@agora-js/media 4.24.4 → 4.24.5

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.24.4-0-gb4d645709-dirty Copyright AgoraInc.
2
+ * AgoraWebSDK_N-v4.24.5-0-g604b18ede-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 u(e,t){i&&console.warn(e+" is deprecated, please use "+t+" instead.")}function d(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e){return d(e)?Object.keys(e).reduce((function(t,r){const i=d(e[r]),n=i?l(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,{[r]:n})}),{}):e}function h(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((i=>{i.endsWith("Id")?h(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((t=>{h(e,e.get(t),r)}))})))}function p(e,t,r){const i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===i&&r.trackId===t.id&&h(e,r,n)}))})),n}const f=c;function E(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const i=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const i="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let e={};"number"==typeof i.ideal?(e[n("min",r)]=i.ideal,t.optional.push(e),e={},e[n("max",r)]=i.ideal,t.optional.push(e)):(e[n("",r)]=i.ideal,t.optional.push(e))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",r)]=i.exact):["min","max"].forEach((e=>{void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,r)]=i[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then((r=>{let s=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&r.length&&t.includes("back")&&(s=r[r.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=i(e.video),f("chrome: "+JSON.stringify(e)),n(e)}))}e.video=i(e.video)}return f("chrome: "+JSON.stringify(e)),n(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,i){n(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{i&&i(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return n(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function m(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function _(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const n=new Event("track");n.track=r.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)})),t.stream.getTracks().forEach((r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const n=new Event("track");n.track=r,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else o(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function T(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){let n=r.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function g(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,i]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const n=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const i=function(e){r(o(n(e)))};return t.apply(this,[i,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(n(t)))},r])})).then(r,i)}}function S(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>p(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),o(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>p(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,i;return this.getSenders().forEach((r=>{r.track===e&&(t?i=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?i=!0:r=t),t.track===e))),i||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function y(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 v(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return y(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 b(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 A=Object.freeze({__proto__:null,fixNegotiationNeeded:b,shimAddTrackRemoveTrack:v,shimAddTrackRemoveTrackWithNative:y,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{const i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))},shimGetSendersWithDtmf:T,shimGetStats:g,shimGetUserMedia:E,shimMediaStream:m,shimOnTrack:_,shimPeerConnection:R,shimSenderReceiverGetStats:S});function O(e,t){const r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){u("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){u("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function P(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function L(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const r=e.length>0;r&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const i=t.apply(this,arguments);if(r){const{sender:t}=i,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(r).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return i})}function k(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function M(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var x=Object.freeze({__proto__:null,shimAddTransceiver:L,shimCreateAnswer:U,shimCreateOffer:M,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})},shimGetParameters:k,shimGetUserMedia: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(W(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function W(e){return e&&void 0!==e.video?Object.assign({},e,{video:l(e.video)}):e}function G(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")?(u("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:W,shimCreateOfferLegacy:K,shimGetUserMedia:j,shimLocalStreamsAPI:V,shimRTCIceServerUrls:G,shimRemoteStreamsAPI:F,shimTrackEventTransceiver:H}),z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function X(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&&void 0!==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 u=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[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 d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=d}))),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=X(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(!A||!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=A,se(e,i),ae(e),E(e,i),m(e),R(e,i),_(e),v(e,i),T(e),g(e),S(e),b(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),L(e),k(e),M(e),U(e),ee(e),ne(e),re(e,i),ie(e);break;case"safari":if(!Z||!t.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=Z,se(e,i),ae(e),G(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 ue={exports:{}};!function(e,t){!function(r,i){var n="function",o="undefined",s="object",a="string",c="major",u="model",d="name",l="type",h="vendor",p="version",f="architecture",E="console",m="mobile",_="tablet",T="smarttv",g="wearable",S="embedded",y="Amazon",v="Apple",R="ASUS",b="BlackBerry",A="Browser",O="Chrome",I="Firefox",C="Google",w="Honor",N="Huawei",D="LG",P="Microsoft",L="Motorola",k="Nvidia",M="OnePlus",U="Opera",x="OPPO",V="Samsung",F="Sharp",B="Sony",j="Xiaomi",W="Zebra",G="Facebook",H="Chromium OS",K="Mac OS",Y=" Browser",Z=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},z=function(e,t){return typeof e===a&&-1!==X(t).indexOf(X(e))},X=function(e){return e.toLowerCase()},J=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,500)},Q=function(e,t){for(var r,o,a,c,u,d,l=0;l<t.length&&!u;){var h=t[l],p=t[l+1];for(r=o=0;r<h.length&&!u&&h[r];)if(u=h[r++].exec(e))for(a=0;a<p.length;a++)d=u[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==n?this[c[0]]=c[1].call(this,d):this[c[0]]=c[1]:3===c.length?typeof c[1]!==n||c[1].exec&&c[1].test?this[c[0]]=d?d.replace(c[1],c[2]):i:this[c[0]]=d?c[1].call(this,d,c[2]):i:4===c.length&&(this[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):i):this[c]=d||i;l+=2}},q=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(z(t[r][n],e))return"?"===r?i:r}else if(z(t[r],e))return"?"===r?i:r;return t.hasOwnProperty("*")?t["*"]:e},$={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"},ee={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[d,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[d,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[d,p],[/opios[\/ ]+([\w\.]+)/i],[p,[d,U+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[p,[d,U+" GX"]],[/\bopr\/([\w\.]+)/i],[p,[d,U]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[p,[d,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[p,[d,"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],[d,p],[/quark(?:pc)?\/([-\w\.]+)/i],[p,[d,"Quark"]],[/\bddg\/([\w\.]+)/i],[p,[d,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[d,"UC"+A]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[p,[d,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[d,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[d,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[p,[d,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[p,[d,"Smart Lenovo "+A]],[/(avast|avg)\/([\w\.]+)/i],[[d,/(.+)/,"$1 Secure "+A],p],[/\bfocus\/([\w\.]+)/i],[p,[d,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[d,U+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[d,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[d,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[d,U+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[d,"MIUI"+Y]],[/fxios\/([\w\.-]+)/i],[p,[d,I]],[/\bqihoobrowser\/?([\w\.]*)/i],[p,[d,"360"]],[/\b(qq)\/([\w\.]+)/i],[[d,/(.+)/,"$1Browser"],p],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[d,/(.+)/,"$1"+Y],p],[/samsungbrowser\/([\w\.]+)/i],[p,[d,V+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[p,[d,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[d,"Sogou Mobile"],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[d,p],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[d],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[p,d],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[d,G],p],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\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],[d,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[d,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[p,[d,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[d,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[d,O+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[d,"Android "+A]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[d,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[d,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,d],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[d,[p,q,{"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],[d,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[d,"Netscape"],p],[/(wolvic|librewolf)\/([\w\.]+)/i],[d,p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[d,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,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[d,[p,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[d,[p,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[f,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[f,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[f,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[f,/ower/,"",X]],[/ sun4\w[;\)]/i],[[f,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[f,X]]],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],[u,[h,V],[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],[u,[h,V],[l,m]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[h,v],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[h,v],[l,_]],[/(macintosh);/i],[u,[h,v]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[h,F],[l,m]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[u,[h,w],[l,_]],[/honor([-\w ]+)[;\)]/i],[u,[h,w],[l,m]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[u,[h,N],[l,_]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[h,N],[l,m]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[u,/_/g," "],[h,j],[l,_]],[/\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,/ ([\w ]+) miui\/v?\d/i],[[u,/_/g," "],[h,j],[l,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[h,x],[l,m]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[u,[h,q,{OnePlus:["304","403","203"],"*":x}],[l,_]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[h,"Vivo"],[l,m]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[u,[h,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[h,L],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[h,L],[l,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[h,D],[l,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[h,D],[l,m]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[u,[h,"Lenovo"],[l,_]],[/(nokia) (t[12][01])/i],[h,u,[l,_]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[u,/_/g," "],[l,m],[h,"Nokia"]],[/(pixel (c|tablet))\b/i],[u,[h,C],[l,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[h,C],[l,m]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[h,B],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[h,B],[l,_]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[h,M],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[h,y],[l,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[h,y],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[u,h,[l,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[h,b],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[h,R],[l,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[h,R],[l,m]],[/(nexus 9)/i],[u,[h,"HTC"],[l,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[u,/_/g," "],[l,m]],[/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],[u,[h,"TCL"],[l,_]],[/(itel) ((\w+))/i],[[h,X],u,[l,q,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[h,"Acer"],[l,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[h,"Meizu"],[l,m]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[u,[h,"Ulefone"],[l,m]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[u,[h,"Energizer"],[l,m]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[u,[h,"Cat"],[l,m]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[u,[h,"Smartfren"],[l,m]],[/droid.+; (a(?:015|06[35]|142p?))/i],[u,[h,"Nothing"],[l,m]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[u,[h,"Archos"],[l,_]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[u,[h,"Archos"],[l,m]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[h,u,[l,_]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[h,u,[l,m]],[/(kobo)\s(ereader|touch)/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,u,[l,_]],[/(surface duo)/i],[u,[h,P],[l,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[h,"Fairphone"],[l,m]],[/(u304aa)/i],[u,[h,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[u,[h,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[u,[h,"RCA"],[l,_]],[/\b(venue[\d ]{2,7}) b/i],[u,[h,"Dell"],[l,_]],[/\b(q(?:mv|ta)\w+) b/i],[u,[h,"Verizon"],[l,_]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[h,"Barnes & Noble"],[l,_]],[/\b(tm\d{3}\w+) b/i],[u,[h,"NuVision"],[l,_]],[/\b(k88) b/i],[u,[h,"ZTE"],[l,_]],[/\b(nx\d{3}j) b/i],[u,[h,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[u,[h,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[u,[h,"Swiss"],[l,_]],[/\b((zeki)?tb.*\b) b/i],[u,[h,"Zeki"],[l,_]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],u,[l,_]],[/\b(ns-?\w{0,9}) b/i],[u,[h,"Insignia"],[l,_]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[h,"NextBook"],[l,_]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],u,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],u,[l,m]],[/\b(ph-1) /i],[u,[h,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[h,"Envizen"],[l,_]],[/\b(trio[-\w\. ]+) b/i],[u,[h,"MachSpeed"],[l,_]],[/\btu_(1491) b/i],[u,[h,"Rotor"],[l,_]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[u,[h,k],[l,_]],[/(sprint) (\w+)/i],[h,u,[l,m]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[h,P],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[h,W],[l,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[h,W],[l,m]],[/smart-tv.+(samsung)/i],[h,[l,T]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[h,V],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,D],[l,T]],[/(apple) ?tv/i],[h,[u,v+" TV"],[l,T]],[/crkey/i],[[u,O+"cast"],[h,C],[l,T]],[/droid.+aft(\w+)( bui|\))/i],[u,[h,y],[l,T]],[/(shield \w+ tv)/i],[u,[h,k],[l,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[h,F],[l,T]],[/(bravia[\w ]+)( bui|\))/i],[u,[h,B],[l,T]],[/(mi(tv|box)-?\w+) bui/i],[u,[h,j],[l,T]],[/Hbbtv.*(technisat) (.*);/i],[h,u,[l,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,J],[u,J],[l,T]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[u,[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,u,[l,E]],[/droid.+; (shield)( bui|\))/i],[u,[h,k],[l,E]],[/(playstation \w+)/i],[u,[h,B],[l,E]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[h,P],[l,E]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[u,[h,V],[l,g]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[h,u,[l,g]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[u,[h,x],[l,g]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[h,v],[l,g]],[/(opwwe\d{3})/i],[u,[h,M],[l,g]],[/(moto 360)/i],[u,[h,L],[l,g]],[/(smartwatch 3)/i],[u,[h,B],[l,g]],[/(g watch r)/i],[u,[h,D],[l,g]],[/droid.+; (wt63?0{2,3})\)/i],[u,[h,W],[l,g]],[/droid.+; (glass) \d/i],[u,[h,C],[l,g]],[/(pico) (4|neo3(?: link|pro)?)/i],[h,u,[l,g]],[/; (quest( \d| pro)?)/i],[u,[h,G],[l,g]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[l,S]],[/(aeobc)\b/i],[u,[h,y],[l,S]],[/(homepod).+mac os/i],[u,[h,v],[l,S]],[/windows iot/i],[[l,S]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[u,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[l,_]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[u,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[d,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[d,p],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[d,"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],[d,p],[/ladybird\//i],[[d,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,d]],os:[[/microsoft (windows) (vista|xp)/i],[d,p],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[d,[p,q,$]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,q,$],[d,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[d,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[d,K],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,d],[/(ubuntu) ([\w\.]+) like android/i],[[d,/(.+)/,"$1 Touch"],p],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[d,p],[/\(bb(10);/i],[p,[d,b]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[p,[d,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[d,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[d,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[d,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[d,O+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[d,H],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)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[d,p],[/(sunos) ?([\w\.\d]*)/i],[[d,"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],[d,p]]},te=function(e,t){if(typeof e===s&&(t=e,e=i),!(this instanceof te))return new te(e,t).getResult();var E=typeof r!==o&&r.navigator?r.navigator:i,T=e||(E&&E.userAgent?E.userAgent:""),g=E&&E.userAgentData?E.userAgentData:i,S=t?function(e,t){var r={};for(var i in e)t[i]&&t[i].length%2==0?r[i]=t[i].concat(e[i]):r[i]=e[i];return r}(ee,t):ee,y=E&&E.userAgent==T;return this.getBrowser=function(){var e={};return e[d]=i,e[p]=i,Q.call(e,T,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i}(e[p]),y&&E&&E.brave&&typeof E.brave.isBrave==n&&(e[d]="Brave"),e},this.getCPU=function(){var e={};return e[f]=i,Q.call(e,T,S.cpu),e},this.getDevice=function(){var e={};return e[h]=i,e[u]=i,e[l]=i,Q.call(e,T,S.device),y&&!e[l]&&g&&g.mobile&&(e[l]=m),y&&"Macintosh"==e[u]&&E&&typeof E.standalone!==o&&E.maxTouchPoints&&E.maxTouchPoints>2&&(e[u]="iPad",e[l]=_),e},this.getEngine=function(){var e={};return e[d]=i,e[p]=i,Q.call(e,T,S.engine),e},this.getOS=function(){var e={};return e[d]=i,e[p]=i,Q.call(e,T,S.os),y&&!e[d]&&g&&g.platform&&"Unknown"!=g.platform&&(e[d]=g.platform.replace(/chrome os/i,H).replace(/macos/i,K)),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?J(e,500):e,this},this.setUA(T),this};te.VERSION="0.7.41",te.BROWSER=Z([d,p,c]),te.CPU=Z([f]),te.DEVICE=Z([u,h,l,E,m,T,_,g,S]),te.ENGINE=te.OS=Z([d,p]),e.exports&&(t=e.exports=te),t.UAParser=te;var re=typeof r!==o&&(r.jQuery||r.Zepto);if(re&&!re.ua){var ie=new te;re.ua=ie.getResult(),re.ua.get=function(){return ie.getUA()},re.ua.set=function(e){ie.setUA(e);var t=ie.getResult();for(var r in t)re.ua[r]=t[r]}}}("object"==typeof window?window:z)}(ue,ue.exports);var de=X(ue.exports);function le(e,t){return function(){return e.apply(t,arguments)}}const{toString:he}=Object.prototype,{getPrototypeOf:pe}=Object,{iterator:fe,toStringTag:Ee}=Symbol,me=(e=>t=>{const r=he.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),_e=e=>(e=e.toLowerCase(),t=>me(t)===e),Te=e=>t=>typeof t===e,{isArray:ge}=Array,Se=Te("undefined");function ye(e){return null!==e&&!Se(e)&&null!==e.constructor&&!Se(e.constructor)&&be(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ve=_e("ArrayBuffer");const Re=Te("string"),be=Te("function"),Ae=Te("number"),Oe=e=>null!==e&&"object"==typeof e,Ie=e=>{if("object"!==me(e))return!1;const t=pe(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Ee in e||fe in e)},Ce=_e("Date"),we=_e("File"),Ne=_e("Blob"),De=_e("FileList");const Pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},Le=void 0!==Pe.FormData?Pe.FormData:void 0,ke=_e("URLSearchParams"),[Me,Ue,xe,Ve]=["ReadableStream","Request","Response","Headers"].map(_e);function Fe(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let i,n;if("object"!=typeof e&&(e=[e]),ge(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{if(ye(e))return;const n=r?Object.getOwnPropertyNames(e):Object.keys(e),o=n.length;let s;for(i=0;i<o;i++)s=n[i],t.call(null,e[s],s,e)}}function Be(e,t){if(ye(e))return null;t=t.toLowerCase();const r=Object.keys(e);let i,n=r.length;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const je="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,We=e=>!Se(e)&&e!==je;const Ge=(He="undefined"!=typeof Uint8Array&&pe(Uint8Array),e=>He&&e instanceof He);var He;const Ke=_e("HTMLFormElement"),Ye=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ze=_e("RegExp"),ze=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),i={};Fe(r,((r,n)=>{let o;!1!==(o=t(r,n,e))&&(i[n]=o||r)})),Object.defineProperties(e,i)};const Xe=_e("AsyncFunction"),Je=(Qe="function"==typeof setImmediate,qe=be(je.postMessage),Qe?setImmediate:qe?($e=`axios@${Math.random()}`,et=[],je.addEventListener("message",(({source:e,data:t})=>{e===je&&t===$e&&et.length&&et.shift()()}),!1),e=>{et.push(e),je.postMessage($e,"*")}):e=>setTimeout(e));var Qe,qe,$e,et;const tt="undefined"!=typeof queueMicrotask?queueMicrotask.bind(je):"undefined"!=typeof process&&process.nextTick||Je;var rt={isArray:ge,isArrayBuffer:ve,isBuffer:ye,isFormData:e=>{if(!e)return!1;if(Le&&e instanceof Le)return!0;const t=pe(e);if(!t||t===Object.prototype)return!1;if(!be(e.append))return!1;const r=me(e);return"formdata"===r||"object"===r&&be(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:Oe,isPlainObject:Ie,isEmptyObject:e=>{if(!Oe(e)||ye(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Me,isRequest:Ue,isResponse:xe,isHeaders:Ve,isUndefined:Se,isDate:Ce,isFile:we,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Ne,isRegExp:Ze,isFunction:be,isStream:e=>Oe(e)&&be(e.pipe),isURLSearchParams:ke,isTypedArray:Ge,isFileList:De,forEach:Fe,merge:function e(...t){const{caseless:r,skipUndefined:i}=We(this)&&this||{},n={},o=(t,o)=>{if("__proto__"===o||"constructor"===o||"prototype"===o)return;const s=r&&Be(n,o)||o,a=Ye(n,s)?n[s]:void 0;Ie(a)&&Ie(t)?n[s]=e(a,t):Ie(t)?n[s]=e({},t):ge(t)?n[s]=t.slice():i&&Se(t)||(n[s]=t)};for(let e=0,r=t.length;e<r;e++)t[e]&&Fe(t[e],o);return n},extend:(e,t,r,{allOwnKeys:i}={})=>(Fe(t,((t,i)=>{r&&be(t)?Object.defineProperty(e,i,{__proto__:null,value:le(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})}),{allOwnKeys:i}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,i)=>{let n,o,s;const a={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),o=n.length;o-- >0;)s=n[o],i&&!i(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==r&&pe(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:me,kindOfTest:_e,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const i=e.indexOf(t,r);return-1!==i&&i===r},toArray:e=>{if(!e)return null;if(ge(e))return e;let t=e.length;if(!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:Ke,hasOwnProperty:Ye,hasOwnProp:Ye,reduceDescriptors:ze,freezeMethods:e=>{ze(e,((t,r)=>{if(be(e)&&["arguments","caller","callee"].includes(r))return!1;const i=e[r];be(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},i=e=>{e.forEach((e=>{r[e]=!0}))};return ge(e)?i(e):i(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Be,global:je,isContextDefined:We,isSpecCompliantForm:function(e){return!!(e&&be(e.append)&&"FormData"===e[Ee]&&e[fe])},toJSONObject:e=>{const t=new WeakSet,r=e=>{if(Oe(e)){if(t.has(e))return;if(ye(e))return e;if(!("toJSON"in e)){t.add(e);const i=ge(e)?[]:{};return Fe(e,((e,t)=>{const n=r(e);!Se(n)&&(i[t]=n)})),t.delete(e),i}}return e};return r(e)},isAsyncFn:Xe,isThenable:e=>e&&(Oe(e)||be(e))&&be(e.then)&&be(e.catch),setImmediate:Je,asap:tt,isIterable:e=>null!=e&&be(e[fe])};const it=rt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const nt=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ot=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function st(e,t){return rt.isArray(e)?e.map((e=>st(e,t))):function(e){let t=0,r=e.length;for(;t<r;){const r=e.charCodeAt(t);if(9!==r&&32!==r)break;t+=1}for(;r>t;){const t=e.charCodeAt(r-1);if(9!==t&&32!==t)break;r-=1}return 0===t&&r===e.length?e:e.slice(t,r)}(String(e).replace(t,""))}const at=e=>st(e,nt),ct=e=>st(e,ot);function ut(e){const t=Object.create(null);return rt.forEach(e.toJSON(),((e,r)=>{t[r]=ct(e)})),t}const dt=Symbol("internals");function lt(e){return e&&String(e).trim().toLowerCase()}function ht(e){return!1===e||null==e?e:rt.isArray(e)?e.map(ht):at(String(e))}function pt(e,t,r,i,n){return rt.isFunction(i)?i.call(this,t,r):(n&&(t=r),rt.isString(t)?rt.isString(i)?-1!==t.indexOf(i):rt.isRegExp(i)?i.test(t):void 0:void 0)}class ft{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function n(e,t,r){const n=lt(t);if(!n)throw new Error("header name must be a non-empty string");const o=rt.findKey(i,n);(!o||void 0===i[o]||!0===r||void 0===r&&!1!==i[o])&&(i[o||t]=ht(e))}const o=(e,t)=>rt.forEach(e,((e,r)=>n(e,r,t)));if(rt.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(rt.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,i,n;return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),r=e.substring(0,n).trim().toLowerCase(),i=e.substring(n+1).trim(),!r||t[r]&&it[r]||("set-cookie"===r?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)})),t})(e),t);else if(rt.isObject(e)&&rt.isIterable(e)){let r,i,n={};for(const t of e){if(!rt.isArray(t))throw TypeError("Object iterator must return a key-value pair");n[i=t[0]]=(r=n[i])?rt.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(n,t)}else null!=e&&n(t,e,r);return this}get(e,t){if(e=lt(e)){const r=rt.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}(e);if(rt.isFunction(t))return t.call(this,e,r);if(rt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=lt(e)){const r=rt.findKey(this,e);return!(!r||void 0===this[r]||t&&!pt(0,this[r],r,t))}return!1}delete(e,t){const r=this;let i=!1;function n(e){if(e=lt(e)){const n=rt.findKey(r,e);!n||t&&!pt(0,r[n],n,t)||(delete r[n],i=!0)}}return rt.isArray(e)?e.forEach(n):n(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const n=t[r];e&&!pt(0,this[n],n,e,!0)||(delete this[n],i=!0)}return i}normalize(e){const t=this,r={};return rt.forEach(this,((i,n)=>{const o=rt.findKey(r,n);if(o)return t[o]=ht(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]=ht(i),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return rt.forEach(this,((r,i)=>{null!=r&&!1!==r&&(t[i]=e&&rt.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[dt]=this[dt]={accessors:{}}).accessors,r=this.prototype;function i(e){const i=lt(e);t[i]||(!function(e,t){const r=rt.toCamelCase(" "+t);["get","set","has"].forEach((i=>{Object.defineProperty(e,i+r,{__proto__:null,value:function(e,r,n){return this[i].call(this,t,e,r,n)},configurable:!0})}))}(r,e),t[i]=!0)}return rt.isArray(e)?e.forEach(i):i(e),this}}ft.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),rt.reduceDescriptors(ft.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),rt.freezeMethods(ft);var Et=ft;const mt="[REDACTED ****]";function _t(e,t){const r=new Set(t.map((e=>String(e).toLowerCase()))),i=[],n=e=>{if(null===e||"object"!=typeof e)return e;if(rt.isBuffer(e))return e;if(-1!==i.indexOf(e))return;let t;if(e instanceof Et&&(e=e.toJSON()),i.push(e),rt.isArray(e))t=[],e.forEach(((e,r)=>{const i=n(e);rt.isUndefined(i)||(t[r]=i)}));else{if(!rt.isPlainObject(e)&&function(e){if(rt.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(rt.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return i.pop(),e;t=Object.create(null);for(const[i,o]of Object.entries(e)){const e=r.has(i.toLowerCase())?mt:n(o);rt.isUndefined(e)||(t[i]=e)}}return i.pop(),t};return n(e)}class Tt extends Error{static from(e,t,r,i,n,o){const s=new Tt(e.message,t||e.code,r,i,n);return s.cause=e,s.name=e.name,null!=e.status&&null==s.status&&(s.status=e.status),o&&Object.assign(s,o),s}constructor(e,t,r,i,n){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status)}toJSON(){const e=this.config,t=e&&rt.hasOwnProp(e,"redact")?e.redact:void 0,r=rt.isArray(t)&&t.length>0?_t(e,t):rt.toJSONObject(e);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:r,code:this.code,status:this.status}}}Tt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Tt.ERR_BAD_OPTION="ERR_BAD_OPTION",Tt.ECONNABORTED="ECONNABORTED",Tt.ETIMEDOUT="ETIMEDOUT",Tt.ECONNREFUSED="ECONNREFUSED",Tt.ERR_NETWORK="ERR_NETWORK",Tt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Tt.ERR_DEPRECATED="ERR_DEPRECATED",Tt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Tt.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Tt.ERR_CANCELED="ERR_CANCELED",Tt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Tt.ERR_INVALID_URL="ERR_INVALID_URL",Tt.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";var gt=Tt;function St(e){return rt.isPlainObject(e)||rt.isArray(e)}function yt(e){return rt.endsWith(e,"[]")?e.slice(0,-2):e}function vt(e,t,r){return e?e.concat(t).map((function(e,t){return e=yt(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const Rt=rt.toFlatObject(rt,{},null,(function(e){return/^is[A-Z]/.test(e)}));function bt(e,t,r){if(!rt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const i=(r=rt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!rt.isUndefined(t[e])}))).metaTokens,n=r.visitor||l,o=r.dots,s=r.indexes,a=r.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===r.maxDepth?100:r.maxDepth,u=a&&rt.isSpecCompliantForm(t);if(!rt.isFunction(n))throw new TypeError("visitor must be a function");function d(e){if(null===e)return"";if(rt.isDate(e))return e.toISOString();if(rt.isBoolean(e))return e.toString();if(!u&&rt.isBlob(e))throw new gt("Blob is not supported. Use a Buffer instead.");return rt.isArrayBuffer(e)||rt.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,n){let a=e;if(rt.isReactNative(t)&&rt.isReactNativeBlob(e))return t.append(vt(n,r,o),d(e)),!1;if(e&&!n&&"object"==typeof e)if(rt.endsWith(r,"{}"))r=i?r:r.slice(0,-2),e=JSON.stringify(e);else if(rt.isArray(e)&&function(e){return rt.isArray(e)&&!e.some(St)}(e)||(rt.isFileList(e)||rt.endsWith(r,"[]"))&&(a=rt.toArray(e)))return r=yt(r),a.forEach((function(e,i){!rt.isUndefined(e)&&null!==e&&t.append(!0===s?vt([r],i,o):null===s?r:r+"[]",d(e))})),!1;return!!St(e)||(t.append(vt(n,r,o),d(e)),!1)}const h=[],p=Object.assign(Rt,{defaultVisitor:l,convertValue:d,isVisitable:St});if(!rt.isObject(e))throw new TypeError("data must be an object");return function e(r,i,o=0){if(!rt.isUndefined(r)){if(o>c)throw new gt("Object is too deeply nested ("+o+" levels). Max depth: "+c,gt.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==h.indexOf(r))throw Error("Circular reference detected in "+i.join("."));h.push(r),rt.forEach(r,(function(r,s){!0===(!(rt.isUndefined(r)||null===r)&&n.call(t,r,rt.isString(s)?s.trim():s,i,p))&&e(r,i?i.concat(s):[s],o+1)})),h.pop()}}(e),t}function At(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,(function(e){return t[e]}))}function Ot(e,t){this._pairs=[],e&&bt(e,this,t)}const It=Ot.prototype;function Ct(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function wt(e,t,r){if(!t)return e;const i=r&&r.encode||Ct,n=rt.isFunction(r)?{serialize:r}:r,o=n&&n.serialize;let s;if(s=o?o(t,n):rt.isURLSearchParams(t)?t.toString():new Ot(t,n).toString(i),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}It.append=function(e,t){this._pairs.push([e,t])},It.toString=function(e){const t=e?function(t){return e.call(this,t,At)}:At;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Nt=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){rt.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Dt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Pt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ot,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Lt="undefined"!=typeof window&&"undefined"!=typeof document,kt="object"==typeof navigator&&navigator||void 0,Mt=Lt&&(!kt||["ReactNative","NativeScript","NS"].indexOf(kt.product)<0),Ut="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,xt=Lt&&window.location.href||"http://localhost";var Vt={...Object.freeze({__proto__:null,hasBrowserEnv:Lt,hasStandardBrowserEnv:Mt,hasStandardBrowserWebWorkerEnv:Ut,navigator:kt,origin:xt}),...Pt};function Ft(e){function t(e,r,i,n){let o=e[n++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=n>=e.length;if(o=!o&&rt.isArray(i)?i.length:o,a)return rt.hasOwnProp(i,o)?i[o]=rt.isArray(i[o])?i[o].concat(r):[i[o],r]:i[o]=r,!s;rt.hasOwnProp(i,o)&&rt.isObject(i[o])||(i[o]=[]);return t(e,r,i[o],n)&&rt.isArray(i[o])&&(i[o]=function(e){const t={},r=Object.keys(e);let i;const n=r.length;let o;for(i=0;i<n;i++)o=r[i],t[o]=e[o];return t}(i[o])),!s}if(rt.isFormData(e)&&rt.isFunction(e.entries)){const r={};return rt.forEachEntry(e,((e,i)=>{t(function(e){return rt.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,r,0)})),r}return null}const Bt=(e,t)=>null!=e&&rt.hasOwnProp(e,t)?e[t]:void 0;const jt={transitional:Dt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,n=rt.isObject(e);n&&rt.isHTMLForm(e)&&(e=new FormData(e));if(rt.isFormData(e))return i?JSON.stringify(Ft(e)):e;if(rt.isArrayBuffer(e)||rt.isBuffer(e)||rt.isStream(e)||rt.isFile(e)||rt.isBlob(e)||rt.isReadableStream(e))return e;if(rt.isArrayBufferView(e))return e.buffer;if(rt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){const t=Bt(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return bt(e,new Vt.classes.URLSearchParams,{visitor:function(e,t,r,i){return Vt.isNode&&rt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((o=rt.isFileList(e))||r.indexOf("multipart/form-data")>-1){const r=Bt(this,"env"),i=r&&r.FormData;return bt(o?{"files[]":e}:e,i&&new i,t)}}return n||i?(t.setContentType("application/json",!1),function(e,t,r){if(rt.isString(e))try{return(t||JSON.parse)(e),rt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Bt(this,"transitional")||jt.transitional,r=t&&t.forcedJSONParsing,i=Bt(this,"responseType"),n="json"===i;if(rt.isResponse(e)||rt.isReadableStream(e))return e;if(e&&rt.isString(e)&&(r&&!i||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e,Bt(this,"parseReviver"))}catch(e){if(r){if("SyntaxError"===e.name)throw gt.from(e,gt.ERR_BAD_RESPONSE,this,null,Bt(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Vt.classes.FormData,Blob:Vt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};rt.forEach(["delete","get","head","post","put","patch","query"],(e=>{jt.headers[e]={}}));var Wt=jt;function Gt(e,t){const r=this||Wt,i=t||r,n=Et.from(i.headers);let o=i.data;return rt.forEach(e,(function(e){o=e.call(r,o,n.normalize(),t?t.status:void 0)})),n.normalize(),o}function Ht(e){return!(!e||!e.__CANCEL__)}var Kt=class extends gt{constructor(e,t,r){super(null==e?"canceled":e,gt.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function Yt(e,t,r){const i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(new gt("Request failed with status code "+r.status,r.status>=400&&r.status<500?gt.ERR_BAD_REQUEST:gt.ERR_BAD_RESPONSE,r.config,r.request,r)):e(r)}const Zt=(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(),u=i[s];n||(n=c),r[o]=a,i[o]=c;let d=s,l=0;for(;d!==o;)l+=r[d++],d%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-n<t)return;const h=u&&c-u;return h?Math.round(1e3*l/h):void 0}}(50,250);return function(e,t){let r,i,n=0,o=1e3/t;const s=(t,o=Date.now())=>{n=o,r=null,i&&(clearTimeout(i),i=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-n;a>=o?s(e,t):(r=e,i||(i=setTimeout((()=>{i=null,s(r)}),o-a)))},()=>r&&s(r)]}((r=>{if(!r||"number"!=typeof r.loaded)return;const o=r.loaded,s=r.lengthComputable?r.total:void 0,a=null!=s?Math.min(o,s):o,c=Math.max(0,a-i),u=n(c);i=Math.max(i,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:c,rate:u||void 0,estimated:u&&s?(s-a)/u:void 0,event:r,lengthComputable:null!=s,[t?"download":"upload"]:!0})}),r)},zt=(e,t)=>{const r=null!=e;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},Xt=e=>(...t)=>rt.asap((()=>e(...t)));var Jt=Vt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Vt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Vt.origin),Vt.navigator&&/(msie|trident)/i.test(Vt.navigator.userAgent)):()=>!0,Qt=Vt.hasStandardBrowserEnv?{write(e,t,r,i,n,o,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];rt.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),rt.isString(i)&&a.push(`path=${i}`),rt.isString(n)&&a.push(`domain=${n}`),!0===o&&a.push("secure"),rt.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const i=t[r].replace(/^\s+/,""),n=i.indexOf("=");if(-1!==n&&i.slice(0,n)===e)return decodeURIComponent(i.slice(n+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function qt(e,t,r){let i=!function(e){return"string"==typeof e&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(i||!1===r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const $t=e=>e instanceof Et?{...e}:e;function er(e,t){t=t||{};const r=Object.create(null);function i(e,t,r,i){return rt.isPlainObject(e)&&rt.isPlainObject(t)?rt.merge.call({caseless:i},e,t):rt.isPlainObject(t)?rt.merge({},t):rt.isArray(t)?t.slice():t}function n(e,t,r,n){return rt.isUndefined(t)?rt.isUndefined(e)?void 0:i(void 0,e,0,n):i(e,t,0,n)}function o(e,t){if(!rt.isUndefined(t))return i(void 0,t)}function s(e,t){return rt.isUndefined(t)?rt.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function a(r,n,o){return rt.hasOwnProp(t,o)?i(r,n):rt.hasOwnProp(e,o)?i(void 0,r):void 0}Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!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,allowedSocketPaths:s,responseEncoding:s,validateStatus:a,headers:(e,t,r)=>n($t(e),$t(t),0,!0)};return rt.forEach(Object.keys({...e,...t}),(function(i){if("__proto__"===i||"constructor"===i||"prototype"===i)return;const o=rt.hasOwnProp(c,i)?c[i]:n,s=o(rt.hasOwnProp(e,i)?e[i]:void 0,rt.hasOwnProp(t,i)?t[i]:void 0,i);rt.isUndefined(s)&&o!==a||(r[i]=s)})),r}const tr=["content-type","content-length"];var rr=e=>{const t=er({},e),r=e=>rt.hasOwnProp(t,e)?t[e]:void 0,i=r("data");let n=r("withXSRFToken");const o=r("xsrfHeaderName"),s=r("xsrfCookieName");let a=r("headers");const c=r("auth"),u=r("baseURL"),d=r("allowAbsoluteUrls"),l=r("url");var h;if(t.headers=a=Et.from(a),t.url=wt(qt(u,l,d),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(h=c.password,encodeURIComponent(h).replace(/%([0-9A-F]{2})/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))):""))),rt.isFormData(i)&&(Vt.hasStandardBrowserEnv||Vt.hasStandardBrowserWebWorkerEnv?a.setContentType(void 0):rt.isFunction(i.getHeaders)&&function(e,t,r){"content-only"===r?Object.entries(t).forEach((([t,r])=>{tr.includes(t.toLowerCase())&&e.set(t,r)})):e.set(t)}(a,i.getHeaders(),r("formDataHeaderPolicy"))),Vt.hasStandardBrowserEnv){rt.isFunction(n)&&(n=n(t));if(!0===n||null==n&&Jt(t.url)){const e=o&&s&&Qt.read(s);e&&a.set(o,e)}}return t};var ir="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const i=rr(e);let n=i.data;const o=Et.from(i.headers).normalize();let s,a,c,u,d,{responseType:l,onUploadProgress:h,onDownloadProgress:p}=i;function f(){u&&u(),d&&d(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let E=new XMLHttpRequest;function m(){if(!E)return;const i=Et.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders());Yt((function(e){t(e),f()}),(function(e){r(e),f()}),{data:l&&"text"!==l&&"json"!==l?E.response:E.responseText,status:E.status,statusText:E.statusText,headers:i,config:e,request:E}),E=null}E.open(i.method.toUpperCase(),i.url,!0),E.timeout=i.timeout,"onloadend"in E?E.onloadend=m:E.onreadystatechange=function(){E&&4===E.readyState&&(0!==E.status||E.responseURL&&E.responseURL.startsWith("file:"))&&setTimeout(m)},E.onabort=function(){E&&(r(new gt("Request aborted",gt.ECONNABORTED,e,E)),f(),E=null)},E.onerror=function(t){const i=t&&t.message?t.message:"Network Error",n=new gt(i,gt.ERR_NETWORK,e,E);n.event=t||null,r(n),f(),E=null},E.ontimeout=function(){let t=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const n=i.transitional||Dt;i.timeoutErrorMessage&&(t=i.timeoutErrorMessage),r(new gt(t,n.clarifyTimeoutError?gt.ETIMEDOUT:gt.ECONNABORTED,e,E)),f(),E=null},void 0===n&&o.setContentType(null),"setRequestHeader"in E&&rt.forEach(ut(o),(function(e,t){E.setRequestHeader(t,e)})),rt.isUndefined(i.withCredentials)||(E.withCredentials=!!i.withCredentials),l&&"json"!==l&&(E.responseType=i.responseType),p&&([c,d]=Zt(p,!0),E.addEventListener("progress",c)),h&&E.upload&&([a,u]=Zt(h),E.upload.addEventListener("progress",a),E.upload.addEventListener("loadend",u)),(i.cancelToken||i.signal)&&(s=t=>{E&&(r(!t||t.type?new Kt(null,e,E):t),E.abort(),f(),E=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));const _=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(i.url);!_||Vt.protocols.includes(_)?E.send(n||null):r(new gt("Unsupported protocol "+_+":",gt.ERR_BAD_REQUEST,e))}))};var nr=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let i=!1;const n=function(e){if(!i){i=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof gt?t:new Kt(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,n(new gt(`timeout of ${t}ms exceeded`,gt.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}=r;return a.unsubscribe=()=>rt.asap(s),a};const or=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},sr=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()}},ar=(e,t,r,i)=>{const n=async function*(e,t){for await(const r of sr(e))yield*or(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})};const cr="1.16.1",{isFunction:ur}=rt,dr=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},lr=e=>{const t=void 0!==rt.global&&null!==rt.global?rt.global:globalThis,{ReadableStream:r,TextEncoder:i}=t;e=rt.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:n,Request:o,Response:s}=e,a=n?ur(n):"function"==typeof fetch,c=ur(o),u=ur(s);if(!a)return!1;const d=a&&ur(r),l=a&&("function"==typeof i?(h=new i,e=>h.encode(e)):async e=>new Uint8Array(await new o(e).arrayBuffer()));var h;const p=c&&d&&dr((()=>{let e=!1;const t=new o(Vt.origin,{body:new r,method:"POST",get duplex(){return e=!0,"half"}}),i=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!i})),f=u&&d&&dr((()=>rt.isReadableStream(new s("").body))),E={stream:f&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!E[e]&&(E[e]=(t,r)=>{let i=t&&t[e];if(i)return i.call(t);throw new gt(`Response type '${e}' is not supported`,gt.ERR_NOT_SUPPORT,r)})}));const m=async(e,t)=>{const r=rt.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(rt.isBlob(e))return e.size;if(rt.isSpecCompliantForm(e)){const t=new o(Vt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return rt.isArrayBufferView(e)||rt.isArrayBuffer(e)?e.byteLength:(rt.isURLSearchParams(e)&&(e+=""),rt.isString(e)?(await l(e)).byteLength:void 0)})(t):r};return async e=>{let{url:t,method:r,data:a,signal:u,cancelToken:d,timeout:l,onDownloadProgress:h,onUploadProgress:_,responseType:T,headers:g,withCredentials:S="same-origin",fetchOptions:y,maxContentLength:v,maxBodyLength:R}=rr(e);const b=rt.isNumber(v)&&v>-1,A=rt.isNumber(R)&&R>-1;let O=n||fetch;T=T?(T+"").toLowerCase():"text";let I=nr([u,d&&d.toAbortSignal()],l),C=null;const w=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let N;try{if(b&&"string"==typeof t&&t.startsWith("data:")){const r=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),i=e.slice(t+1);if(/;base64/i.test(r)){let e=i.length;const t=i.length;for(let r=0;r<t;r++)if(37===i.charCodeAt(r)&&r+2<t){const t=i.charCodeAt(r+1),n=i.charCodeAt(r+2);(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102)&&(e-=2,r+=2)}let r=0,n=t-1;const o=e=>e>=2&&37===i.charCodeAt(e-2)&&51===i.charCodeAt(e-1)&&(68===i.charCodeAt(e)||100===i.charCodeAt(e));n>=0&&(61===i.charCodeAt(n)?(r++,n--):o(n)&&(r++,n-=3)),1===r&&n>=0&&(61===i.charCodeAt(n)||o(n))&&r++;const s=3*Math.floor(e/4)-(r||0);return s>0?s:0}if("undefined"!=typeof Buffer&&"function"==typeof Buffer.byteLength)return Buffer.byteLength(i,"utf8");let n=0;for(let e=0,t=i.length;e<t;e++){const r=i.charCodeAt(e);if(r<128)n+=1;else if(r<2048)n+=2;else if(r>=55296&&r<=56319&&e+1<t){const t=i.charCodeAt(e+1);t>=56320&&t<=57343?(n+=4,e++):n+=3}else n+=3}return n}(t);if(r>v)throw new gt("maxContentLength size of "+v+" exceeded",gt.ERR_BAD_RESPONSE,e,C)}if(A&&"get"!==r&&"head"!==r){const t=await m(g,a);if("number"==typeof t&&isFinite(t)&&t>R)throw new gt("Request body larger than maxBodyLength limit",gt.ERR_BAD_REQUEST,e,C)}if(_&&p&&"get"!==r&&"head"!==r&&0!==(N=await m(g,a))){let e,r=new o(t,{method:"POST",body:a,duplex:"half"});if(rt.isFormData(a)&&(e=r.headers.get("content-type"))&&g.setContentType(e),r.body){const[e,t]=zt(N,Zt(Xt(_)));a=ar(r.body,65536,e,t)}}rt.isString(S)||(S=S?"include":"omit");const n=c&&"credentials"in o.prototype;if(rt.isFormData(a)){const e=g.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&g.delete("content-type")}g.set("User-Agent","axios/"+cr,!1);const u={...y,signal:I,method:r.toUpperCase(),headers:ut(g.normalize()),body:a,duplex:"half",credentials:n?S:void 0};C=c&&new o(t,u);let d=await(c?O(C,y):O(t,u));if(b){const t=rt.toFiniteNumber(d.headers.get("content-length"));if(null!=t&&t>v)throw new gt("maxContentLength size of "+v+" exceeded",gt.ERR_BAD_RESPONSE,e,C)}const l=f&&("stream"===T||"response"===T);if(f&&d.body&&(h||b||l&&w)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=d[e]}));const r=rt.toFiniteNumber(d.headers.get("content-length")),[i,n]=h&&zt(r,Zt(Xt(h),!0))||[];let o=0;const a=t=>{if(b&&(o=t,o>v))throw new gt("maxContentLength size of "+v+" exceeded",gt.ERR_BAD_RESPONSE,e,C);i&&i(t)};d=new s(ar(d.body,65536,a,(()=>{n&&n(),w&&w()})),t)}T=T||"text";let D=await E[rt.findKey(E,T)||"text"](d,e);if(b&&!f&&!l){let t;if(null!=D&&("number"==typeof D.byteLength?t=D.byteLength:"number"==typeof D.size?t=D.size:"string"==typeof D&&(t="function"==typeof i?(new i).encode(D).byteLength:D.length)),"number"==typeof t&&t>v)throw new gt("maxContentLength size of "+v+" exceeded",gt.ERR_BAD_RESPONSE,e,C)}return!l&&w&&w(),await new Promise(((t,r)=>{Yt(t,r,{data:D,headers:Et.from(d.headers),status:d.status,statusText:d.statusText,config:e,request:C})}))}catch(t){if(w&&w(),I&&I.aborted&&I.reason instanceof gt){const r=I.reason;throw r.config=e,C&&(r.request=C),t!==r&&(r.cause=t),r}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new gt("Network Error",gt.ERR_NETWORK,e,C,t&&t.response),{cause:t.cause||t});throw gt.from(t,t&&t.code,e,C,t&&t.response)}}},hr=new Map,pr=e=>{let t=e&&e.env||{};const{fetch:r,Request:i,Response:n}=t,o=[i,n,r];let s,a,c=o.length,u=hr;for(;c--;)s=o[c],a=u.get(s),void 0===a&&u.set(s,a=c?new Map:lr(t)),u=a;return a};pr();const fr={http:null,xhr:ir,fetch:{get:pr}};rt.forEach(fr,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}}));const Er=e=>`- ${e}`,mr=e=>rt.isFunction(e)||null===e||!1===e;var _r={getAdapter:function(e,t){e=rt.isArray(e)?e:[e];const{length:r}=e;let i,n;const o={};for(let s=0;s<r;s++){let r;if(i=e[s],n=i,!mr(i)&&(n=fr[(r=String(i)).toLowerCase()],void 0===n))throw new gt(`Unknown adapter '${r}'`);if(n&&(rt.isFunction(n)||(n=n.get(t))))break;o[r||"#"+s]=n}if(!n){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));let t=r?e.length>1?"since :\n"+e.map(Er).join("\n"):" "+Er(e[0]):"as no adapter specified";throw new gt("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return n},adapters:fr};function Tr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Kt(null,e)}function gr(e){Tr(e),e.headers=Et.from(e.headers),e.data=Gt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return _r.getAdapter(e.adapter||Wt.adapter,e)(e).then((function(t){Tr(e),e.response=t;try{t.data=Gt.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=Et.from(t.headers),t}),(function(t){if(!Ht(t)&&(Tr(e),t&&t.response)){e.response=t.response;try{t.response.data=Gt.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=Et.from(t.response.headers)}return Promise.reject(t)}))}const Sr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Sr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const yr={};Sr.transitional=function(e,t,r){function i(e,t){return"[Axios v"+cr+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,o)=>{if(!1===e)throw new gt(i(n," has been removed"+(t?" in "+t:"")),gt.ERR_DEPRECATED);return t&&!yr[n]&&(yr[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)}},Sr.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var vr={assertOptions:function(e,t,r){if("object"!=typeof e)throw new gt("options must be an object",gt.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let n=i.length;for(;n-- >0;){const o=i[n],s=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new gt("option "+o+" must be "+r,gt.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new gt("Unknown option "+o,gt.ERR_BAD_OPTION)}},validators:Sr};const Rr=vr.validators;let br=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Nt,response:new Nt}}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=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(r){const t=r.indexOf("\n"),i=-1===t?-1:r.indexOf("\n",t+1),n=-1===i?"":r.slice(i+1);String(e.stack).endsWith(n)||(e.stack+="\n"+r)}}else e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=er(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:n}=t;void 0!==r&&vr.assertOptions(r,{silentJSONParsing:Rr.transitional(Rr.boolean),forcedJSONParsing:Rr.transitional(Rr.boolean),clarifyTimeoutError:Rr.transitional(Rr.boolean),legacyInterceptorReqResOrdering:Rr.transitional(Rr.boolean)},!1),null!=i&&(rt.isFunction(i)?t.paramsSerializer={serialize:i}:vr.assertOptions(i,{encode:Rr.function,serialize:Rr.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),vr.assertOptions(t,{baseUrl:Rr.spelling("baseURL"),withXsrfToken:Rr.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=n&&rt.merge(n.common,n[t.method]);n&&rt.forEach(["delete","get","head","post","put","patch","query","common"],(e=>{delete n[e]})),t.headers=Et.concat(o,n);const s=[];let a=!0;this.interceptors.request.forEach((function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const r=t.transitional||Dt;r&&r.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let d,l=0;if(!a){const e=[gr.bind(this),void 0];for(e.unshift(...s),e.push(...c),d=e.length,u=Promise.resolve(t);l<d;)u=u.then(e[l++],e[l++]);return u}d=s.length;let h=t;for(;l<d;){const e=s[l++],t=s[l++];try{h=e(h)}catch(e){t.call(this,e);break}}try{u=gr.call(this,h)}catch(e){return Promise.reject(e)}for(l=0,d=c.length;l<d;)u=u.then(c[l++],c[l++]);return u}getUri(e){return wt(qt((e=er(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};rt.forEach(["delete","get","head","options"],(function(e){br.prototype[e]=function(t,r){return this.request(er(r||{},{method:e,url:t,data:(r||{}).data}))}})),rt.forEach(["post","put","patch","query"],(function(e){function t(t){return function(r,i,n){return this.request(er(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}br.prototype[e]=t(),"query"!==e&&(br.prototype[e+"Form"]=t(!0))}));var Ar=br;class Or{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const i=new Promise((e=>{r.subscribe(e),t=e})).then(e);return i.cancel=function(){r.unsubscribe(t)},i},e((function(e,i,n){r.reason||(r.reason=new Kt(e,i,n),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Or((function(t){e=t})),cancel:e}}}var Ir=Or;const Cr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Cr).forEach((([e,t])=>{Cr[t]=e}));var wr=Cr;const Nr=function e(t){const r=new Ar(t),i=le(Ar.prototype.request,r);return rt.extend(i,Ar.prototype,r,{allOwnKeys:!0}),rt.extend(i,r,null,{allOwnKeys:!0}),i.create=function(r){return e(er(t,r))},i}(Wt);Nr.Axios=Ar,Nr.CanceledError=Kt,Nr.CancelToken=Ir,Nr.isCancel=Ht,Nr.VERSION=cr,Nr.toFormData=bt,Nr.AxiosError=gt,Nr.Cancel=Nr.CanceledError,Nr.all=function(e){return Promise.all(e)},Nr.spread=function(e){return function(t){return e.apply(null,t)}},Nr.isAxiosError=function(e){return rt.isObject(e)&&!0===e.isAxiosError},Nr.mergeConfig=er,Nr.AxiosHeaders=Et,Nr.formToJSON=e=>Ft(rt.isHTMLForm(e)?new FormData(e):e),Nr.getAdapter=_r.getAdapter,Nr.HttpStatusCode=wr,Nr.default=Nr;var Dr=Nr;let Pr=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}({}),Lr=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 kr=new de;let Mr=kr.getResult(),Ur=null;function xr(e){if(!Ur){e&&kr.setUA(e),Mr=kr.getResult();const t=function(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return Lr.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return Lr.CHROME;case"Safari":case"Mobile Safari":return Lr.SAFARI;case"Edge":return Lr.EDGE;case"Firefox":return Lr.FIREFOX;case"QQ":case"QQBrowser":return Lr.QQ;case"Opera":return Lr.OPERA;case"WeChat":return Lr.WECHAT;default:return e.browser.name||""}}(Mr),r=Vr(Mr),i=function(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}(Mr),n=Mr.os.version,o=Vr(Mr,!1),s=Mr.device.type;if(!(t&&r&&i&&n))return{name:t,version:r,os:i,osVersion:n,browserVersion:o,deviceType:s};Ur={name:t,version:r,os:i,osVersion:n,browserVersion:o,deviceType:s}}return Ur}function Vr(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 Fr(){return xr().os}function Br(){const e=xr();return"".concat(e.os," ").concat(e.osVersion)}function jr(){const e=xr();return!!("WebKit"===Mr.engine.name&&e.os===Pr.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==Lr.SAFARI||Yr()&&e.name!==Lr.SAFARI)}function Wr(){return xr().name===Lr.CHROME}function Gr(){return xr().name===Lr.SAFARI}function Hr(){return xr().name===Lr.EDGE}function Kr(){return xr().name===Lr.FIREFOX}function Yr(){return xr().os===Pr.IOS}function Zr(e){const t=xr();return!(t.name!==Lr.CHROME||!t.osVersion)&&Number(t.version)>=e}function zr(e,t,r){const i=xr();return!(i.name!==e||!i.osVersion)&&(r?Number(i.version)>=t&&Number(i.version)<=r:Number(i.version)===t)}function Xr(e){const t=xr();return!(t.name!==Lr.EDGE||!t.osVersion)&&Number(t.version)>=e}function Jr(e){const t=xr();return!(t.name!==Lr.FIREFOX||!t.osVersion)&&Number(t.version)>=e}function Qr(e){const t=xr();return!(t.name!==Lr.OPERA||!t.osVersion)&&Number(t.version)>=e}function qr(){const e=xr();if(e.os!==Pr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function $r(){const e=xr();if(e.os!==Pr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function ei(){const e=xr();if(e.os!==Pr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function ti(){return Gr()&&navigator.maxTouchPoints>0}function ri(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function ii(){const e=Fr();return function(){const e=xr().deviceType;return"mobile"===e||"tablet"===e}()||e===Pr.ANDROID||e===Pr.IOS||e===Pr.HARMONY_OS}function ni(){const e=xr();return e.name!==Lr.EDGE&&e.name!==Lr.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function oi(){return Fr()===Pr.ANDROID}function si(){const e=xr();return oi()&&(e.name===Lr.CHROME||e.name===Lr.WECHAT||/chrome|chromium/i.test(navigator.userAgent))}function ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function ci(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 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 di(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){ci(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}function li(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(i=o.call(r)).done)&&(a.push(i.value),a.length!==t);c=!0);}catch(e){u=!0,n=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ai(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ai(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let hi=function(e){return e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",e.PB_ERROR="PB_ERROR",e.TIMEOUT="TIMEOUT",e.INVALID_PARAMS="INVALID_PARAMS",e.NOT_READABLE="NOT_READABLE",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INVALID_OPERATION="INVALID_OPERATION",e.OPERATION_ABORTED="OPERATION_ABORTED",e.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",e.EXCHANGE_SDP_FAILED="EXCHANGE_SDP_FAILED",e.ADD_CANDIDATE_FAILED="ADD_CANDIDATE_FAILED",e.DATACHANNEL_FAILED="DATACHANNEL_FAILED",e.NETWORK_ERROR="NETWORK_ERROR",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",e.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",e.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",e.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",e.ELECTRON_IS_NULL="ELECTRON_IS_NULL",e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",e.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",e.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",e.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",e.PERMISSION_DENIED="PERMISSION_DENIED",e.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",e.TRACK_IS_DISABLED="TRACK_IS_DISABLED",e.GET_VIDEO_ELEMENT_VISIBLE_ERROR="GET_VIDEO_ELEMENT_VISIBLE_ERROR",e.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",e.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",e.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",e.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",e.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",e.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",e.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",e.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",e.UID_CONFLICT="UID_CONFLICT",e.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",e.UPDATE_TICKET_FAILED="UPDATE_TICKET_FAILED",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.INVALID_LOCAL_TRACK="INVALID_LOCAL_TRACK",e.INVALID_TRACK="INVALID_TRACK",e.SENDER_NOT_FOUND="SENDER_NOT_FOUND",e.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",e.SET_ANSWER_FAILED="SET_ANSWER_FAILED",e.ICE_FAILED="ICE_FAILED",e.PC_CLOSED="PC_CLOSED",e.SENDER_REPLACE_FAILED="SENDER_REPLACE_FAILED",e.GET_LOCAL_CAPABILITIES_FAILED="GET_LOCAL_CAPABILITIES_FAILED",e.GET_LOCAL_CONNECTION_PARAMS_FAILED="GET_LOCAL_CONNECTION_PARAMS_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",e.NO_ICE_CANDIDATE="NO_ICE_CANDIDATE",e.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",e.EXIST_DISABLED_VIDEO_TRACK="EXIST_DISABLED_VIDEO_TRACK",e.INVALID_REMOTE_USER="INVALID_REMOTE_USER",e.REMOTE_USER_IS_NOT_PUBLISHED="REMOTE_USER_IS_NOT_PUBLISHED",e.CUSTOM_REPORT_SEND_FAILED="CUSTOM_REPORT_SEND_FAILED",e.CUSTOM_REPORT_FREQUENCY_TOO_HIGH="CUSTOM_REPORT_FREQUENCY_TOO_HIGH",e.FETCH_AUDIO_FILE_FAILED="FETCH_AUDIO_FILE_FAILED",e.READ_LOCAL_AUDIO_FILE_ERROR="READ_LOCAL_AUDIO_FILE_ERROR",e.DECODE_AUDIO_FILE_FAILED="DECODE_AUDIO_FILE_FAILED",e.WS_ABORT="WS_ABORT",e.WS_DISCONNECT="WS_DISCONNECT",e.WS_ERR="WS_ERR",e.EXTERNAL_SIGNAL_ABORT="EXTERNAL_SIGNAL_ABORT",e.LIVE_STREAMING_TASK_CONFLICT="LIVE_STREAMING_TASK_CONFLICT",e.LIVE_STREAMING_INVALID_ARGUMENT="LIVE_STREAMING_INVALID_ARGUMENT",e.LIVE_STREAMING_INTERNAL_SERVER_ERROR="LIVE_STREAMING_INTERNAL_SERVER_ERROR",e.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED="LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",e.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED="LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",e.LIVE_STREAMING_CDN_ERROR="LIVE_STREAMING_CDN_ERROR",e.LIVE_STREAMING_INVALID_RAW_STREAM="LIVE_STREAMING_INVALID_RAW_STREAM",e.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT="LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",e.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE="LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",e.LIVE_STREAMING_WARN_FREQUENT_REQUEST="LIVE_STREAMING_WARN_FREQUENT_REQUEST",e.WEBGL_INTERNAL_ERROR="WEBGL_INTERNAL_ERROR",e.BEAUTY_PROCESSOR_INTERNAL_ERROR="BEAUTY_PROCESSOR_INTERNAL_ERROR",e.CROSS_CHANNEL_WAIT_STATUS_ERROR="CROSS_CHANNEL_WAIT_STATUS_ERROR",e.CROSS_CHANNEL_FAILED_JOIN_SRC="CROSS_CHANNEL_FAILED_JOIN_SEC",e.CROSS_CHANNEL_FAILED_JOIN_DEST="CROSS_CHANNEL_FAILED_JOIN_DEST",e.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST="CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",e.CROSS_CHANNEL_SERVER_ERROR_RESPONSE="CROSS_CHANNEL_SERVER_ERROR_RESPONSE",e.METADATA_OUT_OF_RANGE="METADATA_OUT_OF_RANGE",e.LOCAL_AEC_ERROR="LOCAL_AEC_ERROR",e.INVALID_PLUGIN="INVALID_PLUGIN",e.DISCONNECT_P2P="DISCONNECT_P2P",e.CONVERTING_IMAGEDATA_TO_BLOB_FAILED="CONVERTING_IMAGEDATA_TO_BLOB_FAILED",e.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED="CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED",e.INIT_DATACHANNEL_TIMEOUT="INIT_DATACHANNEL_TIMEOUT",e.CREATE_DATACHANNEL_ERROR="CREATE_DATACHANNEL_ERROR",e.DATACHANNEL_CONNECTION_TIMEOUT="DATACHANNEL_CONNECTION_TIMEOUT",e.PROHIBITED_OPERATION="PROHIBITED_OPERATION",e.IMAGE_MODERATION_UPLOAD_FAILED="IMAGE_MODERATION_UPLOAD_FAILED",e.P2P_MESSAGE_FAILED="P2P_MESSAGE_FAILED",e}({});class pi 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),ci(this,"code",void 0),ci(this,"message",void 0),ci(this,"data",void 0),ci(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 fi(e,t){if("boolean"!=typeof e)throw new pi(hi.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function Ei(e,t,r){if(!r.includes(e))throw new pi(hi.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(r)))}function mi(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 pi(hi.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(r,", ").concat(i,"]. integer only"))}function _i(e,t){if("number"!=typeof e){if(!(e.min||e.max||e.ideal||e.exact))throw new pi(hi.INVALID_PARAMS,"".concat(t," is not a valid ConstrainLong"));void 0!==e.min&&mi(e.min,"".concat(t,".min"),0,1/0),void 0!==e.max&&mi(e.max,"".concat(t,".max"),1,1/0),void 0!==e.exact&&mi(e.exact,"".concat(t,".exact"),1,1/0),void 0!==e.ideal&&mi(e.ideal,"".concat(t,".ideal"),1,1/0)}else mi(e,t,1,1/0)}function Ti(e){return null==e}var gi=function(e){return e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE",e}(gi||{}),Si=function(e){return e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT",e}(Si||{});const yi=new class{constructor(){ci(this,"_clientSize",null),ci(this,"getClientWidth",(()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth)),ci(this,"getClientHeight",(()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight)),ci(this,"getStyle",(e=>window.getComputedStyle(e,null))),ci(this,"checkCssVisibleProperty",(e=>{let t=!0;const r=this.getStyle(e),i=r.display,n=r.visibility,o=r.opacity,s=r.filter;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=li(e.split(/\(|\)/),2),r=t[0],i=t[1];return[r,Number(i.match(/^[0-9\.]+/))]})).forEach((e=>{const r=li(e,2),i=r[0],n=r[1];switch(i){case"brightness":(n<.1||n>3)&&(t=!1);break;case"blur":n>3&&(t=!1);break;case"opacity":n<.1&&(t=!1)}})),t)})),ci(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})),ci(this,"checkActualCssVisibleIncludeInherit",(e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty))),ci(this,"getSizeAboutClient",(e=>{const t=e.getBoundingClientRect(),r=t.width,i=t.height,n=t.left,o=t.right,s=t.top,a=t.bottom,c=this.getClientWidth(),u=this.getClientHeight();return{width:r,height:i,left:n,right:o,top:s,bottom:a,clientWidth:c,clientHeight:u,clientMin:Math.min(c,u)}})),ci(this,"checkActualSize",(()=>{const e=this._clientSize,t=e.width,r=e.height,i=e.clientMin;return this.checkSizeIsVisible(t,r,i)})),ci(this,"elementFromPoint",((e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null)),ci(this,"checkCoverForAPoint",((e,t,r)=>{const i=this.elementFromPoint(e,t);return null!==i&&i!==r})),ci(this,"getPointPositionList",(()=>{const e=this._clientSize,t=e.width,r=e.height,i=e.left,n=e.top,o=t/6,s=r/6,a=[],c=10**6;for(let e=0;e<5;e++)for(let t=0;t<5;t++){const r=(i*c+(0===e?.1:4===e?(o*e*c-1e5)/c:o*e)*c)/c,u=(n*c+(0===t?.1:4===t?(s*t*c-1e5)/c:s*t)*c)/c;a.push({x:r,y:u})}return[...a]})),ci(this,"checkElementCover",(e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((e=>!!e)).length>6)),ci(this,"checkSizeIsVisible",((e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10))),ci(this,"checkSizeOfPartInClient",(()=>{const e=this._clientSize,t=e.left,r=e.right,i=e.top,n=e.bottom,o=e.clientHeight,s=e.clientWidth,a=e.clientMin;let c,u,d,l;if(t<0)c=0;else{if(!(t<s))return!1;c=t}if(r<0)return!1;if(u=r<s?r:s,i<0)d=0;else{if(!(i<o))return!1;d=i}if(n<0)return!1;l=n<o?n:o;const h=u-c,p=l-d;return this.checkSizeIsVisible(h,p,a)})),ci(this,"returnHiddenResult",(e=>(this._clientSize=null,{visible:!1,reason:e}))),ci(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(gi.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(gi.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(gi.SIZE)}}return this.returnHiddenResult(gi.STYLE)}return this.returnHiddenResult(Si.UNMOUNTED)}return this.returnHiddenResult(Si.INVALID_HTML_ELEMENT)})),ci(this,"checkElementIsMountedOnDom",(e=>this.checkPropertyUpToAllParentNodes(e,(e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))))}};const vi=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 Ri{constructor(){ci(this,"_events",{}),ci(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 bi(){return!!Oi()}let Ai=null;function Oi(){if(Ai)return Ai;if(window.electron)return Ai=window.electron;if(!window.require)return null;try{return Ai=window.require("electron"),Ai}catch(e){return null}}let Ii=function(e){return e.CREATE_CLIENT="createClient",e.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",e.SET_AREA="setArea",e.PRELOAD="PRELOAD",e.CHECK_VIDEO_TRACK_IS_ACTIVE="checkVideoTrackIsActive",e.CHECK_AUDIO_TRACK_IS_ACTIVE="checkAudioTrackIsActive",e.CREATE_MIC_AUDIO_TRACK="createMicrophoneAudioTrack",e.CREATE_CUSTOM_AUDIO_TRACK="createCustomAudioTrack",e.CREATE_BUFFER_AUDIO_TRACK="createBufferSourceAudioTrack",e.CREATE_CAM_VIDEO_TRACK="createCameraVideoTrack",e.CREATE_CUSTOM_VIDEO_TRACK="createCustomVideoTrack",e.CREATE_MIC_AND_CAM_TRACKS="createMicrophoneAndCameraTracks",e.CREATE_SCREEN_VIDEO_TRACK="createScreenVideoTrack",e.SET_ENCRYPTION_CONFIG="Client.setEncryptionConfig",e.START_PROXY_SERVER="Client.startProxyServer",e.STOP_PROXY_SERVER="Client.stopProxyServer",e.SET_PROXY_SERVER="Client.setProxyServer",e.SET_TURN_SERVER="Client.setTurnServer",e.SET_CLIENT_ROLE="Client.setClientRole",e.SET_LOW_STREAM_PARAMETER="Client.setLowStreamParameter",e.ENABLE_DUAL_STREAM="Client.enableDualStream",e.DISABLE_DUAL_STREAM="Client.disableDualStream",e.JOIN="Client.join",e.LEAVE="Client.leave",e.PUBLISH="Client.publish",e.UNPUBLISH="Client.unpublish",e.SUBSCRIBE="Client.subscribe",e.MASS_SUBSCRIBE="Client.massSubscribe",e.MASS_UNSUBSCRIBE="Client.massUnsubscribe",e.UNSUBSCRIBE="Client.unsubscribe",e.RENEW_TOKEN="Client.renewToken",e.SET_REMOTE_VIDEO_STREAM_TYPE="Client.setRemoteVideoStreamType",e.SET_STREAM_FALLBACK_OPTION="Client.setStreamFallbackOption",e.ENABLE_AUDIO_VOLUME_INDICATOR="Client.enableAudioVolumeIndicator",e.SEND_CUSTOM_REPORT_MESSAGE="Client.sendCustomReportMessage",e.INSPECT_VIDEO_CONTENT="Client.inspectVideoContent",e.STOP_INSPECT_VIDEO_CONTENT="Client.stopInspectVideoContent",e.JOIN_FALLBACK_TO_PROXY="Client._joinFallbackToProxy",e.ON_LIVE_STREAM_WARNING="Client.onLiveStreamWarning",e.ON_LIVE_STREAM_ERROR="Client.onLiveStreamingError",e.START_LIVE_STREAMING="Client.startLiveStreaming",e.SET_LIVE_TRANSCODING="Client.setLiveTranscoding",e.STOP_LIVE_STREAMING="Client.stopLiveStreaming",e.START_CHANNEL_MEDIA_RELAY="Client.startChannelMediaRelay",e.UPDATE_CHANNEL_MEDIA_RELAY="Client.updateChannelMediaRelay",e.STOP_CHANNEL_MEDIA_RELAY="Client.stopChannelMediaRelay",e.REQUEST_CONFIG_DISTRIBUTE="_config-distribute-request",e.SET_CONFIG_DISTRIBUTE="_configDistribute",e.LOCAL_TRACK_SET_MUTED="LocalTrack.setMute",e.LOCAL_AUDIO_TRACK_PLAY="LocalAudioTrack.play",e.LOCAL_AUDIO_TRACK_PLAY_IN_ELEMENT="LocalAudioTrack.playInElement",e.LOCAL_AUDIO_TRACK_STOP="LocalAudioTrack.stop",e.LOCAL_AUDIO_TRACK_SET_VOLUME="LocalAudioTrack.setVolume",e.MIC_AUDIO_TRACK_SET_DEVICE="MicrophoneAudioTrack.setDevice",e.BUFFER_AUDIO_TRACK_START="BufferSourceAudioTrack.startProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_STOP="BufferSourceAudioTrack.stopProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_PAUSE="BufferSourceAudioTrack.pauseProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_RESUME="BufferSourceAudioTrack.resumeProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_SEEK="BufferSourceAudioTrack.seekAudioBuffer",e.LOCAL_VIDEO_TRACK_PLAY="LocalVideoTrack.play",e.LOCAL_VIDEO_TRACK_STOP="LocalVideoTrack.stop",e.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE="LocalVideoTrack.getVideoElementVisibleStatus",e.LOCAL_VIDEO_TRACK_BEAUTY="LocalVideoTrack.setBeautyEffect",e.LOCAL_VIDEO_SEND_SEI_DATA="LocalVideoTrack.sendSeiData",e.CAM_VIDEO_TRACK_SET_DEVICE="CameraVideoTrack.setDevice",e.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG="CameraVideoTrack.setEncoderConfiguration",e.REMOTE_VIDEO_TRACK_PLAY="RemoteVideoTrack.play",e.REMOTE_VIDEO_TRACK_STOP="RemoteVideoTrack.stop",e.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE="RemoteVideoTrack.getVideoElementVisibleStatus",e.REMOTE_AUDIO_TRACK_PLAY="RemoteAudioTrack.play",e.REMOTE_AUDIO_TRACK_STOP="RemoteAudioTrack.stop",e.REMOTE_AUDIO_SET_VOLUME="RemoteAudioTrack.setVolume",e.REMOTE_AUDIO_SET_OUTPUT_DEVICE="RemoteAudioTrack.setOutputDevice",e.GET_MEDIA_STREAM_TRACK="Track.getMediaStreamTrack",e.STREAM_TYPE_CHANGE="streamTypeChange",e.CONNECTION_STATE_CHANGE="connectionStateChange",e.LOAD_CONFIG_FROM_LOCALSTORAGE="loadConfigFromLocalStorage",e.IMAGE_MODERATION_UPLOAD="imageModerationUpload",e.REPUB_AFTER_PC_CONNECTED="repubAfterPCConnected",e.PRELOAD_MEDIA_FAILED="preloadMediaFailed",e.MISMATCH_DTLS_PARAMETERS="mismatchDtlsParameters",e.MISMATCH_ICE_PARAMETERS="mismatchIceParameters",e.VOS_FALLBACK_CN="vosFallbackCN",e.DATACHANNEL_FAILBACK="datachannelFailback",e}({}),Ci=function(e){return e.TRACER="tracer",e}({});!function(e){e[e.AUDIENCE_LEVEL_LOW_LATENCY=1]="AUDIENCE_LEVEL_LOW_LATENCY",e[e.AUDIENCE_LEVEL_ULTRA_LOW_LATENCY=2]="AUDIENCE_LEVEL_ULTRA_LOW_LATENCY",e[e.AUDIENCE_LEVEL_SYNC_LATENCY=3]="AUDIENCE_LEVEL_SYNC_LATENCY"}({}),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.FALLBACK="FALLBACK",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.LICENSE_MISSING="LICENSE_MISSING",e.LICENSE_EXPIRED="LICENSE_EXPIRED",e.LICENSE_MINUTES_EXCEEDED="LICENSE_MINUTES_EXCEEDED",e.LICENSE_PERIOD_INVALID="LICENSE_PERIOD_INVALID",e.LICENSE_MULTIPLE_SDK_SERVICE="LICENSE_MULTIPLE_SDK_SERVICE",e.LICENSE_ILLEGAL="LICENSE_ILLEGAL",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.FALLBACK_TO_HLS="FALLBACK_TO_HLS",e.UID_CONFLICT="UID_CONFLICT"}({}),function(e){e[e.AUTO_SIMULCAST_STREAM=-1]="AUTO_SIMULCAST_STREAM",e[e.DISABLE_SIMULCAST_STREM=0]="DISABLE_SIMULCAST_STREM",e[e.ENABLE_SIMULCAST_STREAM=1]="ENABLE_SIMULCAST_STREAM"}({}),function(e){e.PEERCONNECTION_STATE_CHANGE="peerconnection-state-change",e.AUDIO_METADATA="audio-metadata",e.AUDIO_PTS="audio-pts",e.CONNECTION_STATE_CHANGE="connection-state-change",e.MEDIA_RECONNECT_START="media-reconnect-start",e.MEDIA_RECONNECT_END="media-reconnect-end",e.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",e.USER_JOINED="user-joined",e.USER_LEAVED="user-left",e.USER_PUBLISHED="user-published",e.USER_UNPUBLISHED="user-unpublished",e.USER_INFO_UPDATED="user-info-updated",e.CLIENT_BANNED="client-banned",e.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",e.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",e.VOLUME_INDICATOR="volume-indicator",e.CRYPT_ERROR="crypt-error",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGED="stream-type-changed",e.STREAM_FALLBACK="stream-fallback",e.RECEIVE_METADATA="receive-metadata",e.STREAM_MESSAGE="stream-message",e.LIVE_STREAMING_ERROR="live-streaming-error",e.LIVE_STREAMING_WARNING="live-streaming-warning",e.EXCEPTION="exception",e.ERROR="error",e.P2P_LOST="p2p_lost",e.JOIN_FALLBACK_TO_PROXY="join-fallback-to-proxy",e.CHANNEL_FALLBACK_TO_WEBSOCKET="channel-fallback-to-websocket",e.MEDIA_CONNECTION_TYPE_CHANGE="media-connection-type-change",e.PUBLISHED_USER_LIST="published-user-list",e.USER_LIST="user-list",e.CONTENT_INSPECT_CONNECTION_STATE_CHANGE="content-inspect-connection-state-change",e.CONTENT_INSPECT_ERROR="content-inspect-error",e.CONTENT_INSPECT_RESULT="content-inspect-result",e.IMAGE_MODERATION_CONNECTION_STATE_CHANGE="image-moderation-connection-state-change",e.FALLBACK_TO_HLS="fallback-to-hls",e.FIRST_VIDEO_BUFFER_READY="first-video-buffer-ready",e.FIRST_VIDEO_PRE_RENDER="first-video-pre-render",e.AV1_DECODABLE_RESULT="av1-decodable-result"}({}),function(e){e.CONFIG="config",e.VOSERROR="vos_error",e.AP_ERROR="ap_error"}({}),function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.MULTI_IP="MULTI_IP",e.TIMEOUT="TIMEOUT",e.OFFLINE="OFFLINE",e.LEAVE="LEAVE",e.P2P_FAILED="P2P_FAILED",e.FALLBACK="FALLBACK",e.REGIONAL_DISTRIBUTION="REGIONAL_DISTRIBUTION"}({});let wi=function(e){return e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({}),Ni=function(e){return e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({});function Di(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 pi(hi.UNEXPECTED_ERROR,"can not emit promise")):new Promise(((r,n)=>{e.emit(t,...i,r,n)}))}function Pi(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 Di(e,t,...i)}function Li(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 pi(hi.UNEXPECTED_ERROR,"handler is not sync");return r}(e,t,...i)}const ki=new class extends Ri{set networkState(e){this.emit(Ni.NETWORK_STATE_CHANGE,e,this._networkState),e===wi.ONLINE?this.emit(Ni.ONLINE):e===wi.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(Ni.ONLINE,(()=>{this.onlineWaiter=void 0,e(wi.ONLINE)}))})),this.emit(Ni.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}get isOnline(){return this._networkState===wi.ONLINE}constructor(){super(),ci(this,"_moduleName","network-indicator"),ci(this,"_networkState",wi.ONLINE),ci(this,"onlineWaiter",void 0),window.addEventListener("online",(()=>{this.networkState=wi.ONLINE})),window.addEventListener("offline",(()=>{this.networkState=wi.OFFLINE}))}},Mi=[];for(let e=0;e<256;++e)Mi.push((e+256).toString(16).slice(1));const Ui="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);let xi;const Vi=new Uint8Array(16);function Fi(){return Ui?Ui():function(e,t,r){var i,n,o,s;const a=null!==(i=null!==(n=(e=e||{}).random)&&void 0!==n?n:null===(o=(s=e).rng)||void 0===o?void 0:o.call(s))&&void 0!==i?i:function(){if(!xi){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");xi=crypto.getRandomValues.bind(crypto)}return xi(Vi)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError("UUID byte range ".concat(r,":").concat(r+15," is out of buffer bounds"));for(let e=0;e<16;++e)t[r+e]=a[e];return t}return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(Mi[e[t+0]]+Mi[e[t+1]]+Mi[e[t+2]]+Mi[e[t+3]]+"-"+Mi[e[t+4]]+Mi[e[t+5]]+"-"+Mi[e[t+6]]+Mi[e[t+7]]+"-"+Mi[e[t+8]]+Mi[e[t+9]]+"-"+Mi[e[t+10]]+Mi[e[t+11]]+Mi[e[t+12]]+Mi[e[t+13]]+Mi[e[t+14]]+Mi[e[t+15]]).toLowerCase()}(a)}(e,t,undefined);var e,t}function Bi(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function ji(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function Wi(e){return JSON.parse(JSON.stringify(e))}function Gi(e){try{return Wi(e)}catch(t){return e}}const Hi={};function Ki(e,t){Hi[t]||(Hi[t]=!0,e())}function Yi(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function Zi(e){return new Promise((t=>{window.setTimeout(t,e)}))}function zi(){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)+zi(e-r.length,"")}const Xi=()=>{},Ji=new class{constructor(){ci(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,di(di({},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})}}},Qi=Ji.throttleByKey.bind(Ji);function qi(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function $i(e,t){if(!qi(e)||!qi(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]=$i(e[i],t[i]);return r}{const r=di({},e);for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?r[i]=$i(e[i],t[i]):r[i]=t[i]);return r}}function en(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}function tn(e){return e.reduce(((e,t)=>e+t),0)}let rn=1,nn=console;class on{static setLogger(e){nn=e}constructor(e,t){ci(this,"id",void 0),ci(this,"lockingPromise",Promise.resolve()),ci(this,"locks",0),ci(this,"name",""),ci(this,"lockId",void 0),this.lockId=rn++,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:"");nn.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 sn(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 an={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function cn(e,t,r,i){const n=Object.assign({},an,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 pi(hi.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 un=0,dn=0;function ln(e,t,r,i){return new Promise(((n,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),un+=Yi(t.data)):r&&(t.data.size?un+=t.data.size:t.data instanceof FormData?un+=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?Yi(e):e.size})),t+138}(t.data):un+=Yi(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,Dr.request(t).then((e=>{"string"==typeof e.data?dn+=Yi(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?dn+=e.data.byteLength:dn+=Yi(JSON.stringify(e.data)),i&&n({data:e.data,headers:e.headers}),n(e.data)})).catch((e=>{Dr.isCancel(e)?o(new pi(hi.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?o(new pi(hi.NETWORK_TIMEOUT,e.message)):e.response?o(new pi(hi.NETWORK_RESPONSE_ERROR,e.response.status)):o(new pi(hi.NETWORK_ERROR,e.message))}))}))}async function hn(e,t){const r=new Blob([t.data],{type:"buffer"});return await ln(e,di(di({},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 pn=function(e){return e[e.kNone=1]="kNone",e[e.kMillisecondsFromSeconds=1e3]="kMillisecondsFromSeconds",e[e.kBytesToBits=8]="kBytesToBits",e}(pn||{});const fn="websdk_ng_install_id";function En(){try{if(yn("INSTALL_ID"))return yn("INSTALL_ID");let e=window.localStorage.getItem(fn);return e||(e=function(){let e,t=!1;try{e=Fi().replaceAll("-","")}catch(e){t=!0}return!t&&e&&32===e.length||(e=zi(32,"")),e.toUpperCase()}(),window.localStorage.setItem(fn,e)),Sn("INSTALL_ID",e),e}catch(e){return}}const mn=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-([0-9]+)/);if(t&&t[1]&&t[2]){const e=t[1],r=t[2];return"".concat(e,".").concat(r)}return"4.0.0.999"}("4.24.4"),_n=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 Tn=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=Tn;const gn=di(di(di(di({},{ENABLE_EVENT_REPORT:!0,UPLOAD_LOG:!1,ENABLE_AG_ADAPTATION:!0,FORCE_AG_HIGH_FRAMERATE:!1,FORCE_SUPPORT_AG_ADAPTATION:!1,ENCODER_CONFIG_LIMIT:{},CAMERA_CAPTURE_CONFIG:void 0,ENABLE_PRELOAD:!0,NEW_ICE_RESTART:!0,ICE_RESTART_INTERVAL:1e4,RESTART_SEQUENCE:["udp_tcp_relay","relay"],FIRST_TCP_CANDIDATE:!1,MAX_CONFIG_RETRY:10,ENABLE_CONFIG_RESTORE:!1,CONFIG_RESTORE_ERROR_API:["createClient","Client.join"],CONFIG_ERROR_MONITOR:["INVALID_OPERATION","UNEXPECTED_ERROR"],BLOCKED_CONFIG_MAX_TIME:864e5,FIRST_TCP_CANDIDATE_INTERVAL:1e3,TURN_DOMAIN:"edge.agora.io",TURN_DOMAINS:["edge.agora.io"],USE_TURN_IP:!0,NEW_TURN_MODE:4,NEW_FORCE_TURN:!1,USE_NEW_RENDER_FREEZE_TIME:!0,FLS_FALLBACK_TIMEOUT:3e4,RTE_DETAIL_REPORT_INTERVAL:6e4,ENCODE_EXCEPTION_TIMES:5,ENABLE_ENCODE_EXCEPTION:!0,ENCODE_EXCEPTION_VALIDATE_CODEC:["h264"],VIDEO_ENCODER_CONFIG_LIST:[{width:240,height:180},{width:320,height:240},{width:400,height:300},{width:480,height:360},{width:560,height:420},{width:640,height:480}],DELETE_NEQ_AFTER_USER_LEAVE:!0,UPDATE_RTP_CAP_IN_HOST:!1,IOS_BG_TAG:!0,IOS_AUTO_RESTART_BG_TAG:!0,IGNORE_UID_CHECK:!1,ENABLE_UP_SPS_PPS:!1,ENABLE_DOWN_SPS_PPS:!0,NO_EDGES_RETRY:!0,BUFFER_READY_FRAMES:3,FLS_SYNC_AV_PLAY_LIMIT:0,FLS_BUFFER_WAIT_TIME:1500,VOS_CONFIGURE:void 0,ENABLE_QUALITY_FALLBACK:!1,QUALITY_FALLBACK_REHEARSAL:!0,ENABLE_FLS_AV1_FIRST:!1,ENABLE_AP_MULTI_IP:!0,FLS_ENABLE_AV1_DETECT:!0,FLS_ENABLE_AV1_DECODE_DETECT:!0,ENABLE_SDP_ENDPOINT_LOG:!1,REMOTE_VIDEO_FREEZE_TIME_VERSION:2}),{},{PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],SDP_ENDPOINT_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],SDP_ENDPOINT_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,NOT_REPORT_EVENT:[],PING_PONG_TIME_OUT:10,WEBSOCKET_TIMEOUT_MIN:1e4,EVENT_REPORT_SEND_INTERVAL:3e3,CONFIG_DISTRIBUTE_INTERVAL:3e5,ENABLE_CONFIG_DISTRIBUTE:!0,CANDIDATE_TIMEOUT:5e3,SHOW_REPORT_INVOKER_LOG:!1,SHOW_REPORT_USER_INVOKER_LOG:!0,JOIN_EXTEND:"",PUB_EXTEND:"",SUB_EXTEND:"",FORCE_TURN:!1,TURN_ENABLE_TCP:!0,TURN_ENABLE_UDP:!0,MAX_UPLOAD_CACHE:50,UPLOAD_CACHE_INTERVAL:2e3,AJAX_REQUEST_CONCURRENT:3,REPORT_APP_SCENARIO:void 0,GATEWAY_DOMAINS:["edge.agora.io","edge.sd-rtn.com"],CONNECT_GATEWAY_WITHOUT_DOMAIN:!1,WORKER_DOMAIN:"edge.agora.io",EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,GET_VOLUME_OF_MUTED_AUDIO_TRACK:!1,STATS_UPDATE_INTERVAL:250,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,CHECK_VIDEO_VISIBLE_INTERVAL:3e4,CHECK_LOCAL_STATS_INTERVAL:250,PROFILE_SWITCH_INTERVAL:2e3,UNSUPPORTED_VIDEO_CODEC:[],ENUMERATE_DEVICES_INTERVAL:!1,ENUMERATE_DEVICES_INTERVAL_TIME:1e4,USE_NEW_TOKEN:!1,CLOSE_AFB_FOR_LOCAL_AP:!0,JOIN_MAX_CONCURRENCY:6,JOIN_WITH_FALLBACK_SIGNAL_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE:!1,JOIN_GATEWAY_TRY_443PORT_DURATION:2e3,JOIN_GATEWAY_USE_443PORT_ONLY:!1,JOIN_GATEWAY_USE_DUAL_DOMAIN:!0,JOIN_GATEWAY_FALLBACK_PORT:443,USE_TURN_SERVER_OF_GATEWAY:!1,H264_PROFILE_LEVEL_ID:"",USE_NEW_LOG:!1,LOG_VERSION:3,MEDIA_DEVICE_CONSTRAINTS:null,ENCRYPT_PROXY_USERNAME_AND_PSW:!0,SDP_LOGGING:!1,CSP_DETECTED_HOSTNAME_LIST:["agora.io","sd-rtn.com"],REMOTE_AUDIO_TRACK_USES_WEB_AUDIO:!1,LOCAL_AUDIO_TRACK_USES_WEB_AUDIO:!1,BITRATE_ADAPTER_TYPE:"STANDARD_BITRATE",AI_DENOISER_PARAMETERS:{excludedLinks:[]},ADJUST_3A_FROM_PLUGINS:!0,RAISE_H264_BASELINE_PRIORITY:!0,FILTER_SEND_H264_BASELINE:!1,FIRST_H264_PROFILE_LEVEL_ID:"42001f",FIRST_PACKETIZATION_MODE:"",X_GOOGLE_START_BITRATE:void 0,NEW_REPORT_SERVER:!1,NEW_REPORT_SERVER_DOMAINS:["data-reporting.agora.io","data-reporting.agora.io"],VIDEO_INSPECT_WORKER_MESSAGE_LENGTH_LIMIT:3e5,VIDEO_INSPECT_INTERVAL_MINIMUM:1e3,VIDEO_INSPECT_QUALITY_RATIO:.9,VIDEO_INSPECT_WORKER_MANAGER_HOST:"edge.agora.io",VIDEO_INSPECT_WORKER_MANAGER_PORT:"",VIDEO_INSPECT_WORKER_MANAGER_WSS:"",VIDEO_INSPECT_WORKER_PORT:"",SHOW_VIDEO_INSPECT_WORKER_MESSAGE:!1,STATS_COLLECTOR_PORT:443,FORCE_TURN_TCP:!1,WEBAUDIO_INIT_OPTIONS:void 0,FILTER_VIDEO_FEC:!0,FILTER_AUDIO_FEC:!1,CHROME_DUAL_STREAM_USE_ENCODING:!0,DISABLE_DUAL_STREAM_USE_ENCODING:!1,EXTENSION_USAGE_UPLOAD_INTERVAL:1e4,ICE_RESTART:!0,FINGERPRINT:null,ENABLE_VIDEO_FRAME_CALLBACK:!0,VIDEO_FREEZE_DURATION:500,SPATIALIZER_PARAMETERS:{},UPLOAD_LOG_INTERVAL:3e3,UPLOAD_LOG_REQUEST_RETRY_INTERVAL:2e3,UPLOAD_LOG_REQUEST_MAX_RETRY_INTERVAL:2e4,UPLOAD_LOG_TRY_INTERVAL_WHILE_OFF:5e3,UPLOAD_LOG_RETRY_INTERVAL_V1:1e4,UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1:200,UPLOAD_LOG_LENGTH_EACH_TIME:10,APP_TYPE:0,DISABLE_WEBAUDIO:!1,CHANNEL_MEDIA_RELAY_SERVERS:void 0,KEEP_LAST_FRAME:!0,FORWARD_P2P_CREATION:!0,SYNC_GROUP:!0,BLOCK_LOCAL_CLIENT:!1,ENABLE_AUDIO_TOPN:!1,ENABLE_AUDIO_METADATA:!1,ENABLE_AUDIO_PTS:!1,TOPN_SMOOTH_LEVEL:void 0,TOPN_NEW_SPEAKER_DELAY:void 0,TOPN_SWITCH_HOLD_MS:void 0,TOPN_AUDIO_GAIN:void 0,TOPN_SILENCE_THRESHOLD:250,AP_AREA:!0,ENABLE_ENCODED_TRANSFORM:!1,ENABLE_VIDEO_SEI:!1,IMAGE_MODERATION_WORKER_HOST:"edge.agora.io",IMAGE_MODERATION_WORKER_WSS:"",IMAGE_MODERATION_WORKER_MESSAGE_LENGTH_LIMIT:3e5,IMAGE_MODERATION_INTERVAL_MINIMUM:1e3,SHOW_IMAGE_MODERATION_WORKER_MESSAGE:!1,IMAGE_MODERATION_QUALITY_RATIO:.9,IMAGE_MODERATION_UPLOAD_REPORT_INTERVAL:5e3,SHOW_GLOBAL_CLIENT_LIST:!1,DATASTREAM_MAX_RETRANSMITS:10,TCP_CANDIDATE_ONLY:!1,EXTERNAL_SIGNAL_REQUEST_TIMEOUT:3e3,SHOW_P2P_LOG:!1,MAX_P2P_TIMEOUT:3e4,P2P_TOKEN_INTERVAL:1e3,SHOW_DATASTREAM2_LOG:!1,RESTRICTION_SET_PLAYBACK_DEVICE:!0,USE_PURE_ENCRYPTION_MASTER_KEY:!1,ENABLE_AUDIO_RED:!1,OPUS_PTIME:void 0,AUDIO_DUPLICATE_NUM:void 0,ENABLE_ABSSENDTIME_AS_SENTTS:!0,ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,FILEPATH_LENMAX:255,DUALSTREAM_OPERATION_CHECK:!0,MEDIA_ELEMENT_EXISTS_DEPTH:3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,STATS_FILTER:{transportId:!0,googTrackId:!0},FILTER_VIDEO_CODEC:[],SIGNAL_CHANNEL:0,TRANSMITTER_INITIAL_RTT:30,TRANSMITTER_INITIAL_RTO:30,TRANSMITTER_MAX_BATCH_ACK_COUNT:2,TRANSMITTER_MAX_RTO:500,DATACHANNEL_COMPRESS:!1,DC_JOIN_WITH_FAILBACK:4e3,DC_CONNECTION_TIMEOUT:2e3,DC_PINGPONG_INTERVAL:2e3,DC_DEBUG_LOG:!1,UNSUPPORTED_VIDEO_UPLINK_CODEC:[],UNSUPPORTED_VIDEO_DOWNLINK_CODEC:[],USE_NEW_NETWORK_CONFIG:!1,AUTO_RESET_AUDIO_ROUTE:!1,PLUGIN_INFO:[],OVERUSE_DETECTOR_PARAMS:{MIN_FRAME_RATE:1,MAX_FRAME_RATE:30,MAX_THRESHOLD_FRAMERATE:30,BITRATE_MIN_THRESHOLD:100,BITRATE_MAX_THRESHOLD:100,MAX_SCALE:5,BWE_SCALE_UP_THRESHOLD:.6,BWE_SCALE_DOWN_THRESHOLD:.6,PERF_SCALE_UP_THRESHOLD:.7,PERF_SCALE_DOWN_THRESHOLD:.6,MOTION_RESOLUTION_FACTOR:.8,MOTION_BITRATE_FACTOR:.6,DETAIL_FRAMERATE_FACTOR:.8,DETAIL_BITRATE_FACTOR:.6,BALANCE_RESOLUTION_FACTOR:.9,BALANCE_FRAMERATE_FACTOR:.9,BALANCE_BITRATE_FACTOR:.6,OVERUSE_TIMES_THRESHOLD:10,UNDERUSE_TIMES_THRESHOLD:40},CUSTOM_ADAPTATION_DEFAULT_MODE:"",HIDE_NO_POSTER:!1,AP_CACHE_NUM:10,AP_UPDATE_INTERVAL:12e4,AP_CACHE_LIFETIME:12e4,MAX_PRELOAD_ASYNC_LENGTH:3,DISABLE_SCREEN_SHARE_REMB:!1},{ENABLE_PUBLISHED_USER_LIST:!0,ENABLE_USER_LIST:!1,MAX_SUBSCRIPTION:50,SUBSCRIBE_AUDIO_FILTER_TOPN:void 0,ENABLE_PUBLISH_AUDIO_FILTER:void 0,ENABLE_USER_LICENSE_CHECK:!0,DISABLE_FEC:void 0,ENABLE_NTP_REPORT:!1,ENABLE_INSTANT_VIDEO:!1,ENABLE_USER_AUTO_REBALANCE_CHECK:!0,ENABLE_LOSSBASED_BWE:!0,ENABLE_AUT_CC:!0,FORCE_ENABLE_AUT_CC:!1,ENABLE_CC_FALLBACK:void 0,SUBSCRIBE_TWCC:!0,PUBLISH_TWCC:!1,ENABLE_SVC_DEFAULT_CODECS:["H264","VP8","VP9","AV1"],SVC:[],ENABLE_FULL_LINK_AV_SYNC:!1,SVC_MODE:null,ENABLE_AUT_FEEDBACK:!0,SVC_EXTENDED:["VP9"],ENABLE_JOIN_V4:!1,ENABLE_AP_COMPRESS:!0}),{},{USE_CANDIDATE_FROM_AP_DETAIL:!1,AP_REQUEST_DETAIL:void 0,ENABLE_ROLE_SELECT_EDGE:!1,CLIENT_ROLE_OPTIONS:void 0,REMOTE_VIDEO_STREAM_TYPE:void 0,COMPATIBLE_SDP_EXTENSION:["gdpr_forbidden"],LIMIT_BITRATE:void 0,EXPERIMENTS:{},USE_PUB_RTX:!0,USE_SUB_RTX:!0,ENABLE_DATASTREAM_2:!1,USE_XR:!0,ENABLE_PREALLOC_PC:!1,ENABLE_PRE_SUB:!1,ENABLE_SVC:!1,ENABLE_FORCE_HLS:!1,MAX_WEBAUDIO_VOLUME:300,ENABLE_VOS_FALLBACK:!1,ENABLE_FALLBACK_TO_HLS:!1,ENABLE_PRE_RENDER:!1,FORCE_DISABLE_AUTO_SUB:!1,ENABLE_PRE_SUB_WITH_PRE_PC:!0,PRE_USE_LOCAL_CODECS:!0},{INSTALL_ID:""}),{},{K_MIN_RENDER_DELAY:66,USE_STANDARD_BITRATE_DEFAULT:!1,VIDEO_NEW_BITRATE_RATIO:void 0,VIDEO_STANDARD_BITRATE_VERSION:2,BASELINE_MORE_H264_BITRATE_RATIO:1.1,IGNORE_RTC_DEVICE_CHECK:!1,FLS_AUTOPLAY_EMITS:!1,ENABLE_DUAL_STREAM_FLAG:!1,FORBID_MODIFY_LOCAL_OFFER_SDP:!1,RESERVE_MID_1_MLINE:!1,PRE_SUB_NUM:1,DC_IN_ESM:!0,PRE_PLAYOUT_DELAY_HINT:void 0});function Sn(e,t,r){var i;Object.keys(gn).includes(e)&&(!r&&Object.keys(vn).includes(e)||(gn[e]=t,"ENABLE_VIDEO_SEI"!==e&&"ENABLE_AUDIO_TOPN"!==e&&"ENABLE_AUDIO_METADATA"!==e&&"ENABLE_AUDIO_PTS"!==e||!0!==t||(gn.ENABLE_ENCODED_TRANSFORM=!0),"USE_NEW_NETWORK_CONFIG"===e&&t&&(i=!!t,gn.USE_NEW_NETWORK_CONFIG=i,i&&(gn.WEBCS_DOMAIN=["webrtc2-2.ap.sd-rtn.com"],gn.WEBCS_DOMAIN_BACKUP_LIST=["webrtc2-4.ap.sd-rtn.com"],gn.CDS_AP=["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],gn.ACCOUNT_REGISTER=["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],gn.EVENT_REPORT_DOMAIN="web-2.statscollector.sd-rtn.com",gn.EVENT_REPORT_BACKUP_DOMAIN="statscollector-1.agora.io",gn.GATEWAY_DOMAINS=["edge.sd-rtn.com"])),"ENABLE_PRE_SUB"===e&&t&&(gn.ENABLE_INSTANT_VIDEO=!0,gn.ENABLE_PREALLOC_PC=!0),"ENABLE_SVC"===e&&t&&(gn.ENABLE_AUT_CC=!0),"NEW_FORCE_TURN"===e&&t&&(gn.NEW_TURN_MODE||(gn.NEW_TURN_MODE=4))))}function yn(e){if("TURN_DOMAINS"===e){const e=gn.TURN_DOMAINS;return e.includes(yn("TURN_DOMAIN"))?e:[yn("TURN_DOMAIN")].concat(e)}return gn[e]}_n||(gn.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],gn.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],gn.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],gn.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],gn.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],gn.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],gn.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",gn.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",gn.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",gn.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",gn.AREAS=["NORTH_AMERICA","OVERSEA"]),function(e){e[e.REALTIME=1]="REALTIME"}({});const vn={};var Rn=function(e){return e.SET_SESSION_ID="SET_SESSION_ID",e.SET_RTE_URL="SET_RTE_URL",e.SET_RTE_SID="SET_RTE_SID",e.SET_P2P_ID="SET_P2P_id",e.SET_DC_ID="SET_DC_id",e.SET_UID="SET_UID",e.SET_INT_UID="SET_INT_UID",e.SET_PUB_ID="SET_PUB_ID",e.SET_CLOUD_PROXY_SERVER_MODE="SET_CLOUD_PROXY_SERVER_MODE",e.KEY_METRIC_CLIENT_CREATED="KEY_METRIC_CLIENT_CREATED",e.KEY_METRIC_JOIN_START="KEY_METRIC_JOIN_START",e.KEY_METRIC_PRELOAD_START="KEY_METRIC_PRELOAD_START",e.KEY_METRIC_PRELOAD_END="KEY_METRIC_PRELOAD_END",e.KEY_METRIC_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_REQUEST_SUA_END="KEY_METRIC_REQUEST_SUA_END",e.KEY_METRIC_BEFORE_CONNECT="KEY_METRIC_BEFORE_CONNECT",e.KEY_METRIC_PEER_RECEIVER="KEY_METRIC_PEER_RECEIVER",e.KEY_METRIC_SIGNAL_CONNECTED="KEY_METRIC_SIGNAL_CONNECTED",e.KEY_METRIC_JOIN_REQ="KEY_METRIC_JOIN_REQ",e.KEY_METRIC_JOIN_REP="KEY_METRIC_JOIN_REP",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_FIRST_VIDEO_FRAME_DECODED="KEY_METRIC_FIRST_VIDEO_FRAME_DECODED",e.KEY_METRIC_DESCRIPTION_START="KEY_METRIC_DESCRIPTION_START",e.KEY_METRIC_ICE_CONNECTION_END="KEY_METRIC_ICE_CONNECTION_END",e.KEY_METRIC_SIGNAL_CHANNEL_OPEN="KEY_METRIC_SIGNAL_CHANNEL_OPEN",e.KEY_METRIC_PUBLISH="KEY_METRIC_PUBLISH",e.KEY_METRIC_SUBSCRIBE="KEY_METRIC_SUBSCRIBE",e.RECORD_JOIN_CHANNEL_SERVICE="RECORD_JOIN_CHANNEL_SERVICE",e.RESET_JOIN_CHANNEL_SERVICE_RECORDS="RESET_JOIN_CHANNEL_SERVICE_RECORDS",e.RESET_KEY_METRICS="RESET_KEY_METRICS",e.RESET_FIRST_VIDEO_FRAME_DECODED="RESET_FIRST_VIDEO_FRAME_DECODED",e.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE",e}(Rn||{});function bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function An(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 On(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 In(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?On(Object(r),!0).forEach((function(t){An(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):On(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Cn(e,t){return Cn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Cn(e,t)}function wn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(i=o.call(r)).done)&&(a.push(i.value),a.length!==t);c=!0);}catch(e){u=!0,n=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return bn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?bn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nn(){Nn=function(e,t){return new r(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function r(e,i,n){var o=RegExp(e,i);return t.set(o,n||t.get(e)),Cn(o,r.prototype)}function i(e,r){var i=t.get(r);return Object.keys(i).reduce((function(t,r){var n=i[r];if("number"==typeof n)t[r]=e[n];else{for(var o=0;void 0===e[n[o]]&&o+1<n.length;)o++;t[r]=e[n[o]]}return t}),Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Cn(e,t)}(r,RegExp),r.prototype.exec=function(t){var r=e.exec.call(this,t);if(r){r.groups=i(r,this);var n=r.indices;n&&(n.groups=i(n,this))}return r},r.prototype[Symbol.replace]=function(r,n){if("string"==typeof n){var o=t.get(this);return e[Symbol.replace].call(this,r,n.replace(/\$<([^>]+)(>|$)/g,(function(e,t,r){if(""===r)return e;var i=o[t];return Array.isArray(i)?"$"+i.join("$"):"number"==typeof i?"$"+i:""})))}if("function"==typeof n){var s=this;return e[Symbol.replace].call(this,r,(function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(i(e,s)),n.apply(this,e)}))}return e[Symbol.replace].call(this,r,n)},Nn.apply(this,arguments)}!function(e){e.h264="h264",e.h265="h265",e.vp8="vp8",e.vp9="vp9",e.av1="av1"}({}),function(e){e.opus="opus",e.pcma="pcma",e.pcmu="pcmu",e.g722="g722"}({}),(()=>{var e={8:(e,t,r)=>{r.r(t),r.d(t,{Parser:()=>v,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 u(e){return c(e)||e>="€"&&e<="ÿ"}function d(e){return"!"===e||e>="#"&&e<="'"||e>="*"&&e<="+"||e>="-"&&e<="."||e>="0"&&e<="9"||e>="A"&&e<="Z"||e>="^"&&e<="~"}function l(e){return e>="1"&&e<="9"}function h(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function p(e){return"d"===e||"h"===e||"m"===e||"s"===e}function f(e){return e>""&&e<"\t"||e>"\v"&&e<"\f"||e>""&&e<"ÿ"}function E(e){return h(e)||a(e)||"+"===e||"/"===e}function m(e){return a(e)||h(e)||"+"===e||"/"===e||"-"===e||"_"===e}function _(e){return h(e)||a(e)||"+"===e||"/"===e}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e.VERSION="v",e.ORIGIN="o",e.SESSION_NAME="s",e.INFORMATION="i",e.URI="u",e.EMAIL="e",e.PHONE="p",e.CONNECTION="c",e.BANDWIDTH="b",e.TIME="t",e.REPEAT="r",e.ZONE_ADJUSTMENTS="z",e.KEY="k",e.ATTRIBUTE="a",e.MEDIA="m"}(s||(s={}));class y{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,u)}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,d)}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 v extends y{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(),u=this.parseConnection(),d=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:u,bandwidths:d,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 b;for(;this.currentLine<this.records.length;){const t=this.getCurrentRecord();if(t.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(t,(e=>d(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 A(e);for(;this.currentLine<this.records.length;){const e=this.getCurrentRecord();if(e.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(e,(e=>d(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,d);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,u);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,d);this.consumeSpaceForRecord(e);const o=this.extractOneOrMore(e,d);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,d);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,d);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 y{constructor(...e){super(...e),S(this,"attributes",void 0),S(this,"digested",!1)}extractOneOrMore(e,t,r){const i=this.consumeOneOrMore(e.attValue,e._cur,t),n=e.attValue.slice(e._cur,i),[o,s]=r||[];if("number"==typeof o&&n.length<o)throw new Error("error in length, should be more or equal than ".concat(o," characters."));if("number"==typeof s&&n.length>s)throw new Error("error in length, should be less or equal than ".concat(s," characters."));return e._cur=i,n}consumeAttributeSpace(e){if(e.attValue[e._cur]!==o)throw new Error("Invalid space at ".concat(e._cur,"."));e._cur+=1}extract(e,t,...r){if(!e.attValue)throw new Error("Nothing to extract from attValue.");const i=t.call(this,e.attValue,e._cur,...r),n=e.attValue.slice(e._cur,i);return e._cur=i,n}atEnd(e){if(!e.attValue)throw new Error;return e._cur>=e.attValue.length}peekChar(e){if(!e.attValue)throw new Error;return e.attValue[e._cur]}peek(e,t){if(!e.attValue)throw new Error;for(let r=0;r<t.length;r++)if(t[r]!==e.attValue[e._cur+r])return!1;return!0}parseIceUfrag(e){if(this.attributes.iceUfrag)throw new Error("Invalid ice-ufrag, should be only a single line if 'a=ice-ufrag'");this.attributes.iceUfrag=this.extractOneOrMore(e,E,[4,256])}parseIcePwd(e){if(this.attributes.icePwd)throw new Error("Invalid ice-pwd, should be only a single line if 'a=ice-pwd'");this.attributes.icePwd=this.extractOneOrMore(e,E,[22,256])}parseIceOptions(e){if(this.attributes.iceOptions)throw new Error("Invalid ice-options, should be only one 'ice-options' line");const t=[];for(;!this.atEnd(e);){t.push(this.extractOneOrMore(e,E));try{this.consumeAttributeSpace(e)}catch(t){if(this.atEnd(e))break;throw t}}this.attributes.iceOptions=t}parseFingerprint(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill);this.attributes.fingerprints.push({hashFunction:t,fingerprint:r})}parseExtmap(e){const t=this.extractOneOrMore(e,a);let r;"/"===this.peekChar(e)&&(this.extract(e,this.consume,"/"),r=this.extract(e,this.consumeToken)),this.consumeAttributeSpace(e);const i=this.extract(e,this.consumeTill,o),n=g(g({entry:parseInt(t,10)},r&&{direction:r}),{},{extensionName:i});this.peekChar(e)===o&&(this.consumeAttributeSpace(e),n.extensionAttributes=this.extract(e,this.consumeTill)),this.attributes.extmaps.push(n)}parseSetup(e){if(this.attributes.setup)throw new Error("must only be one single 'a=setup' line.");const t=this.extract(e,this.consumeTill);if("active"!==t&&"passive"!==t&&"actpass"!==t&&"holdconn"!==t)throw new Error("role must be one of 'active', 'passive', 'actpass', 'holdconn'.");this.attributes.setup=t}}class b 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,m)}parseIdentity(e){const t=this.extractOneOrMore(e,_),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.extract(e,this.consume,"=");const i=this.extractOneOrMore(e,(e=>e!==o&&f(e)));r.push({name:t,value:i})}this.attributes.identities.push({assertionValue:t,extensions:r})}parseMsidSemantic(e){this.peekChar(e)===o&&this.consumeAttributeSpace(e);const t={semantic:this.extract(e,this.consumeToken),identifierList:[]};for(;;){try{this.consumeAttributeSpace(e)}catch(e){break}if("*"===this.peekChar(e)){this.extract(e,this.consume,"*"),t.applyForAll=!0;break}{const r=this.extract(e,this.consumeTill,o);t.identifierList.push(r)}}this.attributes.msidSemantic=t}}class A 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,E,[1,32]);this.consumeAttributeSpace(e);const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const i=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const n=this.extractOneOrMore(e,a,[1,10]);this.consumeAttributeSpace(e);const s=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const u=this.extract(e,this.consumePort);this.consumeAttributeSpace(e),this.extract(e,this.consume,"typ"),this.consumeAttributeSpace(e);const d={foundation:t,componentId:r,transport:i,priority:n,connectionAddress:s,port:u,type:this.extract(e,this.consumeToken),extension:{}};for(this.peek(e," raddr")&&(this.extract(e,this.consume," raddr"),this.consumeAttributeSpace(e),d.relAddr=this.extract(e,this.consumeAddress)),this.peek(e," rport")&&(this.extract(e,this.consume," rport"),this.consumeAttributeSpace(e),d.relPort=this.extract(e,this.consumePort));this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e),d.extension[t]=this.extractOneOrMore(e,c)}this.attributes.candidates.push(d)}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,d),this.consumeAttributeSpace(e),t.addressType=this.extractOneOrMore(e,d),this.consumeAttributeSpace(e),t.address=this.extract(e,this.consumeAddress)),this.attributes.rtcp=t}parseMsid(e){const t={id:this.extractOneOrMore(e,d,[1,64])};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.appdata=this.extractOneOrMore(e,d,[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 v).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 Dn=new class extends Ri{constructor(){super(...arguments),An(this,"currentUploadLogID",0)}reportLogUploadError(e){const t=e.errorRange;t[t.length-1]&&t[t.length-1]>this.currentUploadLogID&&(this.currentUploadLogID=t[t.length-1],this.emit("REPORT_LOG_UPLOAD",e))}};class Pn{constructor(e){An(this,"logger",void 0),An(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 Ln(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function kn(){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 Mn={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},Un=Date.now(),xn=e=>{for(const t in Mn)if(Object.prototype.hasOwnProperty.call(Mn,t)&&Mn[t]===e)return t;return"DEFAULT"};const Vn=new class{constructor(){An(this,"proxyServerURL",void 0),An(this,"logLevel",Mn.DEBUG),An(this,"uploadState","collecting"),An(this,"uploadLogWaitingList",[]),An(this,"uploadLogUploadingList",[]),An(this,"uploadErrorCount",0),An(this,"currentLogID",0),An(this,"url",void 0),An(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=[Mn.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=[Mn.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=[Mn.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=[Mn.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=[Mn.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 Pn(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()-Un<100)return void setTimeout((()=>{this.log(...t)}),Date.now()-Un);const i=Math.max(0,Math.min(4,t[0]));if(t[0]=Ln()+" Agora-SDK [".concat(xn(i),"]:"),this.appendLogToWaitingList(i,...t),i<this.logLevel)return;const n=Ln()+" %cAgora-SDK [".concat(xn(i),"]:");let o=[];if(!yn("USE_NEW_LOG"))switch(i){case Mn.DEBUG:o=[n,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case Mn.INFO:o=[n,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case Mn.WARNING:o=[n,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case Mn.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()-Un<100)return void setTimeout((()=>{this.uploadLog(...t)}),Date.now()-Un);const i=Math.max(0,Math.min(4,t[0]));t[0]=Ln()+" Agora-SDK [".concat(xn(i),"]:"),this.appendLogToWaitingList(i,...t)}appendLogToWaitingList(e){if(!yn("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]=kn()+" Agora-SDK [".concat(xn(e),"]:"):r[0]=kn()+" Agora-SDK [".concat(xn(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:mn,process_id:yn("PROCESS_ID"),payload:JSON.stringify(e)};return cn((async()=>{const e=await Dr.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(yn("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(yn("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),Dn.reportLogUploadError(r),!0}),{timeout:yn("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:yn("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,yn("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),yn("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),yn("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),yn("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}};var Fn;(Fn={}).FREE="free",Fn.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 Bn=function(e){return e[e.RECOVER=0]="RECOVER",e[e.WARNING=1]="WARNING",e[e.ERROR=2]="ERROR",e}({}),jn=function(e){return e.CONFIG_DISTRIBUTE="config-distribute-error",e}({});const Wn={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let Gn=function(e){return e.PUBLISH="publish",e.SUBSCRIBE="subscribe",e.WS_COMPRESSOR_INIT="ws_compressor_init",e.SESSION_INIT="session_init",e.JOIN_CHOOSE_SERVER="join_choose_server",e.RTE_DETAIL="rte_detail_stats",e.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.XLA_PEER_FIRST_VIDEO_FRAME="xla_peer_first_video_frame",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics",e.PC_STATS="pc_stats",e.UPDATE_REMOTE_RTPCAPABILITIES="update_remote_rtpCapabilities",e.AB_TEST="ab_test",e.ALARM_STATUS_NOTIFY="alarm_status_notify",e}({}),Hn=function(e){return e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.RTE_DETAIL="io.agora.pb.Wrtc.RteDetailStats",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_GATEWAY="io.agora.pb.Wrtc.JoinGateway",e.RE_JOIN_GATEWAY="io.agora.pb.Wrtc.ReJoinGateway",e.PUBLISH="io.agora.pb.Wrtc.Publish",e.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",e.WS_COMPRESSOR_INIT="io.agora.pb.Wrtc.WsCompressorInit",e.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",e.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",e.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",e.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",e.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",e.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",e.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",e.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",e.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",e.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",e.XLA_PEER_FIRST_VIDEO_FRAME="io.agora.pb.Wrtc.XLAPeerFirstVideoFrame",e.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",e.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",e.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",e.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",e.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",e.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",e.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",e.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",e.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",e.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",e.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics",e.AUTOPLAY_FAILED="io.agora.pb.Wrtc.AutoplayFailed",e.PC_STATS="io.agora.pb.Wrtc.PCStats",e.UPDATE_REMOTE_RTPCAPABILITIES="io.agora.pb.Wrtc.UpdateRemoteRTPCapabilities",e.AB_TEST="io.agora.pb.Wrtc.ABTest",e.ALARM_STATUS_NOTIFY="io.agora.pb.Wrtc.AlarmStatusNotify",e}({});!function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}({});let Kn=function(e){return e[e.SESSION=26]="SESSION",e[e.JOIN_CHOOSE_SERVER=27]="JOIN_CHOOSE_SERVER",e[e.REQ_USER_ACCOUNT=196]="REQ_USER_ACCOUNT",e[e.JOIN_GATEWAY=28]="JOIN_GATEWAY",e[e.PUBLISH=30]="PUBLISH",e[e.SUBSCRIBE=29]="SUBSCRIBE",e[e.WS_COMPRESSOR_INIT=9430]="WS_COMPRESSOR_INIT",e[e.STREAM_SWITCH=32]="STREAM_SWITCH",e[e.AUDIO_SENDING_STOPPED=33]="AUDIO_SENDING_STOPPED",e[e.VIDEO_SENDING_STOPPED=34]="VIDEO_SENDING_STOPPED",e[e.REQUEST_PROXY_APPCENTER=35]="REQUEST_PROXY_APPCENTER",e[e.REQUEST_PROXY_WORKER_MANAGER=36]="REQUEST_PROXY_WORKER_MANAGER",e[e.API_INVOKE=41]="API_INVOKE",e[e.FIRST_VIDEO_RECEIVED=348]="FIRST_VIDEO_RECEIVED",e[e.FIRST_AUDIO_RECEIVED=349]="FIRST_AUDIO_RECEIVED",e[e.FIRST_VIDEO_DECODE=350]="FIRST_VIDEO_DECODE",e[e.FIRST_AUDIO_DECODE=351]="FIRST_AUDIO_DECODE",e[e.ON_ADD_AUDIO_STREAM=352]="ON_ADD_AUDIO_STREAM",e[e.ON_ADD_VIDEO_STREAM=353]="ON_ADD_VIDEO_STREAM",e[e.ON_UPDATE_STREAM=356]="ON_UPDATE_STREAM",e[e.ON_REMOVE_STREAM=355]="ON_REMOVE_STREAM",e[e.JOIN_CHANNEL_TIMEOUT=407]="JOIN_CHANNEL_TIMEOUT",e[e.PEER_PUBLISH_STATUS=408]="PEER_PUBLISH_STATUS",e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT",e[e.JOIN_WEB_PROXY_AP=700]="JOIN_WEB_PROXY_AP",e[e.WEBSOCKET_QUIT=671]="WEBSOCKET_QUIT",e[e.USER_ANALYTICS=1e4]="USER_ANALYTICS",e[e.AUTOPLAY_FAILED=9178]="AUTOPLAY_FAILED",e}({});const Yn="[config-restore]",Zn="websdk_ng_",zn=Zn+"blocked_config_hashes",Xn=Zn+"api_failure_records",Jn=Zn+"global_parameter",Qn=Zn+"config_restore_state";function qn(){try{const e=window.localStorage.getItem(Qn);if(e)return JSON.parse(e)}catch(e){}return{currentConfigHash:"",configVerified:!1}}function $n(){try{const e=window.localStorage.getItem(Xn);return e?JSON.parse(e):[]}catch(e){return Vn.debug("[error] ".concat(Yn," error getting API failure records:"),e),[]}}function eo(){return $n().reduce(((e,t)=>e+t.count),0)}function to(){try{const e=eo(),t=yn("MAX_CONFIG_RETRY");if(e<t)return;const r=qn().currentConfigHash;Vn.debug("[warning] ".concat(Yn," restoring config due to ").concat(e," API failures")),r&&function(e){try{const t=window.localStorage.getItem(zn);let r=[];t&&(r=JSON.parse(t).configHashes);const i=[...new Set([...r,e])];window.localStorage.setItem(zn,JSON.stringify({configHashes:i,timestamp:Date.now()})),Vn.debug("[warning] ".concat(Yn," blocked config hash: ").concat(e))}catch(e){Vn.debug("[error] ".concat(Yn," error blocking config hash:"),e)}}(r),window.localStorage.removeItem(Jn);const i=$n().slice(-5);(function(e,t){no.reportAlarm(e,t)})(null,{status:Bn.ERROR,type:jn.CONFIG_DISTRIBUTE,message:"Config cache cleared due to API failures",extend:{failureCount:e,maxRetry:t,blockedConfigHash:r,recentFailures:i.map((e=>({api:e.apiName,error:e.errorCode||e.errorMessage,count:e.count,lastTime:e.lastTimestamp})))}}),function(){try{window.localStorage.removeItem(Xn)}catch(e){Vn.debug("[error] ".concat(Yn," error clearing API failure records:"),e)}}()}catch(e){Vn.debug("[error] ".concat(Yn," error restoring config:"),e)}}function ro(e,t){try{if(!yn("ENABLE_CONFIG_RESTORE"))return;if(t&&"AgoraRTCException"===t.name){const e=yn("CONFIG_ERROR_MONITOR");if(!Array.isArray(e)||!e.includes(t.code))return}const r=window.localStorage.getItem(Jn);if(!r||r.length<20)return;if(qn().configVerified)return;const i=yn("CONFIG_RESTORE_ERROR_API");if(!Array.isArray(i)||!i.includes(e))return;let n,o;t&&(t.code&&(n=t.code),o=t.message?t.message:"string"==typeof t?t:t.toString()),function(e,t,r){try{const i=$n(),n="".concat(e,":").concat(t||""),o=i.find((e=>"".concat(e.apiName,":").concat(e.errorCode||"")===n)),s=qn().currentConfigHash;if(o)o.count++,o.lastTimestamp=Date.now(),r&&(o.errorMessage=r),s&&(o.configHash=s);else{const n=Date.now();i.push({apiName:e,errorCode:t,errorMessage:r,count:1,firstTimestamp:n,lastTimestamp:n,configHash:s||void 0})}const a=i.length>20?i.slice(-20):i;window.localStorage.setItem(Xn,JSON.stringify(a))}catch(e){Vn.debug("[error] ".concat(Yn," error saving API failure record:"),e)}}(e,n,o);const s=eo(),a=yn("MAX_CONFIG_RETRY");Vn.debug("".concat(Yn," API failure count: ").concat(s,"/").concat(a,", API: ").concat(e,", Error: ").concat(n||o)),s>=a&&to()}catch(e){}}function io(){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){Vn.warning(e),c=[]}try{JSON.stringify(c)}catch(e){Vn.warning("arguments for method ".concat(o,".").concat(String(r)," not serializable for apiInvoke.")),c=[]}const u=(e.report||no).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:Ci.TRACER,reportResult:e.reportResult},e.throttleTime);try{const t=n.apply(this,s);return t instanceof Promise?t.then((t=>(u.onSuccess(e.reportResult&&t),t))).catch((e=>{throw u.onError(e),e})):(u.onSuccess(e.reportResult&&t),t)}catch(e){throw u.onError(e),e}}}return i}}const no=new class{constructor(){An(this,"baseInfoMap",new Map),An(this,"proxyServer",void 0),An(this,"eventUploadTimer",void 0),An(this,"setSessionIdTimer",void 0),An(this,"url",void 0),An(this,"sids",new Set),An(this,"backupUrl",void 0),An(this,"_appId",void 0),An(this,"_aid",0),An(this,"keyEventUploadPendingItems",[]),An(this,"normalEventUploadPendingItems",[]),An(this,"apiInvokeUploadPendingItems",[]),An(this,"apiInvokeCount",0),An(this,"apiInvokeLoggedCount",0),An(this,"ltsList",[]),An(this,"lastSendNormalEventTime",Date.now()),An(this,"customReportCounterTimer",void 0),An(this,"customReportCount",0),An(this,"extApiInvoke",(async e=>{for(const t of e){const e=In(In({},t),{},{sid:null,invokeId:++this.apiInvokeCount,tag:Ci.TRACER});this.sendApiInvoke(e)}})),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),yn("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),yn("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=wn(e,2);return t[0]+t[1]})),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=!!yn("SHOW_REPORT_INVOKER_LOG"),s=!!yn("SHOW_REPORT_USER_INVOKER_LOG"),a=o||s&&t.id;a&&(this.apiInvokeLoggedCount+=1);const c=this.apiInvokeLoggedCount;function u(e,r){if(a){let i="[apiInvoke-".concat(c,"]");if(t.id&&(i+="[".concat(t.id,"]")),t.name&&(i+="[".concat(t.name,"]"),t.name===Ii.JOIN))return Vn.info("".concat(i," ").concat(e));Vn.info("".concat(i," ").concat(e),"start"===e?t.options:r||"")}}const d=()=>({tag:t.tag,invokeId:n,sid:e,name:t.name,apiInvokeTime:i,options:t.options,states:t.states||null});u("start");let l=!1;Zi(t.timeout).then((()=>{l||(this.sendApiInvoke(In(In({},d()),{},{error:hi.API_INVOKE_TIMEOUT,success:!1})),u("timeout"),ro(t.name,new pi(hi.API_INVOKE_TIMEOUT)))}));const h=new pi(hi.UNEXPECTED_ERROR,"".concat(t.name,": this api invoke is end"));return{onSuccess:e=>{const i=()=>{if(l)throw h;return l=!0,this.sendApiInvoke(In(In({},d()),{},{success:!0},t.reportResult&&{result:e})),u("onSuccess"),e};return r?Qi(i,t.name+"Success",r,(()=>l=!0)):i()},onError:e=>{const i=()=>{if(l)throw e;l=!0,this.sendApiInvoke(In(In({},d()),{},{success:!1,error:e})),ro(t.name,e),u("onFailure",e.toString())};return r?Qi(i,t.name+"Error",r,(()=>l=!0)):i()}}}_send(e,t,r){this.send({type:e,data:t},r)}_sendApiInvoke(e){return this.sendApiInvoke(e)}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),i=this.createBaseInfo(e,r);i.cname=t.cname,i.rteUrl=t.rteUrl;const n=Object.assign({},{willUploadConsoleLog:yn("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:_n?"global":"oversea",areas:yn("AREAS")&&yn("AREAS").join(",")},t.extend),o=t.stringUid,s=t.channelProfile,a=t.channelMode,c=t.isABTestSuccess,u=t.lsid,d=t.clientRole,l=Date.now(),h=In(In({},i),{},{eventType:Gn.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,buildFormat:t.buildFormat,build:"v4.24.4-0-gb4d645709-dirty(5/26/2026, 6:19:32 PM)",lts:l,elapse:l-r,extend:JSON.stringify(n),mode:t.mode,process:yn("PROCESS_ID"),appType:yn("APP_TYPE"),success:!0,version:mn,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:u,clientType:window.navigator.userAgent.includes("AgoraWebView")?42:20,clientRole:d,serviceId:yn("PROCESS_ID"),extensionID:yn("PLUGIN_INFO").join(",")||"",rteUrl:t.rteUrl,rteSid:t.rteSid,installId:En()});this.send({type:Hn.SESSION,data:h},!0)}reportRteDetail(e){const t=this.baseInfoMap.get(e);if(!t)return;const r=t.info,i=Date.now(),n=In(In({},r),{},{eventType:Gn.RTE_DETAIL,lts:i,success:!0,elapse:i-t.startTime,vid:void 0===r.vid?0:Number(r.vid),ua:navigator.userAgent});this.send({type:Hn.RTE_DETAIL,data:n},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info;t.vid&&(i.vid=t.vid);const n=Date.now(),o=In(In({},i),{},{role:t.role,eventType:Gn.JOIN_CHOOSE_SERVER,lts:n,eventElapse:t.elapse||n-t.lts,chooseServerAddr:t.csAddr,errorCode:t.ec,elapse:n-r.startTime,success:t.succ,chooseServerAddrList:JSON.stringify(t.serverList),uid:t.uid?parseInt(t.uid):null,cid:t.cid?parseInt(t.cid):null,chooseServerIp:t.csIp||"",opid:t.opid,unilbsServerIds:t.unilbsServerIds,extend:t.extend||void 0,isHttp3:t.isHttp3,corssRegionTagReq:t.corssRegionTagReq||void 0,corssRegionTagRes:t.corssRegionTagRes||void 0,ua:navigator.userAgent,resourceTimingInfo:t.resourceTimingInfo||void 0});this.send({type:Hn.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=In(In({},i),{},{eventType:Gn.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:Hn.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(),o=t.firstSuccess,s=t.addr,a=t.isProxy,c=n-r.startTime,u=In(In({},i),{},{eventType:Gn.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,gatewayIp:null,gatewayPort:null,isProxy:a?1:0}),d=u.success?1:0;if(t.succ&&(r.lastJoinSuccessTime=n),s)if("1"===u.signalChannel){const e=Nn(/(\d+\.\d+\.\d+\.\d+):(\d+)/,{ip:1,port:2}),t=s.match(e);u.gatewayIp=t&&t.groups?t.groups.ip:"",u.gatewayPort=t&&t.groups?t.groups.port:""}else if(a){const e=s.match(/h=(\d{1,3}-){3}\d{1,3}/g),t=s.match(/p=[0-9]{1,6}/g);u.gatewayIp=e&&e.length?e[0].split("=")[1].replace(/-/g,"."):"",u.gatewayPort=t&&t.length?t[0].split("=")[1]:""}else{const e=s.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),t=s.match(/(:|p=)[0-9]{1,6}/g);u.gatewayIp=e&&e.length?e[0].split("//")[1].replace(/-/g,"."):"",u.gatewayPort=t&&t.length?t[0].split(/:|p=/g)[1]:""}if(o)this.send({type:Hn.JOIN_GATEWAY,data:u},!0);else{const e={isSuccess:d,port:u.gatewayPort};delete u.success,delete u.eventType,delete u.firstSuccess,delete u.gatewayPort,u.vid=Number(u.vid);const t=Object.assign({},u,e,{eventType:Gn.REJOIN_GATEWAY});this.send({type:Hn.RE_JOIN_GATEWAY,data:t},!0)}}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=Date.now(),n=In(In({},r.info),{},{lts:i,timeout:t,elapse:i-r.startTime});this.send({type:Hn.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=In(In({},i),{},{eventType:Gn.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:Hn.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=In(In({},n),{},{eventType:Gn.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:Hn.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=In(In({},n),{},{eventType:Gn.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-i.startTime,status:e.status?1:2});this.send({type:Hn.WS_COMPRESSOR_INIT,data:s},!0)}firstXLAPeerFirstVideoFrame(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=t.peerPubStatusMs-(r.lastJoinSuccessTime||n),s=In(In({},i),{},{elapse:n-r.startTime,eventType:Gn.XLA_PEER_FIRST_VIDEO_FRAME,lts:n,peer:t.peer,width:t.width,height:t.height,ssrc:t.ssrc,p2pid:t.p2pid,peerPublishDuration:t.peerPublishDuration,joinChannelSuccessElapse:o,peerPubStatusMs:t.peerPubStatusMs-t.joinChannelStart,availablePublish:t.peerPublishDuration>o?1:0,preloadStart:Math.max(t.preloadStart-t.joinChannelStart,0),preloadEnd:Math.max(t.preloadEnd-t.joinChannelStart,0),encrypt:Math.max(t.apStart-t.joinChannelStart,0),ap:Math.max(t.apEnd-t.joinChannelStart,0),sua:Math.max(t.suaEnd-t.joinChannelStart,0),beforeConnect:Math.max(t.beforeConnect-t.joinChannelStart,0),peerRecevier:Math.max(t.peerReceiver-t.joinChannelStart,0),ice:Math.max(t.ice-t.joinChannelStart,0),pc:Math.max(t.pc-t.joinChannelStart,0),signalConnected:Math.max(t.signalConnected-t.joinChannelStart,0),joinReq:Math.max(t.joinReq-t.joinChannelStart,0),joinRes:Math.max(t.joinRes-t.joinChannelStart,0),userJoinNotify:Math.max(t.userJoinNotify-t.joinChannelStart,0),videoSsrcNotify:Math.max(t.videoAddNotify-t.joinChannelStart,0),subscribeDelayMs:Math.max(t.subscribeStart-t.videoAddNotify,0),subscribeStart:Math.max(t.subscribeStart-t.joinChannelStart,0),subscribeEnd:Math.max(t.subscribeEnd-t.joinChannelStart,0),firstReceived:Math.max(t.firstReceived-t.joinChannelStart,0),firstDecoded:Math.max(t.firstDecoded-t.joinChannelStart,0),firstPreRender:Math.max(t.firstPreRender-t.joinChannelStart,0),firstRender:Math.max(t.firstRender-t.joinChannelStart,0),playDelayMs:Math.max(t.playStart-t.subscribeEnd,0),playStart:Math.max(t.playStart-t.joinChannelStart,0),playEnd:Math.max(t.playEnd-t.joinChannelStart,0),isPreSub:t.isPreSub?1:0,isPrePc:t.isPrePc?1:0,isPreInstantVideo:t.isPreInstantVideo?1:0,firstReceivedEncodedFrame:t.firstReceivedEncodedFrame?Math.max(t.firstReceivedEncodedFrame-t.joinChannelStart,0):void 0,frameType:t.frameType||"",rtpTimestamp:t.rtpTimestamp||0,framePayloadType:t.framePayloadType||0,frameDataLength:t.frameDataLength||0,mimeType:t.mimeType||"",sdpEndPoint:t.sdpEndPoint?1:0});this.send({type:Hn.XLA_PEER_FIRST_VIDEO_FRAME,data:s},!0)}firstRemoteVideoDecode(e,t,r,i){const n=this.baseInfoMap.get(e);if(!n)return;const o=n.info,s=Date.now(),a=In(In(In({},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=In(In(In({},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=In(In(In({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),elapse:n-r.startTime,eventType:Gn.AB_TEST,lts:n});this.send({type:Hn.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=In(In(In({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),elapse:n-r.startTime,eventType:Gn.PC_STATS,lts:n,preallocation:t.preallocation?1:0});this.send({type:Hn.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=In(In(In({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),eventType:Gn.UPDATE_REMOTE_RTPCAPABILITIES,lts:n});this.send({type:Hn.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=In(In(In({},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=In(In({},i),{},{eventType:Gn.STREAM_SWITCH,lts:n,isDual:t.isdual,elapse:n-r.startTime,success:t.succ});this.send({type:Hn.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=In(In({},i),{},{eventType:Gn.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:Hn.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=In(In({},i),{},{eventType:Gn.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:Hn.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?Vn.debug("reportProxyServerurl: ".concat(e)):Vn.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=In(In({},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:Hn.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=Yi(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]=di(di({},e),{},{[t]:i.substring(o,c)}),o=c,a=i.charCodeAt(c)<=127?1:3);return o!==i.length-1&&(s[s.length]=di(di({},e),{},{[t]:i.substring(o)})),s})(In(In(In({},i),t),{},{elapse:n-r.startTime,lts:n,productType:"WebRTC"}),"payload",1300).forEach((e=>this.send({type:Hn.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=In(In(In({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:Hn.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=In(In(In({},i),t),{},{elapse:n-r.startTime,lts:n,extend:t.extend||void 0});this.send({type:Hn.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=In(In(In({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:Hn.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>yn("CUSTOM_REPORT_LIMIT"))throw new pi(hi.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((()=>{this.customReportCount=0}),5e3));const r=Date.now(),i=t.map((t=>({type:Hn.USER_ANALYTICS,data:In(In({sid:e},t),{},{lts:r})})));try{yn("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(i):await this.postDataToStatsCollector(i)}catch(e){throw Vn.error("send custom report message failed",e.toString()),new pi(hi.CUSTOM_REPORT_SEND_FAILED,e.message)}}reportAlarm(e,t){const r=e?this.baseInfoMap.get(e):void 0,i=null==r?void 0:r.info,n=Date.now(),o=In(In(In({},i),t),{},{vid:void 0===(null==i?void 0:i.vid)?0:Number(i.vid),elapse:r?n-r.startTime:0,eventType:Gn.ALARM_STATUS_NOTIFY,lts:n,installId:En(),processId:yn("PROCESS_ID")});this.send({type:Hn.ALARM_STATUS_NOTIFY,data:o},!0)}sendApiInvoke(e){const t=yn("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 i=r.info,n=i.cname,o=i.uid,s=i.cid;let a;if(e.lts=e.lts||Date.now(),e.error)if(e.error instanceof pi){const t=e.error,r=t.code,i=t.message;a=r||i||e.error.toString()}else a=e.error.toString();const c={invokeId:e.invokeId,sid:e.sid,cname:n,cid:s,uid:o,lts:e.lts,success:e.success,elapse:e.lts-r.startTime,execElapse:e.lts-e.apiInvokeTime,apiName:e.name,options:e.options?JSON.stringify(e.options):void 0,execStates:e.states?JSON.stringify(e.states):void 0,execResult:e.result?JSON.stringify(e.result):void 0,errorCode:e.error?a:void 0,errorMsg:e.error?JSON.stringify(e.error):void 0};return this.send({type:Hn.API_INVOKE,data:c},!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>yn("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()),yn("ENABLE_EVENT_REPORT")?(r.length&&(yn("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{yn("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>yn("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-yn("NORMAL_EVENT_QUEUE_CAPACITY")),Vn.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){ki.networkState===wi.OFFLINE&&await Promise.race([ki.onlineWaiter,Zi(2*an.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(Hn).forEach((r=>{let i=wn(r,2),n=i[0];i[1]===e.type&&(t=Kn[n])})),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=vi(t,new Uint8Array(i)),t=vi(t,r)})),t},r="event";let i=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(yn("NEW_REPORT_SERVER_DOMAINS")[0],"&p=443&d=").concat(r):"https://".concat(yn("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(yn("NEW_REPORT_SERVER_DOMAINS")[1],"&p=443&d=").concat(r):"https://".concat(yn("NEW_REPORT_SERVER_DOMAINS")[1],"/").concat(r));try{await ln(i,{timeout:1e4,data:t(e),headers:In(In({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};ki.networkState===wi.OFFLINE&&await Promise.race([ki.onlineWaiter,Zi(2*an.maxRetryTimeout)]);const o=t?"/events/proto-raws":"/events/messages";let s=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(yn("EVENT_REPORT_DOMAIN"),"&p=").concat(yn("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(yn("EVENT_REPORT_DOMAIN"),":").concat(yn("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(yn("EVENT_REPORT_BACKUP_DOMAIN"),"&p=").concat(yn("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(yn("EVENT_REPORT_BACKUP_DOMAIN"),":").concat(yn("STATS_COLLECTOR_PORT")).concat(o)));try{t?await hn(s,{timeout:1e4,data:n}):await ln(s,{timeout:1e4,data:n})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},Wn);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:Ci.TRACER}).onSuccess()}};Dn.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=ki.networkState,no.reportApiInvoke(null,{name:"logUploadError",options:e,tag:Ci.TRACER}).onSuccess("logUploadError")}));const oo={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1,supportDataChannel:!1,supportPCSetConfiguration:!1,supportWebRTCEncodedTransform:!1,supportWebRTCInsertableStream:!1,supportRequestVideoFrameCallback:!1,supportWebCrypto:!1,supportSuppressLocalAudioPlayback:!1,supportRestrictOwnAudio:!1};function so(){const e=xr();oo.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),oo.getStreamFromExtension=e.name===Lr.CHROME&&Number(e.version)>34,oo.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}(),oo.supportMinBitrate=e.name===Lr.CHROME||e.name===Lr.EDGE,oo.supportSetRtpSenderParameters=function(){const e=xr();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!ni()||(!(!Gr()&&!jr())||e.name===Lr.FIREFOX&&Number(e.version)>=64)}(),e.name===Lr.SAFARI&&(Number(e.version)>=14?oo.supportDualStream=!0:oo.supportDualStream=!1),oo.webAudioMediaStreamDest=function(){const e=xr();if(e.name===Lr.SAFARI&&Number(e.version)<12)return!1;return!0}(),oo.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),oo.supportWebGL="undefined"!=typeof WebGLRenderingContext,oo.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,ni()||(oo.webAudioWithAEC=!0),oo.supportShareAudio=function(){const e=xr();if((e.os===Pr.WIN_10||e.os===Pr.WIN_81||e.os===Pr.WIN_7||e.os===Pr.LINUX||e.os===Pr.MAC_OS||e.os===Pr.CHROMIUM_OS)&&e.name===Lr.CHROME&&Number(e.version)>=74)return!0;return!1}(),oo.supportDataChannel=function(){if(Zr(76)||Jr(68)||function(e){const t=xr();return!(t.name!==Lr.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),oo.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!Kr()&&!!e&&e.prototype.setConfiguration instanceof Function}(),oo.supportWebRTCEncodedTransform=Zr(87)||function(){const e=xr();if(e.name!==Lr.SAFARI||!e.browserVersion)return!1;const t=e.browserVersion.split(".");return Number(t[0])>15||15===Number(t[0])&&Number(t[1])>=4}()||Jr(117),oo.supportWebRTCInsertableStream=function(){const e=xr();return(e.name===Lr.CHROME||e.name===Lr.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),oo.supportRequestVideoFrameCallback=function(){if("requestVideoFrameCallback"in HTMLVideoElement.prototype)return!0;return!1}(),oo.supportWebCrypto="undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle,oo.supportSuppressLocalAudioPlayback=ho(),oo.supportRestrictOwnAudio=po(),ji((()=>{oo.supportDualStreamEncoding=function(){const e=xr();if(yn("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&yn("CHROME_DUAL_STREAM_USE_ENCODING"))}(),Vn.debug("browser ua: ",navigator.userAgent),Vn.info("browser info: ",e),Vn.info("browser compatibility: ",oo)}))}function ao(){return oo}function co(){return"setSinkId"in HTMLAudioElement.prototype&&(!yn("RESTRICTION_SET_PLAYBACK_DEVICE")||(Wr()||Hr())&&!ii())}function uo(){return!oo.supportUnifiedPlan||yn("CHROME_FORCE_PLAN_B")&&ni()}function lo(){return navigator.mediaDevices&&"getSupportedConstraints"in navigator.mediaDevices}function ho(){if(lo()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("suppressLocalAudioPlayback"in e)||!e.suppressLocalAudioPlayback)}return Zr(141)||Xr(141)||Qr(141)}function po(){if(lo()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("restrictOwnAudio"in e)||!e.restrictOwnAudio)}return Zr(141)||Xr(141)||Qr(125)}let fo=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 Eo=function(e){try{return!!e()}catch(e){return!0}},mo=!Eo((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),_o=mo,To=Function.prototype,go=To.call,So=_o&&To.bind.bind(go,go),yo=_o?So:function(e){return function(){return go.apply(e,arguments)}},vo=yo({}.isPrototypeOf),Ro=function(e){return e&&e.Math===Math&&e},bo=Ro("object"==typeof globalThis&&globalThis)||Ro("object"==typeof window&&window)||Ro("object"==typeof self&&self)||Ro("object"==typeof z&&z)||Ro("object"==typeof z&&z)||function(){return this}()||Function("return this")(),Ao=mo,Oo=Function.prototype,Io=Oo.apply,Co=Oo.call,wo="object"==typeof Reflect&&Reflect.apply||(Ao?Co.bind(Io):function(){return Co.apply(Io,arguments)}),No=yo,Do=No({}.toString),Po=No("".slice),Lo=function(e){return Po(Do(e),8,-1)},ko=Lo,Mo=yo,Uo=function(e){if("Function"===ko(e))return Mo(e)},xo="object"==typeof document&&document.all,Vo=void 0===xo&&void 0!==xo?function(e){return"function"==typeof e||e===xo}:function(e){return"function"==typeof e},Fo={},Bo=!Eo((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),jo=mo,Wo=Function.prototype.call,Go=jo?Wo.bind(Wo):function(){return Wo.apply(Wo,arguments)},Ho={},Ko={}.propertyIsEnumerable,Yo=Object.getOwnPropertyDescriptor,Zo=Yo&&!Ko.call({1:2},1);Ho.f=Zo?function(e){var t=Yo(this,e);return!!t&&t.enumerable}:Ko;var zo,Xo,Jo=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Qo=Eo,qo=Lo,$o=Object,es=yo("".split),ts=Qo((function(){return!$o("z").propertyIsEnumerable(0)}))?function(e){return"String"===qo(e)?es(e,""):$o(e)}:$o,rs=function(e){return null==e},is=rs,ns=TypeError,os=function(e){if(is(e))throw new ns("Can't call method on "+e);return e},ss=ts,as=os,cs=function(e){return ss(as(e))},us=Vo,ds=function(e){return"object"==typeof e?null!==e:us(e)},ls={},hs=ls,ps=bo,fs=Vo,Es=function(e){return fs(e)?e:void 0},ms=function(e,t){return arguments.length<2?Es(hs[e])||Es(ps[e]):hs[e]&&hs[e][t]||ps[e]&&ps[e][t]},_s=bo.navigator,Ts=_s&&_s.userAgent,gs=Ts?String(Ts):"",Ss=bo,ys=gs,vs=Ss.process,Rs=Ss.Deno,bs=vs&&vs.versions||Rs&&Rs.version,As=bs&&bs.v8;As&&(Xo=(zo=As.split("."))[0]>0&&zo[0]<4?1:+(zo[0]+zo[1])),!Xo&&ys&&(!(zo=ys.match(/Edge\/(\d+)/))||zo[1]>=74)&&(zo=ys.match(/Chrome\/(\d+)/))&&(Xo=+zo[1]);var Os=Xo,Is=Os,Cs=Eo,ws=bo.String,Ns=!!Object.getOwnPropertySymbols&&!Cs((function(){var e=Symbol("symbol detection");return!ws(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Is&&Is<41})),Ds=Ns&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ps=ms,Ls=Vo,ks=vo,Ms=Object,Us=Ds?function(e){return"symbol"==typeof e}:function(e){var t=Ps("Symbol");return Ls(t)&&ks(t.prototype,Ms(e))},xs=String,Vs=function(e){try{return xs(e)}catch(e){return"Object"}},Fs=Vo,Bs=Vs,js=TypeError,Ws=function(e){if(Fs(e))return e;throw new js(Bs(e)+" is not a function")},Gs=Ws,Hs=rs,Ks=function(e,t){var r=e[t];return Hs(r)?void 0:Gs(r)},Ys=Go,Zs=Vo,zs=ds,Xs=TypeError,Js={exports:{}},Qs=bo,qs=Object.defineProperty,$s=bo,ea=function(e,t){try{qs(Qs,e,{value:t,configurable:!0,writable:!0})}catch(r){Qs[e]=t}return t},ta="__core-js_shared__",ra=Js.exports=$s[ta]||ea(ta,{});(ra.versions||(ra.versions=[])).push({version:"3.49.0",mode:"pure",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ia=Js.exports,na=ia,oa=function(e,t){return na[e]||(na[e]=t||{})},sa=os,aa=Object,ca=function(e){return aa(sa(e))},ua=ca,da=yo({}.hasOwnProperty),la=Object.hasOwn||function(e,t){return da(ua(e),t)},ha=yo,pa=0,fa=Math.random(),Ea=ha(1.1.toString),ma=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ea(++pa+fa,36)},_a=oa,Ta=la,ga=ma,Sa=Ns,ya=Ds,va=bo.Symbol,Ra=_a("wks"),ba=ya?va.for||va:va&&va.withoutSetter||ga,Aa=function(e){return Ta(Ra,e)||(Ra[e]=Sa&&Ta(va,e)?va[e]:ba("Symbol."+e)),Ra[e]},Oa=Go,Ia=ds,Ca=Us,wa=Ks,Na=function(e,t){var r,i;if("string"===t&&Zs(r=e.toString)&&!zs(i=Ys(r,e)))return i;if(Zs(r=e.valueOf)&&!zs(i=Ys(r,e)))return i;if("string"!==t&&Zs(r=e.toString)&&!zs(i=Ys(r,e)))return i;throw new Xs("Can't convert object to primitive value")},Da=TypeError,Pa=Aa("toPrimitive"),La=function(e,t){if(!Ia(e)||Ca(e))return e;var r,i=wa(e,Pa);if(i){if(void 0===t&&(t="default"),r=Oa(i,e,t),!Ia(r)||Ca(r))return r;throw new Da("Can't convert object to primitive value")}return void 0===t&&(t="number"),Na(e,t)},ka=Us,Ma=function(e){var t=La(e,"string");return ka(t)?t:t+""},Ua=ds,xa=bo.document,Va=Ua(xa)&&Ua(xa.createElement),Fa=function(e){return Va?xa.createElement(e):{}},Ba=Fa,ja=!Bo&&!Eo((function(){return 7!==Object.defineProperty(Ba("div"),"a",{get:function(){return 7}}).a})),Wa=Bo,Ga=Go,Ha=Ho,Ka=Jo,Ya=cs,Za=Ma,za=la,Xa=ja,Ja=Object.getOwnPropertyDescriptor;Fo.f=Wa?Ja:function(e,t){if(e=Ya(e),t=Za(t),Xa)try{return Ja(e,t)}catch(e){}if(za(e,t))return Ka(!Ga(Ha.f,e,t),e[t])};var Qa=Eo,qa=Vo,$a=/#|\.prototype\./,ec=function(e,t){var r=rc[tc(e)];return r===nc||r!==ic&&(qa(t)?Qa(t):!!t)},tc=ec.normalize=function(e){return String(e).replace($a,".").toLowerCase()},rc=ec.data={},ic=ec.NATIVE="N",nc=ec.POLYFILL="P",oc=ec,sc=Ws,ac=mo,cc=Uo(Uo.bind),uc=function(e,t){return sc(e),void 0===t?e:ac?cc(e,t):function(){return e.apply(t,arguments)}},dc={},lc=Bo&&Eo((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),hc=ds,pc=String,fc=TypeError,Ec=function(e){if(hc(e))return e;throw new fc(pc(e)+" is not an object")},mc=Bo,_c=ja,Tc=lc,gc=Ec,Sc=Ma,yc=TypeError,vc=Object.defineProperty,Rc=Object.getOwnPropertyDescriptor,bc="enumerable",Ac="configurable",Oc="writable";dc.f=mc?Tc?function(e,t,r){if(gc(e),t=Sc(t),gc(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Oc in r&&!r[Oc]){var i=Rc(e,t);i&&i[Oc]&&(e[t]=r.value,r={configurable:Ac in r?r[Ac]:i[Ac],enumerable:bc in r?r[bc]:i[bc],writable:!1})}return vc(e,t,r)}:vc:function(e,t,r){if(gc(e),t=Sc(t),gc(r),_c)try{return vc(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new yc("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ic=dc,Cc=Jo,wc=Bo?function(e,t,r){return Ic.f(e,t,Cc(1,r))}:function(e,t,r){return e[t]=r,e},Nc=bo,Dc=wo,Pc=Uo,Lc=Vo,kc=Fo.f,Mc=oc,Uc=ls,xc=uc,Vc=wc,Fc=la,Bc=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 Dc(e,this,arguments)};return t.prototype=e.prototype,t},jc=function(e,t){var r,i,n,o,s,a,c,u,d,l=e.target,h=e.global,p=e.stat,f=e.proto,E=h?Nc:p?Nc[l]:Nc[l]&&Nc[l].prototype,m=h?Uc:Uc[l]||Vc(Uc,l,{})[l],_=m.prototype;for(o in t)i=!(r=Mc(h?o:l+(p?".":"#")+o,e.forced))&&E&&Fc(E,o),a=m[o],i&&(c=e.dontCallGetSet?(d=kc(E,o))&&d.value:E[o]),s=i&&c?c:t[o],(r||f||typeof a!=typeof s)&&(u=e.bind&&i?xc(s,Nc):e.wrap&&i?Bc(s):f&&Lc(s)?Pc(s):s,(e.sham||s&&s.sham||a&&a.sham)&&Vc(u,"sham",!0),Vc(m,o,u),f&&(Fc(Uc,n=l+"Prototype")||Vc(Uc,n,{}),Vc(Uc[n],o,s),e.real&&_&&(r||!_[o])&&Vc(_,o,s)))},Wc=Math.ceil,Gc=Math.floor,Hc=Math.trunc||function(e){var t=+e;return(t>0?Gc:Wc)(t)},Kc=Hc,Yc=function(e){var t=+e;return t!=t||0===t?0:Kc(t)},Zc=Yc,zc=Math.max,Xc=Math.min,Jc=function(e,t){var r=Zc(e);return r<0?zc(r+t,0):Xc(r,t)},Qc=Yc,qc=Math.min,$c=function(e){var t=Qc(e);return t>0?qc(t,9007199254740991):0},eu=function(e){return $c(e.length)},tu=cs,ru=Jc,iu=eu,nu=function(e){return function(t,r,i){var n=tu(t),o=iu(n);if(0===o)return!e&&-1;var s,a=ru(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}},ou={includes:nu(!0),indexOf:nu(!1)},su=jc,au=ou.includes,cu=Eo,uu=cu((function(){return!Array(1).includes()})),du=cu((function(){return[,1].includes(void 0,1)}));su({target:"Array",proto:!0,forced:uu||du},{includes:function(e){return au(this,e,arguments.length>1?arguments[1]:void 0)}});var lu=bo,hu=ls,pu=function(e,t){var r=hu[e+"Prototype"],i=r&&r[t];if(i)return i;var n=lu[e],o=n&&n.prototype;return o&&o[t]},fu=pu("Array","includes"),Eu=ds,mu=Lo,_u=Aa("match"),Tu=function(e){var t;return Eu(e)&&(void 0!==(t=e[_u])?!!t:"RegExp"===mu(e))},gu=TypeError,Su={};Su[Aa("toStringTag")]="z";var yu="[object z]"===String(Su),vu=yu,Ru=Vo,bu=Lo,Au=Aa("toStringTag"),Ou=Object,Iu="Arguments"===bu(function(){return arguments}()),Cu=vu?bu: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=Ou(e),Au))?r:Iu?bu(t):"Object"===(i=bu(t))&&Ru(t.callee)?"Arguments":i},wu=Cu,Nu=String,Du=function(e){if("Symbol"===wu(e))throw new TypeError("Cannot convert a Symbol value to a string");return Nu(e)},Pu=Aa("match"),Lu=jc,ku=function(e){if(Tu(e))throw new gu("The method doesn't accept regular expressions");return e},Mu=os,Uu=Du,xu=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Pu]=!1,"/./"[e](t)}catch(e){}}return!1},Vu=yo("".indexOf);Lu({target:"String",proto:!0,forced:!xu("includes")},{includes:function(e){return!!~Vu(Uu(Mu(this)),Uu(ku(e)),arguments.length>1?arguments[1]:void 0)}});var Fu=pu("String","includes"),Bu=vo,ju=fu,Wu=Fu,Gu=Array.prototype,Hu=String.prototype,Ku=function(e){var t=e.includes;return e===Gu||Bu(Gu,e)&&t===Gu.includes?ju:"string"==typeof e||e===Hu||Bu(Hu,e)&&t===Hu.includes?Wu:t},Yu=X(Ku);function Zu(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function zu(e,t,r,i,n){return{width:e,height:t,frameRate:r,bitrateMin:i,bitrateMax:n}}function Xu(e,t,r,i,n){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:i,bitrateMax:n}}function Ju(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const Qu={"90p":zu(160,90),"90p_1":zu(160,90),"120p":zu(160,120,15,30,65),"120p_1":zu(160,120,15,30,65),"120p_3":zu(120,120,15,30,50),"120p_4":zu(212,120),"180p":zu(320,180,15,30,140),"180p_1":zu(320,180,15,30,140),"180p_3":zu(180,180,15,30,100),"180p_4":zu(240,180,15,30,120),"240p":zu(320,240,15,40,200),"240p_1":zu(320,240,15,40,200),"240p_3":zu(240,240,15,40,140),"240p_4":zu(424,240,15,40,220),"360p":zu(640,360,15,80,400),"360p_1":zu(640,360,15,80,400),"360p_3":zu(360,360,15,80,260),"360p_4":zu(640,360,30,80,600),"360p_6":zu(360,360,30,80,400),"360p_7":zu(480,360,15,80,320),"360p_8":zu(480,360,30,80,490),"360p_9":zu(640,360,15,80,800),"360p_10":zu(640,360,24,80,800),"360p_11":zu(640,360,24,80,1e3),"480p":zu(640,480,15,100,500),"480p_1":zu(640,480,15,100,500),"480p_2":zu(640,480,30,100,1e3),"480p_3":zu(480,480,15,100,400),"480p_4":zu(640,480,30,100,750),"480p_6":zu(480,480,30,100,600),"480p_8":zu(848,480,15,100,610),"480p_9":zu(848,480,30,100,930),"480p_10":zu(640,480,10,100,400),"720p":zu(1280,720,15,120,1130),"720p_auto":zu(1280,720,30,900,3e3),"720p_1":zu(1280,720,15,120,1130),"720p_2":zu(1280,720,30,120,2e3),"720p_3":zu(1280,720,30,120,1710),"720p_5":zu(960,720,15,120,910),"720p_6":zu(960,720,30,120,1380),"1080p":zu(1920,1080,15,120,2080),"1080p_1":zu(1920,1080,15,120,2080),"1080p_2":zu(1920,1080,30,120,3e3),"1080p_3":zu(1920,1080,30,120,3150),"1080p_5":zu(1920,1080,60,120,4780),"1440p":zu(2560,1440,30,120,4850),"1440p_1":zu(2560,1440,30,120,4850),"1440p_2":zu(2560,1440,60,120,7350),"4k":zu(3840,2160,30,120,8910),"4k_1":zu(3840,2160,30,120,8910),"4k_3":zu(3840,2160,60,120,13500)},qu={"480p":Xu(640,480,5),"480p_1":Xu(640,480,5),"480p_2":Xu(640,480,30),"480p_3":Xu(640,480,15),"720p":Xu(1280,720,5),"720p_auto":zu(1280,720,30,900,3e3),"720p_1":Xu(1280,720,5),"720p_2":Xu(1280,720,30),"720p_3":Xu(1280,720,15),"1080p":Xu(1920,1080,5),"1080p_1":Xu(1920,1080,5),"1080p_2":Xu(1920,1080,30),"1080p_3":Xu(1920,1080,15)},$u={"1SL1TL":Ju(1,1),"3SL3TL":Ju(3,3),"2SL3TL":Ju(2,3)};function ed(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},Qu[e]):e}function td(e){return"string"==typeof e?Object.assign({},qu[e]):e}function rd(e){return"string"==typeof e?Object.assign({},$u[e]):e}const id={speech_low_quality:Zu(16e3,!1),speech_standard:Zu(32e3,!1,18),music_standard:Zu(48e3,!1),standard_stereo:Zu(48e3,!0,56),high_quality:Zu(48e3,!1,128),high_quality_stereo:Zu(48e3,!0,192)};function nd(e){return"string"==typeof e?Object.assign({},id[e]):e}const od=[];function sd(e){Yu(od).call(od,e)||od.push(e)}function ad(e){const t=od.indexOf(e);-1!==t&&od.splice(t,1)}function cd(){return od.some((e=>function(e){return"__className__"in e&&"MicrophoneAudioTrack"===e.__className__}(e)))}function ud(e){return _i(e.width,"config.width"),_i(e.height,"config.height"),void 0!==e.frameRate&&_i(e.frameRate,"config.frameRate"),void 0!==e.bitrateMax&&mi(e.bitrateMax,"config.bitrateMax"),void 0!==e.bitrateMin&&mi(e.bitrateMin,"config.bitrateMin"),!0}function dd(e){return void 0!==e.sampleRate&&mi(e.sampleRate,"config.sampleRate",0,96e3,!0),void 0!==e.sampleSize&&mi(e.sampleRate,"config.sampleSize",0,128,!0),void 0!==e.stereo&&fi(e.stereo,"config.stereo"),void 0!==e.bitrate&&mi(e.bitrate,"config.bitrate",0,1e4,!1),!0}function ld(e){return Ei(e,"mediaSource",["screen","window","application"]),!0}let hd=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}({}),pd=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 fd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),Ed=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}({}),md=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}({}),_d=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}({}),Td=function(e){return e.SOURCE_STATE_CHANGE="source-state-change",e.TRACK_ENDED="track-ended",e.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.CLOSED="closed",e}({}),gd=function(e){return e.FIRST_FRAME_DECODED="first-frame-decoded",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.VIDEO_STATE_CHANGED="video-state-changed",e.PLAY_START="play-start",e.PLAY_END="play-end",e.FIRST_FRAME_RENDER="first-frame-render",e}({}),Sd=function(e){return e.AUDIO="audio",e.VIDEO="video",e.DATA="data",e}({}),yd=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}({}),vd=function(e){return e.UPDATE_TRACK_SOURCE="update-track-source",e}({});const Rd={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},bd={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},Ad={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},Od={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 Id=function(e){return e.ON_TRACK="on_track",e.ON_NODE="on_node",e}({}),Cd=function(e){return e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints",e}({}),wd=function(e){return e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND",e}({}),Nd=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 Dd=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}({}),Pd=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 Ld=function(e){return e.OPEN="open",e.MESSAGE="message",e.CLOSE="close",e.CLOSING="closing",e.ERROR="error",e}({});var kd={exports:{}},Md=jc,Ud=Bo,xd=dc.f;Md({target:"Object",stat:!0,forced:Object.defineProperty!==xd,sham:!Ud},{defineProperty:xd});var Vd=ls.Object,Fd=kd.exports=function(e,t,r){return Vd.defineProperty(e,t,r)};Vd.defineProperty.sham&&(Fd.sham=!0);var Bd=X(kd.exports),jd=Lo,Wd=Array.isArray||function(e){return"Array"===jd(e)},Gd=TypeError,Hd=function(e){if(e>9007199254740991)throw new Gd("Maximum allowed index exceeded");return e},Kd=Bo,Yd=dc,Zd=Jo,zd=function(e,t,r){Kd?Yd.f(e,t,Zd(0,r)):e[t]=r},Xd=Bo,Jd=Wd,Qd=TypeError,qd=Object.getOwnPropertyDescriptor,$d=Xd&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(Jd(e)&&!qd(e,"length").writable)throw new Qd("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},el=Vo,tl=ia,rl=yo(Function.toString);el(tl.inspectSource)||(tl.inspectSource=function(e){return rl(e)});var il=tl.inspectSource,nl=yo,ol=Eo,sl=Vo,al=Cu,cl=il,ul=function(){},dl=ms("Reflect","construct"),ll=/^\s*(?:class|function)\b/,hl=nl(ll.exec),pl=!ll.test(ul),fl=function(e){if(!sl(e))return!1;try{return dl(ul,[],e),!0}catch(e){return!1}},El=function(e){if(!sl(e))return!1;switch(al(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return pl||!!hl(ll,cl(e))}catch(e){return!0}};El.sham=!0;var ml=!dl||ol((function(){var e;return fl(fl.call)||!fl(Object)||!fl((function(){e=!0}))||e}))?El:fl,_l=Wd,Tl=ml,gl=ds,Sl=Aa("species"),yl=Array,vl=function(e){var t;return _l(e)&&(t=e.constructor,(Tl(t)&&(t===yl||_l(t.prototype))||gl(t)&&null===(t=t[Sl]))&&(t=void 0)),void 0===t?yl:t},Rl=function(e,t){return new(vl(e))(0===t?0:t)},bl=Eo,Al=Os,Ol=Aa("species"),Il=function(e){return Al>=51||!bl((function(){var t=[];return(t.constructor={})[Ol]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Cl=jc,wl=Eo,Nl=Wd,Dl=ds,Pl=ca,Ll=eu,kl=Hd,Ml=zd,Ul=$d,xl=Rl,Vl=Il,Fl=Os,Bl=Aa("isConcatSpreadable"),jl=Fl>=51||!wl((function(){var e=[];return e[Bl]=!1,e.concat()[0]!==e})),Wl=function(e){if(!Dl(e))return!1;var t=e[Bl];return void 0!==t?!!t:Nl(e)};Cl({target:"Array",proto:!0,arity:1,forced:!jl||!Vl("concat")},{concat:function(e){var t,r,i,n,o,s=Pl(this),a=xl(s,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(Wl(o=-1===t?s:arguments[t]))for(n=Ll(o),kl(c+n),r=0;r<n;r++,c++)r in o&&Ml(a,c,o[r]);else kl(c+1),Ml(a,c++,o);return Ul(a,c),a}});var Gl={},Hl={},Kl=la,Yl=cs,Zl=ou.indexOf,zl=Hl,Xl=yo([].push),Jl=function(e,t){var r,i=Yl(e),n=0,o=[];for(r in i)!Kl(zl,r)&&Kl(i,r)&&Xl(o,r);for(;t.length>n;)Kl(i,r=t[n++])&&(~Zl(o,r)||Xl(o,r));return o},Ql=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ql=Jl,$l=Ql,eh=Object.keys||function(e){return ql(e,$l)},th=Bo,rh=lc,ih=dc,nh=Ec,oh=cs,sh=eh;Gl.f=th&&!rh?Object.defineProperties:function(e,t){nh(e);for(var r,i=oh(t),n=sh(t),o=n.length,s=0;o>s;)ih.f(e,r=n[s++],i[r]);return e};var ah,ch=ms("document","documentElement"),uh=ma,dh=oa("keys"),lh=function(e){return dh[e]||(dh[e]=uh(e))},hh=Ec,ph=Gl,fh=Ql,Eh=Hl,mh=ch,_h=Fa,Th="prototype",gh="script",Sh=lh("IE_PROTO"),yh=function(){},vh=function(e){return"<"+gh+">"+e+"</"+gh+">"},Rh=function(e){e.write(vh("")),e.close();var t=e.parentWindow.Object;return e=null,t},bh=function(){try{ah=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;bh="undefined"!=typeof document?document.domain&&ah?Rh(ah):(t=_h("iframe"),r="java"+gh+":",t.style.display="none",mh.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(vh("document.F=Object")),e.close(),e.F):Rh(ah);for(var i=fh.length;i--;)delete bh[Th][fh[i]];return bh()};Eh[Sh]=!0;var Ah=Object.create||function(e,t){var r;return null!==e?(yh[Th]=hh(e),r=new yh,yh[Th]=null,r[Sh]=e):r=bh(),void 0===t?r:ph.f(r,t)},Oh={},Ih=Jl,Ch=Ql.concat("length","prototype");Oh.f=Object.getOwnPropertyNames||function(e){return Ih(e,Ch)};var wh={},Nh=yo([].slice),Dh=Lo,Ph=cs,Lh=Oh.f,kh=Nh,Mh="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];wh.f=function(e){return Mh&&"Window"===Dh(e)?function(e){try{return Lh(e)}catch(e){return kh(Mh)}}(e):Lh(Ph(e))};var Uh={};Uh.f=Object.getOwnPropertySymbols;var xh=wc,Vh=function(e,t,r,i){return i&&i.enumerable?e[t]=r:xh(e,t,r),e},Fh=dc,Bh=function(e,t,r){return Fh.f(e,t,r)},jh={},Wh=Aa;jh.f=Wh;var Gh,Hh,Kh,Yh=ls,Zh=la,zh=jh,Xh=dc.f,Jh=function(e){var t=Yh.Symbol||(Yh.Symbol={});Zh(t,e)||Xh(t,e,{value:zh.f(e)})},Qh=Go,qh=ms,$h=Aa,ep=Vh,tp=function(){var e=qh("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,i=$h("toPrimitive");t&&!t[i]&&ep(t,i,(function(e){return Qh(r,this)}),{arity:1})},rp=Cu,ip=yu?{}.toString:function(){return"[object "+rp(this)+"]"},np=yu,op=dc.f,sp=wc,ap=la,cp=ip,up=Aa("toStringTag"),dp=function(e,t,r,i){var n=r?e:e&&e.prototype;n&&(ap(n,up)||op(n,up,{configurable:!0,value:t}),i&&!np&&sp(n,"toString",cp))},lp=Vo,hp=bo.WeakMap,pp=lp(hp)&&/native code/.test(String(hp)),fp=bo,Ep=ds,mp=wc,_p=la,Tp=ia,gp=lh,Sp=Hl,yp="Object already initialized",vp=fp.TypeError,Rp=fp.WeakMap;if(pp||Tp.state){var bp=Tp.state||(Tp.state=new Rp);bp.get=bp.get,bp.has=bp.has,bp.set=bp.set,Gh=function(e,t){if(bp.has(e))throw new vp(yp);return t.facade=e,bp.set(e,t),t},Hh=function(e){return bp.get(e)||{}},Kh=function(e){return bp.has(e)}}else{var Ap=gp("state");Sp[Ap]=!0,Gh=function(e,t){if(_p(e,Ap))throw new vp(yp);return t.facade=e,mp(e,Ap,t),t},Hh=function(e){return _p(e,Ap)?e[Ap]:{}},Kh=function(e){return _p(e,Ap)}}var Op={set:Gh,get:Hh,has:Kh,enforce:function(e){return Kh(e)?Hh(e):Gh(e,{})},getterFor:function(e){return function(t){var r;if(!Ep(t)||(r=Hh(t)).type!==e)throw new vp("Incompatible receiver, "+e+" required");return r}}},Ip=uc,Cp=ts,wp=ca,Np=eu,Dp=Rl,Pp=zd,Lp=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,u,d){for(var l,h,p=wp(c),f=Cp(p),E=Np(f),m=Ip(u,d),_=0,T=0,g=t?Dp(c,E):r||s?Dp(c,0):void 0;E>_;_++)if((a||_ in f)&&(h=m(l=f[_],_,p),e))if(t)Pp(g,_,h);else if(h)switch(e){case 3:return!0;case 5:return l;case 6:return _;case 2:Pp(g,T++,l)}else switch(e){case 4:return!1;case 7:Pp(g,T++,l)}return o?-1:i||n?n:g}},kp={forEach:Lp(0),map:Lp(1),filter:Lp(2),some:Lp(3),every:Lp(4),find:Lp(5),findIndex:Lp(6),filterReject:Lp(7)},Mp=jc,Up=bo,xp=Go,Vp=yo,Fp=Bo,Bp=Ns,jp=Eo,Wp=la,Gp=vo,Hp=Ec,Kp=cs,Yp=Ma,Zp=Du,zp=Jo,Xp=Ah,Jp=eh,Qp=Oh,qp=wh,$p=Uh,ef=Fo,tf=dc,rf=Gl,nf=Ho,of=Vh,sf=Bh,af=oa,cf=Hl,uf=ma,df=Aa,lf=jh,hf=Jh,pf=tp,ff=dp,Ef=Op,mf=kp.forEach,_f=lh("hidden"),Tf="Symbol",gf="prototype",Sf=Ef.set,yf=Ef.getterFor(Tf),vf=Object[gf],Rf=Up.Symbol,bf=Rf&&Rf[gf],Af=Up.RangeError,Of=Up.TypeError,If=Up.QObject,Cf=ef.f,wf=tf.f,Nf=qp.f,Df=nf.f,Pf=Vp([].push),Lf=af("symbols"),kf=af("op-symbols"),Mf=af("wks"),Uf=!If||!If[gf]||!If[gf].findChild,xf=function(e,t,r){var i=Cf(vf,t);return i&&delete vf[t],wf(e,t,r),i&&e!==vf&&wf(vf,t,i),e},Vf=Fp&&jp((function(){return 7!==Xp(wf({},"a",{get:function(){return wf(this,"a",{value:7}).a}})).a}))?xf:wf,Ff=function(e,t){var r=Lf[e]=Xp(bf);return Sf(r,{type:Tf,tag:e,description:t}),Fp||(r.description=t),r},Bf=function(e,t,r){e===vf&&Bf(kf,t,r),Hp(e);var i=Yp(t);return Hp(r),Wp(Lf,i)?(("enumerable"in r?!r.enumerable:!Wp(e,i)||Wp(e,_f)&&e[_f][i])?(Wp(e,_f)||wf(e,_f,zp(1,Xp(null))),e[_f][i]=!0):(Wp(e,_f)&&e[_f][i]&&(e[_f][i]=!1),r=Xp(r,{enumerable:zp(0,!1)})),Vf(e,i,r)):wf(e,i,r)},jf=function(e,t){Hp(e);var r=Kp(t),i=Jp(r).concat(Kf(r));return mf(i,(function(t){Fp&&!xp(Wf,r,t)||Bf(e,t,r[t])})),e},Wf=function(e){var t=Yp(e),r=xp(Df,this,t);return!(this===vf&&Wp(Lf,t)&&!Wp(kf,t))&&(!(r||!Wp(this,t)||!Wp(Lf,t)||Wp(this,_f)&&this[_f][t])||r)},Gf=function(e,t){var r=Kp(e),i=Yp(t);if(r!==vf||!Wp(Lf,i)||Wp(kf,i)){var n=Cf(r,i);return!n||!Wp(Lf,i)||Wp(r,_f)&&r[_f][i]||(n.enumerable=!0),n}},Hf=function(e){var t=Nf(Kp(e)),r=[];return mf(t,(function(e){Wp(Lf,e)||Wp(cf,e)||Pf(r,e)})),r},Kf=function(e){var t=e===vf,r=Nf(t?kf:Kp(e)),i=[];return mf(r,(function(e){!Wp(Lf,e)||t&&!Wp(vf,e)||Pf(i,Lf[e])})),i};Bp||(Rf=function(){if(Gp(bf,this))throw new Of("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Zp(arguments[0]):void 0,t=uf(e),r=function(e){var i=void 0===this?Up:this;i===vf&&xp(r,kf,e),Wp(i,_f)&&Wp(i[_f],t)&&(i[_f][t]=!1);var n=zp(1,e);try{Vf(i,t,n)}catch(e){if(!(e instanceof Af))throw e;xf(i,t,n)}};return Fp&&Uf&&Vf(vf,t,{configurable:!0,set:r}),Ff(t,e)},of(bf=Rf[gf],"toString",(function(){return yf(this).tag})),of(Rf,"withoutSetter",(function(e){return Ff(uf(e),e)})),nf.f=Wf,tf.f=Bf,rf.f=jf,ef.f=Gf,Qp.f=qp.f=Hf,$p.f=Kf,lf.f=function(e){return Ff(df(e),e)},Fp&&sf(bf,"description",{configurable:!0,get:function(){return yf(this).description}})),Mp({global:!0,constructor:!0,wrap:!0,forced:!Bp,sham:!Bp},{Symbol:Rf}),mf(Jp(Mf),(function(e){hf(e)})),Mp({target:Tf,stat:!0,forced:!Bp},{useSetter:function(){Uf=!0},useSimple:function(){Uf=!1}}),Mp({target:"Object",stat:!0,forced:!Bp,sham:!Fp},{create:function(e,t){return void 0===t?Xp(e):jf(Xp(e),t)},defineProperty:Bf,defineProperties:jf,getOwnPropertyDescriptor:Gf}),Mp({target:"Object",stat:!0,forced:!Bp},{getOwnPropertyNames:Hf}),pf(),ff(Rf,Tf),cf[_f]=!0;var Yf=Ns&&!!Symbol.for&&!!Symbol.keyFor,Zf=jc,zf=ms,Xf=la,Jf=Du,Qf=oa,qf=Yf,$f=Qf("string-to-symbol-registry"),eE=Qf("symbol-to-string-registry");Zf({target:"Symbol",stat:!0,forced:!qf},{for:function(e){var t=Jf(e);if(Xf($f,t))return $f[t];var r=zf("Symbol")(t);return $f[t]=r,eE[r]=t,r}});var tE=jc,rE=la,iE=Us,nE=Vs,oE=Yf,sE=oa("symbol-to-string-registry");tE({target:"Symbol",stat:!0,forced:!oE},{keyFor:function(e){if(!iE(e))throw new TypeError(nE(e)+" is not a symbol");if(rE(sE,e))return sE[e]}});var aE=ds,cE=Op.get,uE=yo,dE=la,lE=SyntaxError,hE=parseInt,pE=String.fromCharCode,fE=uE("".charAt),EE=uE("".slice),mE=uE(/./.exec),_E={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},TE=/^[\da-f]{4}$/i,gE=/^[\u0000-\u001F]$/,SE=!Eo((function(){var e="9007199254740993",t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e})),yE=jc,vE=ms,RE=wo,bE=Go,AE=yo,OE=Eo,IE=Wd,CE=Vo,wE=function(e){if(!aE(e))return!1;var t=cE(e);return!!t&&"RawJSON"===t.type},NE=Us,DE=Lo,PE=Du,LE=Nh,kE=function(e,t){for(var r=!0,i="";t<e.length;){var n=fE(e,t);if("\\"===n){var o=EE(e,t,t+2);if(dE(_E,o))i+=_E[o],t+=2;else{if("\\u"!==o)throw new lE('Unknown escape sequence: "'+o+'"');var s=EE(e,t+=2,t+4);if(!mE(TE,s))throw new lE("Bad Unicode escape at: "+t);i+=pE(hE(s,16)),t+=4}}else{if('"'===n){r=!1,t++;break}if(mE(gE,n))throw new lE("Bad control character in string literal at: "+t);i+=n,t++}}if(r)throw new lE("Unterminated string at: "+t);return{value:i,end:t}},ME=ma,UE=Ns,xE=SE,VE=String,FE=vE("JSON","stringify"),BE=AE(/./.exec),jE=AE("".charAt),WE=AE("".charCodeAt),GE=AE("".replace),HE=AE("".slice),KE=AE([].push),YE=AE(1.1.toString),ZE=/[\uD800-\uDFFF]/g,zE=/^[\uD800-\uDBFF]$/,XE=/^[\uDC00-\uDFFF]$/,JE=ME(),QE=JE.length,qE=!UE||OE((function(){var e=vE("Symbol")("stringify detection");return"[null]"!==FE([e])||"{}"!==FE({a:e})||"{}"!==FE(Object(e))})),$E=OE((function(){return'"\\udf06\\ud834"'!==FE("\udf06\ud834")||'"\\udead"'!==FE("\udead")})),em=qE?function(e,t){var r=LE(arguments),i=rm(t);if(CE(i)||void 0!==e&&!NE(e))return r[1]=function(e,t){if(CE(i)&&(t=bE(i,this,VE(e),t)),!NE(t))return t},RE(FE,null,r)}:FE,tm=function(e,t,r){var i=jE(r,t-1),n=jE(r,t+1);return BE(zE,e)&&!BE(XE,n)||BE(XE,e)&&!BE(zE,i)?"\\u"+YE(WE(e,0),16):e},rm=function(e){if(CE(e))return e;if(IE(e)){for(var t=e.length,r=[],i=0;i<t;i++){var n=e[i];"string"==typeof n?KE(r,n):"number"!=typeof n&&"Number"!==DE(n)&&"String"!==DE(n)||KE(r,PE(n))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(IE(this))return t;for(var i=0;i<o;i++)if(r[i]===e)return t}}};FE&&yE({target:"JSON",stat:!0,arity:3,forced:qE||$E||!xE},{stringify:function(e,t,r){var i=rm(t),n=[],o=em(e,(function(e,t){var r=CE(i)?bE(i,this,VE(e),t):t;return!xE&&wE(r)?JE+(KE(n,r.rawJSON)-1):r}),r);if("string"!=typeof o)return o;if($E&&(o=GE(o,ZE,tm)),xE)return o;for(var s="",a=o.length,c=0;c<a;c++){var u=jE(o,c);if('"'===u){var d=kE(o,++c).end-1,l=HE(o,c,d);s+=HE(l,0,QE)===JE?n[HE(l,QE)]:'"'+l+'"',c=d}else s+=u}return s}});var im=Uh,nm=ca;jc({target:"Object",stat:!0,forced:!Ns||Eo((function(){im.f(1)}))},{getOwnPropertySymbols:function(e){var t=im.f;return t?t(nm(e)):[]}}),Jh("asyncDispose"),Jh("asyncIterator"),Jh("dispose"),Jh("hasInstance"),Jh("isConcatSpreadable"),Jh("iterator"),Jh("match"),Jh("matchAll"),Jh("replace"),Jh("search"),Jh("species"),Jh("split");var om=tp;Jh("toPrimitive"),om();var sm=ms,am=dp;Jh("toStringTag"),am(sm("Symbol"),"Symbol"),Jh("unscopables"),dp(bo.JSON,"JSON",!0);var cm,um,dm,lm=ls.Symbol,hm={},pm=Bo,fm=la,Em=Function.prototype,mm=pm&&Object.getOwnPropertyDescriptor,_m=fm(Em,"name"),Tm={EXISTS:_m,PROPER:_m&&"something"===function(){}.name,CONFIGURABLE:_m&&(!pm||pm&&mm(Em,"name").configurable)},gm=!Eo((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Sm=la,ym=Vo,vm=ca,Rm=gm,bm=lh("IE_PROTO"),Am=Object,Om=Am.prototype,Im=Rm?Am.getPrototypeOf:function(e){var t=vm(e);if(Sm(t,bm))return t[bm];var r=t.constructor;return ym(r)&&t instanceof r?r.prototype:t instanceof Am?Om:null},Cm=Eo,wm=Vo,Nm=ds,Dm=Ah,Pm=Im,Lm=Vh,km=Aa("iterator"),Mm=!1;[].keys&&("next"in(dm=[].keys())?(um=Pm(Pm(dm)))!==Object.prototype&&(cm=um):Mm=!0);var Um=!Nm(cm)||Cm((function(){var e={};return cm[km].call(e)!==e}));wm((cm=Um?{}:Dm(cm))[km])||Lm(cm,km,(function(){return this}));var xm={IteratorPrototype:cm,BUGGY_SAFARI_ITERATORS:Mm},Vm=xm.IteratorPrototype,Fm=Ah,Bm=Jo,jm=dp,Wm=hm,Gm=function(){return this},Hm=function(e,t,r,i){var n=t+" Iterator";return e.prototype=Fm(Vm,{next:Bm(+!i,r)}),jm(e,n,!1,!0),Wm[n]=Gm,e},Km=yo,Ym=Ws,Zm=ds,zm=function(e){return Zm(e)||null===e},Xm=String,Jm=TypeError,Qm=function(e,t,r){try{return Km(Ym(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},qm=ds,$m=os,e_=function(e){if(zm(e))return e;throw new Jm("Can't set "+Xm(e)+" as a prototype")},t_=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Qm(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return $m(r),e_(i),qm(r)?(t?e(r,i):r.__proto__=i,r):r}}():void 0),r_=jc,i_=Go,n_=Tm,o_=Hm,s_=Im,a_=dp,c_=Vh,u_=hm,d_=xm,l_=n_.PROPER,h_=d_.BUGGY_SAFARI_ITERATORS,p_=Aa("iterator"),f_="keys",E_="values",m_="entries",__=function(){return this},T_=function(e,t,r,i,n,o,s){o_(r,t,i);var a,c,u,d=function(e){if(e===n&&E)return E;if(!h_&&e&&e in p)return p[e];switch(e){case f_:case E_:case m_:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[p_]||p["@@iterator"]||n&&p[n],E=!h_&&f||d(n),m="Array"===t&&p.entries||f;if(m&&(a=s_(m.call(new e)))!==Object.prototype&&a.next&&(a_(a,l,!0,!0),u_[l]=__),l_&&n===E_&&f&&f.name!==E_&&(h=!0,E=function(){return i_(f,this)}),n)if(c={values:d(E_),keys:o?E:d(f_),entries:d(m_)},s)for(u in c)(h_||h||!(u in p))&&c_(p,u,c[u]);else r_({target:t,proto:!0,forced:h_||h},c);return s&&p[p_]!==E&&c_(p,p_,E,{name:n}),u_[t]=E,c},g_=function(e,t){return{value:e,done:t}},S_=cs,y_=hm,v_=Op;dc.f;var R_=T_,b_=g_,A_="Array Iterator",O_=v_.set,I_=v_.getterFor(A_);R_(Array,"Array",(function(e,t){O_(this,{type:A_,target:S_(e),index:0,kind:t})}),(function(){var e=I_(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,b_(void 0,!0);switch(e.kind){case"keys":return b_(r,!1);case"values":return b_(t[r],!1)}return b_([r,t[r]],!1)}),"values"),y_.Arguments=y_.Array;var C_={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},w_=bo,N_=dp,D_=hm;for(var P_ in C_)N_(w_[P_],P_),D_[P_]=D_.Array;var L_=lm,k_=Aa,M_=dc.f,U_=k_("metadata"),x_=Function.prototype;void 0===x_[U_]&&M_(x_,U_,{value:null}),Jh("metadata");var V_=L_,F_=yo,B_=ms("Symbol"),j_=B_.keyFor,W_=F_(B_.prototype.valueOf),G_=B_.isRegisteredSymbol||function(e){try{return void 0!==j_(W_(e))}catch(e){return!1}};jc({target:"Symbol",stat:!0},{isRegisteredSymbol:G_});for(var H_=oa,K_=ms,Y_=yo,Z_=Us,z_=Aa,X_=K_("Symbol"),J_=X_.isWellKnownSymbol,Q_=K_("Object","getOwnPropertyNames"),q_=Y_(X_.prototype.valueOf),$_=H_("wks"),eT=0,tT=Q_(X_),rT=tT.length;eT<rT;eT++)try{var iT=tT[eT];Z_(X_[iT])&&z_(iT)}catch(e){}var nT=function(e){if(J_&&J_(e))return!0;try{for(var t=q_(e),r=0,i=Q_($_),n=i.length;r<n;r++)if($_[i[r]]==t)return!0}catch(e){}return!1};jc({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:nT}),Jh("customMatcher"),Jh("observable"),jc({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:G_}),jc({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:nT}),Jh("matcher"),Jh("metadataKey"),Jh("patternMatch"),Jh("replaceAll");var oT=X(V_),sT=yo,aT=Yc,cT=Du,uT=os,dT=sT("".charAt),lT=sT("".charCodeAt),hT=sT("".slice),pT=function(e){return function(t,r){var i,n,o=cT(uT(t)),s=aT(r),a=o.length;return s<0||s>=a?e?"":void 0:(i=lT(o,s))<55296||i>56319||s+1===a||(n=lT(o,s+1))<56320||n>57343?e?dT(o,s):i:e?hT(o,s,s+2):n-56320+(i-55296<<10)+65536}},fT={codeAt:pT(!1),charAt:pT(!0)},ET=fT.charAt,mT=Du,_T=Op,TT=T_,gT=g_,ST="String Iterator",yT=_T.set,vT=_T.getterFor(ST);TT(String,"String",(function(e){yT(this,{type:ST,string:mT(e),index:0})}),(function(){var e,t=vT(this),r=t.string,i=t.index;return i>=r.length?gT(void 0,!0):(e=ET(r,i),t.index+=e.length,gT(e,!1))}));var RT=X(jh.f("iterator"));function bT(e){return bT="function"==typeof oT&&"symbol"==typeof RT?function(e){return typeof e}:function(e){return e&&"function"==typeof oT&&e.constructor===oT&&e!==oT.prototype?"symbol":typeof e},bT(e)}var AT=X(jh.f("toPrimitive"));function OT(e){var t=function(e,t){if("object"!=bT(e)||!e)return e;var r=e[AT];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=bT(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==bT(t)?t:t+""}function IT(e,t,r){return(t=OT(t))in e?Bd(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var CT=Eo,wT=function(e,t){var r=[][e];return!!r&&CT((function(){r.call(null,t||function(){return 1},1)}))},NT=kp.forEach,DT=wT("forEach")?[].forEach:function(e){return NT(this,e,arguments.length>1?arguments[1]:void 0)};jc({target:"Array",proto:!0,forced:[].forEach!==DT},{forEach:DT});var PT=pu("Array","forEach"),LT=Cu,kT=la,MT=vo,UT=PT,xT=Array.prototype,VT={DOMTokenList:!0,NodeList:!0},FT=function(e){var t=e.forEach;return e===xT||MT(xT,e)&&t===xT.forEach||kT(VT,LT(e))?UT:t},BT=X(FT),jT=ca,WT=eh;jc({target:"Object",stat:!0,forced:Eo((function(){WT(1)}))},{keys:function(e){return WT(jT(e))}});var GT=X(ls.Object.keys),HT=Ws,KT=ca,YT=ts,ZT=eu,zT=TypeError,XT="Reduce of empty array with no initial value",JT=function(e){return function(t,r,i,n){var o=KT(t),s=YT(o),a=ZT(o);if(HT(r),0===a&&i<2)throw new zT(XT);var c=e?a-1:0,u=e?-1:1;if(i<2)for(;;){if(c in s){n=s[c],c+=u;break}if(c+=u,e?c<0:a<=c)throw new zT(XT)}for(;e?c>=0:a>c;c+=u)c in s&&(n=r(n,s[c],c,o));return n}},QT={left:JT(!1),right:JT(!0)},qT=bo,$T=gs,eg=Lo,tg=function(e){return $T.slice(0,e.length)===e},rg=tg("Bun/")?"BUN":tg("Cloudflare-Workers")?"CLOUDFLARE":tg("Deno/")?"DENO":tg("Node.js/")?"NODE":qT.Bun&&"string"==typeof Bun.version?"BUN":qT.Deno&&"object"==typeof Deno.version?"DENO":"process"===eg(qT.process)?"NODE":qT.window&&qT.document?"BROWSER":"REST",ig="NODE"===rg,ng=QT.left;jc({target:"Array",proto:!0,forced:!ig&&Os>79&&Os<83||!wT("reduce")},{reduce:function(e){var t=arguments.length;return ng(this,e,t,t>1?arguments[1]:void 0)}});var og=pu("Array","reduce"),sg=vo,ag=og,cg=Array.prototype,ug=function(e){var t=e.reduce;return e===cg||sg(cg,e)&&t===cg.reduce?ag:t},dg=ug,lg=X(dg),hg=jc,pg=Wd,fg=yo([].reverse),Eg=[1,2];hg({target:"Array",proto:!0,forced:String(Eg)===String(Eg.reverse())},{reverse:function(){return pg(this)&&(this.length=this.length),fg(this)}});var mg=pu("Array","reverse"),_g=vo,Tg=mg,gg=Array.prototype,Sg=function(e){var t=e.reverse;return e===gg||_g(gg,e)&&t===gg.reverse?Tg:t},yg=Sg,vg=X(yg),Rg=jc,bg=Wd,Ag=ml,Og=ds,Ig=Jc,Cg=eu,wg=cs,Ng=zd,Dg=$d,Pg=Aa,Lg=Nh,kg=Il("slice"),Mg=Pg("species"),Ug=Array,xg=Math.max;Rg({target:"Array",proto:!0,forced:!kg},{slice:function(e,t){var r,i,n,o=wg(this),s=Cg(o),a=Ig(e,s),c=Ig(void 0===t?s:t,s);if(bg(o)&&(r=o.constructor,(Ag(r)&&(r===Ug||bg(r.prototype))||Og(r)&&null===(r=r[Mg]))&&(r=void 0),r===Ug||void 0===r))return Lg(o,a,c);for(i=new(void 0===r?Ug:r)(xg(c-a,0)),n=0;a<c;a++,n++)a in o&&Ng(i,n,o[a]);return Dg(i,n),i}});var Vg=pu("Array","slice"),Fg=vo,Bg=Vg,jg=Array.prototype,Wg=function(e){var t=e.slice;return e===jg||Fg(jg,e)&&t===jg.slice?Bg:t},Gg=X(Wg);function Hg(e,t,r,i,n){var o,s,a,c={};return BT(o=GT(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=lg(s=vg(a=Gg(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?(Bd(e,t,c),null):c}var Kg=ms,Yg=Oh,Zg=Uh,zg=Ec,Xg=yo([].concat),Jg=Kg("Reflect","ownKeys")||function(e){var t=Yg.f(zg(e)),r=Zg.f;return r?Xg(t,r(e)):t},Qg=la,qg=Jg,$g=Fo,eS=dc,tS=ds,rS=wc,iS=Error,nS=yo("".replace),oS=String(new iS("zxcasd").stack),sS=/\n\s*at [^:]*:[^\n]*/,aS=sS.test(oS),cS=Jo,uS=!Eo((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",cS(1,7)),7!==e.stack)})),dS=wc,lS=function(e,t){if(aS&&"string"==typeof e&&!iS.prepareStackTrace)for(;t--;)e=nS(e,sS,"");return e},hS=uS,pS=Error.captureStackTrace,fS=hm,ES=Aa("iterator"),mS=Array.prototype,_S=function(e){return void 0!==e&&(fS.Array===e||mS[ES]===e)},TS=Cu,gS=Ks,SS=rs,yS=hm,vS=Aa("iterator"),RS=function(e){if(!SS(e))return gS(e,vS)||gS(e,"@@iterator")||yS[TS(e)]},bS=Go,AS=Ws,OS=Ec,IS=Vs,CS=RS,wS=TypeError,NS=function(e,t){var r=arguments.length<2?CS(e):t;if(AS(r))return OS(bS(r,e));throw new wS(IS(e)+" is not iterable")},DS=Go,PS=Ec,LS=Ks,kS=function(e,t,r){var i,n;PS(e);try{if(!(i=LS(e,"return"))){if("throw"===t)throw r;return r}i=DS(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return PS(i),r},MS=uc,US=Go,xS=Ec,VS=Vs,FS=_S,BS=eu,jS=vo,WS=NS,GS=RS,HS=kS,KS=TypeError,YS=function(e,t){this.stopped=e,this.result=t},ZS=YS.prototype,zS=function(e,t,r){var i,n,o,s,a,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),E=MS(t,d),m=function(e){var t=i;return i=void 0,t&&HS(t,"normal"),new YS(!0,e)},_=function(e){return l?(xS(e),f?E(e[0],e[1],m):E(e[0],e[1])):f?E(e,m):E(e)};if(h)i=e.iterator;else if(p)i=e;else{if(!(n=GS(e)))throw new KS(VS(e)+" is not iterable");if(FS(n)){for(o=0,s=BS(e);s>o;o++)if((a=_(e[o]))&&jS(ZS,a))return a;return new YS(!1)}i=WS(e,n)}for(c=h?e.next:i.next;!(u=US(c,i)).done;){var T=u.value;try{a=_(T)}catch(e){if(!i)throw e;HS(i,"throw",e)}if("object"==typeof a&&a&&jS(ZS,a))return a}return new YS(!1)},XS=Du,JS=jc,QS=vo,qS=Im,$S=t_,ey=function(e,t,r){for(var i=qg(t),n=eS.f,o=$g.f,s=0;s<i.length;s++){var a=i[s];Qg(e,a)||r&&Qg(r,a)||n(e,a,o(t,a))}},ty=Ah,ry=wc,iy=Jo,ny=function(e,t){tS(t)&&"cause"in t&&rS(e,"cause",t.cause)},oy=function(e,t,r,i){hS&&(pS?pS(e,t):dS(e,"stack",lS(r,i)))},sy=zS,ay=function(e,t){return void 0===e?arguments.length<2?"":t:XS(e)},cy=Aa("toStringTag"),uy=Error,dy=[].push,ly=function(e,t){var r,i=QS(hy,this);$S?r=$S(new uy,i?qS(this):hy):(r=i?this:ty(hy),ry(r,cy,"Error")),void 0!==t&&ry(r,"message",ay(t)),oy(r,ly,r.stack,1),arguments.length>2&&ny(r,arguments[2]);var n=[];return sy(e,dy,{that:n}),ry(r,"errors",n),r};$S?$S(ly,uy):ey(ly,uy,{name:!0});var hy=ly.prototype=ty(uy.prototype,{constructor:iy(1,ly),message:iy(1,""),name:iy(1,"AggregateError")});JS({global:!0,constructor:!0,arity:2},{AggregateError:ly});var py,fy,Ey,my,_y=ms,Ty=Bh,gy=Bo,Sy=Aa("species"),yy=vo,vy=TypeError,Ry=function(e,t){if(yy(t,e))return e;throw new vy("Incorrect invocation")},by=ml,Ay=Vs,Oy=TypeError,Iy=Ec,Cy=function(e){if(by(e))return e;throw new Oy(Ay(e)+" is not a constructor")},wy=rs,Ny=Aa("species"),Dy=function(e,t){var r,i=Iy(e).constructor;return void 0===i||wy(r=Iy(i)[Ny])?t:Cy(r)},Py=TypeError,Ly=function(e,t){if(e<t)throw new Py("Not enough arguments");return e},ky=gs,My=/ipad|iphone|ipod/i.test(ky)&&/applewebkit/i.test(ky),Uy=bo,xy=wo,Vy=uc,Fy=Vo,By=la,jy=Eo,Wy=ch,Gy=Nh,Hy=Fa,Ky=Ly,Yy=My,Zy=ig,zy=Uy.setImmediate,Xy=Uy.clearImmediate,Jy=Uy.process,Qy=Uy.Dispatch,qy=Uy.Function,$y=Uy.MessageChannel,ev=Uy.String,tv=0,rv={},iv="onreadystatechange";jy((function(){py=Uy.location}));var nv=function(e){if(By(rv,e)){var t=rv[e];delete rv[e],t()}},ov=function(e){return function(){nv(e)}},sv=function(e){nv(e.data)},av=function(e){Uy.postMessage(ev(e),py.protocol+"//"+py.host)};zy&&Xy||(zy=function(e){Ky(arguments.length,1);var t=Fy(e)?e:qy(e),r=Gy(arguments,1);return rv[++tv]=function(){xy(t,void 0,r)},fy(tv),tv},Xy=function(e){delete rv[e]},Zy?fy=function(e){Jy.nextTick(ov(e))}:Qy&&Qy.now?fy=function(e){Qy.now(ov(e))}:$y&&!Yy?(my=(Ey=new $y).port2,Ey.port1.onmessage=sv,fy=Vy(my.postMessage,my)):Uy.addEventListener&&Fy(Uy.postMessage)&&!Uy.importScripts&&py&&"file:"!==py.protocol&&!jy(av)?(fy=av,Uy.addEventListener("message",sv,!1)):fy=iv in Hy("script")?function(e){Wy.appendChild(Hy("script"))[iv]=function(){Wy.removeChild(this),nv(e)}}:function(e){setTimeout(ov(e),0)});var cv={set:zy,clear:Xy},uv=bo,dv=Bo,lv=Object.getOwnPropertyDescriptor,hv=function(e){if(!dv)return uv[e];var t=lv(uv,e);return t&&t.value},pv=function(){this.head=null,this.tail=null};pv.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 fv,Ev,mv,_v,Tv,gv=pv,Sv=/ipad|iphone|ipod/i.test(gs)&&"undefined"!=typeof Pebble,yv=/web0s(?!.*chrome)/i.test(gs),vv=bo,Rv=hv,bv=uc,Av=cv.set,Ov=gv,Iv=My,Cv=Sv,wv=yv,Nv=ig,Dv=vv.MutationObserver||vv.WebKitMutationObserver,Pv=vv.document,Lv=vv.process,kv=vv.Promise,Mv=Rv("queueMicrotask");if(!Mv){var Uv=new Ov,xv=function(){var e,t;for(Nv&&(e=Lv.domain)&&e.exit();t=Uv.get();)try{t()}catch(e){throw Uv.head&&fv(),e}e&&e.enter()};Iv||Nv||wv||!Dv||!Pv?!Cv&&kv&&kv.resolve?((_v=kv.resolve(void 0)).constructor=kv,Tv=bv(_v.then,_v),fv=function(){Tv(xv)}):Nv?fv=function(){Lv.nextTick(xv)}:(Av=bv(Av,vv),fv=function(){Av(xv)}):(Ev=!0,mv=Pv.createTextNode(""),new Dv(xv).observe(mv,{characterData:!0}),fv=function(){mv.data=Ev=!Ev}),Mv=function(e){Uv.head||fv(),Uv.add(e)}}var Vv=Mv,Fv=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Bv=bo.Promise,jv=bo,Wv=Bv,Gv=Vo,Hv=oc,Kv=il,Yv=Aa,Zv=rg,zv=Os,Xv=Wv&&Wv.prototype,Jv=Yv("species"),Qv=!1,qv=Gv(jv.PromiseRejectionEvent),$v=Hv("Promise",(function(){var e=Kv(Wv),t=e!==String(Wv);if(!t&&66===zv)return!0;if(!Xv.catch||!Xv.finally)return!0;if(!zv||zv<51||!/native code/.test(e)){var r=new Wv((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Jv]=i,!(Qv=r.then((function(){}))instanceof i))return!0}return!(t||"BROWSER"!==Zv&&"DENO"!==Zv||qv)})),eR={CONSTRUCTOR:$v,REJECTION_EVENT:qv,SUBCLASSING:Qv},tR={},rR=Ws,iR=TypeError,nR=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw new iR("Bad Promise constructor");t=e,r=i})),this.resolve=rR(t),this.reject=rR(r)};tR.f=function(e){return new nR(e)};var oR,sR,aR,cR=jc,uR=ig,dR=bo,lR=ls,hR=Go,pR=Vh,fR=dp,ER=function(e){var t=_y(e);gy&&t&&!t[Sy]&&Ty(t,Sy,{configurable:!0,get:function(){return this}})},mR=Ws,_R=Vo,TR=ds,gR=Ry,SR=Dy,yR=cv.set,vR=Vv,RR=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},bR=Fv,AR=gv,OR=Op,IR=Bv,CR=eR,wR=tR,NR="Promise",DR=CR.CONSTRUCTOR,PR=CR.REJECTION_EVENT,LR=OR.getterFor(NR),kR=OR.set,MR=IR&&IR.prototype,UR=IR,xR=MR,VR=dR.TypeError,FR=dR.document,BR=dR.process,jR=wR.f,WR=jR,GR=!!(FR&&FR.createEvent&&dR.dispatchEvent),HR="unhandledrejection",KR=function(e){var t;return!(!TR(e)||!_R(t=e.then))&&t},YR=function(e,t){var r,i,n,o=t.value,s=1===t.state,a=s?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{a?(s||(2===t.rejection&&QR(t),t.rejection=1),!0===a?r=o:(d&&d.enter(),r=a(o),d&&(d.exit(),n=!0)),r===e.promise?u(new VR("Promise-chain cycle")):(i=KR(r))?hR(i,r,c,u):c(r)):u(o)}catch(e){d&&!n&&d.exit(),u(e)}},ZR=function(e,t){e.notified||(e.notified=!0,vR((function(){for(var r,i=e.reactions;r=i.get();)YR(r,e);e.notified=!1,t&&!e.rejection&&XR(e)})))},zR=function(e,t,r){var i,n;GR?((i=FR.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),dR.dispatchEvent(i)):i={promise:t,reason:r},!PR&&(n=dR["on"+e])?n(i):e===HR&&RR("Unhandled promise rejection",r)},XR=function(e){hR(yR,dR,(function(){var t,r=e.facade,i=e.value;if(JR(e)&&(t=bR((function(){uR?BR.emit("unhandledRejection",i,r):zR(HR,r,i)})),e.rejection=uR||JR(e)?2:1,t.error))throw t.value}))},JR=function(e){return 1!==e.rejection&&!e.parent},QR=function(e){hR(yR,dR,(function(){var t=e.facade;uR?BR.emit("rejectionHandled",t):zR("rejectionhandled",t,e.value)}))},qR=function(e,t,r){return function(i){e(t,i,r)}},$R=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,ZR(e,!0))},eb=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new VR("Promise can't be resolved itself");var i=KR(t);i?vR((function(){var r={done:!1};try{hR(i,t,qR(eb,r,e),qR($R,r,e))}catch(t){$R(r,t,e)}})):(e.value=t,e.state=1,ZR(e,!1))}catch(t){$R({done:!1},t,e)}}};DR&&(xR=(UR=function(e){gR(this,xR),mR(e),hR(oR,this);var t=LR(this);try{e(qR(eb,t),qR($R,t))}catch(e){$R(t,e)}}).prototype,(oR=function(e){kR(this,{type:NR,done:!1,notified:!1,parent:!1,reactions:new AR,rejection:!1,state:0,value:null})}).prototype=pR(xR,"then",(function(e,t){var r=LR(this),i=jR(SR(this,UR));return r.parent=!0,i.ok=!_R(e)||e,i.fail=_R(t)&&t,i.domain=uR?BR.domain:void 0,0===r.state?r.reactions.add(i):vR((function(){YR(i,r)})),i.promise})),sR=function(){var e=new oR,t=LR(e);this.promise=e,this.resolve=qR(eb,t),this.reject=qR($R,t)},wR.f=jR=function(e){return e===UR||e===aR?new sR(e):WR(e)}),cR({global:!0,constructor:!0,wrap:!0,forced:DR},{Promise:UR}),aR=lR.Promise,fR(UR,NR,!1,!0),ER(NR);var tb=Aa("iterator"),rb=!1;try{var ib=0,nb={next:function(){return{done:!!ib++}},return:function(){rb=!0}};nb[tb]=function(){return this},Array.from(nb,(function(){throw 2}))}catch(e){}var ob=function(e,t){try{if(!t&&!rb)return!1}catch(e){return!1}var r=!1;try{var i={};i[tb]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},sb=Bv,ab=eR.CONSTRUCTOR||!ob((function(e){sb.all(e).then(void 0,(function(){}))})),cb=Go,ub=Ws,db=tR,lb=Fv,hb=zS;jc({target:"Promise",stat:!0,forced:ab},{all:function(e){var t=this,r=db.f(t),i=r.resolve,n=r.reject,o=lb((function(){var r=ub(t.resolve),o=[],s=0,a=1;hb(e,(function(e){var c=s++,u=!1;a++,cb(r,t,e).then((function(e){u||(u=!0,o[c]=e,--a||i(o))}),n)})),--a||i(o)}));return o.error&&n(o.value),r.promise}});var pb=jc,fb=eR.CONSTRUCTOR;Bv&&Bv.prototype,pb({target:"Promise",proto:!0,forced:fb,real:!0},{catch:function(e){return this.then(void 0,e)}});var Eb=Go,mb=Ws,_b=tR,Tb=Fv,gb=zS;jc({target:"Promise",stat:!0,forced:ab},{race:function(e){var t=this,r=_b.f(t),i=r.reject,n=Tb((function(){var n=mb(t.resolve);gb(e,(function(e){Eb(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var Sb=tR;jc({target:"Promise",stat:!0,forced:eR.CONSTRUCTOR},{reject:function(e){var t=Sb.f(this);return(0,t.reject)(e),t.promise}});var yb=Ec,vb=ds,Rb=tR,bb=function(e,t){if(yb(e),vb(t)&&t.constructor===e)return t;var r=Rb.f(e);return(0,r.resolve)(t),r.promise},Ab=jc,Ob=Bv,Ib=eR.CONSTRUCTOR,Cb=bb,wb=ms("Promise"),Nb=!Ib;Ab({target:"Promise",stat:!0,forced:true},{resolve:function(e){return Cb(Nb&&this===wb?Ob:this,e)}});var Db=Go,Pb=Ws,Lb=tR,kb=Fv,Mb=zS;jc({target:"Promise",stat:!0,forced:ab},{allSettled:function(e){var t=this,r=Lb.f(t),i=r.resolve,n=r.reject,o=kb((function(){var r=Pb(t.resolve),n=[],o=0,s=1;Mb(e,(function(e){var a=o++,c=!1;s++,Db(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 Ub=Go,xb=Ws,Vb=ms,Fb=tR,Bb=Fv,jb=zS,Wb="No one promise resolved";jc({target:"Promise",stat:!0,forced:ab},{any:function(e){var t=this,r=Vb("AggregateError"),i=Fb.f(t),n=i.resolve,o=i.reject,s=Bb((function(){var i=xb(t.resolve),s=[],a=0,c=1,u=!1;jb(e,(function(e){var d=a++,l=!1;c++,Ub(i,t,e).then((function(e){l||u||(u=!0,n(e))}),(function(e){l||u||(l=!0,s[d]=e,--c||o(new r(s,Wb)))}))})),--c||o(new r(s,Wb))}));return s.error&&o(s.value),i.promise}});var Gb=jc,Hb=wo,Kb=Nh,Yb=tR,Zb=Ws,zb=Fv,Xb=bo.Promise,Jb=!1;Gb({target:"Promise",stat:!0,forced:!Xb||!Xb.try||zb((function(){Xb.try((function(e){Jb=8===e}),8)})).error||!Jb},{try:function(e){var t=arguments.length>1?Kb(arguments,1):[],r=Yb.f(this),i=zb((function(){return Hb(Zb(e),void 0,t)}));return(i.error?r.reject:r.resolve)(i.value),r.promise}});var Qb=tR;jc({target:"Promise",stat:!0},{withResolvers:function(){var e=Qb.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}});var qb=jc,$b=Bv,eA=Eo,tA=ms,rA=Vo,iA=Dy,nA=bb,oA=$b&&$b.prototype;qb({target:"Promise",proto:!0,real:!0,forced:!!$b&&eA((function(){oA.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=iA(this,tA("Promise")),r=rA(e);return this.then(r?function(r){return nA(t,e()).then((function(){return r}))}:e,r?function(r){return nA(t,e()).then((function(){throw r}))}:e)}});var sA=X(ls.Promise);class aA extends Ri{set _mediaStreamTrack(e){e!==this.mediaStreamTrack&&(this.safeEmit(_d.TRACK_UPDATED,e),this.mediaStreamTrack=e)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),IT(this,"trackMediaType",void 0),IT(this,"_ID",void 0),IT(this,"_rtpTransceiver",void 0),IT(this,"_lowRtpTransceiver",void 0),IT(this,"_hints",[]),IT(this,"_isClosed",!1),IT(this,"_originMediaStreamTrack",void 0),IT(this,"mediaStreamTrack",void 0),IT(this,"_external",{}),this._ID=t||zi(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,sd(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||Ki((()=>{var e;no.reportApiInvoke(null,{name:Ii.GET_MEDIA_STREAM_TRACK,options:[],tag:Ci.TRACER}).onSuccess((null===(e=this._mediaStreamTrack)||void 0===e?void 0:e.label)||"")}),this.mediaStreamTrack.id||this.getTrackId()),this._mediaStreamTrack}getRTCRtpTransceiver(e){return e===fd.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,ad(this),this.emit(Td.CLOSED),this.removeAllListeners(_d.SEI_RECEIVED)}_updateRtpTransceiver(e,t){if(t===fd.LOW_STREAM){if(this._lowRtpTransceiver===e)return;this._lowRtpTransceiver=e}else{if(this._rtpTransceiver===e)return;this._rtpTransceiver=e}this.emit(_d.TRANSCEIVER_UPDATED,e,t)}}class cA extends aA{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),IT(this,"_enabled",!0),IT(this,"_muted",!1),IT(this,"_isExternalTrack",!1),IT(this,"_isClosed",!1),IT(this,"_enabledMutex",void 0),IT(this,"processor",void 0),IT(this,"_processorContext",void 0),IT(this,"_handleTrackEnded",(()=>{this.onTrackEnded()})),this._enabledMutex=new on("".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,Vn.debug("[".concat(this.getTrackId(),"] close")),this.emit(hd.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 Pi(this,hd.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){Vn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Td.TRACK_ENDED)}stateCheck(e,t){if(Vn.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),fi(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new pi(hi.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print("error",Vn);if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new pi(hi.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print("error",Vn)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():sA.resolve([])}}function uA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}const dA=window.AudioContext||window.webkitAudioContext;let lA,hA=null;const pA=new class extends Ri{constructor(){super(...arguments),IT(this,"prevState",void 0),IT(this,"curState",void 0),IT(this,"currentTime",void 0),IT(this,"currentTimeStuckAt",void 0),IT(this,"interruptDetectorTrack",void 0),IT(this,"onLocalAudioTrackMute",(()=>{Vn.info("ios15-interruption-start"),this.emit(fo.IOS_15_16_INTERRUPTION_START)})),IT(this,"onLocalAudioTrackUnmute",(async()=>{Vn.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?Vn.info("ios15-interruption-end-canceled"):(hA&&await hA.suspend(),this.emit(fo.IOS_15_16_INTERRUPTION_END))}))}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){Vn.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){Vn.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 fA(){if(!dA)return void Vn.error("your browser is not support web audio");Vn.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?uA(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},yn("WEBAUDIO_INIT_OPTIONS"));Vn.debug("audio context init option:",JSON.stringify(e)),hA=new dA(e),pA.curState=hA.state,hA.onstatechange=()=>{pA.prevState=pA.curState,pA.curState=hA?hA.state:void 0;const e=pA.prevState,t=pA.curState,r="running"===t,i="interrupted"===t,n="running"===e,o="suspended"===e,s="interrupted"===e,a=xr().osVersion;(Yr()||ti())&&n&&i&&(Vn.info("ios".concat(a,"-interruption-start")),pA.emit(fo.IOS_INTERRUPTION_START)),(Yr()||ti())&&(o||s)&&r&&(Vn.info("ios".concat(a,"-interruption-end")),pA.emit(fo.IOS_INTERRUPTION_END)),e!==t&&pA.emit(fo.STATE_CHANGE,t,e)},setInterval((()=>{var e;const t=null===(e=hA)||void 0===e?void 0:e.currentTime;if(pA.currentTime!==t)pA.currentTimeStuckAt&&(Vn.debug("AudioContext current time resume at ".concat(t)),pA.currentTimeStuckAt=void 0),pA.currentTime=t;else{if(t!==pA.currentTimeStuckAt){no.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:Ci.TRACER}).onSuccess(),Vn.warning("AudioContext current time stuck at ".concat(t))}pA.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):Yr()||ti()?"suspended"===e.state&&(a(!0),t&&e.resume().then(u,u)):"closed"!==e.state&&(a(!0),t&&e.resume().then(u,u))}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,d,{capture:!0,passive:!0}):window.removeEventListener(t,d,{capture:!0,passive:!0})}}}function c(){s(!0)}function u(){s(!1)}function d(){s(!0)}function l(){let e;try{e=r.play(),e?e.then(f,f):(r.addEventListener("playing",f),r.addEventListener("abort",f),r.addEventListener("error",f))}catch(e){f()}}function h(e){o||(r.paused?e?(p(!1),o=!0,l()):p(!0):p(!1))}function p(e){if(n!==e){n=e;for(let r=0,i=t;r<i.length;r++){const t=i[r];e?window.addEventListener(t,E,{capture:!0,passive:!0}):window.removeEventListener(t,E,{capture:!0,passive:!0})}}}function f(){r.removeEventListener("playing",f),r.removeEventListener("abort",f),r.removeEventListener("error",f),o=!1,h(!1)}function E(){h(!0)}let m;if(Yr()&&yn("IOS_BG_TAG")){const t=e.createMediaStreamDestination(),i=document.createElement("div");i.innerHTML="<audio x-webkit-airplay='deny'></audio>",r=i.children.item(0),r.controls=!1,r.disableRemotePlayback=!0,r.preload="auto",r.srcObject=t.stream,m=()=>{if(yn("IOS_AUTO_RESTART_BG_TAG")&&r&&r.srcObject&&!o&&(!r.paused||!0!==n)){r.paused||r.pause();try{o=!0,l()}catch(e){o=!1}return!0}},h(!0)}return pA.on(fo.STATE_CHANGE,c),s(!1),m}(hA).then((e=>{lA=e}))}function EA(){if(lA){if(lA()){no.reportApiInvoke(null,{name:"BG_AUDIO_TAG_RESTART",options:{},tag:Ci.TRACER}).onSuccess(),Vn.debug("restart background audio tag success")}}}function mA(){if(!hA){if(fA(),!hA)throw new pi(hi.NOT_SUPPORTED,"can not create audio context");return hA}return hA}function _A(){return!!hA}function TA(e){if(function(){if(null!==SA)return SA;const e=mA(),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(),SA=n,n}())return;const t=e.connect,r=e.disconnect;e.connect=(r,i,n)=>{var o;return e._inputNodes||(e._inputNodes=[]),Yu(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?Bi(e._inputNodes,i):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function gA(e){const t=mA();return new sA(((r,i)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{i(new pi(hi.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let SA=null;let yA=null;function vA(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 RA=X(dg);class bA{constructor(){IT(this,"context",void 0),IT(this,"analyserNode",void 0),IT(this,"sourceNode",void 0),this.context=mA(),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||Yr()||ti()||"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=RA(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){Vn.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class AA extends Ri{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(),IT(this,"outputNode",void 0),IT(this,"outputTrack",void 0),IT(this,"isPlayed",!1),IT(this,"sourceNode",void 0),IT(this,"context",void 0),IT(this,"audioBufferNode",void 0),IT(this,"destNode",void 0),IT(this,"audioOutputLevel",0),IT(this,"volumeLevelAnalyser",void 0),IT(this,"_processedNode",void 0),IT(this,"playNode",void 0),IT(this,"isDestroyed",!1),IT(this,"onNoAudioInput",void 0),IT(this,"isNoAudioInput",!1),IT(this,"_noAudioInputCount",0),this.context=mA(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),TA(this.outputNode),this.volumeLevelAnalyser=new bA}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(yd.ON_AUDIO_BUFFER,vA(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!ao().webAudioMediaStreamDest)throw new pi(hi.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&&ji((()=>{pA.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;Yr()||ti()?"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 Zi(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 OA extends AA{get isFreeze(){return!1}constructor(e,t,r){var i;if(super(),IT(this,"sourceNode",void 0),IT(this,"track",void 0),IT(this,"clonedTrack",void 0),IT(this,"audioElement",void 0),IT(this,"isCurrentTrackCloned",!1),IT(this,"isRemoteTrack",!1),IT(this,"originVolumeLevelAnalyser",void 0),IT(this,"rebuildWebAudio",(async()=>{if(Vn.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 Vn.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>Vn.info("resume success"))),Vn.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),TA(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),TA(this.outputNode),this.emit(yd.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=t,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()})),"audio"!==e.kind)throw new pi(hi.UNEXPECTED_ERROR);this.track=e;const n=new MediaStream([this.track]);if(this.isRemoteTrack=!!t,this.sourceNode=this.context.createMediaStreamSource(n),TA(this.sourceNode),r){const e=r.clone();e.enabled=!0,this.clonedTrack=e,Vn.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]));TA(t),this.originVolumeLevelAnalyser=new bA,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=n;const o=xr();t&&o.os===Pr.IOS&&Number(null===(i=o.osVersion)||void 0===i?void 0:i.split(".")[0])<15&&(pA.on(fo.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),TA(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(yd.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),pA.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),Vn.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]));TA(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 CA(e,t){const r=await wA(e.mediaSource),i=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 u=document.createElement("button");u.innerHTML="cancel",u.setAttribute("style","width: 85px;"),u.onclick=()=>{document.body.removeChild(h);const e=new Error("NotAllowedError");e.name="NotAllowedError",i(e)};let d=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=d,e.onchange=()=>{d=e.checked},l.appendChild(e),l.appendChild(t)}c.appendChild(l),c.appendChild(u),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{i.getSize().width>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:d})},a.appendChild(t)}}))}))}(r,t),n=i.sourceId,o=i.audio;return await IA(n,e,o)}async function wA(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=Oi();if(!r)throw console.error("failed to fetch electron, please mount it to window"),new pi(hi.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 sA(((e,i)=>{r.desktopCapturer.getSources({types:t},((t,r)=>{t?i(t):e(r)}))})));try{return await i}catch(e){throw new pi(hi.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.toString())}}function NA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}const DA=new on("safari");async function PA(e,t){let r=0,i=null;for(;r<2;)try{i=await LA(e,t,r>0);break}catch(e){if(e instanceof pi)throw Vn.error("[".concat(t,"] ").concat(e.toString())),e;const i=kA(e.name||e.code||e,e.message);if(i.code===hi.MEDIA_OPTION_INVALID){Vn.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await Zi(500);continue}throw Vn.error("[".concat(t,"] ").concat(i.toString())),i}if(!i)throw new pi(hi.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return i}async function LA(t,r,i){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new pi(hi.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=ao(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return Vn.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(bi())if(t.screen.sourceId){MA(o,await IA(t.screen.sourceId,t.screen,!!t.screenAudio))}else{MA(o,await CA(t.screen,!!t.screenAudio))}else if(Wr()&&t.screen.extensionId&&t.screen.mandatory){if(!n.getStreamFromExtension)throw new pi(hi.NOT_SUPPORTED,"This browser does not support screen sharing");Vn.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new sA(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return Vn.error("[".concat(c,"] No response from Chrome Plugin. Plugin not installed properly"),r),void t(new pi(hi.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){Vn.error("[".concat(c,"] AgoraRTC screensharing plugin is not accessible(").concat(a,")"),e.toString()),t(new pi(hi.CHROME_PLUGIN_NOT_INSTALL))}})));t.screen.mandatory.chromeMediaSourceId=e;MA(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(n.getDisplayMedia){var s;t.screen.mediaSource&&ld(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},i=t.screen,n=i.selfBrowserSurface,a=i.surfaceSwitching,c=i.systemAudio,u=i.preferCurrentTab,d=i.windowAudio,l=i.monitorTypeSurfaces,h={selfBrowserSurface:n,surfaceSwitching:a,systemAudio:c,preferCurrentTab:u,windowAudio:d,monitorTypeSurfaces:l};!n&&delete h.selfBrowserSurface,!a&&delete h.surfaceSwitching,!c&&delete h.systemAudio,!u&&delete h.preferCurrentTab,!d&&delete h.windowAudio,!l&&delete h.monitorTypeSurfaces,Vn.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:t.screenAudio,controls:h}));const p=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?NA(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:t.screenAudio},h));MA(o,p)}else{if(!Kr())throw Vn.error("[".concat(r,"] This browser does not support screenSharing")),new pi(hi.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&ld(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};Vn.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));MA(o,await navigator.mediaDevices.getUserMedia(e))}}var a,c;if(!t.video&&!t.audio)return o;let u={video:t.video,audio:t.audio},d=yn("MEDIA_DEVICE_CONSTRAINTS");if(d)try{"string"==typeof d&&(d=JSON.parse(d)),u=$i(u,d)}catch(e){}Vn.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(u)),xr();let l,h=null;(Gr()||Yr()||jr())&&(h=await DA.lock());try{l=await navigator.mediaDevices.getUserMedia(u)}catch(e){throw h&&h(),e}return u.audio&&(e.HAS_GUM_AUDIO=!0),u.video&&(e.HAS_GUM_VIDEO=!0),MA(o,l),h&&h(),o}function kA(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new pi(hi.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new pi(hi.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new pi(hi.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new pi(hi.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new pi(hi.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new pi(hi.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return Vn.error("getUserMedia unexpected error",e),new pi(hi.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function MA(e,t){const r=e.getVideoTracks()[0],i=e.getAudioTracks()[0],n=t.getVideoTracks()[0],o=t.getAudioTracks()[0];o&&(i&&e.removeTrack(i),e.addTrack(o)),n&&(r&&e.removeTrack(r),e.addTrack(n))}e.HAS_GUM_AUDIO=!1,e.HAS_GUM_VIDEO=!1;class UA extends Ri{get state(){return this._state}set state(e){e!==this._state&&(this.emit(Nd.STATE_CHANGE,e),this._state=e)}constructor(){super(),IT(this,"_state",wd.IDLE),IT(this,"isAccessMicrophonePermission",!1),IT(this,"isAccessCameraPermission",!1),IT(this,"lastAccessMicrophonePermission",!1),IT(this,"lastAccessCameraPermission",!1),IT(this,"checkdeviceMatched",!1),IT(this,"deviceInfoMap",new Map),this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(yn("ENUMERATE_DEVICES_INTERVAL")||(oi()||Fr()===Pr.HARMONY_OS)&&ni())&&this.updateDevicesInfo()}),yn("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>Vn.error(e.toString())))}async enumerateDevices(t,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)throw new pi(hi.NOT_SUPPORTED,"enumerateDevices() not supported.");const n=await navigator.mediaDevices.enumerateDevices(),o=this.checkMediaDeviceInfoIsOk(n);let s=!this.isAccessMicrophonePermission&&t,a=!this.isAccessCameraPermission&&r;o.audio&&(s=!1),o.video&&(a=!1);let c=null,u=null,d=null;if(!i&&(s||a)){if(DA.isLocked){Vn.debug("[device manager] wait GUM lock");(await DA.lock())(),Vn.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),Vn.debug("[device manager] check media device permissions",t,r,s,a),s&&a){try{d=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(e){const t=kA(e.name||e.code||e,e.message);if(t.code===hi.PERMISSION_DENIED)throw t;Vn.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=kA(e.name||e.code||e,e.message);if(t.code===hi.PERMISSION_DENIED)throw t;Vn.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{u=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=kA(e.name||e.code||e,e.message);if(t.code===hi.PERMISSION_DENIED)throw t;Vn.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}Vn.debug("[device manager] mic permission",t,"cam permission",r)}try{const e=await navigator.mediaDevices.enumerateDevices();return c&&c.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),c=null,u=null,d=null,e}catch(e){c&&c.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),c=null,u=null,d=null;return new pi(hi.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 pi(hi.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=wd.INITING;try{await this.updateDevicesInfo(),this.state=wd.INITEND}catch(e){if(this.state=wd.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname))throw new pi(hi.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.");throw Vn.warning("Device Detection functionality cannot start properly.",e.toString()),e}}async updateDevicesInfo(){const e=await this.enumerateDevices(!0,!0,!0),t=Date.now(),r=[];if(e[0]&&e[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const t=e.find((e=>"audioinput"===e.kind&&"default"===e.deviceId)),r=e.find((e=>"audiooutput"===e.kind&&"default"===e.deviceId));t&&r?r.groupId===t.groupId?Vn.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):Vn.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):Vn.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!==wd.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(Nd.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(Nd.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(Nd.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 xA=new UA;jc({target:"Array",stat:!0},{isArray:Wd});var VA=X(ls.Array.isArray);var FA=X(RS),BA=ca,jA=eu,WA=$d,GA=Hd;jc({target:"Array",proto:!0,arity:1,forced:Eo((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=BA(this),r=jA(t),i=arguments.length;GA(r+i);for(var n=0;n<i;n++)t[r]=arguments[n],r++;return WA(t,r),r}});var HA=pu("Array","push"),KA=vo,YA=HA,ZA=Array.prototype,zA=function(e){var t=e.push;return e===ZA||KA(ZA,e)&&t===ZA.push?YA:t},XA=X(zA);var JA=Ec,QA=kS,qA=uc,$A=Go,eO=ca,tO=function(e,t,r,i){try{return i?t(JA(r)[0],r[1]):t(r)}catch(t){QA(e,"throw",t)}},rO=_S,iO=ml,nO=eu,oO=zd,sO=$d,aO=NS,cO=RS,uO=kS,dO=Array,lO=function(e){var t=iO(this),r=arguments.length,i=r>1?arguments[1]:void 0,n=void 0!==i;n&&(i=qA(i,r>2?arguments[2]:void 0));var o,s,a,c,u,d,l=eO(e),h=cO(l),p=0;if(!h||this===dO&&rO(h))for(o=nO(l),s=t?new this(o):dO(o);o>p;p++)d=n?i(l[p],p):l[p],oO(s,p,d);else for(s=t?new this:[],u=(c=aO(l,h)).next;!(a=$A(u,c)).done;p++){d=n?tO(c,i,[a.value,p],!0):a.value;try{oO(s,p,d)}catch(e){uO(c,"throw",e)}}return sO(s,p),s},hO=lO;jc({target:"Array",stat:!0,forced:!ob((function(e){Array.from(e)}))},{from:hO});var pO=X(ls.Array.from);function fO(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function EO(e,t){return function(e){if(VA(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==oT&&FA(e)||e["@@iterator"];if(null!=r){var i,n,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(i=o.call(r)).done)&&(XA(a).call(a,i.value),a.length!==t);c=!0);}catch(e){u=!0,n=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw n}}return a}}(e,t)||function(e,t){if(e){var r;if("string"==typeof e)return fO(e,t);var i=Gg(r={}.toString.call(e)).call(r,8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?pO(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?fO(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let mO=!1;const _O=new class extends Ri{constructor(){super(...arguments),IT(this,"onAutoplayFailed",void 0),IT(this,"onAudioAutoplayFailed",void 0)}};function TO(){if(mO)return yn("FLS_AUTOPLAY_EMITS")?(_O.onAutoplayFailed&&_O.onAutoplayFailed(),_O.emit("autoplay-failed")):void 0;{const e=t=>{t.preventDefault(),mO=!1,si()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};mO=!0,si()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),Vn.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),_O.onAutoplayFailed?_O.onAutoplayFailed():_O.onAudioAutoplayFailed?Vn.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 ."):Vn.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 ."),_O.emit("autoplay-failed")}}function gO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function SO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gO(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function yO(e,t,r,i){if(!e)return;const n=no.getBaseInfoBySessionId(e);if(!n)return;const o=n.info,s=Date.now(),a=SO(SO({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-n.startTime,cbRegistered:_O.onAutoplayFailed||_O.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:i,extend:void 0});no.send({type:Hn.AUTOPLAY_FAILED,data:a},!0)}const vO=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],RO=new class{constructor(){IT(this,"onAutoplayFailed",void 0),IT(this,"elementMap",new Map),IT(this,"elementStateMap",new Map),IT(this,"elementsNeedToResume",[]),IT(this,"sinkIdMap",new Map),IT(this,"autoResumeAfterInterruption",(e=>sA.all(Array.from(this.elementMap.entries()).map((async t=>{let r=EO(t,2),i=r[0],n=r[1];const o=this.elementStateMap.get(i),s=n.srcObject.getAudioTracks()[0],a=s&&s.readyState;if(Vn.debug("resume after interrupted, ele: ".concat(o," audio: ").concat(a," ").concat(e)),"live"===a){if(e)return n.pause(),n.play();if("running"===pA.curState)return qr()?(n.pause(),n.play()):o&&"paused"===o?n.play():void 0}}))))),IT(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let t=EO(e,2);t[0];let r=t[1];const i=r.srcObject.getAudioTracks()[0];i&&"live"===i.readyState&&(Vn.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))})),this.autoResumeAudioElement(),pA.on(fo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),pA.on(fo.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),pA.on(fo.STATE_CHANGE,(()=>{Yr()&&"suspended"===pA.prevState&&"running"===pA.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 pi(hi.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,Dd.INIT),this.setVolume(t,r);const o=this.sinkIdMap.get(t);if(o)try{n.setSinkId(o).catch((e=>{Vn.warning("[".concat(t,"] set sink id failed"),e.toString())}))}catch(e){Vn.warning("[".concat(t,"] set sink id failed"),e.toString())}const s=n.play();s&&s.then&&s.catch((e=>{i&&yO(i,"audio",e.message,t),Vn.warning("audio element play warning",e.toString()),this.elementMap.has(t)&&"NotAllowedError"===e.name&&(Vn.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(n),ji((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),TO()})))}))}updateTrack(e,t){const r=this.elementMap.get(e);r&&(r.srcObject=new MediaStream([t]))}isPlaying(e){return this.elementMap.has(e)&&"playing"===this.elementStateMap.get(e)}setVolume(e,t){const r=this.elementMap.get(e);r&&(t=Math.max(0,Math.min(100,t)),r.volume=t/100)}getVolume(e){const t=this.elementMap.get(e);return t?t.volume:0}stop(e){const t=this.elementMap.get(e);if(this.sinkIdMap.delete(e),!t)return;const r=this.elementsNeedToResume.indexOf(t);this.elementsNeedToResume.splice(r,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}bindAudioElementEvents(e,t){vO.forEach((r=>{t.addEventListener(r,(r=>{const i=this.elementStateMap.get(e),n="pause"===r.type?"paused":r.type;if(Vn.debug("[".concat(e,"] audio-element-status change ").concat(i," => ").concat(n)),"error"===r.type){const r=null==t?void 0:t.error;r&&Vn.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=>{Vn.debug("Auto resume audio element success")})).catch((e=>{Vn.warning("Auto resume audio element failed!",e)}))})),this.elementsNeedToResume=[]};new Promise((e=>{document.body?e():window.addEventListener("load",(()=>e()))})).then((()=>{si()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function bO(){return function(e,t,r){const i=r.value;return"function"==typeof i&&(r.value=function(){this._isClosed&&new pi(hi.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",Vn);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 sA?new sA(((e,t)=>{n.then(e).catch(t)})):n}),r}}var AO=pu("Array","values"),OO=Cu,IO=la,CO=vo,wO=AO,NO=Array.prototype,DO={DOMTokenList:!0,NodeList:!0},PO=function(e){var t=e.values;return e===NO||CO(NO,e)&&t===NO.values||IO(DO,OO(e))?wO:t},LO=X(PO);function kO(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 MO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kO(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class UO extends Ri{constructor(e){super(),IT(this,"name","VideoProcessorDestination"),IT(this,"ID","0"),IT(this,"_source",void 0),IT(this,"videoContext",void 0),IT(this,"inputTrack",void 0),this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new pi(hi.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new pi(hi.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(Id.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(Id.ON_TRACK,void 0)}}class xO extends Ri{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),IT(this,"constraintsMap",new Map),IT(this,"statsRegistry",[]),IT(this,"usageRegistry",[]),IT(this,"trackId",void 0),IT(this,"direction",void 0),IT(this,"_chained",!1),this.trackId=e,this.direction=t}async getConstraints(){return await Di(this,Cd.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return Vn.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),Pi(this,Cd.REQUEST_UPDATE_CONSTRAINTS,Array.from(LO(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return Vn.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),Pi(this,Cd.REQUEST_UPDATE_CONSTRAINTS,Array.from(LO(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 t of this.statsRegistry){const r=t.processorID,i=t.processorName,n=t.type,o=t.cb;try{const t=o();e.push({processorID:r,processorName:i,type:n,stats:t})}catch(e){Vn.error(new pi(hi.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 t of this.usageRegistry){const r=t.cb;try{let t=r();t instanceof sA&&(t=await t),e.push(MO(MO({},t),{},{direction:this.direction}))}catch(e){Vn.error("gather extension usage error",e)}}return e}getDirection(){return this.direction}}class VO extends Ri{constructor(e){super(),IT(this,"name","AudioProcessorDestination"),IT(this,"ID","0"),IT(this,"inputTrack",void 0),IT(this,"inputNode",void 0),IT(this,"audioProcessorContext",void 0),IT(this,"_source",void 0),this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new pi(hi.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new pi(hi.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(Id.ON_TRACK,void 0),this.emit(Id.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(Id.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.audioProcessorContext.chained=!0,this.inputNode=e.node,this.emit(Id.ON_NODE,this.inputNode))}}class FO extends Ri{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),IT(this,"constraintsMap",new Map),IT(this,"statsRegistry",[]),IT(this,"audioContext",void 0),IT(this,"trackId",void 0),IT(this,"direction",void 0),IT(this,"usageRegistry",[]),IT(this,"_chained",!1),this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return Di(this,Cd.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return Vn.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),Pi(this,Cd.REQUEST_UPDATE_CONSTRAINTS,Array.from(LO(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),Pi(this,Cd.REQUEST_UPDATE_CONSTRAINTS,Array.from(LO(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 t of this.statsRegistry){const r=t.processorID,i=t.processorName,n=t.type,o=t.cb;try{const t=o();e.push({processorID:r,processorName:i,type:n,stats:t})}catch(e){Vn.error(new pi(hi.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 t of this.usageRegistry){const r=t.cb;try{let t=r();t instanceof sA&&(t=await t),e.push(MO(MO({},t),{},{direction:this.direction}))}catch(e){Vn.error("gather extension usage error",e)}}return e}getDirection(){return this.direction}}class BO extends Ri{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),IT(this,"context",void 0),IT(this,"processSourceNode",void 0),IT(this,"outputTrack",void 0),IT(this,"processedNode",void 0),IT(this,"clonedTrack",void 0),IT(this,"outputNode",void 0),this.outputNode=new jO}setVolume(){}createOutputTrack(){throw new pi(hi.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 jO{disconnect(){}connect(){}}function WO(e){return new sA(((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=Yr()?"canplay":"playing";n.addEventListener(o,(()=>{const e=n.videoWidth,r=n.videoHeight;!e&&Kr()||(i=!0,n.srcObject=null,n.remove(),t([e,r]))})),n.srcObject=new MediaStream([e]),n.play().catch(Xi),setTimeout((()=>{i||(n.srcObject=null,n.remove(),t([n.videoWidth,n.videoHeight]))}),4e3)}))}function GO(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=ed(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!ri()&&r.frameRate&&(t.frameRate=r.frameRate),Hr()&&"object"==typeof t.frameRate&&(t.frameRate.max=60),Kr()&&(t.frameRate={ideal:30,max:30}),t}function HO(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&Wr()&&(t.extensionId=e.extensionId);const r=e.displaySurface,i=e.selfBrowserSurface,n=e.surfaceSwitching,o=e.systemAudio,s=e.preferCurrentTab,a=e.windowAudio,c=e.monitorTypeSurfaces;(Zr(107)||Xr(107)||Qr(93))&&(r&&(Ei(r,"displaySurface",["browser","window","monitor"]),t.displaySurface=r),i?(Ei(i,"selfBrowserSurface",["exclude","include"]),t.selfBrowserSurface=i):t.selfBrowserSurface="include",n&&(Ei(n,"surfaceSwitching",["exclude","include"]),t.surfaceSwitching=n)),(Zr(105)||Xr(105)||Qr(91))&&o&&(Ei(o,"systemAudio",["exclude","include"]),t.systemAudio=o),(Zr(94)||Xr(94)||Qr(80))&&s&&(t.preferCurrentTab=!0),(Zr(141)||Xr(141)||Qr(125))&&a&&(Ei(a,"windowAudio",["exclude","system"]),t.windowAudio=a),(Zr(119)||Xr(119)||Qr(105))&&c&&(Ei(c,"monitorTypeSurfaces",["exclude","include"]),t.monitorTypeSurfaces=c),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const u=e.encoderConfig?td(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:u?u.width:void 0,maxHeight:u?u.height:void 0},u&&(u.frameRate&&("number"==typeof u.frameRate?(t.mandatory.maxFrameRate=u.frameRate,t.mandatory.minFrameRate=u.frameRate):(t.mandatory.maxFrameRate=u.frameRate.max||u.frameRate.ideal||u.frameRate.exact||void 0,t.mandatory.minFrameRate=u.frameRate.min||u.frameRate.ideal||u.frameRate.exact||void 0),t.frameRate=u.frameRate),u.width&&(t.width=u.width),u.height&&(t.height=u.height)),t}function KO(e){const t={};return ri()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,Wr()&&e.ANS&&(t.googHighpassFilter=e.ANS))),t}function YO(e){const t=KO(e);return ho()&&e.suppressLocalAudioPlayback&&(t.suppressLocalAudioPlayback=e.suppressLocalAudioPlayback),po()&&e.restrictOwnAudio&&(t.restrictOwnAudio=!0),t}function ZO(e){const t=KO(e);if(e.encoderConfig){const r=nd(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),oi()&&(t.sampleRate=void 0),t}var zO=Vs,XO=TypeError,JO=Nh,QO=Math.floor,qO=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=QO(r/2),a=qO(JO(e,0,s),t),c=qO(JO(e,s),t),u=a.length,d=c.length,l=0,h=0;l<u||h<d;)e[l+h]=l<u&&h<d?t(a[l],c[h])<=0?a[l++]:c[h++]:l<u?a[l++]:c[h++];return e},$O=qO,eI=gs.match(/firefox\/(\d+)/i),tI=!!eI&&+eI[1],rI=/MSIE|Trident/.test(gs),iI=gs.match(/AppleWebKit\/(\d+)\./),nI=!!iI&&+iI[1],oI=jc,sI=yo,aI=Ws,cI=ca,uI=eu,dI=function(e,t){if(!delete e[t])throw new XO("Cannot delete property "+zO(t)+" of "+zO(e))},lI=Du,hI=Eo,pI=$O,fI=wT,EI=tI,mI=rI,_I=Os,TI=nI,gI=[],SI=sI(gI.sort),yI=sI(gI.push),vI=hI((function(){gI.sort(void 0)})),RI=hI((function(){gI.sort(null)})),bI=fI("sort"),AI=!hI((function(){if(_I)return _I<70;if(!(EI&&EI>3)){if(mI)return!0;if(TI)return TI<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++)gI.push({k:t+i,v:r})}for(gI.sort((function(e,t){return t.v-e.v})),i=0;i<gI.length;i++)t=gI[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));oI({target:"Array",proto:!0,forced:vI||!RI||!bI||!AI},{sort:function(e){void 0!==e&&aI(e);var t=cI(this);if(AI)return void 0===e?SI(t):SI(t,e);var r,i,n=[],o=uI(t);for(i=0;i<o;i++)i in t&&yI(n,t[i]);for(pI(n,function(e){return function(t,r){if(void 0===r)return-1;if(void 0===t)return 1;if(void 0!==e)return+e(t,r)||0;var i=lI(t),n=lI(r);return i===n?0:i>n?1:-1}}(e)),r=uI(n),i=0;i<r;)t[i]=n[i++];for(;i<o;)dI(t,i++);return t}});var OI=pu("Array","sort"),II=vo,CI=OI,wI=Array.prototype,NI=function(e){var t=e.sort;return e===wI||II(wI,e)&&t===wI.sort?CI:t},DI=X(NI);function PI(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 LI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?PI(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function kI(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=LO(o).call(o).next().value,c=1;if(o.has(n))a=o.get(n);else{var u;const e=DI(u=Array.from(o.entries())).call(u,((e,t)=>EO(e,1)[0]-EO(t,1)[0])),t=e.find((e=>EO(e,1)[0]>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 d;const e=DI(d=Array.from(s.entries())).call(d,((e,t)=>EO(e,1)[0]-EO(t,1)[0])),t=e.find((e=>EO(e,1)[0]>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=yn("VIDEO_NEW_BITRATE_RATIO");l&&l>0&&(a=l/100);const h=Math.floor(i*a),p=Math.floor(65e4*Math.pow(e*t/230400,.5)*Math.pow(r/15,.69));let f=h;const E=yn("VIDEO_STANDARD_BITRATE_VERSION");return E&&E>0&&(1===E?f=i:2===E?f=h:3===E&&(f=p)),[Math.floor(f/1e3),c]}function MI(e,t,r){if(!Array.isArray(yn("VIDEO_ENCODER_CONFIG_LIST")))return!1;if(0===yn("VIDEO_ENCODER_CONFIG_LIST").length)return!1;const i=Math.min(e,t);if(i>=480)return!1;return LI(LI({},yn("VIDEO_ENCODER_CONFIG_LIST").find((e=>e.height>i))),{},{frameRate:r})}function UI(e,t,r,i,n){const o=yn("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 xI(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 VI=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 u=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 d,l,h,p,f,E=1732584193,m=-271733879,_=-1732584194,T=271733878;for(d=0;d<u.length;d+=16)l=E,h=m,p=_,f=T,E=o(E,m,_,T,u[d+0],7,-680876936),T=o(T,E,m,_,u[d+1],12,-389564586),_=o(_,T,E,m,u[d+2],17,606105819),m=o(m,_,T,E,u[d+3],22,-1044525330),E=o(E,m,_,T,u[d+4],7,-176418897),T=o(T,E,m,_,u[d+5],12,1200080426),_=o(_,T,E,m,u[d+6],17,-1473231341),m=o(m,_,T,E,u[d+7],22,-45705983),E=o(E,m,_,T,u[d+8],7,1770035416),T=o(T,E,m,_,u[d+9],12,-1958414417),_=o(_,T,E,m,u[d+10],17,-42063),m=o(m,_,T,E,u[d+11],22,-1990404162),E=o(E,m,_,T,u[d+12],7,1804603682),T=o(T,E,m,_,u[d+13],12,-40341101),_=o(_,T,E,m,u[d+14],17,-1502002290),m=o(m,_,T,E,u[d+15],22,1236535329),E=s(E,m,_,T,u[d+1],5,-165796510),T=s(T,E,m,_,u[d+6],9,-1069501632),_=s(_,T,E,m,u[d+11],14,643717713),m=s(m,_,T,E,u[d+0],20,-373897302),E=s(E,m,_,T,u[d+5],5,-701558691),T=s(T,E,m,_,u[d+10],9,38016083),_=s(_,T,E,m,u[d+15],14,-660478335),m=s(m,_,T,E,u[d+4],20,-405537848),E=s(E,m,_,T,u[d+9],5,568446438),T=s(T,E,m,_,u[d+14],9,-1019803690),_=s(_,T,E,m,u[d+3],14,-187363961),m=s(m,_,T,E,u[d+8],20,1163531501),E=s(E,m,_,T,u[d+13],5,-1444681467),T=s(T,E,m,_,u[d+2],9,-51403784),_=s(_,T,E,m,u[d+7],14,1735328473),m=s(m,_,T,E,u[d+12],20,-1926607734),E=a(E,m,_,T,u[d+5],4,-378558),T=a(T,E,m,_,u[d+8],11,-2022574463),_=a(_,T,E,m,u[d+11],16,1839030562),m=a(m,_,T,E,u[d+14],23,-35309556),E=a(E,m,_,T,u[d+1],4,-1530992060),T=a(T,E,m,_,u[d+4],11,1272893353),_=a(_,T,E,m,u[d+7],16,-155497632),m=a(m,_,T,E,u[d+10],23,-1094730640),E=a(E,m,_,T,u[d+13],4,681279174),T=a(T,E,m,_,u[d+0],11,-358537222),_=a(_,T,E,m,u[d+3],16,-722521979),m=a(m,_,T,E,u[d+6],23,76029189),E=a(E,m,_,T,u[d+9],4,-640364487),T=a(T,E,m,_,u[d+12],11,-421815835),_=a(_,T,E,m,u[d+15],16,530742520),m=a(m,_,T,E,u[d+2],23,-995338651),E=c(E,m,_,T,u[d+0],6,-198630844),T=c(T,E,m,_,u[d+7],10,1126891415),_=c(_,T,E,m,u[d+14],15,-1416354905),m=c(m,_,T,E,u[d+5],21,-57434055),E=c(E,m,_,T,u[d+12],6,1700485571),T=c(T,E,m,_,u[d+3],10,-1894986606),_=c(_,T,E,m,u[d+10],15,-1051523),m=c(m,_,T,E,u[d+1],21,-2054922799),E=c(E,m,_,T,u[d+8],6,1873313359),T=c(T,E,m,_,u[d+15],10,-30611744),_=c(_,T,E,m,u[d+6],15,-1560198380),m=c(m,_,T,E,u[d+13],21,1309151649),E=c(E,m,_,T,u[d+4],6,-145523070),T=c(T,E,m,_,u[d+11],10,-1120210379),_=c(_,T,E,m,u[d+2],15,718787259),m=c(m,_,T,E,u[d+9],21,-343485551),E=i(E,l),m=i(m,h),_=i(_,p),T=i(T,f);return r(E)+r(m)+r(_)+r(T)}(""+t+r)).slice(0,16),n=i.slice(0,12),o=await window.crypto.subtle.importKey("raw",i,"AES-GCM",!0,["encrypt"]);return new Uint8Array(await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},o,e))},FI=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new sA(((r,i)=>{t.toBlob((async e=>{if(t.remove(),e){const i=await BI(e);r({buffer:i,width:t.width,height:t.height})}else i(new pi(hi.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},BI=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function jI(e,t){if("VideoFrame"in window&&"TransformStream"in window&&ao().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 u=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(u).pipeTo(i.writable),i}}var WI,GI,HI,KI,YI,ZI,zI,XI,JI,QI,qI,$I,eC,tC,rC,iC,nC,oC,sC,aC,cC,uC,dC,lC,hC,pC,fC,EC,mC,_C,TC,gC,SC,yC,vC,RC,bC,AC,OC,IC;function CC(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 wC(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?CC(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CC(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let NC=(WI=io({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),GI=io({argsMap:(e,t)=>[e.getTrackId(),t]}),HI=bO(),KI=sn("LocalAudioTrack","_enabledMutex"),YI=io({argsMap:(e,t)=>[e.getTrackId(),t]}),ZI=bO(),zI=sn("LocalAudioTrack","_enabledMutex"),XI=io({argsMap:(e,t)=>[e.getTrackId(),t]}),JI=bO(),QI=bO(),qI=bO(),$I=io({argsMap:e=>[e.getTrackId()]}),eC=bO(),tC=io({argsMap:e=>[e.getTrackId()]}),rC=bO(),iC=io({argsMap:e=>[e.getTrackId()]}),nC=io({argsMap:(e,t)=>[e.getTrackId(),t.name]}),oC=io({argsMap:e=>[e.getTrackId()]}),sC=class extends cA{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?RO.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,i){super(e,r),IT(this,"trackMediaType",Sd.AUDIO),IT(this,"_encoderConfig",void 0),IT(this,"_trackSource",void 0),IT(this,"metadata",[]),IT(this,"_enabled",!0),IT(this,"_volume",100),IT(this,"_useAudioElement",!0),IT(this,"_bypassWebAudio",!1),IT(this,"processor",void 0),IT(this,"_processorContext",void 0),IT(this,"_processorDestination",void 0),IT(this,"_getOriginVolumeLevel",void 0),this._encoderConfig=t,this._getOriginVolumeLevel=!!i,this._trackSource=new BO,yn("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),yn("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);Gr()&&!_A()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(e){mi(e,"volume",0,1e3),this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&RO.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void Vn.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,Pi(this,hd.NEED_REPLACE_TRACK,this).then((()=>{Vn.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{Vn.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||!co())throw new pi(hi.NOT_SUPPORTED,"your browser does not support setting the audio output device");await RO.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(Vn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await Pi(this,hd.NEED_ENABLE_TRACK,this),Vn.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success"))}catch(e){throw r||(this._enabled=!1),Vn.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await Pi(this,hd.NEED_DISABLE_TRACK,this)}catch(e){throw r||(this._enabled=!0),Vn.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,Vn.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await Pi(this,hd.NEED_MUTE_TRACK,this):await Pi(this,hd.NEED_UNMUTE_TRACK,this))}getStats(){Ki((()=>{Vn.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const e=Li(this,hd.GET_STATS);return e||wC({},Rd)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(yd.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(yd.ON_AUDIO_BUFFER),this._source.on(yd.ON_AUDIO_BUFFER,(t=>e(t)))}play(){Vn.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(Vn.debug("[".concat(this.getTrackId(),"] start audio playback in element")),RO.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){Vn.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?RO.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];Vn.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&RO.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 Pi(this,hd.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(e))}renewMediaStreamTrack(e){return sA.resolve(void 0)}pipe(e){if(this._bypassWebAudio)throw new pi(hi.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new pi(hi.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(Id.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e),await Pi(this,hd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await Pi(this,hd.NEED_REPLACE_TRACK,this))})),e.on(Id.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(e){e.removeAllListeners(Id.ON_TRACK),e.removeAllListeners(Id.ON_NODE)}bindProcessorContextEvents(e){e.on(Cd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(e){e.removeAllListeners(Cd.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof BO&&(this._trackSource=new OA(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const e=new FO(this._source.context,this.getTrackId(),"local"),t=new VO(e);return this._processorContext=e,this._processorDestination=t,this.bindProcessorContextEvents(e),this.bindProcessorDestinationEvents(t),this._source.on(yd.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:e})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(RO.stop(this.getTrackId()),this._source.play()),Pi(this,hd.NEED_REPLACE_MIXING_TRACK,this).then((()=>{Vn.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{Vn.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:e,processorDestination:t}}},Hg(sC.prototype,"setVolume",[WI],Object.getOwnPropertyDescriptor(sC.prototype,"setVolume"),sC.prototype),Hg(sC.prototype,"setPlaybackDevice",[GI,HI],Object.getOwnPropertyDescriptor(sC.prototype,"setPlaybackDevice"),sC.prototype),Hg(sC.prototype,"setEnabled",[KI,YI,ZI],Object.getOwnPropertyDescriptor(sC.prototype,"setEnabled"),sC.prototype),Hg(sC.prototype,"setMuted",[zI,XI,JI],Object.getOwnPropertyDescriptor(sC.prototype,"setMuted"),sC.prototype),Hg(sC.prototype,"getStats",[QI],Object.getOwnPropertyDescriptor(sC.prototype,"getStats"),sC.prototype),Hg(sC.prototype,"setAudioFrameCallback",[qI],Object.getOwnPropertyDescriptor(sC.prototype,"setAudioFrameCallback"),sC.prototype),Hg(sC.prototype,"play",[$I,eC],Object.getOwnPropertyDescriptor(sC.prototype,"play"),sC.prototype),Hg(sC.prototype,"stop",[tC,rC],Object.getOwnPropertyDescriptor(sC.prototype,"stop"),sC.prototype),Hg(sC.prototype,"close",[iC],Object.getOwnPropertyDescriptor(sC.prototype,"close"),sC.prototype),Hg(sC.prototype,"pipe",[nC],Object.getOwnPropertyDescriptor(sC.prototype,"pipe"),sC.prototype),Hg(sC.prototype,"unpipe",[oC],Object.getOwnPropertyDescriptor(sC.prototype,"unpipe"),sC.prototype),sC),DC=(aC=io({argsMap:(e,t)=>[e.getTrackId(),t]}),cC=bO(),uC=sn("MicrophoneAudioTrack","_enabledMutex"),dC=io({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),lC=bO(),hC=io({argsMap:e=>[e.getTrackId()]}),pC=class extends NC{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,i){super(e,t.encoderConfig?nd(t.encoderConfig):{},i,yn("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),IT(this,"_config",void 0),IT(this,"_deviceName","default"),IT(this,"_constraints",void 0),IT(this,"_originalConstraints",void 0),IT(this,"_enabled",!0),this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),(qr()||$r())&&pA.bindInterruptDetectorTrack(this)}async setDevice(e){if(Vn.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await xA.getDeviceById(e),r={};r.audio=wC({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let i=null;try{i=await PA(r,this.getTrackId())}catch(e){throw Vn.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await PA({audio:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(i.getAudioTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(i.getAudioTracks()[0],!1),this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw Vn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await xA.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw Vn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Vn.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(e,t,r){if(t)return Vn.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(Vn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),yn("AUTO_RESET_AUDIO_ROUTE")&&(Yr()||ti())){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 Pi(this,hd.NEED_DISABLE_TRACK,this)}catch(e){throw Vn.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const n=wC({},this._constraints),o=xA.searchDeviceIdByName(this._deviceName);o&&!n.deviceId&&(n.deviceId=o);try{r||(this._enabled=!0);const e=await PA({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await Pi(this,hd.NEED_ENABLE_TRACK,this)}catch(e){throw r||(this._enabled=!1),Vn.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}Vn.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(qr()||$r())&&pA.unbindInterruptDetectorTrack(this),cd()||EA()}onTrackEnded(){if((Yr()||ti())&&this._enabled&&!this._isClosed&&pA.duringInterruption){const e=async()=>{pA.off(fo.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Vn.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};pA.on(fo.IOS_INTERRUPTION_END,e)}else Vn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Td.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=xA.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await PA({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(e){super.bindProcessorContextEvents(e),e.on(Cd.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(Cd.REQUEST_UPDATE_CONSTRAINTS)}},Hg(pC.prototype,"setDevice",[aC,cC],Object.getOwnPropertyDescriptor(pC.prototype,"setDevice"),pC.prototype),Hg(pC.prototype,"setEnabled",[uC,dC,lC],Object.getOwnPropertyDescriptor(pC.prototype,"setEnabled"),pC.prototype),Hg(pC.prototype,"close",[hC],Object.getOwnPropertyDescriptor(pC.prototype,"close"),pC.prototype),pC),PC=(fC=io({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),EC=bO(),mC=io({argsMap:e=>[e.getTrackId()]}),_C=bO(),TC=io({argsMap:e=>[e.getTrackId()]}),gC=bO(),SC=io({argsMap:e=>[e.getTrackId()]}),yC=bO(),vC=io({argsMap:e=>[e.getTrackId()]}),RC=bO(),bC=io({argsMap:e=>[e.getTrackId()]}),AC=io({argsMap:e=>[e.getTrackId()]}),OC=bO(),Hg((IC=class extends NC{get __className__(){return"BufferSourceAudioTrack"}constructor(e,t,r,i){super(t.createOutputTrack(),r,i),IT(this,"source",void 0),IT(this,"_bufferSource",void 0),this._useAudioElement=!1,this.source=e,this._bufferSource=t,this._bufferSource.on(yd.AUDIO_SOURCE_STATE_CHANGE,(e=>{this.safeEmit(Td.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){mi(e,"speed",0),this._bufferSource.setAudioBufferPlaybackSpeed(e)}}).prototype,"startProcessAudioBuffer",[fC,EC],Object.getOwnPropertyDescriptor(IC.prototype,"startProcessAudioBuffer"),IC.prototype),Hg(IC.prototype,"pauseProcessAudioBuffer",[mC,_C],Object.getOwnPropertyDescriptor(IC.prototype,"pauseProcessAudioBuffer"),IC.prototype),Hg(IC.prototype,"seekAudioBuffer",[TC,gC],Object.getOwnPropertyDescriptor(IC.prototype,"seekAudioBuffer"),IC.prototype),Hg(IC.prototype,"resumeProcessAudioBuffer",[SC,yC],Object.getOwnPropertyDescriptor(IC.prototype,"resumeProcessAudioBuffer"),IC.prototype),Hg(IC.prototype,"stopProcessAudioBuffer",[vC,RC],Object.getOwnPropertyDescriptor(IC.prototype,"stopProcessAudioBuffer"),IC.prototype),Hg(IC.prototype,"close",[bC],Object.getOwnPropertyDescriptor(IC.prototype,"close"),IC.prototype),Hg(IC.prototype,"setAudioBufferPlaybackSpeed",[AC,OC],Object.getOwnPropertyDescriptor(IC.prototype,"setAudioBufferPlaybackSpeed"),IC.prototype),IC);class LC extends NC{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=mA().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,zi(8,"track-mix-")),IT(this,"trackList",void 0),IT(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)?(Vn.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):Vn.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){Vn.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}Bi(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 LC?t.emit(_d.TRANSCEIVER_UPDATED,e):t._updateRtpTransceiver(e)})))}}class kC extends AA{set currentState(e){e!==this._currentState&&(this._currentState=e,this.safeEmit(yd.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(),IT(this,"audioBuffer",void 0),IT(this,"sourceNode",void 0),IT(this,"startPlayTime",0),IT(this,"startPlayOffset",0),IT(this,"pausePlayTime",0),IT(this,"options",void 0),IT(this,"currentLoopCount",0),IT(this,"currentPlaybackSpeed",100),IT(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):Vn.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 MC=new Map;function UC(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 xC(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?UC(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UC(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function VC(e,t){if(0===e.length||0===t.length)return 1/0;const r=tn(e),i=tn(t);return Math.floor(i/r)}class FC{get rendFrameRate(){const e=Math.max(1,VC(this._render_interframe_delays_sizes,this._render_interframe_delays));return Math.floor(1e3/e)}get videoElementStatus(){return this._isInPage?this._videoElementStatus:Dd.DESTROYED}set videoElementStatus(e){e!==this._videoElementStatus&&(Vn.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){IT(this,"trackId",void 0),IT(this,"config",void 0),IT(this,"onFirstVideoFrameDecoded",void 0),IT(this,"onFirstVideoFrameRender",void 0),IT(this,"onVideoBufferReady",void 0),IT(this,"onVideoStateChanged",void 0),IT(this,"freezeTimeCounterList",[]),IT(this,"renderFreezeAccTime",0),IT(this,"renderFreezeAccTime2",0),IT(this,"totalFreezeTime",0),IT(this,"isKeepLastFrame",!1),IT(this,"isDestroyed",!1),IT(this,"timeUpdatedCount",0),IT(this,"freezeTime",0),IT(this,"playbackTime",0),IT(this,"lastTimeUpdatedTime",0),IT(this,"autoplayFailed",!1),IT(this,"videoTrack",void 0),IT(this,"videoElement",void 0),IT(this,"cacheVideoElement",void 0),IT(this,"cancelRVFId",void 0),IT(this,"internal",!1),IT(this,"_render_interframe_delays",[]),IT(this,"_render_interframe_delays_sizes",[]),IT(this,"_videoState",Pd.VideoStateStopped),IT(this,"videoElementCheckInterval",void 0),IT(this,"videoElementFreezeTimeout",void 0),IT(this,"_videoElementStatus",Dd.NONE),IT(this,"_isInPage",!0),IT(this,"isGettingVideoDimensions",!1),IT(this,"startGetVideoDimensions",(()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return Vn.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()})),IT(this,"autoResumeAfterInterruption",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===pA.curState&&(Vn.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Br())),ei()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),IT(this,"handleVideoEvents",(e=>{switch(e.type){case"play":case"playing":"play"===e.type&&Vn.debug("[".concat(this.trackId,"] video element status: play")),this.startGetVideoDimensions(),this.videoElementStatus=Dd.PLAYING;break;case"loadeddata":if(this.videoState=Pd.VideoStateStarting,this.onFirstVideoFrameRender&&this.onFirstVideoFrameRender(),this.onFirstVideoFrameDecoded&&this.onFirstVideoFrameDecoded(),this.cacheVideoElement){try{this.cacheVideoElement.srcObject=null,this.cacheVideoElement.remove()}catch(e){}this.cacheVideoElement=void 0}break;case"canplay":this.videoElementStatus=Dd.CANPLAY;break;case"stalled":this.videoElementStatus=Dd.STALLED;break;case"suspend":this.videoElementStatus=Dd.SUSPEND;break;case"pause":this.videoElementStatus=Dd.PAUSED,Yr()||ti()||Gr()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(Vn.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=Dd.WAITING;break;case"abort":this.videoElementStatus=Dd.ABORT;break;case"ended":this.videoElementStatus=Dd.ENDED;break;case"emptied":this.videoElementStatus=Dd.EMPTIED;break;case"error":{const e=this.videoElement.error;e&&(this.videoElementStatus=Dd.ERROR,Vn.error("[".concat(this.trackId,"] media error: ").concat(e.message," (").concat(e.code,")")));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.onVideoBufferReady&&this.timeUpdatedCount>yn("BUFFER_READY_FRAMES")&&this.onVideoBufferReady(),this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,Qw.lastVisibleTime<Qw.lastHiddenTime||r<Qw.lastHiddenTime||r<Qw.lastVisibleTime)return;if(this.isSkipCalcRenderFreezeTime())return;for(t>yn("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}}})),IT(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(Vn.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Br())),ei()?(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"),pA.on(fo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),pA.on(fo.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&&yO(e,"video",t.message,this.trackId),"NotAllowedError"===t.name?(Vn.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):Vn.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=xr();if(("Safari"===r.name&&15===Number(r.version)||qr())&&t&&t.then){const e=()=>{this.config.mirror&&!this.config.noStyle&&(this.videoElement.style.transform="rotateY(180deg)")};t.then(e).catch(e)}}getCurrentFrame(){const e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;const t=e.getContext("2d");if(!t)return Vn.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 sA(((i,n)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await BI(e);i({buffer:t,width:r.width,height:r.height})}else n(new pi(hi.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,t<0?.1:t>1?1:t)}))):await FI(e)}destroy(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isDestroyed=!0,pA.off(fo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),pA.off(fo.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),e?this.videoElement.pause():this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=Pd.VideoStateStopped}initVideoElement(){if(this._videoElementStatus!==Dd.NONE&&this._videoElementStatus!==Dd.DESTROYED||(this.videoElementStatus=Dd.INIT),!this.videoElementCheckInterval&&(BC.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{this._isInPage=function(e){return e!==document.body&&document.body.contains(e)}(this.videoElement)}),1e3),yn("ENABLE_VIDEO_FRAME_CALLBACK"))){var e,t;let r;const i=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",i),this.videoElementFreezeTimeout=window.setTimeout(n,yn("VIDEO_FREEZE_DURATION")))},n=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===Pd.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=Pd.VideoStateFrozen:document.addEventListener("visibilitychange",i))},o=(e,t)=>{if(this.videoElementStatus===Dd.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=tn(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===Pd.VideoStateStarting&&(this.videoState=Pd.VideoStateDecoding),this.videoState===Pd.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(n,yn("VIDEO_FREEZE_DURATION"))),e<yn("VIDEO_FREEZE_DURATION")&&this.videoState===Pd.VideoStateFrozen&&(this.videoState=Pd.VideoStateDecoding),e>yn("VIDEO_FREEZE_DURATION")&&Qw.lastVisibleTime>=Qw.lastHiddenTime&&r.timestamp>Qw.lastVisibleTime&&r.timestamp>Qw.lastHiddenTime){const t=Math.min(66,VC(this._render_interframe_delays_sizes,this._render_interframe_delays)),r=Math.max(0,e-(i-1)*t),n=r>t?r:0;this.renderFreezeAccTime2+=n,this.totalFreezeTime+=n,this.renderFreezeAccTime+=e}}r=xC(xC({},t),{},{timestamp:e})}else this.isSkipCalcRenderFreezeTime()&&(r=xC(xC({},t),{},{timestamp:e}));var i,s;yn("ENABLE_VIDEO_FRAME_CALLBACK")&&(this.cancelRVFId=null===(i=(s=this.videoElement).requestVideoFrameCallback)||void 0===i?void 0:i.call(s,o))};this.cancelRVFId=null===(e=(t=this.videoElement).requestVideoFrameCallback)||void 0===e?void 0:e.call(t,o)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),oi()&&!yn("HIDE_NO_POSTER")&&(this.videoElement.poster="noposter");const r=xr();if(this.config.noStyle||("Safari"===r.name&&15===Number(r.version)||qr()||!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,Kr()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Kr()&&this.videoElement.load();const i=this.videoElement.play();void 0!==i&&i.catch((e=>{Vn.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){var e,t;(BC.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.cancelRVFId&&this.videoElement)&&(null===(e=(t=this.videoElement).cancelVideoFrameCallback)||void 0===e||e.call(t,this.cancelRVFId),this.cancelRVFId=void 0);this.videoElementStatus=Dd.NONE}isSkipCalcRenderFreezeTime(){return this.videoElementStatus===Dd.DESTROYED||this.internal}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{Vn.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{Vn.error(e)})),this.autoplayFailed=!1,si()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};si()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),TO()}}const BC=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class jC extends FC{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super(e),IT(this,"container",void 0),IT(this,"slot",void 0),this.slot=e.element,this.internal=t,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;var r;!this.internal||this.slot?(t!==this.slot&&(this.destroy(),this.slot=t),this.createElements()):(this.slot=t,t&&this.container?(this.internal=!1,this.container.id="agora-video-player-".concat(this.trackId),this.videoElement.id="video_".concat(this.trackId),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover",null===(r=this.slot)||void 0===r||r.appendChild(this.container)):this.createElements())}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}play(e){var t;null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)&&super.play(e)}getCurrentFrame(){var e;return null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)?super.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameToUint8Array(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)?await super.getCurrentFrameToUint8Array(e,r):await FI(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{var e;this.container.remove(),null===(e=this.slot)||void 0===e||e.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){var e;this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",yn("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),null===(e=this.slot)||void 0===e||e.appendChild(this.container)}mountedVideoElement(){var e;!this.container||null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)||this.container.appendChild(this.videoElement),super.initVideoElement(),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.left="0",this.videoElement.style.top="0"}unmountedVideoElement(){var e;if(null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)){super.resetVideoElement();try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=document.createElement("video")}}resetVideoElement(){var e;null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)&&(super.resetVideoElement(),this.cacheVideoElement=this.videoElement,this.videoElement=document.createElement("video"))}getContainerElement(){return this.container}}var WC,GC,HC,KC,YC,ZC,zC,XC,JC,QC,qC,$C,ew,tw,rw,iw,nw,ow,sw,aw,cw,uw,dw,lw,hw,pw,fw,Ew,mw,_w,Tw,gw,Sw,yw,vw,Rw,bw,Aw;function Ow(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 Iw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ow(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ow(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let Cw=(WC=io({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),GC=bO(),HC=io({argsMap:e=>[e.getTrackId()]}),KC=sn("LocalVideoTrack","_enabledMutex"),YC=io({argsMap:(e,t)=>[e.getTrackId(),t]}),ZC=bO(),zC=sn("LocalVideoTrack","_enabledMutex"),XC=io({argsMap:(e,t)=>[e.getTrackId(),t]}),JC=bO(),QC=io({argsMap:(e,t)=>[e.getTrackId(),t,e._saveEncodeBitrateRatio]}),qC=bO(),$C=io({argsMap:(e,t)=>[e.getTrackId(),t]}),ew=bO(),tw=bO(),rw=io({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),iw=bO(),nw=bO(),ow=bO(),sw=io({argsMap:e=>[e.getTrackId()]}),aw=bO(),cw=bO(),uw=bO(),dw=bO(),lw=bO(),hw=io({argsMap:(e,t)=>[e.getTrackId(),t.name]}),pw=io({argsMap:e=>[e.getTrackId()]}),fw=io({argsMap:e=>[e.getTrackId()]}),Ew=io({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),mw=class e extends cA{get videoHeight(){if(Gr()){const e=this._mediaStreamTrack.getSettings().height;return this._videoHeight=e,this._videoHeight}return this._videoHeight}get videoWidth(){if(Gr()){const e=this._mediaStreamTrack.getSettings().width;return this._videoWidth=e,this._videoWidth}return this._videoWidth}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==Dd.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),IT(this,"trackMediaType",Sd.VIDEO),IT(this,"_player",void 0),IT(this,"isUseScaleResolutionDownBy",!1),IT(this,"_videoVisibleTimer",null),IT(this,"_previousVideoVisibleStatus",void 0),IT(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),IT(this,"_encoderConfig",void 0),IT(this,"_scalabilityMode",{numSpatialLayers:1,numTemporalLayers:1}),IT(this,"_optimizationMode",void 0),IT(this,"_saveEncodeBitrateRatio",1),IT(this,"_videoHeight",void 0),IT(this,"_videoWidth",void 0),IT(this,"_forceBitrateLimit",void 0),IT(this,"_enabled",!0),IT(this,"_processorDestination",void 0),IT(this,"_processorContext",void 0),Gr()){const t=e.getSettings(),r=t.width,i=t.height;this._videoWidth=r,this._videoHeight=i}else this.updateMediaStreamTrackResolution();if(this._scalabilityMode=r,this._optimizationMode=i,this._hints=o||[],t&&-1!==this._hints.indexOf(pd.CUSTOM_TRACK)?this._encoderConfig=Wi(t):this._encoderConfig=t,-1===this._hints.indexOf(pd.SCREEN_TRACK))this.updateBitrateFromProfile();else if(zr(Lr.CHROME,115)&&-1!==Fr().indexOf("Windows")){const t=jI(e);t&&(Vn.info("local screen video track begin to inject frame"),this._mediaStreamTrack=t)}t&&-1!==this._hints.indexOf(pd.CUSTOM_TRACK)&&this.setEncoderConfiguration(t),this._processorContext=new xO(this.getTrackId(),"local"),this._processorDestination=new UO(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:(Vn.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Vn.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=Iw(Iw(Iw({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new FC(r):this._player=new jC(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(Td.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),yn("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,Vn.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Vn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),!e){this._originMediaStreamTrack.enabled=!1;try{await Pi(this,hd.NEED_DISABLE_TRACK,this)}catch(e){throw Vn.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return t||(this._enabled=!1),void Vn.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await Pi(this,hd.NEED_ENABLE_TRACK,this)}catch(e){throw Vn.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}Vn.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,Vn.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await Pi(this,hd.NEED_MUTE_TRACK,this):await Pi(this,hd.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),Vn.debug("[".concat(this.getTrackId(),"] set save encode bitrate ratio, ").concat(e)),this._saveEncodeBitrateRatio=1;try{await Pi(this,hd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Vn)}}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new pi(hi.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");if(e=ed(e),yn("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=GO({encoderConfig:e});(Gr()||Yr()||ti())&&(t.deviceId=void 0),Vn.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 pi(hi.UNEXPECTED_ERROR,e.toString());throw Vn.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=e,-1===this._hints.indexOf(pd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Pi(this,hd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Vn)}}getStats(){Ki((()=>{Vn.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const e=Li(this,hd.GET_STATS);return e||Iw({},bd)}async setBeautyEffect(e){Vn.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 FI(e)}async findClosestProfile(){const e=this.getMediaStreamTrackSettings(),t=e.width,r=e.height,i=e.frameRate,n=this._encoderConfig||{},o=n.width,s=n.height,a=n.frameRate,c=en(this._videoWidth||t||o||0),u=en(this._videoHeight||r||s||0),d=MI(c,u,en(i||a||15));if(d)return Vn.debug("[".concat(this.getTrackId(),"] find closest profile, ").concat(c,"x").concat(u," => ").concat(JSON.stringify(d))),this.setEncoderConfiguration(d)}async setBitrateLimit(e){Vn.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 Vn.error(hi.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const t=this._optimizationMode;try{this._optimizationMode=e,await Pi(this,hd.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=t,Vn.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}Vn.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return Vn.error(hi.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,Vn.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){WO(this._originMediaStreamTrack).then((e=>{let t=EO(e,2),r=t[0],i=t[1];this._videoHeight=i,this._videoWidth=r})).catch(Xi)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}async setSenderConfiguration(e){if(!this._enabled)throw new pi(hi.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");Vn.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(e)),e=ed(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(pd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Pi(this,hd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Vn)}}updateBitrateFromProfile(){if(!this._encoderConfig)return;const e=this.getMediaStreamTrackSettings(),t=e.width,r=e.height,i=e.frameRate;if(!t||!r||!i)return;const n=this._encoderConfig,o=n.bitrateMax,s=n.bitrateMin;if(null==s||null==o){const e=UI(t,r,i,s,o),n=e.max,a=e.min;if(this._encoderConfig.bitrateMin=a,this._encoderConfig.bitrateMax=n,yn("VIDEO_STANDARD_BITRATE_VERSION")&&null==s&&null==o){const e=EO(kI(t,r,i),2),n=e[0],o=e[1];this._encoderConfig.bitrateMax=n,this._encoderConfig.bitrateMin=a?Math.min(a,n):n,this._saveEncodeBitrateRatio=o,Vn.debug("[".concat(this.getTrackId(),"] update new bitrate from profile, [w: ").concat(t,", h: ").concat(r,", fps: ").concat(i,"] => [brMax: ").concat(this._encoderConfig.bitrateMax,", brMin: ").concat(this._encoderConfig.bitrateMin,", save_bitrate_ratio: ").concat(this._saveEncodeBitrateRatio,"]"))}else Vn.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(t,", h: ").concat(r,", fps: ").concat(i,"] => [brMax: ").concat(n,", brMin: ").concat(a,"]")),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},n=i.element,o=i.slot;if(this.isPlaying&&n instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=yi.checkOneElementVisible(n),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=no.reportApiInvoke(null,{tag:Ci.TRACER,name:Ii.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 pi(hi.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}pipe(e){if(this.processor===e)return e;if(e._source)throw new pi(hi.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=Iw(Iw({},i),ed(t))),i=Gi(i);const n=zi(8,"track-video-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,i,Gi(this._scalabilityMode),this._optimizationMode,n,Gi(this._hints));return t&&i&&o.setEncoderConfiguration(i),Vn.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 pi(hi.INVALID_PARAMS,"track should be an instance of MediaStreamTrack");if("video"!==e.kind)throw new pi(hi.INVALID_PARAMS,"track should be a video MediaStreamTrack");await this._updateOriginMediaStreamTrack(e,t,!0),this.updateMediaStreamTrackResolution()}sendSeiData(e){if(Ki((()=>{no.reportApiInvoke(null,{name:Ii.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:Ci.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!yn("ENABLE_VIDEO_SEI")||!yn("ENABLE_ENCODED_TRANSFORM"))return void Vn.warning('To send/receive SEI, please call AgoraRTC.setParameter("ENABLE_VIDEO_SEI", true) before instantiate IAgoraRtcClient');if(e instanceof Uint8Array==!1)return new pi(hi.INVALID_PARAMS,"Invalid argument type, ILocalVideoTrack.sendSeiData() only accept Uint8Array argument.").throw();const t=this.getRTCRtpTransceiver();if(!t)return void Vn.warning("Video track is not published, SEI can not be send");const r=t.sender.getParameters();if(0===r.codecs.length)return;const i=r.codecs[0].mimeType.toLocaleLowerCase();"video/h264"===i||"video/h265"===i?this.safeEmit("sei-to-send",e):Vn.warning("SEI is not supported by ".concat(i))}bindProcessorDestinationEvents(){this.processorDestination.on(Id.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await Pi(this,hd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await Pi(this,hd.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(Id.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(Cd.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(Cd.REQUEST_CONSTRAINTS)}},Hg(mw.prototype,"play",[WC,GC],Object.getOwnPropertyDescriptor(mw.prototype,"play"),mw.prototype),Hg(mw.prototype,"stop",[HC],Object.getOwnPropertyDescriptor(mw.prototype,"stop"),mw.prototype),Hg(mw.prototype,"setEnabled",[KC,YC,ZC],Object.getOwnPropertyDescriptor(mw.prototype,"setEnabled"),mw.prototype),Hg(mw.prototype,"setMuted",[zC,XC,JC],Object.getOwnPropertyDescriptor(mw.prototype,"setMuted"),mw.prototype),Hg(mw.prototype,"setSaveEncodeBitrateRatio",[QC,qC],Object.getOwnPropertyDescriptor(mw.prototype,"setSaveEncodeBitrateRatio"),mw.prototype),Hg(mw.prototype,"setEncoderConfiguration",[$C,ew],Object.getOwnPropertyDescriptor(mw.prototype,"setEncoderConfiguration"),mw.prototype),Hg(mw.prototype,"getStats",[tw],Object.getOwnPropertyDescriptor(mw.prototype,"getStats"),mw.prototype),Hg(mw.prototype,"setBeautyEffect",[rw,iw],Object.getOwnPropertyDescriptor(mw.prototype,"setBeautyEffect"),mw.prototype),Hg(mw.prototype,"getCurrentFrameData",[nw],Object.getOwnPropertyDescriptor(mw.prototype,"getCurrentFrameData"),mw.prototype),Hg(mw.prototype,"getCurrentFrameImage",[ow],Object.getOwnPropertyDescriptor(mw.prototype,"getCurrentFrameImage"),mw.prototype),Hg(mw.prototype,"findClosestProfile",[sw,aw],Object.getOwnPropertyDescriptor(mw.prototype,"findClosestProfile"),mw.prototype),Hg(mw.prototype,"setBitrateLimit",[cw],Object.getOwnPropertyDescriptor(mw.prototype,"setBitrateLimit"),mw.prototype),Hg(mw.prototype,"setOptimizationMode",[uw],Object.getOwnPropertyDescriptor(mw.prototype,"setOptimizationMode"),mw.prototype),Hg(mw.prototype,"setScalabiltyMode",[dw],Object.getOwnPropertyDescriptor(mw.prototype,"setScalabiltyMode"),mw.prototype),Hg(mw.prototype,"updateMediaStreamTrackResolution",[lw],Object.getOwnPropertyDescriptor(mw.prototype,"updateMediaStreamTrackResolution"),mw.prototype),Hg(mw.prototype,"pipe",[hw],Object.getOwnPropertyDescriptor(mw.prototype,"pipe"),mw.prototype),Hg(mw.prototype,"unpipe",[pw],Object.getOwnPropertyDescriptor(mw.prototype,"unpipe"),mw.prototype),Hg(mw.prototype,"close",[fw],Object.getOwnPropertyDescriptor(mw.prototype,"close"),mw.prototype),Hg(mw.prototype,"replaceTrack",[Ew],Object.getOwnPropertyDescriptor(mw.prototype,"replaceTrack"),mw.prototype),mw),ww=(_w=io({argsMap:(e,t)=>[e.getTrackId(),t]}),Tw=bO(),gw=sn("CameraVideoTrack","_enabledMutex"),Sw=io({argsMap:(e,t)=>[e.getTrackId(),t]}),yw=bO(),vw=io({argsMap:(e,t)=>[e.getTrackId(),t]}),Rw=bO(),bw=io({argsMap:e=>[e.getTrackId()]}),Aw=class e extends Cw{get __className__(){return"CameraVideoTrack"}constructor(e,t,r,i,n,o){super(e,ed(t.encoderConfig),i,n,o),IT(this,"_config",void 0),IT(this,"_originalConstraints",void 0),IT(this,"_constraints",void 0),IT(this,"_enabled",!0),IT(this,"_deviceName","default"),IT(this,"tryResumeVideoForIOS15_16WeChat",(async()=>{!qr()&&!$r()||function(){const e=xr();if(e.os!==Pr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()||xr().name!==Lr.WECHAT||!this._enabled||this._isClosed||(Vn.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=ed(this._config.encoderConfig),pA.on(fo.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),pA.on(fo.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(Vn.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await xA.getDeviceById(e),r={};r.video=Iw({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let i=null;try{i=await PA(r,this.getTrackId())}catch(e){throw Vn.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await PA({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(i.getVideoTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(i.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution(),this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw Vn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await xA.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw Vn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Vn.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){Vn.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:Iw(Iw({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await PA(t,this.getTrackId())}catch(t){throw Vn.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await PA({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1),t}await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution()}this._deviceName="",this._config.facingMode=e,this._config.cameraId=void 0,this._constraints=Iw({},t.video),Vn.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Vn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await PA({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await Pi(this,hd.NEED_ENABLE_TRACK,this)}catch(e){throw Vn.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),Vn.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 Pi(this,hd.NEED_DISABLE_TRACK,this)}catch(e){throw Vn.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}Vn.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new pi(hi.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");e=ed(e),yn("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=Wi(this._config);r.encoderConfig=e;const i=GO(r);(Gr()||Yr()||ti())&&(i.deviceId=void 0),Vn.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 pi(hi.UNEXPECTED_ERROR,e.toString());throw Vn.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(pd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Pi(this,hd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Vn)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((Yr()||ti())&&this._enabled&&!this._isClosed&&pA.duringInterruption){const e=async()=>{pA.off(fo.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Vn.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};pA.on(fo.IOS_INTERRUPTION_END,e)}else Vn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Td.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=xA.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await PA({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),pA.off(fo.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),pA.off(fo.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this._encoderConfig;t&&(i=Iw(Iw({},i),ed(t))),i=Gi(i);const n=zi(8,"track-cam-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,Gi(Iw(Iw({},this._config),{},{encoderConfig:i})),Gi(this._constraints),Gi(this._scalabilityMode),this._optimizationMode,n);return t&&i&&o.setEncoderConfiguration(i),Vn.debug("clone track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(r)),o}bindProcessorContextEvents(){this.processorContext.on(Cd.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(Cd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}},Hg(Aw.prototype,"setDevice",[_w,Tw],Object.getOwnPropertyDescriptor(Aw.prototype,"setDevice"),Aw.prototype),Hg(Aw.prototype,"setEnabled",[gw,Sw,yw],Object.getOwnPropertyDescriptor(Aw.prototype,"setEnabled"),Aw.prototype),Hg(Aw.prototype,"setEncoderConfiguration",[vw,Rw],Object.getOwnPropertyDescriptor(Aw.prototype,"setEncoderConfiguration"),Aw.prototype),Hg(Aw.prototype,"close",[bw],Object.getOwnPropertyDescriptor(Aw.prototype,"close"),Aw.prototype),Aw);function Nw(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 Dw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nw(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nw(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Pw(e,t,r,i){r.optimizationMode&&(i&&i.width&&i.height?(r.encoderConfig=Dw(Dw({},i),{},{bitrateMin:i.bitrateMin,bitrateMax:i.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?Vn.debug("[".concat(e,"] set content hint to"),r.optimizationMode):Vn.debug("[".concat(e,"] set content hint failed")))):Vn.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}var Lw,kw,Mw,Uw,xw,Vw,Fw,Bw,jw,Ww,Gw,Hw,Kw;function Yw(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 Zw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yw(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yw(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class zw extends aA{getUserId(){return this._userId}constructor(e,t,r,i){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(i.clientId,"_").concat(zi(5,""))),IT(this,"_userId",void 0),IT(this,"_uintId",void 0),IT(this,"_isDestroyed",!1),IT(this,"store",void 0),IT(this,"processor",void 0),IT(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,Vn.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}let Xw=(Lw=io({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),kw=io({argsMap:e=>[e.getTrackId()]}),Mw=io({argsMap:(e,t)=>[e.getTrackId(),t.name]}),Uw=io({argsMap:e=>[e.getTrackId()]}),xw=class extends zw{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==Dd.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,i,n){super(e,t,r,i),IT(this,"_videoVisibleTimer",null),IT(this,"_previousVideoVisibleStatus",void 0),IT(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),IT(this,"trackMediaType",Sd.VIDEO),IT(this,"_videoWidth",void 0),IT(this,"_videoHeight",void 0),IT(this,"_player",void 0),IT(this,"_prePlayer",void 0),IT(this,"processorDestination",void 0),IT(this,"processorContext",void 0),this._prePlayer=n,this.updateMediaStreamTrackResolution(),this.processorContext=new xO(this.getTrackId(),"remote"),this.processorDestination=new UO(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){Ki((()=>{Vn.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return Li(this,hd.GET_STATS)||Zw({},Od)}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.safeEmit(gd.PLAY_START),"string"==typeof e){const t=document.getElementById(e);t?e=t:(Vn.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Vn.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=Zw(Zw({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});if(this._player)this._player.updateConfig(r);else{let t=!1,i=!1;const n=this._prePlayer&&!this._prePlayer.isDestroyed&&e===this._prePlayer.config.element;this._prePlayer&&!n&&(this._prePlayer.destroy(),i=!0),n?(this._player=this._prePlayer,t=this._player.videoState>0,this._player.updateConfig(r)):this._player=e instanceof HTMLVideoElement?new FC(r):new jC(r),this._prePlayer=void 0,this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(gd.FIRST_FRAME_DECODED),i&&this.safeEmit(gd.FIRST_FRAME_RENDER)},this._player.onVideoStateChanged=e=>{this.safeEmit(gd.VIDEO_STATE_CHANGED,e)},t&&(this._player.onFirstVideoFrameDecoded(),this._player.onVideoStateChanged(this._player.videoState))}this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(gd.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),yn("CHECK_VIDEO_VISIBLE_INTERVAL")),this.safeEmit(gd.PLAY_END)}stop(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(e),this._player=void 0,Vn.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){WO(this._originMediaStreamTrack).then((e=>{let t=EO(e,2),r=t[0],i=t[1];this._videoHeight=i,this._videoWidth=r})).catch(Xi)}_updatePlayerSource(){Vn.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},n=i.element,o=i.slot;if(this.isPlaying&&n instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=yi.checkOneElementVisible(n),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=no.reportApiInvoke(null,{tag:Ci.TRACER,name:Ii.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 pi(hi.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}pipe(e){if(this.processor===e)return e;if(e._source)throw new pi(hi.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(Id.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(Id.ON_TRACK)}_destroy(){this._prePlayer&&(this._prePlayer.destroy(),this._prePlayer=void 0),super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(e){this.emit(_d.SEI_RECEIVED,e)}},Hg(xw.prototype,"play",[Lw],Object.getOwnPropertyDescriptor(xw.prototype,"play"),xw.prototype),Hg(xw.prototype,"stop",[kw],Object.getOwnPropertyDescriptor(xw.prototype,"stop"),xw.prototype),Hg(xw.prototype,"pipe",[Mw],Object.getOwnPropertyDescriptor(xw.prototype,"pipe"),xw.prototype),Hg(xw.prototype,"unpipe",[Uw],Object.getOwnPropertyDescriptor(xw.prototype,"unpipe"),xw.prototype),xw),Jw=(Vw=io({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),Fw=io({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),Bw=io({argsMap:(e,t)=>[e.getTrackId(),t]}),jw=io({argsMap:e=>[e.getTrackId()]}),Ww=io({argsMap:e=>[e.getTrackId()]}),Gw=io({argsMap:(e,t)=>[e.getTrackId(),t.name]}),Hw=io({argsMap:e=>[e.getTrackId()]}),Kw=class extends zw{get isPlaying(){return this._useAudioElement?RO.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(e,t,r,i){super(e,t,r,i),IT(this,"trackMediaType",Sd.AUDIO),IT(this,"_source",void 0),IT(this,"_useAudioElement",!0),IT(this,"_volume",100),IT(this,"processorContext",void 0),IT(this,"processorDestination",void 0),IT(this,"_played",!1),IT(this,"_bypassWebAudio",!1),yn("DISABLE_WEBAUDIO")?(this._source=new BO,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new OA(e,!0),yn("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(yd.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(gd.FIRST_FRAME_DECODED)})),this.processorContext=new FO(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new VO(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(yd.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(yd.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(yd.ON_AUDIO_BUFFER),this._source.on(yd.ON_AUDIO_BUFFER,(t=>e(t)))}setVolume(e){this._volume=e,this._useAudioElement?RO.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}setAmplifiedVolume(e){this._useAudioElement&&this._played&&(RO.stop(this.getTrackId()),this._source.play()),this._useAudioElement=!1,e=Math.min(e,yn("MAX_WEBAUDIO_VOLUME")),this._volume=e,this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!co())throw new pi(hi.NOT_SUPPORTED,"your browser does not support setting the audio output device");await RO.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getVolume(){return this._useAudioElement?RO.getVolume(this.getTrackId()):this._source instanceof OA?this._source.getAudioVolume():0}getStats(){Ki((()=>{Vn.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return Li(this,hd.GET_STATS)||Zw({},Ad)}play(){Vn.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement?(Vn.debug("[".concat(this.getTrackId(),"] use audio element to play")),RO.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):(Vn.debug("[".concat(this.getTrackId(),"] use audio context to play")),this._source.play())}stop(){Vn.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?RO.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];Vn.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&RO.updateTrack(this.getTrackId(),this._mediaStreamTrack)}pipe(e){if(this._bypassWebAudio)throw new pi(hi.NOT_SUPPORTED,"can not pipe extension when WebAudio disabled");if(this.processor===e)return e;if(e._source)throw new pi(hi.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 pi(hi.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(Id.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(Id.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(Id.ON_TRACK),this.processorDestination.removeAllListeners(Id.ON_NODE)}},Hg(Kw.prototype,"setVolume",[Vw],Object.getOwnPropertyDescriptor(Kw.prototype,"setVolume"),Kw.prototype),Hg(Kw.prototype,"setAmplifiedVolume",[Fw],Object.getOwnPropertyDescriptor(Kw.prototype,"setAmplifiedVolume"),Kw.prototype),Hg(Kw.prototype,"setPlaybackDevice",[Bw],Object.getOwnPropertyDescriptor(Kw.prototype,"setPlaybackDevice"),Kw.prototype),Hg(Kw.prototype,"play",[jw],Object.getOwnPropertyDescriptor(Kw.prototype,"play"),Kw.prototype),Hg(Kw.prototype,"stop",[Ww],Object.getOwnPropertyDescriptor(Kw.prototype,"stop"),Kw.prototype),Hg(Kw.prototype,"pipe",[Gw],Object.getOwnPropertyDescriptor(Kw.prototype,"pipe"),Kw.prototype),Hg(Kw.prototype,"unpipe",[Hw],Object.getOwnPropertyDescriptor(Kw.prototype,"unpipe"),Kw.prototype),Kw);const Qw=new class extends Ri{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),IT(this,"_lastHiddenTime",0),IT(this,"_lastVisibleTime",0),IT(this,"needUploadStats",[]),IT(this,"isCollectingStats",!1),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),this.isCollectingStats&&this.needUploadStats.push("visible"===document.visibilityState?1:0),Vn.debug("current web page is ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}startCollectStats(){this.isCollectingStats=!0,this.needUploadStats.push("visible"===this.visibility?1:0)}stopCollectStats(){this.isCollectingStats=!1,this.needUploadStats.length=0}};class qw extends Ri{constructor(e,t){super(),IT(this,"trackMediaType",Sd.DATA),IT(this,"_version",1),IT(this,"_type",3),IT(this,"_config",void 0),IT(this,"_originDataChannel",void 0),IT(this,"_dataStreamPacketHeader",new ArrayBuffer(4)),IT(this,"_dataStreamPacketHandler",{serialize:e=>e,deserialize:e=>e}),IT(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 yn("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 sA(((e,t)=>{if(this._originDataChannel){"open"===this._originDataChannel.readyState&&e();const r=setTimeout((()=>{var e;t(new pi(hi.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 pi(hi.DATACHANNEL_CONNECTION_TIMEOUT)}}else t(new pi(hi.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),[Ld.OPEN,Ld.CLOSE,Ld.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=EO(t,2),i=r[0],n=r[1];e.removeEventListener(i,n)})),this._datachannelEventMap.clear()}}var $w=jc,eN=yo,tN=Jc,rN=RangeError,iN=String.fromCharCode,nN=String.fromCodePoint,oN=eN([].join);$w({target:"String",stat:!0,arity:1,forced:!!nN&&1!==nN.length},{fromCodePoint:function(e){for(var t,r=[],i=arguments.length,n=0;i>n;){if(tN(t=+arguments[n],1114111)!==t)throw new rN(t+" is not a valid code point");r[n++]=t<65536?iN(t):iN(55296+((t-=65536)>>10),t%1024+56320)}return oN(r,"")}});var sN=Eo,aN=Aa("iterator"),cN=!sN((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[aN]||"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})),uN=Vh,dN=jc,lN=bo,hN=hv,pN=ms,fN=Go,EN=yo,mN=Bo,_N=cN,TN=Vh,gN=Bh,SN=function(e,t,r){for(var i in t)r&&r.unsafe&&e[i]?e[i]=t[i]:uN(e,i,t[i],r);return e},yN=dp,vN=Hm,RN=Op,bN=Ry,AN=Vo,ON=la,IN=uc,CN=Cu,wN=Ec,NN=ds,DN=Du,PN=Ah,LN=Jo,kN=NS,MN=RS,UN=g_,xN=Ly,VN=$O,FN=Aa("iterator"),BN="URLSearchParams",jN=BN+"Iterator",WN=RN.set,GN=RN.getterFor(BN),HN=RN.getterFor(jN),KN=hN("fetch"),YN=hN("Request"),ZN=hN("Headers"),zN=YN&&YN.prototype,XN=ZN&&ZN.prototype,JN=lN.TypeError,QN=lN.encodeURIComponent,qN=String.fromCharCode,$N=pN("String","fromCodePoint"),eD=parseInt,tD=EN("".charAt),rD=EN([].join),iD=EN([].push),nD=EN("".replace),oD=EN([].shift),sD=EN([].splice),aD=EN("".split),cD=EN("".slice),uD=EN(/./.exec),dD=/\+/g,lD=/^[0-9a-f]+$/i,hD=function(e,t){var r=cD(e,t,t+2);return uD(lD,r)?eD(r,16):NaN},pD=function(e){for(var t=0,r=128;r>0&&0!=(e&r);r>>=1)t++;return t},fD=function(e){var t=null,r=e.length;switch(r){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 null===t||t>1114111||t>=55296&&t<=57343||t<(r>3?65536:r>2?2048:r>1?128:0)?null:t},ED=function(e){for(var t=(e=nD(e,dD," ")).length,r="",i=0;i<t;){var n=tD(e,i);if("%"===n){if("%"===tD(e,i+1)||i+3>t){r+="%",i++;continue}var o=hD(e,i+1);if(o!=o){r+=n,i++;continue}i+=2;var s=pD(o);if(0===s)n=qN(o);else{if(1===s||s>4){r+="�",i++;continue}for(var a=[o],c=1;c<s&&!(++i+3>t||"%"!==tD(e,i));){var u=hD(e,i+1);if(u!=u||u>191||u<128)break;if(1===c){if(224===o&&u<160)break;if(237===o&&u>159)break;if(240===o&&u<144)break;if(244===o&&u>143)break}iD(a,u),i+=2,c++}if(a.length!==s){r+="�";continue}var d=fD(a);if(null===d){for(var l=0;l<s;l++)r+="�";i++;continue}n=$N(d)}}r+=n,i++}return r},mD=/[!'()~]|%20/g,_D={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},TD=function(e){return _D[e]},gD=function(e){return nD(QN(e),mD,TD)},SD=vN((function(e,t){WN(this,{type:jN,target:GN(e).entries,index:0,kind:t})}),BN,(function(){var e=HN(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,UN(void 0,!0);var i=t[r];switch(e.kind){case"keys":return UN(i.key,!1);case"values":return UN(i.value,!1)}return UN([i.key,i.value],!1)}),!0),yD=function(e){this.entries=[],this.url=null,void 0!==e&&(NN(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===tD(e,0)?cD(e,1):e:DN(e)))};yD.prototype={type:BN,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,s,a,c=this.entries,u=MN(e);if(u)for(r=(t=kN(e,u)).next;!(i=fN(r,t)).done;){if(o=(n=kN(wN(i.value))).next,(s=fN(o,n)).done||(a=fN(o,n)).done||!fN(o,n).done)throw new JN("Expected sequence with length 2");iD(c,{key:DN(s.value),value:DN(a.value)})}else for(var d in e)ON(e,d)&&iD(c,{key:d,value:DN(e[d])})},parseQuery:function(e){if(e)for(var t,r,i=this.entries,n=aD(e,"&"),o=0;o<n.length;)(t=n[o++]).length&&(r=aD(t,"="),iD(i,{key:ED(oD(r)),value:ED(rD(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],iD(r,gD(e.key)+"="+gD(e.value));return rD(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var vD=function(){bN(this,RD);var e=WN(this,new yD(arguments.length>0?arguments[0]:void 0));mN||(this.size=e.entries.length)},RD=vD.prototype;if(SN(RD,{append:function(e,t){var r=GN(this);xN(arguments.length,2),iD(r.entries,{key:DN(e),value:DN(t)}),mN||this.size++,r.updateURL()},delete:function(e){for(var t=GN(this),r=xN(arguments.length,1),i=t.entries,n=DN(e),o=r<2?void 0:arguments[1],s=void 0===o?o:DN(o),a=0;a<i.length;){var c=i[a];c.key!==n||void 0!==s&&c.value!==s?a++:sD(i,a,1)}mN||(this.size=i.length),t.updateURL()},get:function(e){var t=GN(this).entries;xN(arguments.length,1);for(var r=DN(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){var t=GN(this).entries;xN(arguments.length,1);for(var r=DN(e),i=[],n=0;n<t.length;n++)t[n].key===r&&iD(i,t[n].value);return i},has:function(e){for(var t=GN(this).entries,r=xN(arguments.length,1),i=DN(e),n=r<2?void 0:arguments[1],o=void 0===n?n:DN(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=GN(this);xN(arguments.length,2);for(var i,n=r.entries,o=!1,s=DN(e),a=DN(t),c=0;c<n.length;c++)(i=n[c]).key===s&&(o?sD(n,c--,1):(o=!0,i.value=a));o||iD(n,{key:s,value:a}),mN||(this.size=n.length),r.updateURL()},sort:function(){var e=GN(this);VN(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=GN(this).entries,i=IN(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 SD(this,"keys")},values:function(){return new SD(this,"values")},entries:function(){return new SD(this,"entries")}},{enumerable:!0}),TN(RD,FN,RD.entries,{name:"entries"}),TN(RD,"toString",(function(){return GN(this).serialize()}),{enumerable:!0}),mN&&gN(RD,"size",{get:function(){return GN(this).entries.length},configurable:!0,enumerable:!0}),yN(vD,BN),dN({global:!0,constructor:!0,forced:!_N},{URLSearchParams:vD}),!_N&&AN(ZN)){var bD=EN(XN.has),AD=EN(XN.set),OD=function(e){if(NN(e)){var t,r=e.body;if(CN(r)===BN)return t=e.headers?new ZN(e.headers):new ZN,bD(t,"content-type")||AD(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),PN(e,{body:LN(0,DN(r)),headers:LN(0,t)})}return e};if(AN(KN)&&dN({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return KN(e,arguments.length>1?OD(arguments[1]):{})}}),AN(YN)){var ID=function(e){return bN(this,zN),new YN(e,arguments.length>1?OD(arguments[1]):{})};zN.constructor=ID,ID.prototype=zN,dN({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:ID})}}var CD,wD={URLSearchParams:vD,getState:GN},ND=Bo,DD=yo,PD=Go,LD=Eo,kD=eh,MD=Uh,UD=Ho,xD=ca,VD=ts,FD=Object.assign,BD=Object.defineProperty,jD=DD([].concat),WD=!FD||LD((function(){if(ND&&1!==FD({b:1},FD(BD({},"a",{enumerable:!0,get:function(){BD(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!==FD({},e)[r]||kD(FD({},t)).join("")!==i}))?function(e,t){for(var r=xD(e),i=arguments.length,n=1,o=MD.f,s=UD.f;i>n;)for(var a,c=VD(arguments[n++]),u=o?jD(kD(c),o(c)):kD(c),d=u.length,l=0;d>l;)a=u[l++],ND&&!PD(s,c,a)||(r[a]=c[a]);return r}:FD,GD=yo,HD=2147483647,KD=/[^\0-\u007E]/,YD=/[.\u3002\uFF0E\uFF61]/g,ZD="Overflow: input needs wider integers to process",zD=RangeError,XD=GD(YD.exec),JD=Math.floor,QD=String.fromCharCode,qD=GD("".charCodeAt),$D=GD([].join),eP=GD([].push),tP=GD("".replace),rP=GD("".split),iP=GD("".toLowerCase),nP=function(e){return e+22+75*(e<26)},oP=function(e,t,r){var i=0;for(e=r?JD(e/700):e>>1,e+=JD(e/t);e>455;)e=JD(e/35),i+=36;return JD(i+36*e/(e+38))},sP=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=qD(e,r++);if(n>=55296&&n<=56319&&r<i){var o=qD(e,r++);56320==(64512&o)?eP(t,((1023&n)<<10)+(1023&o)+65536):(eP(t,n),r--)}else eP(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&&eP(t,QD(i));var c=t.length,u=c;for(c&&eP(t,"-");u<n;){var d=HD;for(r=0;r<e.length;r++)(i=e[r])>=o&&i<d&&(d=i);var l=u+1;if(d-o>JD((HD-s)/l))throw new zD(ZD);for(s+=(d-o)*l,o=d,r=0;r<e.length;r++){if((i=e[r])<o&&++s>HD)throw new zD(ZD);if(i===o){for(var h=s,p=36;;){var f=p<=a?1:p>=a+26?26:p-a;if(h<f)break;var E=h-f,m=36-f;eP(t,QD(nP(f+E%m))),h=JD(E/m),p+=36}eP(t,QD(nP(h))),a=oP(s,l,u===c),s=0,u++}}s++,o++}return $D(t,"")},aP=jc,cP=Bo,uP=cN,dP=bo,lP=uc,hP=yo,pP=Vh,fP=Bh,EP=Ry,mP=la,_P=WD,TP=lO,gP=Nh,SP=fT.codeAt,yP=function(e){var t,r,i=[],n=rP(tP(iP(e),YD,"."),".");for(t=0;t<n.length;t++)r=n[t],eP(i,XD(KD,r)?"xn--"+sP(r):r);return $D(i,".")},vP=Du,RP=dp,bP=Ly,AP=wD,OP=Op,IP=OP.set,CP=OP.getterFor("URL"),wP=AP.URLSearchParams,NP=AP.getState,DP=dP.URL,PP=dP.TypeError,LP=dP.encodeURIComponent,kP=dP.parseInt,MP=Math.floor,UP=Math.pow,xP=hP("".charAt),VP=hP(/./.exec),FP=hP([].join),BP=hP(1.1.toString),jP=hP([].pop),WP=hP([].push),GP=hP("".replace),HP=hP([].shift),KP=hP("".split),YP=hP("".slice),ZP=hP("".toLowerCase),zP=hP([].unshift),XP="Invalid scheme",JP="Invalid host",QP="Invalid port",qP=/[a-z]/i,$P=/[\d+\-.a-z]/i,eL=/\d/,tL=/^0x/i,rL=/^[0-7]+$/,iL=/^\d+$/,nL=/^[\da-f]+$/i,oL=/[\0\t\n\r #%/:<>?@[\\\]^|]/,sL=/[\0\t\n\r #/:<>?@[\\\]^|]/,aL=/^[\u0000-\u0020]+/,cL=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,uL=/[\t\n\r]/g,dL=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)zP(t,e%256),e=MP(e/256);return FP(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+=BP(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},lL={},hL=_P({},lL,{" ":1,'"':1,"#":1,"<":1,">":1}),pL=_P({},hL,{"'":1}),fL=_P({},lL,{" ":1,'"':1,"<":1,">":1,"`":1}),EL=_P({},fL,{"#":1,"?":1,"{":1,"}":1,"^":1}),mL=_P({},EL,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),_L=function(e,t){var r=SP(e,0);return r>=32&&r<127&&!mP(t,e)?e:"'"===e&&mP(t,e)?"%27":LP(e)},TL={ftp:21,file:null,http:80,https:443,ws:80,wss:443},gL=function(e,t){var r;return 2===e.length&&VP(qP,xP(e,0))&&(":"===(r=xP(e,1))||!t&&"|"===r)},SL=function(e){var t;return e.length>1&&gL(YP(e,0,2))&&(2===e.length||"/"===(t=xP(e,2))||"\\"===t||"?"===t||"#"===t)},yL=function(e){return"."===e||"%2e"===ZP(e)},vL={},RL={},bL={},AL={},OL={},IL={},CL={},wL={},NL={},DL={},PL={},LL={},kL={},ML={},UL={},xL={},VL={},FL={},BL={},jL={},WL={},GL=function(e,t,r){var i,n,o,s=vP(e);if(t){if(n=this.parse(s))throw new PP(n);this.searchParams=null}else{if(void 0!==r&&(i=new GL(r,!0)),n=this.parse(s,null,i))throw new PP(n);(o=NP(new wP)).bindURL(this),this.searchParams=o}};GL.prototype={type:"URL",parse:function(e,t,r){var i,n,o,s,a,c=this,u=t||vL,d=0,l="",h=!1,p=!1,f=!1;for(e=vP(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=GP(e,aL,""),e=GP(e,cL,"$1")),e=GP(e,uL,""),i=TP(e);d<=i.length;){switch(n=i[d],u){case vL:if(!n||!VP(qP,n)){if(t)return XP;u=bL;continue}l+=ZP(n),u=RL;break;case RL:if(n&&VP($P,n))l+=ZP(n);else{if(":"!==n){if(t)return XP;l="",u=bL,d=0;continue}if(t&&(c.isSpecial()!==mP(TL,l)||"file"===l&&(c.includesCredentials()||null!==c.port)||"file"===c.scheme&&""===c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&TL[c.scheme]===c.port&&(c.port=null));l="","file"===c.scheme?u=ML:c.isSpecial()&&r&&r.scheme===c.scheme?u=AL:c.isSpecial()?u=wL:"/"===i[d+1]?(u=OL,d++):(c.cannotBeABaseURL=!0,WP(c.path,""),u=BL)}break;case bL:if(!r||r.cannotBeABaseURL&&"#"!==n)return XP;if(r.cannotBeABaseURL&&"#"===n){c.scheme=r.scheme,c.path=gP(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=WL;break}u="file"===r.scheme?ML:IL;continue;case AL:if("/"!==n||"/"!==i[d+1]){u=IL;continue}u=NL,d++;break;case OL:if("/"===n){u=DL;break}u=FL;continue;case IL:if(c.scheme=r.scheme,n===CD)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=gP(r.path),c.query=r.query;else if("/"===n||"\\"===n&&c.isSpecial())u=CL;else if("?"===n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=gP(r.path),c.query="",u=jL;else{if("#"!==n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=gP(r.path),c.path.length&&c.path.length--,u=FL;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=gP(r.path),c.query=r.query,c.fragment="",u=WL}break;case CL:if(!c.isSpecial()||"/"!==n&&"\\"!==n){if("/"!==n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=FL;continue}u=DL}else u=NL;break;case wL:if(u=NL,"/"!==n||"/"!==i[d+1])continue;d++;break;case NL:if("/"!==n&&"\\"!==n){u=DL;continue}break;case DL:if("@"===n){h&&(l="%40"+l),h=!0,o=TP(l);for(var E=0;E<o.length;E++){var m=o[E];if(":"!==m||f){var _=_L(m,mL);f?c.password+=_:c.username+=_}else f=!0}l=""}else if(n===CD||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()){if(h&&""===l)return"Invalid authority";d-=TP(l).length+1,l="",u=PL}else l+=n;break;case PL:case LL:if(t&&"file"===c.scheme){u=xL;continue}if(":"!==n||p){if(n===CD||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()){if(c.isSpecial()&&""===l)return JP;if(t&&""===l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",u=VL,t)return;continue}"["===n?p=!0:"]"===n&&(p=!1),l+=n}else{if(""===l)return JP;if(t===LL)return;if(s=c.parseHost(l))return s;l="",u=kL}break;case kL:if(!VP(eL,n)){if(n===CD||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()||t){if(""!==l){var T=kP(l,10);if(T>65535)return QP;c.port=c.isSpecial()&&T===TL[c.scheme]?null:T,l=""}if(t)return;u=VL;continue}return QP}l+=n;break;case ML:if(c.scheme="file",c.host="","/"===n||"\\"===n)u=UL;else{if(!r||"file"!==r.scheme){u=FL;continue}switch(n){case CD:c.host=r.host,c.path=gP(r.path),c.query=r.query;break;case"?":c.host=r.host,c.path=gP(r.path),c.query="",u=jL;break;case"#":c.host=r.host,c.path=gP(r.path),c.query=r.query,c.fragment="",u=WL;break;default:c.host=r.host,SL(FP(gP(i,d),""))||(c.path=gP(r.path),c.shortenPath()),u=FL;continue}}break;case UL:if("/"===n||"\\"===n){u=xL;break}r&&"file"===r.scheme&&(c.host=r.host,!SL(FP(gP(i,d),""))&&gL(r.path[0],!0)&&WP(c.path,r.path[0])),u=FL;continue;case xL:if(n===CD||"/"===n||"\\"===n||"?"===n||"#"===n){if(!t&&gL(l))u=FL;else if(""===l){if(c.host="",t)return;u=VL}else{if(s=c.parseHost(l))return s;if("localhost"===c.host&&(c.host=""),t)return;l="",u=VL}continue}l+=n;break;case VL:if(c.isSpecial()){if(u=FL,"/"!==n&&"\\"!==n)continue}else if(t||"?"!==n)if(t||"#"!==n){if(n!==CD&&(u=FL,"/"!==n))continue}else c.fragment="",u=WL;else c.query="",u=jL;break;case FL:if(n===CD||"/"===n||"\\"===n&&c.isSpecial()||!t&&("?"===n||"#"===n)){if(".."===(a=ZP(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"===n||"\\"===n&&c.isSpecial()||WP(c.path,"")):yL(l)?"/"===n||"\\"===n&&c.isSpecial()||WP(c.path,""):("file"===c.scheme&&!c.path.length&&gL(l)&&(null!==c.host&&""!==c.host&&(c.host=""),l=xP(l,0)+":"),WP(c.path,l)),l="","file"===c.scheme&&(n===CD||"?"===n||"#"===n))for(;c.path.length>1&&""===c.path[0];)HP(c.path);"?"===n?(c.query="",u=jL):"#"===n&&(c.fragment="",u=WL)}else l+=_L(n,EL);break;case BL:"?"===n?(c.query="",u=jL):"#"===n?(c.fragment="",u=WL):n!==CD&&(c.path[0]+=_L(n,lL));break;case jL:t||"#"!==n?n!==CD&&(c.query+=_L(n,c.isSpecial()?pL:hL)):(c.fragment="",u=WL);break;case WL:n!==CD&&(c.fragment+=_L(n,fL))}d++}},parseHost:function(e){var t,r,i;if("["===xP(e,0)){if("]"!==xP(e,e.length-1))return JP;if(t=function(e){var t,r,i,n,o,s,a,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return xP(e,l)};if(":"===h()){if(":"!==xP(e,1))return;l+=2,d=++u}for(;h();){if(8===u)return;if(":"!==h()){for(t=r=0;r<4&&VP(nL,h());)t=16*t+kP(h(),16),l++,r++;if("."===h()){if(0===r)return;if(l-=r,u>6)return;for(i=0;h();){if(n=null,i>0){if(!("."===h()&&i<4))return;l++}if(!VP(eL,h()))return;for(;VP(eL,h());){if(o=kP(h(),10),null===n)n=o;else{if(0===n)return;n=10*n+o}if(n>255)return;l++}c[u]=256*c[u]+n,2!=++i&&4!==i||u++}if(4!==i)return;break}if(":"===h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(s=u-d,u=7;0!==u&&s>0;)a=c[u],c[u--]=c[d+s-1],c[d+--s]=a;else if(8!==u)return;return c}(YP(e,1,-1)),!t)return JP;this.host=t}else if(this.isSpecial()){if(e=yP(e),VP(oL,e))return JP;if(function(e){var t,r,i=KP(e,".");if(""===i[i.length-1]){if(1===i.length)return!1;i.length--}return t=i[i.length-1],!!VP(iL,t)||!!VP(tL,t)&&(""===(r=YP(t,2))||!!VP(nL,r))}(e)){if(t=function(e){var t,r,i,n,o,s,a,c=KP(e,".");if(c.length&&""===c[c.length-1]&&c.length--,(t=c.length)>4)return null;for(r=[],i=0;i<t;i++){if(""===(n=c[i]))return null;if(o=10,n.length>1&&"0"===xP(n,0)&&(o=VP(tL,n)?16:8,n=YP(n,8===o?1:2)),""===n)s=0;else{if(!VP(10===o?iL:8===o?rL:nL,n))return null;s=kP(n,o)}WP(r,s)}for(i=0;i<t;i++)if(s=r[i],i===t-1){if(s>=UP(256,5-t))return null}else if(s>255)return null;for(a=jP(r),i=0;i<r.length;i++)a+=r[i]*UP(256,3-i);return a}(e),null===t)return JP;this.host=t}else this.host=e}else{if(VP(sL,e))return JP;for(t="",r=TP(e),i=0;i<r.length;i++)t+=_L(r[i],lL);this.host=t}},cannotHaveUsernamePasswordPort:function(){return null===this.host||""===this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return mP(TL,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&gL(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,u=t+":";return null!==n?(u+="//",e.includesCredentials()&&(u+=r+(i?":"+i:"")+"@"),u+=dL(n),null!==o&&(u+=":"+o)):"file"===t&&(u+="//"),null===n&&!e.cannotBeABaseURL&&s.length>1&&""===s[0]&&(u+="/."),u+=e.cannotBeABaseURL?s[0]:s.length?"/"+FP(s,"/"):"",null!==a&&(u+="?"+a),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw new PP(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new HL(this.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+dL(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(vP(e)+":",vL)},getUsername:function(){return this.username},setUsername:function(e){var t=TP(vP(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=_L(t[r],mL)}},getPassword:function(){return this.password},setPassword:function(e){var t=TP(vP(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=_L(t[r],mL)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?dL(e):dL(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,PL)},getHostname:function(){var e=this.host;return null===e?"":dL(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,LL)},getPort:function(){var e=this.port;return null===e?"":vP(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=vP(e))?this.port=null:this.parse(e,kL))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+FP(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,VL))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=vP(e))?this.query=null:("?"===xP(e,0)&&(e=YP(e,1)),this.query="",this.parse(e,jL)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=vP(e))?("#"===xP(e,0)&&(e=YP(e,1)),this.fragment="",this.parse(e,WL)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var HL=function(e){var t=EP(this,KL),r=bP(arguments.length,1)>1?arguments[1]:void 0,i=IP(t,new GL(e,!1,r));cP||(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())},KL=HL.prototype,YL=function(e,t){return{get:function(){return CP(this)[e]()},set:t&&function(e){return CP(this)[t](e)},configurable:!0,enumerable:!0}};if(cP&&(fP(KL,"href",YL("serialize","setHref")),fP(KL,"origin",YL("getOrigin")),fP(KL,"protocol",YL("getProtocol","setProtocol")),fP(KL,"username",YL("getUsername","setUsername")),fP(KL,"password",YL("getPassword","setPassword")),fP(KL,"host",YL("getHost","setHost")),fP(KL,"hostname",YL("getHostname","setHostname")),fP(KL,"port",YL("getPort","setPort")),fP(KL,"pathname",YL("getPathname","setPathname")),fP(KL,"search",YL("getSearch","setSearch")),fP(KL,"searchParams",YL("getSearchParams")),fP(KL,"hash",YL("getHash","setHash"))),pP(KL,"toJSON",(function(){return CP(this).serialize()}),{enumerable:!0}),pP(KL,"toString",(function(){return CP(this).serialize()}),{enumerable:!0}),DP){var ZL=DP.createObjectURL,zL=DP.revokeObjectURL;ZL&&pP(HL,"createObjectURL",lP(ZL,DP)),zL&&pP(HL,"revokeObjectURL",lP(zL,DP))}RP(HL,"URL"),aP({global:!0,constructor:!0,forced:!uP,sham:!cP},{URL:HL});var XL=jc,JL=Eo,QL=Ly,qL=Du,$L=cN,ek=ms("URL"),tk=$L&&JL((function(){ek.canParse()})),rk=JL((function(){return 1!==ek.canParse.length}));XL({target:"URL",stat:!0,forced:!tk||rk},{canParse:function(e){var t=QL(arguments.length,1),r=qL(e),i=t<2||void 0===arguments[1]?void 0:qL(arguments[1]);try{return!!new ek(r,i)}catch(e){return!1}}});var ik=jc,nk=Ly,ok=Du,sk=cN,ak=ms("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=X(ls.URL);function uk(){const e=new Blob([atob("ZnVuY3Rpb24gdCh0LGUsbil7cmV0dXJuKGU9ZnVuY3Rpb24odCl7dmFyIGU9ZnVuY3Rpb24odCxlKXtpZigib2JqZWN0IiE9dHlwZW9mIHR8fCF0KXJldHVybiB0O3ZhciBuPXRbU3ltYm9sLnRvUHJpbWl0aXZlXTtpZih2b2lkIDAhPT1uKXt2YXIgcj1uLmNhbGwodCxlfHwiZGVmYXVsdCIpO2lmKCJvYmplY3QiIT10eXBlb2YgcilyZXR1cm4gcjt0aHJvdyBuZXcgVHlwZUVycm9yKCJAQHRvUHJpbWl0aXZlIG11c3QgcmV0dXJuIGEgcHJpbWl0aXZlIHZhbHVlLiIpfXJldHVybigic3RyaW5nIj09PWU/U3RyaW5nOk51bWJlcikodCl9KHQsInN0cmluZyIpO3JldHVybiJzeW1ib2wiPT10eXBlb2YgZT9lOmUrIiJ9KGUpKWluIHQ/T2JqZWN0LmRlZmluZVByb3BlcnR5KHQsZSx7dmFsdWU6bixlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMCx3cml0YWJsZTohMH0pOnRbZV09bix0fWZ1bmN0aW9uIGUodCxlKXt2YXIgbj1PYmplY3Qua2V5cyh0KTtpZihPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgcj1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKHQpO2UmJihyPXIuZmlsdGVyKChmdW5jdGlvbihlKXtyZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LGUpLmVudW1lcmFibGV9KSkpLG4ucHVzaC5hcHBseShuLHIpfXJldHVybiBufWNvbnN0IG49InZpZGVvL2gyNjQiLHI9InZpZGVvL2gyNjUiO2Z1bmN0aW9uIGEodCxlLG4pe2xldCByPW5ldyBVaW50OEFycmF5KHQsZSxuKSxhPVtdLG89MDtmb3IoO2EubGVuZ3RoPG47KW8rMzxuJiYwPT09cltvXSYmMD09PXJbbysxXSYmMz09PXJbbysyXSYmKDA9PT1yW28rM118fDE9PT1yW28rM118fDI9PT1yW28rM118fDM9PT1yW28rM10pPyhhLnB1c2gocltvXSxyW28rMV0scltvKzNdKSxvKz00KTooYS5wdXNoKHJbb10pLG8rKyk7cmV0dXJuIG5ldyBVaW50OEFycmF5KGEpfWZ1bmN0aW9uIG8odCxlKXtzd2l0Y2goZSl7Y2FzZSBuOnJldHVybiBmdW5jdGlvbih0KXtjb25zdCBlPW5ldyBEYXRhVmlldyh0LmRhdGEpO2xldCBuPTA7Zm9yKDtuKzQ8dC5kYXRhLmJ5dGVMZW5ndGg7KXtpZigwPT09ZS5nZXRVaW50OChuKzApJiYwPT09ZS5nZXRVaW50OChuKzEpJiYwPT09ZS5nZXRVaW50OChuKzIpJiYxPT09ZS5nZXRVaW50OChuKzMpJiY2PT09ZS5nZXRVaW50OChuKzQpKXtsZXQgcj1uKzYsbz0wLGk9MDtmb3IoOzI1NT09PShpPWUuZ2V0VWludDgocisrKSk7KW8rPTI1NTtvKz1pO2NvbnN0IHM9YSh0LmRhdGEscixvKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkocyl9bisrfXJldHVybiBudWxsfSh0KTtjYXNlIHI6cmV0dXJuIGZ1bmN0aW9uKHQpe2NvbnN0IGU9bmV3IERhdGFWaWV3KHQuZGF0YSk7bGV0IG49MDtmb3IoO24rNTx0LmRhdGEuYnl0ZUxlbmd0aDspe2lmKDA9PT1lLmdldFVpbnQ4KG4rMCkmJjA9PT1lLmdldFVpbnQ4KG4rMSkmJjA9PT1lLmdldFVpbnQ4KG4rMikmJjE9PT1lLmdldFVpbnQ4KG4rMykmJjc4PT09ZS5nZXRVaW50OChuKzQpJiYxPT09ZS5nZXRVaW50OChuKzUpJiYxMDE9PT1lLmdldFVpbnQ4KG4rNikpe2xldCByPW4rNyxvPTAsaT0wO2Zvcig7MjU1PT09KGk9ZS5nZXRVaW50OChyKyspKTspbys9MjU1O28rPWk7Y29uc3Qgcz1hKHQuZGF0YSxyLG8pO3JldHVybiBuZXcgVWludDhBcnJheShzKX1uKyt9cmV0dXJuIG51bGx9KHQpO2RlZmF1bHQ6cmV0dXJuIG51bGx9fWZ1bmN0aW9uIGkodCl7Y29uc3QgZT10Lmxlbmd0aDtsZXQgbj1bXSxyPTA7Zm9yKDtyPGU7KXIrMjxlJiYwPT09dFtyXSYmMD09PXRbcisxXSYmKDA9PT10W3IrMl18fDE9PT10W3IrMl18fDI9PT10W3IrMl18fDM9PT10W3IrMl0pPyhuLnB1c2godFtyXSx0W3IrMV0sMyx0W3IrMl0pLHIrPTMpOihuLnB1c2godFtyXSkscisrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkobil9ZnVuY3Rpb24gcyh0LGUsYSl7c3dpdGNoKGEpe2Nhc2UgbjpyZXR1cm4gZnVuY3Rpb24odCxlKXtjb25zdCBuPWkoZSkscj1uLmxlbmd0aCxhPU1hdGguZmxvb3Ioci8yNTUpLG89ciUyNTUscz1uZXcgVWludDhBcnJheSg2K2ErMStyK3QuYnl0ZUxlbmd0aCk7c1swXT0wLHNbMV09MCxzWzJdPTAsc1szXT0xLHNbNF09NixzWzVdPTEwMTtsZXQgZj0wO2Zvcig7ZjxhOylzWzYrZl09MjU1LGYrKztyZXR1cm4gc1s2K2ZdPW8sZisrLHMuc2V0KG4sNitmKSxzLnNldChuZXcgVWludDhBcnJheSh0KSw2K2Yrcikscy5idWZmZXJ9KHQsZSk7Y2FzZSByOnJldHVybiBmdW5jdGlvbih0LGUpe2NvbnN0IG49aShlKSxyPW4ubGVuZ3RoLGE9TWF0aC5mbG9vcihyLzI1NSksbz1yJTI1NSxzPW5ldyBVaW50OEFycmF5KDcrYSsxK3IrMSt0LmJ5dGVMZW5ndGgpO3NbMF09MCxzWzFdPTAsc1syXT0wLHNbM109MSxzWzRdPTc4LHNbNV09MSxzWzZdPTEwMTtsZXQgZj0wO2Zvcig7ZjxhOylzWzcrZl09MjU1LGYrKztyZXR1cm4gc1s3K2ZdPW8sZisrLHMuc2V0KG4sNytmKSxmKz1yLHNbNytmXT0xMjgsZisrLHMuc2V0KG5ldyBVaW50OEFycmF5KHQpLDcrZikscy5idWZmZXJ9KHQsZSk7ZGVmYXVsdDpyZXR1cm4gbnVsbH19ZnVuY3Rpb24gZih0KXtpZih0Lmxlbmd0aDw1KXJldHVybiIiO2xldCBlPS0xO2ZvcihsZXQgbj0wO248dC5sZW5ndGgtMztuKyspe2lmKDA9PT10W25dJiYwPT09dFtuKzFdJiYxPT09dFtuKzJdKXtlPW47YnJlYWt9aWYobjx0Lmxlbmd0aC00JiYwPT09dFtuXSYmMD09PXRbbisxXSYmMD09PXRbbisyXSYmMT09PXRbbiszXSl7ZT1uO2JyZWFrfX1pZigtMT09PWUpcmV0dXJuIiI7Y29uc3QgYT1lKygwPT09dFtlKzJdPzQ6Myk7aWYoYT49dC5sZW5ndGgpcmV0dXJuIiI7Y29uc3Qgbz10W2FdO2lmKDEyOCZvKXJldHVybiIiO2lmKChvPj4xJjYzKT49MzIpcmV0dXJuIHI7aWYoYSsxPHQubGVuZ3RoKXtpZigwPT0oMjQ4JnRbYSsxXSkpcmV0dXJuIHJ9cmV0dXJuKDMxJm8pPD0zMT9uOiIifWNvbnN0IGw9NzEsdT0xLGM9MixnPTEscD0yO3ZhciBkPWZ1bmN0aW9uKHQpe3JldHVybiB0W3QuQVVESU9fTEVWRUw9MV09IkFVRElPX0xFVkVMIix0W3QuTUVUQURBVEE9Ml09Ik1FVEFEQVRBIix0W3QuQVVESU9fNjRfQklUX1BUUz0zXT0iQVVESU9fNjRfQklUX1BUUyIsdH0oZHx8e30pO2Z1bmN0aW9uIGgodCl7bGV0IGU9YXJndW1lbnRzLmxlbmd0aD4xJiZ2b2lkIDAhPT1hcmd1bWVudHNbMV0mJmFyZ3VtZW50c1sxXTtjb25zdCBuPXQuZ2V0VWludDgoMCk7aWYobiE9PWwpcmV0dXJuO2NvbnN0IHI9dC5nZXRVaW50MTYoMSksYT11K2MrcixvPW5ldyBVaW50OEFycmF5KHQuYnl0ZUxlbmd0aC1hKTtvLnNldChuZXcgVWludDhBcnJheSh0LmJ1ZmZlcixhLHQuYnl0ZUxlbmd0aC1hKSk7Y29uc3QgaT17bTpuLHRsdkxlbjpyLHRsdjpbXSxmcmFtZTpvfTtsZXQgcz11K2M7Zm9yKDtzPGE7KXtjb25zdCBuPXQuZ2V0VWludDgocykscj10LmdldFVpbnQxNihzK2cpLGE9ZytwO2lmKG49PT1kLkFVRElPX0xFVkVMKXtsZXQgbz10LmdldFVpbnQ4KHMrYSk7Zm9yKGxldCBlPTE7ZTxyO2UrKylvPW88PDh8dC5nZXRVaW50OChzK2ErZSk7aS50bHYucHVzaCh7dGFnOm4sbGVuZ3RoOnIsdmFsdWU6ZT8xMjdebz4+MToxMjcmb30pfWVsc2UgaWYobj09PWQuTUVUQURBVEF8fG49PT1kLkFVRElPXzY0X0JJVF9QVFMpe2NvbnN0IGU9bmV3IFVpbnQ4QXJyYXkocik7Zm9yKGxldCBuPTA7bjxyO24rKyllW25dPXQuZ2V0VWludDgocythK24pO2kudGx2LnB1c2goe3RhZzpuLGxlbmd0aDpyLHZhbHVlOmV9KX1zKz1hK3J9cmV0dXJuIGl9c2VsZi5vbnJ0Y3RyYW5zZm9ybT1uPT57Y29uc3Qgcj1uLnRyYW5zZm9ybWVyLGE9W10saT1bXTtsZXQgeT1udWxsO3Iub3B0aW9ucy5wb3J0Lm9ubWVzc2FnZT10PT57dC5kYXRhLnNlaSYmYS5wdXNoKHQuZGF0YS5zZWkpLHQuZGF0YS5tZXRhZGF0YSYmaS5wdXNoKHQuZGF0YS5tZXRhZGF0YSl9LHNlbGYucG9zdE1lc3NhZ2UoInN0YXJ0ZWQiKTtjb25zdCBVPXIucmVhZGFibGUuZ2V0UmVhZGVyKCksYj1yLndyaXRhYmxlLmdldFdyaXRlcigpOyJzZWktcngiPT09ci5vcHRpb25zLm5hbWU/ZnVuY3Rpb24gbihyKXtVLnJlYWQoKS50aGVuKChhPT57aWYoIWEuZG9uZSl7aWYoYS52YWx1ZSBpbnN0YW5jZW9mIFJUQ0VuY29kZWRWaWRlb0ZyYW1lKXtjb25zdCBuPWYobmV3IFVpbnQ4QXJyYXkoYS52YWx1ZS5kYXRhKSksaT1vKGEudmFsdWUsbik7aWYoaSYmci5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3NlaTppfSksIXkpe2NvbnN0IG49YS52YWx1ZS5nZXRNZXRhZGF0YSgpfHx7fTt5PWZ1bmN0aW9uKG4pe2Zvcih2YXIgcj0xO3I8YXJndW1lbnRzLmxlbmd0aDtyKyspe3ZhciBhPW51bGwhPWFyZ3VtZW50c1tyXT9hcmd1bWVudHNbcl06e307ciUyP2UoT2JqZWN0KGEpLCEwKS5mb3JFYWNoKChmdW5jdGlvbihlKXt0KG4sZSxhW2VdKX0pKTpPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycz9PYmplY3QuZGVmaW5lUHJvcGVydGllcyhuLE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKGEpKTplKE9iamVjdChhKSkuZm9yRWFjaCgoZnVuY3Rpb24odCl7T2JqZWN0LmRlZmluZVByb3BlcnR5KG4sdCxPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGEsdCkpfSkpfXJldHVybiBufSh7dHlwZTphLnZhbHVlLnR5cGUscnRwVGltZXN0YW1wOmEudmFsdWUudGltZXN0YW1wLHBheWxvYWRUeXBlOm4ucGF5bG9hZFR5cGV8fDAsc3NyYzpuLnN5bmNocm9uaXphdGlvblNvdXJjZXx8MCxsZW5ndGg6YS52YWx1ZS5kYXRhLmJ5dGVMZW5ndGh9LCJtaW1lVHlwZSJpbiBuP3ttaW1lVHlwZTpuLm1pbWVUeXBlfTp7fSksci5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe2ZpcnN0RnJhbWVJbmZvOnl9KX19Yi53cml0ZShhLnZhbHVlKSxyLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSxuKHIpfX0pKX0ocik6InNlaS10eCI9PT1yLm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KGUpe1UucmVhZCgpLnRoZW4oKG49PntpZighbi5kb25lKXtpZihuLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IHQ9ZihuZXcgVWludDhBcnJheShuLnZhbHVlLmRhdGEpKSxlPWEuc2hpZnQoKTtpZihlKXtjb25zdCByPXMobi52YWx1ZS5kYXRhLGUsdCk7ciYmKG4udmFsdWUuZGF0YT1yKX19Yi53cml0ZShuLnZhbHVlKSxlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSx0KGUpfX0pKX0ocik6ImF1ZGlvLW1ldGFkYXRhLXJ4Ij09PXIub3B0aW9ucy5uYW1lP2Z1bmN0aW9uIHQoZSl7VS5yZWFkKCkudGhlbigobj0+e2lmKCFuLmRvbmUpe2lmKG4udmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkQXVkaW9GcmFtZSl7Y29uc3QgdD1uZXcgRGF0YVZpZXcobi52YWx1ZS5kYXRhKSxyPXQuZ2V0VWludDgoMCk7bGV0IGE7aWYoMCE9KDEyOCZyKSYmNzEhPT1yKXtjb25zdCBlPWZ1bmN0aW9uKHQpe2lmKHQuYnl0ZUxlbmd0aDw9MClyZXR1cm5bXTtjb25zdCBlPVtdO2xldCBuPTA7Zm9yKDtuPHQuYnl0ZUxlbmd0aDspe2NvbnN0IHI9KDEyOCZ0LmdldFVpbnQ4KG4pKT4+NyxhPTEyNyZ0LmdldFVpbnQ4KG4pO2lmKCEociYmbis0PD10LmJ5dGVMZW5ndGgpKXtuKys7YnJlYWt9e2NvbnN0IHI9dC5nZXRVaW50MzIobiwhMSksbz0oMTY3NzYxOTImcik+PjEwLGk9MTAyMyZyO2UucHVzaCh7cHQ6YSx0c19vZmZzZXQ6byxsZW5ndGg6aSxkYXRhOm5ldyBVaW50OEFycmF5fSksbis9NH19bGV0IHI9dC5ieXRlTGVuZ3RoLW47Zm9yKGNvbnN0IGEgb2YgZSl7aWYoYS5sZW5ndGg+cilyZXR1cm4gY29uc29sZS53YXJuKCJCcm9rZW4gcmVkIHBheWxvYWQiKSxbXTthLmxlbmd0aD4wJiYoYS5kYXRhPW5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHQuYnl0ZU9mZnNldCtuLGEubGVuZ3RoKSxuKz1hLmxlbmd0aCxyLT1hLmxlbmd0aCl9aWYocj4wKXtjb25zdCBhPXtwdDplLmxlbmd0aD4wP2VbZS5sZW5ndGgtMV0ucHQ6MCx0c19vZmZzZXQ6MCxsZW5ndGg6cixkYXRhOm5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHQuYnl0ZU9mZnNldCtuLHIpfTtlLnB1c2goYSl9cmV0dXJuIGV9KHQpO2lmKGUubGVuZ3RoPjApe2NvbnN0IHQ9ZnVuY3Rpb24odCl7bGV0IGU9MDtmb3IobGV0IG49MDtuPHQubGVuZ3RoO24rKyllKz1uPHQubGVuZ3RoLTE/NDoxLGUrPXRbbl0ubGVuZ3RoO2NvbnN0IG49bmV3IFVpbnQ4QXJyYXkoZSk7bGV0IHI9MDtmb3IobGV0IGU9MDtlPHQubGVuZ3RoO2UrKylpZihlPHQubGVuZ3RoLTEpe2NvbnN0IGE9KDIxNDc0ODM2NDh8KDEyNyZ0W2VdLnB0KTw8MjR8KDI2MjE0MyZ0W2VdLnRzX29mZnNldCk8PDEwfDEwMjMmdFtlXS5sZW5ndGgpPj4+MDtuW3IrK109YT4+MjQmMjU1LG5bcisrXT1hPj4xNiYyNTUsbltyKytdPWE+PjgmMjU1LG5bcisrXT0yNTUmYX1lbHNlIG5bcisrXT0xMjcmdFtlXS5wdDtmb3IoY29uc3QgZSBvZiB0KW4uc2V0KGUuZGF0YSxyKSxyKz1lLmxlbmd0aDtyZXR1cm4gbn0oZS5tYXAoKHQ9Pntjb25zdCBlPW5ldyBVaW50OEFycmF5KHQubGVuZ3RoKTtlLnNldCh0LmRhdGEpO2NvbnN0IG49aChuZXcgRGF0YVZpZXcoZS5idWZmZXIpKTtyZXR1cm4gbnVsbCE9biYmbi5mcmFtZSYmKHQuZGF0YT1udWxsPT1uP3ZvaWQgMDpuLmZyYW1lKSxhPW4sdH0pKSk7bi52YWx1ZS5kYXRhPXQuYnVmZmVyfX1lbHNlIGE9aCh0KSxhJiYobi52YWx1ZS5kYXRhPWEuZnJhbWUuYnVmZmVyKTtpZihhKXtsZXQgdD1hLnRsdi5maW5kKCh0PT50LnRhZz09PWQuTUVUQURBVEEpKTtpZih0JiZ0LnZhbHVlIGluc3RhbmNlb2YgVWludDhBcnJheSYmZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe21ldGFkYXRhOnQudmFsdWV9KSx0PWEudGx2LmZpbmQoKHQ9PnQudGFnPT09ZC5BVURJT182NF9CSVRfUFRTKSksdCYmdC52YWx1ZSBpbnN0YW5jZW9mIFVpbnQ4QXJyYXkmJjg9PXQudmFsdWUubGVuZ3RoKXtjb25zdCBuPW5ldyBEYXRhVmlldyh0LnZhbHVlLmJ1ZmZlcikuZ2V0QmlnVWludDY0KDAsITApO3QmJnQudmFsdWUgaW5zdGFuY2VvZiBVaW50OEFycmF5JiZlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7cHRzOm59KX19fWIud3JpdGUobi52YWx1ZSksZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3RyYW5zZm9ybWVkOiEwfSksdChlKX19KSl9KHIpOiJhdWRpby1tZXRhZGF0YS10eCI9PT1yLm9wdGlvbnMubmFtZSYmZnVuY3Rpb24gdChlKXtVLnJlYWQoKS50aGVuKChuPT57aWYoIW4uZG9uZSl7aWYoZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe2dldE1ldGFkYXRhOiEwfSksbi52YWx1ZSBpbnN0YW5jZW9mIFJUQ0VuY29kZWRBdWRpb0ZyYW1lKXtjb25zdCB0PWkuc2hpZnQoKTt0JiYobi52YWx1ZS5kYXRhPWZ1bmN0aW9uKHQsZSxuKXtjb25zdCByPW4uYnl0ZUxlbmd0aCxhPXIrZytwLG89dStjK2EsaT1uZXcgQXJyYXlCdWZmZXIodC5ieXRlTGVuZ3RoK28pLHM9bmV3IERhdGFWaWV3KGkpO3Muc2V0VWludDgoMCxsKSxzLnNldFVpbnQxNigxLGEpLHMuc2V0VWludDgoMyxlKSxzLnNldFVpbnQxNig0LHIpO2ZvcihsZXQgdD0wO3Q8cjt0Kyspcy5zZXRVaW50OCg2K3Qsblt0XSk7Y29uc3QgZj1uZXcgVWludDhBcnJheShzLmJ1ZmZlcik7cmV0dXJuIGYuc2V0KG5ldyBVaW50OEFycmF5KHQpLG8pLGYuYnVmZmVyfShuLnZhbHVlLmRhdGEsZC5BVURJT182NF9CSVRfUFRTLHQpKX1iLndyaXRlKG4udmFsdWUpLGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQoZSl9fSkpfShyKX0sc2VsZi5wb3N0TWVzc2FnZSgicmVnaXN0ZXJlZCIpOwo=")],{type:"text/javascript"});return setTimeout((()=>ck.revokeObjectURL(e)),0),new Worker(ck.createObjectURL(e))}const dk=71,lk=1,hk=2,pk=1,fk=2;var Ek=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}(Ek||{});function mk(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=e.getUint8(0);if(r!==dk)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===Ek.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===Ek.METADATA||r===Ek.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 r=t.chunk,i=t.controller,n=Ek.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,dk),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=X(yg);const Sk=127,yk=1e-10,vk=139/13;const Rk=new Map;function bk(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<yk&&(n=yk),n}function Ak(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){IT(this,"id",void 0),IT(this,"immediates",[]),IT(this,"lastNonSilence",-1),IT(this,"immediateSpeechActivityScore",yk),IT(this,"lastLevelChangedTime",Date.now()),IT(this,"levels",[]),IT(this,"longs",[]),IT(this,"longSpeechActivityScore",yk),IT(this,"mediums",[]),IT(this,"mediumSpeechActivityScore",yk),IT(this,"minLevel",0),IT(this,"nextMinLevel",0),IT(this,"nextMinLevelWindowLength",0),IT(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+vk;let i=!1;for(let n=0;n<e.length;++n){let o=t[n];o<r&&(o=0);const s=Math.floor(o/vk);e[n]!==s&&(e[n]=s,i=!0)}return i}computeLongs(){return Ak(this.mediums,this.longs,4)}computeMediums(){return Ak(this.immediates,this.mediums,7)}evaluateImmediateSpeechActivityScore(){this.immediateSpeechActivityScore=bk(this.immediates[0],13,.78)}evaluateLongSpeechActivityScore(e){this.longSpeechActivityScore=bk(this.longs[0],10,47),this.longSpeechActivityScore>yk&&(this.lastNonSilence=e)}evaluateMediumSpeechActivityScore(){this.mediumSpeechActivityScore=bk(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+vk?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){IT(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){IT(this,"isDominant",void 0),IT(this,"energyRanking",void 0),IT(this,"energyScore",void 0),this.isDominant=e,this.energyRanking=t,this.energyScore=r}}class Nk extends Ri{constructor(e){super(),IT(this,"dominantId",null),IT(this,"lastDecisionTime",0),IT(this,"lastLevelChangedTime",0),IT(this,"lastLevelIdleTime",0),IT(this,"relativeSpeechActivities",[]),IT(this,"speakers",new Map),IT(this,"enableSilence",!1),IT(this,"timeoutToSilenceInterval",0),IT(this,"decisionMaker",null),IT(this,"loudest",[]),IT(this,"numLoudestToTrack",3),IT(this,"energyExpireTimeMs",250),IT(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=LO(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=EO(o,2),a=s[0],c=s[1];if(c===t)continue;c.evaluateSpeechActivityScores(e);for(let e=0;e<r.length;++e){const i=null==t?yk:t.getSpeechActivityScore(e);r[e]=Math.log(c.getSpeechActivityScore(e)/i)}const u=r[0],d=r[1],l=r[2];u>3&&d>2&&l>0&&d>i&&(i=d,n=a)}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 LO(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 Pk=null,Lk=null;const kk=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),Pk||(Pk=new Nk(yn("TOPN_SILENCE_THRESHOLD")||500),Pk.on("ActiveSpeakerChanged",(e=>{null!=e&&(Lk=e)}))),Pk.addSpeakers([t]),t}(e)),Dk.size<=kk)return{selected:!0,speaker:r};if(!Pk)throw new Error("no active speaker detector");Pk.levelChanged(r.id,t),Mk=Pk.loudest.map((e=>e.id)),Lk&&!Yu(Mk).call(Mk,Lk)&&Mk.length>=kk&&Mk.pop();return{selected:Yu(Mk).call(Mk,r.id)||r.id===Lk,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){IT(this,"id",void 0),IT(this,"track",void 0),IT(this,"score",0),IT(this,"active",!0),IT(this,"muted",!1),IT(this,"timer",0),IT(this,"actives",0),IT(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 t=function(){const e=[],t=[];return Array.from(LO(Fk).call(Fk)).forEach((r=>{r.active?e.push(r):t.push(r)})),{actives:e,inactives:t}}(),r=t.actives,i=t.inactives;if(r.length>3){let e;r.forEach((t=>{(!e||e.score>t.score)&&(e=t)})),e&&e.setActive(!1)}if(r.length<3&&i.length>0){let t;i.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(LO(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(LO(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 Wk;function Gk(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),!Wk)return void(Wk=Date.now());const t=Date.now();t-Wk>1e3&&(Bk.get(e)?Bk.set(e,!1):(Hk(e),Bk.delete(e)),Wk=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,i){const n=new DataView(e.data),o=n.getUint8(0);let s;if(0!=(128&o)&&71!==o){const t=function(e){if(e.byteLength<=0)return[];const t=[];let r=0;for(;r<e.byteLength;){const i=(128&e.getUint8(r))>>7,n=127&e.getUint8(r);if(!(i&&r+4<=e.byteLength)){r++;break}{const i=e.getUint32(r,!1),o=(16776192&i)>>10,s=1023&i;t.push({pt:n,ts_offset:o,length:s,data:new Uint8Array}),r+=4}}let i=e.byteLength-r;for(const n of t){if(n.length>i)return console.warn("Broken red payload"),[];n.length>0&&(n.data=new Uint8Array(e.buffer,e.byteOffset+r,n.length),r+=n.length,i-=n.length)}if(i>0){const n={pt:t.length>0?t[t.length-1].pt:0,ts_offset:0,length:i,data:new Uint8Array(e.buffer,e.byteOffset+r,i)};t.push(n)}return t}(n);if(t.length>0){const r=function(e){let t=0;for(let r=0;r<e.length;r++)t+=r<e.length-1?4:1,t+=e[r].length;const r=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++)if(t<e.length-1){const n=(2147483648|(127&e[t].pt)<<24|(262143&e[t].ts_offset)<<10|1023&e[t].length)>>>0;r[i++]=n>>24&255,r[i++]=n>>16&255,r[i++]=n>>8&255,r[i++]=255&n}else r[i++]=127&e[t].pt;for(const t of e)r.set(t.data,i),i+=t.length;return r}(t.map((e=>{const t=new Uint8Array(e.length);t.set(e.data);const r=mk(new DataView(t.buffer));return null!=r&&r.frame&&(e.data=null==r?void 0:r.frame),s=r,e})));e.data=r.buffer}}else s=mk(n),s&&(e.data=s.frame.buffer);if(t.enqueue(e),!s)return;const a=s.tlv.find((e=>e.tag===Ek.METADATA));a&&r&&a.value instanceof Uint8Array&&r(a.value);const c=s.tlv.find((e=>e.tag===Ek.AUDIO_64_BIT_PTS));if(c&&i&&c.value instanceof Uint8Array&&8==c.value.length){i(new DataView(c.value.buffer).getBigUint64(0,!0))}}const zk="video/h264",Xk="video/h265";function Jk(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 Qk(e,t){switch(t){case zk:return function(e){const t=new DataView(e.data);let r=0;for(;r+4<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&6===t.getUint8(r+4)){let i=r+6,n=0,o=0;for(;255===(o=t.getUint8(i++));)n+=255;n+=o;const s=Jk(e.data,i,n);return new Uint8Array(s)}r++}return null}(e);case Xk:return function(e){const t=new DataView(e.data);let r=0;for(;r+5<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&78===t.getUint8(r+4)&&1===t.getUint8(r+5)&&101===t.getUint8(r+6)){let i=r+7,n=0,o=0;for(;255===(o=t.getUint8(i++));)n+=255;n+=o;const s=Jk(e.data,i,n);return new Uint8Array(s)}r++}return null}(e);default:return null}}function qk(e){const t=e.length;let r=[],i=0;for(;i<t;)i+2<t&&0===e[i]&&0===e[i+1]&&(0===e[i+2]||1===e[i+2]||2===e[i+2]||3===e[i+2])?(r.push(e[i],e[i+1],3,e[i+2]),i+=3):(r.push(e[i]),i++);return new Uint8Array(r)}function $k(e,t,r){switch(r){case zk:return function(e,t){const r=qk(t),i=r.length,n=Math.floor(i/255),o=i%255,s=new Uint8Array(6+n+1+i+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=6,s[5]=101;let a=0;for(;a<n;)s[6+a]=255,a++;return s[6+a]=o,a++,s.set(r,6+a),s.set(new Uint8Array(e),6+a+i),s.buffer}(e,t);case Xk:return function(e,t){const r=qk(t),i=r.length,n=Math.floor(i/255),o=i%255,s=new Uint8Array(7+n+1+i+1+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=78,s[5]=1,s[6]=101;let a=0;for(;a<n;)s[7+a]=255,a++;return s[7+a]=o,a++,s.set(r,7+a),a+=i,s[7+a]=128,a++,s.set(new Uint8Array(e),7+a),s.buffer}(e,t);default:return null}}function eM(e){if(e.length<5)return"";let t=-1;for(let r=0;r<e.length-3;r++){if(0===e[r]&&0===e[r+1]&&1===e[r+2]){t=r;break}if(r<e.length-4&&0===e[r]&&0===e[r+1]&&0===e[r+2]&&1===e[r+3]){t=r;break}}if(-1===t)return"";const r=t+(0===e[t+2]?4:3);if(r>=e.length)return"";const i=e[r];if(128&i)return"";if((i>>1&63)>=32)return Xk;if(r+1<e.length){if(0==(248&e[r+1]))return Xk}return(31&i)<=31?zk:""}const tM=new Map;function rM(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 iM=new Map;so(),e.AUDIO_CONTEXT_EVENT=fo,e.AUDIO_ENCODER_CONFIG_SETTINGS=id,e.AUDIO_TRACK_EVENT=vd,e.AgoraRTCPlayer=jC,e.AudioProcessorContext=FO,e.AudioProcessorDestination=VO,e.AudioSourceEvents=yd,e.BufferSourceAudioTrack=PC,e.CameraVideoTrack=ww,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=Rd,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=bd,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=Ad,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=Od,e.DataChannel=qw,e.DataChannelEvents=Ld,e.DeviceManager=UA,e.DeviceManagerEvent=Nd,e.DeviceManagerState=wd,e.LocalAudioTrack=NC,e.LocalDataChannel=class extends qw{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=cA,e.LocalTrackEvents=Td,e.LocalVideoTrack=Cw,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=Dd,e.MicrophoneAudioTrack=DC,e.MixingAudioTrack=LC,e.PROCESSOR_CONTEXT_EVENTS=Cd,e.PROCESSOR_DESTINATION_EVENTS=Id,e.RemoteAudioTrack=Jw,e.RemoteDataChannel=class extends qw{constructor(e){super(e),IT(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(yn("SHOW_DATASTREAM2_LOG")&&Vn.debug("invalid datachannel id: ".concat(r," !== ").concat(this.id)));let i=e.data.slice(this._dataStreamPacketHeader.byteLength);i=this._dataStreamPacketHandler.deserialize(i),this.emit(Ld.MESSAGE,i)}}_updateDataChannelConfig(e){this._config=e}_updateOriginDataChannel(e){super._updateOriginDataChannel(e),this._bandRemoteDataChannelEvents()}_close(){this._originDataChannel&&(this._originDataChannel.removeEventListener("message",this._messageListener),super._close())}_bandRemoteDataChannelEvents(){this._originDataChannel&&this._originDataChannel.addEventListener("message",this._messageListener)}},e.RemoteStreamFallbackType=md,e.RemoteStreamType=Ed,e.RemoteTrack=zw,e.RemoteTrackEvents=gd,e.RemoteVideoTrack=Xw,e.SAFARI_GLOBAL_GUM_LOCK=DA,e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=qu,e.SUPPORT_SVC_CONFIG_LIST=$u,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=Qu,e.StreamType=fd,e.Track=aA,e.TrackEvents=_d,e.TrackHint=pd,e.TrackInternalEvent=hd,e.TrackMediaType=Sd,e.VideoPlayer=FC,e.VideoProcessorContext=xO,e.VideoProcessorDestination=UO,e.VideoState=Pd,e.__TRACK_LIST__=od,e.addTrack=sd,e.audioContextState=pA,e.audioElementPlayCenter=RO,e.audioTimerLoop=function(e,t){let r=!1;const i=1/t;if(yn("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*i)}else{const t=mA();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=_O,e.blob2Uint8Array=BI,e.checkMediaStreamTrackResolution=WO,e.checkTrackState=bO,e.createBufferSourceAudioTrack=async function(e){var t;const r=e.cacheOnlineFile,i=e.encoderConfig;let n=e.source;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=zi(8,"track-buf-"),a=no.reportApiInvoke(null,{id:s,tag:Ci.TRACER,name:Ii.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(yn("DISABLE_WEBAUDIO"))throw new pi(hi.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");Vn.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=MC.get(e);if(t)return Vn.debug("use cached audio resource: ",e),t;try{r=(await cn((()=>Dr.get(e,{responseType:"arraybuffer"})),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new pi(hi.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new sA(((t,r)=>{const i=new FileReader;i.onload=e=>{e.target?t(e.target.result):r(new pi(hi.READ_LOCAL_AUDIO_FILE_ERROR))},i.onerror=()=>{r(new pi(hi.READ_LOCAL_AUDIO_FILE_ERROR))},i.readAsArrayBuffer(e)}));r=await t}const i=await gA(r);return"string"==typeof e&&t&&MC.set(e,i),i}(n,r)}catch(e){return a.onError(e),e.throw(Vn)}const u=new kC(n),d=new PC(c,u,i?nd(i):{},s);return Vn.info("create buffer source audio track success, trackId:",s),a.onSuccess(d.getTrackId()),d},e.createCameraVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=yn("CAMERA_CAPTURE_CONFIG"),r=zi(8,"track-cam-"),i=no.reportApiInvoke(null,{id:r,tag:Ci.TRACER,name:Ii.CREATE_CAM_VIDEO_TRACK,options:[Dw({},e),t]});t&&(e.encoderConfig=t);const n=GO(e);let o=null;Vn.info("start create camera video track with config",JSON.stringify(e),"trackId",r);try{o=(await PA({video:n},r)).getVideoTracks()[0]||null}catch(e){throw i.onError(e),e}if(!o){const e=new pi(hi.UNEXPECTED_ERROR,"can not find track in media stream");return i.onError(e),e.throw(Vn)}if(e.optimizationMode&&Pw(r,o,e,ed(e.encoderConfig)),yn("USE_STANDARD_BITRATE_DEFAULT")){const t=ed(e.encoderConfig);e.encoderConfig=t,delete t.bitrateMax,delete t.bitrateMin}const s=new ww(o,e,n,e.scalabiltyMode?rd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,r);return i.onSuccess(s.getTrackId()),Vn.info("create camera video success, trackId:",r),s},e.createCustomAudioTrack=function(e){const t=zi(8,"track-cus-"),r=no.reportApiInvoke(null,{id:t,tag:Ci.TRACER,name:Ii.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),i=new NC(e.mediaStreamTrack,e.encoderConfig?nd(e.encoderConfig):{},t,!1);return Vn.info("create custom audio track success with config",e,"trackId",i.getTrackId()),r.onSuccess(i.getTrackId()),i},e.createCustomVideoTrack=function(e){const t=zi(8,"track-cus-"),r=no.reportApiInvoke(null,{id:t,tag:Ci.TRACER,name:Ii.CREATE_CUSTOM_VIDEO_TRACK,options:[e]});yn("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin);const i=new Cw(e.mediaStreamTrack,{width:e.width,height:e.height,frameRate:e.frameRate,bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin},e.scalabiltyMode?rd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,t,[pd.CUSTOM_TRACK]);return r.onSuccess(i.getTrackId()),Vn.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=yn("CAMERA_CAPTURE_CONFIG"),i=zi(8,"track-mic-"),n=zi(8,"track-cam-"),o=no.reportApiInvoke(null,{id:"".concat(i,"-").concat(n),tag:Ci.TRACER,name:Ii.CREATE_MIC_AND_CAM_TRACKS,options:[e,t,r]});r&&(t.encoderConfig=r);const s=GO(t),a=ZO(e);let c=null,u=null;Vn.info("start create camera video track(".concat(n,") and microphone audio track(").concat(i,") with config, audio: ").concat(JSON.stringify(e),", video: ").concat(JSON.stringify(t)));try{const e=await PA({audio:a,video:s},"".concat(i,"-").concat(n));c=e.getAudioTracks()[0],u=e.getVideoTracks()[0]}catch(e){throw o.onError(e),e}if(!c||!u){const e=new pi(hi.UNEXPECTED_ERROR,"can not find tracks in media stream");return o.onError(e),e.throw(Vn)}if(t.optimizationMode&&Pw(n,u,t,ed(t.encoderConfig)),yn("USE_STANDARD_BITRATE_DEFAULT")){const e=ed(t.encoderConfig);t.encoderConfig=e,delete e.bitrateMax,delete e.bitrateMin}const d=new DC(c,e,a,i),l=new ww(u,t,s,t.scalabiltyMode?rd(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,n);return o.onSuccess([d.getTrackId(),l.getTrackId()]),Vn.info("create camera video track(".concat(n,") and microphone audio track(").concat(i,") success")),[d,l]},e.createMicrophoneAudioTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=zi(8,"track-mic-"),r=no.reportApiInvoke(null,{id:t,tag:Ci.TRACER,name:Ii.CREATE_MIC_AUDIO_TRACK,options:[e]}),i=ZO(e);let n=null;Vn.info("start create microphone audio track with config",JSON.stringify(e),"trackId",t);try{n=(await PA({audio:i},t)).getAudioTracks()[0]||null}catch(e){throw r.onError(e),e}if(!n){const e=new pi(hi.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(Vn)}const o=new DC(n,e,i,t);return r.onSuccess(o.getTrackId()),Vn.info("create microphone audio track success, trackId:",t),o},e.createMixingAudioTrack=function(e){const t=new LC;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?YO(t):void 0;r&&(t="auto");const i=zi(8,"track-scr-v-"),n=no.reportApiInvoke(null,{id:i,tag:Ci.TRACER,name:Ii.CREATE_SCREEN_VIDEO_TRACK,options:[Dw({},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=HO(e);let s=null,a=null;const c=ao();if(!c.supportShareAudio&&"enable"===t){const e=new pi(hi.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return n.onError(e),e.throw(Vn)}Vn.info("start create screen video track with config",e,"withAudio",t,"trackId",i);const u=c.supportShareAudio&&"disable"!==t;try{const e=await PA({screen:o,screenAudio:u?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 pi(hi.UNEXPECTED_ERROR,"can not find track in media stream");return n.onError(e),e.throw(Vn)}if(!a&&"enable"===t){s&&s.stop();const e=new pi(hi.SHARE_AUDIO_NOT_ALLOWED);return n.onError(e),e.throw(Vn)}if(e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode){Pw(i,s,e,e.encoderConfig&&td(e.encoderConfig)||void 0),e.encoderConfig&&"string"!=typeof e.encoderConfig&&(e.encoderConfig.bitrateMin=e.encoderConfig.bitrateMax)}const d=new Cw(s,e.encoderConfig?td(e.encoderConfig):{},e.scalabiltyMode?rd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,i,[pd.SCREEN_TRACK]);if(!a)return n.onSuccess(d.getTrackId()),Vn.info("create screen video track success","video:",d.getTrackId()),d;const l=new NC(a,void 0,zi(8,"track-scr-a-"),!1);return n.onSuccess([d.getTrackId(),l.getTrackId()]),Vn.info("create screen video track success","video:",d.getTrackId(),"audio:",l.getTrackId()),[d,l]},e.decodeAudioData=gA,e.detectSupportAudioElementSetSinkId=co,e.detectSupportAutCC=function(){return!!yn("FORCE_ENABLE_AUT_CC")||!uo()&&(!!yn("ENABLE_AUT_CC")||void 0)},e.detectSupportAutCCFeedback=function(){return!!yn("FORCE_ENABLE_AUT_CC")||!uo()&&(!!yn("ENABLE_AUT_FEEDBACK")||void 0)},e.detectSupportInstantVideo=function(e){return yn("ENABLE_INSTANT_VIDEO")?yn("ENABLE_INSTANT_VIDEO"):!(null==e||!e.autoSubscribe||yn("FORCE_DISABLE_AUTO_SUB"))},e.detectSupportPrePc=function(e){return!uo()&&!yn("USE_NEW_TOKEN")&&(!!yn("ENABLE_PREALLOC_PC")||!(null==e||!e.autoSubscribe||yn("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportPreSub=function(e){return!(Kr()||function(e){const t=xr();return!(t.name!==Lr.CHROME||!t.osVersion)&&Number(t.version)<e}(87)||uo())&&(!!yn("ENABLE_PRE_SUB")||!(null==e||!e.autoSubscribe||yn("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportRestrictOwnAudio=po,e.detectSupportSDPEndpoint=function(){return yn("ENABLE_JOIN_V4")},e.detectSupportSuppressLocalAudioPlayback=ho,e.deviceManager=xA,e.emptyImage2TypedArray=FI,e.frameData2CryptoBuffer=async(e,t,r)=>await VI(e.buffer,t,r),e.getAudioContext=mA,e.getAudioEncoderConfiguration=nd,e.getBitrateConstrainRange=UI,e.getBitrateFromResAndFps=xI,e.getCompatibility=ao,e.getConstraintsFromAudioConfig=KO,e.getConstraintsFromCameraConfig=GO,e.getConstraintsFromMicrophoneConfig=ZO,e.getConstraintsFromScreenAudioConfig=YO,e.getConstraintsFromScreenConfig=HO,e.getElectronScreenSources=wA,e.getElectronScreenStream=IA,e.getElectronScreenStreamByUserSelect=CA,e.getLocalStream=PA,e.getNewNearestVideoProfile=MI,e.getNewVideoBitrate=kI,e.getOriginSenderConfig=e=>{const t=e._encoderConfig;if(!t)return;const r=e.getMediaStreamTrackSettings(),i=r.frameRate,n=r.width,o=r.height;let s=t.frameRate,a=void 0===s?i:s,c=t.width,u=void 0===c?n:c,d=t.height,l=void 0===d?o:d;if(!a||!u||!l)return;u=en(u),l=en(l),a=en(a);const h=xI(u,l,a),p=h.max,f=h.min,E=t||{},m=E.bitrateMax,_=E.bitrateMin;m||Vn.debug("calculate bitrate: [w: ".concat(u,", h: ").concat(l,", fps: ").concat(a,"] => [brMax: ").concat(m,", brMin: ").concat(_,"]"));const T=yn("ENCODER_CONFIG_LIMIT").maxFramerate;return T&&"number"==typeof T&&(a=Math.min(a,T)),{frameRate:a,bitrateMax:m||p,bitrateMin:_||f,scaleResolutionDownBy:1,scale:0}},e.getScalabilityConfiguration=rd,e.getScreenEncoderConfiguration=td,e.getSilenceAudioTrack=function(){if(yA)return yA;const e=mA();if(!e.createMediaStreamDestination)throw new pi(hi.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),yA=i.stream.getAudioTracks()[0],yA},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=jI,e.getVideoEncoderConfiguration=ed,e.handleGetUserMediaError=kA,e.hasAudioContext=_A,e.hasMicrophoneTrack=cd,e.interceptLocalAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ao().supportWebRTCEncodedTransform)return void Vn.warning("browser not support audio encoded transform");if(_k.has(e))return;if(!e.track)return;const r={track:e.track};if(Wr()){if(!e.createEncodedStreams)return void Vn.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Vn.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&&(Vn.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(Gr()){if("undefined"==typeof RTCRtpScriptTransform)return void Vn.warning("browser not support RTCRtpScriptTransform");const n=uk(),o=new MessageChannel;await new sA((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 sA((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)Vn.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){Vn.warning(e&&e.message)}}}_k.set(e,r),e.track.addEventListener("ended",i)},e.interceptLocalVideoFrame=async function(e,t){if(!ao().supportWebRTCEncodedTransform)return void Vn.warning("browser not support video encoded transform");if(tM.has(e))return;if(!e.track)return;const r={track:e.track};if(Wr()){if(!e.createEncodedStreams)return void Vn.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Vn.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&&(Vn.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=eM(new Uint8Array(t.data)),a=o.shift();if(a){const e=$k(t.data,a,s);e&&(t.data=e)}n.enqueue(t)}});n.readable.pipeThrough(s).pipeTo(n.writable)}else{if(!Gr())return;{if("undefined"==typeof RTCRtpScriptTransform)return void Vn.warning("browser not support RTCRtpScriptTransform");const n=uk(),o=new MessageChannel;await new sA((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 sA((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&&(Vn.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=tM.get(e);if(t){tM.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){Vn.warning(e&&e.message)}}}tM.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(!ao().supportWebRTCEncodedTransform)return void Vn.warning("browser not support audio encoded transform");if(Kk.has(e))return;const r={track:e.track,onMetadata:t.onMetadata,onPts:t.onPts};if(Wr()&&!Yr()){if(!e.createEncodedStreams)return void Vn.warning("browser not support createEncodedStreams() API");zr(Lr.CHROME,87,116)||(t.enableTopn=!1);let n=null;try{n=e.createEncodedStreams()}catch(e){return void Vn.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&&(Vn.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=mk(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===Ek.AUDIO_LEVEL)))||void 0===i?void 0:i.value;let a=0;"number"==typeof s&&(a=127-s);const c=Uk(e,Math.round(Math.pow(10,a/60)-1)),u=c.selected,d=c.speaker,l=Gk(o,e.track,d.energyScore);l.addSample(u),l.active&&(t.data=n.frame.buffer,r.enqueue(t))}(e,n,o):t.enableMetadata||t.enablePts?Zk(n,o,t.onMetadata,t.onPts):o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}else{if("undefined"==typeof RTCRtpScriptTransform)return void Vn.warning("browser not support RTCRtpScriptTransform");const t=uk(),n=new MessageChannel;await new sA((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 sA((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?(Vn.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i)):t.data.metadata&&r.onMetadata?r.onMetadata(t.data.metadata):t.data.pts&&r.onPts&&r.onPts(t.data.pts)},r.worker=t}function i(){e.track.removeEventListener("ended",i),function(e){const t=Kk.get(e);if(t){!function(e){const t=Dk.get(e);t&&(Dk.delete(e),Pk&&(Pk.removeSpeakers([t]),0===Dk.size&&(Pk.destroy(),Pk=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){Vn.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(!ao().supportWebRTCEncodedTransform)return void Vn.warning("browser not support video encoded transform");if(!e.track)return;if(iM.has(e)){const r=iM.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(Wr()){if(!e.createEncodedStreams)return void Vn.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Vn.error("create video-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(n,o){if(r.controller||(r.controller=o),!r.firstFrameInfo){var s;const e=n.getMetadata()||{};r.firstFrameInfo=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?rM(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:n.type,rtpTimestamp:n.timestamp,payloadType:e.payloadType||0,ssrc:e.synchronizationSource||0,length:n.data.byteLength},"mimeType"in e?{mimeType:e.mimeType}:{}),null===(s=t.onFirstFrame)||void 0===s||s.call(t,r.firstFrameInfo)}e.track&&e.track.id!==r.track.id&&(Vn.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i));const a=Qk(n,eM(new Uint8Array(n.data)));a&&r.onSei&&r.onSei(a),o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}else if(Gr()){if("undefined"==typeof RTCRtpScriptTransform)return void Vn.warning("browser not support RTCRtpScriptTransform");const n=uk(),o=new MessageChannel;await new sA((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(n,{name:"sei-rx",port:o.port2},[o.port2]);e.transform=s,await new sA((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=n=>{var o;if(n.data.transformed&&e.track&&(null===(o=e.track)||void 0===o?void 0:o.id)!==r.track.id)Vn.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i);else if(n.data.sei&&r.onSei)r.onSei(n.data.sei);else if(n.data.firstFrameInfo&&t.onFirstFrame){var s;null===(s=t.onFirstFrame)||void 0===s||s.call(t,n.data.firstFrameInfo)}},r.worker=n}function i(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",i)}!function(e){const t=iM.get(e);if(t){iM.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){Vn.warning(e&&e.message)}}}(e)}iM.set(e,r),e.track.addEventListener("ended",i)},e.isAudioEncoderConfiguration=dd,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?Ei(e,"profile",Object.keys(id)):dd(e),!0},e.isBeautyEffectOptions=function(e){return void 0!==e.smoothnessLevel&&mi(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&mi(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&mi(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&Ei(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),!0},e.isElectron=bi,e.isLowStreamParameter=function(e){if(!e)throw new pi(hi.INVALID_PARAMS);return Ti(e.width)||_i(e.width,"streamParameter.width"),Ti(e.height)||_i(e.height,"streamParameter.height"),Ti(e.framerate)||_i(e.framerate,"streamParameter.framerate"),Ti(e.bitrate)||mi(e.bitrate,"streamParameter.bitrate"),!0},e.isPlanB=uo,e.isScreenSourceType=ld,e.isVideoEncoderConfiguration=ud,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?Ei(e,"profile",Object.keys(Qu)):ud(e),!0},e.polyfillAudioNode=TA,e.removeTrack=ad,e.requestAutoplayGesture=TO,e.restartBackgroundTag=EA,e.silenceScriptProcessHandler=vA,e.updateAgoraRTCCompatibility=so,e.visibilityWatcher=Qw}));
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 n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}let r=!0,n=!0;function i(e,t,r){const n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function o(e,t,r){if(!e.RTCPeerConnection)return;const n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};const o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){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."):(n=!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 u(e,t){n&&console.warn(e+" is deprecated, please use "+t+" instead.")}function d(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e){return d(e)?Object.keys(e).reduce((function(t,r){const n=d(e[r]),i=n?l(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[r]:i})}),{}):e}function h(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?h(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((t=>{h(e,e.get(t),r)}))})))}function p(e,t,r){const n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===n&&r.trackId===t.id&&h(e,r,i)}))})),i}const f=c;function E(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const n=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 n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];let e={};"number"==typeof n.ideal?(e[i("min",r)]=n.ideal,t.optional.push(e),e={},e[i("max",r)]=n.ideal,t.optional.push(e)):(e[i("",r)]=n.ideal,t.optional.push(e))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==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=n(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=n(e.video),f("chrome: "+JSON.stringify(e)),i(e)}))}e.video=n(e.video)}return f("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return i(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function m(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function _(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}))},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,n){let i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.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 n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.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,n]=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 i=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 n=function(e){r(o(i(e)))};return t.apply(this,[n,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(i(t)))},r])})).then(r,n)}}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,n;return this.getSenders().forEach((r=>{r.track===e&&(t?n=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?n=!0:r=t),t.track===e))),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function y(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 n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};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 n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const i=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]})),i.apply(this,arguments)}}function v(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return y(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 n=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}n.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[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 i=this._streams[r.id];if(i)i.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const n=new e.MediaStream([t]);this._streams[r.id]=n,this._reverseStreams[n.id]=r,this.addStream(n)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[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]=n[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 n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(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],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[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:v,shimAddTrackRemoveTrackWithNative:y,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 n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))},shimGetSendersWithDtmf:T,shimGetStats:g,shimGetUserMedia:E,shimMediaStream:m,shimOnTrack:_,shimPeerConnection:R,shimSenderReceiverGetStats:S});function O(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){u("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(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)},n&&n.prototype.getSettings){const t=n.prototype.getSettings;n.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(n&&n.prototype.applyConstraints){const t=n.prototype.applyConstraints;n.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],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return n.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,n)=>{e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(i,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){u("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function P(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function L(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const r=e.length>0;r&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const n=t.apply(this,arguments);if(r){const{sender:t}=n,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 n})}function k(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function M(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var x=Object.freeze({__proto__:null,shimAddTransceiver:L,shimCreateAnswer:U,shimCreateOffer:M,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})},shimGetParameters:k,shimGetUserMedia: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,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};let a=function(e,t,r){const n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=a,a=function(e,t,r){const n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=a,a=function(e,t,r){const n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},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(W(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function W(e){return e&&void 0!==e.video?Object.assign({},e,{video:l(e.video)}):e}function G(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 n=e.iceServers[r];!n.hasOwnProperty("urls")&&n.hasOwnProperty("url")?(u("RTCIceServer.url","RTCIceServer.urls"),n=JSON.parse(JSON.stringify(n)),n.urls=n.url,delete n.url,t.push(n)):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:W,shimCreateOfferLegacy:K,shimGetUserMedia:j,shimLocalStreamsAPI:V,shimRTCIceServerUrls:G,shimRemoteStreamsAPI:F,shimTrackEventTransceiver:H}),z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function X(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 n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&void 0!==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 n=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<n.length;e++)r=n[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 n=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){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)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substring(t+1,n),r.value=e.substring(n+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 n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substring(12),password:i.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:[]},n=t.splitLines(e)[0].split(" ");r.profile=n[2];for(let i=3;i<n.length;i++){const o=n[i],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){const n=t.parseRtpMap(s),i=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(n.parameters=i.length?t.parseFmtp(i[0]):{},n.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(n.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{r.headerExtensions.push(t.parseExtmap(e))}));const i=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return r.codecs.forEach((e=>{i.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 n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",n+=r.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((e=>{n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));let i=0;return r.codecs.forEach((e=>{e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((e=>{n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){const r=[],n=t.parseRtpParameters(e),i=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.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 u=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),n.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),i&&(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 d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){const r={},n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);const i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.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 n=t.matchPrefix(e,"a=msid:");if(1===n.length)return r=n[0].substring(7).split(" "),{stream:r[0],track:r[1]};const i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return i.length>0?(r=i[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},t.parseSctpDescription=function(e){const r=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");let i;n.length>0&&(i=parseInt(n[0].substring(19),10)),isNaN(i)&&(i=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:i};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:i}}},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,n){let i;const o=void 0!==r?r:2;i=e||t.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){const n=t.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[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=X(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),n=q.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,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")}))},n=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},i=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 n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);const i=q.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},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=n(arguments[0]),t=i(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 ne(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}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 ie(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:ie,shimMaxMessageSize:re,shimParameterlessSetLocalDescription:ae,shimRTCIceCandidate:ee,shimRTCIceCandidateRelayProtocol:te,shimSendThrowTypeError:ne});!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=c,n=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=i(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=i(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=i(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),o={browserDetails:n,commonShim:ce,extractVersion:i,disableLog:s,disableWarnings:a,sdp:$};switch(n.browser){case"chrome":if(!b||!R||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=b,se(e,n),ae(e),E(e,n),m(e),R(e,n),_(e),v(e,n),T(e),g(e),S(e),A(e,n),ee(e),te(e),ie(e),re(e,n),ne(e),oe(e,n);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,n),ae(e),O(e,n),C(e,n),I(e),D(e),w(e),N(e),P(e),L(e),k(e),M(e),U(e),ee(e),ie(e),re(e,n),ne(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,n),ae(e),G(e),K(e),B(e),V(e),F(e),H(e),j(e),Y(e),ee(e),te(e),re(e,n),ne(e),oe(e,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var ue={exports:{}};!function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",c="major",u="model",d="name",l="type",h="vendor",p="version",f="architecture",E="console",m="mobile",_="tablet",T="smarttv",g="wearable",S="embedded",y="Amazon",v="Apple",R="ASUS",A="BlackBerry",b="Browser",O="Chrome",I="Firefox",C="Google",w="Huawei",N="LG",D="Microsoft",P="Motorola",L="Opera",k="Samsung",M="Sharp",U="Sony",x="Xiaomi",V="Zebra",F="Facebook",B="Chromium OS",j="Mac OS",W=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},G=function(e,t){return typeof e===a&&-1!==H(t).indexOf(H(e))},H=function(e){return e.toLowerCase()},K=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,350)},Y=function(e,t){for(var r,o,a,c,u,d,l=0;l<t.length&&!u;){var h=t[l],p=t[l+1];for(r=o=0;r<h.length&&!u&&h[r];)if(u=h[r++].exec(e))for(a=0;a<p.length;a++)d=u[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,d):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=d?d.replace(c[1],c[2]):n:this[c[0]]=d?c[1].call(this,d,c[2]):n:4===c.length&&(this[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):n):this[c]=d||n;l+=2}},Z=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(G(t[r][i],e))return"?"===r?n:r}else if(G(t[r],e))return"?"===r?n:r;return 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"},X={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[d,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[d,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[d,p],[/opios[\/ ]+([\w\.]+)/i],[p,[d,L+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[d,L]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[d,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[d,"UC"+b]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[d,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[d,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[d,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[d,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[d,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[d,/(.+)/,"$1 Secure "+b],p],[/\bfocus\/([\w\.]+)/i],[p,[d,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[d,L+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[d,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[d,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[d,L+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[d,"MIUI "+b]],[/fxios\/([-\w\.]+)/i],[p,[d,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[d,"360 "+b]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[d,/(.+)/,"$1 "+b],p],[/(comodo_dragon)\/([\w\.]+)/i],[[d,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[d,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[d],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[d,F],p],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[d,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[d,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[d,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[d,O+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[d,"Android "+b]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[d,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[d,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,d],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[d,[p,Z,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[d,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[d,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[d,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[d,p],[/(cobalt)\/([\w\.]+)/i],[d,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,H]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",H]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,H]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[h,k],[l,_]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[h,k],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[h,v],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[h,v],[l,_]],[/(macintosh);/i],[u,[h,v]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[h,M],[l,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[h,w],[l,_]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[h,w],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[h,x],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/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],[u,[h,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[h,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[h,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[h,P],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[h,P],[l,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[h,N],[l,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[h,N],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[h,"Lenovo"],[l,_]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[h,"Nokia"],[l,m]],[/(pixel c)\b/i],[u,[h,C],[l,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[h,C],[l,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[h,U],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[h,U],[l,_]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[h,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[h,y],[l,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[h,y],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[u,h,[l,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[h,A],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[h,R],[l,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[h,R],[l,m]],[/(nexus 9)/i],[u,[h,"HTC"],[l,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[u,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[h,"Acer"],[l,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[h,"Meizu"],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,u,[l,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[h,u,[l,_]],[/(surface duo)/i],[u,[h,D],[l,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[h,"Fairphone"],[l,m]],[/(u304aa)/i],[u,[h,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[u,[h,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[u,[h,"RCA"],[l,_]],[/\b(venue[\d ]{2,7}) b/i],[u,[h,"Dell"],[l,_]],[/\b(q(?:mv|ta)\w+) b/i],[u,[h,"Verizon"],[l,_]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[h,"Barnes & Noble"],[l,_]],[/\b(tm\d{3}\w+) b/i],[u,[h,"NuVision"],[l,_]],[/\b(k88) b/i],[u,[h,"ZTE"],[l,_]],[/\b(nx\d{3}j) b/i],[u,[h,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[u,[h,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[u,[h,"Swiss"],[l,_]],[/\b((zeki)?tb.*\b) b/i],[u,[h,"Zeki"],[l,_]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],u,[l,_]],[/\b(ns-?\w{0,9}) b/i],[u,[h,"Insignia"],[l,_]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[h,"NextBook"],[l,_]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],u,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],u,[l,m]],[/\b(ph-1) /i],[u,[h,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[h,"Envizen"],[l,_]],[/\b(trio[-\w\. ]+) b/i],[u,[h,"MachSpeed"],[l,_]],[/\btu_(1491) b/i],[u,[h,"Rotor"],[l,_]],[/(shield[\w ]+) b/i],[u,[h,"Nvidia"],[l,_]],[/(sprint) (\w+)/i],[h,u,[l,m]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[h,D],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[h,V],[l,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[h,V],[l,m]],[/smart-tv.+(samsung)/i],[h,[l,T]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[h,k],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,N],[l,T]],[/(apple) ?tv/i],[h,[u,v+" TV"],[l,T]],[/crkey/i],[[u,O+"cast"],[h,C],[l,T]],[/droid.+aft(\w)( bui|\))/i],[u,[h,y],[l,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[h,M],[l,T]],[/(bravia[\w ]+)( bui|\))/i],[u,[h,U],[l,T]],[/(mitv-\w{5}) bui/i],[u,[h,x],[l,T]],[/Hbbtv.*(technisat) (.*);/i],[h,u,[l,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,K],[u,K],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,u,[l,E]],[/droid.+; (shield) bui/i],[u,[h,"Nvidia"],[l,E]],[/(playstation [345portablevi]+)/i],[u,[h,U],[l,E]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[h,D],[l,E]],[/((pebble))app/i],[h,u,[l,g]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[h,v],[l,g]],[/droid.+; (glass) \d/i],[u,[h,C],[l,g]],[/droid.+; (wt63?0{2,3})\)/i],[u,[h,V],[l,g]],[/(quest( 2| pro)?)/i],[u,[h,F],[l,g]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[l,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[l,_]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[d,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[d,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[d,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,d]],os:[[/microsoft (windows) (vista|xp)/i],[d,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[d,[p,Z,z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[d,"Windows"],[p,Z,z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[d,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[d,j],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,d],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[d,p],[/\(bb(10);/i],[p,[d,A]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[d,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[d,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[d,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[d,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[d,O+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[d,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],[d,p],[/(sunos) ?([\w\.\d]*)/i],[[d,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[d,p]]},J=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof J))return new J(e,t).getResult();var E=typeof r!==o&&r.navigator?r.navigator:n,T=e||(E&&E.userAgent?E.userAgent:""),g=E&&E.userAgentData?E.userAgentData:n,S=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(X,t):X;return this.getBrowser=function(){var e={};return e[d]=n,e[p]=n,Y.call(e,T,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e[p]),E&&E.brave&&typeof E.brave.isBrave==i&&(e[d]="Brave"),e},this.getCPU=function(){var e={};return e[f]=n,Y.call(e,T,S.cpu),e},this.getDevice=function(){var e={};return e[h]=n,e[u]=n,e[l]=n,Y.call(e,T,S.device),!e[l]&&g&&g.mobile&&(e[l]=m),"Macintosh"==e[u]&&E&&typeof E.standalone!==o&&E.maxTouchPoints&&E.maxTouchPoints>2&&(e[u]="iPad",e[l]=_),e},this.getEngine=function(){var e={};return e[d]=n,e[p]=n,Y.call(e,T,S.engine),e},this.getOS=function(){var e={};return e[d]=n,e[p]=n,Y.call(e,T,S.os),!e[d]&&g&&"Unknown"!=g.platform&&(e[d]=g.platform.replace(/chrome os/i,B).replace(/macos/i,j)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return T},this.setUA=function(e){return T=typeof e===a&&e.length>350?K(e,350):e,this},this.setUA(T),this};J.VERSION="0.7.34",J.BROWSER=W([d,p,c]),J.CPU=W([f]),J.DEVICE=W([u,h,l,E,m,T,_,g,S]),J.ENGINE=J.OS=W([d,p]),e.exports&&(t=e.exports=J),t.UAParser=J;var Q=typeof r!==o&&(r.jQuery||r.Zepto);if(Q&&!Q.ua){var q=new J;Q.ua=q.getResult(),Q.ua.get=function(){return q.getUA()},Q.ua.set=function(e){q.setUA(e);var t=q.getResult();for(var r in t)Q.ua[r]=t[r]}}}("object"==typeof window?window:z)}(ue,ue.exports);var de=X(ue.exports);function le(e,t){return function(){return e.apply(t,arguments)}}const{toString:he}=Object.prototype,{getPrototypeOf:pe}=Object,{iterator:fe,toStringTag:Ee}=Symbol,me=(e=>t=>{const r=he.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),_e=e=>(e=e.toLowerCase(),t=>me(t)===e),Te=e=>t=>typeof t===e,{isArray:ge}=Array,Se=Te("undefined");function ye(e){return null!==e&&!Se(e)&&null!==e.constructor&&!Se(e.constructor)&&Ae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ve=_e("ArrayBuffer");const Re=Te("string"),Ae=Te("function"),be=Te("number"),Oe=e=>null!==e&&"object"==typeof e,Ie=e=>{if("object"!==me(e))return!1;const t=pe(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Ee in e||fe in e)},Ce=_e("Date"),we=_e("File"),Ne=_e("Blob"),De=_e("FileList");const Pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},Le=void 0!==Pe.FormData?Pe.FormData:void 0,ke=_e("URLSearchParams"),[Me,Ue,xe,Ve]=["ReadableStream","Request","Response","Headers"].map(_e);function Fe(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),ge(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(ye(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let s;for(n=0;n<o;n++)s=i[n],t.call(null,e[s],s,e)}}function Be(e,t){if(ye(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const je="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,We=e=>!Se(e)&&e!==je;const Ge=(He="undefined"!=typeof Uint8Array&&pe(Uint8Array),e=>He&&e instanceof He);var He;const Ke=_e("HTMLFormElement"),Ye=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ze=_e("RegExp"),ze=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Fe(r,((r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)})),Object.defineProperties(e,n)};const Xe=_e("AsyncFunction"),Je=(Qe="function"==typeof setImmediate,qe=Ae(je.postMessage),Qe?setImmediate:qe?($e=`axios@${Math.random()}`,et=[],je.addEventListener("message",(({source:e,data:t})=>{e===je&&t===$e&&et.length&&et.shift()()}),!1),e=>{et.push(e),je.postMessage($e,"*")}):e=>setTimeout(e));var Qe,qe,$e,et;const tt="undefined"!=typeof queueMicrotask?queueMicrotask.bind(je):"undefined"!=typeof process&&process.nextTick||Je;var rt={isArray:ge,isArrayBuffer:ve,isBuffer:ye,isFormData:e=>{if(!e)return!1;if(Le&&e instanceof Le)return!0;const t=pe(e);if(!t||t===Object.prototype)return!1;if(!Ae(e.append))return!1;const r=me(e);return"formdata"===r||"object"===r&&Ae(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ve(e.buffer),t},isString:Re,isNumber:be,isBoolean:e=>!0===e||!1===e,isObject:Oe,isPlainObject:Ie,isEmptyObject:e=>{if(!Oe(e)||ye(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Me,isRequest:Ue,isResponse:xe,isHeaders:Ve,isUndefined:Se,isDate:Ce,isFile:we,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Ne,isRegExp:Ze,isFunction:Ae,isStream:e=>Oe(e)&&Ae(e.pipe),isURLSearchParams:ke,isTypedArray:Ge,isFileList:De,forEach:Fe,merge:function e(...t){const{caseless:r,skipUndefined:n}=We(this)&&this||{},i={},o=(t,o)=>{if("__proto__"===o||"constructor"===o||"prototype"===o)return;const s=r&&Be(i,o)||o,a=Ye(i,s)?i[s]:void 0;Ie(a)&&Ie(t)?i[s]=e(a,t):Ie(t)?i[s]=e({},t):ge(t)?i[s]=t.slice():n&&Se(t)||(i[s]=t)};for(let e=0,r=t.length;e<r;e++)t[e]&&Fe(t[e],o);return i},extend:(e,t,r,{allOwnKeys:n}={})=>(Fe(t,((t,n)=>{r&&Ae(t)?Object.defineProperty(e,n,{__proto__:null,value:le(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,n,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})}),{allOwnKeys:n}),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,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,o,s;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],n&&!n(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==r&&pe(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:me,kindOfTest:_e,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(ge(e))return e;let t=e.length;if(!be(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[fe]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Ke,hasOwnProperty:Ye,hasOwnProp:Ye,reduceDescriptors:ze,freezeMethods:e=>{ze(e,((t,r)=>{if(Ae(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];Ae(n)&&(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={},n=e=>{e.forEach((e=>{r[e]=!0}))};return ge(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Be,global:je,isContextDefined:We,isSpecCompliantForm:function(e){return!!(e&&Ae(e.append)&&"FormData"===e[Ee]&&e[fe])},toJSONObject:e=>{const t=new WeakSet,r=e=>{if(Oe(e)){if(t.has(e))return;if(ye(e))return e;if(!("toJSON"in e)){t.add(e);const n=ge(e)?[]:{};return Fe(e,((e,t)=>{const i=r(e);!Se(i)&&(n[t]=i)})),t.delete(e),n}}return e};return r(e)},isAsyncFn:Xe,isThenable:e=>e&&(Oe(e)||Ae(e))&&Ae(e.then)&&Ae(e.catch),setImmediate:Je,asap:tt,isIterable:e=>null!=e&&Ae(e[fe])};const nt=rt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const it=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ot=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function st(e,t){return rt.isArray(e)?e.map((e=>st(e,t))):function(e){let t=0,r=e.length;for(;t<r;){const r=e.charCodeAt(t);if(9!==r&&32!==r)break;t+=1}for(;r>t;){const t=e.charCodeAt(r-1);if(9!==t&&32!==t)break;r-=1}return 0===t&&r===e.length?e:e.slice(t,r)}(String(e).replace(t,""))}const at=e=>st(e,it),ct=e=>st(e,ot);function ut(e){const t=Object.create(null);return rt.forEach(e.toJSON(),((e,r)=>{t[r]=ct(e)})),t}const dt=Symbol("internals");function lt(e){return e&&String(e).trim().toLowerCase()}function ht(e){return!1===e||null==e?e:rt.isArray(e)?e.map(ht):at(String(e))}function pt(e,t,r,n,i){return rt.isFunction(n)?n.call(this,t,r):(i&&(t=r),rt.isString(t)?rt.isString(n)?-1!==t.indexOf(n):rt.isRegExp(n)?n.test(t):void 0:void 0)}class ft{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=lt(t);if(!i)throw new Error("header name must be a non-empty string");const o=rt.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=ht(e))}const o=(e,t)=>rt.forEach(e,((e,r)=>i(e,r,t)));if(rt.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(rt.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&nt[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t);else if(rt.isObject(e)&&rt.isIterable(e)){let r,n,i={};for(const t of e){if(!rt.isArray(t))throw TypeError("Object iterator must return a key-value pair");i[n=t[0]]=(r=i[n])?rt.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(i,t)}else null!=e&&i(t,e,r);return this}get(e,t){if(e=lt(e)){const r=rt.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(rt.isFunction(t))return t.call(this,e,r);if(rt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=lt(e)){const r=rt.findKey(this,e);return!(!r||void 0===this[r]||t&&!pt(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=lt(e)){const i=rt.findKey(r,e);!i||t&&!pt(0,r[i],i,t)||(delete r[i],n=!0)}}return rt.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!pt(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return rt.forEach(this,((n,i)=>{const o=rt.findKey(r,i);if(o)return t[o]=ht(n),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();s!==i&&delete t[i],t[s]=ht(n),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return rt.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&rt.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[dt]=this[dt]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=lt(e);t[n]||(!function(e,t){const r=rt.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return rt.isArray(e)?e.forEach(n):n(e),this}}ft.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),rt.reduceDescriptors(ft.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),rt.freezeMethods(ft);var Et=ft;const mt="[REDACTED ****]";function _t(e,t){const r=new Set(t.map((e=>String(e).toLowerCase()))),n=[],i=e=>{if(null===e||"object"!=typeof e)return e;if(rt.isBuffer(e))return e;if(-1!==n.indexOf(e))return;let t;if(e instanceof Et&&(e=e.toJSON()),n.push(e),rt.isArray(e))t=[],e.forEach(((e,r)=>{const n=i(e);rt.isUndefined(n)||(t[r]=n)}));else{if(!rt.isPlainObject(e)&&function(e){if(rt.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(rt.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return n.pop(),e;t=Object.create(null);for(const[n,o]of Object.entries(e)){const e=r.has(n.toLowerCase())?mt:i(o);rt.isUndefined(e)||(t[n]=e)}}return n.pop(),t};return i(e)}class Tt extends Error{static from(e,t,r,n,i,o){const s=new Tt(e.message,t||e.code,r,n,i);return s.cause=e,s.name=e.name,null!=e.status&&null==s.status&&(s.status=e.status),o&&Object.assign(s,o),s}constructor(e,t,r,n,i){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status)}toJSON(){const e=this.config,t=e&&rt.hasOwnProp(e,"redact")?e.redact:void 0,r=rt.isArray(t)&&t.length>0?_t(e,t):rt.toJSONObject(e);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:r,code:this.code,status:this.status}}}Tt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Tt.ERR_BAD_OPTION="ERR_BAD_OPTION",Tt.ECONNABORTED="ECONNABORTED",Tt.ETIMEDOUT="ETIMEDOUT",Tt.ECONNREFUSED="ECONNREFUSED",Tt.ERR_NETWORK="ERR_NETWORK",Tt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Tt.ERR_DEPRECATED="ERR_DEPRECATED",Tt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Tt.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Tt.ERR_CANCELED="ERR_CANCELED",Tt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Tt.ERR_INVALID_URL="ERR_INVALID_URL",Tt.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";var gt=Tt;function St(e){return rt.isPlainObject(e)||rt.isArray(e)}function yt(e){return rt.endsWith(e,"[]")?e.slice(0,-2):e}function vt(e,t,r){return e?e.concat(t).map((function(e,t){return e=yt(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const Rt=rt.toFlatObject(rt,{},null,(function(e){return/^is[A-Z]/.test(e)}));function At(e,t,r){if(!rt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=rt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!rt.isUndefined(t[e])}))).metaTokens,i=r.visitor||l,o=r.dots,s=r.indexes,a=r.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===r.maxDepth?100:r.maxDepth,u=a&&rt.isSpecCompliantForm(t);if(!rt.isFunction(i))throw new TypeError("visitor must be a function");function d(e){if(null===e)return"";if(rt.isDate(e))return e.toISOString();if(rt.isBoolean(e))return e.toString();if(!u&&rt.isBlob(e))throw new gt("Blob is not supported. Use a Buffer instead.");return rt.isArrayBuffer(e)||rt.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,i){let a=e;if(rt.isReactNative(t)&&rt.isReactNativeBlob(e))return t.append(vt(i,r,o),d(e)),!1;if(e&&!i&&"object"==typeof e)if(rt.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(rt.isArray(e)&&function(e){return rt.isArray(e)&&!e.some(St)}(e)||(rt.isFileList(e)||rt.endsWith(r,"[]"))&&(a=rt.toArray(e)))return r=yt(r),a.forEach((function(e,n){!rt.isUndefined(e)&&null!==e&&t.append(!0===s?vt([r],n,o):null===s?r:r+"[]",d(e))})),!1;return!!St(e)||(t.append(vt(i,r,o),d(e)),!1)}const h=[],p=Object.assign(Rt,{defaultVisitor:l,convertValue:d,isVisitable:St});if(!rt.isObject(e))throw new TypeError("data must be an object");return function e(r,n,o=0){if(!rt.isUndefined(r)){if(o>c)throw new gt("Object is too deeply nested ("+o+" levels). Max depth: "+c,gt.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==h.indexOf(r))throw Error("Circular reference detected in "+n.join("."));h.push(r),rt.forEach(r,(function(r,s){!0===(!(rt.isUndefined(r)||null===r)&&i.call(t,r,rt.isString(s)?s.trim():s,n,p))&&e(r,n?n.concat(s):[s],o+1)})),h.pop()}}(e),t}function bt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,(function(e){return t[e]}))}function Ot(e,t){this._pairs=[],e&&At(e,this,t)}const It=Ot.prototype;function Ct(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function wt(e,t,r){if(!t)return e;const n=r&&r.encode||Ct,i=rt.isFunction(r)?{serialize:r}:r,o=i&&i.serialize;let s;if(s=o?o(t,i):rt.isURLSearchParams(t)?t.toString():new Ot(t,i).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}It.append=function(e,t){this._pairs.push([e,t])},It.toString=function(e){const t=e?function(t){return e.call(this,t,bt)}:bt;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Nt=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){rt.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Dt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Pt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ot,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Lt="undefined"!=typeof window&&"undefined"!=typeof document,kt="object"==typeof navigator&&navigator||void 0,Mt=Lt&&(!kt||["ReactNative","NativeScript","NS"].indexOf(kt.product)<0),Ut="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,xt=Lt&&window.location.href||"http://localhost";var Vt={...Object.freeze({__proto__:null,hasBrowserEnv:Lt,hasStandardBrowserEnv:Mt,hasStandardBrowserWebWorkerEnv:Ut,navigator:kt,origin:xt}),...Pt};function Ft(e){function t(e,r,n,i){let o=e[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=e.length;if(o=!o&&rt.isArray(n)?n.length:o,a)return rt.hasOwnProp(n,o)?n[o]=rt.isArray(n[o])?n[o].concat(r):[n[o],r]:n[o]=r,!s;rt.hasOwnProp(n,o)&&rt.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],i)&&rt.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}(n[o])),!s}if(rt.isFormData(e)&&rt.isFunction(e.entries)){const r={};return rt.forEachEntry(e,((e,n)=>{t(function(e){return rt.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const Bt=(e,t)=>null!=e&&rt.hasOwnProp(e,t)?e[t]:void 0;const jt={transitional:Dt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=rt.isObject(e);i&&rt.isHTMLForm(e)&&(e=new FormData(e));if(rt.isFormData(e))return n?JSON.stringify(Ft(e)):e;if(rt.isArrayBuffer(e)||rt.isBuffer(e)||rt.isStream(e)||rt.isFile(e)||rt.isBlob(e)||rt.isReadableStream(e))return e;if(rt.isArrayBufferView(e))return e.buffer;if(rt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){const t=Bt(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return At(e,new Vt.classes.URLSearchParams,{visitor:function(e,t,r,n){return Vt.isNode&&rt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((o=rt.isFileList(e))||r.indexOf("multipart/form-data")>-1){const r=Bt(this,"env"),n=r&&r.FormData;return At(o?{"files[]":e}:e,n&&new n,t)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(rt.isString(e))try{return(t||JSON.parse)(e),rt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Bt(this,"transitional")||jt.transitional,r=t&&t.forcedJSONParsing,n=Bt(this,"responseType"),i="json"===n;if(rt.isResponse(e)||rt.isReadableStream(e))return e;if(e&&rt.isString(e)&&(r&&!n||i)){const r=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,Bt(this,"parseReviver"))}catch(e){if(r){if("SyntaxError"===e.name)throw gt.from(e,gt.ERR_BAD_RESPONSE,this,null,Bt(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Vt.classes.FormData,Blob:Vt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};rt.forEach(["delete","get","head","post","put","patch","query"],(e=>{jt.headers[e]={}}));var Wt=jt;function Gt(e,t){const r=this||Wt,n=t||r,i=Et.from(n.headers);let o=n.data;return rt.forEach(e,(function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function Ht(e){return!(!e||!e.__CANCEL__)}var Kt=class extends gt{constructor(e,t,r){super(null==e?"canceled":e,gt.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function Yt(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new gt("Request failed with status code "+r.status,r.status>=400&&r.status<500?gt.ERR_BAD_REQUEST:gt.ERR_BAD_RESPONSE,r.config,r.request,r)):e(r)}const Zt=(e,t,r=3)=>{let n=0;const i=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=n[s];i||(i=c),r[o]=a,n[o]=c;let d=s,l=0;for(;d!==o;)l+=r[d++],d%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-i<t)return;const h=u&&c-u;return h?Math.round(1e3*l/h):void 0}}(50,250);return function(e,t){let r,n,i=0,o=1e3/t;const s=(t,o=Date.now())=>{i=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=o?s(e,t):(r=e,n||(n=setTimeout((()=>{n=null,s(r)}),o-a)))},()=>r&&s(r)]}((r=>{if(!r||"number"!=typeof r.loaded)return;const o=r.loaded,s=r.lengthComputable?r.total:void 0,a=null!=s?Math.min(o,s):o,c=Math.max(0,a-n),u=i(c);n=Math.max(n,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:c,rate:u||void 0,estimated:u&&s?(s-a)/u:void 0,event:r,lengthComputable:null!=s,[t?"download":"upload"]:!0})}),r)},zt=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Xt=e=>(...t)=>rt.asap((()=>e(...t)));var Jt=Vt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Vt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Vt.origin),Vt.navigator&&/(msie|trident)/i.test(Vt.navigator.userAgent)):()=>!0,Qt=Vt.hasStandardBrowserEnv?{write(e,t,r,n,i,o,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];rt.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),rt.isString(n)&&a.push(`path=${n}`),rt.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),rt.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),i=n.indexOf("=");if(-1!==i&&n.slice(0,i)===e)return decodeURIComponent(n.slice(i+1))}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function qt(e,t,r){let n=!function(e){return"string"==typeof e&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(n||!1===r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const $t=e=>e instanceof Et?{...e}:e;function er(e,t){t=t||{};const r=Object.create(null);function n(e,t,r,n){return rt.isPlainObject(e)&&rt.isPlainObject(t)?rt.merge.call({caseless:n},e,t):rt.isPlainObject(t)?rt.merge({},t):rt.isArray(t)?t.slice():t}function i(e,t,r,i){return rt.isUndefined(t)?rt.isUndefined(e)?void 0:n(void 0,e,0,i):n(e,t,0,i)}function o(e,t){if(!rt.isUndefined(t))return n(void 0,t)}function s(e,t){return rt.isUndefined(t)?rt.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,o){return rt.hasOwnProp(t,o)?n(r,i):rt.hasOwnProp(e,o)?n(void 0,r):void 0}Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!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,allowedSocketPaths:s,responseEncoding:s,validateStatus:a,headers:(e,t,r)=>i($t(e),$t(t),0,!0)};return rt.forEach(Object.keys({...e,...t}),(function(n){if("__proto__"===n||"constructor"===n||"prototype"===n)return;const o=rt.hasOwnProp(c,n)?c[n]:i,s=o(rt.hasOwnProp(e,n)?e[n]:void 0,rt.hasOwnProp(t,n)?t[n]:void 0,n);rt.isUndefined(s)&&o!==a||(r[n]=s)})),r}const tr=["content-type","content-length"];var rr=e=>{const t=er({},e),r=e=>rt.hasOwnProp(t,e)?t[e]:void 0,n=r("data");let i=r("withXSRFToken");const o=r("xsrfHeaderName"),s=r("xsrfCookieName");let a=r("headers");const c=r("auth"),u=r("baseURL"),d=r("allowAbsoluteUrls"),l=r("url");var h;if(t.headers=a=Et.from(a),t.url=wt(qt(u,l,d),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(h=c.password,encodeURIComponent(h).replace(/%([0-9A-F]{2})/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))):""))),rt.isFormData(n)&&(Vt.hasStandardBrowserEnv||Vt.hasStandardBrowserWebWorkerEnv?a.setContentType(void 0):rt.isFunction(n.getHeaders)&&function(e,t,r){"content-only"===r?Object.entries(t).forEach((([t,r])=>{tr.includes(t.toLowerCase())&&e.set(t,r)})):e.set(t)}(a,n.getHeaders(),r("formDataHeaderPolicy"))),Vt.hasStandardBrowserEnv){rt.isFunction(i)&&(i=i(t));if(!0===i||null==i&&Jt(t.url)){const e=o&&s&&Qt.read(s);e&&a.set(o,e)}}return t};var nr="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const n=rr(e);let i=n.data;const o=Et.from(n.headers).normalize();let s,a,c,u,d,{responseType:l,onUploadProgress:h,onDownloadProgress:p}=n;function f(){u&&u(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(s),n.signal&&n.signal.removeEventListener("abort",s)}let E=new XMLHttpRequest;function m(){if(!E)return;const n=Et.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders());Yt((function(e){t(e),f()}),(function(e){r(e),f()}),{data:l&&"text"!==l&&"json"!==l?E.response:E.responseText,status:E.status,statusText:E.statusText,headers:n,config:e,request:E}),E=null}E.open(n.method.toUpperCase(),n.url,!0),E.timeout=n.timeout,"onloadend"in E?E.onloadend=m:E.onreadystatechange=function(){E&&4===E.readyState&&(0!==E.status||E.responseURL&&E.responseURL.startsWith("file:"))&&setTimeout(m)},E.onabort=function(){E&&(r(new gt("Request aborted",gt.ECONNABORTED,e,E)),f(),E=null)},E.onerror=function(t){const n=t&&t.message?t.message:"Network Error",i=new gt(n,gt.ERR_NETWORK,e,E);i.event=t||null,r(i),f(),E=null},E.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||Dt;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new gt(t,i.clarifyTimeoutError?gt.ETIMEDOUT:gt.ECONNABORTED,e,E)),f(),E=null},void 0===i&&o.setContentType(null),"setRequestHeader"in E&&rt.forEach(ut(o),(function(e,t){E.setRequestHeader(t,e)})),rt.isUndefined(n.withCredentials)||(E.withCredentials=!!n.withCredentials),l&&"json"!==l&&(E.responseType=n.responseType),p&&([c,d]=Zt(p,!0),E.addEventListener("progress",c)),h&&E.upload&&([a,u]=Zt(h),E.upload.addEventListener("progress",a),E.upload.addEventListener("loadend",u)),(n.cancelToken||n.signal)&&(s=t=>{E&&(r(!t||t.type?new Kt(null,e,E):t),E.abort(),f(),E=null)},n.cancelToken&&n.cancelToken.subscribe(s),n.signal&&(n.signal.aborted?s():n.signal.addEventListener("abort",s)));const _=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(n.url);!_||Vt.protocols.includes(_)?E.send(i||null):r(new gt("Unsupported protocol "+_+":",gt.ERR_BAD_REQUEST,e))}))};var ir=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const i=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof gt?t:new Kt(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,i(new gt(`timeout of ${t}ms exceeded`,gt.ETIMEDOUT))}),t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)})),e=null)};e.forEach((e=>e.addEventListener("abort",i)));const{signal:a}=r;return a.unsubscribe=()=>rt.asap(s),a};const or=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,i=0;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},sr=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()}},ar=(e,t,r,n)=>{const i=async function*(e,t){for await(const r of sr(e))yield*or(r,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await i.next();if(t)return a(),void e.close();let o=n.byteLength;if(r){let e=s+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})};const cr="1.16.1",{isFunction:ur}=rt,dr=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},lr=e=>{const t=void 0!==rt.global&&null!==rt.global?rt.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=rt.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:i,Request:o,Response:s}=e,a=i?ur(i):"function"==typeof fetch,c=ur(o),u=ur(s);if(!a)return!1;const d=a&&ur(r),l=a&&("function"==typeof n?(h=new n,e=>h.encode(e)):async e=>new Uint8Array(await new o(e).arrayBuffer()));var h;const p=c&&d&&dr((()=>{let e=!1;const t=new o(Vt.origin,{body:new r,method:"POST",get duplex(){return e=!0,"half"}}),n=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!n})),f=u&&d&&dr((()=>rt.isReadableStream(new s("").body))),E={stream:f&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!E[e]&&(E[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new gt(`Response type '${e}' is not supported`,gt.ERR_NOT_SUPPORT,r)})}));const m=async(e,t)=>{const r=rt.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(rt.isBlob(e))return e.size;if(rt.isSpecCompliantForm(e)){const t=new o(Vt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return rt.isArrayBufferView(e)||rt.isArrayBuffer(e)?e.byteLength:(rt.isURLSearchParams(e)&&(e+=""),rt.isString(e)?(await l(e)).byteLength:void 0)})(t):r};return async e=>{let{url:t,method:r,data:a,signal:u,cancelToken:d,timeout:l,onDownloadProgress:h,onUploadProgress:_,responseType:T,headers:g,withCredentials:S="same-origin",fetchOptions:y,maxContentLength:v,maxBodyLength:R}=rr(e);const A=rt.isNumber(v)&&v>-1,b=rt.isNumber(R)&&R>-1;let O=i||fetch;T=T?(T+"").toLowerCase():"text";let I=ir([u,d&&d.toAbortSignal()],l),C=null;const w=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let N;try{if(A&&"string"==typeof t&&t.startsWith("data:")){const r=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let e=n.length;const t=n.length;for(let r=0;r<t;r++)if(37===n.charCodeAt(r)&&r+2<t){const t=n.charCodeAt(r+1),i=n.charCodeAt(r+2);(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102)&&(e-=2,r+=2)}let r=0,i=t-1;const o=e=>e>=2&&37===n.charCodeAt(e-2)&&51===n.charCodeAt(e-1)&&(68===n.charCodeAt(e)||100===n.charCodeAt(e));i>=0&&(61===n.charCodeAt(i)?(r++,i--):o(i)&&(r++,i-=3)),1===r&&i>=0&&(61===n.charCodeAt(i)||o(i))&&r++;const s=3*Math.floor(e/4)-(r||0);return s>0?s:0}if("undefined"!=typeof Buffer&&"function"==typeof Buffer.byteLength)return Buffer.byteLength(n,"utf8");let i=0;for(let e=0,t=n.length;e<t;e++){const r=n.charCodeAt(e);if(r<128)i+=1;else if(r<2048)i+=2;else if(r>=55296&&r<=56319&&e+1<t){const t=n.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i}(t);if(r>v)throw new gt("maxContentLength size of "+v+" exceeded",gt.ERR_BAD_RESPONSE,e,C)}if(b&&"get"!==r&&"head"!==r){const t=await m(g,a);if("number"==typeof t&&isFinite(t)&&t>R)throw new gt("Request body larger than maxBodyLength limit",gt.ERR_BAD_REQUEST,e,C)}if(_&&p&&"get"!==r&&"head"!==r&&0!==(N=await m(g,a))){let e,r=new o(t,{method:"POST",body:a,duplex:"half"});if(rt.isFormData(a)&&(e=r.headers.get("content-type"))&&g.setContentType(e),r.body){const[e,t]=zt(N,Zt(Xt(_)));a=ar(r.body,65536,e,t)}}rt.isString(S)||(S=S?"include":"omit");const i=c&&"credentials"in o.prototype;if(rt.isFormData(a)){const e=g.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&g.delete("content-type")}g.set("User-Agent","axios/"+cr,!1);const u={...y,signal:I,method:r.toUpperCase(),headers:ut(g.normalize()),body:a,duplex:"half",credentials:i?S:void 0};C=c&&new o(t,u);let d=await(c?O(C,y):O(t,u));if(A){const t=rt.toFiniteNumber(d.headers.get("content-length"));if(null!=t&&t>v)throw new gt("maxContentLength size of "+v+" exceeded",gt.ERR_BAD_RESPONSE,e,C)}const l=f&&("stream"===T||"response"===T);if(f&&d.body&&(h||A||l&&w)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=d[e]}));const r=rt.toFiniteNumber(d.headers.get("content-length")),[n,i]=h&&zt(r,Zt(Xt(h),!0))||[];let o=0;const a=t=>{if(A&&(o=t,o>v))throw new gt("maxContentLength size of "+v+" exceeded",gt.ERR_BAD_RESPONSE,e,C);n&&n(t)};d=new s(ar(d.body,65536,a,(()=>{i&&i(),w&&w()})),t)}T=T||"text";let D=await E[rt.findKey(E,T)||"text"](d,e);if(A&&!f&&!l){let t;if(null!=D&&("number"==typeof D.byteLength?t=D.byteLength:"number"==typeof D.size?t=D.size:"string"==typeof D&&(t="function"==typeof n?(new n).encode(D).byteLength:D.length)),"number"==typeof t&&t>v)throw new gt("maxContentLength size of "+v+" exceeded",gt.ERR_BAD_RESPONSE,e,C)}return!l&&w&&w(),await new Promise(((t,r)=>{Yt(t,r,{data:D,headers:Et.from(d.headers),status:d.status,statusText:d.statusText,config:e,request:C})}))}catch(t){if(w&&w(),I&&I.aborted&&I.reason instanceof gt){const r=I.reason;throw r.config=e,C&&(r.request=C),t!==r&&(r.cause=t),r}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new gt("Network Error",gt.ERR_NETWORK,e,C,t&&t.response),{cause:t.cause||t});throw gt.from(t,t&&t.code,e,C,t&&t.response)}}},hr=new Map,pr=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:i}=t,o=[n,i,r];let s,a,c=o.length,u=hr;for(;c--;)s=o[c],a=u.get(s),void 0===a&&u.set(s,a=c?new Map:lr(t)),u=a;return a};pr();const fr={http:null,xhr:nr,fetch:{get:pr}};rt.forEach(fr,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}}));const Er=e=>`- ${e}`,mr=e=>rt.isFunction(e)||null===e||!1===e;var _r={getAdapter:function(e,t){e=rt.isArray(e)?e:[e];const{length:r}=e;let n,i;const o={};for(let s=0;s<r;s++){let r;if(n=e[s],i=n,!mr(n)&&(i=fr[(r=String(n)).toLowerCase()],void 0===i))throw new gt(`Unknown adapter '${r}'`);if(i&&(rt.isFunction(i)||(i=i.get(t))))break;o[r||"#"+s]=i}if(!i){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));let t=r?e.length>1?"since :\n"+e.map(Er).join("\n"):" "+Er(e[0]):"as no adapter specified";throw new gt("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return i},adapters:fr};function Tr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Kt(null,e)}function gr(e){Tr(e),e.headers=Et.from(e.headers),e.data=Gt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return _r.getAdapter(e.adapter||Wt.adapter,e)(e).then((function(t){Tr(e),e.response=t;try{t.data=Gt.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=Et.from(t.headers),t}),(function(t){if(!Ht(t)&&(Tr(e),t&&t.response)){e.response=t.response;try{t.response.data=Gt.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=Et.from(t.response.headers)}return Promise.reject(t)}))}const Sr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Sr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const yr={};Sr.transitional=function(e,t,r){function n(e,t){return"[Axios v"+cr+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new gt(n(i," has been removed"+(t?" in "+t:"")),gt.ERR_DEPRECATED);return t&&!yr[i]&&(yr[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,o)}},Sr.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var vr={assertOptions:function(e,t,r){if("object"!=typeof e)throw new gt("options must be an object",gt.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],s=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new gt("option "+o+" must be "+r,gt.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new gt("Unknown option "+o,gt.ERR_BAD_OPTION)}},validators:Sr};const Rr=vr.validators;let Ar=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Nt,response:new Nt}}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=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(r){const t=r.indexOf("\n"),n=-1===t?-1:r.indexOf("\n",t+1),i=-1===n?"":r.slice(n+1);String(e.stack).endsWith(i)||(e.stack+="\n"+r)}}else e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=er(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&vr.assertOptions(r,{silentJSONParsing:Rr.transitional(Rr.boolean),forcedJSONParsing:Rr.transitional(Rr.boolean),clarifyTimeoutError:Rr.transitional(Rr.boolean),legacyInterceptorReqResOrdering:Rr.transitional(Rr.boolean)},!1),null!=n&&(rt.isFunction(n)?t.paramsSerializer={serialize:n}:vr.assertOptions(n,{encode:Rr.function,serialize:Rr.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),vr.assertOptions(t,{baseUrl:Rr.spelling("baseURL"),withXsrfToken:Rr.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&rt.merge(i.common,i[t.method]);i&&rt.forEach(["delete","get","head","post","put","patch","query","common"],(e=>{delete i[e]})),t.headers=Et.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const r=t.transitional||Dt;r&&r.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let d,l=0;if(!a){const e=[gr.bind(this),void 0];for(e.unshift(...s),e.push(...c),d=e.length,u=Promise.resolve(t);l<d;)u=u.then(e[l++],e[l++]);return u}d=s.length;let h=t;for(;l<d;){const e=s[l++],t=s[l++];try{h=e(h)}catch(e){t.call(this,e);break}}try{u=gr.call(this,h)}catch(e){return Promise.reject(e)}for(l=0,d=c.length;l<d;)u=u.then(c[l++],c[l++]);return u}getUri(e){return wt(qt((e=er(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};rt.forEach(["delete","get","head","options"],(function(e){Ar.prototype[e]=function(t,r){return this.request(er(r||{},{method:e,url:t,data:(r||{}).data}))}})),rt.forEach(["post","put","patch","query"],(function(e){function t(t){return function(r,n,i){return this.request(er(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Ar.prototype[e]=t(),"query"!==e&&(Ar.prototype[e+"Form"]=t(!0))}));var br=Ar;class Or{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 n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new Kt(e,n,i),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 Or((function(t){e=t})),cancel:e}}}var Ir=Or;const Cr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Cr).forEach((([e,t])=>{Cr[t]=e}));var wr=Cr;const Nr=function e(t){const r=new br(t),n=le(br.prototype.request,r);return rt.extend(n,br.prototype,r,{allOwnKeys:!0}),rt.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(er(t,r))},n}(Wt);Nr.Axios=br,Nr.CanceledError=Kt,Nr.CancelToken=Ir,Nr.isCancel=Ht,Nr.VERSION=cr,Nr.toFormData=At,Nr.AxiosError=gt,Nr.Cancel=Nr.CanceledError,Nr.all=function(e){return Promise.all(e)},Nr.spread=function(e){return function(t){return e.apply(null,t)}},Nr.isAxiosError=function(e){return rt.isObject(e)&&!0===e.isAxiosError},Nr.mergeConfig=er,Nr.AxiosHeaders=Et,Nr.formToJSON=e=>Ft(rt.isHTMLForm(e)?new FormData(e):e),Nr.getAdapter=_r.getAdapter,Nr.HttpStatusCode=wr,Nr.default=Nr;var Dr=Nr;let Pr=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}({}),Lr=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 kr=new de;let Mr=kr.getResult(),Ur=null;function xr(e){if(!Ur){e&&kr.setUA(e),Mr=kr.getResult();const t=function(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return Lr.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return Lr.CHROME;case"Safari":case"Mobile Safari":return Lr.SAFARI;case"Edge":return Lr.EDGE;case"Firefox":return Lr.FIREFOX;case"QQ":case"QQBrowser":return Lr.QQ;case"Opera":return Lr.OPERA;case"WeChat":return Lr.WECHAT;default:return e.browser.name||""}}(Mr),r=Vr(Mr),n=function(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}(Mr),i=Mr.os.version,o=Vr(Mr,!1),s=Mr.device.type;if(!(t&&r&&n&&i))return{name:t,version:r,os:n,osVersion:i,browserVersion:o,deviceType:s};Ur={name:t,version:r,os:n,osVersion:i,browserVersion:o,deviceType:s}}return Ur}function Vr(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 Fr(){return xr().os}function Br(){const e=xr();return"".concat(e.os," ").concat(e.osVersion)}function jr(){const e=xr();return!!("WebKit"===Mr.engine.name&&e.os===Pr.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==Lr.SAFARI||Yr()&&e.name!==Lr.SAFARI)}function Wr(){return xr().name===Lr.CHROME}function Gr(){return xr().name===Lr.SAFARI}function Hr(){return xr().name===Lr.EDGE}function Kr(){return xr().name===Lr.FIREFOX}function Yr(){return xr().os===Pr.IOS}function Zr(e){const t=xr();return!(t.name!==Lr.CHROME||!t.osVersion)&&Number(t.version)>=e}function zr(e,t,r){const n=xr();return!(n.name!==e||!n.osVersion)&&(r?Number(n.version)>=t&&Number(n.version)<=r:Number(n.version)===t)}function Xr(e){const t=xr();return!(t.name!==Lr.EDGE||!t.osVersion)&&Number(t.version)>=e}function Jr(e){const t=xr();return!(t.name!==Lr.FIREFOX||!t.osVersion)&&Number(t.version)>=e}function Qr(e){const t=xr();return!(t.name!==Lr.OPERA||!t.osVersion)&&Number(t.version)>=e}function qr(){const e=xr();if(e.os!==Pr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function $r(){const e=xr();if(e.os!==Pr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function en(){const e=xr();if(e.os!==Pr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function tn(){return Gr()&&navigator.maxTouchPoints>0}function rn(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function nn(){const e=Fr();return function(){const e=xr().deviceType;return"mobile"===e||"tablet"===e}()||e===Pr.ANDROID||e===Pr.IOS||e===Pr.HARMONY_OS}function on(){const e=xr();return e.name!==Lr.EDGE&&e.name!==Lr.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function sn(){return Fr()===Pr.ANDROID}function an(){const e=xr();return sn()&&(e.name===Lr.CHROME||e.name===Lr.WECHAT||/chrome|chromium/i.test(navigator.userAgent))}function cn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}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 n=r.call(e,"string");if("object"!=typeof n)return n;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 dn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ln(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dn(Object(r),!0).forEach((function(t){un(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function hn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return cn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?cn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let pn=function(e){return e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",e.PB_ERROR="PB_ERROR",e.TIMEOUT="TIMEOUT",e.INVALID_PARAMS="INVALID_PARAMS",e.NOT_READABLE="NOT_READABLE",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INVALID_OPERATION="INVALID_OPERATION",e.OPERATION_ABORTED="OPERATION_ABORTED",e.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",e.EXCHANGE_SDP_FAILED="EXCHANGE_SDP_FAILED",e.ADD_CANDIDATE_FAILED="ADD_CANDIDATE_FAILED",e.DATACHANNEL_FAILED="DATACHANNEL_FAILED",e.NETWORK_ERROR="NETWORK_ERROR",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",e.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",e.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",e.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",e.ELECTRON_IS_NULL="ELECTRON_IS_NULL",e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",e.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",e.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",e.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",e.PERMISSION_DENIED="PERMISSION_DENIED",e.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",e.TRACK_IS_DISABLED="TRACK_IS_DISABLED",e.GET_VIDEO_ELEMENT_VISIBLE_ERROR="GET_VIDEO_ELEMENT_VISIBLE_ERROR",e.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",e.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",e.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",e.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",e.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",e.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",e.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",e.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",e.UID_CONFLICT="UID_CONFLICT",e.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",e.UPDATE_TICKET_FAILED="UPDATE_TICKET_FAILED",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.INVALID_LOCAL_TRACK="INVALID_LOCAL_TRACK",e.INVALID_TRACK="INVALID_TRACK",e.SENDER_NOT_FOUND="SENDER_NOT_FOUND",e.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",e.SET_ANSWER_FAILED="SET_ANSWER_FAILED",e.ICE_FAILED="ICE_FAILED",e.PC_CLOSED="PC_CLOSED",e.SENDER_REPLACE_FAILED="SENDER_REPLACE_FAILED",e.GET_LOCAL_CAPABILITIES_FAILED="GET_LOCAL_CAPABILITIES_FAILED",e.GET_LOCAL_CONNECTION_PARAMS_FAILED="GET_LOCAL_CONNECTION_PARAMS_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",e.NO_ICE_CANDIDATE="NO_ICE_CANDIDATE",e.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",e.EXIST_DISABLED_VIDEO_TRACK="EXIST_DISABLED_VIDEO_TRACK",e.INVALID_REMOTE_USER="INVALID_REMOTE_USER",e.REMOTE_USER_IS_NOT_PUBLISHED="REMOTE_USER_IS_NOT_PUBLISHED",e.CUSTOM_REPORT_SEND_FAILED="CUSTOM_REPORT_SEND_FAILED",e.CUSTOM_REPORT_FREQUENCY_TOO_HIGH="CUSTOM_REPORT_FREQUENCY_TOO_HIGH",e.FETCH_AUDIO_FILE_FAILED="FETCH_AUDIO_FILE_FAILED",e.READ_LOCAL_AUDIO_FILE_ERROR="READ_LOCAL_AUDIO_FILE_ERROR",e.DECODE_AUDIO_FILE_FAILED="DECODE_AUDIO_FILE_FAILED",e.WS_ABORT="WS_ABORT",e.WS_DISCONNECT="WS_DISCONNECT",e.WS_ERR="WS_ERR",e.EXTERNAL_SIGNAL_ABORT="EXTERNAL_SIGNAL_ABORT",e.LIVE_STREAMING_TASK_CONFLICT="LIVE_STREAMING_TASK_CONFLICT",e.LIVE_STREAMING_INVALID_ARGUMENT="LIVE_STREAMING_INVALID_ARGUMENT",e.LIVE_STREAMING_INTERNAL_SERVER_ERROR="LIVE_STREAMING_INTERNAL_SERVER_ERROR",e.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED="LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",e.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED="LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",e.LIVE_STREAMING_CDN_ERROR="LIVE_STREAMING_CDN_ERROR",e.LIVE_STREAMING_INVALID_RAW_STREAM="LIVE_STREAMING_INVALID_RAW_STREAM",e.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT="LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",e.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE="LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",e.LIVE_STREAMING_WARN_FREQUENT_REQUEST="LIVE_STREAMING_WARN_FREQUENT_REQUEST",e.WEBGL_INTERNAL_ERROR="WEBGL_INTERNAL_ERROR",e.BEAUTY_PROCESSOR_INTERNAL_ERROR="BEAUTY_PROCESSOR_INTERNAL_ERROR",e.CROSS_CHANNEL_WAIT_STATUS_ERROR="CROSS_CHANNEL_WAIT_STATUS_ERROR",e.CROSS_CHANNEL_FAILED_JOIN_SRC="CROSS_CHANNEL_FAILED_JOIN_SEC",e.CROSS_CHANNEL_FAILED_JOIN_DEST="CROSS_CHANNEL_FAILED_JOIN_DEST",e.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST="CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",e.CROSS_CHANNEL_SERVER_ERROR_RESPONSE="CROSS_CHANNEL_SERVER_ERROR_RESPONSE",e.METADATA_OUT_OF_RANGE="METADATA_OUT_OF_RANGE",e.LOCAL_AEC_ERROR="LOCAL_AEC_ERROR",e.INVALID_PLUGIN="INVALID_PLUGIN",e.DISCONNECT_P2P="DISCONNECT_P2P",e.CONVERTING_IMAGEDATA_TO_BLOB_FAILED="CONVERTING_IMAGEDATA_TO_BLOB_FAILED",e.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED="CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED",e.INIT_DATACHANNEL_TIMEOUT="INIT_DATACHANNEL_TIMEOUT",e.CREATE_DATACHANNEL_ERROR="CREATE_DATACHANNEL_ERROR",e.DATACHANNEL_CONNECTION_TIMEOUT="DATACHANNEL_CONNECTION_TIMEOUT",e.PROHIBITED_OPERATION="PROHIBITED_OPERATION",e.IMAGE_MODERATION_UPLOAD_FAILED="IMAGE_MODERATION_UPLOAD_FAILED",e.P2P_MESSAGE_FAILED="P2P_MESSAGE_FAILED",e}({});class fn 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),un(this,"code",void 0),un(this,"message",void 0),un(this,"data",void 0),un(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 En(e,t){if("boolean"!=typeof e)throw new fn(pn.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function mn(e,t,r){if(!r.includes(e))throw new fn(pn.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(r)))}function _n(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e4;if(e<r||e>n||(!(arguments.length>4&&void 0!==arguments[4])||arguments[4])&&!function(e){return"number"==typeof e&&e%1==0}(e))throw new fn(pn.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function Tn(e,t){if("number"!=typeof e){if(!(e.min||e.max||e.ideal||e.exact))throw new fn(pn.INVALID_PARAMS,"".concat(t," is not a valid ConstrainLong"));void 0!==e.min&&_n(e.min,"".concat(t,".min"),0,1/0),void 0!==e.max&&_n(e.max,"".concat(t,".max"),1,1/0),void 0!==e.exact&&_n(e.exact,"".concat(t,".exact"),1,1/0),void 0!==e.ideal&&_n(e.ideal,"".concat(t,".ideal"),1,1/0)}else _n(e,t,1,1/0)}function gn(e){return null==e}var Sn=function(e){return e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE",e}(Sn||{}),yn=function(e){return e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT",e}(yn||{});const vn=new class{constructor(){un(this,"_clientSize",null),un(this,"getClientWidth",(()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth)),un(this,"getClientHeight",(()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight)),un(this,"getStyle",(e=>window.getComputedStyle(e,null))),un(this,"checkCssVisibleProperty",(e=>{let t=!0;const r=this.getStyle(e),n=r.display,i=r.visibility,o=r.opacity,s=r.filter;return("none"===n||["hidden","collapse"].includes(i)||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=hn(e.split(/\(|\)/),2),r=t[0],n=t[1];return[r,Number(n.match(/^[0-9\.]+/))]})).forEach((e=>{const r=hn(e,2),n=r[0],i=r[1];switch(n){case"brightness":(i<.1||i>3)&&(t=!1);break;case"blur":i>3&&(t=!1);break;case"opacity":i<.1&&(t=!1)}})),t)})),un(this,"checkPropertyUpToAllParentNodes",((e,t)=>{let r=!0,n=!0;const i=e=>t(e);let o=e;for(;o&&n;)i(o)||(r=!1,n=!1),o=o.parentElement,o||(n=!1);return r})),un(this,"checkActualCssVisibleIncludeInherit",(e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty))),un(this,"getSizeAboutClient",(e=>{const t=e.getBoundingClientRect(),r=t.width,n=t.height,i=t.left,o=t.right,s=t.top,a=t.bottom,c=this.getClientWidth(),u=this.getClientHeight();return{width:r,height:n,left:i,right:o,top:s,bottom:a,clientWidth:c,clientHeight:u,clientMin:Math.min(c,u)}})),un(this,"checkActualSize",(()=>{const e=this._clientSize,t=e.width,r=e.height,n=e.clientMin;return this.checkSizeIsVisible(t,r,n)})),un(this,"elementFromPoint",((e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null)),un(this,"checkCoverForAPoint",((e,t,r)=>{const n=this.elementFromPoint(e,t);return null!==n&&n!==r})),un(this,"getPointPositionList",(()=>{const e=this._clientSize,t=e.width,r=e.height,n=e.left,i=e.top,o=t/6,s=r/6,a=[],c=10**6;for(let e=0;e<5;e++)for(let t=0;t<5;t++){const r=(n*c+(0===e?.1:4===e?(o*e*c-1e5)/c:o*e)*c)/c,u=(i*c+(0===t?.1:4===t?(s*t*c-1e5)/c:s*t)*c)/c;a.push({x:r,y:u})}return[...a]})),un(this,"checkElementCover",(e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((e=>!!e)).length>6)),un(this,"checkSizeIsVisible",((e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10))),un(this,"checkSizeOfPartInClient",(()=>{const e=this._clientSize,t=e.left,r=e.right,n=e.top,i=e.bottom,o=e.clientHeight,s=e.clientWidth,a=e.clientMin;let c,u,d,l;if(t<0)c=0;else{if(!(t<s))return!1;c=t}if(r<0)return!1;if(u=r<s?r:s,n<0)d=0;else{if(!(n<o))return!1;d=n}if(i<0)return!1;l=i<o?i:o;const h=u-c,p=l-d;return this.checkSizeIsVisible(h,p,a)})),un(this,"returnHiddenResult",(e=>(this._clientSize=null,{visible:!1,reason:e}))),un(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(Sn.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(Sn.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(Sn.SIZE)}}return this.returnHiddenResult(Sn.STYLE)}return this.returnHiddenResult(yn.UNMOUNTED)}return this.returnHiddenResult(yn.INVALID_HTML_ELEMENT)})),un(this,"checkElementIsMountedOnDom",(e=>this.checkPropertyUpToAllParentNodes(e,(e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))))}};const Rn=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 An{constructor(){un(this,"_events",{}),un(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],n=this._indexOfListener(r,t);-1!==n&&r.splice(n,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,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(let r=0;r<t.length;r+=1){const i=t[r];i.once&&this.off(e,i.listener),i.listener.apply(this,n||[])}}safeEmit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];[...this._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 bn(){return!!In()}let On=null;function In(){if(On)return On;if(window.electron)return On=window.electron;if(!window.require)return null;try{return On=window.require("electron"),On}catch(e){return null}}let Cn=function(e){return e.CREATE_CLIENT="createClient",e.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",e.SET_AREA="setArea",e.PRELOAD="PRELOAD",e.CHECK_VIDEO_TRACK_IS_ACTIVE="checkVideoTrackIsActive",e.CHECK_AUDIO_TRACK_IS_ACTIVE="checkAudioTrackIsActive",e.CREATE_MIC_AUDIO_TRACK="createMicrophoneAudioTrack",e.CREATE_CUSTOM_AUDIO_TRACK="createCustomAudioTrack",e.CREATE_BUFFER_AUDIO_TRACK="createBufferSourceAudioTrack",e.CREATE_CAM_VIDEO_TRACK="createCameraVideoTrack",e.CREATE_CUSTOM_VIDEO_TRACK="createCustomVideoTrack",e.CREATE_MIC_AND_CAM_TRACKS="createMicrophoneAndCameraTracks",e.CREATE_SCREEN_VIDEO_TRACK="createScreenVideoTrack",e.SET_ENCRYPTION_CONFIG="Client.setEncryptionConfig",e.START_PROXY_SERVER="Client.startProxyServer",e.STOP_PROXY_SERVER="Client.stopProxyServer",e.SET_PROXY_SERVER="Client.setProxyServer",e.SET_TURN_SERVER="Client.setTurnServer",e.SET_CLIENT_ROLE="Client.setClientRole",e.SET_LOW_STREAM_PARAMETER="Client.setLowStreamParameter",e.ENABLE_DUAL_STREAM="Client.enableDualStream",e.DISABLE_DUAL_STREAM="Client.disableDualStream",e.JOIN="Client.join",e.LEAVE="Client.leave",e.PUBLISH="Client.publish",e.UNPUBLISH="Client.unpublish",e.SUBSCRIBE="Client.subscribe",e.MASS_SUBSCRIBE="Client.massSubscribe",e.MASS_UNSUBSCRIBE="Client.massUnsubscribe",e.UNSUBSCRIBE="Client.unsubscribe",e.RENEW_TOKEN="Client.renewToken",e.SET_REMOTE_VIDEO_STREAM_TYPE="Client.setRemoteVideoStreamType",e.SET_STREAM_FALLBACK_OPTION="Client.setStreamFallbackOption",e.ENABLE_AUDIO_VOLUME_INDICATOR="Client.enableAudioVolumeIndicator",e.SEND_CUSTOM_REPORT_MESSAGE="Client.sendCustomReportMessage",e.INSPECT_VIDEO_CONTENT="Client.inspectVideoContent",e.STOP_INSPECT_VIDEO_CONTENT="Client.stopInspectVideoContent",e.JOIN_FALLBACK_TO_PROXY="Client._joinFallbackToProxy",e.ON_LIVE_STREAM_WARNING="Client.onLiveStreamWarning",e.ON_LIVE_STREAM_ERROR="Client.onLiveStreamingError",e.START_LIVE_STREAMING="Client.startLiveStreaming",e.SET_LIVE_TRANSCODING="Client.setLiveTranscoding",e.STOP_LIVE_STREAMING="Client.stopLiveStreaming",e.START_CHANNEL_MEDIA_RELAY="Client.startChannelMediaRelay",e.UPDATE_CHANNEL_MEDIA_RELAY="Client.updateChannelMediaRelay",e.STOP_CHANNEL_MEDIA_RELAY="Client.stopChannelMediaRelay",e.REQUEST_CONFIG_DISTRIBUTE="_config-distribute-request",e.SET_CONFIG_DISTRIBUTE="_configDistribute",e.LOCAL_TRACK_SET_MUTED="LocalTrack.setMute",e.LOCAL_AUDIO_TRACK_PLAY="LocalAudioTrack.play",e.LOCAL_AUDIO_TRACK_PLAY_IN_ELEMENT="LocalAudioTrack.playInElement",e.LOCAL_AUDIO_TRACK_STOP="LocalAudioTrack.stop",e.LOCAL_AUDIO_TRACK_SET_VOLUME="LocalAudioTrack.setVolume",e.MIC_AUDIO_TRACK_SET_DEVICE="MicrophoneAudioTrack.setDevice",e.BUFFER_AUDIO_TRACK_START="BufferSourceAudioTrack.startProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_STOP="BufferSourceAudioTrack.stopProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_PAUSE="BufferSourceAudioTrack.pauseProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_RESUME="BufferSourceAudioTrack.resumeProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_SEEK="BufferSourceAudioTrack.seekAudioBuffer",e.LOCAL_VIDEO_TRACK_PLAY="LocalVideoTrack.play",e.LOCAL_VIDEO_TRACK_STOP="LocalVideoTrack.stop",e.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE="LocalVideoTrack.getVideoElementVisibleStatus",e.LOCAL_VIDEO_TRACK_BEAUTY="LocalVideoTrack.setBeautyEffect",e.LOCAL_VIDEO_SEND_SEI_DATA="LocalVideoTrack.sendSeiData",e.CAM_VIDEO_TRACK_SET_DEVICE="CameraVideoTrack.setDevice",e.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG="CameraVideoTrack.setEncoderConfiguration",e.REMOTE_VIDEO_TRACK_PLAY="RemoteVideoTrack.play",e.REMOTE_VIDEO_TRACK_STOP="RemoteVideoTrack.stop",e.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE="RemoteVideoTrack.getVideoElementVisibleStatus",e.REMOTE_AUDIO_TRACK_PLAY="RemoteAudioTrack.play",e.REMOTE_AUDIO_TRACK_STOP="RemoteAudioTrack.stop",e.REMOTE_AUDIO_SET_VOLUME="RemoteAudioTrack.setVolume",e.REMOTE_AUDIO_SET_OUTPUT_DEVICE="RemoteAudioTrack.setOutputDevice",e.GET_MEDIA_STREAM_TRACK="Track.getMediaStreamTrack",e.STREAM_TYPE_CHANGE="streamTypeChange",e.CONNECTION_STATE_CHANGE="connectionStateChange",e.LOAD_CONFIG_FROM_LOCALSTORAGE="loadConfigFromLocalStorage",e.IMAGE_MODERATION_UPLOAD="imageModerationUpload",e.REPUB_AFTER_PC_CONNECTED="repubAfterPCConnected",e.PRELOAD_MEDIA_FAILED="preloadMediaFailed",e.MISMATCH_DTLS_PARAMETERS="mismatchDtlsParameters",e.MISMATCH_ICE_PARAMETERS="mismatchIceParameters",e.VOS_FALLBACK_CN="vosFallbackCN",e.DATACHANNEL_FAILBACK="datachannelFailback",e}({}),wn=function(e){return e.TRACER="tracer",e}({});!function(e){e[e.AUDIENCE_LEVEL_LOW_LATENCY=1]="AUDIENCE_LEVEL_LOW_LATENCY",e[e.AUDIENCE_LEVEL_ULTRA_LOW_LATENCY=2]="AUDIENCE_LEVEL_ULTRA_LOW_LATENCY",e[e.AUDIENCE_LEVEL_SYNC_LATENCY=3]="AUDIENCE_LEVEL_SYNC_LATENCY"}({}),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.FALLBACK="FALLBACK",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.LICENSE_MISSING="LICENSE_MISSING",e.LICENSE_EXPIRED="LICENSE_EXPIRED",e.LICENSE_MINUTES_EXCEEDED="LICENSE_MINUTES_EXCEEDED",e.LICENSE_PERIOD_INVALID="LICENSE_PERIOD_INVALID",e.LICENSE_MULTIPLE_SDK_SERVICE="LICENSE_MULTIPLE_SDK_SERVICE",e.LICENSE_ILLEGAL="LICENSE_ILLEGAL",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.FALLBACK_TO_HLS="FALLBACK_TO_HLS",e.UID_CONFLICT="UID_CONFLICT"}({}),function(e){e[e.AUTO_SIMULCAST_STREAM=-1]="AUTO_SIMULCAST_STREAM",e[e.DISABLE_SIMULCAST_STREM=0]="DISABLE_SIMULCAST_STREM",e[e.ENABLE_SIMULCAST_STREAM=1]="ENABLE_SIMULCAST_STREAM"}({}),function(e){e.PEERCONNECTION_STATE_CHANGE="peerconnection-state-change",e.AUDIO_METADATA="audio-metadata",e.AUDIO_PTS="audio-pts",e.CONNECTION_STATE_CHANGE="connection-state-change",e.MEDIA_RECONNECT_START="media-reconnect-start",e.MEDIA_RECONNECT_END="media-reconnect-end",e.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",e.USER_JOINED="user-joined",e.USER_LEAVED="user-left",e.USER_PUBLISHED="user-published",e.USER_UNPUBLISHED="user-unpublished",e.USER_INFO_UPDATED="user-info-updated",e.CLIENT_BANNED="client-banned",e.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",e.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",e.VOLUME_INDICATOR="volume-indicator",e.CRYPT_ERROR="crypt-error",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGED="stream-type-changed",e.STREAM_FALLBACK="stream-fallback",e.RECEIVE_METADATA="receive-metadata",e.STREAM_MESSAGE="stream-message",e.LIVE_STREAMING_ERROR="live-streaming-error",e.LIVE_STREAMING_WARNING="live-streaming-warning",e.EXCEPTION="exception",e.ERROR="error",e.P2P_LOST="p2p_lost",e.JOIN_FALLBACK_TO_PROXY="join-fallback-to-proxy",e.CHANNEL_FALLBACK_TO_WEBSOCKET="channel-fallback-to-websocket",e.MEDIA_CONNECTION_TYPE_CHANGE="media-connection-type-change",e.PUBLISHED_USER_LIST="published-user-list",e.USER_LIST="user-list",e.CONTENT_INSPECT_CONNECTION_STATE_CHANGE="content-inspect-connection-state-change",e.CONTENT_INSPECT_ERROR="content-inspect-error",e.CONTENT_INSPECT_RESULT="content-inspect-result",e.IMAGE_MODERATION_CONNECTION_STATE_CHANGE="image-moderation-connection-state-change",e.FALLBACK_TO_HLS="fallback-to-hls",e.FIRST_VIDEO_BUFFER_READY="first-video-buffer-ready",e.FIRST_VIDEO_PRE_RENDER="first-video-pre-render",e.AV1_DECODABLE_RESULT="av1-decodable-result"}({}),function(e){e.CONFIG="config",e.VOSERROR="vos_error",e.AP_ERROR="ap_error"}({}),function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.MULTI_IP="MULTI_IP",e.TIMEOUT="TIMEOUT",e.OFFLINE="OFFLINE",e.LEAVE="LEAVE",e.P2P_FAILED="P2P_FAILED",e.FALLBACK="FALLBACK",e.REGIONAL_DISTRIBUTION="REGIONAL_DISTRIBUTION"}({});let Nn=function(e){return e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({}),Dn=function(e){return e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({});function Pn(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return 0===e.getListeners(t).length?Promise.reject(new fn(pn.UNEXPECTED_ERROR,"can not emit promise")):new Promise(((r,i)=>{e.emit(t,...n,r,i)}))}function Ln(e,t){if(0===e.getListeners(t).length)return Promise.resolve();for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return Pn(e,t,...n)}function kn(e,t){if(0===e.getListeners(t).length)return null;for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return function(e,t){let r=null,n=null;for(var i=arguments.length,o=new Array(i>2?i-2:0),s=2;s<i;s++)o[s-2]=arguments[s];if(e.emit(t,...o,(e=>{r=e}),(e=>{n=e})),null!==n)throw n;if(null===r)throw new fn(pn.UNEXPECTED_ERROR,"handler is not sync");return r}(e,t,...n)}const Mn=new class extends An{set networkState(e){this.emit(Dn.NETWORK_STATE_CHANGE,e,this._networkState),e===Nn.ONLINE?this.emit(Dn.ONLINE):e===Nn.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(Dn.ONLINE,(()=>{this.onlineWaiter=void 0,e(Nn.ONLINE)}))})),this.emit(Dn.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}get isOnline(){return this._networkState===Nn.ONLINE}constructor(){super(),un(this,"_moduleName","network-indicator"),un(this,"_networkState",Nn.ONLINE),un(this,"onlineWaiter",void 0),window.addEventListener("online",(()=>{this.networkState=Nn.ONLINE})),window.addEventListener("offline",(()=>{this.networkState=Nn.OFFLINE}))}},Un=[];for(let e=0;e<256;++e)Un.push((e+256).toString(16).slice(1));const xn="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);let Vn;const Fn=new Uint8Array(16);function Bn(){return xn?xn():function(e,t,r){var n,i,o,s;const a=null!==(n=null!==(i=(e=e||{}).random)&&void 0!==i?i:null===(o=(s=e).rng)||void 0===o?void 0:o.call(s))&&void 0!==n?n:function(){if(!Vn){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Vn=crypto.getRandomValues.bind(crypto)}return Vn(Fn)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError("UUID byte range ".concat(r,":").concat(r+15," is out of buffer bounds"));for(let e=0;e<16;++e)t[r+e]=a[e];return t}return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(Un[e[t+0]]+Un[e[t+1]]+Un[e[t+2]]+Un[e[t+3]]+"-"+Un[e[t+4]]+Un[e[t+5]]+"-"+Un[e[t+6]]+Un[e[t+7]]+"-"+Un[e[t+8]]+Un[e[t+9]]+"-"+Un[e[t+10]]+Un[e[t+11]]+Un[e[t+12]]+Un[e[t+13]]+Un[e[t+14]]+Un[e[t+15]]).toLowerCase()}(a)}(e,t,undefined);var e,t}function jn(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function Wn(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function Gn(e){return JSON.parse(JSON.stringify(e))}function Hn(e){try{return Gn(e)}catch(t){return e}}const Kn={};function Yn(e,t){Kn[t]||(Kn[t]=!0,e())}function Zn(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function zn(e){return new Promise((t=>{window.setTimeout(t,e)}))}function Xn(){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)+Xn(e-r.length,"")}const Jn=()=>{},Qn=new class{constructor(){un(this,"fnMap",new Map)}throttleByKey(e,t,r,n){for(var i=arguments.length,o=new Array(i>4?i-4:0),s=4;s<i;s++)o[s-4]=arguments[s];if(this.fnMap.has(t)){const i=this.fnMap.get(t);if(i.threshold!==r){i.fn(...i.args),clearTimeout(i.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:n})}else i.skipFn&&i.skipFn(...i.args),this.fnMap.set(t,ln(ln({},i),{},{fn:e,args:o,skipFn:n}))}else{const i=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:i,args:o,skipFn:n})}}},qn=Qn.throttleByKey.bind(Qn);function $n(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function ei(e,t){if(!$n(e)||!$n(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 n=0;n<t.length;n++)r[n]=ei(e[n],t[n]);return r}{const r=ln({},e);for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?r[n]=ei(e[n],t[n]):r[n]=t[n]);return r}}function ti(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}function ri(e){return e.reduce(((e,t)=>e+t),0)}let ni=1,ii=console;class oi{static setLogger(e){ii=e}constructor(e,t){un(this,"id",void 0),un(this,"lockingPromise",Promise.resolve()),un(this,"locks",0),un(this,"name",""),un(this,"lockId",void 0),this.lockId=ni++,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,"]"),n="created"===e?"is ".concat(e,"."):"is ".concat(e,", current queue ").concat(this.locks,". ").concat(null!=t?t:"");ii.debug("".concat(r," ").concat(n))}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()}})),n=this.lockingPromise.then((()=>t));return this.lockingPromise=this.lockingPromise.then((()=>r)),n}}function si(e,t){return function(r,n,i){const o=i.value;if("function"!=typeof o)throw new Error("Cannot use mutex on object property.");return i.value=async function(){const r=this[t];if(!r)throw new Error("mutex property key ".concat(t," doesn't exist on ").concat(e));const i=await r.lock("From ".concat(e,".").concat(n));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{i()}},i}}const ai={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function ci(e,t,r,n){const i=Object.assign({},ai,n);let o=i.timeout;const s=async()=>{await function(e){return new Promise((t=>{window.setTimeout(t,e)}))}(o),o*=i.timeoutFactor,o=Math.min(i.maxRetryTimeout,o)};let a=!1;const c=new Promise((async(n,o)=>{t=t||(()=>!1),r=r||(()=>!0);for(let c=0;c<i.maxRetryCount;c+=1){if(a)return o(new fn(pn.OPERATION_ABORTED));try{const r=await e();if(!t(r,c))return n(r);if(c+1===i.maxRetryCount)return n(r);await s()}catch(e){if(!r(e,c))return o(e);if(c+1===i.maxRetryCount)return o(e);await s()}}}));return c.cancel=()=>a=!0,c}let ui=0,di=0;function li(e,t,r,n){return new Promise(((i,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),ui+=Zn(t.data)):r&&(t.data.size?ui+=t.data.size:t.data instanceof FormData?ui+=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?Zn(e):e.size})),t+138}(t.data):ui+=Zn(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,Dr.request(t).then((e=>{"string"==typeof e.data?di+=Zn(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?di+=e.data.byteLength:di+=Zn(JSON.stringify(e.data)),n&&i({data:e.data,headers:e.headers}),i(e.data)})).catch((e=>{Dr.isCancel(e)?o(new fn(pn.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?o(new fn(pn.NETWORK_TIMEOUT,e.message)):e.response?o(new fn(pn.NETWORK_RESPONSE_ERROR,e.response.status)):o(new fn(pn.NETWORK_ERROR,e.message))}))}))}async function hi(e,t){const r=new Blob([t.data],{type:"buffer"});return await li(e,ln(ln({},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 pi=function(e){return e[e.kNone=1]="kNone",e[e.kMillisecondsFromSeconds=1e3]="kMillisecondsFromSeconds",e[e.kBytesToBits=8]="kBytesToBits",e}(pi||{});const fi="websdk_ng_install_id";function Ei(){try{if(yi("INSTALL_ID"))return yi("INSTALL_ID");let e=window.localStorage.getItem(fi);return e||(e=function(){let e,t=!1;try{e=Bn().replaceAll("-","")}catch(e){t=!0}return!t&&e&&32===e.length||(e=Xn(32,"")),e.toUpperCase()}(),window.localStorage.setItem(fi,e)),Si("INSTALL_ID",e),e}catch(e){return}}const mi=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-([0-9]+)/);if(t&&t[1]&&t[2]){const e=t[1],r=t[2];return"".concat(e,".").concat(r)}return"4.0.0.999"}("4.24.5"),_i=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 Ti=function(){const e="us".concat("erna","me"),t="pa".concat("sswo","rd"),r=["t","s","t"];r.splice(1,0,"e");const n=r.join(""),i=[];for(let e=0;e<6;e++)i.push("1");const o=i.join(""),s={};return s[e]=n,s[t]=o,Object.assign(s,{turnServerURL:"",tcpport:3433,udpport:3478,forceturn:!1})}();window.DEFAULT_TURN_CONFIG=Ti;const gi=ln(ln(ln(ln({},{ENABLE_EVENT_REPORT:!0,UPLOAD_LOG:!1,ENABLE_AG_ADAPTATION:!0,FORCE_AG_HIGH_FRAMERATE:!1,FORCE_SUPPORT_AG_ADAPTATION:!1,ENCODER_CONFIG_LIMIT:{},CAMERA_CAPTURE_CONFIG:void 0,ENABLE_PRELOAD:!0,NEW_ICE_RESTART:!0,ICE_RESTART_INTERVAL:1e4,RESTART_SEQUENCE:["udp_tcp_relay","relay"],FIRST_TCP_CANDIDATE:!1,MAX_CONFIG_RETRY:10,ENABLE_CONFIG_RESTORE:!1,CONFIG_RESTORE_ERROR_API:["createClient","Client.join"],CONFIG_ERROR_MONITOR:["INVALID_OPERATION","UNEXPECTED_ERROR"],BLOCKED_CONFIG_MAX_TIME:864e5,FIRST_TCP_CANDIDATE_INTERVAL:1e3,TURN_DOMAIN:"edge.agora.io",TURN_DOMAINS:["edge.agora.io"],USE_TURN_IP:!0,NEW_TURN_MODE:4,NEW_FORCE_TURN:!1,USE_NEW_RENDER_FREEZE_TIME:!0,FLS_FALLBACK_TIMEOUT:3e4,RTE_DETAIL_REPORT_INTERVAL:6e4,ENCODE_EXCEPTION_TIMES:5,ENABLE_ENCODE_EXCEPTION:!0,ENCODE_EXCEPTION_VALIDATE_CODEC:["h264"],VIDEO_ENCODER_CONFIG_LIST:[{width:240,height:180},{width:320,height:240},{width:400,height:300},{width:480,height:360},{width:560,height:420},{width:640,height:480}],DELETE_NEQ_AFTER_USER_LEAVE:!0,UPDATE_RTP_CAP_IN_HOST:!1,IOS_BG_TAG:!0,IOS_AUTO_RESTART_BG_TAG:!0,IGNORE_UID_CHECK:!1,ENABLE_UP_SPS_PPS:!1,ENABLE_DOWN_SPS_PPS:!0,NO_EDGES_RETRY:!0,BUFFER_READY_FRAMES:3,FLS_SYNC_AV_PLAY_LIMIT:0,FLS_BUFFER_WAIT_TIME:1500,VOS_CONFIGURE:void 0,ENABLE_QUALITY_FALLBACK:!1,QUALITY_FALLBACK_REHEARSAL:!0,ENABLE_FLS_AV1_FIRST:!1,ENABLE_AP_MULTI_IP:!0,FLS_ENABLE_AV1_DETECT:!0,FLS_ENABLE_AV1_DECODE_DETECT:!0,ENABLE_SDP_ENDPOINT_LOG:!1,REMOTE_VIDEO_FREEZE_TIME_VERSION:2}),{},{PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],SDP_ENDPOINT_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],SDP_ENDPOINT_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,NOT_REPORT_EVENT:[],PING_PONG_TIME_OUT:10,WEBSOCKET_TIMEOUT_MIN:1e4,EVENT_REPORT_SEND_INTERVAL:3e3,CONFIG_DISTRIBUTE_INTERVAL:3e5,ENABLE_CONFIG_DISTRIBUTE:!0,CANDIDATE_TIMEOUT:5e3,SHOW_REPORT_INVOKER_LOG:!1,SHOW_REPORT_USER_INVOKER_LOG:!0,JOIN_EXTEND:"",PUB_EXTEND:"",SUB_EXTEND:"",FORCE_TURN:!1,TURN_ENABLE_TCP:!0,TURN_ENABLE_UDP:!0,MAX_UPLOAD_CACHE:50,UPLOAD_CACHE_INTERVAL:2e3,AJAX_REQUEST_CONCURRENT:3,REPORT_APP_SCENARIO:void 0,GATEWAY_DOMAINS:["edge.agora.io","edge.sd-rtn.com"],CONNECT_GATEWAY_WITHOUT_DOMAIN:!1,WORKER_DOMAIN:"edge.agora.io",EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,GET_VOLUME_OF_MUTED_AUDIO_TRACK:!1,STATS_UPDATE_INTERVAL:250,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,CHECK_VIDEO_VISIBLE_INTERVAL:3e4,CHECK_LOCAL_STATS_INTERVAL:250,PROFILE_SWITCH_INTERVAL:2e3,UNSUPPORTED_VIDEO_CODEC:[],ENUMERATE_DEVICES_INTERVAL:!1,ENUMERATE_DEVICES_INTERVAL_TIME:1e4,USE_NEW_TOKEN:!1,CLOSE_AFB_FOR_LOCAL_AP:!0,JOIN_MAX_CONCURRENCY:6,JOIN_WITH_FALLBACK_SIGNAL_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE:!1,JOIN_GATEWAY_TRY_443PORT_DURATION:2e3,JOIN_GATEWAY_USE_443PORT_ONLY:!1,JOIN_GATEWAY_USE_DUAL_DOMAIN:!0,JOIN_GATEWAY_FALLBACK_PORT:443,USE_TURN_SERVER_OF_GATEWAY:!1,H264_PROFILE_LEVEL_ID:"",USE_NEW_LOG:!1,LOG_VERSION:3,MEDIA_DEVICE_CONSTRAINTS:null,ENCRYPT_PROXY_USERNAME_AND_PSW:!0,SDP_LOGGING:!1,CSP_DETECTED_HOSTNAME_LIST:["agora.io","sd-rtn.com"],REMOTE_AUDIO_TRACK_USES_WEB_AUDIO:!1,LOCAL_AUDIO_TRACK_USES_WEB_AUDIO:!1,BITRATE_ADAPTER_TYPE:"STANDARD_BITRATE",AI_DENOISER_PARAMETERS:{excludedLinks:[]},ADJUST_3A_FROM_PLUGINS:!0,RAISE_H264_BASELINE_PRIORITY:!0,FILTER_SEND_H264_BASELINE:!1,FIRST_H264_PROFILE_LEVEL_ID:"42001f",FIRST_PACKETIZATION_MODE:"",X_GOOGLE_START_BITRATE:void 0,NEW_REPORT_SERVER:!1,NEW_REPORT_SERVER_DOMAINS:["data-reporting.agora.io","data-reporting.agora.io"],VIDEO_INSPECT_WORKER_MESSAGE_LENGTH_LIMIT:3e5,VIDEO_INSPECT_INTERVAL_MINIMUM:1e3,VIDEO_INSPECT_QUALITY_RATIO:.9,VIDEO_INSPECT_WORKER_MANAGER_HOST:"edge.agora.io",VIDEO_INSPECT_WORKER_MANAGER_PORT:"",VIDEO_INSPECT_WORKER_MANAGER_WSS:"",VIDEO_INSPECT_WORKER_PORT:"",SHOW_VIDEO_INSPECT_WORKER_MESSAGE:!1,STATS_COLLECTOR_PORT:443,FORCE_TURN_TCP:!1,WEBAUDIO_INIT_OPTIONS:void 0,FILTER_VIDEO_FEC:!0,FILTER_AUDIO_FEC:!1,CHROME_DUAL_STREAM_USE_ENCODING:!0,DISABLE_DUAL_STREAM_USE_ENCODING:!1,EXTENSION_USAGE_UPLOAD_INTERVAL:1e4,ICE_RESTART:!0,FINGERPRINT:null,ENABLE_VIDEO_FRAME_CALLBACK:!0,VIDEO_FREEZE_DURATION:500,SPATIALIZER_PARAMETERS:{},UPLOAD_LOG_INTERVAL:3e3,UPLOAD_LOG_REQUEST_RETRY_INTERVAL:2e3,UPLOAD_LOG_REQUEST_MAX_RETRY_INTERVAL:2e4,UPLOAD_LOG_TRY_INTERVAL_WHILE_OFF:5e3,UPLOAD_LOG_RETRY_INTERVAL_V1:1e4,UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1:200,UPLOAD_LOG_LENGTH_EACH_TIME:10,APP_TYPE:0,DISABLE_WEBAUDIO:!1,CHANNEL_MEDIA_RELAY_SERVERS:void 0,KEEP_LAST_FRAME:!0,FORWARD_P2P_CREATION:!0,SYNC_GROUP:!0,BLOCK_LOCAL_CLIENT:!1,ENABLE_AUDIO_TOPN:!1,ENABLE_AUDIO_METADATA:!1,ENABLE_AUDIO_PTS:!1,TOPN_SMOOTH_LEVEL:void 0,TOPN_NEW_SPEAKER_DELAY:void 0,TOPN_SWITCH_HOLD_MS:void 0,TOPN_AUDIO_GAIN:void 0,TOPN_SILENCE_THRESHOLD:250,AP_AREA:!0,ENABLE_ENCODED_TRANSFORM:!1,ENABLE_VIDEO_SEI:!1,IMAGE_MODERATION_WORKER_HOST:"edge.agora.io",IMAGE_MODERATION_WORKER_WSS:"",IMAGE_MODERATION_WORKER_MESSAGE_LENGTH_LIMIT:3e5,IMAGE_MODERATION_INTERVAL_MINIMUM:1e3,SHOW_IMAGE_MODERATION_WORKER_MESSAGE:!1,IMAGE_MODERATION_QUALITY_RATIO:.9,IMAGE_MODERATION_UPLOAD_REPORT_INTERVAL:5e3,SHOW_GLOBAL_CLIENT_LIST:!1,DATASTREAM_MAX_RETRANSMITS:10,TCP_CANDIDATE_ONLY:!1,EXTERNAL_SIGNAL_REQUEST_TIMEOUT:3e3,SHOW_P2P_LOG:!1,MAX_P2P_TIMEOUT:3e4,P2P_TOKEN_INTERVAL:1e3,SHOW_DATASTREAM2_LOG:!1,RESTRICTION_SET_PLAYBACK_DEVICE:!0,USE_PURE_ENCRYPTION_MASTER_KEY:!1,ENABLE_AUDIO_RED:!1,OPUS_PTIME:void 0,AUDIO_DUPLICATE_NUM:void 0,ENABLE_ABSSENDTIME_AS_SENTTS:!0,ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,FILEPATH_LENMAX:255,DUALSTREAM_OPERATION_CHECK:!0,MEDIA_ELEMENT_EXISTS_DEPTH:3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,STATS_FILTER:{transportId:!0,googTrackId:!0},FILTER_VIDEO_CODEC:[],SIGNAL_CHANNEL:0,TRANSMITTER_INITIAL_RTT:30,TRANSMITTER_INITIAL_RTO:30,TRANSMITTER_MAX_BATCH_ACK_COUNT:2,TRANSMITTER_MAX_RTO:500,DATACHANNEL_COMPRESS:!1,DC_JOIN_WITH_FAILBACK:4e3,DC_CONNECTION_TIMEOUT:2e3,DC_PINGPONG_INTERVAL:2e3,DC_DEBUG_LOG:!1,UNSUPPORTED_VIDEO_UPLINK_CODEC:[],UNSUPPORTED_VIDEO_DOWNLINK_CODEC:[],USE_NEW_NETWORK_CONFIG:!1,AUTO_RESET_AUDIO_ROUTE:!1,PLUGIN_INFO:[],OVERUSE_DETECTOR_PARAMS:{MIN_FRAME_RATE:1,MAX_FRAME_RATE:30,MAX_THRESHOLD_FRAMERATE:30,BITRATE_MIN_THRESHOLD:100,BITRATE_MAX_THRESHOLD:100,MAX_SCALE:5,BWE_SCALE_UP_THRESHOLD:.6,BWE_SCALE_DOWN_THRESHOLD:.6,PERF_SCALE_UP_THRESHOLD:.7,PERF_SCALE_DOWN_THRESHOLD:.6,MOTION_RESOLUTION_FACTOR:.8,MOTION_BITRATE_FACTOR:.6,DETAIL_FRAMERATE_FACTOR:.8,DETAIL_BITRATE_FACTOR:.6,BALANCE_RESOLUTION_FACTOR:.9,BALANCE_FRAMERATE_FACTOR:.9,BALANCE_BITRATE_FACTOR:.6,OVERUSE_TIMES_THRESHOLD:10,UNDERUSE_TIMES_THRESHOLD:40},CUSTOM_ADAPTATION_DEFAULT_MODE:"",HIDE_NO_POSTER:!1,AP_CACHE_NUM:10,AP_UPDATE_INTERVAL:12e4,AP_CACHE_LIFETIME:12e4,MAX_PRELOAD_ASYNC_LENGTH:3,DISABLE_SCREEN_SHARE_REMB:!1},{ENABLE_PUBLISHED_USER_LIST:!0,ENABLE_USER_LIST:!1,MAX_SUBSCRIPTION:50,SUBSCRIBE_AUDIO_FILTER_TOPN:void 0,ENABLE_PUBLISH_AUDIO_FILTER:void 0,ENABLE_USER_LICENSE_CHECK:!0,DISABLE_FEC:void 0,ENABLE_NTP_REPORT:!0,ENABLE_INSTANT_VIDEO:!1,ENABLE_USER_AUTO_REBALANCE_CHECK:!0,ENABLE_LOSSBASED_BWE:!0,ENABLE_AUT_CC:!0,FORCE_ENABLE_AUT_CC:!1,ENABLE_CC_FALLBACK:void 0,SUBSCRIBE_TWCC:!0,PUBLISH_TWCC:!1,ENABLE_SVC_DEFAULT_CODECS:["H264","VP8","VP9","AV1"],SVC:[],ENABLE_FULL_LINK_AV_SYNC:!1,SVC_MODE:null,ENABLE_AUT_FEEDBACK:!0,SVC_EXTENDED:["VP9"],ENABLE_JOIN_V4:!1,ENABLE_AP_COMPRESS:!0}),{},{USE_CANDIDATE_FROM_AP_DETAIL:!1,AP_REQUEST_DETAIL:void 0,ENABLE_ROLE_SELECT_EDGE:!1,CLIENT_ROLE_OPTIONS:void 0,REMOTE_VIDEO_STREAM_TYPE:void 0,COMPATIBLE_SDP_EXTENSION:["gdpr_forbidden"],LIMIT_BITRATE:void 0,EXPERIMENTS:{},USE_PUB_RTX:!0,USE_SUB_RTX:!0,ENABLE_DATASTREAM_2:!1,USE_XR:!0,ENABLE_PREALLOC_PC:!1,ENABLE_PRE_SUB:!1,ENABLE_SVC:!1,ENABLE_FORCE_HLS:!1,MAX_WEBAUDIO_VOLUME:300,ENABLE_VOS_FALLBACK:!1,ENABLE_FALLBACK_TO_HLS:!1,ENABLE_PRE_RENDER:!1,FORCE_DISABLE_AUTO_SUB:!1,ENABLE_PRE_SUB_WITH_PRE_PC:!0,PRE_USE_LOCAL_CODECS:!0},{INSTALL_ID:""}),{},{K_MIN_RENDER_DELAY:66,USE_STANDARD_BITRATE_DEFAULT:!1,VIDEO_NEW_BITRATE_RATIO:void 0,VIDEO_STANDARD_BITRATE_VERSION:2,BASELINE_MORE_H264_BITRATE_RATIO:1.1,IGNORE_RTC_DEVICE_CHECK:!1,FLS_AUTOPLAY_EMITS:!1,ENABLE_DUAL_STREAM_FLAG:!1,FORBID_MODIFY_LOCAL_OFFER_SDP:!1,RESERVE_MID_1_MLINE:!1,PRE_SUB_NUM:1,DC_IN_ESM:!0,PRE_PLAYOUT_DELAY_HINT:void 0});function Si(e,t,r){var n;Object.keys(gi).includes(e)&&(!r&&Object.keys(vi).includes(e)||(gi[e]=t,"ENABLE_VIDEO_SEI"!==e&&"ENABLE_AUDIO_TOPN"!==e&&"ENABLE_AUDIO_METADATA"!==e&&"ENABLE_AUDIO_PTS"!==e||!0!==t||(gi.ENABLE_ENCODED_TRANSFORM=!0),"USE_NEW_NETWORK_CONFIG"===e&&t&&(n=!!t,gi.USE_NEW_NETWORK_CONFIG=n,n&&(gi.WEBCS_DOMAIN=["webrtc2-2.ap.sd-rtn.com"],gi.WEBCS_DOMAIN_BACKUP_LIST=["webrtc2-4.ap.sd-rtn.com"],gi.CDS_AP=["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],gi.ACCOUNT_REGISTER=["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],gi.EVENT_REPORT_DOMAIN="web-2.statscollector.sd-rtn.com",gi.EVENT_REPORT_BACKUP_DOMAIN="statscollector-1.agora.io",gi.GATEWAY_DOMAINS=["edge.sd-rtn.com"])),"ENABLE_PRE_SUB"===e&&t&&(gi.ENABLE_INSTANT_VIDEO=!0,gi.ENABLE_PREALLOC_PC=!0),"ENABLE_SVC"===e&&t&&(gi.ENABLE_AUT_CC=!0),"NEW_FORCE_TURN"===e&&t&&(gi.NEW_TURN_MODE||(gi.NEW_TURN_MODE=4))))}function yi(e){if("TURN_DOMAINS"===e){const e=gi.TURN_DOMAINS;return e.includes(yi("TURN_DOMAIN"))?e:[yi("TURN_DOMAIN")].concat(e)}return gi[e]}_i||(gi.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],gi.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],gi.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],gi.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],gi.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],gi.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],gi.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",gi.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",gi.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",gi.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",gi.AREAS=["NORTH_AMERICA","OVERSEA"]),function(e){e[e.REALTIME=1]="REALTIME"}({});const vi={};var Ri=function(e){return e.SET_SESSION_ID="SET_SESSION_ID",e.SET_RTE_URL="SET_RTE_URL",e.SET_RTE_SID="SET_RTE_SID",e.SET_P2P_ID="SET_P2P_id",e.SET_DC_ID="SET_DC_id",e.SET_UID="SET_UID",e.SET_INT_UID="SET_INT_UID",e.SET_PUB_ID="SET_PUB_ID",e.SET_CLOUD_PROXY_SERVER_MODE="SET_CLOUD_PROXY_SERVER_MODE",e.KEY_METRIC_CLIENT_CREATED="KEY_METRIC_CLIENT_CREATED",e.KEY_METRIC_JOIN_START="KEY_METRIC_JOIN_START",e.KEY_METRIC_PRELOAD_START="KEY_METRIC_PRELOAD_START",e.KEY_METRIC_PRELOAD_END="KEY_METRIC_PRELOAD_END",e.KEY_METRIC_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_REQUEST_SUA_END="KEY_METRIC_REQUEST_SUA_END",e.KEY_METRIC_BEFORE_CONNECT="KEY_METRIC_BEFORE_CONNECT",e.KEY_METRIC_PEER_RECEIVER="KEY_METRIC_PEER_RECEIVER",e.KEY_METRIC_SIGNAL_CONNECTED="KEY_METRIC_SIGNAL_CONNECTED",e.KEY_METRIC_JOIN_REQ="KEY_METRIC_JOIN_REQ",e.KEY_METRIC_JOIN_REP="KEY_METRIC_JOIN_REP",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_FIRST_VIDEO_FRAME_DECODED="KEY_METRIC_FIRST_VIDEO_FRAME_DECODED",e.KEY_METRIC_DESCRIPTION_START="KEY_METRIC_DESCRIPTION_START",e.KEY_METRIC_ICE_CONNECTION_END="KEY_METRIC_ICE_CONNECTION_END",e.KEY_METRIC_SIGNAL_CHANNEL_OPEN="KEY_METRIC_SIGNAL_CHANNEL_OPEN",e.KEY_METRIC_PUBLISH="KEY_METRIC_PUBLISH",e.KEY_METRIC_SUBSCRIBE="KEY_METRIC_SUBSCRIBE",e.RECORD_JOIN_CHANNEL_SERVICE="RECORD_JOIN_CHANNEL_SERVICE",e.RESET_JOIN_CHANNEL_SERVICE_RECORDS="RESET_JOIN_CHANNEL_SERVICE_RECORDS",e.RESET_KEY_METRICS="RESET_KEY_METRICS",e.RESET_FIRST_VIDEO_FRAME_DECODED="RESET_FIRST_VIDEO_FRAME_DECODED",e.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE",e}(Ri||{});function Ai(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function bi(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 n=r.call(e,"string");if("object"!=typeof n)return n;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 Oi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ii(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Oi(Object(r),!0).forEach((function(t){bi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ci(e,t){return Ci=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ci(e,t)}function wi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ai(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ai(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ni(){Ni=function(e,t){return new r(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function r(e,n,i){var o=RegExp(e,n);return t.set(o,i||t.get(e)),Ci(o,r.prototype)}function n(e,r){var n=t.get(r);return Object.keys(n).reduce((function(t,r){var i=n[r];if("number"==typeof i)t[r]=e[i];else{for(var o=0;void 0===e[i[o]]&&o+1<i.length;)o++;t[r]=e[i[o]]}return t}),Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ci(e,t)}(r,RegExp),r.prototype.exec=function(t){var r=e.exec.call(this,t);if(r){r.groups=n(r,this);var i=r.indices;i&&(i.groups=n(i,this))}return r},r.prototype[Symbol.replace]=function(r,i){if("string"==typeof i){var o=t.get(this);return e[Symbol.replace].call(this,r,i.replace(/\$<([^>]+)(>|$)/g,(function(e,t,r){if(""===r)return e;var n=o[t];return Array.isArray(n)?"$"+n.join("$"):"number"==typeof n?"$"+n:""})))}if("function"==typeof i){var s=this;return e[Symbol.replace].call(this,r,(function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(n(e,s)),i.apply(this,e)}))}return e[Symbol.replace].call(this,r,i)},Ni.apply(this,arguments)}!function(e){e.h264="h264",e.h265="h265",e.vp8="vp8",e.vp9="vp9",e.av1="av1"}({}),function(e){e.opus="opus",e.pcma="pcma",e.pcmu="pcmu",e.g722="g722"}({}),(()=>{var e={8:(e,t,r)=>{r.r(t),r.d(t,{Parser:()=>v,Printer:()=>I,parse:()=>D,print:()=>P});const n="\n",i="".concat("\r").concat(n),o=" ";let s;function a(e){return e>="0"&&e<="9"}function c(e){return e>="!"&&e<="~"}function u(e){return c(e)||e>="€"&&e<="ÿ"}function d(e){return"!"===e||e>="#"&&e<="'"||e>="*"&&e<="+"||e>="-"&&e<="."||e>="0"&&e<="9"||e>="A"&&e<="Z"||e>="^"&&e<="~"}function l(e){return e>="1"&&e<="9"}function h(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function p(e){return"d"===e||"h"===e||"m"===e||"s"===e}function f(e){return e>""&&e<"\t"||e>"\v"&&e<"\f"||e>""&&e<"ÿ"}function E(e){return h(e)||a(e)||"+"===e||"/"===e}function m(e){return a(e)||h(e)||"+"===e||"/"===e||"-"===e||"_"===e}function _(e){return h(e)||a(e)||"+"===e||"/"===e}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}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 y{consumeText(e,t){let r=t;for(;r<e.length;){const t=e[r];if("\0"===t||"\r"===t||t===n)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 n=t;for(;r(e[n]);)n++;if(n-t==0)throw new Error("Invalid rule at ".concat(t,"."));return n}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 n=parseInt(e.slice(t,r));if(n>=0&&n<=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(!((n=e[t+r])>="0"&&n<="9"||n>="a"&&n<="f"||n>="A"&&n<="F")){if(0===r)throw new Error("Invalid hex 4");break}var n;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,u)}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 n=e.slice(t,r),i=parseInt(n);if(i<224||i>239)throw new Error("Invalid IP4 multicast address, IPv4 multicast addresses may be in the range 224.0.0.0 to 239.255.255.255.");for(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,d)}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 n=0;n<r.length;n++){if(t+n>=e.length)throw new Error("consume exceeding value length");if(e[t+n]!==r[n])throw new Error("consume ".concat(r," failed at ").concat(n))}return t+r.length}consumeTill(e,t,r){let n=t;for(;n<e.length&&("string"!=typeof r||e[n]!==r)&&("function"!=typeof r||!r(e[n]));)n++;return n}}class v extends y{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(),n=this.parseOrigin(),i=this.parseSessionName(),o=this.parseInformation(),s=this.parseUri(),a=this.parseEmail(),c=this.parsePhone(),u=this.parseConnection(),d=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:n,sessionName:i,information:o,uri:s,emails:a,phones:c,connection:u,bandwidths:d,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]===n)return"\r"===e[t-1]?i:n;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=>d(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=>d(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 n=!1;"-"===e.value[e.cur]&&(n=!0,e.cur+=1);const i=this.extract(e,this.consumeTypedTime);t.push({time:r,typedTime:i,back:n})}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),n=this.parseTypedTime(t);e.push({repeatInterval:r,typedTimes:n}),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,d);if(":"!==t.value[t.cur])throw new Error("Invalid bandwidth field.");t.cur++;const n=this.extractOneOrMore(t,a);e.push({bwtype:r,bandwidth:n}),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,u);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const n=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const i=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const o=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const c=this.extract(e,this.consumeUnicastAddress);return this.currentLine++,{username:t,sessId:r,sessVersion:n,nettype:i,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,d);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const n=this.extract(e,this.consumeAddress);return this.currentLine++,{nettype:t,addrtype:r,address:n}}}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 n=[];for(n.push(this.extract(e,this.consumeToken));"/"===e.value[e.cur];)e.cur+=1,n.push(this.extract(e,this.consumeToken));if(0===n.length)throw new Error("Invalid proto");const i=this.parseFmt(e);return this.currentLine++,{mediaType:t,port:r,protos:n,fmts:i}}parseTimeFields(){const e=[];for(;this.getCurrentRecord().type===s.TIME;){const t=this.parseTime(),r=this.parseRepeat(),n=this.parseZone();e.push({time:t,repeats:r,zones:n})}return e}parseMediaDescription(){const e=[];for(;this.currentLine<this.records.length&&this.getCurrentRecord().type===s.MEDIA;){const t=this.parseMedia(),r=this.parseInformation(),n=this.parseConnections(),i=this.parseBandWidth(),o=this.parseKey(),s=this.parseMediaAttributes(t);e.push({media:t,information:r,connections:n,bandwidths:i,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 n=t.call(this,e.value,e.cur,...r),i=e.value.slice(e.cur,n);return e.cur=n,i}extractOneOrMore(e,t){const r=this.consumeOneOrMore(e.value,e.cur,t),n=e.value.slice(e.cur,r);return e.cur=r,n}consumeSpaceForRecord(e){if(e.value[e.cur]!==o)throw new Error("Invalid space at ".concat(e.cur,"."));e.cur+=1}}class R extends y{constructor(...e){super(...e),S(this,"attributes",void 0),S(this,"digested",!1)}extractOneOrMore(e,t,r){const n=this.consumeOneOrMore(e.attValue,e._cur,t),i=e.attValue.slice(e._cur,n),[o,s]=r||[];if("number"==typeof o&&i.length<o)throw new Error("error in length, should be more or equal than ".concat(o," characters."));if("number"==typeof s&&i.length>s)throw new Error("error in length, should be less or equal than ".concat(s," characters."));return e._cur=n,i}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 n=t.call(this,e.attValue,e._cur,...r),i=e.attValue.slice(e._cur,n);return e._cur=n,i}atEnd(e){if(!e.attValue)throw new Error;return e._cur>=e.attValue.length}peekChar(e){if(!e.attValue)throw new Error;return e.attValue[e._cur]}peek(e,t){if(!e.attValue)throw new Error;for(let r=0;r<t.length;r++)if(t[r]!==e.attValue[e._cur+r])return!1;return!0}parseIceUfrag(e){if(this.attributes.iceUfrag)throw new Error("Invalid ice-ufrag, should be only a single line if 'a=ice-ufrag'");this.attributes.iceUfrag=this.extractOneOrMore(e,E,[4,256])}parseIcePwd(e){if(this.attributes.icePwd)throw new Error("Invalid ice-pwd, should be only a single line if 'a=ice-pwd'");this.attributes.icePwd=this.extractOneOrMore(e,E,[22,256])}parseIceOptions(e){if(this.attributes.iceOptions)throw new Error("Invalid ice-options, should be only one 'ice-options' line");const t=[];for(;!this.atEnd(e);){t.push(this.extractOneOrMore(e,E));try{this.consumeAttributeSpace(e)}catch(t){if(this.atEnd(e))break;throw t}}this.attributes.iceOptions=t}parseFingerprint(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill);this.attributes.fingerprints.push({hashFunction:t,fingerprint:r})}parseExtmap(e){const t=this.extractOneOrMore(e,a);let r;"/"===this.peekChar(e)&&(this.extract(e,this.consume,"/"),r=this.extract(e,this.consumeToken)),this.consumeAttributeSpace(e);const n=this.extract(e,this.consumeTill,o),i=g(g({entry:parseInt(t,10)},r&&{direction:r}),{},{extensionName:n});this.peekChar(e)===o&&(this.consumeAttributeSpace(e),i.extensionAttributes=this.extract(e,this.consumeTill)),this.attributes.extmaps.push(i)}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,m)}parseIdentity(e){const t=this.extractOneOrMore(e,_),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.extract(e,this.consume,"=");const n=this.extractOneOrMore(e,(e=>e!==o&&f(e)));r.push({name:t,value:n})}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,E,[1,32]);this.consumeAttributeSpace(e);const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const n=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const i=this.extractOneOrMore(e,a,[1,10]);this.consumeAttributeSpace(e);const s=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const u=this.extract(e,this.consumePort);this.consumeAttributeSpace(e),this.extract(e,this.consume,"typ"),this.consumeAttributeSpace(e);const d={foundation:t,componentId:r,transport:n,priority:i,connectionAddress:s,port:u,type:this.extract(e,this.consumeToken),extension:{}};for(this.peek(e," raddr")&&(this.extract(e,this.consume," raddr"),this.consumeAttributeSpace(e),d.relAddr=this.extract(e,this.consumeAddress)),this.peek(e," rport")&&(this.extract(e,this.consume," rport"),this.consumeAttributeSpace(e),d.relPort=this.extract(e,this.consumePort));this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e),d.extension[t]=this.extractOneOrMore(e,c)}this.attributes.candidates.push(d)}parseRemoteCandidate(e){const t=[];for(;;){const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const n=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const i=this.extract(e,this.consumePort);t.push({componentId:r,connectionAddress:n,port:i});try{this.consumeAttributeSpace(e)}catch(e){break}}this.attributes.remoteCandidatesList.push(t)}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 n={encodingName:r,clockRate:this.extractOneOrMore(e,a)};this.atEnd(e)||"/"!==this.peekChar(e)||(this.extract(e,this.consume,"/"),n.encodingParameters=parseInt(this.extract(e,this.consumeTill),10));const i=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));i?i.rtpMap=n:this.attributes.payloads.push({payloadType:parseInt(t,10),rtpMap:n,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 n;":"===this.peekChar(e)&&(this.extract(e,this.consume,":"),n=this.extract(e,this.consumeTill));const i=this.attributes.ssrcs.find((e=>e.ssrcId===parseInt(t,10)));i?i.attributes[r]=n:this.attributes.ssrcs.push({ssrcId:parseInt(t,10),attributes:{[r]:n}})}parseFmtp(e){const t=this.extract(e,this.consumeTill,o);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill),n={};r.split(";").forEach((e=>{let[t,r]=e.split("=");t=t.trim();const i="string"==typeof r?r.trim():null;"string"==typeof t&&t.length>0&&(n[t]=i)}));const i=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));i?i.fmtp={parameters:n}:this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[],fmtp:{parameters:n}})}parseFmtParameters(e){const t={},r=this.extract(e,this.consumeTill,"=");e._cur++;const n=this.extract(e,this.consumeTill,";");for(t[r]=n;";"===e.attValue[e._cur];){const r=this.extract(e,this.consumeTill,"=");e._cur++;const n=this.extract(e,this.consumeTill,";");t[r]=n}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 n;if("trr-int"===r)n={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))),n=t}if("*"===t)this.attributes.rtcpFeedbackWildcards.push(n);else{const e=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));e?e.rtcpFeedbacks.push(n):this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[n]})}}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,d),this.consumeAttributeSpace(e),t.addressType=this.extractOneOrMore(e,d),this.consumeAttributeSpace(e),t.address=this.extract(e,this.consumeAddress)),this.attributes.rtcp=t}parseMsid(e){const t={id:this.extractOneOrMore(e,d,[1,64])};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.appdata=this.extractOneOrMore(e,d,[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 n={type:t,rids:this.extract(e,this.consume,"=").split(",")};r.params.push(n);break}default:{const n={type:t};"="===this.peekChar(e)&&(this.extract(e,this.consume,"="),n.val=this.extract(e,this.consumeTill,";")),r.params.push(n)}}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",i)}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),n=t;return"trr-int"===n.type?r+="ttr-int".concat(o).concat(n.interval):(r+="".concat(n.type),n.parameter&&(r+="".concat(o).concat(n.parameter),n.additional&&(r+="".concat(o).concat(n.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 v).parse(e)}function P(e,t){return(new I).print(e,t)}}},t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(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 Di=new class extends An{constructor(){super(...arguments),bi(this,"currentUploadLogID",0)}reportLogUploadError(e){const t=e.errorRange;t[t.length-1]&&t[t.length-1]>this.currentUploadLogID&&(this.currentUploadLogID=t[t.length-1],this.emit("REPORT_LOG_UPLOAD",e))}};class Pi{constructor(e){bi(this,"logger",void 0),bi(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 Li(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function ki(){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 Mi={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},Ui=Date.now(),xi=e=>{for(const t in Mi)if(Object.prototype.hasOwnProperty.call(Mi,t)&&Mi[t]===e)return t;return"DEFAULT"};const Vi=new class{constructor(){bi(this,"proxyServerURL",void 0),bi(this,"logLevel",Mi.DEBUG),bi(this,"uploadState","collecting"),bi(this,"uploadStartTimer",void 0),bi(this,"uploadLogWaitingList",[]),bi(this,"uploadLogUploadingList",[]),bi(this,"uploadErrorCount",0),bi(this,"currentLogID",0),bi(this,"url",void 0),bi(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 n=[Mi.DEBUG].concat(t);this.log.apply(this,n)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[Mi.INFO].concat(t);this.log.apply(this,n)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[Mi.WARNING].concat(t);this.log.apply(this,n)}warn(){this.warning(...arguments)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[Mi.ERROR].concat(t);this.log.apply(this,n)}upload(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[Mi.DEBUG].concat(t);this.uploadLog.apply(this,n)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){Si("UPLOAD_LOG",!0)}disableLogUpload(){Si("UPLOAD_LOG",!1),this.uploadState="collecting",void 0!==this.uploadStartTimer&&(window.clearTimeout(this.uploadStartTimer),this.uploadStartTimer=void 0),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new Pi(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()-Ui<100)return void setTimeout((()=>{this.log(...t)}),Date.now()-Ui);const n=Math.max(0,Math.min(4,t[0]));if(t[0]=Li()+" Agora-SDK [".concat(xi(n),"]:"),this.appendLogToWaitingList(n,...t),n<this.logLevel)return;const i=Li()+" %cAgora-SDK [".concat(xi(n),"]:");let o=[];if(!yi("USE_NEW_LOG"))switch(n){case Mi.DEBUG:o=[i,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case Mi.INFO:o=[i,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case Mi.WARNING:o=[i,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case Mi.ERROR:o=[i,"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()-Ui<100)return void setTimeout((()=>{this.uploadLog(...t)}),Date.now()-Ui);const n=Math.max(0,Math.min(4,t[0]));t[0]=Li()+" Agora-SDK [".concat(xi(n),"]:"),this.appendLogToWaitingList(n,...t)}appendLogToWaitingList(e){if(!yi("UPLOAD_LOG"))return;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];Array.isArray(r[0])?r[0][0]=ki()+" Agora-SDK [".concat(xi(e),"]:"):r[0]=ki()+" Agora-SDK [".concat(xi(e),"]:");let i="";r.forEach((e=>{"object"==typeof e&&(e=JSON.stringify(e)),i+="".concat(e," ")})),this.uploadLogWaitingList.push({payload_str:i,log_level:e,log_item_id:this.currentLogID++}),"uploading"===this.uploadState&&0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}startUpload(){this.uploadState="uploading",void 0!==this.uploadStartTimer&&(window.clearTimeout(this.uploadStartTimer),this.uploadStartTimer=void 0),0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}scheduleUploadStart(){"uploading"!==this.uploadState&&void 0===this.uploadStartTimer&&(this.uploadStartTimer=window.setTimeout((()=>{this.uploadStartTimer=void 0,yi("UPLOAD_LOG")&&this.startUpload()}),5e3))}async uploadLogs(){const e=this.uploadLogUploadingList,t={sdk_version:mi,process_id:yi("PROCESS_ID"),payload:JSON.stringify(e)};return ci((async()=>{const e=await Dr.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(yi("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(yi("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),Di.reportLogUploadError(r),!0}),{timeout:yi("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:yi("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,yi("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),yi("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),yi("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),yi("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}};var Fi;(Fi={}).FREE="free",Fi.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 Bi=function(e){return e[e.RECOVER=0]="RECOVER",e[e.WARNING=1]="WARNING",e[e.ERROR=2]="ERROR",e}({}),ji=function(e){return e.CONFIG_DISTRIBUTE="config-distribute-error",e}({});const Wi={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let Gi=function(e){return e.PUBLISH="publish",e.SUBSCRIBE="subscribe",e.WS_COMPRESSOR_INIT="ws_compressor_init",e.SESSION_INIT="session_init",e.JOIN_CHOOSE_SERVER="join_choose_server",e.RTE_DETAIL="rte_detail_stats",e.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.XLA_PEER_FIRST_VIDEO_FRAME="xla_peer_first_video_frame",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics",e.PC_STATS="pc_stats",e.UPDATE_REMOTE_RTPCAPABILITIES="update_remote_rtpCapabilities",e.AB_TEST="ab_test",e.ALARM_STATUS_NOTIFY="alarm_status_notify",e}({}),Hi=function(e){return e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.RTE_DETAIL="io.agora.pb.Wrtc.RteDetailStats",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_GATEWAY="io.agora.pb.Wrtc.JoinGateway",e.RE_JOIN_GATEWAY="io.agora.pb.Wrtc.ReJoinGateway",e.PUBLISH="io.agora.pb.Wrtc.Publish",e.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",e.WS_COMPRESSOR_INIT="io.agora.pb.Wrtc.WsCompressorInit",e.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",e.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",e.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",e.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",e.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",e.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",e.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",e.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",e.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",e.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",e.XLA_PEER_FIRST_VIDEO_FRAME="io.agora.pb.Wrtc.XLAPeerFirstVideoFrame",e.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",e.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",e.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",e.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",e.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",e.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",e.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",e.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",e.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",e.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",e.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics",e.AUTOPLAY_FAILED="io.agora.pb.Wrtc.AutoplayFailed",e.PC_STATS="io.agora.pb.Wrtc.PCStats",e.UPDATE_REMOTE_RTPCAPABILITIES="io.agora.pb.Wrtc.UpdateRemoteRTPCapabilities",e.AB_TEST="io.agora.pb.Wrtc.ABTest",e.ALARM_STATUS_NOTIFY="io.agora.pb.Wrtc.AlarmStatusNotify",e}({});!function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}({});let Ki=function(e){return e[e.SESSION=26]="SESSION",e[e.JOIN_CHOOSE_SERVER=27]="JOIN_CHOOSE_SERVER",e[e.REQ_USER_ACCOUNT=196]="REQ_USER_ACCOUNT",e[e.JOIN_GATEWAY=28]="JOIN_GATEWAY",e[e.PUBLISH=30]="PUBLISH",e[e.SUBSCRIBE=29]="SUBSCRIBE",e[e.WS_COMPRESSOR_INIT=9430]="WS_COMPRESSOR_INIT",e[e.STREAM_SWITCH=32]="STREAM_SWITCH",e[e.AUDIO_SENDING_STOPPED=33]="AUDIO_SENDING_STOPPED",e[e.VIDEO_SENDING_STOPPED=34]="VIDEO_SENDING_STOPPED",e[e.REQUEST_PROXY_APPCENTER=35]="REQUEST_PROXY_APPCENTER",e[e.REQUEST_PROXY_WORKER_MANAGER=36]="REQUEST_PROXY_WORKER_MANAGER",e[e.API_INVOKE=41]="API_INVOKE",e[e.FIRST_VIDEO_RECEIVED=348]="FIRST_VIDEO_RECEIVED",e[e.FIRST_AUDIO_RECEIVED=349]="FIRST_AUDIO_RECEIVED",e[e.FIRST_VIDEO_DECODE=350]="FIRST_VIDEO_DECODE",e[e.FIRST_AUDIO_DECODE=351]="FIRST_AUDIO_DECODE",e[e.ON_ADD_AUDIO_STREAM=352]="ON_ADD_AUDIO_STREAM",e[e.ON_ADD_VIDEO_STREAM=353]="ON_ADD_VIDEO_STREAM",e[e.ON_UPDATE_STREAM=356]="ON_UPDATE_STREAM",e[e.ON_REMOVE_STREAM=355]="ON_REMOVE_STREAM",e[e.JOIN_CHANNEL_TIMEOUT=407]="JOIN_CHANNEL_TIMEOUT",e[e.PEER_PUBLISH_STATUS=408]="PEER_PUBLISH_STATUS",e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT",e[e.JOIN_WEB_PROXY_AP=700]="JOIN_WEB_PROXY_AP",e[e.WEBSOCKET_QUIT=671]="WEBSOCKET_QUIT",e[e.USER_ANALYTICS=1e4]="USER_ANALYTICS",e[e.AUTOPLAY_FAILED=9178]="AUTOPLAY_FAILED",e}({});const Yi="[config-restore]",Zi="websdk_ng_",zi=Zi+"blocked_config_hashes",Xi=Zi+"api_failure_records",Ji=Zi+"global_parameter",Qi=Zi+"config_restore_state";function qi(){try{const e=window.localStorage.getItem(Qi);if(e)return JSON.parse(e)}catch(e){}return{currentConfigHash:"",configVerified:!1}}function $i(){try{const e=window.localStorage.getItem(Xi);return e?JSON.parse(e):[]}catch(e){return Vi.debug("[error] ".concat(Yi," error getting API failure records:"),e),[]}}function eo(){return $i().reduce(((e,t)=>e+t.count),0)}function to(){try{const e=eo(),t=yi("MAX_CONFIG_RETRY");if(e<t)return;const r=qi().currentConfigHash;Vi.debug("[warning] ".concat(Yi," restoring config due to ").concat(e," API failures")),r&&function(e){try{const t=window.localStorage.getItem(zi);let r=[];t&&(r=JSON.parse(t).configHashes);const n=[...new Set([...r,e])];window.localStorage.setItem(zi,JSON.stringify({configHashes:n,timestamp:Date.now()})),Vi.debug("[warning] ".concat(Yi," blocked config hash: ").concat(e))}catch(e){Vi.debug("[error] ".concat(Yi," error blocking config hash:"),e)}}(r),window.localStorage.removeItem(Ji);const n=$i().slice(-5);(function(e,t){io.reportAlarm(e,t)})(null,{status:Bi.ERROR,type:ji.CONFIG_DISTRIBUTE,message:"Config cache cleared due to API failures",extend:{failureCount:e,maxRetry:t,blockedConfigHash:r,recentFailures:n.map((e=>({api:e.apiName,error:e.errorCode||e.errorMessage,count:e.count,lastTime:e.lastTimestamp})))}}),function(){try{window.localStorage.removeItem(Xi)}catch(e){Vi.debug("[error] ".concat(Yi," error clearing API failure records:"),e)}}()}catch(e){Vi.debug("[error] ".concat(Yi," error restoring config:"),e)}}function ro(e,t){try{if(!yi("ENABLE_CONFIG_RESTORE"))return;if(t&&"AgoraRTCException"===t.name){const e=yi("CONFIG_ERROR_MONITOR");if(!Array.isArray(e)||!e.includes(t.code))return}const r=window.localStorage.getItem(Ji);if(!r||r.length<20)return;if(qi().configVerified)return;const n=yi("CONFIG_RESTORE_ERROR_API");if(!Array.isArray(n)||!n.includes(e))return;let i,o;t&&(t.code&&(i=t.code),o=t.message?t.message:"string"==typeof t?t:t.toString()),function(e,t,r){try{const n=$i(),i="".concat(e,":").concat(t||""),o=n.find((e=>"".concat(e.apiName,":").concat(e.errorCode||"")===i)),s=qi().currentConfigHash;if(o)o.count++,o.lastTimestamp=Date.now(),r&&(o.errorMessage=r),s&&(o.configHash=s);else{const i=Date.now();n.push({apiName:e,errorCode:t,errorMessage:r,count:1,firstTimestamp:i,lastTimestamp:i,configHash:s||void 0})}const a=n.length>20?n.slice(-20):n;window.localStorage.setItem(Xi,JSON.stringify(a))}catch(e){Vi.debug("[error] ".concat(Yi," error saving API failure record:"),e)}}(e,i,o);const s=eo(),a=yi("MAX_CONFIG_RETRY");Vi.debug("".concat(Yi," API failure count: ").concat(s,"/").concat(a,", API: ").concat(e,", Error: ").concat(i||o)),s>=a&&to()}catch(e){}}function no(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,r,n){const i=n.value;if("function"==typeof i){const o=e.className||t.__className__||("AgoraRTCClient"===t.constructor.name?"Client":t.constructor.name);n.value=function(){for(var t,n=arguments.length,s=new Array(n),a=0;a<n;a++)s[a]=arguments[a];let c=s;if(e.argsMap)try{c=e.argsMap(this,...s)}catch(e){Vi.warning(e),c=[]}try{JSON.stringify(c)}catch(e){Vi.warning("arguments for method ".concat(o,".").concat(String(r)," not serializable for apiInvoke.")),c=[]}const u=(e.report||io).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:wn.TRACER,reportResult:e.reportResult},e.throttleTime);try{const t=i.apply(this,s);return t instanceof Promise?t.then((t=>(u.onSuccess(e.reportResult&&t),t))).catch((e=>{throw u.onError(e),e})):(u.onSuccess(e.reportResult&&t),t)}catch(e){throw u.onError(e),e}}}return n}}const io=new class{constructor(){bi(this,"baseInfoMap",new Map),bi(this,"proxyServer",void 0),bi(this,"eventUploadTimer",void 0),bi(this,"setSessionIdTimer",void 0),bi(this,"url",void 0),bi(this,"sids",new Set),bi(this,"backupUrl",void 0),bi(this,"_appId",void 0),bi(this,"_aid",0),bi(this,"keyEventUploadPendingItems",[]),bi(this,"normalEventUploadPendingItems",[]),bi(this,"apiInvokeUploadPendingItems",[]),bi(this,"apiInvokeCount",0),bi(this,"apiInvokeLoggedCount",0),bi(this,"ltsList",[]),bi(this,"lastSendNormalEventTime",Date.now()),bi(this,"customReportCounterTimer",void 0),bi(this,"customReportCount",0),bi(this,"extApiInvoke",(async e=>{for(const t of e){const e=Ii(Ii({},t),{},{sid:null,invokeId:++this.apiInvokeCount,tag:wn.TRACER});this.sendApiInvoke(e)}})),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),yi("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),yi("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=wi(e,2);return t[0]+t[1]})),16)||0}reportApiInvoke(e,t,r){t.timeout=t.timeout||6e4,t.reportResult=void 0===t.reportResult||t.reportResult;const n=Date.now();this.apiInvokeCount+=1;const i=this.apiInvokeCount,o=!!yi("SHOW_REPORT_INVOKER_LOG"),s=!!yi("SHOW_REPORT_USER_INVOKER_LOG"),a=o||s&&t.id;a&&(this.apiInvokeLoggedCount+=1);const c=this.apiInvokeLoggedCount;function u(e,r){if(a){let n="[apiInvoke-".concat(c,"]");if(t.id&&(n+="[".concat(t.id,"]")),t.name&&(n+="[".concat(t.name,"]"),t.name===Cn.JOIN))return Vi.info("".concat(n," ").concat(e));Vi.info("".concat(n," ").concat(e),"start"===e?t.options:r||"")}}const d=()=>({tag:t.tag,invokeId:i,sid:e,name:t.name,apiInvokeTime:n,options:t.options,states:t.states||null});u("start");let l=!1;zn(t.timeout).then((()=>{l||(this.sendApiInvoke(Ii(Ii({},d()),{},{error:pn.API_INVOKE_TIMEOUT,success:!1})),u("timeout"),ro(t.name,new fn(pn.API_INVOKE_TIMEOUT)))}));const h=new fn(pn.UNEXPECTED_ERROR,"".concat(t.name,": this api invoke is end"));return{onSuccess:e=>{const n=()=>{if(l)throw h;return l=!0,this.sendApiInvoke(Ii(Ii({},d()),{},{success:!0},t.reportResult&&{result:e})),u("onSuccess"),e};return r?qn(n,t.name+"Success",r,(()=>l=!0)):n()},onError:e=>{const n=()=>{if(l)throw e;l=!0,this.sendApiInvoke(Ii(Ii({},d()),{},{success:!1,error:e})),ro(t.name,e),u("onFailure",e.toString())};return r?qn(n,t.name+"Error",r,(()=>l=!0)):n()}}}_send(e,t,r){this.send({type:e,data:t},r)}_sendApiInvoke(e){return this.sendApiInvoke(e)}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),n=this.createBaseInfo(e,r);n.cname=t.cname,n.rteUrl=t.rteUrl;const i=Object.assign({},{willUploadConsoleLog:yi("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:_i?"global":"oversea",areas:yi("AREAS")&&yi("AREAS").join(",")},t.extend),o=t.stringUid,s=t.channelProfile,a=t.channelMode,c=t.isABTestSuccess,u=t.lsid,d=t.clientRole,l=Date.now(),h=Ii(Ii({},n),{},{eventType:Gi.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,buildFormat:t.buildFormat,build:"v4.24.5-0-g604b18ede-dirty(6/25/2026, 6:06:10 PM)",lts:l,elapse:l-r,extend:JSON.stringify(i),mode:t.mode,process:yi("PROCESS_ID"),appType:yi("APP_TYPE"),success:!0,version:mi,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:u,clientType:window.navigator.userAgent.includes("AgoraWebView")?42:20,clientRole:d,serviceId:yi("PROCESS_ID"),extensionID:yi("PLUGIN_INFO").join(",")||"",rteUrl:t.rteUrl,rteSid:t.rteSid,installId:Ei()});this.send({type:Hi.SESSION,data:h},!0)}reportRteDetail(e){const t=this.baseInfoMap.get(e);if(!t)return;const r=t.info,n=Date.now(),i=Ii(Ii({},r),{},{eventType:Gi.RTE_DETAIL,lts:n,success:!0,elapse:n-t.startTime,vid:void 0===r.vid?0:Number(r.vid),ua:navigator.userAgent});this.send({type:Hi.RTE_DETAIL,data:i},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info;t.vid&&(n.vid=t.vid);const i=Date.now(),o=Ii(Ii({},n),{},{role:t.role,eventType:Gi.JOIN_CHOOSE_SERVER,lts:i,eventElapse:t.elapse||i-t.lts,chooseServerAddr:t.csAddr,errorCode:t.ec,elapse:i-r.startTime,success:t.succ,chooseServerAddrList:JSON.stringify(t.serverList),uid:t.uid?parseInt(t.uid):null,cid:t.cid?parseInt(t.cid):null,chooseServerIp:t.csIp||"",opid:t.opid,unilbsServerIds:t.unilbsServerIds,extend:t.extend||void 0,isHttp3:t.isHttp3,corssRegionTagReq:t.corssRegionTagReq||void 0,corssRegionTagRes:t.corssRegionTagRes||void 0,ua:navigator.userAgent,resourceTimingInfo:t.resourceTimingInfo||void 0});this.send({type:Hi.JOIN_CHOOSE_SERVER,data:o},!0)}reqUserAccount(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ii(Ii({},n),{},{eventType:Gi.REQ_USER_ACCOUNT,lts:i,success:t.success,serverAddress:t.serverAddr,stringUid:t.stringUid,uid:t.uid,errorCode:t.errorCode,elapse:t.elapse||i-r.startTime,eventElapse:i-t.lts,extend:JSON.stringify(t.extend)});this.send({type:Hi.REQ_USER_ACCOUNT,data:o},!0)}joinGateway(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info;t.vid&&(n.vid=t.vid),n.uid=t.uid,n.cid=t.cid;const i=Date.now(),o=t.firstSuccess,s=t.addr,a=t.isProxy,c=i-r.startTime,u=Ii(Ii({},n),{},{eventType:Gi.JOIN_GATEWAY,lts:i,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,errorMsg:t.errorMsg||"",elapse:c,eventElapse:i-t.lts,firstSuccess:o,signalChannel:t.signalChannel,preload:t.preload?1:0,installId:Ei(),isABTestSuccess:t.isABTestSuccess?1:0,gatewayIp:null,gatewayPort:null,isProxy:a?1:0}),d=u.success?1:0;if(t.succ&&(r.lastJoinSuccessTime=i),s)if("1"===u.signalChannel){const e=Ni(/(\d+\.\d+\.\d+\.\d+):(\d+)/,{ip:1,port:2}),t=s.match(e);u.gatewayIp=t&&t.groups?t.groups.ip:"",u.gatewayPort=t&&t.groups?t.groups.port:""}else if(a){const e=s.match(/h=(\d{1,3}-){3}\d{1,3}/g),t=s.match(/p=[0-9]{1,6}/g);u.gatewayIp=e&&e.length?e[0].split("=")[1].replace(/-/g,"."):"",u.gatewayPort=t&&t.length?t[0].split("=")[1]:""}else{const e=s.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),t=s.match(/(:|p=)[0-9]{1,6}/g);u.gatewayIp=e&&e.length?e[0].split("//")[1].replace(/-/g,"."):"",u.gatewayPort=t&&t.length?t[0].split(/:|p=/g)[1]:""}if(o)this.send({type:Hi.JOIN_GATEWAY,data:u},!0);else{const e={isSuccess:d,port:u.gatewayPort};delete u.success,delete u.eventType,delete u.firstSuccess,delete u.gatewayPort,u.vid=Number(u.vid);const t=Object.assign({},u,e,{eventType:Gi.REJOIN_GATEWAY});this.send({type:Hi.RE_JOIN_GATEWAY,data:t},!0)}}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=Date.now(),i=Ii(Ii({},r.info),{},{lts:n,timeout:t,elapse:n-r.startTime});this.send({type:Hi.JOIN_CHANNEL_TIMEOUT,data:i},!0)}publish(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ii(Ii({},n),{},{eventType:Gi.PUBLISH,lts:i,eventElapse:t.eventElapse,elapse:i-r.startTime,success:t.succ,errorCode:t.ec,videoName:t.videoName,audioName:t.audioName,screenName:t.screenName,screenshare:t.screenshare,audio:t.audio,video:t.video,p2pid:t.p2pid,publishRequestid:t.publishRequestid});this.send({type:Hi.PUBLISH,data:o},!0)}subscribe(e,t,r){const n=this.baseInfoMap.get(e);if(!n)return;const i=n.info,o=Date.now(),s=Ii(Ii({},i),{},{eventType:Gi.SUBSCRIBE,lts:o,eventElapse:t.eventElapse,elapse:o-n.startTime,success:t.succ,errorCode:t.ec,video:t.video,audio:t.audio,subscribeRequestid:t.subscribeRequestid,p2pid:t.p2pid,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:Hi.SUBSCRIBE,data:s},!0)}wsCompressorInit(e){const t=[...this.baseInfoMap.keys()],r=t.length?t[0]:"UnableToGetSid",n=this.baseInfoMap.get(r);if(!n)return;const i=n.info,o=Date.now(),s=Ii(Ii({},i),{},{eventType:Gi.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-n.startTime,status:e.status?1:2});this.send({type:Hi.WS_COMPRESSOR_INIT,data:s},!0)}firstXLAPeerFirstVideoFrame(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=t.peerPubStatusMs-(r.lastJoinSuccessTime||i),s=Ii(Ii({},n),{},{elapse:i-r.startTime,eventType:Gi.XLA_PEER_FIRST_VIDEO_FRAME,lts:i,peer:t.peer,width:t.width,height:t.height,ssrc:t.ssrc,p2pid:t.p2pid,peerPublishDuration:t.peerPublishDuration,joinChannelSuccessElapse:o,peerPubStatusMs:t.peerPubStatusMs-t.joinChannelStart,availablePublish:t.peerPublishDuration>o?1:0,preloadStart:Math.max(t.preloadStart-t.joinChannelStart,0),preloadEnd:Math.max(t.preloadEnd-t.joinChannelStart,0),encrypt:Math.max(t.apStart-t.joinChannelStart,0),ap:Math.max(t.apEnd-t.joinChannelStart,0),sua:Math.max(t.suaEnd-t.joinChannelStart,0),beforeConnect:Math.max(t.beforeConnect-t.joinChannelStart,0),peerRecevier:Math.max(t.peerReceiver-t.joinChannelStart,0),ice:Math.max(t.ice-t.joinChannelStart,0),pc:Math.max(t.pc-t.joinChannelStart,0),signalConnected:Math.max(t.signalConnected-t.joinChannelStart,0),joinReq:Math.max(t.joinReq-t.joinChannelStart,0),joinRes:Math.max(t.joinRes-t.joinChannelStart,0),userJoinNotify:Math.max(t.userJoinNotify-t.joinChannelStart,0),videoSsrcNotify:Math.max(t.videoAddNotify-t.joinChannelStart,0),subscribeDelayMs:Math.max(t.subscribeStart-t.videoAddNotify,0),subscribeStart:Math.max(t.subscribeStart-t.joinChannelStart,0),subscribeEnd:Math.max(t.subscribeEnd-t.joinChannelStart,0),firstReceived:Math.max(t.firstReceived-t.joinChannelStart,0),firstDecoded:Math.max(t.firstDecoded-t.joinChannelStart,0),firstPreRender:Math.max(t.firstPreRender-t.joinChannelStart,0),firstRender:Math.max(t.firstRender-t.joinChannelStart,0),playDelayMs:Math.max(t.playStart-t.subscribeEnd,0),playStart:Math.max(t.playStart-t.joinChannelStart,0),playEnd:Math.max(t.playEnd-t.joinChannelStart,0),isPreSub:t.isPreSub?1:0,isPrePc:t.isPrePc?1:0,isPreInstantVideo:t.isPreInstantVideo?1:0,firstReceivedEncodedFrame:t.firstReceivedEncodedFrame?Math.max(t.firstReceivedEncodedFrame-t.joinChannelStart,0):void 0,frameType:t.frameType||"",rtpTimestamp:t.rtpTimestamp||0,framePayloadType:t.framePayloadType||0,frameDataLength:t.frameDataLength||0,mimeType:t.mimeType||"",sdpEndPoint:t.sdpEndPoint?1:0});this.send({type:Hi.XLA_PEER_FIRST_VIDEO_FRAME,data:s},!0)}firstRemoteVideoDecode(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,s=Date.now(),a=Ii(Ii(Ii({},o),n),{},{elapse:s-i.startTime,eventType:t,lts:s,firstDecodeFrame:Math.max((n.firstFrame||s)-i.startTime,0),apEnd:Math.max(n.apEnd-i.startTime,0),apStart:Math.max(n.apStart-i.startTime,0),joinGwEnd:Math.max(n.joinGwEnd-i.startTime,0),joinGwStart:Math.max(n.joinGwStart-i.startTime,0),pcEnd:Math.max(n.pcEnd-i.startTime,0),pcStart:Math.max(n.pcStart-i.startTime,0),subscriberEnd:Math.max(n.subscriberEnd-i.startTime,0),subscriberStart:Math.max(n.subscriberStart-i.startTime,0),videoAddNotify:Math.max(n.videoAddNotify-i.startTime,0)});this.send({type:r,data:a},!0)}firstRemoteFrame(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,s=Date.now(),a=Ii(Ii(Ii({},o),n),{},{elapse:s-i.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 n=r.info,i=Date.now(),o=Ii(Ii(Ii({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),elapse:i-r.startTime,eventType:Gi.AB_TEST,lts:i});this.send({type:Hi.AB_TEST,data:o},!0)}pcStats(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ii(Ii(Ii({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),elapse:i-r.startTime,eventType:Gi.PC_STATS,lts:i,preallocation:t.preallocation?1:0});this.send({type:Hi.PC_STATS,data:o},!0)}updateRemoteRTPCapabilities(e,t){if(e){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ii(Ii(Ii({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),eventType:Gi.UPDATE_REMOTE_RTPCAPABILITIES,lts:i});this.send({type:Hi.UPDATE_REMOTE_RTPCAPABILITIES,data:o},!0)}}onGatewayStream(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,s=Date.now(),a=Ii(Ii(Ii({},o),n),{},{eventType:t,lts:s});this.send({type:r,data:a},!0)}streamSwitch(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ii(Ii({},n),{},{eventType:Gi.STREAM_SWITCH,lts:i,isDual:t.isdual,elapse:i-r.startTime,success:t.succ});this.send({type:Hi.STREAM_SWITCH,data:o},!0)}requestProxyAppCenter(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ii(Ii({},n),{},{eventType:Gi.REQUEST_PROXY_APPCENTER,lts:i,eventElapse:i-t.lts,elapse:i-r.startTime,APAddr:t.APAddr,workerManagerList:t.workerManagerList,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:Hi.REQUEST_PROXY_APPCENTER,data:o},!0)}requestProxyWorkerManager(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ii(Ii({},n),{},{eventType:Gi.REQUEST_PROXY_WORKER_MANAGER,lts:i,eventElapse:i-t.lts,elapse:i-r.startTime,workerManagerAddr:t.workerManagerAddr,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:Hi.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?Vi.debug("reportProxyServerurl: ".concat(e)):Vi.debug("disable reportProxyServerurl: ".concat(e))}peerPublishStatus(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ii(Ii({},n),{},{subscribeElapse:t.subscribeElapse,peer:t.peer,peerPublishDuration:Math.max(t.audioPublishDuration,t.videoPublishDuration),audiotag:t.audioPublishDuration>0?1:-1,videotag:t.videoPublishDuration>0?1:-1,lts:i,elapse:i-r.startTime,joinChannelSuccessElapse:i-(r.lastJoinSuccessTime||i),peerPublishDurationVideo:t.videoPublishDuration,peerPublishDurationAudio:t.audioPublishDuration});this.send({type:Hi.PEER_PUBLISH_STATUS,data:o},!0)}workerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now();(function(e,t,r){const n=e[t];if(!n||"string"!=typeof n)return[e];e[t]="";const i=Zn(JSON.stringify(e));let o=0;const s=[];let a=0;for(let c=0;c<n.length;c++)a+=n.charCodeAt(c)<=127?1:3,a<=r-i||(s[s.length]=ln(ln({},e),{},{[t]:n.substring(o,c)}),o=c,a=n.charCodeAt(c)<=127?1:3);return o!==n.length-1&&(s[s.length]=ln(ln({},e),{},{[t]:n.substring(o)})),s})(Ii(Ii(Ii({},n),t),{},{elapse:i-r.startTime,lts:i,productType:"WebRTC"}),"payload",1300).forEach((e=>this.send({type:Hi.WORKER_EVENT,data:e},!0)))}apworkerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ii(Ii(Ii({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:Hi.AP_WORKER_EVENT,data:o},!0)}joinWebProxyAP(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ii(Ii(Ii({},n),t),{},{elapse:i-r.startTime,lts:i,extend:t.extend||void 0});this.send({type:Hi.JOIN_WEB_PROXY_AP,data:o},!0)}WebSocketQuit(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ii(Ii(Ii({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:Hi.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>yi("CUSTOM_REPORT_LIMIT"))throw new fn(pn.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((()=>{this.customReportCount=0}),5e3));const r=Date.now(),n=t.map((t=>({type:Hi.USER_ANALYTICS,data:Ii(Ii({sid:e},t),{},{lts:r})})));try{yi("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(n):await this.postDataToStatsCollector(n)}catch(e){throw Vi.error("send custom report message failed",e.toString()),new fn(pn.CUSTOM_REPORT_SEND_FAILED,e.message)}}reportAlarm(e,t){const r=e?this.baseInfoMap.get(e):void 0,n=null==r?void 0:r.info,i=Date.now(),o=Ii(Ii(Ii({},n),t),{},{vid:void 0===(null==n?void 0:n.vid)?0:Number(n.vid),elapse:r?i-r.startTime:0,eventType:Gi.ALARM_STATUS_NOTIFY,lts:i,installId:Ei(),processId:yi("PROCESS_ID")});this.send({type:Hi.ALARM_STATUS_NOTIFY,data:o},!0)}sendApiInvoke(e){const t=yi("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 n=r.info,i=n.cname,o=n.uid,s=n.cid;let a;if(e.lts=e.lts||Date.now(),e.error)if(e.error instanceof fn){const t=e.error,r=t.code,n=t.message;a=r||n||e.error.toString()}else a=e.error.toString();const c={invokeId:e.invokeId,sid:e.sid,cname:i,cid:s,uid:o,lts:e.lts,success:e.success,elapse:e.lts-r.startTime,execElapse:e.lts-e.apiInvokeTime,apiName:e.name,options:e.options?JSON.stringify(e.options):void 0,execStates:e.states?JSON.stringify(e.states):void 0,execResult:e.result?JSON.stringify(e.result):void 0,errorCode:e.error?a:void 0,errorMsg:e.error?JSON.stringify(e.error):void 0};return this.send({type:Hi.API_INVOKE,data:c},!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>yi("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=[],n=[];for(;e.length;){const t=e.shift();r.length<20?r.push(t):n.push(t)}e.push(...n);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()),yi("ENABLE_EVENT_REPORT")?(r.length&&(yi("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{yi("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>yi("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-yi("NORMAL_EVENT_QUEUE_CAPACITY")),Vi.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){Mn.networkState===Nn.OFFLINE&&await Promise.race([Mn.onlineWaiter,zn(2*ai.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)),n=new ArrayBuffer(5),i=(e=>{let t=0;return Object.entries(Hi).forEach((r=>{let n=wi(r,2),i=n[0];n[1]===e.type&&(t=Ki[i])})),t})(e),o=new DataView(n);o.setUint16(0,r.byteLength,!0),o.setUint8(2,255&i),o.setUint8(3,i>>>8&255),o.setUint8(4,i>>>16&255),t=Rn(t,new Uint8Array(n)),t=Rn(t,r)})),t},r="event";let n=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(yi("NEW_REPORT_SERVER_DOMAINS")[0],"&p=443&d=").concat(r):"https://".concat(yi("NEW_REPORT_SERVER_DOMAINS")[0],"/").concat(r);for(let i=0;i<2;i+=1){1===i&&(n=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(yi("NEW_REPORT_SERVER_DOMAINS")[1],"&p=443&d=").concat(r):"https://".concat(yi("NEW_REPORT_SERVER_DOMAINS")[1],"/").concat(r));try{await li(n,{timeout:1e4,data:t(e),headers:Ii(Ii({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===i)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]),n=r?void 0:this._aid,i={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:e.map((e=>JSON.stringify(e))),vid:r,aid:n};Mn.networkState===Nn.OFFLINE&&await Promise.race([Mn.onlineWaiter,zn(2*ai.maxRetryTimeout)]);const o=t?"/events/proto-raws":"/events/messages";let s=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(yi("EVENT_REPORT_DOMAIN"),"&p=").concat(yi("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(yi("EVENT_REPORT_DOMAIN"),":").concat(yi("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(yi("EVENT_REPORT_BACKUP_DOMAIN"),"&p=").concat(yi("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(yi("EVENT_REPORT_BACKUP_DOMAIN"),":").concat(yi("STATS_COLLECTOR_PORT")).concat(o)));try{t?await hi(s,{timeout:1e4,data:i}):await li(s,{timeout:1e4,data:i})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},Wi);return r.sid=e,this.baseInfoMap.set(e,{info:r,startTime:t}),r}reportResourceTiming(e,t){const r=performance.getEntriesByName(e),n=r[r.length-1];n&&this.reportApiInvoke(t,{name:"Client.resourceTiming",options:n,tag:wn.TRACER}).onSuccess()}};Di.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=Mn.networkState,io.reportApiInvoke(null,{name:"logUploadError",options:e,tag:wn.TRACER}).onSuccess("logUploadError")}));const oo={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1,supportDataChannel:!1,supportPCSetConfiguration:!1,supportWebRTCEncodedTransform:!1,supportWebRTCInsertableStream:!1,supportRequestVideoFrameCallback:!1,supportWebCrypto:!1,supportSuppressLocalAudioPlayback:!1,supportRestrictOwnAudio:!1};function so(){const e=xr();oo.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),oo.getStreamFromExtension=e.name===Lr.CHROME&&Number(e.version)>34,oo.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}(),oo.supportMinBitrate=e.name===Lr.CHROME||e.name===Lr.EDGE,oo.supportSetRtpSenderParameters=function(){const e=xr();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!on()||(!(!Gr()&&!jr())||e.name===Lr.FIREFOX&&Number(e.version)>=64)}(),e.name===Lr.SAFARI&&(Number(e.version)>=14?oo.supportDualStream=!0:oo.supportDualStream=!1),oo.webAudioMediaStreamDest=function(){const e=xr();if(e.name===Lr.SAFARI&&Number(e.version)<12)return!1;return!0}(),oo.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),oo.supportWebGL="undefined"!=typeof WebGLRenderingContext,oo.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,on()||(oo.webAudioWithAEC=!0),oo.supportShareAudio=function(){const e=xr();if((e.os===Pr.WIN_10||e.os===Pr.WIN_81||e.os===Pr.WIN_7||e.os===Pr.LINUX||e.os===Pr.MAC_OS||e.os===Pr.CHROMIUM_OS)&&e.name===Lr.CHROME&&Number(e.version)>=74)return!0;return!1}(),oo.supportDataChannel=function(){if(Zr(76)||Jr(68)||function(e){const t=xr();return!(t.name!==Lr.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),oo.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!Kr()&&!!e&&e.prototype.setConfiguration instanceof Function}(),oo.supportWebRTCEncodedTransform=Zr(87)||function(){const e=xr();if(e.name!==Lr.SAFARI||!e.browserVersion)return!1;const t=e.browserVersion.split(".");return Number(t[0])>15||15===Number(t[0])&&Number(t[1])>=4}()||Jr(117),oo.supportWebRTCInsertableStream=function(){const e=xr();return(e.name===Lr.CHROME||e.name===Lr.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),oo.supportRequestVideoFrameCallback=function(){if("requestVideoFrameCallback"in HTMLVideoElement.prototype)return!0;return!1}(),oo.supportWebCrypto="undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle,oo.supportSuppressLocalAudioPlayback=ho(),oo.supportRestrictOwnAudio=po(),Wn((()=>{oo.supportDualStreamEncoding=function(){const e=xr();if(yi("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&yi("CHROME_DUAL_STREAM_USE_ENCODING"))}(),Vi.debug("browser ua: ",navigator.userAgent),Vi.info("browser info: ",e),Vi.info("browser compatibility: ",oo)}))}function ao(){return oo}function co(){return"setSinkId"in HTMLAudioElement.prototype&&(!yi("RESTRICTION_SET_PLAYBACK_DEVICE")||(Wr()||Hr())&&!nn())}function uo(){return!oo.supportUnifiedPlan||yi("CHROME_FORCE_PLAN_B")&&on()}function lo(){return navigator.mediaDevices&&"getSupportedConstraints"in navigator.mediaDevices}function ho(){if(lo()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("suppressLocalAudioPlayback"in e)||!e.suppressLocalAudioPlayback)}return Zr(141)||Xr(141)||Qr(141)}function po(){if(lo()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("restrictOwnAudio"in e)||!e.restrictOwnAudio)}return Zr(141)||Xr(141)||Qr(125)}let fo=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 Eo=function(e){try{return!!e()}catch(e){return!0}},mo=!Eo((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),_o=mo,To=Function.prototype,go=To.call,So=_o&&To.bind.bind(go,go),yo=_o?So:function(e){return function(){return go.apply(e,arguments)}},vo=yo({}.isPrototypeOf),Ro=function(e){return e&&e.Math===Math&&e},Ao=Ro("object"==typeof globalThis&&globalThis)||Ro("object"==typeof window&&window)||Ro("object"==typeof self&&self)||Ro("object"==typeof z&&z)||Ro("object"==typeof z&&z)||function(){return this}()||Function("return this")(),bo=mo,Oo=Function.prototype,Io=Oo.apply,Co=Oo.call,wo="object"==typeof Reflect&&Reflect.apply||(bo?Co.bind(Io):function(){return Co.apply(Io,arguments)}),No=yo,Do=No({}.toString),Po=No("".slice),Lo=function(e){return Po(Do(e),8,-1)},ko=Lo,Mo=yo,Uo=function(e){if("Function"===ko(e))return Mo(e)},xo="object"==typeof document&&document.all,Vo=void 0===xo&&void 0!==xo?function(e){return"function"==typeof e||e===xo}:function(e){return"function"==typeof e},Fo={},Bo=!Eo((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),jo=mo,Wo=Function.prototype.call,Go=jo?Wo.bind(Wo):function(){return Wo.apply(Wo,arguments)},Ho={},Ko={}.propertyIsEnumerable,Yo=Object.getOwnPropertyDescriptor,Zo=Yo&&!Ko.call({1:2},1);Ho.f=Zo?function(e){var t=Yo(this,e);return!!t&&t.enumerable}:Ko;var zo,Xo,Jo=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Qo=Eo,qo=Lo,$o=Object,es=yo("".split),ts=Qo((function(){return!$o("z").propertyIsEnumerable(0)}))?function(e){return"String"===qo(e)?es(e,""):$o(e)}:$o,rs=function(e){return null==e},ns=rs,is=TypeError,os=function(e){if(ns(e))throw new is("Can't call method on "+e);return e},ss=ts,as=os,cs=function(e){return ss(as(e))},us=Vo,ds=function(e){return"object"==typeof e?null!==e:us(e)},ls={},hs=ls,ps=Ao,fs=Vo,Es=function(e){return fs(e)?e:void 0},ms=function(e,t){return arguments.length<2?Es(hs[e])||Es(ps[e]):hs[e]&&hs[e][t]||ps[e]&&ps[e][t]},_s=Ao.navigator,Ts=_s&&_s.userAgent,gs=Ts?String(Ts):"",Ss=Ao,ys=gs,vs=Ss.process,Rs=Ss.Deno,As=vs&&vs.versions||Rs&&Rs.version,bs=As&&As.v8;bs&&(Xo=(zo=bs.split("."))[0]>0&&zo[0]<4?1:+(zo[0]+zo[1])),!Xo&&ys&&(!(zo=ys.match(/Edge\/(\d+)/))||zo[1]>=74)&&(zo=ys.match(/Chrome\/(\d+)/))&&(Xo=+zo[1]);var Os=Xo,Is=Os,Cs=Eo,ws=Ao.String,Ns=!!Object.getOwnPropertySymbols&&!Cs((function(){var e=Symbol("symbol detection");return!ws(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Is&&Is<41})),Ds=Ns&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ps=ms,Ls=Vo,ks=vo,Ms=Object,Us=Ds?function(e){return"symbol"==typeof e}:function(e){var t=Ps("Symbol");return Ls(t)&&ks(t.prototype,Ms(e))},xs=String,Vs=function(e){try{return xs(e)}catch(e){return"Object"}},Fs=Vo,Bs=Vs,js=TypeError,Ws=function(e){if(Fs(e))return e;throw new js(Bs(e)+" is not a function")},Gs=Ws,Hs=rs,Ks=function(e,t){var r=e[t];return Hs(r)?void 0:Gs(r)},Ys=Go,Zs=Vo,zs=ds,Xs=TypeError,Js={exports:{}},Qs=Ao,qs=Object.defineProperty,$s=Ao,ea=function(e,t){try{qs(Qs,e,{value:t,configurable:!0,writable:!0})}catch(r){Qs[e]=t}return t},ta="__core-js_shared__",ra=Js.exports=$s[ta]||ea(ta,{});(ra.versions||(ra.versions=[])).push({version:"3.49.0",mode:"pure",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"});var na=Js.exports,ia=na,oa=function(e,t){return ia[e]||(ia[e]=t||{})},sa=os,aa=Object,ca=function(e){return aa(sa(e))},ua=ca,da=yo({}.hasOwnProperty),la=Object.hasOwn||function(e,t){return da(ua(e),t)},ha=yo,pa=0,fa=Math.random(),Ea=ha(1.1.toString),ma=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ea(++pa+fa,36)},_a=oa,Ta=la,ga=ma,Sa=Ns,ya=Ds,va=Ao.Symbol,Ra=_a("wks"),Aa=ya?va.for||va:va&&va.withoutSetter||ga,ba=function(e){return Ta(Ra,e)||(Ra[e]=Sa&&Ta(va,e)?va[e]:Aa("Symbol."+e)),Ra[e]},Oa=Go,Ia=ds,Ca=Us,wa=Ks,Na=function(e,t){var r,n;if("string"===t&&Zs(r=e.toString)&&!zs(n=Ys(r,e)))return n;if(Zs(r=e.valueOf)&&!zs(n=Ys(r,e)))return n;if("string"!==t&&Zs(r=e.toString)&&!zs(n=Ys(r,e)))return n;throw new Xs("Can't convert object to primitive value")},Da=TypeError,Pa=ba("toPrimitive"),La=function(e,t){if(!Ia(e)||Ca(e))return e;var r,n=wa(e,Pa);if(n){if(void 0===t&&(t="default"),r=Oa(n,e,t),!Ia(r)||Ca(r))return r;throw new Da("Can't convert object to primitive value")}return void 0===t&&(t="number"),Na(e,t)},ka=Us,Ma=function(e){var t=La(e,"string");return ka(t)?t:t+""},Ua=ds,xa=Ao.document,Va=Ua(xa)&&Ua(xa.createElement),Fa=function(e){return Va?xa.createElement(e):{}},Ba=Fa,ja=!Bo&&!Eo((function(){return 7!==Object.defineProperty(Ba("div"),"a",{get:function(){return 7}}).a})),Wa=Bo,Ga=Go,Ha=Ho,Ka=Jo,Ya=cs,Za=Ma,za=la,Xa=ja,Ja=Object.getOwnPropertyDescriptor;Fo.f=Wa?Ja:function(e,t){if(e=Ya(e),t=Za(t),Xa)try{return Ja(e,t)}catch(e){}if(za(e,t))return Ka(!Ga(Ha.f,e,t),e[t])};var Qa=Eo,qa=Vo,$a=/#|\.prototype\./,ec=function(e,t){var r=rc[tc(e)];return r===ic||r!==nc&&(qa(t)?Qa(t):!!t)},tc=ec.normalize=function(e){return String(e).replace($a,".").toLowerCase()},rc=ec.data={},nc=ec.NATIVE="N",ic=ec.POLYFILL="P",oc=ec,sc=Ws,ac=mo,cc=Uo(Uo.bind),uc=function(e,t){return sc(e),void 0===t?e:ac?cc(e,t):function(){return e.apply(t,arguments)}},dc={},lc=Bo&&Eo((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),hc=ds,pc=String,fc=TypeError,Ec=function(e){if(hc(e))return e;throw new fc(pc(e)+" is not an object")},mc=Bo,_c=ja,Tc=lc,gc=Ec,Sc=Ma,yc=TypeError,vc=Object.defineProperty,Rc=Object.getOwnPropertyDescriptor,Ac="enumerable",bc="configurable",Oc="writable";dc.f=mc?Tc?function(e,t,r){if(gc(e),t=Sc(t),gc(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Oc in r&&!r[Oc]){var n=Rc(e,t);n&&n[Oc]&&(e[t]=r.value,r={configurable:bc in r?r[bc]:n[bc],enumerable:Ac in r?r[Ac]:n[Ac],writable:!1})}return vc(e,t,r)}:vc:function(e,t,r){if(gc(e),t=Sc(t),gc(r),_c)try{return vc(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new yc("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ic=dc,Cc=Jo,wc=Bo?function(e,t,r){return Ic.f(e,t,Cc(1,r))}:function(e,t,r){return e[t]=r,e},Nc=Ao,Dc=wo,Pc=Uo,Lc=Vo,kc=Fo.f,Mc=oc,Uc=ls,xc=uc,Vc=wc,Fc=la,Bc=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return Dc(e,this,arguments)};return t.prototype=e.prototype,t},jc=function(e,t){var r,n,i,o,s,a,c,u,d,l=e.target,h=e.global,p=e.stat,f=e.proto,E=h?Nc:p?Nc[l]:Nc[l]&&Nc[l].prototype,m=h?Uc:Uc[l]||Vc(Uc,l,{})[l],_=m.prototype;for(o in t)n=!(r=Mc(h?o:l+(p?".":"#")+o,e.forced))&&E&&Fc(E,o),a=m[o],n&&(c=e.dontCallGetSet?(d=kc(E,o))&&d.value:E[o]),s=n&&c?c:t[o],(r||f||typeof a!=typeof s)&&(u=e.bind&&n?xc(s,Nc):e.wrap&&n?Bc(s):f&&Lc(s)?Pc(s):s,(e.sham||s&&s.sham||a&&a.sham)&&Vc(u,"sham",!0),Vc(m,o,u),f&&(Fc(Uc,i=l+"Prototype")||Vc(Uc,i,{}),Vc(Uc[i],o,s),e.real&&_&&(r||!_[o])&&Vc(_,o,s)))},Wc=Math.ceil,Gc=Math.floor,Hc=Math.trunc||function(e){var t=+e;return(t>0?Gc:Wc)(t)},Kc=Hc,Yc=function(e){var t=+e;return t!=t||0===t?0:Kc(t)},Zc=Yc,zc=Math.max,Xc=Math.min,Jc=function(e,t){var r=Zc(e);return r<0?zc(r+t,0):Xc(r,t)},Qc=Yc,qc=Math.min,$c=function(e){var t=Qc(e);return t>0?qc(t,9007199254740991):0},eu=function(e){return $c(e.length)},tu=cs,ru=Jc,nu=eu,iu=function(e){return function(t,r,n){var i=tu(t),o=nu(i);if(0===o)return!e&&-1;var s,a=ru(n,o);if(e&&r!=r){for(;o>a;)if((s=i[a++])!=s)return!0}else for(;o>a;a++)if((e||a in i)&&i[a]===r)return e||a||0;return!e&&-1}},ou={includes:iu(!0),indexOf:iu(!1)},su=jc,au=ou.includes,cu=Eo,uu=cu((function(){return!Array(1).includes()})),du=cu((function(){return[,1].includes(void 0,1)}));su({target:"Array",proto:!0,forced:uu||du},{includes:function(e){return au(this,e,arguments.length>1?arguments[1]:void 0)}});var lu=Ao,hu=ls,pu=function(e,t){var r=hu[e+"Prototype"],n=r&&r[t];if(n)return n;var i=lu[e],o=i&&i.prototype;return o&&o[t]},fu=pu("Array","includes"),Eu=ds,mu=Lo,_u=ba("match"),Tu=function(e){var t;return Eu(e)&&(void 0!==(t=e[_u])?!!t:"RegExp"===mu(e))},gu=TypeError,Su={};Su[ba("toStringTag")]="z";var yu="[object z]"===String(Su),vu=yu,Ru=Vo,Au=Lo,bu=ba("toStringTag"),Ou=Object,Iu="Arguments"===Au(function(){return arguments}()),Cu=vu?Au:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Ou(e),bu))?r:Iu?Au(t):"Object"===(n=Au(t))&&Ru(t.callee)?"Arguments":n},wu=Cu,Nu=String,Du=function(e){if("Symbol"===wu(e))throw new TypeError("Cannot convert a Symbol value to a string");return Nu(e)},Pu=ba("match"),Lu=jc,ku=function(e){if(Tu(e))throw new gu("The method doesn't accept regular expressions");return e},Mu=os,Uu=Du,xu=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Pu]=!1,"/./"[e](t)}catch(e){}}return!1},Vu=yo("".indexOf);Lu({target:"String",proto:!0,forced:!xu("includes")},{includes:function(e){return!!~Vu(Uu(Mu(this)),Uu(ku(e)),arguments.length>1?arguments[1]:void 0)}});var Fu=pu("String","includes"),Bu=vo,ju=fu,Wu=Fu,Gu=Array.prototype,Hu=String.prototype,Ku=function(e){var t=e.includes;return e===Gu||Bu(Gu,e)&&t===Gu.includes?ju:"string"==typeof e||e===Hu||Bu(Hu,e)&&t===Hu.includes?Wu:t},Yu=X(Ku);function Zu(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function zu(e,t,r,n,i){return{width:e,height:t,frameRate:r,bitrateMin:n,bitrateMax:i}}function Xu(e,t,r,n,i){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:n,bitrateMax:i}}function Ju(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const Qu={"90p":zu(160,90),"90p_1":zu(160,90),"120p":zu(160,120,15,30,65),"120p_1":zu(160,120,15,30,65),"120p_3":zu(120,120,15,30,50),"120p_4":zu(212,120),"180p":zu(320,180,15,30,140),"180p_1":zu(320,180,15,30,140),"180p_3":zu(180,180,15,30,100),"180p_4":zu(240,180,15,30,120),"240p":zu(320,240,15,40,200),"240p_1":zu(320,240,15,40,200),"240p_3":zu(240,240,15,40,140),"240p_4":zu(424,240,15,40,220),"360p":zu(640,360,15,80,400),"360p_1":zu(640,360,15,80,400),"360p_3":zu(360,360,15,80,260),"360p_4":zu(640,360,30,80,600),"360p_6":zu(360,360,30,80,400),"360p_7":zu(480,360,15,80,320),"360p_8":zu(480,360,30,80,490),"360p_9":zu(640,360,15,80,800),"360p_10":zu(640,360,24,80,800),"360p_11":zu(640,360,24,80,1e3),"480p":zu(640,480,15,100,500),"480p_1":zu(640,480,15,100,500),"480p_2":zu(640,480,30,100,1e3),"480p_3":zu(480,480,15,100,400),"480p_4":zu(640,480,30,100,750),"480p_6":zu(480,480,30,100,600),"480p_8":zu(848,480,15,100,610),"480p_9":zu(848,480,30,100,930),"480p_10":zu(640,480,10,100,400),"720p":zu(1280,720,15,120,1130),"720p_auto":zu(1280,720,30,900,3e3),"720p_1":zu(1280,720,15,120,1130),"720p_2":zu(1280,720,30,120,2e3),"720p_3":zu(1280,720,30,120,1710),"720p_5":zu(960,720,15,120,910),"720p_6":zu(960,720,30,120,1380),"1080p":zu(1920,1080,15,120,2080),"1080p_1":zu(1920,1080,15,120,2080),"1080p_2":zu(1920,1080,30,120,3e3),"1080p_3":zu(1920,1080,30,120,3150),"1080p_5":zu(1920,1080,60,120,4780),"1440p":zu(2560,1440,30,120,4850),"1440p_1":zu(2560,1440,30,120,4850),"1440p_2":zu(2560,1440,60,120,7350),"4k":zu(3840,2160,30,120,8910),"4k_1":zu(3840,2160,30,120,8910),"4k_3":zu(3840,2160,60,120,13500)},qu={"480p":Xu(640,480,5),"480p_1":Xu(640,480,5),"480p_2":Xu(640,480,30),"480p_3":Xu(640,480,15),"720p":Xu(1280,720,5),"720p_auto":zu(1280,720,30,900,3e3),"720p_1":Xu(1280,720,5),"720p_2":Xu(1280,720,30),"720p_3":Xu(1280,720,15),"1080p":Xu(1920,1080,5),"1080p_1":Xu(1920,1080,5),"1080p_2":Xu(1920,1080,30),"1080p_3":Xu(1920,1080,15)},$u={"1SL1TL":Ju(1,1),"3SL3TL":Ju(3,3),"2SL3TL":Ju(2,3)};function ed(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},Qu[e]):e}function td(e){return"string"==typeof e?Object.assign({},qu[e]):e}function rd(e){return"string"==typeof e?Object.assign({},$u[e]):e}const nd={speech_low_quality:Zu(16e3,!1),speech_standard:Zu(32e3,!1,18),music_standard:Zu(48e3,!1),standard_stereo:Zu(48e3,!0,56),high_quality:Zu(48e3,!1,128),high_quality_stereo:Zu(48e3,!0,192)};function id(e){return"string"==typeof e?Object.assign({},nd[e]):e}const od=[];function sd(e){Yu(od).call(od,e)||od.push(e)}function ad(e){const t=od.indexOf(e);-1!==t&&od.splice(t,1)}function cd(){return od.some((e=>function(e){return"__className__"in e&&"MicrophoneAudioTrack"===e.__className__}(e)))}function ud(e){return Tn(e.width,"config.width"),Tn(e.height,"config.height"),void 0!==e.frameRate&&Tn(e.frameRate,"config.frameRate"),void 0!==e.bitrateMax&&_n(e.bitrateMax,"config.bitrateMax"),void 0!==e.bitrateMin&&_n(e.bitrateMin,"config.bitrateMin"),void 0!==e.minDownscaleWidth&&_n(e.minDownscaleWidth,"config.minDownscaleWidth",1,1/0,!0),void 0!==e.minDownscaleHeight&&_n(e.minDownscaleHeight,"config.minDownscaleHeight",1,1/0,!0),!0}function dd(e){return void 0!==e.sampleRate&&_n(e.sampleRate,"config.sampleRate",0,96e3,!0),void 0!==e.sampleSize&&_n(e.sampleRate,"config.sampleSize",0,128,!0),void 0!==e.stereo&&En(e.stereo,"config.stereo"),void 0!==e.bitrate&&_n(e.bitrate,"config.bitrate",0,1e4,!1),!0}function ld(e){return mn(e,"mediaSource",["screen","window","application"]),!0}let hd=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}({}),pd=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 fd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),Ed=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}({}),md=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}({}),_d=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}({}),Td=function(e){return e.SOURCE_STATE_CHANGE="source-state-change",e.TRACK_ENDED="track-ended",e.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.CLOSED="closed",e}({}),gd=function(e){return e.FIRST_FRAME_DECODED="first-frame-decoded",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.VIDEO_STATE_CHANGED="video-state-changed",e.PLAY_START="play-start",e.PLAY_END="play-end",e.FIRST_FRAME_RENDER="first-frame-render",e}({}),Sd=function(e){return e.AUDIO="audio",e.VIDEO="video",e.DATA="data",e}({}),yd=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}({}),vd=function(e){return e.UPDATE_TRACK_SOURCE="update-track-source",e}({});const Rd={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},Ad={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},bd={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},Od={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 Id=function(e){return e.ON_TRACK="on_track",e.ON_NODE="on_node",e}({}),Cd=function(e){return e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints",e}({}),wd=function(e){return e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND",e}({}),Nd=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 Dd=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}({}),Pd=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 Ld=function(e){return e.OPEN="open",e.MESSAGE="message",e.CLOSE="close",e.CLOSING="closing",e.ERROR="error",e}({});var kd={exports:{}},Md=jc,Ud=Bo,xd=dc.f;Md({target:"Object",stat:!0,forced:Object.defineProperty!==xd,sham:!Ud},{defineProperty:xd});var Vd=ls.Object,Fd=kd.exports=function(e,t,r){return Vd.defineProperty(e,t,r)};Vd.defineProperty.sham&&(Fd.sham=!0);var Bd=X(kd.exports),jd=Lo,Wd=Array.isArray||function(e){return"Array"===jd(e)},Gd=TypeError,Hd=function(e){if(e>9007199254740991)throw new Gd("Maximum allowed index exceeded");return e},Kd=Bo,Yd=dc,Zd=Jo,zd=function(e,t,r){Kd?Yd.f(e,t,Zd(0,r)):e[t]=r},Xd=Bo,Jd=Wd,Qd=TypeError,qd=Object.getOwnPropertyDescriptor,$d=Xd&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(Jd(e)&&!qd(e,"length").writable)throw new Qd("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},el=Vo,tl=na,rl=yo(Function.toString);el(tl.inspectSource)||(tl.inspectSource=function(e){return rl(e)});var nl=tl.inspectSource,il=yo,ol=Eo,sl=Vo,al=Cu,cl=nl,ul=function(){},dl=ms("Reflect","construct"),ll=/^\s*(?:class|function)\b/,hl=il(ll.exec),pl=!ll.test(ul),fl=function(e){if(!sl(e))return!1;try{return dl(ul,[],e),!0}catch(e){return!1}},El=function(e){if(!sl(e))return!1;switch(al(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return pl||!!hl(ll,cl(e))}catch(e){return!0}};El.sham=!0;var ml=!dl||ol((function(){var e;return fl(fl.call)||!fl(Object)||!fl((function(){e=!0}))||e}))?El:fl,_l=Wd,Tl=ml,gl=ds,Sl=ba("species"),yl=Array,vl=function(e){var t;return _l(e)&&(t=e.constructor,(Tl(t)&&(t===yl||_l(t.prototype))||gl(t)&&null===(t=t[Sl]))&&(t=void 0)),void 0===t?yl:t},Rl=function(e,t){return new(vl(e))(0===t?0:t)},Al=Eo,bl=Os,Ol=ba("species"),Il=function(e){return bl>=51||!Al((function(){var t=[];return(t.constructor={})[Ol]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Cl=jc,wl=Eo,Nl=Wd,Dl=ds,Pl=ca,Ll=eu,kl=Hd,Ml=zd,Ul=$d,xl=Rl,Vl=Il,Fl=Os,Bl=ba("isConcatSpreadable"),jl=Fl>=51||!wl((function(){var e=[];return e[Bl]=!1,e.concat()[0]!==e})),Wl=function(e){if(!Dl(e))return!1;var t=e[Bl];return void 0!==t?!!t:Nl(e)};Cl({target:"Array",proto:!0,arity:1,forced:!jl||!Vl("concat")},{concat:function(e){var t,r,n,i,o,s=Pl(this),a=xl(s,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(Wl(o=-1===t?s:arguments[t]))for(i=Ll(o),kl(c+i),r=0;r<i;r++,c++)r in o&&Ml(a,c,o[r]);else kl(c+1),Ml(a,c++,o);return Ul(a,c),a}});var Gl={},Hl={},Kl=la,Yl=cs,Zl=ou.indexOf,zl=Hl,Xl=yo([].push),Jl=function(e,t){var r,n=Yl(e),i=0,o=[];for(r in n)!Kl(zl,r)&&Kl(n,r)&&Xl(o,r);for(;t.length>i;)Kl(n,r=t[i++])&&(~Zl(o,r)||Xl(o,r));return o},Ql=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ql=Jl,$l=Ql,eh=Object.keys||function(e){return ql(e,$l)},th=Bo,rh=lc,nh=dc,ih=Ec,oh=cs,sh=eh;Gl.f=th&&!rh?Object.defineProperties:function(e,t){ih(e);for(var r,n=oh(t),i=sh(t),o=i.length,s=0;o>s;)nh.f(e,r=i[s++],n[r]);return e};var ah,ch=ms("document","documentElement"),uh=ma,dh=oa("keys"),lh=function(e){return dh[e]||(dh[e]=uh(e))},hh=Ec,ph=Gl,fh=Ql,Eh=Hl,mh=ch,_h=Fa,Th="prototype",gh="script",Sh=lh("IE_PROTO"),yh=function(){},vh=function(e){return"<"+gh+">"+e+"</"+gh+">"},Rh=function(e){e.write(vh("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ah=function(){try{ah=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Ah="undefined"!=typeof document?document.domain&&ah?Rh(ah):(t=_h("iframe"),r="java"+gh+":",t.style.display="none",mh.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(vh("document.F=Object")),e.close(),e.F):Rh(ah);for(var n=fh.length;n--;)delete Ah[Th][fh[n]];return Ah()};Eh[Sh]=!0;var bh=Object.create||function(e,t){var r;return null!==e?(yh[Th]=hh(e),r=new yh,yh[Th]=null,r[Sh]=e):r=Ah(),void 0===t?r:ph.f(r,t)},Oh={},Ih=Jl,Ch=Ql.concat("length","prototype");Oh.f=Object.getOwnPropertyNames||function(e){return Ih(e,Ch)};var wh={},Nh=yo([].slice),Dh=Lo,Ph=cs,Lh=Oh.f,kh=Nh,Mh="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];wh.f=function(e){return Mh&&"Window"===Dh(e)?function(e){try{return Lh(e)}catch(e){return kh(Mh)}}(e):Lh(Ph(e))};var Uh={};Uh.f=Object.getOwnPropertySymbols;var xh=wc,Vh=function(e,t,r,n){return n&&n.enumerable?e[t]=r:xh(e,t,r),e},Fh=dc,Bh=function(e,t,r){return Fh.f(e,t,r)},jh={},Wh=ba;jh.f=Wh;var Gh,Hh,Kh,Yh=ls,Zh=la,zh=jh,Xh=dc.f,Jh=function(e){var t=Yh.Symbol||(Yh.Symbol={});Zh(t,e)||Xh(t,e,{value:zh.f(e)})},Qh=Go,qh=ms,$h=ba,ep=Vh,tp=function(){var e=qh("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=$h("toPrimitive");t&&!t[n]&&ep(t,n,(function(e){return Qh(r,this)}),{arity:1})},rp=Cu,np=yu?{}.toString:function(){return"[object "+rp(this)+"]"},ip=yu,op=dc.f,sp=wc,ap=la,cp=np,up=ba("toStringTag"),dp=function(e,t,r,n){var i=r?e:e&&e.prototype;i&&(ap(i,up)||op(i,up,{configurable:!0,value:t}),n&&!ip&&sp(i,"toString",cp))},lp=Vo,hp=Ao.WeakMap,pp=lp(hp)&&/native code/.test(String(hp)),fp=Ao,Ep=ds,mp=wc,_p=la,Tp=na,gp=lh,Sp=Hl,yp="Object already initialized",vp=fp.TypeError,Rp=fp.WeakMap;if(pp||Tp.state){var Ap=Tp.state||(Tp.state=new Rp);Ap.get=Ap.get,Ap.has=Ap.has,Ap.set=Ap.set,Gh=function(e,t){if(Ap.has(e))throw new vp(yp);return t.facade=e,Ap.set(e,t),t},Hh=function(e){return Ap.get(e)||{}},Kh=function(e){return Ap.has(e)}}else{var bp=gp("state");Sp[bp]=!0,Gh=function(e,t){if(_p(e,bp))throw new vp(yp);return t.facade=e,mp(e,bp,t),t},Hh=function(e){return _p(e,bp)?e[bp]:{}},Kh=function(e){return _p(e,bp)}}var Op={set:Gh,get:Hh,has:Kh,enforce:function(e){return Kh(e)?Hh(e):Gh(e,{})},getterFor:function(e){return function(t){var r;if(!Ep(t)||(r=Hh(t)).type!==e)throw new vp("Incompatible receiver, "+e+" required");return r}}},Ip=uc,Cp=ts,wp=ca,Np=eu,Dp=Rl,Pp=zd,Lp=function(e){var t=1===e,r=2===e,n=3===e,i=4===e,o=6===e,s=7===e,a=5===e||o;return function(c,u,d){for(var l,h,p=wp(c),f=Cp(p),E=Np(f),m=Ip(u,d),_=0,T=0,g=t?Dp(c,E):r||s?Dp(c,0):void 0;E>_;_++)if((a||_ in f)&&(h=m(l=f[_],_,p),e))if(t)Pp(g,_,h);else if(h)switch(e){case 3:return!0;case 5:return l;case 6:return _;case 2:Pp(g,T++,l)}else switch(e){case 4:return!1;case 7:Pp(g,T++,l)}return o?-1:n||i?i:g}},kp={forEach:Lp(0),map:Lp(1),filter:Lp(2),some:Lp(3),every:Lp(4),find:Lp(5),findIndex:Lp(6),filterReject:Lp(7)},Mp=jc,Up=Ao,xp=Go,Vp=yo,Fp=Bo,Bp=Ns,jp=Eo,Wp=la,Gp=vo,Hp=Ec,Kp=cs,Yp=Ma,Zp=Du,zp=Jo,Xp=bh,Jp=eh,Qp=Oh,qp=wh,$p=Uh,ef=Fo,tf=dc,rf=Gl,nf=Ho,of=Vh,sf=Bh,af=oa,cf=Hl,uf=ma,df=ba,lf=jh,hf=Jh,pf=tp,ff=dp,Ef=Op,mf=kp.forEach,_f=lh("hidden"),Tf="Symbol",gf="prototype",Sf=Ef.set,yf=Ef.getterFor(Tf),vf=Object[gf],Rf=Up.Symbol,Af=Rf&&Rf[gf],bf=Up.RangeError,Of=Up.TypeError,If=Up.QObject,Cf=ef.f,wf=tf.f,Nf=qp.f,Df=nf.f,Pf=Vp([].push),Lf=af("symbols"),kf=af("op-symbols"),Mf=af("wks"),Uf=!If||!If[gf]||!If[gf].findChild,xf=function(e,t,r){var n=Cf(vf,t);return n&&delete vf[t],wf(e,t,r),n&&e!==vf&&wf(vf,t,n),e},Vf=Fp&&jp((function(){return 7!==Xp(wf({},"a",{get:function(){return wf(this,"a",{value:7}).a}})).a}))?xf:wf,Ff=function(e,t){var r=Lf[e]=Xp(Af);return Sf(r,{type:Tf,tag:e,description:t}),Fp||(r.description=t),r},Bf=function(e,t,r){e===vf&&Bf(kf,t,r),Hp(e);var n=Yp(t);return Hp(r),Wp(Lf,n)?(("enumerable"in r?!r.enumerable:!Wp(e,n)||Wp(e,_f)&&e[_f][n])?(Wp(e,_f)||wf(e,_f,zp(1,Xp(null))),e[_f][n]=!0):(Wp(e,_f)&&e[_f][n]&&(e[_f][n]=!1),r=Xp(r,{enumerable:zp(0,!1)})),Vf(e,n,r)):wf(e,n,r)},jf=function(e,t){Hp(e);var r=Kp(t),n=Jp(r).concat(Kf(r));return mf(n,(function(t){Fp&&!xp(Wf,r,t)||Bf(e,t,r[t])})),e},Wf=function(e){var t=Yp(e),r=xp(Df,this,t);return!(this===vf&&Wp(Lf,t)&&!Wp(kf,t))&&(!(r||!Wp(this,t)||!Wp(Lf,t)||Wp(this,_f)&&this[_f][t])||r)},Gf=function(e,t){var r=Kp(e),n=Yp(t);if(r!==vf||!Wp(Lf,n)||Wp(kf,n)){var i=Cf(r,n);return!i||!Wp(Lf,n)||Wp(r,_f)&&r[_f][n]||(i.enumerable=!0),i}},Hf=function(e){var t=Nf(Kp(e)),r=[];return mf(t,(function(e){Wp(Lf,e)||Wp(cf,e)||Pf(r,e)})),r},Kf=function(e){var t=e===vf,r=Nf(t?kf:Kp(e)),n=[];return mf(r,(function(e){!Wp(Lf,e)||t&&!Wp(vf,e)||Pf(n,Lf[e])})),n};Bp||(Rf=function(){if(Gp(Af,this))throw new Of("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Zp(arguments[0]):void 0,t=uf(e),r=function(e){var n=void 0===this?Up:this;n===vf&&xp(r,kf,e),Wp(n,_f)&&Wp(n[_f],t)&&(n[_f][t]=!1);var i=zp(1,e);try{Vf(n,t,i)}catch(e){if(!(e instanceof bf))throw e;xf(n,t,i)}};return Fp&&Uf&&Vf(vf,t,{configurable:!0,set:r}),Ff(t,e)},of(Af=Rf[gf],"toString",(function(){return yf(this).tag})),of(Rf,"withoutSetter",(function(e){return Ff(uf(e),e)})),nf.f=Wf,tf.f=Bf,rf.f=jf,ef.f=Gf,Qp.f=qp.f=Hf,$p.f=Kf,lf.f=function(e){return Ff(df(e),e)},Fp&&sf(Af,"description",{configurable:!0,get:function(){return yf(this).description}})),Mp({global:!0,constructor:!0,wrap:!0,forced:!Bp,sham:!Bp},{Symbol:Rf}),mf(Jp(Mf),(function(e){hf(e)})),Mp({target:Tf,stat:!0,forced:!Bp},{useSetter:function(){Uf=!0},useSimple:function(){Uf=!1}}),Mp({target:"Object",stat:!0,forced:!Bp,sham:!Fp},{create:function(e,t){return void 0===t?Xp(e):jf(Xp(e),t)},defineProperty:Bf,defineProperties:jf,getOwnPropertyDescriptor:Gf}),Mp({target:"Object",stat:!0,forced:!Bp},{getOwnPropertyNames:Hf}),pf(),ff(Rf,Tf),cf[_f]=!0;var Yf=Ns&&!!Symbol.for&&!!Symbol.keyFor,Zf=jc,zf=ms,Xf=la,Jf=Du,Qf=oa,qf=Yf,$f=Qf("string-to-symbol-registry"),eE=Qf("symbol-to-string-registry");Zf({target:"Symbol",stat:!0,forced:!qf},{for:function(e){var t=Jf(e);if(Xf($f,t))return $f[t];var r=zf("Symbol")(t);return $f[t]=r,eE[r]=t,r}});var tE=jc,rE=la,nE=Us,iE=Vs,oE=Yf,sE=oa("symbol-to-string-registry");tE({target:"Symbol",stat:!0,forced:!oE},{keyFor:function(e){if(!nE(e))throw new TypeError(iE(e)+" is not a symbol");if(rE(sE,e))return sE[e]}});var aE=ds,cE=Op.get,uE=yo,dE=la,lE=SyntaxError,hE=parseInt,pE=String.fromCharCode,fE=uE("".charAt),EE=uE("".slice),mE=uE(/./.exec),_E={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},TE=/^[\da-f]{4}$/i,gE=/^[\u0000-\u001F]$/,SE=!Eo((function(){var e="9007199254740993",t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e})),yE=jc,vE=ms,RE=wo,AE=Go,bE=yo,OE=Eo,IE=Wd,CE=Vo,wE=function(e){if(!aE(e))return!1;var t=cE(e);return!!t&&"RawJSON"===t.type},NE=Us,DE=Lo,PE=Du,LE=Nh,kE=function(e,t){for(var r=!0,n="";t<e.length;){var i=fE(e,t);if("\\"===i){var o=EE(e,t,t+2);if(dE(_E,o))n+=_E[o],t+=2;else{if("\\u"!==o)throw new lE('Unknown escape sequence: "'+o+'"');var s=EE(e,t+=2,t+4);if(!mE(TE,s))throw new lE("Bad Unicode escape at: "+t);n+=pE(hE(s,16)),t+=4}}else{if('"'===i){r=!1,t++;break}if(mE(gE,i))throw new lE("Bad control character in string literal at: "+t);n+=i,t++}}if(r)throw new lE("Unterminated string at: "+t);return{value:n,end:t}},ME=ma,UE=Ns,xE=SE,VE=String,FE=vE("JSON","stringify"),BE=bE(/./.exec),jE=bE("".charAt),WE=bE("".charCodeAt),GE=bE("".replace),HE=bE("".slice),KE=bE([].push),YE=bE(1.1.toString),ZE=/[\uD800-\uDFFF]/g,zE=/^[\uD800-\uDBFF]$/,XE=/^[\uDC00-\uDFFF]$/,JE=ME(),QE=JE.length,qE=!UE||OE((function(){var e=vE("Symbol")("stringify detection");return"[null]"!==FE([e])||"{}"!==FE({a:e})||"{}"!==FE(Object(e))})),$E=OE((function(){return'"\\udf06\\ud834"'!==FE("\udf06\ud834")||'"\\udead"'!==FE("\udead")})),em=qE?function(e,t){var r=LE(arguments),n=rm(t);if(CE(n)||void 0!==e&&!NE(e))return r[1]=function(e,t){if(CE(n)&&(t=AE(n,this,VE(e),t)),!NE(t))return t},RE(FE,null,r)}:FE,tm=function(e,t,r){var n=jE(r,t-1),i=jE(r,t+1);return BE(zE,e)&&!BE(XE,i)||BE(XE,e)&&!BE(zE,n)?"\\u"+YE(WE(e,0),16):e},rm=function(e){if(CE(e))return e;if(IE(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?KE(r,i):"number"!=typeof i&&"Number"!==DE(i)&&"String"!==DE(i)||KE(r,PE(i))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(IE(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}};FE&&yE({target:"JSON",stat:!0,arity:3,forced:qE||$E||!xE},{stringify:function(e,t,r){var n=rm(t),i=[],o=em(e,(function(e,t){var r=CE(n)?AE(n,this,VE(e),t):t;return!xE&&wE(r)?JE+(KE(i,r.rawJSON)-1):r}),r);if("string"!=typeof o)return o;if($E&&(o=GE(o,ZE,tm)),xE)return o;for(var s="",a=o.length,c=0;c<a;c++){var u=jE(o,c);if('"'===u){var d=kE(o,++c).end-1,l=HE(o,c,d);s+=HE(l,0,QE)===JE?i[HE(l,QE)]:'"'+l+'"',c=d}else s+=u}return s}});var nm=Uh,im=ca;jc({target:"Object",stat:!0,forced:!Ns||Eo((function(){nm.f(1)}))},{getOwnPropertySymbols:function(e){var t=nm.f;return t?t(im(e)):[]}}),Jh("asyncDispose"),Jh("asyncIterator"),Jh("dispose"),Jh("hasInstance"),Jh("isConcatSpreadable"),Jh("iterator"),Jh("match"),Jh("matchAll"),Jh("replace"),Jh("search"),Jh("species"),Jh("split");var om=tp;Jh("toPrimitive"),om();var sm=ms,am=dp;Jh("toStringTag"),am(sm("Symbol"),"Symbol"),Jh("unscopables"),dp(Ao.JSON,"JSON",!0);var cm,um,dm,lm=ls.Symbol,hm={},pm=Bo,fm=la,Em=Function.prototype,mm=pm&&Object.getOwnPropertyDescriptor,_m=fm(Em,"name"),Tm={EXISTS:_m,PROPER:_m&&"something"===function(){}.name,CONFIGURABLE:_m&&(!pm||pm&&mm(Em,"name").configurable)},gm=!Eo((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Sm=la,ym=Vo,vm=ca,Rm=gm,Am=lh("IE_PROTO"),bm=Object,Om=bm.prototype,Im=Rm?bm.getPrototypeOf:function(e){var t=vm(e);if(Sm(t,Am))return t[Am];var r=t.constructor;return ym(r)&&t instanceof r?r.prototype:t instanceof bm?Om:null},Cm=Eo,wm=Vo,Nm=ds,Dm=bh,Pm=Im,Lm=Vh,km=ba("iterator"),Mm=!1;[].keys&&("next"in(dm=[].keys())?(um=Pm(Pm(dm)))!==Object.prototype&&(cm=um):Mm=!0);var Um=!Nm(cm)||Cm((function(){var e={};return cm[km].call(e)!==e}));wm((cm=Um?{}:Dm(cm))[km])||Lm(cm,km,(function(){return this}));var xm={IteratorPrototype:cm,BUGGY_SAFARI_ITERATORS:Mm},Vm=xm.IteratorPrototype,Fm=bh,Bm=Jo,jm=dp,Wm=hm,Gm=function(){return this},Hm=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Fm(Vm,{next:Bm(+!n,r)}),jm(e,i,!1,!0),Wm[i]=Gm,e},Km=yo,Ym=Ws,Zm=ds,zm=function(e){return Zm(e)||null===e},Xm=String,Jm=TypeError,Qm=function(e,t,r){try{return Km(Ym(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},qm=ds,$m=os,e_=function(e){if(zm(e))return e;throw new Jm("Can't set "+Xm(e)+" as a prototype")},t_=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Qm(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return $m(r),e_(n),qm(r)?(t?e(r,n):r.__proto__=n,r):r}}():void 0),r_=jc,n_=Go,i_=Tm,o_=Hm,s_=Im,a_=dp,c_=Vh,u_=hm,d_=xm,l_=i_.PROPER,h_=d_.BUGGY_SAFARI_ITERATORS,p_=ba("iterator"),f_="keys",E_="values",m_="entries",__=function(){return this},T_=function(e,t,r,n,i,o,s){o_(r,t,n);var a,c,u,d=function(e){if(e===i&&E)return E;if(!h_&&e&&e in p)return p[e];switch(e){case f_:case E_:case m_:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[p_]||p["@@iterator"]||i&&p[i],E=!h_&&f||d(i),m="Array"===t&&p.entries||f;if(m&&(a=s_(m.call(new e)))!==Object.prototype&&a.next&&(a_(a,l,!0,!0),u_[l]=__),l_&&i===E_&&f&&f.name!==E_&&(h=!0,E=function(){return n_(f,this)}),i)if(c={values:d(E_),keys:o?E:d(f_),entries:d(m_)},s)for(u in c)(h_||h||!(u in p))&&c_(p,u,c[u]);else r_({target:t,proto:!0,forced:h_||h},c);return s&&p[p_]!==E&&c_(p,p_,E,{name:i}),u_[t]=E,c},g_=function(e,t){return{value:e,done:t}},S_=cs,y_=hm,v_=Op;dc.f;var R_=T_,A_=g_,b_="Array Iterator",O_=v_.set,I_=v_.getterFor(b_);R_(Array,"Array",(function(e,t){O_(this,{type:b_,target:S_(e),index:0,kind:t})}),(function(){var e=I_(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,A_(void 0,!0);switch(e.kind){case"keys":return A_(r,!1);case"values":return A_(t[r],!1)}return A_([r,t[r]],!1)}),"values"),y_.Arguments=y_.Array;var C_={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},w_=Ao,N_=dp,D_=hm;for(var P_ in C_)N_(w_[P_],P_),D_[P_]=D_.Array;var L_=lm,k_=ba,M_=dc.f,U_=k_("metadata"),x_=Function.prototype;void 0===x_[U_]&&M_(x_,U_,{value:null}),Jh("metadata");var V_=L_,F_=yo,B_=ms("Symbol"),j_=B_.keyFor,W_=F_(B_.prototype.valueOf),G_=B_.isRegisteredSymbol||function(e){try{return void 0!==j_(W_(e))}catch(e){return!1}};jc({target:"Symbol",stat:!0},{isRegisteredSymbol:G_});for(var H_=oa,K_=ms,Y_=yo,Z_=Us,z_=ba,X_=K_("Symbol"),J_=X_.isWellKnownSymbol,Q_=K_("Object","getOwnPropertyNames"),q_=Y_(X_.prototype.valueOf),$_=H_("wks"),eT=0,tT=Q_(X_),rT=tT.length;eT<rT;eT++)try{var nT=tT[eT];Z_(X_[nT])&&z_(nT)}catch(e){}var iT=function(e){if(J_&&J_(e))return!0;try{for(var t=q_(e),r=0,n=Q_($_),i=n.length;r<i;r++)if($_[n[r]]==t)return!0}catch(e){}return!1};jc({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:iT}),Jh("customMatcher"),Jh("observable"),jc({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:G_}),jc({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:iT}),Jh("matcher"),Jh("metadataKey"),Jh("patternMatch"),Jh("replaceAll");var oT=X(V_),sT=yo,aT=Yc,cT=Du,uT=os,dT=sT("".charAt),lT=sT("".charCodeAt),hT=sT("".slice),pT=function(e){return function(t,r){var n,i,o=cT(uT(t)),s=aT(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=lT(o,s))<55296||n>56319||s+1===a||(i=lT(o,s+1))<56320||i>57343?e?dT(o,s):n:e?hT(o,s,s+2):i-56320+(n-55296<<10)+65536}},fT={codeAt:pT(!1),charAt:pT(!0)},ET=fT.charAt,mT=Du,_T=Op,TT=T_,gT=g_,ST="String Iterator",yT=_T.set,vT=_T.getterFor(ST);TT(String,"String",(function(e){yT(this,{type:ST,string:mT(e),index:0})}),(function(){var e,t=vT(this),r=t.string,n=t.index;return n>=r.length?gT(void 0,!0):(e=ET(r,n),t.index+=e.length,gT(e,!1))}));var RT=X(jh.f("iterator"));function AT(e){return AT="function"==typeof oT&&"symbol"==typeof RT?function(e){return typeof e}:function(e){return e&&"function"==typeof oT&&e.constructor===oT&&e!==oT.prototype?"symbol":typeof e},AT(e)}var bT=X(jh.f("toPrimitive"));function OT(e){var t=function(e,t){if("object"!==AT(e)||null===e)return e;var r=e[bT];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==AT(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===AT(t)?t:String(t)}function IT(e,t,r){return(t=OT(t))in e?Bd(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var CT=Eo,wT=function(e,t){var r=[][e];return!!r&&CT((function(){r.call(null,t||function(){return 1},1)}))},NT=kp.forEach,DT=wT("forEach")?[].forEach:function(e){return NT(this,e,arguments.length>1?arguments[1]:void 0)};jc({target:"Array",proto:!0,forced:[].forEach!==DT},{forEach:DT});var PT=pu("Array","forEach"),LT=Cu,kT=la,MT=vo,UT=PT,xT=Array.prototype,VT={DOMTokenList:!0,NodeList:!0},FT=function(e){var t=e.forEach;return e===xT||MT(xT,e)&&t===xT.forEach||kT(VT,LT(e))?UT:t},BT=X(FT),jT=ca,WT=eh;jc({target:"Object",stat:!0,forced:Eo((function(){WT(1)}))},{keys:function(e){return WT(jT(e))}});var GT=X(ls.Object.keys),HT=Ws,KT=ca,YT=ts,ZT=eu,zT=TypeError,XT="Reduce of empty array with no initial value",JT=function(e){return function(t,r,n,i){var o=KT(t),s=YT(o),a=ZT(o);if(HT(r),0===a&&n<2)throw new zT(XT);var c=e?a-1:0,u=e?-1:1;if(n<2)for(;;){if(c in s){i=s[c],c+=u;break}if(c+=u,e?c<0:a<=c)throw new zT(XT)}for(;e?c>=0:a>c;c+=u)c in s&&(i=r(i,s[c],c,o));return i}},QT={left:JT(!1),right:JT(!0)},qT=Ao,$T=gs,eg=Lo,tg=function(e){return $T.slice(0,e.length)===e},rg=tg("Bun/")?"BUN":tg("Cloudflare-Workers")?"CLOUDFLARE":tg("Deno/")?"DENO":tg("Node.js/")?"NODE":qT.Bun&&"string"==typeof Bun.version?"BUN":qT.Deno&&"object"==typeof Deno.version?"DENO":"process"===eg(qT.process)?"NODE":qT.window&&qT.document?"BROWSER":"REST",ng="NODE"===rg,ig=QT.left;jc({target:"Array",proto:!0,forced:!ng&&Os>79&&Os<83||!wT("reduce")},{reduce:function(e){var t=arguments.length;return ig(this,e,t,t>1?arguments[1]:void 0)}});var og=pu("Array","reduce"),sg=vo,ag=og,cg=Array.prototype,ug=function(e){var t=e.reduce;return e===cg||sg(cg,e)&&t===cg.reduce?ag:t},dg=ug,lg=X(dg),hg=jc,pg=Wd,fg=yo([].reverse),Eg=[1,2];hg({target:"Array",proto:!0,forced:String(Eg)===String(Eg.reverse())},{reverse:function(){return pg(this)&&(this.length=this.length),fg(this)}});var mg=pu("Array","reverse"),_g=vo,Tg=mg,gg=Array.prototype,Sg=function(e){var t=e.reverse;return e===gg||_g(gg,e)&&t===gg.reverse?Tg:t},yg=Sg,vg=X(yg),Rg=jc,Ag=Wd,bg=ml,Og=ds,Ig=Jc,Cg=eu,wg=cs,Ng=zd,Dg=$d,Pg=ba,Lg=Nh,kg=Il("slice"),Mg=Pg("species"),Ug=Array,xg=Math.max;Rg({target:"Array",proto:!0,forced:!kg},{slice:function(e,t){var r,n,i,o=wg(this),s=Cg(o),a=Ig(e,s),c=Ig(void 0===t?s:t,s);if(Ag(o)&&(r=o.constructor,(bg(r)&&(r===Ug||Ag(r.prototype))||Og(r)&&null===(r=r[Mg]))&&(r=void 0),r===Ug||void 0===r))return Lg(o,a,c);for(n=new(void 0===r?Ug:r)(xg(c-a,0)),i=0;a<c;a++,i++)a in o&&Ng(n,i,o[a]);return Dg(n,i),n}});var Vg=pu("Array","slice"),Fg=vo,Bg=Vg,jg=Array.prototype,Wg=function(e){var t=e.slice;return e===jg||Fg(jg,e)&&t===jg.slice?Bg:t},Gg=X(Wg);function Hg(e,t,r,n,i){var o,s,a,c={};return BT(o=GT(n)).call(o,(function(e){c[e]=n[e]})),c.enumerable=!!c.enumerable,c.configurable=!!c.configurable,("value"in c||c.initializer)&&(c.writable=!0),c=lg(s=vg(a=Gg(r).call(r)).call(a)).call(s,(function(r,n){return n(e,t,r)||r}),c),i&&void 0!==c.initializer&&(c.value=c.initializer?c.initializer.call(i):void 0,c.initializer=void 0),void 0===c.initializer&&(Bd(e,t,c),c=null),c}var Kg=ms,Yg=Oh,Zg=Uh,zg=Ec,Xg=yo([].concat),Jg=Kg("Reflect","ownKeys")||function(e){var t=Yg.f(zg(e)),r=Zg.f;return r?Xg(t,r(e)):t},Qg=la,qg=Jg,$g=Fo,eS=dc,tS=ds,rS=wc,nS=Error,iS=yo("".replace),oS=String(new nS("zxcasd").stack),sS=/\n\s*at [^:]*:[^\n]*/,aS=sS.test(oS),cS=Jo,uS=!Eo((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",cS(1,7)),7!==e.stack)})),dS=wc,lS=function(e,t){if(aS&&"string"==typeof e&&!nS.prepareStackTrace)for(;t--;)e=iS(e,sS,"");return e},hS=uS,pS=Error.captureStackTrace,fS=hm,ES=ba("iterator"),mS=Array.prototype,_S=function(e){return void 0!==e&&(fS.Array===e||mS[ES]===e)},TS=Cu,gS=Ks,SS=rs,yS=hm,vS=ba("iterator"),RS=function(e){if(!SS(e))return gS(e,vS)||gS(e,"@@iterator")||yS[TS(e)]},AS=Go,bS=Ws,OS=Ec,IS=Vs,CS=RS,wS=TypeError,NS=function(e,t){var r=arguments.length<2?CS(e):t;if(bS(r))return OS(AS(r,e));throw new wS(IS(e)+" is not iterable")},DS=Go,PS=Ec,LS=Ks,kS=function(e,t,r){var n,i;PS(e);try{if(!(n=LS(e,"return"))){if("throw"===t)throw r;return r}n=DS(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return PS(n),r},MS=uc,US=Go,xS=Ec,VS=Vs,FS=_S,BS=eu,jS=vo,WS=NS,GS=RS,HS=kS,KS=TypeError,YS=function(e,t){this.stopped=e,this.result=t},ZS=YS.prototype,zS=function(e,t,r){var n,i,o,s,a,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),E=MS(t,d),m=function(e){var t=n;return n=void 0,t&&HS(t,"normal"),new YS(!0,e)},_=function(e){return l?(xS(e),f?E(e[0],e[1],m):E(e[0],e[1])):f?E(e,m):E(e)};if(h)n=e.iterator;else if(p)n=e;else{if(!(i=GS(e)))throw new KS(VS(e)+" is not iterable");if(FS(i)){for(o=0,s=BS(e);s>o;o++)if((a=_(e[o]))&&jS(ZS,a))return a;return new YS(!1)}n=WS(e,i)}for(c=h?e.next:n.next;!(u=US(c,n)).done;){var T=u.value;try{a=_(T)}catch(e){if(!n)throw e;HS(n,"throw",e)}if("object"==typeof a&&a&&jS(ZS,a))return a}return new YS(!1)},XS=Du,JS=jc,QS=vo,qS=Im,$S=t_,ey=function(e,t,r){for(var n=qg(t),i=eS.f,o=$g.f,s=0;s<n.length;s++){var a=n[s];Qg(e,a)||r&&Qg(r,a)||i(e,a,o(t,a))}},ty=bh,ry=wc,ny=Jo,iy=function(e,t){tS(t)&&"cause"in t&&rS(e,"cause",t.cause)},oy=function(e,t,r,n){hS&&(pS?pS(e,t):dS(e,"stack",lS(r,n)))},sy=zS,ay=function(e,t){return void 0===e?arguments.length<2?"":t:XS(e)},cy=ba("toStringTag"),uy=Error,dy=[].push,ly=function(e,t){var r,n=QS(hy,this);$S?r=$S(new uy,n?qS(this):hy):(r=n?this:ty(hy),ry(r,cy,"Error")),void 0!==t&&ry(r,"message",ay(t)),oy(r,ly,r.stack,1),arguments.length>2&&iy(r,arguments[2]);var i=[];return sy(e,dy,{that:i}),ry(r,"errors",i),r};$S?$S(ly,uy):ey(ly,uy,{name:!0});var hy=ly.prototype=ty(uy.prototype,{constructor:ny(1,ly),message:ny(1,""),name:ny(1,"AggregateError")});JS({global:!0,constructor:!0,arity:2},{AggregateError:ly});var py,fy,Ey,my,_y=ms,Ty=Bh,gy=Bo,Sy=ba("species"),yy=vo,vy=TypeError,Ry=function(e,t){if(yy(t,e))return e;throw new vy("Incorrect invocation")},Ay=ml,by=Vs,Oy=TypeError,Iy=Ec,Cy=function(e){if(Ay(e))return e;throw new Oy(by(e)+" is not a constructor")},wy=rs,Ny=ba("species"),Dy=function(e,t){var r,n=Iy(e).constructor;return void 0===n||wy(r=Iy(n)[Ny])?t:Cy(r)},Py=TypeError,Ly=function(e,t){if(e<t)throw new Py("Not enough arguments");return e},ky=gs,My=/ipad|iphone|ipod/i.test(ky)&&/applewebkit/i.test(ky),Uy=Ao,xy=wo,Vy=uc,Fy=Vo,By=la,jy=Eo,Wy=ch,Gy=Nh,Hy=Fa,Ky=Ly,Yy=My,Zy=ng,zy=Uy.setImmediate,Xy=Uy.clearImmediate,Jy=Uy.process,Qy=Uy.Dispatch,qy=Uy.Function,$y=Uy.MessageChannel,ev=Uy.String,tv=0,rv={},nv="onreadystatechange";jy((function(){py=Uy.location}));var iv=function(e){if(By(rv,e)){var t=rv[e];delete rv[e],t()}},ov=function(e){return function(){iv(e)}},sv=function(e){iv(e.data)},av=function(e){Uy.postMessage(ev(e),py.protocol+"//"+py.host)};zy&&Xy||(zy=function(e){Ky(arguments.length,1);var t=Fy(e)?e:qy(e),r=Gy(arguments,1);return rv[++tv]=function(){xy(t,void 0,r)},fy(tv),tv},Xy=function(e){delete rv[e]},Zy?fy=function(e){Jy.nextTick(ov(e))}:Qy&&Qy.now?fy=function(e){Qy.now(ov(e))}:$y&&!Yy?(my=(Ey=new $y).port2,Ey.port1.onmessage=sv,fy=Vy(my.postMessage,my)):Uy.addEventListener&&Fy(Uy.postMessage)&&!Uy.importScripts&&py&&"file:"!==py.protocol&&!jy(av)?(fy=av,Uy.addEventListener("message",sv,!1)):fy=nv in Hy("script")?function(e){Wy.appendChild(Hy("script"))[nv]=function(){Wy.removeChild(this),iv(e)}}:function(e){setTimeout(ov(e),0)});var cv={set:zy,clear:Xy},uv=Ao,dv=Bo,lv=Object.getOwnPropertyDescriptor,hv=function(e){if(!dv)return uv[e];var t=lv(uv,e);return t&&t.value},pv=function(){this.head=null,this.tail=null};pv.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 fv,Ev,mv,_v,Tv,gv=pv,Sv=/ipad|iphone|ipod/i.test(gs)&&"undefined"!=typeof Pebble,yv=/web0s(?!.*chrome)/i.test(gs),vv=Ao,Rv=hv,Av=uc,bv=cv.set,Ov=gv,Iv=My,Cv=Sv,wv=yv,Nv=ng,Dv=vv.MutationObserver||vv.WebKitMutationObserver,Pv=vv.document,Lv=vv.process,kv=vv.Promise,Mv=Rv("queueMicrotask");if(!Mv){var Uv=new Ov,xv=function(){var e,t;for(Nv&&(e=Lv.domain)&&e.exit();t=Uv.get();)try{t()}catch(e){throw Uv.head&&fv(),e}e&&e.enter()};Iv||Nv||wv||!Dv||!Pv?!Cv&&kv&&kv.resolve?((_v=kv.resolve(void 0)).constructor=kv,Tv=Av(_v.then,_v),fv=function(){Tv(xv)}):Nv?fv=function(){Lv.nextTick(xv)}:(bv=Av(bv,vv),fv=function(){bv(xv)}):(Ev=!0,mv=Pv.createTextNode(""),new Dv(xv).observe(mv,{characterData:!0}),fv=function(){mv.data=Ev=!Ev}),Mv=function(e){Uv.head||fv(),Uv.add(e)}}var Vv=Mv,Fv=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Bv=Ao.Promise,jv=Ao,Wv=Bv,Gv=Vo,Hv=oc,Kv=nl,Yv=ba,Zv=rg,zv=Os,Xv=Wv&&Wv.prototype,Jv=Yv("species"),Qv=!1,qv=Gv(jv.PromiseRejectionEvent),$v=Hv("Promise",(function(){var e=Kv(Wv),t=e!==String(Wv);if(!t&&66===zv)return!0;if(!Xv.catch||!Xv.finally)return!0;if(!zv||zv<51||!/native code/.test(e)){var r=new Wv((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Jv]=n,!(Qv=r.then((function(){}))instanceof n))return!0}return!(t||"BROWSER"!==Zv&&"DENO"!==Zv||qv)})),eR={CONSTRUCTOR:$v,REJECTION_EVENT:qv,SUBCLASSING:Qv},tR={},rR=Ws,nR=TypeError,iR=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw new nR("Bad Promise constructor");t=e,r=n})),this.resolve=rR(t),this.reject=rR(r)};tR.f=function(e){return new iR(e)};var oR,sR,aR,cR=jc,uR=ng,dR=Ao,lR=ls,hR=Go,pR=Vh,fR=dp,ER=function(e){var t=_y(e);gy&&t&&!t[Sy]&&Ty(t,Sy,{configurable:!0,get:function(){return this}})},mR=Ws,_R=Vo,TR=ds,gR=Ry,SR=Dy,yR=cv.set,vR=Vv,RR=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},AR=Fv,bR=gv,OR=Op,IR=Bv,CR=eR,wR=tR,NR="Promise",DR=CR.CONSTRUCTOR,PR=CR.REJECTION_EVENT,LR=OR.getterFor(NR),kR=OR.set,MR=IR&&IR.prototype,UR=IR,xR=MR,VR=dR.TypeError,FR=dR.document,BR=dR.process,jR=wR.f,WR=jR,GR=!!(FR&&FR.createEvent&&dR.dispatchEvent),HR="unhandledrejection",KR=function(e){var t;return!(!TR(e)||!_R(t=e.then))&&t},YR=function(e,t){var r,n,i,o=t.value,s=1===t.state,a=s?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{a?(s||(2===t.rejection&&QR(t),t.rejection=1),!0===a?r=o:(d&&d.enter(),r=a(o),d&&(d.exit(),i=!0)),r===e.promise?u(new VR("Promise-chain cycle")):(n=KR(r))?hR(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},ZR=function(e,t){e.notified||(e.notified=!0,vR((function(){for(var r,n=e.reactions;r=n.get();)YR(r,e);e.notified=!1,t&&!e.rejection&&XR(e)})))},zR=function(e,t,r){var n,i;GR?((n=FR.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),dR.dispatchEvent(n)):n={promise:t,reason:r},!PR&&(i=dR["on"+e])?i(n):e===HR&&RR("Unhandled promise rejection",r)},XR=function(e){hR(yR,dR,(function(){var t,r=e.facade,n=e.value;if(JR(e)&&(t=AR((function(){uR?BR.emit("unhandledRejection",n,r):zR(HR,r,n)})),e.rejection=uR||JR(e)?2:1,t.error))throw t.value}))},JR=function(e){return 1!==e.rejection&&!e.parent},QR=function(e){hR(yR,dR,(function(){var t=e.facade;uR?BR.emit("rejectionHandled",t):zR("rejectionhandled",t,e.value)}))},qR=function(e,t,r){return function(n){e(t,n,r)}},$R=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,ZR(e,!0))},eA=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new VR("Promise can't be resolved itself");var n=KR(t);n?vR((function(){var r={done:!1};try{hR(n,t,qR(eA,r,e),qR($R,r,e))}catch(t){$R(r,t,e)}})):(e.value=t,e.state=1,ZR(e,!1))}catch(t){$R({done:!1},t,e)}}};DR&&(xR=(UR=function(e){gR(this,xR),mR(e),hR(oR,this);var t=LR(this);try{e(qR(eA,t),qR($R,t))}catch(e){$R(t,e)}}).prototype,(oR=function(e){kR(this,{type:NR,done:!1,notified:!1,parent:!1,reactions:new bR,rejection:!1,state:0,value:null})}).prototype=pR(xR,"then",(function(e,t){var r=LR(this),n=jR(SR(this,UR));return r.parent=!0,n.ok=!_R(e)||e,n.fail=_R(t)&&t,n.domain=uR?BR.domain:void 0,0===r.state?r.reactions.add(n):vR((function(){YR(n,r)})),n.promise})),sR=function(){var e=new oR,t=LR(e);this.promise=e,this.resolve=qR(eA,t),this.reject=qR($R,t)},wR.f=jR=function(e){return e===UR||e===aR?new sR(e):WR(e)}),cR({global:!0,constructor:!0,wrap:!0,forced:DR},{Promise:UR}),aR=lR.Promise,fR(UR,NR,!1,!0),ER(NR);var tA=ba("iterator"),rA=!1;try{var nA=0,iA={next:function(){return{done:!!nA++}},return:function(){rA=!0}};iA[tA]=function(){return this},Array.from(iA,(function(){throw 2}))}catch(e){}var oA=function(e,t){try{if(!t&&!rA)return!1}catch(e){return!1}var r=!1;try{var n={};n[tA]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},sA=Bv,aA=eR.CONSTRUCTOR||!oA((function(e){sA.all(e).then(void 0,(function(){}))})),cA=Go,uA=Ws,dA=tR,lA=Fv,hA=zS;jc({target:"Promise",stat:!0,forced:aA},{all:function(e){var t=this,r=dA.f(t),n=r.resolve,i=r.reject,o=lA((function(){var r=uA(t.resolve),o=[],s=0,a=1;hA(e,(function(e){var c=s++,u=!1;a++,cA(r,t,e).then((function(e){u||(u=!0,o[c]=e,--a||n(o))}),i)})),--a||n(o)}));return o.error&&i(o.value),r.promise}});var pA=jc,fA=eR.CONSTRUCTOR;Bv&&Bv.prototype,pA({target:"Promise",proto:!0,forced:fA,real:!0},{catch:function(e){return this.then(void 0,e)}});var EA=Go,mA=Ws,_A=tR,TA=Fv,gA=zS;jc({target:"Promise",stat:!0,forced:aA},{race:function(e){var t=this,r=_A.f(t),n=r.reject,i=TA((function(){var i=mA(t.resolve);gA(e,(function(e){EA(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var SA=tR;jc({target:"Promise",stat:!0,forced:eR.CONSTRUCTOR},{reject:function(e){var t=SA.f(this);return(0,t.reject)(e),t.promise}});var yA=Ec,vA=ds,RA=tR,AA=function(e,t){if(yA(e),vA(t)&&t.constructor===e)return t;var r=RA.f(e);return(0,r.resolve)(t),r.promise},bA=jc,OA=Bv,IA=eR.CONSTRUCTOR,CA=AA,wA=ms("Promise"),NA=!IA;bA({target:"Promise",stat:!0,forced:true},{resolve:function(e){return CA(NA&&this===wA?OA:this,e)}});var DA=Go,PA=Ws,LA=tR,kA=Fv,MA=zS;jc({target:"Promise",stat:!0,forced:aA},{allSettled:function(e){var t=this,r=LA.f(t),n=r.resolve,i=r.reject,o=kA((function(){var r=PA(t.resolve),i=[],o=0,s=1;MA(e,(function(e){var a=o++,c=!1;s++,DA(r,t,e).then((function(e){c||(c=!0,i[a]={status:"fulfilled",value:e},--s||n(i))}),(function(e){c||(c=!0,i[a]={status:"rejected",reason:e},--s||n(i))}))})),--s||n(i)}));return o.error&&i(o.value),r.promise}});var UA=Go,xA=Ws,VA=ms,FA=tR,BA=Fv,jA=zS,WA="No one promise resolved";jc({target:"Promise",stat:!0,forced:aA},{any:function(e){var t=this,r=VA("AggregateError"),n=FA.f(t),i=n.resolve,o=n.reject,s=BA((function(){var n=xA(t.resolve),s=[],a=0,c=1,u=!1;jA(e,(function(e){var d=a++,l=!1;c++,UA(n,t,e).then((function(e){l||u||(u=!0,i(e))}),(function(e){l||u||(l=!0,s[d]=e,--c||o(new r(s,WA)))}))})),--c||o(new r(s,WA))}));return s.error&&o(s.value),n.promise}});var GA=jc,HA=wo,KA=Nh,YA=tR,ZA=Ws,zA=Fv,XA=Ao.Promise,JA=!1;GA({target:"Promise",stat:!0,forced:!XA||!XA.try||zA((function(){XA.try((function(e){JA=8===e}),8)})).error||!JA},{try:function(e){var t=arguments.length>1?KA(arguments,1):[],r=YA.f(this),n=zA((function(){return HA(ZA(e),void 0,t)}));return(n.error?r.reject:r.resolve)(n.value),r.promise}});var QA=tR;jc({target:"Promise",stat:!0},{withResolvers:function(){var e=QA.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}});var qA=jc,$A=Bv,eb=Eo,tb=ms,rb=Vo,nb=Dy,ib=AA,ob=$A&&$A.prototype;qA({target:"Promise",proto:!0,real:!0,forced:!!$A&&eb((function(){ob.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=nb(this,tb("Promise")),r=rb(e);return this.then(r?function(r){return ib(t,e()).then((function(){return r}))}:e,r?function(r){return ib(t,e()).then((function(){throw r}))}:e)}});var sb=X(ls.Promise);class ab extends An{set _mediaStreamTrack(e){e!==this.mediaStreamTrack&&(this.safeEmit(_d.TRACK_UPDATED,e),this.mediaStreamTrack=e)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),IT(this,"trackMediaType",void 0),IT(this,"_ID",void 0),IT(this,"_rtpTransceiver",void 0),IT(this,"_lowRtpTransceiver",void 0),IT(this,"_hints",[]),IT(this,"_isClosed",!1),IT(this,"_originMediaStreamTrack",void 0),IT(this,"mediaStreamTrack",void 0),IT(this,"_external",{}),this._ID=t||Xn(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,sd(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||Yn((()=>{var e;io.reportApiInvoke(null,{name:Cn.GET_MEDIA_STREAM_TRACK,options:[],tag:wn.TRACER}).onSuccess((null===(e=this._mediaStreamTrack)||void 0===e?void 0:e.label)||"")}),this.mediaStreamTrack.id||this.getTrackId()),this._mediaStreamTrack}getRTCRtpTransceiver(e){return e===fd.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,ad(this),this.emit(Td.CLOSED),this.removeAllListeners(_d.SEI_RECEIVED)}_updateRtpTransceiver(e,t){if(t===fd.LOW_STREAM){if(this._lowRtpTransceiver===e)return;this._lowRtpTransceiver=e}else{if(this._rtpTransceiver===e)return;this._rtpTransceiver=e}this.emit(_d.TRANSCEIVER_UPDATED,e,t)}}class cb extends ab{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),IT(this,"_enabled",!0),IT(this,"_muted",!1),IT(this,"_isExternalTrack",!1),IT(this,"_isClosed",!1),IT(this,"_enabledMutex",void 0),IT(this,"processor",void 0),IT(this,"_processorContext",void 0),IT(this,"_handleTrackEnded",(()=>{this.onTrackEnded()})),this._enabledMutex=new oi("".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,Vi.debug("[".concat(this.getTrackId(),"] close")),this.emit(hd.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 Ln(this,hd.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){Vi.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Td.TRACK_ENDED)}stateCheck(e,t){if(Vi.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),En(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new fn(pn.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print("error",Vi);if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new fn(pn.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print("error",Vi)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():sb.resolve([])}}function ub(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const db=window.AudioContext||window.webkitAudioContext;let lb,hb=null;const pb=new class extends An{constructor(){super(...arguments),IT(this,"prevState",void 0),IT(this,"curState",void 0),IT(this,"currentTime",void 0),IT(this,"currentTimeStuckAt",void 0),IT(this,"interruptDetectorTrack",void 0),IT(this,"onLocalAudioTrackMute",(()=>{Vi.info("ios15-interruption-start"),this.emit(fo.IOS_15_16_INTERRUPTION_START)})),IT(this,"onLocalAudioTrackUnmute",(async()=>{Vi.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?Vi.info("ios15-interruption-end-canceled"):(hb&&await hb.suspend(),this.emit(fo.IOS_15_16_INTERRUPTION_END))}))}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){Vi.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){Vi.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 fb(){if(!db)return void Vi.error("your browser is not support web audio");Vi.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?ub(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ub(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},yi("WEBAUDIO_INIT_OPTIONS"));Vi.debug("audio context init option:",JSON.stringify(e)),hb=new db(e),pb.curState=hb.state,hb.onstatechange=()=>{pb.prevState=pb.curState,pb.curState=hb?hb.state:void 0;const e=pb.prevState,t=pb.curState,r="running"===t,n="interrupted"===t,i="running"===e,o="suspended"===e,s="interrupted"===e,a=xr().osVersion;(Yr()||tn())&&i&&n&&(Vi.info("ios".concat(a,"-interruption-start")),pb.emit(fo.IOS_INTERRUPTION_START)),(Yr()||tn())&&(o||s)&&r&&(Vi.info("ios".concat(a,"-interruption-end")),pb.emit(fo.IOS_INTERRUPTION_END)),e!==t&&pb.emit(fo.STATE_CHANGE,t,e)},setInterval((()=>{var e;const t=null===(e=hb)||void 0===e?void 0:e.currentTime;if(pb.currentTime!==t)pb.currentTimeStuckAt&&(Vi.debug("AudioContext current time resume at ".concat(t)),pb.currentTimeStuckAt=void 0),pb.currentTime=t;else{if(t!==pb.currentTimeStuckAt){io.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:wn.TRACER}).onSuccess(),Vi.warning("AudioContext current time stuck at ".concat(t))}pb.currentTimeStuckAt=t}}),5e3),async function(e){const t=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"];let r,n=!1,i=!1,o=!1;function s(t){"running"===e.state?a(!1):Yr()||tn()?"suspended"===e.state&&(a(!0),t&&e.resume().then(u,u)):"closed"!==e.state&&(a(!0),t&&e.resume().then(u,u))}function a(e){if(n!==e){n=e;for(let r=0,n=t;r<n.length;r+=1){const t=n[r];e?window.addEventListener(t,d,{capture:!0,passive:!0}):window.removeEventListener(t,d,{capture:!0,passive:!0})}}}function c(){s(!0)}function u(){s(!1)}function d(){s(!0)}function l(){let e;try{e=r.play(),e?e.then(f,f):(r.addEventListener("playing",f),r.addEventListener("abort",f),r.addEventListener("error",f))}catch(e){f()}}function h(e){o||(r.paused?e?(p(!1),o=!0,l()):p(!0):p(!1))}function p(e){if(i!==e){i=e;for(let r=0,n=t;r<n.length;r++){const t=n[r];e?window.addEventListener(t,E,{capture:!0,passive:!0}):window.removeEventListener(t,E,{capture:!0,passive:!0})}}}function f(){r.removeEventListener("playing",f),r.removeEventListener("abort",f),r.removeEventListener("error",f),o=!1,h(!1)}function E(){h(!0)}let m;if(Yr()&&yi("IOS_BG_TAG")){const t=e.createMediaStreamDestination(),n=document.createElement("div");n.innerHTML="<audio x-webkit-airplay='deny'></audio>",r=n.children.item(0),r.controls=!1,r.disableRemotePlayback=!0,r.preload="auto",r.srcObject=t.stream,m=()=>{if(yi("IOS_AUTO_RESTART_BG_TAG")&&r&&r.srcObject&&!o&&(!r.paused||!0!==i)){r.paused||r.pause();try{o=!0,l()}catch(e){o=!1}return!0}},h(!0)}return pb.on(fo.STATE_CHANGE,c),s(!1),m}(hb).then((e=>{lb=e}))}function Eb(){if(lb){if(lb()){io.reportApiInvoke(null,{name:"BG_AUDIO_TAG_RESTART",options:{},tag:wn.TRACER}).onSuccess(),Vi.debug("restart background audio tag success")}}}function mb(){if(!hb){if(fb(),!hb)throw new fn(pn.NOT_SUPPORTED,"can not create audio context");return hb}return hb}function _b(){return!!hb}function Tb(e){if(function(){if(null!==Sb)return Sb;const e=mb(),t=e.createBufferSource(),r=e.createGain(),n=e.createGain();t.connect(r),t.connect(n),t.disconnect(r);let i=!1;try{t.disconnect(r)}catch(e){i=!0}return t.disconnect(),Sb=i,i}())return;const t=e.connect,r=e.disconnect;e.connect=(r,n,i)=>{var o;return e._inputNodes||(e._inputNodes=[]),Yu(o=e._inputNodes).call(o,r)||(r instanceof AudioNode?(e._inputNodes.push(r),t.call(e,r,n,i)):t.call(e,r,n)),e},e.disconnect=(n,i,o)=>{r.call(e),n?jn(e._inputNodes,n):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function gb(e){const t=mb();return new sb(((r,n)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{n(new fn(pn.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let Sb=null;let yb=null;function vb(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 Rb=X(dg);class Ab{constructor(){IT(this,"context",void 0),IT(this,"analyserNode",void 0),IT(this,"sourceNode",void 0),this.context=mb(),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||Yr()||tn()||"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=Rb(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){Vi.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class bb extends An{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(),IT(this,"outputNode",void 0),IT(this,"outputTrack",void 0),IT(this,"isPlayed",!1),IT(this,"sourceNode",void 0),IT(this,"context",void 0),IT(this,"audioBufferNode",void 0),IT(this,"destNode",void 0),IT(this,"audioOutputLevel",0),IT(this,"volumeLevelAnalyser",void 0),IT(this,"_processedNode",void 0),IT(this,"playNode",void 0),IT(this,"isDestroyed",!1),IT(this,"onNoAudioInput",void 0),IT(this,"isNoAudioInput",!1),IT(this,"_noAudioInputCount",0),this.context=mb(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),Tb(this.outputNode),this.volumeLevelAnalyser=new Ab}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(yd.ON_AUDIO_BUFFER,vb(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!ao().webAudioMediaStreamDest)throw new fn(pn.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&&Wn((()=>{pb.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;Yr()||tn()?"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 n=!1;for(let e=0;e<r.length;e++)0!==r[e]&&(n=!0);return n?(this.isNoAudioInput=!1,!0):(await zn(200),await this.checkHasAudioInput(e?e+1:1)&&n)}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 Ob extends bb{get isFreeze(){return!1}constructor(e,t,r){var n;if(super(),IT(this,"sourceNode",void 0),IT(this,"track",void 0),IT(this,"clonedTrack",void 0),IT(this,"audioElement",void 0),IT(this,"isCurrentTrackCloned",!1),IT(this,"isRemoteTrack",!1),IT(this,"originVolumeLevelAnalyser",void 0),IT(this,"rebuildWebAudio",(async()=>{if(Vi.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 Vi.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>Vi.info("resume success"))),Vi.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),Tb(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),Tb(this.outputNode),this.emit(yd.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=t,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()})),"audio"!==e.kind)throw new fn(pn.UNEXPECTED_ERROR);this.track=e;const i=new MediaStream([this.track]);if(this.isRemoteTrack=!!t,this.sourceNode=this.context.createMediaStreamSource(i),Tb(this.sourceNode),r){const e=r.clone();e.enabled=!0,this.clonedTrack=e,Vi.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]));Tb(t),this.originVolumeLevelAnalyser=new Ab,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=i;const o=xr();t&&o.os===Pr.IOS&&Number(null===(n=o.osVersion)||void 0===n?void 0:n.split(".")[0])<15&&(pb.on(fo.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),Tb(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(yd.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),pb.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),Vi.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]));Tb(r),this.originVolumeLevelAnalyser&&this.originVolumeLevelAnalyser.updateSource(r)}getOriginVolumeLevel(){return this.originVolumeLevelAnalyser?this.originVolumeLevelAnalyser.getVolumeLevel():this.getAccurateVolumeLevel()}}async function Ib(e,t,r){const n=(e,t)=>e?"number"!=typeof e?e.max||e.exact||e.ideal||e.min||t:e:t,i={audio:!!r&&{mandatory:{chromeMediaSource:"desktop"}},video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxHeight:n(t.height,1080),maxWidth:n(t.width,1920)}}};return t.frameRate&&"number"!=typeof t.frameRate?(i.video.mandatory.maxFrameRate=t.frameRate.max,i.video.mandatory.minFrameRate=t.frameRate.min):"number"==typeof t.frameRate&&(i.video.mandatory.maxFrameRate=t.frameRate),await navigator.mediaDevices.getUserMedia(i)}async function Cb(e,t){const r=await wb(e.mediaSource),n=await function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(((r,n)=>{const i=document.createElement("div");i.innerText="share screen",i.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 u=document.createElement("button");u.innerHTML="cancel",u.setAttribute("style","width: 85px;"),u.onclick=()=>{document.body.removeChild(h);const e=new Error("NotAllowedError");e.name="NotAllowedError",n(e)};let d=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=d,e.onchange=()=>{d=e.checked},l.appendChild(e),l.appendChild(t)}c.appendChild(l),c.appendChild(u),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(i),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 n=e.thumbnail;try{n.getSize().width>1920&&(n=n.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='+n.toDataURL()+' /></div><span style="\theight: 40px; line-height: 40px; display: inline-block; width: 70%; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">'+e.name.replace(/[\u00A0-\u9999<>\&]/g,(function(e){return"&#"+e.charCodeAt(0)+";"}))+"</span>",t.onclick=()=>{document.body.removeChild(h),r({sourceId:e.id,audio:d})},a.appendChild(t)}}))}))}(r,t),i=n.sourceId,o=n.audio;return await Ib(i,e,o)}async function wb(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=In();if(!r)throw console.error("failed to fetch electron, please mount it to window"),new fn(pn.ELECTRON_IS_NULL);let n=null;try{var i;n=(null===(i=r.desktopCapturer)||void 0===i?void 0:i.getSources({types:t}))||r.ipcRenderer.invoke("DESKTOP_CAPTURER_GET_SOURCES",{types:t})}catch(e){n=null}n&&n.then||(n=new sb(((e,n)=>{r.desktopCapturer.getSources({types:t},((t,r)=>{t?n(t):e(r)}))})));try{return await n}catch(e){throw new fn(pn.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.toString())}}function Nb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const Db=new oi("safari");async function Pb(e,t){let r=0,n=null;for(;r<2;)try{n=await Lb(e,t,r>0);break}catch(e){if(e instanceof fn)throw Vi.error("[".concat(t,"] ").concat(e.toString())),e;const n=kb(e.name||e.code||e,e.message);if(n.code===pn.MEDIA_OPTION_INVALID){Vi.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await zn(500);continue}throw Vi.error("[".concat(t,"] ").concat(n.toString())),n}if(!n)throw new fn(pn.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return n}async function Lb(t,r,n){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new fn(pn.NOT_SUPPORTED,"can not find getUserMedia");n&&(t.video&&(delete t.video.width,delete t.video.height),t.screen&&(delete t.screen.width,delete t.screen.height));const i=ao(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return Vi.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(bn())if(t.screen.sourceId){Mb(o,await Ib(t.screen.sourceId,t.screen,!!t.screenAudio))}else{Mb(o,await Cb(t.screen,!!t.screenAudio))}else if(Wr()&&t.screen.extensionId&&t.screen.mandatory){if(!i.getStreamFromExtension)throw new fn(pn.NOT_SUPPORTED,"This browser does not support screen sharing");Vi.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new sb(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return Vi.error("[".concat(c,"] No response from Chrome Plugin. Plugin not installed properly"),r),void t(new fn(pn.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){Vi.error("[".concat(c,"] AgoraRTC screensharing plugin is not accessible(").concat(a,")"),e.toString()),t(new fn(pn.CHROME_PLUGIN_NOT_INSTALL))}})));t.screen.mandatory.chromeMediaSourceId=e;Mb(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(i.getDisplayMedia){var s;t.screen.mediaSource&&ld(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},n=t.screen,i=n.selfBrowserSurface,a=n.surfaceSwitching,c=n.systemAudio,u=n.preferCurrentTab,d=n.windowAudio,l=n.monitorTypeSurfaces,h={selfBrowserSurface:i,surfaceSwitching:a,systemAudio:c,preferCurrentTab:u,windowAudio:d,monitorTypeSurfaces:l};!i&&delete h.selfBrowserSurface,!a&&delete h.surfaceSwitching,!c&&delete h.systemAudio,!u&&delete h.preferCurrentTab,!d&&delete h.windowAudio,!l&&delete h.monitorTypeSurfaces,Vi.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:t.screenAudio,controls:h}));const p=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nb(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nb(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:t.screenAudio},h));Mb(o,p)}else{if(!Kr())throw Vi.error("[".concat(r,"] This browser does not support screenSharing")),new fn(pn.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&ld(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};Vi.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));Mb(o,await navigator.mediaDevices.getUserMedia(e))}}var a,c;if(!t.video&&!t.audio)return o;let u={video:t.video,audio:t.audio},d=yi("MEDIA_DEVICE_CONSTRAINTS");if(d)try{"string"==typeof d&&(d=JSON.parse(d)),u=ei(u,d)}catch(e){}Vi.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(u)),xr();let l,h=null;(Gr()||Yr()||jr())&&(h=await Db.lock());try{l=await navigator.mediaDevices.getUserMedia(u)}catch(e){throw h&&h(),e}return u.audio&&(e.HAS_GUM_AUDIO=!0),u.video&&(e.HAS_GUM_VIDEO=!0),Mb(o,l),h&&h(),o}function kb(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new fn(pn.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new fn(pn.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new fn(pn.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new fn(pn.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new fn(pn.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new fn(pn.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return Vi.error("getUserMedia unexpected error",e),new fn(pn.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function Mb(e,t){const r=e.getVideoTracks()[0],n=e.getAudioTracks()[0],i=t.getVideoTracks()[0],o=t.getAudioTracks()[0];o&&(n&&e.removeTrack(n),e.addTrack(o)),i&&(r&&e.removeTrack(r),e.addTrack(i))}e.HAS_GUM_AUDIO=!1,e.HAS_GUM_VIDEO=!1;class Ub extends An{get state(){return this._state}set state(e){e!==this._state&&(this.emit(Nd.STATE_CHANGE,e),this._state=e)}constructor(){super(),IT(this,"_state",wd.IDLE),IT(this,"isAccessMicrophonePermission",!1),IT(this,"isAccessCameraPermission",!1),IT(this,"lastAccessMicrophonePermission",!1),IT(this,"lastAccessCameraPermission",!1),IT(this,"checkdeviceMatched",!1),IT(this,"deviceInfoMap",new Map),this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(yi("ENUMERATE_DEVICES_INTERVAL")||(sn()||Fr()===Pr.HARMONY_OS)&&on())&&this.updateDevicesInfo()}),yi("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>Vi.error(e.toString())))}async enumerateDevices(t,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)throw new fn(pn.NOT_SUPPORTED,"enumerateDevices() not supported.");const i=await navigator.mediaDevices.enumerateDevices(),o=this.checkMediaDeviceInfoIsOk(i);let s=!this.isAccessMicrophonePermission&&t,a=!this.isAccessCameraPermission&&r;o.audio&&(s=!1),o.video&&(a=!1);let c=null,u=null,d=null;if(!n&&(s||a)){if(Db.isLocked){Vi.debug("[device manager] wait GUM lock");(await Db.lock())(),Vi.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),Vi.debug("[device manager] check media device permissions",t,r,s,a),s&&a){try{d=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(e){const t=kb(e.name||e.code||e,e.message);if(t.code===pn.PERMISSION_DENIED)throw t;Vi.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=kb(e.name||e.code||e,e.message);if(t.code===pn.PERMISSION_DENIED)throw t;Vi.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{u=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=kb(e.name||e.code||e,e.message);if(t.code===pn.PERMISSION_DENIED)throw t;Vi.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}Vi.debug("[device manager] mic permission",t,"cam permission",r)}try{const e=await navigator.mediaDevices.enumerateDevices();return c&&c.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),c=null,u=null,d=null,e}catch(e){c&&c.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),c=null,u=null,d=null;return new fn(pn.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 fn(pn.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=wd.INITING;try{await this.updateDevicesInfo(),this.state=wd.INITEND}catch(e){if(this.state=wd.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname))throw new fn(pn.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.");throw Vi.warning("Device Detection functionality cannot start properly.",e.toString()),e}}async updateDevicesInfo(){const e=await this.enumerateDevices(!0,!0,!0),t=Date.now(),r=[];if(e[0]&&e[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const t=e.find((e=>"audioinput"===e.kind&&"default"===e.deviceId)),r=e.find((e=>"audiooutput"===e.kind&&"default"===e.deviceId));t&&r?r.groupId===t.groupId?Vi.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):Vi.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):Vi.debug("[device-check] default input or output not found")}const n=this.checkMediaDeviceInfoIsOk(e);if(e.forEach((e=>{if(!e.deviceId)return;const n=this.deviceInfoMap.get("".concat(e.kind,"_").concat(e.deviceId));if("ACTIVE"!==(n?n.state:"INACTIVE")){const n={initAt:t,updateAt:t,device:e,state:"ACTIVE"};this.deviceInfoMap.set("".concat(e.kind,"_").concat(e.deviceId),n),r.push(n)}n&&(n.updateAt=t)})),this.deviceInfoMap.forEach(((e,n)=>{"ACTIVE"===e.state&&e.updateAt!==t&&(e.state="INACTIVE",r.push(e))})),this.state!==wd.INITEND)return n.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(n.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0));r.forEach((e=>{switch(e.device.kind){case"audioinput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(Nd.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(Nd.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(Nd.PLAYOUT_DEVICE_CHANGED,e)}})),n.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),n.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0)}checkMediaDeviceInfoIsOk(e){const t=e.filter((e=>"audioinput"===e.kind)),r=e.filter((e=>"videoinput"===e.kind)),n={audio:!1,video:!1};for(const e of t)if(e.label&&e.deviceId){n.audio=!0;break}for(const e of r)if(e.label&&e.deviceId){n.video=!0;break}return n}}const xb=new Ub;jc({target:"Array",stat:!0},{isArray:Wd});var Vb=X(ls.Array.isArray);var Fb=X(RS),Bb=ca,jb=eu,Wb=$d,Gb=Hd;jc({target:"Array",proto:!0,arity:1,forced:Eo((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=Bb(this),r=jb(t),n=arguments.length;Gb(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return Wb(t,r),r}});var Hb=pu("Array","push"),Kb=vo,Yb=Hb,Zb=Array.prototype,zb=function(e){var t=e.push;return e===Zb||Kb(Zb,e)&&t===Zb.push?Yb:t},Xb=X(zb);var Jb=Ec,Qb=kS,qb=uc,$b=Go,eO=ca,tO=function(e,t,r,n){try{return n?t(Jb(r)[0],r[1]):t(r)}catch(t){Qb(e,"throw",t)}},rO=_S,nO=ml,iO=eu,oO=zd,sO=$d,aO=NS,cO=RS,uO=kS,dO=Array,lO=function(e){var t=nO(this),r=arguments.length,n=r>1?arguments[1]:void 0,i=void 0!==n;i&&(n=qb(n,r>2?arguments[2]:void 0));var o,s,a,c,u,d,l=eO(e),h=cO(l),p=0;if(!h||this===dO&&rO(h))for(o=iO(l),s=t?new this(o):dO(o);o>p;p++)d=i?n(l[p],p):l[p],oO(s,p,d);else for(s=t?new this:[],u=(c=aO(l,h)).next;!(a=$b(u,c)).done;p++){d=i?tO(c,n,[a.value,p],!0):a.value;try{oO(s,p,d)}catch(e){uO(c,"throw",e)}}return sO(s,p),s},hO=lO;jc({target:"Array",stat:!0,forced:!oA((function(e){Array.from(e)}))},{from:hO});var pO=X(ls.Array.from);function fO(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function EO(e,t){return function(e){if(Vb(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==oT&&Fb(e)||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(Xb(a).call(a,n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||function(e,t){var r;if(e){if("string"==typeof e)return fO(e,t);var n=Gg(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?pO(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fO(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let mO=!1;const _O=new class extends An{constructor(){super(...arguments),IT(this,"onAutoplayFailed",void 0),IT(this,"onAudioAutoplayFailed",void 0)}};function TO(){if(mO)return yi("FLS_AUTOPLAY_EMITS")?(_O.onAutoplayFailed&&_O.onAutoplayFailed(),_O.emit("autoplay-failed")):void 0;{const e=t=>{t.preventDefault(),mO=!1,an()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};mO=!0,an()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),Vi.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),_O.onAutoplayFailed?_O.onAutoplayFailed():_O.onAudioAutoplayFailed?Vi.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 ."):Vi.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 ."),_O.emit("autoplay-failed")}}function gO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function SO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?gO(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function yO(e,t,r,n){if(!e)return;const i=io.getBaseInfoBySessionId(e);if(!i)return;const o=i.info,s=Date.now(),a=SO(SO({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-i.startTime,cbRegistered:_O.onAutoplayFailed||_O.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:n,extend:void 0});io.send({type:Hi.AUTOPLAY_FAILED,data:a},!0)}const vO=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],RO=new class{constructor(){IT(this,"onAutoplayFailed",void 0),IT(this,"elementMap",new Map),IT(this,"elementStateMap",new Map),IT(this,"elementsNeedToResume",[]),IT(this,"sinkIdMap",new Map),IT(this,"autoResumeAfterInterruption",(e=>sb.all(Array.from(this.elementMap.entries()).map((async t=>{let r=EO(t,2),n=r[0],i=r[1];const o=this.elementStateMap.get(n),s=i.srcObject.getAudioTracks()[0],a=s&&s.readyState;if(Vi.debug("resume after interrupted, ele: ".concat(o," audio: ").concat(a," ").concat(e)),"live"===a){if(e)return i.pause(),i.play();if("running"===pb.curState)return qr()?(i.pause(),i.play()):o&&"paused"===o?i.play():void 0}}))))),IT(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let t=EO(e,2);t[0];let r=t[1];const n=r.srcObject.getAudioTracks()[0];n&&"live"===n.readyState&&(Vi.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))})),this.autoResumeAudioElement(),pb.on(fo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),pb.on(fo.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),pb.on(fo.STATE_CHANGE,(()=>{Yr()&&"suspended"===pb.prevState&&"running"===pb.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 fn(pn.PERMISSION_DENIED,"can not set sink id: "+e.toString())}}play(e,t,r,n){if(this.elementMap.has(t))return;const i=document.createElement("audio");i.autoplay=!0,i.srcObject=new MediaStream([e]),this.bindAudioElementEvents(t,i),this.elementMap.set(t,i),this.elementStateMap.set(t,Dd.INIT),this.setVolume(t,r);const o=this.sinkIdMap.get(t);if(o)try{i.setSinkId(o).catch((e=>{Vi.warning("[".concat(t,"] set sink id failed"),e.toString())}))}catch(e){Vi.warning("[".concat(t,"] set sink id failed"),e.toString())}const s=i.play();s&&s.then&&s.catch((e=>{n&&yO(n,"audio",e.message,t),Vi.warning("audio element play warning",e.toString()),this.elementMap.has(t)&&"NotAllowedError"===e.name&&(Vi.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(i),Wn((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),TO()})))}))}updateTrack(e,t){const r=this.elementMap.get(e);r&&(r.srcObject=new MediaStream([t]))}isPlaying(e){return this.elementMap.has(e)&&"playing"===this.elementStateMap.get(e)}setVolume(e,t){const r=this.elementMap.get(e);r&&(t=Math.max(0,Math.min(100,t)),r.volume=t/100)}getVolume(e){const t=this.elementMap.get(e);return t?t.volume:0}stop(e){const t=this.elementMap.get(e);if(this.sinkIdMap.delete(e),!t)return;const r=this.elementsNeedToResume.indexOf(t);this.elementsNeedToResume.splice(r,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}bindAudioElementEvents(e,t){vO.forEach((r=>{t.addEventListener(r,(r=>{const n=this.elementStateMap.get(e),i="pause"===r.type?"paused":r.type;if(Vi.debug("[".concat(e,"] audio-element-status change ").concat(n," => ").concat(i)),"error"===r.type){const r=null==t?void 0:t.error;r&&Vi.error("[".concat(e,"] media error, code: ").concat(r.code,", message: ").concat(r.message))}this.elementStateMap.set(e,i)}))}))}getPlayerState(e){return this.elementStateMap.get(e)||"uninit"}autoResumeAudioElement(){const e=()=>{this.elementsNeedToResume.forEach((e=>{e.play().then((e=>{Vi.debug("Auto resume audio element success")})).catch((e=>{Vi.warning("Auto resume audio element failed!",e)}))})),this.elementsNeedToResume=[]};new Promise((e=>{document.body?e():window.addEventListener("load",(()=>e()))})).then((()=>{an()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function AO(){return function(e,t,r){const n=r.value;return"function"==typeof n&&(r.value=function(){this._isClosed&&new fn(pn.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",Vi);for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=n.apply(this,t);return i instanceof sb?new sb(((e,t)=>{i.then(e).catch(t)})):i}),r}}var bO=pu("Array","values"),OO=Cu,IO=la,CO=vo,wO=bO,NO=Array.prototype,DO={DOMTokenList:!0,NodeList:!0},PO=function(e){var t=e.values;return e===NO||CO(NO,e)&&t===NO.values||IO(DO,OO(e))?wO:t},LO=X(PO);function kO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function MO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kO(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class UO extends An{constructor(e){super(),IT(this,"name","VideoProcessorDestination"),IT(this,"ID","0"),IT(this,"_source",void 0),IT(this,"videoContext",void 0),IT(this,"inputTrack",void 0),this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new fn(pn.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new fn(pn.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(Id.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(Id.ON_TRACK,void 0)}}class xO extends An{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),IT(this,"constraintsMap",new Map),IT(this,"statsRegistry",[]),IT(this,"usageRegistry",[]),IT(this,"trackId",void 0),IT(this,"direction",void 0),IT(this,"_chained",!1),this.trackId=e,this.direction=t}async getConstraints(){return await Pn(this,Cd.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return Vi.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),Ln(this,Cd.REQUEST_UPDATE_CONSTRAINTS,Array.from(LO(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return Vi.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),Ln(this,Cd.REQUEST_UPDATE_CONSTRAINTS,Array.from(LO(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 t of this.statsRegistry){const r=t.processorID,n=t.processorName,i=t.type,o=t.cb;try{const t=o();e.push({processorID:r,processorName:n,type:i,stats:t})}catch(e){Vi.error(new fn(pn.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 t of this.usageRegistry){const r=t.cb;try{let t=r();t instanceof sb&&(t=await t),e.push(MO(MO({},t),{},{direction:this.direction}))}catch(e){Vi.error("gather extension usage error",e)}}return e}getDirection(){return this.direction}}class VO extends An{constructor(e){super(),IT(this,"name","AudioProcessorDestination"),IT(this,"ID","0"),IT(this,"inputTrack",void 0),IT(this,"inputNode",void 0),IT(this,"audioProcessorContext",void 0),IT(this,"_source",void 0),this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new fn(pn.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new fn(pn.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(Id.ON_TRACK,void 0),this.emit(Id.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(Id.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.audioProcessorContext.chained=!0,this.inputNode=e.node,this.emit(Id.ON_NODE,this.inputNode))}}class FO extends An{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),IT(this,"constraintsMap",new Map),IT(this,"statsRegistry",[]),IT(this,"audioContext",void 0),IT(this,"trackId",void 0),IT(this,"direction",void 0),IT(this,"usageRegistry",[]),IT(this,"_chained",!1),this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return Pn(this,Cd.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return Vi.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),Ln(this,Cd.REQUEST_UPDATE_CONSTRAINTS,Array.from(LO(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),Ln(this,Cd.REQUEST_UPDATE_CONSTRAINTS,Array.from(LO(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 t of this.statsRegistry){const r=t.processorID,n=t.processorName,i=t.type,o=t.cb;try{const t=o();e.push({processorID:r,processorName:n,type:i,stats:t})}catch(e){Vi.error(new fn(pn.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 t of this.usageRegistry){const r=t.cb;try{let t=r();t instanceof sb&&(t=await t),e.push(MO(MO({},t),{},{direction:this.direction}))}catch(e){Vi.error("gather extension usage error",e)}}return e}getDirection(){return this.direction}}class BO extends An{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),IT(this,"context",void 0),IT(this,"processSourceNode",void 0),IT(this,"outputTrack",void 0),IT(this,"processedNode",void 0),IT(this,"clonedTrack",void 0),IT(this,"outputNode",void 0),this.outputNode=new jO}setVolume(){}createOutputTrack(){throw new fn(pn.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 jO{disconnect(){}connect(){}}function WO(e){return new sb(((t,r)=>{let n=!1;const i=document.createElement("video");i.setAttribute("autoplay",""),i.setAttribute("muted",""),i.muted=!0,i.autoplay=!0,i.setAttribute("playsinline",""),i.setAttribute("style","position: fixed; top: 0; left: 0; width: 1px; height: 1px"),document.body.appendChild(i);const o=Yr()?"canplay":"playing";i.addEventListener(o,(()=>{const e=i.videoWidth,r=i.videoHeight;!e&&Kr()||(n=!0,i.srcObject=null,i.remove(),t([e,r]))})),i.srcObject=new MediaStream([e]),i.play().catch(Jn),setTimeout((()=>{n||(i.srcObject=null,i.remove(),t([i.videoWidth,i.videoHeight]))}),4e3)}))}function GO(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=ed(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!rn()&&r.frameRate&&(t.frameRate=r.frameRate),Hr()&&"object"==typeof t.frameRate&&(t.frameRate.max=60),Kr()&&(t.frameRate={ideal:30,max:30}),t}function HO(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&Wr()&&(t.extensionId=e.extensionId);const r=e.displaySurface,n=e.selfBrowserSurface,i=e.surfaceSwitching,o=e.systemAudio,s=e.preferCurrentTab,a=e.windowAudio,c=e.monitorTypeSurfaces;(Zr(107)||Xr(107)||Qr(93))&&(r&&(mn(r,"displaySurface",["browser","window","monitor"]),t.displaySurface=r),n?(mn(n,"selfBrowserSurface",["exclude","include"]),t.selfBrowserSurface=n):t.selfBrowserSurface="include",i&&(mn(i,"surfaceSwitching",["exclude","include"]),t.surfaceSwitching=i)),(Zr(105)||Xr(105)||Qr(91))&&o&&(mn(o,"systemAudio",["exclude","include"]),t.systemAudio=o),(Zr(94)||Xr(94)||Qr(80))&&s&&(t.preferCurrentTab=!0),(Zr(141)||Xr(141)||Qr(125))&&a&&(mn(a,"windowAudio",["exclude","system"]),t.windowAudio=a),(Zr(119)||Xr(119)||Qr(105))&&c&&(mn(c,"monitorTypeSurfaces",["exclude","include"]),t.monitorTypeSurfaces=c),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const u=e.encoderConfig?td(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:u?u.width:void 0,maxHeight:u?u.height:void 0},u&&(u.frameRate&&("number"==typeof u.frameRate?(t.mandatory.maxFrameRate=u.frameRate,t.mandatory.minFrameRate=u.frameRate):(t.mandatory.maxFrameRate=u.frameRate.max||u.frameRate.ideal||u.frameRate.exact||void 0,t.mandatory.minFrameRate=u.frameRate.min||u.frameRate.ideal||u.frameRate.exact||void 0),t.frameRate=u.frameRate),u.width&&(t.width=u.width),u.height&&(t.height=u.height)),t}function KO(e){const t={};return rn()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,Wr()&&e.ANS&&(t.googHighpassFilter=e.ANS))),t}function YO(e){const t=KO(e);return ho()&&e.suppressLocalAudioPlayback&&(t.suppressLocalAudioPlayback=e.suppressLocalAudioPlayback),po()&&e.restrictOwnAudio&&(t.restrictOwnAudio=!0),t}function ZO(e){const t=KO(e);if(e.encoderConfig){const r=id(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),sn()&&(t.sampleRate=void 0),t}var zO=Vs,XO=TypeError,JO=Nh,QO=Math.floor,qO=function(e,t){var r=e.length;if(r<8)for(var n,i,o=1;o<r;){for(i=o,n=e[o];i&&t(e[i-1],n)>0;)e[i]=e[--i];i!==o++&&(e[i]=n)}else for(var s=QO(r/2),a=qO(JO(e,0,s),t),c=qO(JO(e,s),t),u=a.length,d=c.length,l=0,h=0;l<u||h<d;)e[l+h]=l<u&&h<d?t(a[l],c[h])<=0?a[l++]:c[h++]:l<u?a[l++]:c[h++];return e},$O=qO,eI=gs.match(/firefox\/(\d+)/i),tI=!!eI&&+eI[1],rI=/MSIE|Trident/.test(gs),nI=gs.match(/AppleWebKit\/(\d+)\./),iI=!!nI&&+nI[1],oI=jc,sI=yo,aI=Ws,cI=ca,uI=eu,dI=function(e,t){if(!delete e[t])throw new XO("Cannot delete property "+zO(t)+" of "+zO(e))},lI=Du,hI=Eo,pI=$O,fI=wT,EI=tI,mI=rI,_I=Os,TI=iI,gI=[],SI=sI(gI.sort),yI=sI(gI.push),vI=hI((function(){gI.sort(void 0)})),RI=hI((function(){gI.sort(null)})),AI=fI("sort"),bI=!hI((function(){if(_I)return _I<70;if(!(EI&&EI>3)){if(mI)return!0;if(TI)return TI<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)gI.push({k:t+n,v:r})}for(gI.sort((function(e,t){return t.v-e.v})),n=0;n<gI.length;n++)t=gI[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));oI({target:"Array",proto:!0,forced:vI||!RI||!AI||!bI},{sort:function(e){void 0!==e&&aI(e);var t=cI(this);if(bI)return void 0===e?SI(t):SI(t,e);var r,n,i=[],o=uI(t);for(n=0;n<o;n++)n in t&&yI(i,t[n]);for(pI(i,function(e){return function(t,r){if(void 0===r)return-1;if(void 0===t)return 1;if(void 0!==e)return+e(t,r)||0;var n=lI(t),i=lI(r);return n===i?0:n>i?1:-1}}(e)),r=uI(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)dI(t,n++);return t}});var OI=pu("Array","sort"),II=vo,CI=OI,wI=Array.prototype,NI=function(e){var t=e.sort;return e===wI||II(wI,e)&&t===wI.sort?CI:t},DI=X(NI);function PI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function LI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?PI(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function kI(e,t,r){const n=4*Math.floor(2e5*Math.pow(r/15,.6)*Math.pow(e*t/230400,.75)),i=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=LO(o).call(o).next().value,c=1;if(o.has(i))a=o.get(i);else{var u;const e=DI(u=Array.from(o.entries())).call(u,((e,t)=>EO(e,1)[0]-EO(t,1)[0])),t=e.find((e=>EO(e,1)[0]>i));if(t){const r=e.indexOf(t);if(r>0){const n=e[r-1],o=(i-n[0])/(t[0]-n[0]);a=n[1]+o*(t[1]-n[1])}else a=t[1]}else a=e[e.length-1][1]}if(s.has(i))c=s.get(i);else{var d;const e=DI(d=Array.from(s.entries())).call(d,((e,t)=>EO(e,1)[0]-EO(t,1)[0])),t=e.find((e=>EO(e,1)[0]>i));if(t){const r=e.indexOf(t);if(r>0){const n=e[r-1],o=(i-n[0])/(t[0]-n[0]);c=n[1]+o*(t[1]-n[1])}else c=t[1]}else c=e[e.length-1][1]}const l=yi("VIDEO_NEW_BITRATE_RATIO");l&&l>0&&(a=l/100);const h=Math.floor(n*a),p=Math.floor(65e4*Math.pow(e*t/230400,.5)*Math.pow(r/15,.69));let f=h;const E=yi("VIDEO_STANDARD_BITRATE_VERSION");return E&&E>0&&(1===E?f=n:2===E?f=h:3===E&&(f=p)),[Math.floor(f/1e3),c]}function MI(e,t,r){if(!Array.isArray(yi("VIDEO_ENCODER_CONFIG_LIST")))return!1;if(0===yi("VIDEO_ENCODER_CONFIG_LIST").length)return!1;const n=Math.min(e,t);if(n>=480)return!1;return LI(LI({},yi("VIDEO_ENCODER_CONFIG_LIST").find((e=>e.height>n))),{},{frameRate:r})}function UI(e,t,r,n,i){const o=yi("BITRATE_ADAPTER_TYPE");if("DEFAULT_BITRATE"===o)return{min:n,max:i};if(void 0===i){const s=Math.floor(200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75));i="STANDARD_BITRATE"===o?4*s:2*s,n=null!=n?n:s}else n=null!=n?n:Math.floor(i/10);return{min:n,max:i}}function xI(e,t,r){const n=200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75);return{min:Math.floor(n),max:Math.floor(4*n)}}const VI=async(e,t,r)=>{const n=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,n="";for(r=0;r<=3;r++)n+=t.charAt(e>>8*r+4&15)+t.charAt(e>>8*r&15);return n}function n(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function i(e,t,r,i,o,s){return n(function(e,t){return e<<t|e>>>32-t}(n(n(t,e),n(i,s)),o),r)}function o(e,t,r,n,o,s,a){return i(t&r|~t&n,e,t,o,s,a)}function s(e,t,r,n,o,s,a){return i(t&n|r&~n,e,t,o,s,a)}function a(e,t,r,n,o,s,a){return i(t^r^n,e,t,o,s,a)}function c(e,t,r,n,o,s,a){return i(r^(t|~n),e,t,o,s,a)}const u=function(e){let t;const r=1+(e.length+8>>6),n=new Array(16*r);for(t=0;t<16*r;t++)n[t]=0;for(t=0;t<e.length;t++)n[t>>2]|=e.charCodeAt(t)<<t%4*8;return n[t>>2]|=128<<t%4*8,n[16*r-2]=8*e.length,n}(e);let d,l,h,p,f,E=1732584193,m=-271733879,_=-1732584194,T=271733878;for(d=0;d<u.length;d+=16)l=E,h=m,p=_,f=T,E=o(E,m,_,T,u[d+0],7,-680876936),T=o(T,E,m,_,u[d+1],12,-389564586),_=o(_,T,E,m,u[d+2],17,606105819),m=o(m,_,T,E,u[d+3],22,-1044525330),E=o(E,m,_,T,u[d+4],7,-176418897),T=o(T,E,m,_,u[d+5],12,1200080426),_=o(_,T,E,m,u[d+6],17,-1473231341),m=o(m,_,T,E,u[d+7],22,-45705983),E=o(E,m,_,T,u[d+8],7,1770035416),T=o(T,E,m,_,u[d+9],12,-1958414417),_=o(_,T,E,m,u[d+10],17,-42063),m=o(m,_,T,E,u[d+11],22,-1990404162),E=o(E,m,_,T,u[d+12],7,1804603682),T=o(T,E,m,_,u[d+13],12,-40341101),_=o(_,T,E,m,u[d+14],17,-1502002290),m=o(m,_,T,E,u[d+15],22,1236535329),E=s(E,m,_,T,u[d+1],5,-165796510),T=s(T,E,m,_,u[d+6],9,-1069501632),_=s(_,T,E,m,u[d+11],14,643717713),m=s(m,_,T,E,u[d+0],20,-373897302),E=s(E,m,_,T,u[d+5],5,-701558691),T=s(T,E,m,_,u[d+10],9,38016083),_=s(_,T,E,m,u[d+15],14,-660478335),m=s(m,_,T,E,u[d+4],20,-405537848),E=s(E,m,_,T,u[d+9],5,568446438),T=s(T,E,m,_,u[d+14],9,-1019803690),_=s(_,T,E,m,u[d+3],14,-187363961),m=s(m,_,T,E,u[d+8],20,1163531501),E=s(E,m,_,T,u[d+13],5,-1444681467),T=s(T,E,m,_,u[d+2],9,-51403784),_=s(_,T,E,m,u[d+7],14,1735328473),m=s(m,_,T,E,u[d+12],20,-1926607734),E=a(E,m,_,T,u[d+5],4,-378558),T=a(T,E,m,_,u[d+8],11,-2022574463),_=a(_,T,E,m,u[d+11],16,1839030562),m=a(m,_,T,E,u[d+14],23,-35309556),E=a(E,m,_,T,u[d+1],4,-1530992060),T=a(T,E,m,_,u[d+4],11,1272893353),_=a(_,T,E,m,u[d+7],16,-155497632),m=a(m,_,T,E,u[d+10],23,-1094730640),E=a(E,m,_,T,u[d+13],4,681279174),T=a(T,E,m,_,u[d+0],11,-358537222),_=a(_,T,E,m,u[d+3],16,-722521979),m=a(m,_,T,E,u[d+6],23,76029189),E=a(E,m,_,T,u[d+9],4,-640364487),T=a(T,E,m,_,u[d+12],11,-421815835),_=a(_,T,E,m,u[d+15],16,530742520),m=a(m,_,T,E,u[d+2],23,-995338651),E=c(E,m,_,T,u[d+0],6,-198630844),T=c(T,E,m,_,u[d+7],10,1126891415),_=c(_,T,E,m,u[d+14],15,-1416354905),m=c(m,_,T,E,u[d+5],21,-57434055),E=c(E,m,_,T,u[d+12],6,1700485571),T=c(T,E,m,_,u[d+3],10,-1894986606),_=c(_,T,E,m,u[d+10],15,-1051523),m=c(m,_,T,E,u[d+1],21,-2054922799),E=c(E,m,_,T,u[d+8],6,1873313359),T=c(T,E,m,_,u[d+15],10,-30611744),_=c(_,T,E,m,u[d+6],15,-1560198380),m=c(m,_,T,E,u[d+13],21,1309151649),E=c(E,m,_,T,u[d+4],6,-145523070),T=c(T,E,m,_,u[d+11],10,-1120210379),_=c(_,T,E,m,u[d+2],15,718787259),m=c(m,_,T,E,u[d+9],21,-343485551),E=n(E,l),m=n(m,h),_=n(_,p),T=n(T,f);return r(E)+r(m)+r(_)+r(T)}(""+t+r)).slice(0,16),i=n.slice(0,12),o=await window.crypto.subtle.importKey("raw",n,"AES-GCM",!0,["encrypt"]);return new Uint8Array(await window.crypto.subtle.encrypt({name:"AES-GCM",iv:i},o,e))},FI=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new sb(((r,n)=>{t.toBlob((async e=>{if(t.remove(),e){const n=await BI(e);r({buffer:n,width:t.width,height:t.height})}else n(new fn(pn.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},BI=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function jI(e,t){if("VideoFrame"in window&&"TransformStream"in window&&ao().supportWebRTCInsertableStream){const r=new MediaStreamTrackProcessor(e),n=new MediaStreamTrackGenerator({kind:"video"});let i,o,s=Date.now();const a=()=>{c&&(clearInterval(c),c=void 0),i&&(i.close(),i=void 0),e.stop(),o=void 0,n.removeEventListener("ended",a)};let c=window.setInterval((()=>{if(o&&i&&Date.now()-s>(null!=t?t:1e3))try{"live"===n.readyState?o.enqueue(i.clone()):a()}catch(e){a()}}),null!=t?t:1e3);const u=new TransformStream({transform:(e,t)=>{"live"===n.readyState?(o=t,s=Date.now(),void 0===i?(i=e,t.enqueue(e.clone())):(t.enqueue(i),i=e)):e.close()}});return n.addEventListener("ended",a),r.readable.pipeThrough(u).pipeTo(n.writable),n}}var WI,GI,HI,KI,YI,ZI,zI,XI,JI,QI,qI,$I,eC,tC,rC,nC,iC,oC,sC,aC,cC,uC,dC,lC,hC,pC,fC,EC,mC,_C,TC,gC,SC,yC,vC,RC,AC,bC,OC,IC;function CC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wC(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?CC(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):CC(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let NC=(WI=no({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),GI=no({argsMap:(e,t)=>[e.getTrackId(),t]}),HI=AO(),KI=si("LocalAudioTrack","_enabledMutex"),YI=no({argsMap:(e,t)=>[e.getTrackId(),t]}),ZI=AO(),zI=si("LocalAudioTrack","_enabledMutex"),XI=no({argsMap:(e,t)=>[e.getTrackId(),t]}),JI=AO(),QI=AO(),qI=AO(),$I=no({argsMap:e=>[e.getTrackId()]}),eC=AO(),tC=no({argsMap:e=>[e.getTrackId()]}),rC=AO(),nC=no({argsMap:e=>[e.getTrackId()]}),iC=no({argsMap:(e,t)=>[e.getTrackId(),t.name]}),oC=no({argsMap:e=>[e.getTrackId()]}),sC=class extends cb{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?RO.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,n){super(e,r),IT(this,"trackMediaType",Sd.AUDIO),IT(this,"_encoderConfig",void 0),IT(this,"_trackSource",void 0),IT(this,"metadata",[]),IT(this,"_enabled",!0),IT(this,"_volume",100),IT(this,"_useAudioElement",!0),IT(this,"_bypassWebAudio",!1),IT(this,"processor",void 0),IT(this,"_processorContext",void 0),IT(this,"_processorDestination",void 0),IT(this,"_getOriginVolumeLevel",void 0),IT(this,"_usePipeMode",!1),IT(this,"_useExtensionMode",!1),IT(this,"_extensionManager",void 0),this._encoderConfig=t,this._getOriginVolumeLevel=!!n,this._trackSource=new BO,yi("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),yi("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);Gr()&&!_b()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(e){_n(e,"volume",0,1e3),this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&RO.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void Vi.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,Ln(this,hd.NEED_REPLACE_TRACK,this).then((()=>{Vi.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{Vi.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||!co())throw new fn(pn.NOT_SUPPORTED,"your browser does not support setting the audio output device");await RO.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(Vi.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await Ln(this,hd.NEED_ENABLE_TRACK,this),Vi.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success"))}catch(e){throw r||(this._enabled=!1),Vi.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await Ln(this,hd.NEED_DISABLE_TRACK,this)}catch(e){throw r||(this._enabled=!0),Vi.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,Vi.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await Ln(this,hd.NEED_MUTE_TRACK,this):await Ln(this,hd.NEED_UNMUTE_TRACK,this))}getStats(){Yn((()=>{Vi.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const e=kn(this,hd.GET_STATS);return e||wC({},Rd)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(yd.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(yd.ON_AUDIO_BUFFER),this._source.on(yd.ON_AUDIO_BUFFER,(t=>e(t)))}play(){Vi.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(Vi.debug("[".concat(this.getTrackId(),"] start audio playback in element")),RO.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){Vi.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?RO.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._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1),this._source.destroy()}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];Vi.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&RO.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 Ln(this,hd.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(e))}renewMediaStreamTrack(e){return sb.resolve(void 0)}_ensureExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createAudioExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,Ln(this,hd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,Ln(this,hd.NEED_REPLACE_TRACK,this))}),this._extensionManager}useExtension(e,t){if(this._usePipeMode)throw new fn(pn.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e,t)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&Vi.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}addReferenceTrack(e){if(!this._extensionManager)throw new fn(pn.INVALID_OPERATION,"Call useExtension() before addReferenceTrack().");this._extensionManager.addReferenceTrack(e),Vi.info("[".concat(this.getTrackId(),"] addReferenceTrack"))}removeReferenceTrack(e){return!!this._extensionManager&&this._extensionManager.removeReferenceTrack(e)}pipe(e){if(this._useExtensionMode)throw new fn(pn.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active. Call removeExtension() for all extensions first.");if(this._bypassWebAudio)throw new fn(pn.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new fn(pn.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,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,this._usePipeMode=!1,t.reset()}bindProcessorDestinationEvents(e){e.on(Id.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e),await Ln(this,hd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await Ln(this,hd.NEED_REPLACE_TRACK,this))})),e.on(Id.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(e){e.removeAllListeners(Id.ON_TRACK),e.removeAllListeners(Id.ON_NODE)}bindProcessorContextEvents(e){e.on(Cd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(e){e.removeAllListeners(Cd.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof BO&&(this._trackSource=new Ob(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const e=new FO(this._source.context,this.getTrackId(),"local"),t=new VO(e);return this._processorContext=e,this._processorDestination=t,this.bindProcessorContextEvents(e),this.bindProcessorDestinationEvents(t),this._source.on(yd.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:e})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(RO.stop(this.getTrackId()),this._source.play()),Ln(this,hd.NEED_REPLACE_MIXING_TRACK,this).then((()=>{Vi.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{Vi.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:e,processorDestination:t}}},Hg(sC.prototype,"setVolume",[WI],Object.getOwnPropertyDescriptor(sC.prototype,"setVolume"),sC.prototype),Hg(sC.prototype,"setPlaybackDevice",[GI,HI],Object.getOwnPropertyDescriptor(sC.prototype,"setPlaybackDevice"),sC.prototype),Hg(sC.prototype,"setEnabled",[KI,YI,ZI],Object.getOwnPropertyDescriptor(sC.prototype,"setEnabled"),sC.prototype),Hg(sC.prototype,"setMuted",[zI,XI,JI],Object.getOwnPropertyDescriptor(sC.prototype,"setMuted"),sC.prototype),Hg(sC.prototype,"getStats",[QI],Object.getOwnPropertyDescriptor(sC.prototype,"getStats"),sC.prototype),Hg(sC.prototype,"setAudioFrameCallback",[qI],Object.getOwnPropertyDescriptor(sC.prototype,"setAudioFrameCallback"),sC.prototype),Hg(sC.prototype,"play",[$I,eC],Object.getOwnPropertyDescriptor(sC.prototype,"play"),sC.prototype),Hg(sC.prototype,"stop",[tC,rC],Object.getOwnPropertyDescriptor(sC.prototype,"stop"),sC.prototype),Hg(sC.prototype,"close",[nC],Object.getOwnPropertyDescriptor(sC.prototype,"close"),sC.prototype),Hg(sC.prototype,"pipe",[iC],Object.getOwnPropertyDescriptor(sC.prototype,"pipe"),sC.prototype),Hg(sC.prototype,"unpipe",[oC],Object.getOwnPropertyDescriptor(sC.prototype,"unpipe"),sC.prototype),sC),DC=(aC=no({argsMap:(e,t)=>[e.getTrackId(),t]}),cC=AO(),uC=si("MicrophoneAudioTrack","_enabledMutex"),dC=no({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),lC=AO(),hC=no({argsMap:e=>[e.getTrackId()]}),pC=class extends NC{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,n){super(e,t.encoderConfig?id(t.encoderConfig):{},n,yi("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),IT(this,"_config",void 0),IT(this,"_deviceName","default"),IT(this,"_constraints",void 0),IT(this,"_originalConstraints",void 0),IT(this,"_enabled",!0),this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),(qr()||$r())&&pb.bindInterruptDetectorTrack(this)}async setDevice(e){if(Vi.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await xb.getDeviceById(e),r={};r.audio=wC({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let n=null;try{n=await Pb(r,this.getTrackId())}catch(e){throw Vi.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await Pb({audio:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(n.getAudioTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(n.getAudioTracks()[0],!1),this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw Vi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await xb.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw Vi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Vi.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(e,t,r){if(t)return Vi.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(Vi.info("[".concat(this.getTrackId(),"] start setEnabled"),e),yi("AUTO_RESET_AUDIO_ROUTE")&&(Yr()||tn())){const t=navigator.audioSession;t&&(e||(t.type="playback"),t.type="auto")}if(!e){var n;this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),null===(n=this._source.clonedTrack)||void 0===n||n.stop(),r||(this._enabled=!1);try{await Ln(this,hd.NEED_DISABLE_TRACK,this)}catch(e){throw Vi.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const i=wC({},this._constraints),o=xb.searchDeviceIdByName(this._deviceName);o&&!i.deviceId&&(i.deviceId=o);try{r||(this._enabled=!0);const e=await Pb({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await Ln(this,hd.NEED_ENABLE_TRACK,this)}catch(e){throw r||(this._enabled=!1),Vi.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}Vi.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(qr()||$r())&&pb.unbindInterruptDetectorTrack(this),cd()||Eb()}onTrackEnded(){if((Yr()||tn())&&this._enabled&&!this._isClosed&&pb.duringInterruption){const e=async()=>{pb.off(fo.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Vi.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};pb.on(fo.IOS_INTERRUPTION_END,e)}else Vi.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Td.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=xb.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await Pb({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(e){super.bindProcessorContextEvents(e),e.on(Cd.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(Cd.REQUEST_UPDATE_CONSTRAINTS)}},Hg(pC.prototype,"setDevice",[aC,cC],Object.getOwnPropertyDescriptor(pC.prototype,"setDevice"),pC.prototype),Hg(pC.prototype,"setEnabled",[uC,dC,lC],Object.getOwnPropertyDescriptor(pC.prototype,"setEnabled"),pC.prototype),Hg(pC.prototype,"close",[hC],Object.getOwnPropertyDescriptor(pC.prototype,"close"),pC.prototype),pC),PC=(fC=no({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),EC=AO(),mC=no({argsMap:e=>[e.getTrackId()]}),_C=AO(),TC=no({argsMap:e=>[e.getTrackId()]}),gC=AO(),SC=no({argsMap:e=>[e.getTrackId()]}),yC=AO(),vC=no({argsMap:e=>[e.getTrackId()]}),RC=AO(),AC=no({argsMap:e=>[e.getTrackId()]}),bC=no({argsMap:e=>[e.getTrackId()]}),OC=AO(),Hg((IC=class extends NC{get __className__(){return"BufferSourceAudioTrack"}constructor(e,t,r,n){super(t.createOutputTrack(),r,n),IT(this,"source",void 0),IT(this,"_bufferSource",void 0),this._useAudioElement=!1,this.source=e,this._bufferSource=t,this._bufferSource.on(yd.AUDIO_SOURCE_STATE_CHANGE,(e=>{this.safeEmit(Td.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){_n(e,"speed",0),this._bufferSource.setAudioBufferPlaybackSpeed(e)}}).prototype,"startProcessAudioBuffer",[fC,EC],Object.getOwnPropertyDescriptor(IC.prototype,"startProcessAudioBuffer"),IC.prototype),Hg(IC.prototype,"pauseProcessAudioBuffer",[mC,_C],Object.getOwnPropertyDescriptor(IC.prototype,"pauseProcessAudioBuffer"),IC.prototype),Hg(IC.prototype,"seekAudioBuffer",[TC,gC],Object.getOwnPropertyDescriptor(IC.prototype,"seekAudioBuffer"),IC.prototype),Hg(IC.prototype,"resumeProcessAudioBuffer",[SC,yC],Object.getOwnPropertyDescriptor(IC.prototype,"resumeProcessAudioBuffer"),IC.prototype),Hg(IC.prototype,"stopProcessAudioBuffer",[vC,RC],Object.getOwnPropertyDescriptor(IC.prototype,"stopProcessAudioBuffer"),IC.prototype),Hg(IC.prototype,"close",[AC],Object.getOwnPropertyDescriptor(IC.prototype,"close"),IC.prototype),Hg(IC.prototype,"setAudioBufferPlaybackSpeed",[bC,OC],Object.getOwnPropertyDescriptor(IC.prototype,"setAudioBufferPlaybackSpeed"),IC.prototype),IC);class LC extends NC{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=mb().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,Xn(8,"track-mix-")),IT(this,"trackList",void 0),IT(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)?(Vi.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):Vi.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){Vi.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}jn(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 LC?t.emit(_d.TRANSCEIVER_UPDATED,e):t._updateRtpTransceiver(e)})))}}class kC extends bb{set currentState(e){e!==this._currentState&&(this._currentState=e,this.safeEmit(yd.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(),IT(this,"audioBuffer",void 0),IT(this,"sourceNode",void 0),IT(this,"startPlayTime",0),IT(this,"startPlayOffset",0),IT(this,"pausePlayTime",0),IT(this,"options",void 0),IT(this,"currentLoopCount",0),IT(this,"currentPlaybackSpeed",100),IT(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):Vi.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 MC=new Map;function UC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xC(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?UC(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UC(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function VC(e,t){if(0===e.length||0===t.length)return 1/0;const r=ri(e),n=ri(t);return Math.floor(n/r)}class FC{get rendFrameRate(){const e=Math.max(1,VC(this._render_interframe_delays_sizes,this._render_interframe_delays));return Math.floor(1e3/e)}get videoElementStatus(){return this._isInPage?this._videoElementStatus:Dd.DESTROYED}set videoElementStatus(e){e!==this._videoElementStatus&&(Vi.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){IT(this,"trackId",void 0),IT(this,"config",void 0),IT(this,"onFirstVideoFrameDecoded",void 0),IT(this,"onFirstVideoFrameRender",void 0),IT(this,"onVideoBufferReady",void 0),IT(this,"onVideoStateChanged",void 0),IT(this,"freezeTimeCounterList",[]),IT(this,"renderFreezeAccTime",0),IT(this,"renderFreezeAccTime2",0),IT(this,"totalFreezeTime",0),IT(this,"isKeepLastFrame",!1),IT(this,"isDestroyed",!1),IT(this,"timeUpdatedCount",0),IT(this,"freezeTime",0),IT(this,"playbackTime",0),IT(this,"lastTimeUpdatedTime",0),IT(this,"autoplayFailed",!1),IT(this,"videoTrack",void 0),IT(this,"videoElement",void 0),IT(this,"cacheVideoElement",void 0),IT(this,"cancelRVFId",void 0),IT(this,"internal",!1),IT(this,"_render_interframe_delays",[]),IT(this,"_render_interframe_delays_sizes",[]),IT(this,"_videoState",Pd.VideoStateStopped),IT(this,"videoElementCheckInterval",void 0),IT(this,"videoElementFreezeTimeout",void 0),IT(this,"_videoElementStatus",Dd.NONE),IT(this,"_isInPage",!0),IT(this,"isGettingVideoDimensions",!1),IT(this,"startGetVideoDimensions",(()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return Vi.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()})),IT(this,"autoResumeAfterInterruption",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===pb.curState&&(Vi.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Br())),en()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),IT(this,"handleVideoEvents",(e=>{switch(e.type){case"play":case"playing":"play"===e.type&&Vi.debug("[".concat(this.trackId,"] video element status: play")),this.startGetVideoDimensions(),this.videoElementStatus=Dd.PLAYING;break;case"loadeddata":if(this.videoState=Pd.VideoStateStarting,this.onFirstVideoFrameRender&&this.onFirstVideoFrameRender(),this.onFirstVideoFrameDecoded&&this.onFirstVideoFrameDecoded(),this.cacheVideoElement){try{this.cacheVideoElement.srcObject=null,this.cacheVideoElement.remove()}catch(e){}this.cacheVideoElement=void 0}break;case"canplay":this.videoElementStatus=Dd.CANPLAY;break;case"stalled":this.videoElementStatus=Dd.STALLED;break;case"suspend":this.videoElementStatus=Dd.SUSPEND;break;case"pause":this.videoElementStatus=Dd.PAUSED,Yr()||tn()||Gr()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(Vi.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=Dd.WAITING;break;case"abort":this.videoElementStatus=Dd.ABORT;break;case"ended":this.videoElementStatus=Dd.ENDED;break;case"emptied":this.videoElementStatus=Dd.EMPTIED;break;case"error":{const e=this.videoElement.error;e&&(this.videoElementStatus=Dd.ERROR,Vi.error("[".concat(this.trackId,"] media error: ").concat(e.message," (").concat(e.code,")")));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.onVideoBufferReady&&this.timeUpdatedCount>yi("BUFFER_READY_FRAMES")&&this.onVideoBufferReady(),this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,Qw.lastVisibleTime<Qw.lastHiddenTime||r<Qw.lastHiddenTime||r<Qw.lastVisibleTime)return;if(this.isSkipCalcRenderFreezeTime())return;for(t>yi("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}}})),IT(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(Vi.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Br())),en()?(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"),pb.on(fo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),pb.on(fo.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&&yO(e,"video",t.message,this.trackId),"NotAllowedError"===t.name?(Vi.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):Vi.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=xr();if(("Safari"===r.name&&15===Number(r.version)||qr())&&t&&t.then){const e=()=>{this.config.mirror&&!this.config.noStyle&&(this.videoElement.style.transform="rotateY(180deg)")};t.then(e).catch(e)}}getCurrentFrame(){const e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;const t=e.getContext("2d");if(!t)return Vi.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 n=r.getContext("2d");return n?(n.drawImage(this.videoElement,0,0,r.width,r.height),new sb(((n,i)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await BI(e);n({buffer:t,width:r.width,height:r.height})}else i(new fn(pn.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,t<0?.1:t>1?1:t)}))):await FI(e)}destroy(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isDestroyed=!0,pb.off(fo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),pb.off(fo.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),e?this.videoElement.pause():this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=Pd.VideoStateStopped}initVideoElement(){if(this._videoElementStatus!==Dd.NONE&&this._videoElementStatus!==Dd.DESTROYED||(this.videoElementStatus=Dd.INIT),!this.videoElementCheckInterval&&(BC.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{this._isInPage=function(e){return e!==document.body&&document.body.contains(e)}(this.videoElement)}),1e3),yi("ENABLE_VIDEO_FRAME_CALLBACK"))){var e,t;let r;const n=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",n),this.videoElementFreezeTimeout=window.setTimeout(i,yi("VIDEO_FREEZE_DURATION")))},i=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===Pd.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=Pd.VideoStateFrozen:document.addEventListener("visibilitychange",n))},o=(e,t)=>{if(this.videoElementStatus===Dd.PLAYING){if(r){const e=t.presentationTime-r.presentationTime,n=t.presentedFrames-r.presentedFrames;this._render_interframe_delays_sizes.push(n),this._render_interframe_delays.push(e);const o=ri(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===Pd.VideoStateStarting&&(this.videoState=Pd.VideoStateDecoding),this.videoState===Pd.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(i,yi("VIDEO_FREEZE_DURATION"))),e<yi("VIDEO_FREEZE_DURATION")&&this.videoState===Pd.VideoStateFrozen&&(this.videoState=Pd.VideoStateDecoding),e>yi("VIDEO_FREEZE_DURATION")&&Qw.lastVisibleTime>=Qw.lastHiddenTime&&r.timestamp>Qw.lastVisibleTime&&r.timestamp>Qw.lastHiddenTime){const t=Math.min(66,VC(this._render_interframe_delays_sizes,this._render_interframe_delays)),r=Math.max(0,e-(n-1)*t),i=r>t?r:0;this.renderFreezeAccTime2+=i,this.totalFreezeTime+=i,this.renderFreezeAccTime+=e}}r=xC(xC({},t),{},{timestamp:e})}else this.isSkipCalcRenderFreezeTime()&&(r=xC(xC({},t),{},{timestamp:e}));var n,s;yi("ENABLE_VIDEO_FRAME_CALLBACK")&&(this.cancelRVFId=null===(n=(s=this.videoElement).requestVideoFrameCallback)||void 0===n?void 0:n.call(s,o))};this.cancelRVFId=null===(e=(t=this.videoElement).requestVideoFrameCallback)||void 0===e?void 0:e.call(t,o)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),sn()&&!yi("HIDE_NO_POSTER")&&(this.videoElement.poster="noposter");const r=xr();if(this.config.noStyle||("Safari"===r.name&&15===Number(r.version)||qr()||!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,Kr()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Kr()&&this.videoElement.load();const n=this.videoElement.play();void 0!==n&&n.catch((e=>{Vi.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){var e,t;(BC.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.cancelRVFId&&this.videoElement)&&(null===(e=(t=this.videoElement).cancelVideoFrameCallback)||void 0===e||e.call(t,this.cancelRVFId),this.cancelRVFId=void 0);this.videoElementStatus=Dd.NONE}isSkipCalcRenderFreezeTime(){return this.videoElementStatus===Dd.DESTROYED||this.internal}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{Vi.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{Vi.error(e)})),this.autoplayFailed=!1,an()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};an()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),TO()}}const BC=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class jC extends FC{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super(e),IT(this,"container",void 0),IT(this,"slot",void 0),this.slot=e.element,this.internal=t,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;var r;!this.internal||this.slot?(t!==this.slot&&(this.destroy(),this.slot=t),this.createElements()):(this.slot=t,t&&this.container?(this.internal=!1,this.container.id="agora-video-player-".concat(this.trackId),this.videoElement.id="video_".concat(this.trackId),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover",null===(r=this.slot)||void 0===r||r.appendChild(this.container)):this.createElements())}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}play(e){var t;null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)&&super.play(e)}getCurrentFrame(){var e;return null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)?super.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameToUint8Array(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)?await super.getCurrentFrameToUint8Array(e,r):await FI(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{var e;this.container.remove(),null===(e=this.slot)||void 0===e||e.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){var e;this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",yi("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),null===(e=this.slot)||void 0===e||e.appendChild(this.container)}mountedVideoElement(){var e;!this.container||null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)||this.container.appendChild(this.videoElement),super.initVideoElement(),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.left="0",this.videoElement.style.top="0"}unmountedVideoElement(){var e;if(null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)){super.resetVideoElement();try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=document.createElement("video")}}resetVideoElement(){var e;null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)&&(super.resetVideoElement(),this.cacheVideoElement=this.videoElement,this.videoElement=document.createElement("video"))}getContainerElement(){return this.container}}var WC,GC,HC,KC,YC,ZC,zC,XC,JC,QC,qC,$C,ew,tw,rw,nw,iw,ow,sw,aw,cw,uw,dw,lw,hw,pw,fw,Ew,mw,_w,Tw,gw,Sw,yw,vw,Rw,Aw,bw;function Ow(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Iw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ow(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ow(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let Cw=(WC=no({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),GC=AO(),HC=no({argsMap:e=>[e.getTrackId()]}),KC=si("LocalVideoTrack","_enabledMutex"),YC=no({argsMap:(e,t)=>[e.getTrackId(),t]}),ZC=AO(),zC=si("LocalVideoTrack","_enabledMutex"),XC=no({argsMap:(e,t)=>[e.getTrackId(),t]}),JC=AO(),QC=no({argsMap:(e,t)=>[e.getTrackId(),t,e._saveEncodeBitrateRatio]}),qC=AO(),$C=no({argsMap:(e,t)=>[e.getTrackId(),t]}),ew=AO(),tw=AO(),rw=no({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),nw=AO(),iw=AO(),ow=AO(),sw=no({argsMap:e=>[e.getTrackId()]}),aw=AO(),cw=AO(),uw=AO(),dw=AO(),lw=AO(),hw=no({argsMap:(e,t)=>[e.getTrackId(),t.name]}),pw=no({argsMap:e=>[e.getTrackId()]}),fw=no({argsMap:e=>[e.getTrackId()]}),Ew=no({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),mw=class e extends cb{get videoHeight(){if(Gr()){const e=this._mediaStreamTrack.getSettings().height;return this._videoHeight=e,this._videoHeight}return this._videoHeight}get videoWidth(){if(Gr()){const e=this._mediaStreamTrack.getSettings().width;return this._videoWidth=e,this._videoWidth}return this._videoWidth}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==Dd.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,n,i,o){if(super(e,i),IT(this,"trackMediaType",Sd.VIDEO),IT(this,"_player",void 0),IT(this,"isUseScaleResolutionDownBy",!1),IT(this,"_videoVisibleTimer",null),IT(this,"_previousVideoVisibleStatus",void 0),IT(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),IT(this,"_encoderConfig",void 0),IT(this,"_scalabilityMode",{numSpatialLayers:1,numTemporalLayers:1}),IT(this,"_optimizationMode",void 0),IT(this,"_saveEncodeBitrateRatio",1),IT(this,"_videoHeight",void 0),IT(this,"_videoWidth",void 0),IT(this,"_forceBitrateLimit",void 0),IT(this,"_enabled",!0),IT(this,"_processorDestination",void 0),IT(this,"_processorContext",void 0),IT(this,"_usePipeMode",!1),IT(this,"_useExtensionMode",!1),IT(this,"_extensionManager",void 0),Gr()){const t=e.getSettings(),r=t.width,n=t.height;this._videoWidth=r,this._videoHeight=n}else this.updateMediaStreamTrackResolution();if(this._scalabilityMode=r,this._optimizationMode=n,this._hints=o||[],t&&-1!==this._hints.indexOf(pd.CUSTOM_TRACK)?this._encoderConfig=Gn(t):this._encoderConfig=t,-1===this._hints.indexOf(pd.SCREEN_TRACK))this.updateBitrateFromProfile();else if(zr(Lr.CHROME,115)&&-1!==Fr().indexOf("Windows")){const t=jI(e);t&&(Vi.info("local screen video track begin to inject frame"),this._mediaStreamTrack=t)}t&&-1!==this._hints.indexOf(pd.CUSTOM_TRACK)&&this.setEncoderConfiguration(t),this._processorContext=new xO(this.getTrackId(),"local"),this._processorDestination=new UO(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:(Vi.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Vi.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=Iw(Iw(Iw({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new FC(r):this._player=new jC(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(Td.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),yi("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,Vi.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Vi.info("[".concat(this.getTrackId(),"] start setEnabled"),e),!e){this._originMediaStreamTrack.enabled=!1;try{await Ln(this,hd.NEED_DISABLE_TRACK,this)}catch(e){throw Vi.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return t||(this._enabled=!1),void Vi.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await Ln(this,hd.NEED_ENABLE_TRACK,this)}catch(e){throw Vi.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}Vi.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,Vi.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await Ln(this,hd.NEED_MUTE_TRACK,this):await Ln(this,hd.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),Vi.debug("[".concat(this.getTrackId(),"] set save encode bitrate ratio, ").concat(e)),this._saveEncodeBitrateRatio=1;try{await Ln(this,hd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Vi)}}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new fn(pn.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");if(e=ed(e),yi("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=GO({encoderConfig:e});(Gr()||Yr()||tn())&&(t.deviceId=void 0),Vi.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 fn(pn.UNEXPECTED_ERROR,e.toString());throw Vi.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=e,-1===this._hints.indexOf(pd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Ln(this,hd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Vi)}}getStats(){Yn((()=>{Vi.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const e=kn(this,hd.GET_STATS);return e||Iw({},Ad)}async setBeautyEffect(e){Vi.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 FI(e)}async findClosestProfile(){const e=this.getMediaStreamTrackSettings(),t=e.width,r=e.height,n=e.frameRate,i=this._encoderConfig||{},o=i.width,s=i.height,a=i.frameRate,c=ti(this._videoWidth||t||o||0),u=ti(this._videoHeight||r||s||0),d=MI(c,u,ti(n||a||15));if(d)return Vi.debug("[".concat(this.getTrackId(),"] find closest profile, ").concat(c,"x").concat(u," => ").concat(JSON.stringify(d))),this.setEncoderConfiguration(d)}async setBitrateLimit(e){Vi.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 Vi.error(pn.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const t=this._optimizationMode;try{this._optimizationMode=e,await Ln(this,hd.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=t,Vi.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}Vi.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return Vi.error(pn.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,Vi.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){WO(this._originMediaStreamTrack).then((e=>{let t=EO(e,2),r=t[0],n=t[1];this._videoHeight=n,this._videoWidth=r})).catch(Jn)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}async setSenderConfiguration(e){if(!this._enabled)throw new fn(pn.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");Vi.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(e)),e=ed(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(pd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Ln(this,hd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Vi)}}updateBitrateFromProfile(){if(!this._encoderConfig)return;const e=this.getMediaStreamTrackSettings(),t=e.width,r=e.height,n=e.frameRate;if(!t||!r||!n)return;const i=this._encoderConfig,o=i.bitrateMax,s=i.bitrateMin;if(null==s||null==o){const e=UI(t,r,n,s,o),i=e.max,a=e.min;if(this._encoderConfig.bitrateMin=a,this._encoderConfig.bitrateMax=i,yi("VIDEO_STANDARD_BITRATE_VERSION")&&null==s&&null==o){const e=EO(kI(t,r,n),2),i=e[0],o=e[1];this._encoderConfig.bitrateMax=i,this._encoderConfig.bitrateMin=a?Math.min(a,i):i,this._saveEncodeBitrateRatio=o,Vi.debug("[".concat(this.getTrackId(),"] update new bitrate from profile, [w: ").concat(t,", h: ").concat(r,", fps: ").concat(n,"] => [brMax: ").concat(this._encoderConfig.bitrateMax,", brMin: ").concat(this._encoderConfig.bitrateMin,", save_bitrate_ratio: ").concat(this._saveEncodeBitrateRatio,"]"))}else Vi.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(t,", h: ").concat(r,", fps: ").concat(n,"] => [brMax: ").concat(i,", brMin: ").concat(a,"]")),this._saveEncodeBitrateRatio=1}}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),n={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},i=n.element,o=n.slot;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=vn.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=io.reportApiInvoke(null,{tag:wn.TRACER,name:Cn.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 fn(pn.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}_ensureVideoExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createVideoExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),Ln(this,hd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),Ln(this,hd.NEED_REPLACE_TRACK,this))},this._extensionManager.onEmpty=()=>{this._useExtensionMode=!1,this._extensionManager=void 0}),this._extensionManager}useExtension(e,t){if(this._usePipeMode)throw new fn(pn.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureVideoExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e,t)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&Vi.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}pipe(e){if(this._useExtensionMode)throw new fn(pn.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active. Call removeExtension() for all extensions first.");if(this.processor===e)return e;if(e._source)throw new fn(pn.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,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,this._usePipeMode=!1,e.reset()}close(){super.close(),this.unbindProcessorDestinationEvents(),this.unbindProcessorContextEvents(),this.unpipe(),this.processorDestination._source&&this.processorDestination._source.unpipe(),this._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._encoderConfig;t&&(n=Iw(Iw({},n),ed(t))),n=Hn(n);const i=Xn(8,"track-video-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,n,Hn(this._scalabilityMode),this._optimizationMode,i,Hn(this._hints));return t&&n&&o.setEncoderConfiguration(n),Vi.debug("clone video track from ".concat(this.getTrackId()," to ").concat(i,", clone ").concat(r)),o}async replaceTrack(e,t){if(!(e instanceof MediaStreamTrack))throw new fn(pn.INVALID_PARAMS,"track should be an instance of MediaStreamTrack");if("video"!==e.kind)throw new fn(pn.INVALID_PARAMS,"track should be a video MediaStreamTrack");await this._updateOriginMediaStreamTrack(e,t,!0),this.updateMediaStreamTrackResolution()}sendSeiData(e){if(Yn((()=>{io.reportApiInvoke(null,{name:Cn.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:wn.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!yi("ENABLE_VIDEO_SEI")||!yi("ENABLE_ENCODED_TRANSFORM"))return void Vi.warning('To send/receive SEI, please call AgoraRTC.setParameter("ENABLE_VIDEO_SEI", true) before instantiate IAgoraRtcClient');if(e instanceof Uint8Array==!1)return new fn(pn.INVALID_PARAMS,"Invalid argument type, ILocalVideoTrack.sendSeiData() only accept Uint8Array argument.").throw();const t=this.getRTCRtpTransceiver();if(!t)return void Vi.warning("Video track is not published, SEI can not be send");const r=t.sender.getParameters();if(0===r.codecs.length)return;const n=r.codecs[0].mimeType.toLocaleLowerCase();"video/h264"===n||"video/h265"===n?this.safeEmit("sei-to-send",e):Vi.warning("SEI is not supported by ".concat(n))}bindProcessorDestinationEvents(){this.processorDestination.on(Id.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await Ln(this,hd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await Ln(this,hd.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(Id.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(Cd.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(Cd.REQUEST_CONSTRAINTS)}},Hg(mw.prototype,"play",[WC,GC],Object.getOwnPropertyDescriptor(mw.prototype,"play"),mw.prototype),Hg(mw.prototype,"stop",[HC],Object.getOwnPropertyDescriptor(mw.prototype,"stop"),mw.prototype),Hg(mw.prototype,"setEnabled",[KC,YC,ZC],Object.getOwnPropertyDescriptor(mw.prototype,"setEnabled"),mw.prototype),Hg(mw.prototype,"setMuted",[zC,XC,JC],Object.getOwnPropertyDescriptor(mw.prototype,"setMuted"),mw.prototype),Hg(mw.prototype,"setSaveEncodeBitrateRatio",[QC,qC],Object.getOwnPropertyDescriptor(mw.prototype,"setSaveEncodeBitrateRatio"),mw.prototype),Hg(mw.prototype,"setEncoderConfiguration",[$C,ew],Object.getOwnPropertyDescriptor(mw.prototype,"setEncoderConfiguration"),mw.prototype),Hg(mw.prototype,"getStats",[tw],Object.getOwnPropertyDescriptor(mw.prototype,"getStats"),mw.prototype),Hg(mw.prototype,"setBeautyEffect",[rw,nw],Object.getOwnPropertyDescriptor(mw.prototype,"setBeautyEffect"),mw.prototype),Hg(mw.prototype,"getCurrentFrameData",[iw],Object.getOwnPropertyDescriptor(mw.prototype,"getCurrentFrameData"),mw.prototype),Hg(mw.prototype,"getCurrentFrameImage",[ow],Object.getOwnPropertyDescriptor(mw.prototype,"getCurrentFrameImage"),mw.prototype),Hg(mw.prototype,"findClosestProfile",[sw,aw],Object.getOwnPropertyDescriptor(mw.prototype,"findClosestProfile"),mw.prototype),Hg(mw.prototype,"setBitrateLimit",[cw],Object.getOwnPropertyDescriptor(mw.prototype,"setBitrateLimit"),mw.prototype),Hg(mw.prototype,"setOptimizationMode",[uw],Object.getOwnPropertyDescriptor(mw.prototype,"setOptimizationMode"),mw.prototype),Hg(mw.prototype,"setScalabiltyMode",[dw],Object.getOwnPropertyDescriptor(mw.prototype,"setScalabiltyMode"),mw.prototype),Hg(mw.prototype,"updateMediaStreamTrackResolution",[lw],Object.getOwnPropertyDescriptor(mw.prototype,"updateMediaStreamTrackResolution"),mw.prototype),Hg(mw.prototype,"pipe",[hw],Object.getOwnPropertyDescriptor(mw.prototype,"pipe"),mw.prototype),Hg(mw.prototype,"unpipe",[pw],Object.getOwnPropertyDescriptor(mw.prototype,"unpipe"),mw.prototype),Hg(mw.prototype,"close",[fw],Object.getOwnPropertyDescriptor(mw.prototype,"close"),mw.prototype),Hg(mw.prototype,"replaceTrack",[Ew],Object.getOwnPropertyDescriptor(mw.prototype,"replaceTrack"),mw.prototype),mw),ww=(_w=no({argsMap:(e,t)=>[e.getTrackId(),t]}),Tw=AO(),gw=si("CameraVideoTrack","_enabledMutex"),Sw=no({argsMap:(e,t)=>[e.getTrackId(),t]}),yw=AO(),vw=no({argsMap:(e,t)=>[e.getTrackId(),t]}),Rw=AO(),Aw=no({argsMap:e=>[e.getTrackId()]}),bw=class e extends Cw{get __className__(){return"CameraVideoTrack"}constructor(e,t,r,n,i,o){super(e,ed(t.encoderConfig),n,i,o),IT(this,"_config",void 0),IT(this,"_originalConstraints",void 0),IT(this,"_constraints",void 0),IT(this,"_enabled",!0),IT(this,"_deviceName","default"),IT(this,"tryResumeVideoForIOS15_16WeChat",(async()=>{!qr()&&!$r()||function(){const e=xr();if(e.os!==Pr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()||xr().name!==Lr.WECHAT||!this._enabled||this._isClosed||(Vi.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=ed(this._config.encoderConfig),pb.on(fo.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),pb.on(fo.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(Vi.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await xb.getDeviceById(e),r={};r.video=Iw({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let n=null;try{n=await Pb(r,this.getTrackId())}catch(e){throw Vi.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await Pb({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(n.getVideoTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(n.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution(),this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw Vi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await xb.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw Vi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Vi.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){Vi.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:Iw(Iw({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await Pb(t,this.getTrackId())}catch(t){throw Vi.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await Pb({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=Iw({},t.video),Vi.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Vi.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await Pb({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await Ln(this,hd.NEED_ENABLE_TRACK,this)}catch(e){throw Vi.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),Vi.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 Ln(this,hd.NEED_DISABLE_TRACK,this)}catch(e){throw Vi.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}Vi.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new fn(pn.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");e=ed(e),yi("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=Gn(this._config);r.encoderConfig=e;const n=GO(r);(Gr()||Yr()||tn())&&(n.deviceId=void 0),Vi.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(n));try{await this._originMediaStreamTrack.applyConstraints(n),this.updateMediaStreamTrackResolution()}catch(e){const t=new fn(pn.UNEXPECTED_ERROR,e.toString());throw Vi.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}this._config=r,this._constraints=n,this._originalConstraints=n,this._encoderConfig=e,-1===this._hints.indexOf(pd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Ln(this,hd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Vi)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((Yr()||tn())&&this._enabled&&!this._isClosed&&pb.duringInterruption){const e=async()=>{pb.off(fo.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Vi.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};pb.on(fo.IOS_INTERRUPTION_END,e)}else Vi.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Td.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=xb.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await Pb({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),pb.off(fo.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),pb.off(fo.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._encoderConfig;t&&(n=Iw(Iw({},n),ed(t))),n=Hn(n);const i=Xn(8,"track-cam-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,Hn(Iw(Iw({},this._config),{},{encoderConfig:n})),Hn(this._constraints),Hn(this._scalabilityMode),this._optimizationMode,i);return t&&n&&o.setEncoderConfiguration(n),Vi.debug("clone track from ".concat(this.getTrackId()," to ").concat(i,", clone ").concat(r)),o}bindProcessorContextEvents(){this.processorContext.on(Cd.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(Cd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}},Hg(bw.prototype,"setDevice",[_w,Tw],Object.getOwnPropertyDescriptor(bw.prototype,"setDevice"),bw.prototype),Hg(bw.prototype,"setEnabled",[gw,Sw,yw],Object.getOwnPropertyDescriptor(bw.prototype,"setEnabled"),bw.prototype),Hg(bw.prototype,"setEncoderConfiguration",[vw,Rw],Object.getOwnPropertyDescriptor(bw.prototype,"setEncoderConfiguration"),bw.prototype),Hg(bw.prototype,"close",[Aw],Object.getOwnPropertyDescriptor(bw.prototype,"close"),bw.prototype),bw);function Nw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Dw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nw(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nw(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Pw(e,t,r,n){r.optimizationMode&&(n&&n.width&&n.height?(r.encoderConfig=Dw(Dw({},n),{},{bitrateMin:n.bitrateMin,bitrateMax:n.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?Vi.debug("[".concat(e,"] set content hint to"),r.optimizationMode):Vi.debug("[".concat(e,"] set content hint failed")))):Vi.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}var Lw,kw,Mw,Uw,xw,Vw,Fw,Bw,jw,Ww,Gw,Hw,Kw;function Yw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Zw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yw(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yw(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class zw extends ab{getUserId(){return this._userId}constructor(e,t,r,n){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(n.clientId,"_").concat(Xn(5,""))),IT(this,"_userId",void 0),IT(this,"_uintId",void 0),IT(this,"_isDestroyed",!1),IT(this,"store",void 0),IT(this,"processor",void 0),IT(this,"processorContext",void 0),this._userId=t,this._uintId=r,this.store=n}_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,Vi.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}let Xw=(Lw=no({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),kw=no({argsMap:e=>[e.getTrackId()]}),Mw=no({argsMap:(e,t)=>[e.getTrackId(),t.name]}),Uw=no({argsMap:e=>[e.getTrackId()]}),xw=class extends zw{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==Dd.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,n,i){super(e,t,r,n),IT(this,"_videoVisibleTimer",null),IT(this,"_previousVideoVisibleStatus",void 0),IT(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),IT(this,"trackMediaType",Sd.VIDEO),IT(this,"_videoWidth",void 0),IT(this,"_videoHeight",void 0),IT(this,"_player",void 0),IT(this,"_prePlayer",void 0),IT(this,"processorDestination",void 0),IT(this,"processorContext",void 0),IT(this,"_usePipeMode",!1),IT(this,"_useExtensionMode",!1),IT(this,"_extensionManager",void 0),this._prePlayer=i,this.updateMediaStreamTrackResolution(),this.processorContext=new xO(this.getTrackId(),"remote"),this.processorDestination=new UO(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){Yn((()=>{Vi.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return kn(this,hd.GET_STATS)||Zw({},Od)}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.safeEmit(gd.PLAY_START),"string"==typeof e){const t=document.getElementById(e);t?e=t:(Vi.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Vi.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=Zw(Zw({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});if(this._player)this._player.updateConfig(r);else{let t=!1,n=!1;const i=this._prePlayer&&!this._prePlayer.isDestroyed&&e===this._prePlayer.config.element;this._prePlayer&&!i&&(this._prePlayer.destroy(),n=!0),i?(this._player=this._prePlayer,t=this._player.videoState>0,this._player.updateConfig(r)):this._player=e instanceof HTMLVideoElement?new FC(r):new jC(r),this._prePlayer=void 0,this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(gd.FIRST_FRAME_DECODED),n&&this.safeEmit(gd.FIRST_FRAME_RENDER)},this._player.onVideoStateChanged=e=>{this.safeEmit(gd.VIDEO_STATE_CHANGED,e)},t&&(this._player.onFirstVideoFrameDecoded(),this._player.onVideoStateChanged(this._player.videoState))}this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(gd.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),yi("CHECK_VIDEO_VISIBLE_INTERVAL")),this.safeEmit(gd.PLAY_END)}stop(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(e),this._player=void 0,Vi.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){WO(this._originMediaStreamTrack).then((e=>{let t=EO(e,2),r=t[0],n=t[1];this._videoHeight=n,this._videoWidth=r})).catch(Jn)}_updatePlayerSource(){Vi.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(),n={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},i=n.element,o=n.slot;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=vn.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=io.reportApiInvoke(null,{tag:wn.TRACER,name:Cn.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 fn(pn.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}_ensureVideoExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createVideoExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource()):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())},this._extensionManager.onEmpty=()=>{this._useExtensionMode=!1,this._extensionManager=void 0}),this._extensionManager}useExtension(e,t){if(this._usePipeMode)throw new fn(pn.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureVideoExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e,t)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&Vi.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}pipe(e){if(this._useExtensionMode)throw new fn(pn.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active. Call removeExtension() for all extensions first.");if(this.processor===e)return e;if(e._source)throw new fn(pn.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,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,this._usePipeMode=!1,e.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(Id.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(Id.ON_TRACK)}_destroy(){this._prePlayer&&(this._prePlayer.destroy(),this._prePlayer=void 0),this._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1),super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(e){this.emit(_d.SEI_RECEIVED,e)}},Hg(xw.prototype,"play",[Lw],Object.getOwnPropertyDescriptor(xw.prototype,"play"),xw.prototype),Hg(xw.prototype,"stop",[kw],Object.getOwnPropertyDescriptor(xw.prototype,"stop"),xw.prototype),Hg(xw.prototype,"pipe",[Mw],Object.getOwnPropertyDescriptor(xw.prototype,"pipe"),xw.prototype),Hg(xw.prototype,"unpipe",[Uw],Object.getOwnPropertyDescriptor(xw.prototype,"unpipe"),xw.prototype),xw),Jw=(Vw=no({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),Fw=no({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),Bw=no({argsMap:(e,t)=>[e.getTrackId(),t]}),jw=no({argsMap:e=>[e.getTrackId()]}),Ww=no({argsMap:e=>[e.getTrackId()]}),Gw=no({argsMap:(e,t)=>[e.getTrackId(),t.name]}),Hw=no({argsMap:e=>[e.getTrackId()]}),Kw=class extends zw{get isPlaying(){return this._useAudioElement?RO.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(e,t,r,n){super(e,t,r,n),IT(this,"trackMediaType",Sd.AUDIO),IT(this,"_source",void 0),IT(this,"_useAudioElement",!0),IT(this,"_volume",100),IT(this,"processorContext",void 0),IT(this,"processorDestination",void 0),IT(this,"_usePipeMode",!1),IT(this,"_useExtensionMode",!1),IT(this,"_extensionManager",void 0),IT(this,"_played",!1),IT(this,"_bypassWebAudio",!1),yi("DISABLE_WEBAUDIO")?(this._source=new BO,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new Ob(e,!0),yi("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(yd.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(gd.FIRST_FRAME_DECODED)})),this.processorContext=new FO(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new VO(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(yd.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(yd.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(yd.ON_AUDIO_BUFFER),this._source.on(yd.ON_AUDIO_BUFFER,(t=>e(t)))}setVolume(e){this._volume=e,this._useAudioElement?RO.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}setAmplifiedVolume(e){this._useAudioElement&&this._played&&(RO.stop(this.getTrackId()),this._source.play()),this._useAudioElement=!1,e=Math.min(e,yi("MAX_WEBAUDIO_VOLUME")),this._volume=e,this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!co())throw new fn(pn.NOT_SUPPORTED,"your browser does not support setting the audio output device");await RO.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getVolume(){return this._useAudioElement?RO.getVolume(this.getTrackId()):this._source instanceof Ob?this._source.getAudioVolume():0}getStats(){Yn((()=>{Vi.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return kn(this,hd.GET_STATS)||Zw({},bd)}play(){Vi.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement?(Vi.debug("[".concat(this.getTrackId(),"] use audio element to play")),RO.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):(Vi.debug("[".concat(this.getTrackId(),"] use audio context to play")),this._source.play())}stop(){Vi.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?RO.stop(this.getTrackId()):this._source.stop()}_destroy(){super._destroy(),this._played=!1,this._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1),this.unbindProcessorDestinationEvents(),this._source.destroy()}_isFreeze(){return this._source.isFreeze}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];Vi.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&RO.updateTrack(this.getTrackId(),this._mediaStreamTrack)}_ensureAudioExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createAudioExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())}),this._extensionManager}useExtension(e){if(this._usePipeMode)throw new fn(pn.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureAudioExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&Vi.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}addReferenceTrack(e){if(!this._extensionManager)throw new fn(pn.INVALID_OPERATION,"Call useExtension() before addReferenceTrack().");this._extensionManager.addReferenceTrack(e),Vi.info("[".concat(this.getTrackId(),"] addReferenceTrack"))}removeReferenceTrack(e){return!!this._extensionManager&&this._extensionManager.removeReferenceTrack(e)}pipe(e){if(this._useExtensionMode)throw new fn(pn.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active.");if(this._bypassWebAudio)throw new fn(pn.NOT_SUPPORTED,"can not pipe extension when WebAudio disabled");if(this.processor===e)return e;if(e._source)throw new fn(pn.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,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 fn(pn.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,this._usePipeMode=!1,t.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(Id.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(Id.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(Id.ON_TRACK),this.processorDestination.removeAllListeners(Id.ON_NODE)}},Hg(Kw.prototype,"setVolume",[Vw],Object.getOwnPropertyDescriptor(Kw.prototype,"setVolume"),Kw.prototype),Hg(Kw.prototype,"setAmplifiedVolume",[Fw],Object.getOwnPropertyDescriptor(Kw.prototype,"setAmplifiedVolume"),Kw.prototype),Hg(Kw.prototype,"setPlaybackDevice",[Bw],Object.getOwnPropertyDescriptor(Kw.prototype,"setPlaybackDevice"),Kw.prototype),Hg(Kw.prototype,"play",[jw],Object.getOwnPropertyDescriptor(Kw.prototype,"play"),Kw.prototype),Hg(Kw.prototype,"stop",[Ww],Object.getOwnPropertyDescriptor(Kw.prototype,"stop"),Kw.prototype),Hg(Kw.prototype,"pipe",[Gw],Object.getOwnPropertyDescriptor(Kw.prototype,"pipe"),Kw.prototype),Hg(Kw.prototype,"unpipe",[Hw],Object.getOwnPropertyDescriptor(Kw.prototype,"unpipe"),Kw.prototype),Kw);const Qw=new class extends An{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),IT(this,"_lastHiddenTime",0),IT(this,"_lastVisibleTime",0),IT(this,"needUploadStats",[]),IT(this,"isCollectingStats",!1),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),this.isCollectingStats&&this.needUploadStats.push("visible"===document.visibilityState?1:0),Vi.debug("current web page is ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}startCollectStats(){this.isCollectingStats=!0,this.needUploadStats.push("visible"===this.visibility?1:0)}stopCollectStats(){this.isCollectingStats=!1,this.needUploadStats.length=0}};class qw extends An{constructor(e,t){super(),IT(this,"trackMediaType",Sd.DATA),IT(this,"_version",1),IT(this,"_type",3),IT(this,"_config",void 0),IT(this,"_originDataChannel",void 0),IT(this,"_dataStreamPacketHeader",new ArrayBuffer(4)),IT(this,"_dataStreamPacketHandler",{serialize:e=>e,deserialize:e=>e}),IT(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 yi("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 sb(((e,t)=>{if(this._originDataChannel){"open"===this._originDataChannel.readyState&&e();const r=setTimeout((()=>{var e;t(new fn(pn.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 fn(pn.DATACHANNEL_CONNECTION_TIMEOUT)}}else t(new fn(pn.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),[Ld.OPEN,Ld.CLOSE,Ld.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=EO(t,2),n=r[0],i=r[1];e.removeEventListener(n,i)})),this._datachannelEventMap.clear()}}var $w=jc,eN=yo,tN=Jc,rN=RangeError,nN=String.fromCharCode,iN=String.fromCodePoint,oN=eN([].join);$w({target:"String",stat:!0,arity:1,forced:!!iN&&1!==iN.length},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,i=0;n>i;){if(tN(t=+arguments[i],1114111)!==t)throw new rN(t+" is not a valid code point");r[i++]=t<65536?nN(t):nN(55296+((t-=65536)>>10),t%1024+56320)}return oN(r,"")}});var sN=Eo,aN=ba("iterator"),cN=!sN((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"),n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=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[aN]||"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"!==n||"x"!==new URL("https://x",void 0).host})),uN=Vh,dN=jc,lN=Ao,hN=hv,pN=ms,fN=Go,EN=yo,mN=Bo,_N=cN,TN=Vh,gN=Bh,SN=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:uN(e,n,t[n],r);return e},yN=dp,vN=Hm,RN=Op,AN=Ry,bN=Vo,ON=la,IN=uc,CN=Cu,wN=Ec,NN=ds,DN=Du,PN=bh,LN=Jo,kN=NS,MN=RS,UN=g_,xN=Ly,VN=$O,FN=ba("iterator"),BN="URLSearchParams",jN=BN+"Iterator",WN=RN.set,GN=RN.getterFor(BN),HN=RN.getterFor(jN),KN=hN("fetch"),YN=hN("Request"),ZN=hN("Headers"),zN=YN&&YN.prototype,XN=ZN&&ZN.prototype,JN=lN.TypeError,QN=lN.encodeURIComponent,qN=String.fromCharCode,$N=pN("String","fromCodePoint"),eD=parseInt,tD=EN("".charAt),rD=EN([].join),nD=EN([].push),iD=EN("".replace),oD=EN([].shift),sD=EN([].splice),aD=EN("".split),cD=EN("".slice),uD=EN(/./.exec),dD=/\+/g,lD=/^[0-9a-f]+$/i,hD=function(e,t){var r=cD(e,t,t+2);return uD(lD,r)?eD(r,16):NaN},pD=function(e){for(var t=0,r=128;r>0&&0!=(e&r);r>>=1)t++;return t},fD=function(e){var t=null,r=e.length;switch(r){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 null===t||t>1114111||t>=55296&&t<=57343||t<(r>3?65536:r>2?2048:r>1?128:0)?null:t},ED=function(e){for(var t=(e=iD(e,dD," ")).length,r="",n=0;n<t;){var i=tD(e,n);if("%"===i){if("%"===tD(e,n+1)||n+3>t){r+="%",n++;continue}var o=hD(e,n+1);if(o!=o){r+=i,n++;continue}n+=2;var s=pD(o);if(0===s)i=qN(o);else{if(1===s||s>4){r+="�",n++;continue}for(var a=[o],c=1;c<s&&!(++n+3>t||"%"!==tD(e,n));){var u=hD(e,n+1);if(u!=u||u>191||u<128)break;if(1===c){if(224===o&&u<160)break;if(237===o&&u>159)break;if(240===o&&u<144)break;if(244===o&&u>143)break}nD(a,u),n+=2,c++}if(a.length!==s){r+="�";continue}var d=fD(a);if(null===d){for(var l=0;l<s;l++)r+="�";n++;continue}i=$N(d)}}r+=i,n++}return r},mD=/[!'()~]|%20/g,_D={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},TD=function(e){return _D[e]},gD=function(e){return iD(QN(e),mD,TD)},SD=vN((function(e,t){WN(this,{type:jN,target:GN(e).entries,index:0,kind:t})}),BN,(function(){var e=HN(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,UN(void 0,!0);var n=t[r];switch(e.kind){case"keys":return UN(n.key,!1);case"values":return UN(n.value,!1)}return UN([n.key,n.value],!1)}),!0),yD=function(e){this.entries=[],this.url=null,void 0!==e&&(NN(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===tD(e,0)?cD(e,1):e:DN(e)))};yD.prototype={type:BN,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,s,a,c=this.entries,u=MN(e);if(u)for(r=(t=kN(e,u)).next;!(n=fN(r,t)).done;){if(o=(i=kN(wN(n.value))).next,(s=fN(o,i)).done||(a=fN(o,i)).done||!fN(o,i).done)throw new JN("Expected sequence with length 2");nD(c,{key:DN(s.value),value:DN(a.value)})}else for(var d in e)ON(e,d)&&nD(c,{key:d,value:DN(e[d])})},parseQuery:function(e){if(e)for(var t,r,n=this.entries,i=aD(e,"&"),o=0;o<i.length;)(t=i[o++]).length&&(r=aD(t,"="),nD(n,{key:ED(oD(r)),value:ED(rD(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],nD(r,gD(e.key)+"="+gD(e.value));return rD(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var vD=function(){AN(this,RD);var e=WN(this,new yD(arguments.length>0?arguments[0]:void 0));mN||(this.size=e.entries.length)},RD=vD.prototype;if(SN(RD,{append:function(e,t){var r=GN(this);xN(arguments.length,2),nD(r.entries,{key:DN(e),value:DN(t)}),mN||this.size++,r.updateURL()},delete:function(e){for(var t=GN(this),r=xN(arguments.length,1),n=t.entries,i=DN(e),o=r<2?void 0:arguments[1],s=void 0===o?o:DN(o),a=0;a<n.length;){var c=n[a];c.key!==i||void 0!==s&&c.value!==s?a++:sD(n,a,1)}mN||(this.size=n.length),t.updateURL()},get:function(e){var t=GN(this).entries;xN(arguments.length,1);for(var r=DN(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=GN(this).entries;xN(arguments.length,1);for(var r=DN(e),n=[],i=0;i<t.length;i++)t[i].key===r&&nD(n,t[i].value);return n},has:function(e){for(var t=GN(this).entries,r=xN(arguments.length,1),n=DN(e),i=r<2?void 0:arguments[1],o=void 0===i?i:DN(i),s=0;s<t.length;){var a=t[s++];if(a.key===n&&(void 0===o||a.value===o))return!0}return!1},set:function(e,t){var r=GN(this);xN(arguments.length,2);for(var n,i=r.entries,o=!1,s=DN(e),a=DN(t),c=0;c<i.length;c++)(n=i[c]).key===s&&(o?sD(i,c--,1):(o=!0,n.value=a));o||nD(i,{key:s,value:a}),mN||(this.size=i.length),r.updateURL()},sort:function(){var e=GN(this);VN(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=GN(this).entries,n=IN(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new SD(this,"keys")},values:function(){return new SD(this,"values")},entries:function(){return new SD(this,"entries")}},{enumerable:!0}),TN(RD,FN,RD.entries,{name:"entries"}),TN(RD,"toString",(function(){return GN(this).serialize()}),{enumerable:!0}),mN&&gN(RD,"size",{get:function(){return GN(this).entries.length},configurable:!0,enumerable:!0}),yN(vD,BN),dN({global:!0,constructor:!0,forced:!_N},{URLSearchParams:vD}),!_N&&bN(ZN)){var AD=EN(XN.has),bD=EN(XN.set),OD=function(e){if(NN(e)){var t,r=e.body;if(CN(r)===BN)return t=e.headers?new ZN(e.headers):new ZN,AD(t,"content-type")||bD(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),PN(e,{body:LN(0,DN(r)),headers:LN(0,t)})}return e};if(bN(KN)&&dN({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return KN(e,arguments.length>1?OD(arguments[1]):{})}}),bN(YN)){var ID=function(e){return AN(this,zN),new YN(e,arguments.length>1?OD(arguments[1]):{})};zN.constructor=ID,ID.prototype=zN,dN({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:ID})}}var CD,wD={URLSearchParams:vD,getState:GN},ND=Bo,DD=yo,PD=Go,LD=Eo,kD=eh,MD=Uh,UD=Ho,xD=ca,VD=ts,FD=Object.assign,BD=Object.defineProperty,jD=DD([].concat),WD=!FD||LD((function(){if(ND&&1!==FD({b:1},FD(BD({},"a",{enumerable:!0,get:function(){BD(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!==FD({},e)[r]||kD(FD({},t)).join("")!==n}))?function(e,t){for(var r=xD(e),n=arguments.length,i=1,o=MD.f,s=UD.f;n>i;)for(var a,c=VD(arguments[i++]),u=o?jD(kD(c),o(c)):kD(c),d=u.length,l=0;d>l;)a=u[l++],ND&&!PD(s,c,a)||(r[a]=c[a]);return r}:FD,GD=yo,HD=2147483647,KD=/[^\0-\u007E]/,YD=/[.\u3002\uFF0E\uFF61]/g,ZD="Overflow: input needs wider integers to process",zD=RangeError,XD=GD(YD.exec),JD=Math.floor,QD=String.fromCharCode,qD=GD("".charCodeAt),$D=GD([].join),eP=GD([].push),tP=GD("".replace),rP=GD("".split),nP=GD("".toLowerCase),iP=function(e){return e+22+75*(e<26)},oP=function(e,t,r){var n=0;for(e=r?JD(e/700):e>>1,e+=JD(e/t);e>455;)e=JD(e/35),n+=36;return JD(n+36*e/(e+38))},sP=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=qD(e,r++);if(i>=55296&&i<=56319&&r<n){var o=qD(e,r++);56320==(64512&o)?eP(t,((1023&i)<<10)+(1023&o)+65536):(eP(t,i),r--)}else eP(t,i)}return t}(e);var r,n,i=e.length,o=128,s=0,a=72;for(r=0;r<e.length;r++)(n=e[r])<128&&eP(t,QD(n));var c=t.length,u=c;for(c&&eP(t,"-");u<i;){var d=HD;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>JD((HD-s)/l))throw new zD(ZD);for(s+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++s>HD)throw new zD(ZD);if(n===o){for(var h=s,p=36;;){var f=p<=a?1:p>=a+26?26:p-a;if(h<f)break;var E=h-f,m=36-f;eP(t,QD(iP(f+E%m))),h=JD(E/m),p+=36}eP(t,QD(iP(h))),a=oP(s,l,u===c),s=0,u++}}s++,o++}return $D(t,"")},aP=jc,cP=Bo,uP=cN,dP=Ao,lP=uc,hP=yo,pP=Vh,fP=Bh,EP=Ry,mP=la,_P=WD,TP=lO,gP=Nh,SP=fT.codeAt,yP=function(e){var t,r,n=[],i=rP(tP(nP(e),YD,"."),".");for(t=0;t<i.length;t++)r=i[t],eP(n,XD(KD,r)?"xn--"+sP(r):r);return $D(n,".")},vP=Du,RP=dp,AP=Ly,bP=wD,OP=Op,IP=OP.set,CP=OP.getterFor("URL"),wP=bP.URLSearchParams,NP=bP.getState,DP=dP.URL,PP=dP.TypeError,LP=dP.encodeURIComponent,kP=dP.parseInt,MP=Math.floor,UP=Math.pow,xP=hP("".charAt),VP=hP(/./.exec),FP=hP([].join),BP=hP(1.1.toString),jP=hP([].pop),WP=hP([].push),GP=hP("".replace),HP=hP([].shift),KP=hP("".split),YP=hP("".slice),ZP=hP("".toLowerCase),zP=hP([].unshift),XP="Invalid scheme",JP="Invalid host",QP="Invalid port",qP=/[a-z]/i,$P=/[\d+\-.a-z]/i,eL=/\d/,tL=/^0x/i,rL=/^[0-7]+$/,nL=/^\d+$/,iL=/^[\da-f]+$/i,oL=/[\0\t\n\r #%/:<>?@[\\\]^|]/,sL=/[\0\t\n\r #/:<>?@[\\\]^|]/,aL=/^[\u0000-\u0020]+/,cL=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,uL=/[\t\n\r]/g,dL=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)zP(t,e%256),e=MP(e/256);return FP(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r?n:t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=BP(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},lL={},hL=_P({},lL,{" ":1,'"':1,"#":1,"<":1,">":1}),pL=_P({},hL,{"'":1}),fL=_P({},lL,{" ":1,'"':1,"<":1,">":1,"`":1}),EL=_P({},fL,{"#":1,"?":1,"{":1,"}":1,"^":1}),mL=_P({},EL,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),_L=function(e,t){var r=SP(e,0);return r>=32&&r<127&&!mP(t,e)?e:"'"===e&&mP(t,e)?"%27":LP(e)},TL={ftp:21,file:null,http:80,https:443,ws:80,wss:443},gL=function(e,t){var r;return 2===e.length&&VP(qP,xP(e,0))&&(":"===(r=xP(e,1))||!t&&"|"===r)},SL=function(e){var t;return e.length>1&&gL(YP(e,0,2))&&(2===e.length||"/"===(t=xP(e,2))||"\\"===t||"?"===t||"#"===t)},yL=function(e){return"."===e||"%2e"===ZP(e)},vL={},RL={},AL={},bL={},OL={},IL={},CL={},wL={},NL={},DL={},PL={},LL={},kL={},ML={},UL={},xL={},VL={},FL={},BL={},jL={},WL={},GL=function(e,t,r){var n,i,o,s=vP(e);if(t){if(i=this.parse(s))throw new PP(i);this.searchParams=null}else{if(void 0!==r&&(n=new GL(r,!0)),i=this.parse(s,null,n))throw new PP(i);(o=NP(new wP)).bindURL(this),this.searchParams=o}};GL.prototype={type:"URL",parse:function(e,t,r){var n,i,o,s,a,c=this,u=t||vL,d=0,l="",h=!1,p=!1,f=!1;for(e=vP(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=GP(e,aL,""),e=GP(e,cL,"$1")),e=GP(e,uL,""),n=TP(e);d<=n.length;){switch(i=n[d],u){case vL:if(!i||!VP(qP,i)){if(t)return XP;u=AL;continue}l+=ZP(i),u=RL;break;case RL:if(i&&VP($P,i))l+=ZP(i);else{if(":"!==i){if(t)return XP;l="",u=AL,d=0;continue}if(t&&(c.isSpecial()!==mP(TL,l)||"file"===l&&(c.includesCredentials()||null!==c.port)||"file"===c.scheme&&""===c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&TL[c.scheme]===c.port&&(c.port=null));l="","file"===c.scheme?u=ML:c.isSpecial()&&r&&r.scheme===c.scheme?u=bL:c.isSpecial()?u=wL:"/"===n[d+1]?(u=OL,d++):(c.cannotBeABaseURL=!0,WP(c.path,""),u=BL)}break;case AL:if(!r||r.cannotBeABaseURL&&"#"!==i)return XP;if(r.cannotBeABaseURL&&"#"===i){c.scheme=r.scheme,c.path=gP(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=WL;break}u="file"===r.scheme?ML:IL;continue;case bL:if("/"!==i||"/"!==n[d+1]){u=IL;continue}u=NL,d++;break;case OL:if("/"===i){u=DL;break}u=FL;continue;case IL:if(c.scheme=r.scheme,i===CD)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=gP(r.path),c.query=r.query;else if("/"===i||"\\"===i&&c.isSpecial())u=CL;else if("?"===i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=gP(r.path),c.query="",u=jL;else{if("#"!==i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=gP(r.path),c.path.length&&c.path.length--,u=FL;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=gP(r.path),c.query=r.query,c.fragment="",u=WL}break;case CL:if(!c.isSpecial()||"/"!==i&&"\\"!==i){if("/"!==i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=FL;continue}u=DL}else u=NL;break;case wL:if(u=NL,"/"!==i||"/"!==n[d+1])continue;d++;break;case NL:if("/"!==i&&"\\"!==i){u=DL;continue}break;case DL:if("@"===i){h&&(l="%40"+l),h=!0,o=TP(l);for(var E=0;E<o.length;E++){var m=o[E];if(":"!==m||f){var _=_L(m,mL);f?c.password+=_:c.username+=_}else f=!0}l=""}else if(i===CD||"/"===i||"?"===i||"#"===i||"\\"===i&&c.isSpecial()){if(h&&""===l)return"Invalid authority";d-=TP(l).length+1,l="",u=PL}else l+=i;break;case PL:case LL:if(t&&"file"===c.scheme){u=xL;continue}if(":"!==i||p){if(i===CD||"/"===i||"?"===i||"#"===i||"\\"===i&&c.isSpecial()){if(c.isSpecial()&&""===l)return JP;if(t&&""===l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",u=VL,t)return;continue}"["===i?p=!0:"]"===i&&(p=!1),l+=i}else{if(""===l)return JP;if(t===LL)return;if(s=c.parseHost(l))return s;l="",u=kL}break;case kL:if(!VP(eL,i)){if(i===CD||"/"===i||"?"===i||"#"===i||"\\"===i&&c.isSpecial()||t){if(""!==l){var T=kP(l,10);if(T>65535)return QP;c.port=c.isSpecial()&&T===TL[c.scheme]?null:T,l=""}if(t)return;u=VL;continue}return QP}l+=i;break;case ML:if(c.scheme="file",c.host="","/"===i||"\\"===i)u=UL;else{if(!r||"file"!==r.scheme){u=FL;continue}switch(i){case CD:c.host=r.host,c.path=gP(r.path),c.query=r.query;break;case"?":c.host=r.host,c.path=gP(r.path),c.query="",u=jL;break;case"#":c.host=r.host,c.path=gP(r.path),c.query=r.query,c.fragment="",u=WL;break;default:c.host=r.host,SL(FP(gP(n,d),""))||(c.path=gP(r.path),c.shortenPath()),u=FL;continue}}break;case UL:if("/"===i||"\\"===i){u=xL;break}r&&"file"===r.scheme&&(c.host=r.host,!SL(FP(gP(n,d),""))&&gL(r.path[0],!0)&&WP(c.path,r.path[0])),u=FL;continue;case xL:if(i===CD||"/"===i||"\\"===i||"?"===i||"#"===i){if(!t&&gL(l))u=FL;else if(""===l){if(c.host="",t)return;u=VL}else{if(s=c.parseHost(l))return s;if("localhost"===c.host&&(c.host=""),t)return;l="",u=VL}continue}l+=i;break;case VL:if(c.isSpecial()){if(u=FL,"/"!==i&&"\\"!==i)continue}else if(t||"?"!==i)if(t||"#"!==i){if(i!==CD&&(u=FL,"/"!==i))continue}else c.fragment="",u=WL;else c.query="",u=jL;break;case FL:if(i===CD||"/"===i||"\\"===i&&c.isSpecial()||!t&&("?"===i||"#"===i)){if(".."===(a=ZP(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"===i||"\\"===i&&c.isSpecial()||WP(c.path,"")):yL(l)?"/"===i||"\\"===i&&c.isSpecial()||WP(c.path,""):("file"===c.scheme&&!c.path.length&&gL(l)&&(null!==c.host&&""!==c.host&&(c.host=""),l=xP(l,0)+":"),WP(c.path,l)),l="","file"===c.scheme&&(i===CD||"?"===i||"#"===i))for(;c.path.length>1&&""===c.path[0];)HP(c.path);"?"===i?(c.query="",u=jL):"#"===i&&(c.fragment="",u=WL)}else l+=_L(i,EL);break;case BL:"?"===i?(c.query="",u=jL):"#"===i?(c.fragment="",u=WL):i!==CD&&(c.path[0]+=_L(i,lL));break;case jL:t||"#"!==i?i!==CD&&(c.query+=_L(i,c.isSpecial()?pL:hL)):(c.fragment="",u=WL);break;case WL:i!==CD&&(c.fragment+=_L(i,fL))}d++}},parseHost:function(e){var t,r,n;if("["===xP(e,0)){if("]"!==xP(e,e.length-1))return JP;if(t=function(e){var t,r,n,i,o,s,a,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return xP(e,l)};if(":"===h()){if(":"!==xP(e,1))return;l+=2,d=++u}for(;h();){if(8===u)return;if(":"!==h()){for(t=r=0;r<4&&VP(iL,h());)t=16*t+kP(h(),16),l++,r++;if("."===h()){if(0===r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."===h()&&n<4))return;l++}if(!VP(eL,h()))return;for(;VP(eL,h());){if(o=kP(h(),10),null===i)i=o;else{if(0===i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!==n||u++}if(4!==n)return;break}if(":"===h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(s=u-d,u=7;0!==u&&s>0;)a=c[u],c[u--]=c[d+s-1],c[d+--s]=a;else if(8!==u)return;return c}(YP(e,1,-1)),!t)return JP;this.host=t}else if(this.isSpecial()){if(e=yP(e),VP(oL,e))return JP;if(function(e){var t,r,n=KP(e,".");if(""===n[n.length-1]){if(1===n.length)return!1;n.length--}return t=n[n.length-1],!!VP(nL,t)||!!VP(tL,t)&&(""===(r=YP(t,2))||!!VP(iL,r))}(e)){if(t=function(e){var t,r,n,i,o,s,a,c=KP(e,".");if(c.length&&""===c[c.length-1]&&c.length--,(t=c.length)>4)return null;for(r=[],n=0;n<t;n++){if(""===(i=c[n]))return null;if(o=10,i.length>1&&"0"===xP(i,0)&&(o=VP(tL,i)?16:8,i=YP(i,8===o?1:2)),""===i)s=0;else{if(!VP(10===o?nL:8===o?rL:iL,i))return null;s=kP(i,o)}WP(r,s)}for(n=0;n<t;n++)if(s=r[n],n===t-1){if(s>=UP(256,5-t))return null}else if(s>255)return null;for(a=jP(r),n=0;n<r.length;n++)a+=r[n]*UP(256,3-n);return a}(e),null===t)return JP;this.host=t}else this.host=e}else{if(VP(sL,e))return JP;for(t="",r=TP(e),n=0;n<r.length;n++)t+=_L(r[n],lL);this.host=t}},cannotHaveUsernamePasswordPort:function(){return null===this.host||""===this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return mP(TL,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&gL(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,s=e.path,a=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=dL(i),null!==o&&(u+=":"+o)):"file"===t&&(u+="//"),null===i&&!e.cannotBeABaseURL&&s.length>1&&""===s[0]&&(u+="/."),u+=e.cannotBeABaseURL?s[0]:s.length?"/"+FP(s,"/"):"",null!==a&&(u+="?"+a),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw new PP(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new HL(this.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+dL(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(vP(e)+":",vL)},getUsername:function(){return this.username},setUsername:function(e){var t=TP(vP(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=_L(t[r],mL)}},getPassword:function(){return this.password},setPassword:function(e){var t=TP(vP(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=_L(t[r],mL)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?dL(e):dL(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,PL)},getHostname:function(){var e=this.host;return null===e?"":dL(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,LL)},getPort:function(){var e=this.port;return null===e?"":vP(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=vP(e))?this.port=null:this.parse(e,kL))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+FP(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,VL))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=vP(e))?this.query=null:("?"===xP(e,0)&&(e=YP(e,1)),this.query="",this.parse(e,jL)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=vP(e))?("#"===xP(e,0)&&(e=YP(e,1)),this.fragment="",this.parse(e,WL)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var HL=function(e){var t=EP(this,KL),r=AP(arguments.length,1)>1?arguments[1]:void 0,n=IP(t,new GL(e,!1,r));cP||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},KL=HL.prototype,YL=function(e,t){return{get:function(){return CP(this)[e]()},set:t&&function(e){return CP(this)[t](e)},configurable:!0,enumerable:!0}};if(cP&&(fP(KL,"href",YL("serialize","setHref")),fP(KL,"origin",YL("getOrigin")),fP(KL,"protocol",YL("getProtocol","setProtocol")),fP(KL,"username",YL("getUsername","setUsername")),fP(KL,"password",YL("getPassword","setPassword")),fP(KL,"host",YL("getHost","setHost")),fP(KL,"hostname",YL("getHostname","setHostname")),fP(KL,"port",YL("getPort","setPort")),fP(KL,"pathname",YL("getPathname","setPathname")),fP(KL,"search",YL("getSearch","setSearch")),fP(KL,"searchParams",YL("getSearchParams")),fP(KL,"hash",YL("getHash","setHash"))),pP(KL,"toJSON",(function(){return CP(this).serialize()}),{enumerable:!0}),pP(KL,"toString",(function(){return CP(this).serialize()}),{enumerable:!0}),DP){var ZL=DP.createObjectURL,zL=DP.revokeObjectURL;ZL&&pP(HL,"createObjectURL",lP(ZL,DP)),zL&&pP(HL,"revokeObjectURL",lP(zL,DP))}RP(HL,"URL"),aP({global:!0,constructor:!0,forced:!uP,sham:!cP},{URL:HL});var XL=jc,JL=Eo,QL=Ly,qL=Du,$L=cN,ek=ms("URL"),tk=$L&&JL((function(){ek.canParse()})),rk=JL((function(){return 1!==ek.canParse.length}));XL({target:"URL",stat:!0,forced:!tk||rk},{canParse:function(e){var t=QL(arguments.length,1),r=qL(e),n=t<2||void 0===arguments[1]?void 0:qL(arguments[1]);try{return!!new ek(r,n)}catch(e){return!1}}});var nk=jc,ik=Ly,ok=Du,sk=cN,ak=ms("URL");nk({target:"URL",stat:!0,forced:!sk},{parse:function(e){var t=ik(arguments.length,1),r=ok(e),n=t<2||void 0===arguments[1]?void 0:ok(arguments[1]);try{return new ak(r,n)}catch(e){return null}}});var ck=X(ls.URL);function uk(){const e=new Blob([atob("ZnVuY3Rpb24gdCh0LGUsbil7cmV0dXJuKGU9ZnVuY3Rpb24odCl7dmFyIGU9ZnVuY3Rpb24odCxlKXtpZigib2JqZWN0IiE9dHlwZW9mIHR8fCF0KXJldHVybiB0O3ZhciBuPXRbU3ltYm9sLnRvUHJpbWl0aXZlXTtpZih2b2lkIDAhPT1uKXt2YXIgcj1uLmNhbGwodCxlfHwiZGVmYXVsdCIpO2lmKCJvYmplY3QiIT10eXBlb2YgcilyZXR1cm4gcjt0aHJvdyBuZXcgVHlwZUVycm9yKCJAQHRvUHJpbWl0aXZlIG11c3QgcmV0dXJuIGEgcHJpbWl0aXZlIHZhbHVlLiIpfXJldHVybigic3RyaW5nIj09PWU/U3RyaW5nOk51bWJlcikodCl9KHQsInN0cmluZyIpO3JldHVybiJzeW1ib2wiPT10eXBlb2YgZT9lOmUrIiJ9KGUpKWluIHQ/T2JqZWN0LmRlZmluZVByb3BlcnR5KHQsZSx7dmFsdWU6bixlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMCx3cml0YWJsZTohMH0pOnRbZV09bix0fWZ1bmN0aW9uIGUodCxlKXt2YXIgbj1PYmplY3Qua2V5cyh0KTtpZihPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgcj1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKHQpO2UmJihyPXIuZmlsdGVyKChmdW5jdGlvbihlKXtyZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LGUpLmVudW1lcmFibGV9KSkpLG4ucHVzaC5hcHBseShuLHIpfXJldHVybiBufWNvbnN0IG49InZpZGVvL2gyNjQiLHI9InZpZGVvL2gyNjUiO2Z1bmN0aW9uIGEodCxlLG4pe2xldCByPW5ldyBVaW50OEFycmF5KHQsZSxuKSxhPVtdLG89MDtmb3IoO2EubGVuZ3RoPG47KW8rMzxuJiYwPT09cltvXSYmMD09PXJbbysxXSYmMz09PXJbbysyXSYmKDA9PT1yW28rM118fDE9PT1yW28rM118fDI9PT1yW28rM118fDM9PT1yW28rM10pPyhhLnB1c2gocltvXSxyW28rMV0scltvKzNdKSxvKz00KTooYS5wdXNoKHJbb10pLG8rKyk7cmV0dXJuIG5ldyBVaW50OEFycmF5KGEpfWZ1bmN0aW9uIG8odCxlKXtzd2l0Y2goZSl7Y2FzZSBuOnJldHVybiBmdW5jdGlvbih0KXtjb25zdCBlPW5ldyBEYXRhVmlldyh0LmRhdGEpO2xldCBuPTA7Zm9yKDtuKzQ8dC5kYXRhLmJ5dGVMZW5ndGg7KXtpZigwPT09ZS5nZXRVaW50OChuKzApJiYwPT09ZS5nZXRVaW50OChuKzEpJiYwPT09ZS5nZXRVaW50OChuKzIpJiYxPT09ZS5nZXRVaW50OChuKzMpJiY2PT09ZS5nZXRVaW50OChuKzQpKXtsZXQgcj1uKzYsbz0wLGk9MDtmb3IoOzI1NT09PShpPWUuZ2V0VWludDgocisrKSk7KW8rPTI1NTtvKz1pO2NvbnN0IHM9YSh0LmRhdGEscixvKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkocyl9bisrfXJldHVybiBudWxsfSh0KTtjYXNlIHI6cmV0dXJuIGZ1bmN0aW9uKHQpe2NvbnN0IGU9bmV3IERhdGFWaWV3KHQuZGF0YSk7bGV0IG49MDtmb3IoO24rNTx0LmRhdGEuYnl0ZUxlbmd0aDspe2lmKDA9PT1lLmdldFVpbnQ4KG4rMCkmJjA9PT1lLmdldFVpbnQ4KG4rMSkmJjA9PT1lLmdldFVpbnQ4KG4rMikmJjE9PT1lLmdldFVpbnQ4KG4rMykmJjc4PT09ZS5nZXRVaW50OChuKzQpJiYxPT09ZS5nZXRVaW50OChuKzUpJiYxMDE9PT1lLmdldFVpbnQ4KG4rNikpe2xldCByPW4rNyxvPTAsaT0wO2Zvcig7MjU1PT09KGk9ZS5nZXRVaW50OChyKyspKTspbys9MjU1O28rPWk7Y29uc3Qgcz1hKHQuZGF0YSxyLG8pO3JldHVybiBuZXcgVWludDhBcnJheShzKX1uKyt9cmV0dXJuIG51bGx9KHQpO2RlZmF1bHQ6cmV0dXJuIG51bGx9fWZ1bmN0aW9uIGkodCl7Y29uc3QgZT10Lmxlbmd0aDtsZXQgbj1bXSxyPTA7Zm9yKDtyPGU7KXIrMjxlJiYwPT09dFtyXSYmMD09PXRbcisxXSYmKDA9PT10W3IrMl18fDE9PT10W3IrMl18fDI9PT10W3IrMl18fDM9PT10W3IrMl0pPyhuLnB1c2godFtyXSx0W3IrMV0sMyx0W3IrMl0pLHIrPTMpOihuLnB1c2godFtyXSkscisrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkobil9ZnVuY3Rpb24gcyh0LGUsYSl7c3dpdGNoKGEpe2Nhc2UgbjpyZXR1cm4gZnVuY3Rpb24odCxlKXtjb25zdCBuPWkoZSkscj1uLmxlbmd0aCxhPU1hdGguZmxvb3Ioci8yNTUpLG89ciUyNTUscz1uZXcgVWludDhBcnJheSg2K2ErMStyK3QuYnl0ZUxlbmd0aCk7c1swXT0wLHNbMV09MCxzWzJdPTAsc1szXT0xLHNbNF09NixzWzVdPTEwMTtsZXQgZj0wO2Zvcig7ZjxhOylzWzYrZl09MjU1LGYrKztyZXR1cm4gc1s2K2ZdPW8sZisrLHMuc2V0KG4sNitmKSxzLnNldChuZXcgVWludDhBcnJheSh0KSw2K2Yrcikscy5idWZmZXJ9KHQsZSk7Y2FzZSByOnJldHVybiBmdW5jdGlvbih0LGUpe2NvbnN0IG49aShlKSxyPW4ubGVuZ3RoLGE9TWF0aC5mbG9vcihyLzI1NSksbz1yJTI1NSxzPW5ldyBVaW50OEFycmF5KDcrYSsxK3IrMSt0LmJ5dGVMZW5ndGgpO3NbMF09MCxzWzFdPTAsc1syXT0wLHNbM109MSxzWzRdPTc4LHNbNV09MSxzWzZdPTEwMTtsZXQgZj0wO2Zvcig7ZjxhOylzWzcrZl09MjU1LGYrKztyZXR1cm4gc1s3K2ZdPW8sZisrLHMuc2V0KG4sNytmKSxmKz1yLHNbNytmXT0xMjgsZisrLHMuc2V0KG5ldyBVaW50OEFycmF5KHQpLDcrZikscy5idWZmZXJ9KHQsZSk7ZGVmYXVsdDpyZXR1cm4gbnVsbH19ZnVuY3Rpb24gZih0KXtpZih0Lmxlbmd0aDw1KXJldHVybiIiO2xldCBlPS0xO2ZvcihsZXQgbj0wO248dC5sZW5ndGgtMztuKyspe2lmKDA9PT10W25dJiYwPT09dFtuKzFdJiYxPT09dFtuKzJdKXtlPW47YnJlYWt9aWYobjx0Lmxlbmd0aC00JiYwPT09dFtuXSYmMD09PXRbbisxXSYmMD09PXRbbisyXSYmMT09PXRbbiszXSl7ZT1uO2JyZWFrfX1pZigtMT09PWUpcmV0dXJuIiI7Y29uc3QgYT1lKygwPT09dFtlKzJdPzQ6Myk7aWYoYT49dC5sZW5ndGgpcmV0dXJuIiI7Y29uc3Qgbz10W2FdO2lmKDEyOCZvKXJldHVybiIiO2lmKChvPj4xJjYzKT49MzIpcmV0dXJuIHI7aWYoYSsxPHQubGVuZ3RoKXtpZigwPT0oMjQ4JnRbYSsxXSkpcmV0dXJuIHJ9cmV0dXJuKDMxJm8pPD0zMT9uOiIifWNvbnN0IGw9NzEsdT0xLGM9MixnPTEscD0yO3ZhciBkPWZ1bmN0aW9uKHQpe3JldHVybiB0W3QuQVVESU9fTEVWRUw9MV09IkFVRElPX0xFVkVMIix0W3QuTUVUQURBVEE9Ml09Ik1FVEFEQVRBIix0W3QuQVVESU9fNjRfQklUX1BUUz0zXT0iQVVESU9fNjRfQklUX1BUUyIsdH0oZHx8e30pO2Z1bmN0aW9uIGgodCl7bGV0IGU9YXJndW1lbnRzLmxlbmd0aD4xJiZ2b2lkIDAhPT1hcmd1bWVudHNbMV0mJmFyZ3VtZW50c1sxXTtjb25zdCBuPXQuZ2V0VWludDgoMCk7aWYobiE9PWwpcmV0dXJuO2NvbnN0IHI9dC5nZXRVaW50MTYoMSksYT11K2MrcixvPW5ldyBVaW50OEFycmF5KHQuYnl0ZUxlbmd0aC1hKTtvLnNldChuZXcgVWludDhBcnJheSh0LmJ1ZmZlcixhLHQuYnl0ZUxlbmd0aC1hKSk7Y29uc3QgaT17bTpuLHRsdkxlbjpyLHRsdjpbXSxmcmFtZTpvfTtsZXQgcz11K2M7Zm9yKDtzPGE7KXtjb25zdCBuPXQuZ2V0VWludDgocykscj10LmdldFVpbnQxNihzK2cpLGE9ZytwO2lmKG49PT1kLkFVRElPX0xFVkVMKXtsZXQgbz10LmdldFVpbnQ4KHMrYSk7Zm9yKGxldCBlPTE7ZTxyO2UrKylvPW88PDh8dC5nZXRVaW50OChzK2ErZSk7aS50bHYucHVzaCh7dGFnOm4sbGVuZ3RoOnIsdmFsdWU6ZT8xMjdebz4+MToxMjcmb30pfWVsc2UgaWYobj09PWQuTUVUQURBVEF8fG49PT1kLkFVRElPXzY0X0JJVF9QVFMpe2NvbnN0IGU9bmV3IFVpbnQ4QXJyYXkocik7Zm9yKGxldCBuPTA7bjxyO24rKyllW25dPXQuZ2V0VWludDgocythK24pO2kudGx2LnB1c2goe3RhZzpuLGxlbmd0aDpyLHZhbHVlOmV9KX1zKz1hK3J9cmV0dXJuIGl9c2VsZi5vbnJ0Y3RyYW5zZm9ybT1uPT57Y29uc3Qgcj1uLnRyYW5zZm9ybWVyLGE9W10saT1bXTtsZXQgeT1udWxsO3Iub3B0aW9ucy5wb3J0Lm9ubWVzc2FnZT10PT57dC5kYXRhLnNlaSYmYS5wdXNoKHQuZGF0YS5zZWkpLHQuZGF0YS5tZXRhZGF0YSYmaS5wdXNoKHQuZGF0YS5tZXRhZGF0YSl9LHNlbGYucG9zdE1lc3NhZ2UoInN0YXJ0ZWQiKTtjb25zdCBVPXIucmVhZGFibGUuZ2V0UmVhZGVyKCksYj1yLndyaXRhYmxlLmdldFdyaXRlcigpOyJzZWktcngiPT09ci5vcHRpb25zLm5hbWU/ZnVuY3Rpb24gbihyKXtVLnJlYWQoKS50aGVuKChhPT57aWYoIWEuZG9uZSl7aWYoYS52YWx1ZSBpbnN0YW5jZW9mIFJUQ0VuY29kZWRWaWRlb0ZyYW1lKXtjb25zdCBuPWYobmV3IFVpbnQ4QXJyYXkoYS52YWx1ZS5kYXRhKSksaT1vKGEudmFsdWUsbik7aWYoaSYmci5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3NlaTppfSksIXkpe2NvbnN0IG49YS52YWx1ZS5nZXRNZXRhZGF0YSgpfHx7fTt5PWZ1bmN0aW9uKG4pe2Zvcih2YXIgcj0xO3I8YXJndW1lbnRzLmxlbmd0aDtyKyspe3ZhciBhPW51bGwhPWFyZ3VtZW50c1tyXT9hcmd1bWVudHNbcl06e307ciUyP2UoT2JqZWN0KGEpLCEwKS5mb3JFYWNoKChmdW5jdGlvbihlKXt0KG4sZSxhW2VdKX0pKTpPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycz9PYmplY3QuZGVmaW5lUHJvcGVydGllcyhuLE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKGEpKTplKE9iamVjdChhKSkuZm9yRWFjaCgoZnVuY3Rpb24odCl7T2JqZWN0LmRlZmluZVByb3BlcnR5KG4sdCxPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGEsdCkpfSkpfXJldHVybiBufSh7dHlwZTphLnZhbHVlLnR5cGUscnRwVGltZXN0YW1wOmEudmFsdWUudGltZXN0YW1wLHBheWxvYWRUeXBlOm4ucGF5bG9hZFR5cGV8fDAsc3NyYzpuLnN5bmNocm9uaXphdGlvblNvdXJjZXx8MCxsZW5ndGg6YS52YWx1ZS5kYXRhLmJ5dGVMZW5ndGh9LCJtaW1lVHlwZSJpbiBuP3ttaW1lVHlwZTpuLm1pbWVUeXBlfTp7fSksci5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe2ZpcnN0RnJhbWVJbmZvOnl9KX19Yi53cml0ZShhLnZhbHVlKSxyLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSxuKHIpfX0pKX0ocik6InNlaS10eCI9PT1yLm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KGUpe1UucmVhZCgpLnRoZW4oKG49PntpZighbi5kb25lKXtpZihuLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IHQ9ZihuZXcgVWludDhBcnJheShuLnZhbHVlLmRhdGEpKSxlPWEuc2hpZnQoKTtpZihlKXtjb25zdCByPXMobi52YWx1ZS5kYXRhLGUsdCk7ciYmKG4udmFsdWUuZGF0YT1yKX19Yi53cml0ZShuLnZhbHVlKSxlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSx0KGUpfX0pKX0ocik6ImF1ZGlvLW1ldGFkYXRhLXJ4Ij09PXIub3B0aW9ucy5uYW1lP2Z1bmN0aW9uIHQoZSl7VS5yZWFkKCkudGhlbigobj0+e2lmKCFuLmRvbmUpe2lmKG4udmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkQXVkaW9GcmFtZSl7Y29uc3QgdD1uZXcgRGF0YVZpZXcobi52YWx1ZS5kYXRhKSxyPXQuZ2V0VWludDgoMCk7bGV0IGE7aWYoMCE9KDEyOCZyKSYmNzEhPT1yKXtjb25zdCBlPWZ1bmN0aW9uKHQpe2lmKHQuYnl0ZUxlbmd0aDw9MClyZXR1cm5bXTtjb25zdCBlPVtdO2xldCBuPTA7Zm9yKDtuPHQuYnl0ZUxlbmd0aDspe2NvbnN0IHI9KDEyOCZ0LmdldFVpbnQ4KG4pKT4+NyxhPTEyNyZ0LmdldFVpbnQ4KG4pO2lmKCEociYmbis0PD10LmJ5dGVMZW5ndGgpKXtuKys7YnJlYWt9e2NvbnN0IHI9dC5nZXRVaW50MzIobiwhMSksbz0oMTY3NzYxOTImcik+PjEwLGk9MTAyMyZyO2UucHVzaCh7cHQ6YSx0c19vZmZzZXQ6byxsZW5ndGg6aSxkYXRhOm5ldyBVaW50OEFycmF5fSksbis9NH19bGV0IHI9dC5ieXRlTGVuZ3RoLW47Zm9yKGNvbnN0IGEgb2YgZSl7aWYoYS5sZW5ndGg+cilyZXR1cm4gY29uc29sZS53YXJuKCJCcm9rZW4gcmVkIHBheWxvYWQiKSxbXTthLmxlbmd0aD4wJiYoYS5kYXRhPW5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHQuYnl0ZU9mZnNldCtuLGEubGVuZ3RoKSxuKz1hLmxlbmd0aCxyLT1hLmxlbmd0aCl9aWYocj4wKXtjb25zdCBhPXtwdDplLmxlbmd0aD4wP2VbZS5sZW5ndGgtMV0ucHQ6MCx0c19vZmZzZXQ6MCxsZW5ndGg6cixkYXRhOm5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHQuYnl0ZU9mZnNldCtuLHIpfTtlLnB1c2goYSl9cmV0dXJuIGV9KHQpO2lmKGUubGVuZ3RoPjApe2NvbnN0IHQ9ZnVuY3Rpb24odCl7bGV0IGU9MDtmb3IobGV0IG49MDtuPHQubGVuZ3RoO24rKyllKz1uPHQubGVuZ3RoLTE/NDoxLGUrPXRbbl0ubGVuZ3RoO2NvbnN0IG49bmV3IFVpbnQ4QXJyYXkoZSk7bGV0IHI9MDtmb3IobGV0IGU9MDtlPHQubGVuZ3RoO2UrKylpZihlPHQubGVuZ3RoLTEpe2NvbnN0IGE9KDIxNDc0ODM2NDh8KDEyNyZ0W2VdLnB0KTw8MjR8KDI2MjE0MyZ0W2VdLnRzX29mZnNldCk8PDEwfDEwMjMmdFtlXS5sZW5ndGgpPj4+MDtuW3IrK109YT4+MjQmMjU1LG5bcisrXT1hPj4xNiYyNTUsbltyKytdPWE+PjgmMjU1LG5bcisrXT0yNTUmYX1lbHNlIG5bcisrXT0xMjcmdFtlXS5wdDtmb3IoY29uc3QgZSBvZiB0KW4uc2V0KGUuZGF0YSxyKSxyKz1lLmxlbmd0aDtyZXR1cm4gbn0oZS5tYXAoKHQ9Pntjb25zdCBlPW5ldyBVaW50OEFycmF5KHQubGVuZ3RoKTtlLnNldCh0LmRhdGEpO2NvbnN0IG49aChuZXcgRGF0YVZpZXcoZS5idWZmZXIpKTtyZXR1cm4gbnVsbCE9biYmbi5mcmFtZSYmKHQuZGF0YT1udWxsPT1uP3ZvaWQgMDpuLmZyYW1lKSxhPW4sdH0pKSk7bi52YWx1ZS5kYXRhPXQuYnVmZmVyfX1lbHNlIGE9aCh0KSxhJiYobi52YWx1ZS5kYXRhPWEuZnJhbWUuYnVmZmVyKTtpZihhKXtsZXQgdD1hLnRsdi5maW5kKCh0PT50LnRhZz09PWQuTUVUQURBVEEpKTtpZih0JiZ0LnZhbHVlIGluc3RhbmNlb2YgVWludDhBcnJheSYmZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe21ldGFkYXRhOnQudmFsdWV9KSx0PWEudGx2LmZpbmQoKHQ9PnQudGFnPT09ZC5BVURJT182NF9CSVRfUFRTKSksdCYmdC52YWx1ZSBpbnN0YW5jZW9mIFVpbnQ4QXJyYXkmJjg9PXQudmFsdWUubGVuZ3RoKXtjb25zdCBuPW5ldyBEYXRhVmlldyh0LnZhbHVlLmJ1ZmZlcikuZ2V0QmlnVWludDY0KDAsITApO3QmJnQudmFsdWUgaW5zdGFuY2VvZiBVaW50OEFycmF5JiZlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7cHRzOm59KX19fWIud3JpdGUobi52YWx1ZSksZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3RyYW5zZm9ybWVkOiEwfSksdChlKX19KSl9KHIpOiJhdWRpby1tZXRhZGF0YS10eCI9PT1yLm9wdGlvbnMubmFtZSYmZnVuY3Rpb24gdChlKXtVLnJlYWQoKS50aGVuKChuPT57aWYoIW4uZG9uZSl7aWYoZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe2dldE1ldGFkYXRhOiEwfSksbi52YWx1ZSBpbnN0YW5jZW9mIFJUQ0VuY29kZWRBdWRpb0ZyYW1lKXtjb25zdCB0PWkuc2hpZnQoKTt0JiYobi52YWx1ZS5kYXRhPWZ1bmN0aW9uKHQsZSxuKXtjb25zdCByPW4uYnl0ZUxlbmd0aCxhPXIrZytwLG89dStjK2EsaT1uZXcgQXJyYXlCdWZmZXIodC5ieXRlTGVuZ3RoK28pLHM9bmV3IERhdGFWaWV3KGkpO3Muc2V0VWludDgoMCxsKSxzLnNldFVpbnQxNigxLGEpLHMuc2V0VWludDgoMyxlKSxzLnNldFVpbnQxNig0LHIpO2ZvcihsZXQgdD0wO3Q8cjt0Kyspcy5zZXRVaW50OCg2K3Qsblt0XSk7Y29uc3QgZj1uZXcgVWludDhBcnJheShzLmJ1ZmZlcik7cmV0dXJuIGYuc2V0KG5ldyBVaW50OEFycmF5KHQpLG8pLGYuYnVmZmVyfShuLnZhbHVlLmRhdGEsZC5BVURJT182NF9CSVRfUFRTLHQpKX1iLndyaXRlKG4udmFsdWUpLGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQoZSl9fSkpfShyKX0sc2VsZi5wb3N0TWVzc2FnZSgicmVnaXN0ZXJlZCIpOwo=")],{type:"text/javascript"});return setTimeout((()=>ck.revokeObjectURL(e)),0),new Worker(ck.createObjectURL(e))}const dk=71,lk=1,hk=2,pk=1,fk=2;var Ek=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}(Ek||{});function mk(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=e.getUint8(0);if(r!==dk)return;const n=e.getUint16(1),i=lk+hk+n,o=new Uint8Array(e.byteLength-i);o.set(new Uint8Array(e.buffer,i,e.byteLength-i));const s={m:r,tlvLen:n,tlv:[],frame:o};let a=lk+hk;for(;a<i;){const r=e.getUint8(a),n=e.getUint16(a+pk),i=pk+fk;if(r===Ek.AUDIO_LEVEL){let o=e.getUint8(a+i);for(let t=1;t<n;t++)o=o<<8|e.getUint8(a+i+t);s.tlv.push({tag:r,length:n,value:t?127^o>>1:127&o})}else if(r===Ek.METADATA||r===Ek.AUDIO_64_BIT_PTS){const t=new Uint8Array(n);for(let r=0;r<n;r++)t[r]=e.getUint8(a+i+r);s.tlv.push({tag:r,length:n,value:t})}a+=i+n}return s}const _k=new Map;function Tk(e,t){const r=t.chunk,n=t.controller,i=Ek.METADATA;r.data=function(e,t,r){const n=r.byteLength,i=n+pk+fk,o=lk+hk+i,s=new ArrayBuffer(e.byteLength+o),a=new DataView(s);a.setUint8(0,dk),a.setUint16(1,i),a.setUint8(3,t),a.setUint16(4,n);for(let e=0;e<n;e++)a.setUint8(6+e,r[e]);const c=new Uint8Array(a.buffer);return c.set(new Uint8Array(e),o),c.buffer}(r.data,i,e),n.enqueue(r)}var gk=X(yg);const Sk=127,yk=1e-10,vk=139/13;const Rk=new Map;function Ak(e,t,r){const n="".concat(e,"-").concat(t,"-").concat(r);let i=0;if(Rk.has(n))i=Rk.get(n);else{const o=.5;i=Math.log(function(e,t){const r=e-t;t<r&&(t=r);let n=1;for(let r=e,i=1;r>t;r--,i++)n=n*r/i;return n}(t,e))+e*Math.log(o)+(t-e)*Math.log(1-o)-Math.log(r)+r*e,Rk.set(n,i)}return i<yk&&(i=yk),i}function bk(e,t,r){const n=t.length,i=e.length/n;let o=!1;for(let s=0,a=0;s<n;s++){let n=0;for(let t=a+i;a<t;a++)e[a]>r&&n++;t[s]!==n&&(t[s]=n,o=!0)}return o}window.cache=Rk;let Ok=0;class Ik{constructor(e){IT(this,"id",void 0),IT(this,"immediates",[]),IT(this,"lastNonSilence",-1),IT(this,"immediateSpeechActivityScore",yk),IT(this,"lastLevelChangedTime",Date.now()),IT(this,"levels",[]),IT(this,"longs",[]),IT(this,"longSpeechActivityScore",yk),IT(this,"mediums",[]),IT(this,"mediumSpeechActivityScore",yk),IT(this,"minLevel",0),IT(this,"nextMinLevel",0),IT(this,"nextMinLevelWindowLength",0),IT(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+vk;let n=!1;for(let i=0;i<e.length;++i){let o=t[i];o<r&&(o=0);const s=Math.floor(o/vk);e[i]!==s&&(e[i]=s,n=!0)}return n}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>yk&&(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+vk?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){IT(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){IT(this,"isDominant",void 0),IT(this,"energyRanking",void 0),IT(this,"energyScore",void 0),this.isDominant=e,this.energyRanking=t,this.energyScore=r}}class Nk extends An{constructor(e){super(),IT(this,"dominantId",null),IT(this,"lastDecisionTime",0),IT(this,"lastLevelChangedTime",0),IT(this,"lastLevelIdleTime",0),IT(this,"relativeSpeechActivities",[]),IT(this,"speakers",new Map),IT(this,"enableSilence",!1),IT(this,"timeoutToSilenceInterval",0),IT(this,"decisionMaker",null),IT(this,"loudest",[]),IT(this,"numLoudestToTrack",3),IT(this,"energyExpireTimeMs",250),IT(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(),n=this.getOrCreateSpeaker(e);this.lastLevelChangedTime<r&&(this.lastLevelChangedTime=r,this.maybeStartDecisionMaker());const i=n.levelChanged(t,r);return this.updateLoudestList(n,i,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 n=e.id===this.dominantId;if(t<0){let t=0;for(;t<this.loudest.length&&this.loudest[t]!==e;)++t;return new wk(n,t,e.energyScore)}if(e.energyScore=Math.floor((this.energyAlphaPct*t+(100-this.energyAlphaPct)*e.energyScore+50)/100),0===this.numLoudestToTrack)return new wk(n,0,e.energyScore);const i=r-this.energyExpireTimeMs;let o=0;for(;o<this.loudest.length;){const t=this.loudest[o];if(t.getLastLevelChangedTime()<i&&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(n,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 n=this.speakers.size;let i=null;if(0===n)i=null;else if(1===n){var o;const t=LO(o=this.speakers).call(o).next().value;if(this.enableSilence&&t){i=t.id,t.evaluateSpeechActivityScores(e);e-t.lastNonSilence>this.timeoutToSilenceInterval&&(i=null)}}else{let t=null==this.dominantId?null:this.speakers.get(this.dominantId);if(null==t){const e=this.speakers.entries().next();e.value&&(i=e.value[0],t=e.value[1])}else i=t.id;null!=t&&t.evaluateSpeechActivityScores(e);const r=this.relativeSpeechActivities;let n=2;for(const o of this.speakers.entries()){const s=EO(o,2),a=s[0],c=s[1];if(c===t)continue;c.evaluateSpeechActivityScores(e);for(let e=0;e<r.length;++e){const n=null==t?yk:t.getSpeechActivityScore(e);r[e]=Math.log(c.getSpeechActivityScore(e)/n)}const u=r[0],d=r[1],l=r[2];u>3&&d>2&&l>0&&d>n&&(n=d,i=a)}if(this.enableSilence&&null!=t&&i===t.id){e-t.lastNonSilence>this.timeoutToSilenceInterval&&(i=null)}}null==i&&!this.enableSilence||i===this.dominantId||(t=this.dominantId,this.dominantId=i,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 n=300-(e-this.lastDecisionTime);return n<=0&&(this.lastDecisionTime=e,this.makeDecision(e),n=300-(Date.now()-e)),n>0&&r>n&&(r=n),r}timeoutIdleLevels(e){const t=[];for(const n of LO(r=this.speakers).call(r)){var r;const i=e-n.getLastLevelChangedTime();36e5<i&&(null==this.dominantId||n.id!==this.dominantId)?t.push(n.id):300<i&&n.levelTimedOut()}t.forEach((e=>this.speakers.delete(e)))}}const Dk=new Map;let Pk=null,Lk=null;const kk=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),Pk||(Pk=new Nk(yi("TOPN_SILENCE_THRESHOLD")||500),Pk.on("ActiveSpeakerChanged",(e=>{null!=e&&(Lk=e)}))),Pk.addSpeakers([t]),t}(e)),Dk.size<=kk)return{selected:!0,speaker:r};if(!Pk)throw new Error("no active speaker detector");Pk.levelChanged(r.id,t),Mk=Pk.loudest.map((e=>e.id)),Lk&&!Yu(Mk).call(Mk,Lk)&&Mk.length>=kk&&Mk.pop();return{selected:Yu(Mk).call(Mk,r.id)||r.id===Lk,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){IT(this,"id",void 0),IT(this,"track",void 0),IT(this,"score",0),IT(this,"active",!0),IT(this,"muted",!1),IT(this,"timer",0),IT(this,"actives",0),IT(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 t=function(){const e=[],t=[];return Array.from(LO(Fk).call(Fk)).forEach((r=>{r.active?e.push(r):t.push(r)})),{actives:e,inactives:t}}(),r=t.actives,n=t.inactives;if(r.length>3){let e;r.forEach((t=>{(!e||e.score>t.score)&&(e=t)})),e&&e.setActive(!1)}if(r.length<3&&n.length>0){let t;n.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(LO(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(LO(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 Wk;function Gk(e,t,r){const n=Fk.get(e)||new jk(e,t);return n.score=r,Fk.set(e,n),function(e){if(Bk.set(e,!0),!Wk)return void(Wk=Date.now());const t=Date.now();t-Wk>1e3&&(Bk.get(e)?Bk.set(e,!1):(Hk(e),Bk.delete(e)),Wk=t)}(e),n}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,n){const i=new DataView(e.data),o=i.getUint8(0);let s;if(0!=(128&o)&&71!==o){const t=function(e){if(e.byteLength<=0)return[];const t=[];let r=0;for(;r<e.byteLength;){const n=(128&e.getUint8(r))>>7,i=127&e.getUint8(r);if(!(n&&r+4<=e.byteLength)){r++;break}{const n=e.getUint32(r,!1),o=(16776192&n)>>10,s=1023&n;t.push({pt:i,ts_offset:o,length:s,data:new Uint8Array}),r+=4}}let n=e.byteLength-r;for(const i of t){if(i.length>n)return console.warn("Broken red payload"),[];i.length>0&&(i.data=new Uint8Array(e.buffer,e.byteOffset+r,i.length),r+=i.length,n-=i.length)}if(n>0){const i={pt:t.length>0?t[t.length-1].pt:0,ts_offset:0,length:n,data:new Uint8Array(e.buffer,e.byteOffset+r,n)};t.push(i)}return t}(i);if(t.length>0){const r=function(e){let t=0;for(let r=0;r<e.length;r++)t+=r<e.length-1?4:1,t+=e[r].length;const r=new Uint8Array(t);let n=0;for(let t=0;t<e.length;t++)if(t<e.length-1){const i=(2147483648|(127&e[t].pt)<<24|(262143&e[t].ts_offset)<<10|1023&e[t].length)>>>0;r[n++]=i>>24&255,r[n++]=i>>16&255,r[n++]=i>>8&255,r[n++]=255&i}else r[n++]=127&e[t].pt;for(const t of e)r.set(t.data,n),n+=t.length;return r}(t.map((e=>{const t=new Uint8Array(e.length);t.set(e.data);const r=mk(new DataView(t.buffer));return null!=r&&r.frame&&(e.data=null==r?void 0:r.frame),s=r,e})));e.data=r.buffer}}else s=mk(i),s&&(e.data=s.frame.buffer);if(t.enqueue(e),!s)return;const a=s.tlv.find((e=>e.tag===Ek.METADATA));a&&r&&a.value instanceof Uint8Array&&r(a.value);const c=s.tlv.find((e=>e.tag===Ek.AUDIO_64_BIT_PTS));if(c&&n&&c.value instanceof Uint8Array&&8==c.value.length){n(new DataView(c.value.buffer).getBigUint64(0,!0))}}const zk="video/h264",Xk="video/h265";function Jk(e,t,r){let n=new Uint8Array(e,t,r),i=[],o=0;for(;i.length<r;)o+3<r&&0===n[o]&&0===n[o+1]&&3===n[o+2]&&(0===n[o+3]||1===n[o+3]||2===n[o+3]||3===n[o+3])?(i.push(n[o],n[o+1],n[o+3]),o+=4):(i.push(n[o]),o++);return new Uint8Array(i)}function Qk(e,t){switch(t){case zk:return function(e){const t=new DataView(e.data);let r=0;for(;r+4<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&6===t.getUint8(r+4)){let n=r+6,i=0,o=0;for(;255===(o=t.getUint8(n++));)i+=255;i+=o;const s=Jk(e.data,n,i);return new Uint8Array(s)}r++}return null}(e);case Xk:return function(e){const t=new DataView(e.data);let r=0;for(;r+5<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&78===t.getUint8(r+4)&&1===t.getUint8(r+5)&&101===t.getUint8(r+6)){let n=r+7,i=0,o=0;for(;255===(o=t.getUint8(n++));)i+=255;i+=o;const s=Jk(e.data,n,i);return new Uint8Array(s)}r++}return null}(e);default:return null}}function qk(e){const t=e.length;let r=[],n=0;for(;n<t;)n+2<t&&0===e[n]&&0===e[n+1]&&(0===e[n+2]||1===e[n+2]||2===e[n+2]||3===e[n+2])?(r.push(e[n],e[n+1],3,e[n+2]),n+=3):(r.push(e[n]),n++);return new Uint8Array(r)}function $k(e,t,r){switch(r){case zk:return function(e,t){const r=qk(t),n=r.length,i=Math.floor(n/255),o=n%255,s=new Uint8Array(6+i+1+n+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<i;)s[6+a]=255,a++;return s[6+a]=o,a++,s.set(r,6+a),s.set(new Uint8Array(e),6+a+n),s.buffer}(e,t);case Xk:return function(e,t){const r=qk(t),n=r.length,i=Math.floor(n/255),o=n%255,s=new Uint8Array(7+i+1+n+1+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=78,s[5]=1,s[6]=101;let a=0;for(;a<i;)s[7+a]=255,a++;return s[7+a]=o,a++,s.set(r,7+a),a+=n,s[7+a]=128,a++,s.set(new Uint8Array(e),7+a),s.buffer}(e,t);default:return null}}function eM(e){if(e.length<5)return"";let t=-1;for(let r=0;r<e.length-3;r++){if(0===e[r]&&0===e[r+1]&&1===e[r+2]){t=r;break}if(r<e.length-4&&0===e[r]&&0===e[r+1]&&0===e[r+2]&&1===e[r+3]){t=r;break}}if(-1===t)return"";const r=t+(0===e[t+2]?4:3);if(r>=e.length)return"";const n=e[r];if(128&n)return"";if((n>>1&63)>=32)return Xk;if(r+1<e.length){if(0==(248&e[r+1]))return Xk}return(31&n)<=31?zk:""}const tM=new Map;function rM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const nM=new Map;so(),e.AUDIO_CONTEXT_EVENT=fo,e.AUDIO_ENCODER_CONFIG_SETTINGS=nd,e.AUDIO_TRACK_EVENT=vd,e.AgoraRTCPlayer=jC,e.AudioProcessorContext=FO,e.AudioProcessorDestination=VO,e.AudioSourceEvents=yd,e.BufferSourceAudioTrack=PC,e.CameraVideoTrack=ww,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=Rd,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=Ad,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=bd,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=Od,e.DataChannel=qw,e.DataChannelEvents=Ld,e.DeviceManager=Ub,e.DeviceManagerEvent=Nd,e.DeviceManagerState=wd,e.LocalAudioTrack=NC,e.LocalDataChannel=class extends qw{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=cb,e.LocalTrackEvents=Td,e.LocalVideoTrack=Cw,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=Dd,e.MicrophoneAudioTrack=DC,e.MixingAudioTrack=LC,e.PROCESSOR_CONTEXT_EVENTS=Cd,e.PROCESSOR_DESTINATION_EVENTS=Id,e.RemoteAudioTrack=Jw,e.RemoteDataChannel=class extends qw{constructor(e){super(e),IT(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(yi("SHOW_DATASTREAM2_LOG")&&Vi.debug("invalid datachannel id: ".concat(r," !== ").concat(this.id)));let n=e.data.slice(this._dataStreamPacketHeader.byteLength);n=this._dataStreamPacketHandler.deserialize(n),this.emit(Ld.MESSAGE,n)}}_updateDataChannelConfig(e){this._config=e}_updateOriginDataChannel(e){super._updateOriginDataChannel(e),this._bandRemoteDataChannelEvents()}_close(){this._originDataChannel&&(this._originDataChannel.removeEventListener("message",this._messageListener),super._close())}_bandRemoteDataChannelEvents(){this._originDataChannel&&this._originDataChannel.addEventListener("message",this._messageListener)}},e.RemoteStreamFallbackType=md,e.RemoteStreamType=Ed,e.RemoteTrack=zw,e.RemoteTrackEvents=gd,e.RemoteVideoTrack=Xw,e.SAFARI_GLOBAL_GUM_LOCK=Db,e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=qu,e.SUPPORT_SVC_CONFIG_LIST=$u,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=Qu,e.StreamType=fd,e.Track=ab,e.TrackEvents=_d,e.TrackHint=pd,e.TrackInternalEvent=hd,e.TrackMediaType=Sd,e.VideoPlayer=FC,e.VideoProcessorContext=xO,e.VideoProcessorDestination=UO,e.VideoState=Pd,e.__TRACK_LIST__=od,e.addTrack=sd,e.audioContextState=pb,e.audioElementPlayCenter=RO,e.audioTimerLoop=function(e,t){let r=!1;const n=1/t;if(yi("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*n)}else{const t=mb();let i=t.createGain();i.gain.value=0,i.connect(t.destination);const o=()=>{if(r)return void(i=null);const s=t.createOscillator();s.onended=o,s.connect(i),s.start(0),s.stop(t.currentTime+n),e(t.currentTime)};o()}return()=>{r=!0}},e.autoPlayGestureEventEmitter=_O,e.blob2Uint8Array=BI,e.checkMediaStreamTrackResolution=WO,e.checkTrackState=AO,e.createBufferSourceAudioTrack=async function(e){var t;const r=e.cacheOnlineFile,n=e.encoderConfig;let i=e.source;const o={source:i instanceof AudioBuffer?"AudioBuffer":i instanceof File?null!==(t=File.name)&&void 0!==t?t:"File":i,cacheOnlineFile:r,encoderConfig:n},s=Xn(8,"track-buf-"),a=io.reportApiInvoke(null,{id:s,tag:wn.TRACER,name:Cn.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(yi("DISABLE_WEBAUDIO"))throw new fn(pn.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");Vi.info("start create buffer source audio track with config",JSON.stringify(o),"trackId",s);const c=i;if(!(i instanceof AudioBuffer))try{i=await async function(e,t){let r=null;if("string"==typeof e){const t=MC.get(e);if(t)return Vi.debug("use cached audio resource: ",e),t;try{r=(await ci((()=>Dr.get(e,{responseType:"arraybuffer"})),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new fn(pn.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new sb(((t,r)=>{const n=new FileReader;n.onload=e=>{e.target?t(e.target.result):r(new fn(pn.READ_LOCAL_AUDIO_FILE_ERROR))},n.onerror=()=>{r(new fn(pn.READ_LOCAL_AUDIO_FILE_ERROR))},n.readAsArrayBuffer(e)}));r=await t}const n=await gb(r);return"string"==typeof e&&t&&MC.set(e,n),n}(i,r)}catch(e){return a.onError(e),e.throw(Vi)}const u=new kC(i),d=new PC(c,u,n?id(n):{},s);return Vi.info("create buffer source audio track success, trackId:",s),a.onSuccess(d.getTrackId()),d},e.createCameraVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=yi("CAMERA_CAPTURE_CONFIG"),r=Xn(8,"track-cam-"),n=io.reportApiInvoke(null,{id:r,tag:wn.TRACER,name:Cn.CREATE_CAM_VIDEO_TRACK,options:[Dw({},e),t]});t&&(e.encoderConfig=t);const i=GO(e);let o=null;Vi.info("start create camera video track with config",JSON.stringify(e),"trackId",r);try{o=(await Pb({video:i},r)).getVideoTracks()[0]||null}catch(e){throw n.onError(e),e}if(!o){const e=new fn(pn.UNEXPECTED_ERROR,"can not find track in media stream");return n.onError(e),e.throw(Vi)}if(e.optimizationMode&&Pw(r,o,e,ed(e.encoderConfig)),yi("USE_STANDARD_BITRATE_DEFAULT")){const t=ed(e.encoderConfig);e.encoderConfig=t,delete t.bitrateMax,delete t.bitrateMin}const s=new ww(o,e,i,e.scalabiltyMode?rd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,r);return n.onSuccess(s.getTrackId()),Vi.info("create camera video success, trackId:",r),s},e.createCustomAudioTrack=function(e){const t=Xn(8,"track-cus-"),r=io.reportApiInvoke(null,{id:t,tag:wn.TRACER,name:Cn.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),n=new NC(e.mediaStreamTrack,e.encoderConfig?id(e.encoderConfig):{},t,!1);return Vi.info("create custom audio track success with config",e,"trackId",n.getTrackId()),r.onSuccess(n.getTrackId()),n},e.createCustomVideoTrack=function(e){const t=Xn(8,"track-cus-"),r=io.reportApiInvoke(null,{id:t,tag:wn.TRACER,name:Cn.CREATE_CUSTOM_VIDEO_TRACK,options:[e]});yi("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin);const n=new Cw(e.mediaStreamTrack,{width:e.width,height:e.height,frameRate:e.frameRate,bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin,minDownscaleWidth:e.minDownscaleWidth,minDownscaleHeight:e.minDownscaleHeight},e.scalabiltyMode?rd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,t,[pd.CUSTOM_TRACK]);return r.onSuccess(n.getTrackId()),Vi.info("create custom video track success with config",e,"trackId",n.getTrackId()),n},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=yi("CAMERA_CAPTURE_CONFIG"),n=Xn(8,"track-mic-"),i=Xn(8,"track-cam-"),o=io.reportApiInvoke(null,{id:"".concat(n,"-").concat(i),tag:wn.TRACER,name:Cn.CREATE_MIC_AND_CAM_TRACKS,options:[e,t,r]});r&&(t.encoderConfig=r);const s=GO(t),a=ZO(e);let c=null,u=null;Vi.info("start create camera video track(".concat(i,") and microphone audio track(").concat(n,") with config, audio: ").concat(JSON.stringify(e),", video: ").concat(JSON.stringify(t)));try{const e=await Pb({audio:a,video:s},"".concat(n,"-").concat(i));c=e.getAudioTracks()[0],u=e.getVideoTracks()[0]}catch(e){throw o.onError(e),e}if(!c||!u){const e=new fn(pn.UNEXPECTED_ERROR,"can not find tracks in media stream");return o.onError(e),e.throw(Vi)}if(t.optimizationMode&&Pw(i,u,t,ed(t.encoderConfig)),yi("USE_STANDARD_BITRATE_DEFAULT")){const e=ed(t.encoderConfig);t.encoderConfig=e,delete e.bitrateMax,delete e.bitrateMin}const d=new DC(c,e,a,n),l=new ww(u,t,s,t.scalabiltyMode?rd(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,i);return o.onSuccess([d.getTrackId(),l.getTrackId()]),Vi.info("create camera video track(".concat(i,") and microphone audio track(").concat(n,") success")),[d,l]},e.createMicrophoneAudioTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Xn(8,"track-mic-"),r=io.reportApiInvoke(null,{id:t,tag:wn.TRACER,name:Cn.CREATE_MIC_AUDIO_TRACK,options:[e]}),n=ZO(e);let i=null;Vi.info("start create microphone audio track with config",JSON.stringify(e),"trackId",t);try{i=(await Pb({audio:n},t)).getAudioTracks()[0]||null}catch(e){throw r.onError(e),e}if(!i){const e=new fn(pn.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(Vi)}const o=new DC(i,e,n,t);return r.onSuccess(o.getTrackId()),Vi.info("create microphone audio track success, trackId:",t),o},e.createMixingAudioTrack=function(e){const t=new LC;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?YO(t):void 0;r&&(t="auto");const n=Xn(8,"track-scr-v-"),i=io.reportApiInvoke(null,{id:n,tag:wn.TRACER,name:Cn.CREATE_SCREEN_VIDEO_TRACK,options:[Dw({},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=HO(e);let s=null,a=null;const c=ao();if(!c.supportShareAudio&&"enable"===t){const e=new fn(pn.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return i.onError(e),e.throw(Vi)}Vi.info("start create screen video track with config",e,"withAudio",t,"trackId",n);const u=c.supportShareAudio&&"disable"!==t;try{const e=await Pb({screen:o,screenAudio:u?r||!0:void 0},n);s=e.getVideoTracks()[0]||null,a=e.getAudioTracks()[0]||null}catch(e){throw i.onError(e),e}if(!s){const e=new fn(pn.UNEXPECTED_ERROR,"can not find track in media stream");return i.onError(e),e.throw(Vi)}if(!a&&"enable"===t){s&&s.stop();const e=new fn(pn.SHARE_AUDIO_NOT_ALLOWED);return i.onError(e),e.throw(Vi)}if(e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode){Pw(n,s,e,e.encoderConfig&&td(e.encoderConfig)||void 0),e.encoderConfig&&"string"!=typeof e.encoderConfig&&(e.encoderConfig.bitrateMin=e.encoderConfig.bitrateMax)}const d=new Cw(s,e.encoderConfig?td(e.encoderConfig):{},e.scalabiltyMode?rd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,n,[pd.SCREEN_TRACK]);if(!a)return i.onSuccess(d.getTrackId()),Vi.info("create screen video track success","video:",d.getTrackId()),d;const l=new NC(a,void 0,Xn(8,"track-scr-a-"),!1);return i.onSuccess([d.getTrackId(),l.getTrackId()]),Vi.info("create screen video track success","video:",d.getTrackId(),"audio:",l.getTrackId()),[d,l]},e.decodeAudioData=gb,e.detectSupportAudioElementSetSinkId=co,e.detectSupportAutCC=function(){return!!yi("FORCE_ENABLE_AUT_CC")||!uo()&&(!!yi("ENABLE_AUT_CC")||void 0)},e.detectSupportAutCCFeedback=function(){return!!yi("FORCE_ENABLE_AUT_CC")||!uo()&&(!!yi("ENABLE_AUT_FEEDBACK")||void 0)},e.detectSupportInstantVideo=function(e){return yi("ENABLE_INSTANT_VIDEO")?yi("ENABLE_INSTANT_VIDEO"):!(null==e||!e.autoSubscribe||yi("FORCE_DISABLE_AUTO_SUB"))},e.detectSupportPrePc=function(e){return!uo()&&!yi("USE_NEW_TOKEN")&&(!!yi("ENABLE_PREALLOC_PC")||!(null==e||!e.autoSubscribe||yi("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportPreSub=function(e){return!(Kr()||function(e){const t=xr();return!(t.name!==Lr.CHROME||!t.osVersion)&&Number(t.version)<e}(87)||uo())&&(!!yi("ENABLE_PRE_SUB")||!(null==e||!e.autoSubscribe||yi("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportRestrictOwnAudio=po,e.detectSupportSDPEndpoint=function(){return yi("ENABLE_JOIN_V4")},e.detectSupportSuppressLocalAudioPlayback=ho,e.deviceManager=xb,e.emptyImage2TypedArray=FI,e.frameData2CryptoBuffer=async(e,t,r)=>await VI(e.buffer,t,r),e.getAudioContext=mb,e.getAudioEncoderConfiguration=id,e.getBitrateConstrainRange=UI,e.getBitrateFromResAndFps=xI,e.getCompatibility=ao,e.getConstraintsFromAudioConfig=KO,e.getConstraintsFromCameraConfig=GO,e.getConstraintsFromMicrophoneConfig=ZO,e.getConstraintsFromScreenAudioConfig=YO,e.getConstraintsFromScreenConfig=HO,e.getElectronScreenSources=wb,e.getElectronScreenStream=Ib,e.getElectronScreenStreamByUserSelect=Cb,e.getLocalStream=Pb,e.getNewNearestVideoProfile=MI,e.getNewVideoBitrate=kI,e.getOriginSenderConfig=e=>{const t=e._encoderConfig;if(!t)return;const r=e.getMediaStreamTrackSettings(),n=r.frameRate,i=r.width,o=r.height;let s=t.frameRate,a=void 0===s?n:s,c=t.width,u=void 0===c?i:c,d=t.height,l=void 0===d?o:d;if(!a||!u||!l)return;u=ti(u),l=ti(l),a=ti(a);const h=xI(u,l,a),p=h.max,f=h.min,E=t||{},m=E.bitrateMax,_=E.bitrateMin,T=E.minDownscaleWidth,g=E.minDownscaleHeight;m||Vi.debug("calculate bitrate: [w: ".concat(u,", h: ").concat(l,", fps: ").concat(a,"] => [brMax: ").concat(m,", brMin: ").concat(_,"]"));const S=yi("ENCODER_CONFIG_LIMIT").maxFramerate;return S&&"number"==typeof S&&(a=Math.min(a,S)),{width:u,height:l,frameRate:a,bitrateMax:m||p,bitrateMin:_||f,scaleResolutionDownBy:1,scale:0,minDownscaleWidth:T,minDownscaleHeight:g}},e.getScalabilityConfiguration=rd,e.getScreenEncoderConfiguration=td,e.getSilenceAudioTrack=function(){if(yb)return yb;const e=mb();if(!e.createMediaStreamDestination)throw new fn(pn.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 n=e.createMediaStreamDestination();return t.connect(n),yb=n.stream.getAudioTracks()[0],yb},e.getSilenceSamplesDuration=function(e){const t=e.getChannelData(0);let r=0,n=0;for(let e=0;e<t.length;e+=1)0===t[e]?(r+=1,r>n&&(n=r)):r=0;return n/t.length*e.duration},e.getStaticTrackStream=jI,e.getVideoEncoderConfiguration=ed,e.handleGetUserMediaError=kb,e.hasAudioContext=_b,e.hasMicrophoneTrack=cd,e.interceptLocalAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ao().supportWebRTCEncodedTransform)return void Vi.warning("browser not support audio encoded transform");if(_k.has(e))return;if(!e.track)return;const r={track:e.track};if(Wr()){if(!e.createEncodedStreams)return void Vi.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void Vi.error("create audio-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(i,o){r.controller||(r.controller=o),e.track&&e.track.id!==r.track.id&&(Vi.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n));const s=t.metadata&&t.metadata();s?Tk(s,{sender:e,chunk:i,controller:o}):o.enqueue(i)}});i.readable.pipeThrough(o).pipeTo(i.writable)}else if(Gr()){if("undefined"==typeof RTCRtpScriptTransform)return void Vi.warning("browser not support RTCRtpScriptTransform");const i=uk(),o=new MessageChannel;await new sb((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(i,{name:"audio-metadata-tx",port:o.port2},[o.port2]);e.transform=s,await new sb((e=>i.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=i=>{var s;if(i.data.transformed&&e.track&&(null===(s=e.track)||void 0===s?void 0:s.id)!==r.track.id)Vi.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n);else if(i.data.getMetadata){const e=t.metadata&&t.metadata();e&&o.port1.postMessage({metadata:e})}},r.worker=i}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}const t=_k.get(e);if(t){_k.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){Vi.warning(e&&e.message)}}}_k.set(e,r),e.track.addEventListener("ended",n)},e.interceptLocalVideoFrame=async function(e,t){if(!ao().supportWebRTCEncodedTransform)return void Vi.warning("browser not support video encoded transform");if(tM.has(e))return;if(!e.track)return;const r={track:e.track};if(Wr()){if(!e.createEncodedStreams)return void Vi.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void Vi.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,i){r.controller||(r.controller=i),e.track&&e.track.id!==r.track.id&&(Vi.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n));const s=eM(new Uint8Array(t.data)),a=o.shift();if(a){const e=$k(t.data,a,s);e&&(t.data=e)}i.enqueue(t)}});i.readable.pipeThrough(s).pipeTo(i.writable)}else{if(!Gr())return;{if("undefined"==typeof RTCRtpScriptTransform)return void Vi.warning("browser not support RTCRtpScriptTransform");const i=uk(),o=new MessageChannel;await new sb((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(i,{name:"sei-tx",port:o.port2},[o.port2]);e.transform=s,await new sb((e=>i.onmessage=t=>{"started"===t.data&&e(void 0)})),t.on("sei-to-send",(e=>{o.port1.postMessage({sei:e})})),o.port1.onmessage=t=>{var i;t.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==r.track.id&&(Vi.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n))},r.worker=i}}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}const t=tM.get(e);if(t){tM.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){Vi.warning(e&&e.message)}}}tM.set(e,r),e.track.addEventListener("ended",n)},e.interceptRemoteAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ao().supportWebRTCEncodedTransform)return void Vi.warning("browser not support audio encoded transform");if(Kk.has(e))return;const r={track:e.track,onMetadata:t.onMetadata,onPts:t.onPts};if(Wr()&&!Yr()){if(!e.createEncodedStreams)return void Vi.warning("browser not support createEncodedStreams() API");zr(Lr.CHROME,87,116)||(t.enableTopn=!1);let i=null;try{i=e.createEncodedStreams()}catch(e){return void Vi.error("create audio-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(i,o){r.controller||(r.controller=o),e.track&&e.track.id!==r.track.id&&(Vi.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n)),t.enableTopn?function(e,t,r){var n;const i=mk(new DataView(t.data));if(!i)return r.enqueue(t);const o=e.track.id;Yk.set(o,e.track);const s=null===(n=i.tlv.find((e=>e.tag===Ek.AUDIO_LEVEL)))||void 0===n?void 0:n.value;let a=0;"number"==typeof s&&(a=127-s);const c=Uk(e,Math.round(Math.pow(10,a/60)-1)),u=c.selected,d=c.speaker,l=Gk(o,e.track,d.energyScore);l.addSample(u),l.active&&(t.data=i.frame.buffer,r.enqueue(t))}(e,i,o):t.enableMetadata||t.enablePts?Zk(i,o,t.onMetadata,t.onPts):o.enqueue(i)}});i.readable.pipeThrough(o).pipeTo(i.writable)}else{if("undefined"==typeof RTCRtpScriptTransform)return void Vi.warning("browser not support RTCRtpScriptTransform");const t=uk(),i=new MessageChannel;await new sb((e=>t.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(t,{name:"audio-metadata-rx",port:i.port2},[i.port2]);e.transform=o,await new sb((e=>t.onmessage=t=>{"started"===t.data&&e(void 0)})),i.port1.onmessage=t=>{var i;t.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==r.track.id?(Vi.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n)):t.data.metadata&&r.onMetadata?r.onMetadata(t.data.metadata):t.data.pts&&r.onPts&&r.onPts(t.data.pts)},r.worker=t}function n(){e.track.removeEventListener("ended",n),function(e){const t=Kk.get(e);if(t){!function(e){const t=Dk.get(e);t&&(Dk.delete(e),Pk&&(Pk.removeSpeakers([t]),0===Dk.size&&(Pk.destroy(),Pk=null)))}(e),Hk(e.track.id),Kk.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){Vi.warning(e&&e.message)}}}(e)}Kk.set(e,r),e.track.addEventListener("ended",n)},e.interceptRemoteVideoFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!ao().supportWebRTCEncodedTransform)return void Vi.warning("browser not support video encoded transform");if(!e.track)return;if(nM.has(e)){const r=nM.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(Wr()){if(!e.createEncodedStreams)return void Vi.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void Vi.error("create video-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(i,o){if(r.controller||(r.controller=o),!r.firstFrameInfo){var s;const e=i.getMetadata()||{};r.firstFrameInfo=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?rM(Object(r),!0).forEach((function(t){IT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:i.type,rtpTimestamp:i.timestamp,payloadType:e.payloadType||0,ssrc:e.synchronizationSource||0,length:i.data.byteLength},"mimeType"in e?{mimeType:e.mimeType}:{}),null===(s=t.onFirstFrame)||void 0===s||s.call(t,r.firstFrameInfo)}e.track&&e.track.id!==r.track.id&&(Vi.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n));const a=Qk(i,eM(new Uint8Array(i.data)));a&&r.onSei&&r.onSei(a),o.enqueue(i)}});i.readable.pipeThrough(o).pipeTo(i.writable)}else if(Gr()){if("undefined"==typeof RTCRtpScriptTransform)return void Vi.warning("browser not support RTCRtpScriptTransform");const i=uk(),o=new MessageChannel;await new sb((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(i,{name:"sei-rx",port:o.port2},[o.port2]);e.transform=s,await new sb((e=>i.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=i=>{var o;if(i.data.transformed&&e.track&&(null===(o=e.track)||void 0===o?void 0:o.id)!==r.track.id)Vi.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n);else if(i.data.sei&&r.onSei)r.onSei(i.data.sei);else if(i.data.firstFrameInfo&&t.onFirstFrame){var s;null===(s=t.onFirstFrame)||void 0===s||s.call(t,i.data.firstFrameInfo)}},r.worker=i}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}!function(e){const t=nM.get(e);if(t){nM.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){Vi.warning(e&&e.message)}}}(e)}nM.set(e,r),e.track.addEventListener("ended",n)},e.isAudioEncoderConfiguration=dd,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?mn(e,"profile",Object.keys(nd)):dd(e),!0},e.isBeautyEffectOptions=function(e){return void 0!==e.smoothnessLevel&&_n(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&_n(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&_n(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&mn(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),!0},e.isElectron=bn,e.isLowStreamParameter=function(e){if(!e)throw new fn(pn.INVALID_PARAMS);return gn(e.width)||Tn(e.width,"streamParameter.width"),gn(e.height)||Tn(e.height,"streamParameter.height"),gn(e.framerate)||Tn(e.framerate,"streamParameter.framerate"),gn(e.bitrate)||_n(e.bitrate,"streamParameter.bitrate"),!0},e.isPlanB=uo,e.isScreenSourceType=ld,e.isVideoEncoderConfiguration=ud,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?mn(e,"profile",Object.keys(Qu)):ud(e),!0},e.polyfillAudioNode=Tb,e.removeTrack=ad,e.requestAutoplayGesture=TO,e.restartBackgroundTag=Eb,e.silenceScriptProcessHandler=vb,e.updateAgoraRTCCompatibility=so,e.visibilityWatcher=Qw}));