@agora-js/media 4.21.0 → 4.22.0

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,6 +1,5 @@
1
1
  /**
2
- * AgoraWebSDK_N-v4.21.0-0-g16fdae2c-dirty Copyright AgoraInc.
2
+ * AgoraWebSDK_N-v4.22.0-0-g8569241d-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 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 d(e,t){n&&console.warn(e+" is deprecated, please use "+t+" instead.")}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e){return u(e)?Object.keys(e).reduce((function(t,r){const n=u(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,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(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 g(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 T(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 v(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const 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 y(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return v(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const 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 b(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 R(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:R,shimAddTrackRemoveTrack:y,shimAddTrackRemoveTrackWithNative:v,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{const 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:g,shimGetStats:T,shimGetUserMedia:_,shimMediaStream:m,shimOnTrack:E,shimPeerConnection:b,shimSenderReceiverGetStats:S});function O(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){d("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 w(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 C(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 k(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){d("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function D(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function P(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const r=e.length>0;r&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const 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 L(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function M(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var x=Object.freeze({__proto__:null,shimAddTransceiver:P,shimCreateAnswer:U,shimCreateOffer:M,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})},shimGetParameters:L,shimGetUserMedia:O,shimOnTrack:I,shimPeerConnection:w,shimRTCDataChannel:D,shimReceiverGetStats:N,shimRemoveStream:k,shimSenderGetStats:C});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(G(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function G(e){return e&&void 0!==e.video?Object.assign({},e,{video:l(e.video)}):e}function W(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let n=e.iceServers[r];!n.hasOwnProperty("urls")&&n.hasOwnProperty("url")?(d("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 z(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 K(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Y=Object.freeze({__proto__:null,shimAudioContext:K,shimCallbacksAPI:B,shimConstraints:G,shimCreateOfferLegacy:z,shimGetUserMedia:j,shimLocalStreamsAPI:V,shimRTCIceServerUrls:W,shimRemoteStreamsAPI:F,shimTrackEventTransceiver:H}),J="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Z(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var X={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&&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 d=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));d.length>0&&d[0].length>1&&d[0][0]===a&&(c=d[0][1]),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 u=t.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substring(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=u}))),r},t.parseRtcpParameters=function(e){const r={},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}(X);var q=X.exports,Q=Z(q),$=t({__proto__:null,default:Q},[q]);function ee(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),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(!A||!b||!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=A,se(e,n),ae(e),_(e,n),m(e),b(e,n),E(e),y(e,n),g(e),T(e),S(e),R(e,n),ee(e),te(e),ie(e),re(e,n),ne(e),oe(e,n);break;case"firefox":if(!x||!w||!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),w(e,n),I(e),k(e),C(e),N(e),D(e),P(e),L(e),M(e),U(e),ee(e),ie(e),re(e,n),ne(e);break;case"safari":if(!Y||!t.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=Y,se(e,n),ae(e),W(e),z(e),B(e),V(e),F(e),H(e),j(e),K(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 de={exports:{}};!function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",c="major",d="model",u="name",l="type",h="vendor",p="version",f="architecture",_="console",m="mobile",E="tablet",g="smarttv",T="wearable",S="embedded",v="Amazon",y="Apple",b="ASUS",R="BlackBerry",A="Browser",O="Chrome",I="Firefox",w="Google",C="Huawei",N="LG",k="Microsoft",D="Motorola",P="Opera",L="Samsung",M="Sharp",U="Sony",x="Xiaomi",V="Zebra",F="Facebook",B="Chromium OS",j="Mac OS",G=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},W=function(e,t){return typeof e===a&&-1!==H(t).indexOf(H(e))},H=function(e){return e.toLowerCase()},z=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,350)},K=function(e,t){for(var r,o,a,c,d,u,l=0;l<t.length&&!d;){var h=t[l],p=t[l+1];for(r=o=0;r<h.length&&!d&&h[r];)if(d=h[r++].exec(e))for(a=0;a<p.length;a++)u=d[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):n:this[c[0]]=u?c[1].call(this,u,c[2]):n:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):n):this[c]=u||n;l+=2}},Y=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(W(t[r][i],e))return"?"===r?n:r}else if(W(t[r],e))return"?"===r?n:r;return e},J={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Z={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,p],[/opios[\/ ]+([\w\.]+)/i],[p,[u,P+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[u,P]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[u,"UC"+A]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+A],p],[/\bfocus\/([\w\.]+)/i],[p,[u,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[u,P+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[u,P+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI "+A]],[/fxios\/([-\w\.]+)/i],[p,[u,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+A]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+A],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],p],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[u,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,O+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[u,"Android "+A]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[p,Y,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[u,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],[u,p],[/(cobalt)\/([\w\.]+)/i],[u,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,H]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",H]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,H]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[h,L],[l,E]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[h,L],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[d,[h,y],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[h,y],[l,E]],[/(macintosh);/i],[d,[h,y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[h,M],[l,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[h,C],[l,E]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[h,C],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[d,/_/g," "],[h,x],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[h,x],[l,E]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[h,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[h,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[d,[h,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[h,D],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[h,D],[l,E]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[h,N],[l,E]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[h,N],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[h,"Lenovo"],[l,E]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[h,"Nokia"],[l,m]],[/(pixel c)\b/i],[d,[h,w],[l,E]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[h,w],[l,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[h,U],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[h,U],[l,E]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[h,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[h,v],[l,E]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[h,v],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[d,h,[l,E]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[h,R],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[h,b],[l,E]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[h,b],[l,m]],[/(nexus 9)/i],[d,[h,"HTC"],[l,E]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[d,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[h,"Acer"],[l,E]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[h,"Meizu"],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,d,[l,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[h,d,[l,E]],[/(surface duo)/i],[d,[h,k],[l,E]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[h,"Fairphone"],[l,m]],[/(u304aa)/i],[d,[h,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[d,[h,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[d,[h,"RCA"],[l,E]],[/\b(venue[\d ]{2,7}) b/i],[d,[h,"Dell"],[l,E]],[/\b(q(?:mv|ta)\w+) b/i],[d,[h,"Verizon"],[l,E]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[h,"Barnes & Noble"],[l,E]],[/\b(tm\d{3}\w+) b/i],[d,[h,"NuVision"],[l,E]],[/\b(k88) b/i],[d,[h,"ZTE"],[l,E]],[/\b(nx\d{3}j) b/i],[d,[h,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[d,[h,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[d,[h,"Swiss"],[l,E]],[/\b((zeki)?tb.*\b) b/i],[d,[h,"Zeki"],[l,E]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],d,[l,E]],[/\b(ns-?\w{0,9}) b/i],[d,[h,"Insignia"],[l,E]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[h,"NextBook"],[l,E]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],d,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],d,[l,m]],[/\b(ph-1) /i],[d,[h,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[h,"Envizen"],[l,E]],[/\b(trio[-\w\. ]+) b/i],[d,[h,"MachSpeed"],[l,E]],[/\btu_(1491) b/i],[d,[h,"Rotor"],[l,E]],[/(shield[\w ]+) b/i],[d,[h,"Nvidia"],[l,E]],[/(sprint) (\w+)/i],[h,d,[l,m]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[h,k],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[h,V],[l,E]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[h,V],[l,m]],[/smart-tv.+(samsung)/i],[h,[l,g]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[h,L],[l,g]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,N],[l,g]],[/(apple) ?tv/i],[h,[d,y+" TV"],[l,g]],[/crkey/i],[[d,O+"cast"],[h,w],[l,g]],[/droid.+aft(\w)( bui|\))/i],[d,[h,v],[l,g]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[h,M],[l,g]],[/(bravia[\w ]+)( bui|\))/i],[d,[h,U],[l,g]],[/(mitv-\w{5}) bui/i],[d,[h,x],[l,g]],[/Hbbtv.*(technisat) (.*);/i],[h,d,[l,g]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,z],[d,z],[l,g]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,g]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,d,[l,_]],[/droid.+; (shield) bui/i],[d,[h,"Nvidia"],[l,_]],[/(playstation [345portablevi]+)/i],[d,[h,U],[l,_]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[h,k],[l,_]],[/((pebble))app/i],[h,d,[l,T]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[h,y],[l,T]],[/droid.+; (glass) \d/i],[d,[h,w],[l,T]],[/droid.+; (wt63?0{2,3})\)/i],[d,[h,V],[l,T]],[/(quest( 2| pro)?)/i],[d,[h,F],[l,T]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[l,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[d,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[l,E]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,E]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[p,Y,J]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[p,Y,J]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,j],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,p],[/\(bb(10);/i],[p,[u,R]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[u,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[u,O+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,B],p],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,p],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,p]]},X=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof X))return new X(e,t).getResult();var _=typeof r!==o&&r.navigator?r.navigator:n,g=e||(_&&_.userAgent?_.userAgent:""),T=_&&_.userAgentData?_.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}(Z,t):Z;return this.getBrowser=function(){var e={};return e[u]=n,e[p]=n,K.call(e,g,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e[p]),_&&_.brave&&typeof _.brave.isBrave==i&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[f]=n,K.call(e,g,S.cpu),e},this.getDevice=function(){var e={};return e[h]=n,e[d]=n,e[l]=n,K.call(e,g,S.device),!e[l]&&T&&T.mobile&&(e[l]=m),"Macintosh"==e[d]&&_&&typeof _.standalone!==o&&_.maxTouchPoints&&_.maxTouchPoints>2&&(e[d]="iPad",e[l]=E),e},this.getEngine=function(){var e={};return e[u]=n,e[p]=n,K.call(e,g,S.engine),e},this.getOS=function(){var e={};return e[u]=n,e[p]=n,K.call(e,g,S.os),!e[u]&&T&&"Unknown"!=T.platform&&(e[u]=T.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 g},this.setUA=function(e){return g=typeof e===a&&e.length>350?z(e,350):e,this},this.setUA(g),this};X.VERSION="0.7.34",X.BROWSER=G([u,p,c]),X.CPU=G([f]),X.DEVICE=G([d,h,l,_,m,g,E,T,S]),X.ENGINE=X.OS=G([u,p]),e.exports&&(t=e.exports=X),t.UAParser=X;var q=typeof r!==o&&(r.jQuery||r.Zepto);if(q&&!q.ua){var Q=new X;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:J)}(de,de.exports);var ue=Z(de.exports);function le(e,t){return function(){return e.apply(t,arguments)}}const{toString:he}=Object.prototype,{getPrototypeOf:pe}=Object,fe=(_e=Object.create(null),e=>{const t=he.call(e);return _e[t]||(_e[t]=t.slice(8,-1).toLowerCase())});var _e;const me=e=>(e=e.toLowerCase(),t=>fe(t)===e),Ee=e=>t=>typeof t===e,{isArray:ge}=Array,Te=Ee("undefined");const Se=me("ArrayBuffer");const ve=Ee("string"),ye=Ee("function"),be=Ee("number"),Re=e=>null!==e&&"object"==typeof e,Ae=e=>{if("object"!==fe(e))return!1;const t=pe(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Oe=me("Date"),Ie=me("File"),we=me("Blob"),Ce=me("FileList"),Ne=me("URLSearchParams");function ke(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{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 De(e,t){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 Pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Le=e=>!Te(e)&&e!==Pe;const Me=(Ue="undefined"!=typeof Uint8Array&&pe(Uint8Array),e=>Ue&&e instanceof Ue);var Ue;const xe=me("HTMLFormElement"),Ve=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Fe=me("RegExp"),Be=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};ke(r,((r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)})),Object.defineProperties(e,n)},je="abcdefghijklmnopqrstuvwxyz",Ge="0123456789",We={DIGIT:Ge,ALPHA:je,ALPHA_DIGIT:je+je.toUpperCase()+Ge};const He=me("AsyncFunction");var ze={isArray:ge,isArrayBuffer:Se,isBuffer:function(e){return null!==e&&!Te(e)&&null!==e.constructor&&!Te(e.constructor)&&ye(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||ye(e.append)&&("formdata"===(t=fe(e))||"object"===t&&ye(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Se(e.buffer),t},isString:ve,isNumber:be,isBoolean:e=>!0===e||!1===e,isObject:Re,isPlainObject:Ae,isUndefined:Te,isDate:Oe,isFile:Ie,isBlob:we,isRegExp:Fe,isFunction:ye,isStream:e=>Re(e)&&ye(e.pipe),isURLSearchParams:Ne,isTypedArray:Me,isFileList:Ce,forEach:ke,merge:function e(){const{caseless:t}=Le(this)&&this||{},r={},n=(n,i)=>{const o=t&&De(r,i)||i;Ae(r[o])&&Ae(n)?r[o]=e(r[o],n):Ae(n)?r[o]=e({},n):ge(n)?r[o]=n.slice():r[o]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&ke(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(ke(t,((t,n)=>{r&&ye(t)?e[n]=le(t,r):e[n]=t}),{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),e.prototype.constructor=e,Object.defineProperty(e,"super",{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:fe,kindOfTest:me,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[Symbol.iterator]).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:xe,hasOwnProperty:Ve,hasOwnProp:Ve,reduceDescriptors:Be,freezeMethods:e=>{Be(e,((t,r)=>{if(ye(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];ye(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)=>(e=+e,Number.isFinite(e)?e:t),findKey:De,global:Pe,isContextDefined:Le,ALPHABET:We,generateString:(e=16,t=We.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&ye(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Re(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=ge(e)?[]:{};return ke(e,((e,t)=>{const o=r(e,n+1);!Te(o)&&(i[t]=o)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:He,isThenable:e=>e&&(Re(e)||ye(e))&&ye(e.then)&&ye(e.catch)};function Ke(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}ze.inherits(Ke,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ze.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Ye=Ke.prototype,Je={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Je[e]={value:e}})),Object.defineProperties(Ke,Je),Object.defineProperty(Ye,"isAxiosError",{value:!0}),Ke.from=(e,t,r,n,i,o)=>{const s=Object.create(Ye);return ze.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),Ke.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};function Ze(e){return ze.isPlainObject(e)||ze.isArray(e)}function Xe(e){return ze.endsWith(e,"[]")?e.slice(0,-2):e}function qe(e,t,r){return e?e.concat(t).map((function(e,t){return e=Xe(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const Qe=ze.toFlatObject(ze,{},null,(function(e){return/^is[A-Z]/.test(e)}));function $e(e,t,r){if(!ze.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=ze.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!ze.isUndefined(t[e])}))).metaTokens,i=r.visitor||d,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&ze.isSpecCompliantForm(t);if(!ze.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(ze.isDate(e))return e.toISOString();if(!a&&ze.isBlob(e))throw new Ke("Blob is not supported. Use a Buffer instead.");return ze.isArrayBuffer(e)||ze.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(ze.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(ze.isArray(e)&&function(e){return ze.isArray(e)&&!e.some(Ze)}(e)||(ze.isFileList(e)||ze.endsWith(r,"[]"))&&(a=ze.toArray(e)))return r=Xe(r),a.forEach((function(e,n){!ze.isUndefined(e)&&null!==e&&t.append(!0===s?qe([r],n,o):null===s?r:r+"[]",c(e))})),!1;return!!Ze(e)||(t.append(qe(i,r,o),c(e)),!1)}const u=[],l=Object.assign(Qe,{defaultVisitor:d,convertValue:c,isVisitable:Ze});if(!ze.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!ze.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),ze.forEach(r,(function(r,o){!0===(!(ze.isUndefined(r)||null===r)&&i.call(t,r,ze.isString(o)?o.trim():o,n,l))&&e(r,n?n.concat(o):[o])})),u.pop()}}(e),t}function et(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function tt(e,t){this._pairs=[],e&&$e(e,this,t)}const rt=tt.prototype;function nt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function it(e,t,r){if(!t)return e;const n=r&&r.encode||nt,i=r&&r.serialize;let o;if(o=i?i(t,r):ze.isURLSearchParams(t)?t.toString():new tt(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}rt.append=function(e,t){this._pairs.push([e,t])},rt.toString=function(e){const t=e?function(t){return e.call(this,t,et)}:et;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var ot=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){ze.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},st={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},at={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:tt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ct="undefined"!=typeof window&&"undefined"!=typeof document,dt=(ut="undefined"!=typeof navigator&&navigator.product,ct&&["ReactNative","NativeScript","NS"].indexOf(ut)<0);var ut;const lt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var ht={...Object.freeze({__proto__:null,hasBrowserEnv:ct,hasStandardBrowserEnv:dt,hasStandardBrowserWebWorkerEnv:lt}),...at};function pt(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&&ze.isArray(n)?n.length:o,a)return ze.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!s;n[o]&&ze.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],i)&&ze.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(ze.isFormData(e)&&ze.isFunction(e.entries)){const r={};return ze.forEachEntry(e,((e,n)=>{t(function(e){return ze.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const ft={transitional:st,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=ze.isObject(e);i&&ze.isHTMLForm(e)&&(e=new FormData(e));if(ze.isFormData(e))return n?JSON.stringify(pt(e)):e;if(ze.isArrayBuffer(e)||ze.isBuffer(e)||ze.isStream(e)||ze.isFile(e)||ze.isBlob(e))return e;if(ze.isArrayBufferView(e))return e.buffer;if(ze.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return $e(e,new ht.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return ht.isNode&&ze.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=ze.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return $e(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(ze.isString(e))try{return(t||JSON.parse)(e),ze.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ft.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&ze.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw Ke.from(e,Ke.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ht.classes.FormData,Blob:ht.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ze.forEach(["delete","get","head","post","put","patch"],(e=>{ft.headers[e]={}}));var _t=ft;const mt=ze.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 Et=Symbol("internals");function gt(e){return e&&String(e).trim().toLowerCase()}function Tt(e){return!1===e||null==e?e:ze.isArray(e)?e.map(Tt):String(e)}function St(e,t,r,n,i){return ze.isFunction(n)?n.call(this,t,r):(i&&(t=r),ze.isString(t)?ze.isString(n)?-1!==t.indexOf(n):ze.isRegExp(n)?n.test(t):void 0:void 0)}class vt{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=gt(t);if(!i)throw new Error("header name must be a non-empty string");const o=ze.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=Tt(e))}const o=(e,t)=>ze.forEach(e,((e,r)=>i(e,r,t)));return ze.isPlainObject(e)||e instanceof this.constructor?o(e,t):ze.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]&&mt[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=gt(e)){const r=ze.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(ze.isFunction(t))return t.call(this,e,r);if(ze.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=gt(e)){const r=ze.findKey(this,e);return!(!r||void 0===this[r]||t&&!St(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=gt(e)){const i=ze.findKey(r,e);!i||t&&!St(0,r[i],i,t)||(delete r[i],n=!0)}}return ze.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&&!St(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return ze.forEach(this,((n,i)=>{const o=ze.findKey(r,i);if(o)return t[o]=Tt(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]=Tt(n),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ze.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&ze.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")}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[Et]=this[Et]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=gt(e);t[n]||(!function(e,t){const r=ze.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return ze.isArray(e)?e.forEach(n):n(e),this}}vt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ze.reduceDescriptors(vt.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),ze.freezeMethods(vt);var yt=vt;function bt(e,t){const r=this||_t,n=t||r,i=yt.from(n.headers);let o=n.data;return ze.forEach(e,(function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function Rt(e){return!(!e||!e.__CANCEL__)}function At(e,t,r){Ke.call(this,null==e?"canceled":e,Ke.ERR_CANCELED,t,r),this.name="CanceledError"}ze.inherits(At,Ke,{__CANCEL__:!0});var Ot=ht.hasStandardBrowserEnv?{write(e,t,r,n,i,o){const s=[e+"="+encodeURIComponent(t)];ze.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),ze.isString(n)&&s.push("path="+n),ze.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function It(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var wt=ht.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=ze.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function Ct(e,t){let r=0;const n=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(),d=n[s];i||(i=c),r[o]=a,n[o]=c;let u=s,l=0;for(;u!==o;)l+=r[u++],u%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-i<t)return;const h=d&&c-d;return h?Math.round(1e3*l/h):void 0}}(50,250);return i=>{const o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-r,c=n(a);r=o;const d={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:i};d[t?"download":"upload"]=!0,e(d)}}var Nt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=yt.from(e.headers).normalize();let o,s,{responseType:a,withXSRFToken:c}=e;function d(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}if(ze.isFormData(n))if(ht.hasStandardBrowserEnv||ht.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if(!1!==(s=i.getContentType())){const[e,...t]=s?s.split(";").map((e=>e.trim())).filter(Boolean):[];i.setContentType([e||"multipart/form-data",...t].join("; "))}let u=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const l=It(e.baseURL,e.url);function h(){if(!u)return;const n=yt.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Ke("Request failed with status code "+r.status,[Ke.ERR_BAD_REQUEST,Ke.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),d()}),(function(e){r(e),d()}),{data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:e,request:u}),u=null}if(u.open(e.method.toUpperCase(),it(l,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(h)},u.onabort=function(){u&&(r(new Ke("Request aborted",Ke.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new Ke("Network Error",Ke.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||st;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new Ke(t,n.clarifyTimeoutError?Ke.ETIMEDOUT:Ke.ECONNABORTED,e,u)),u=null},ht.hasStandardBrowserEnv&&(c&&ze.isFunction(c)&&(c=c(e)),c||!1!==c&&wt(l))){const t=e.xsrfHeaderName&&e.xsrfCookieName&&Ot.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in u&&ze.forEach(i.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),ze.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),a&&"json"!==a&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",Ct(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",Ct(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{u&&(r(!t||t.type?new At(null,e,u):t),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const p=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(l);p&&-1===ht.protocols.indexOf(p)?r(new Ke("Unsupported protocol "+p+":",Ke.ERR_BAD_REQUEST,e)):u.send(n||null)}))};const kt={http:null,xhr:Nt};ze.forEach(kt,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Dt=e=>`- ${e}`,Pt=e=>ze.isFunction(e)||null===e||!1===e;var Lt={getAdapter:e=>{e=ze.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let o=0;o<t;o++){let t;if(r=e[o],n=r,!Pt(r)&&(n=kt[(t=String(r)).toLowerCase()],void 0===n))throw new Ke(`Unknown adapter '${t}'`);if(n)break;i[t||"#"+o]=n}if(!n){const e=Object.entries(i).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new Ke("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Dt).join("\n"):" "+Dt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n},adapters:kt};function Mt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new At(null,e)}function Ut(e){Mt(e),e.headers=yt.from(e.headers),e.data=bt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Lt.getAdapter(e.adapter||_t.adapter)(e).then((function(t){return Mt(e),t.data=bt.call(e,e.transformResponse,t),t.headers=yt.from(t.headers),t}),(function(t){return Rt(t)||(Mt(e),t&&t.response&&(t.response.data=bt.call(e,e.transformResponse,t.response),t.response.headers=yt.from(t.response.headers))),Promise.reject(t)}))}const xt=e=>e instanceof yt?{...e}:e;function Vt(e,t){t=t||{};const r={};function n(e,t,r){return ze.isPlainObject(e)&&ze.isPlainObject(t)?ze.merge.call({caseless:r},e,t):ze.isPlainObject(t)?ze.merge({},t):ze.isArray(t)?t.slice():t}function i(e,t,r){return ze.isUndefined(t)?ze.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function o(e,t){if(!ze.isUndefined(t))return n(void 0,t)}function s(e,t){return ze.isUndefined(t)?ze.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,o){return o in t?n(r,i):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>i(xt(e),xt(t),!0)};return ze.forEach(Object.keys(Object.assign({},e,t)),(function(n){const o=c[n]||i,s=o(e[n],t[n],n);ze.isUndefined(s)&&o!==a||(r[n]=s)})),r}const Ft="1.6.8",Bt={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Bt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const jt={};Bt.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Ft+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new Ke(n(i," has been removed"+(t?" in "+t:"")),Ke.ERR_DEPRECATED);return t&&!jt[i]&&(jt[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,o)}};var Gt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Ke("options must be an object",Ke.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],s=t[o];if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new Ke("option "+o+" must be "+r,Ke.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new Ke("Unknown option "+o,Ke.ERR_BAD_OPTION)}},validators:Bt};const Wt=Gt.validators;let Ht=class{constructor(e){this.defaults=e,this.interceptors={request:new ot,response:new ot}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Vt(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&Gt.assertOptions(r,{silentJSONParsing:Wt.transitional(Wt.boolean),forcedJSONParsing:Wt.transitional(Wt.boolean),clarifyTimeoutError:Wt.transitional(Wt.boolean)},!1),null!=n&&(ze.isFunction(n)?t.paramsSerializer={serialize:n}:Gt.assertOptions(n,{encode:Wt.function,serialize:Wt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&ze.merge(i.common,i[t.method]);i&&ze.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=yt.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let d;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,l=0;if(!a){const e=[Ut.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),u=e.length,d=Promise.resolve(t);l<u;)d=d.then(e[l++],e[l++]);return d}u=s.length;let h=t;for(l=0;l<u;){const e=s[l++],t=s[l++];try{h=e(h)}catch(e){t.call(this,e);break}}try{d=Ut.call(this,h)}catch(e){return Promise.reject(e)}for(l=0,u=c.length;l<u;)d=d.then(c[l++],c[l++]);return d}getUri(e){return it(It((e=Vt(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};ze.forEach(["delete","get","head","options"],(function(e){Ht.prototype[e]=function(t,r){return this.request(Vt(r||{},{method:e,url:t,data:(r||{}).data}))}})),ze.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Vt(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Ht.prototype[e]=t(),Ht.prototype[e+"Form"]=t(!0)}));var zt=Ht;class Kt{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 At(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)}static source(){let e;return{token:new Kt((function(t){e=t})),cancel:e}}}var Yt=Kt;const Jt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Jt).forEach((([e,t])=>{Jt[t]=e}));var Zt=Jt;const Xt=function e(t){const r=new zt(t),n=le(zt.prototype.request,r);return ze.extend(n,zt.prototype,r,{allOwnKeys:!0}),ze.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Vt(t,r))},n}(_t);Xt.Axios=zt,Xt.CanceledError=At,Xt.CancelToken=Yt,Xt.isCancel=Rt,Xt.VERSION=Ft,Xt.toFormData=$e,Xt.AxiosError=Ke,Xt.Cancel=Xt.CanceledError,Xt.all=function(e){return Promise.all(e)},Xt.spread=function(e){return function(t){return e.apply(null,t)}},Xt.isAxiosError=function(e){return ze.isObject(e)&&!0===e.isAxiosError},Xt.mergeConfig=Vt,Xt.AxiosHeaders=yt,Xt.formToJSON=e=>pt(ze.isHTMLForm(e)?new FormData(e):e),Xt.getAdapter=Lt.getAdapter,Xt.HttpStatusCode=Zt,Xt.default=Xt;var qt=Xt;let Qt=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}({}),$t=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 er=new ue;let tr=er.getResult(),rr=null;function nr(e){if(!rr){e&&er.setUA(e),tr=er.getResult();const t=function(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return $t.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return $t.CHROME;case"Safari":case"Mobile Safari":return $t.SAFARI;case"Edge":return $t.EDGE;case"Firefox":return $t.FIREFOX;case"QQ":case"QQBrowser":return $t.QQ;case"Opera":return $t.OPERA;case"WeChat":return $t.WECHAT;default:return e.browser.name||""}}(tr),r=ir(tr),n=function(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}(tr),i=tr.os.version,o=ir(tr,!1),s=tr.device.type;if(!(t&&r&&n&&i))return{name:t,version:r,os:n,osVersion:i,browserVersion:o,deviceType:s};rr={name:t,version:r,os:n,osVersion:i,browserVersion:o,deviceType:s}}return rr}function ir(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 or(){return nr().os}function sr(){const e=nr();return"".concat(e.os," ").concat(e.osVersion)}function ar(){const e=nr();return!!("WebKit"===tr.engine.name&&e.os===Qt.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==$t.SAFARI||hr()&&e.name!==$t.SAFARI)}function cr(){return nr().name===$t.CHROME}function dr(){return nr().name===$t.SAFARI}function ur(){return nr().name===$t.EDGE}function lr(){return nr().name===$t.FIREFOX}function hr(){return nr().os===Qt.IOS}function pr(e){const t=nr();return!(t.name!==$t.CHROME||!t.osVersion)&&Number(t.version)>=e}function fr(e){const t=nr();return!(t.name!==$t.EDGE||!t.osVersion)&&Number(t.version)>=e}function _r(e){const t=nr();return!(t.name!==$t.OPERA||!t.osVersion)&&Number(t.version)>=e}function mr(){const e=nr();if(e.os!==Qt.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function Er(){const e=nr();if(e.os!==Qt.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function gr(){const e=nr();if(e.os!==Qt.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function Tr(){return dr()&&navigator.maxTouchPoints>0}function Sr(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function vr(){const e=or();return function(){const{deviceType:e}=nr();return"mobile"===e||"tablet"===e}()||e===Qt.ANDROID||e===Qt.IOS||e===Qt.HARMONY_OS}function yr(){const e=nr();return e.name!==$t.EDGE&&e.name!==$t.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function br(){return or()===Qt.ANDROID}function Rr(){const e=nr();return br()&&(e.name===$t.CHROME||e.name===$t.WECHAT||/chrome|chromium/i.test(navigator.userAgent))}function Ar(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 Or(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ar(Object(r),!0).forEach((function(t){Ir(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ar(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ir(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var 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:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let wr=function(e){return e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",e.TIMEOUT="TIMEOUT",e.INVALID_PARAMS="INVALID_PARAMS",e.NOT_READABLE="NOT_READABLE",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INVALID_OPERATION="INVALID_OPERATION",e.OPERATION_ABORTED="OPERATION_ABORTED",e.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",e.EXCHANGE_SDP_FAILED="EXCHANGE_SDP_FAILED",e.ADD_CANDIDATE_FAILED="ADD_CANDIDATE_FAILED",e.DATACHANNEL_FAILED="DATACHANNEL_FAILED",e.NETWORK_ERROR="NETWORK_ERROR",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",e.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",e.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",e.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",e.ELECTRON_IS_NULL="ELECTRON_IS_NULL",e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",e.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",e.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",e.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",e.PERMISSION_DENIED="PERMISSION_DENIED",e.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",e.TRACK_IS_DISABLED="TRACK_IS_DISABLED",e.GET_VIDEO_ELEMENT_VISIBLE_ERROR="GET_VIDEO_ELEMENT_VISIBLE_ERROR",e.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",e.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",e.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",e.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",e.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",e.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",e.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",e.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",e.UID_CONFLICT="UID_CONFLICT",e.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",e.UPDATE_TICKET_FAILED="UPDATE_TICKET_FAILED",e.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.INIT_WEBSOCKET_TIMEOUT="INIT_WEBSOCKET_TIMEOUT",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 Cr 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),Ir(this,"code",void 0),Ir(this,"message",void 0),Ir(this,"data",void 0),Ir(this,"name","AgoraRTCException"),this.code=e,this.message="AgoraRTCError ".concat(this.code,": ").concat(t),this.data=r}toString(){return this.data?"data: ".concat(JSON.stringify(this.data),"\n").concat(this.stack):"".concat(this.stack)}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 Nr(e,t){if("boolean"!=typeof e)throw new Cr(wr.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function kr(e,t,r){if(!r.includes(e))throw new Cr(wr.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(r)))}function Dr(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 Cr(wr.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function Pr(e,t){if("number"!=typeof e){if(!(e.min||e.max||e.ideal||e.exact))throw new Cr(wr.INVALID_PARAMS,"".concat(t," is not a valid ConstrainLong"));void 0!==e.min&&Dr(e.min,"".concat(t,".min"),0,1/0),void 0!==e.max&&Dr(e.max,"".concat(t,".max"),1,1/0),void 0!==e.exact&&Dr(e.exact,"".concat(t,".exact"),1,1/0),void 0!==e.ideal&&Dr(e.ideal,"".concat(t,".ideal"),1,1/0)}else Dr(e,t,1,1/0)}function Lr(e){return null==e}var Mr=function(e){return e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE",e}(Mr||{}),Ur=function(e){return e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT",e}(Ur||{});const xr=new class{constructor(){Ir(this,"_clientSize",null),Ir(this,"getClientWidth",(()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth)),Ir(this,"getClientHeight",(()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight)),Ir(this,"getStyle",(e=>window.getComputedStyle(e,null))),Ir(this,"checkCssVisibleProperty",(e=>{let t=!0;const r=this.getStyle(e),{display:n,visibility:i,opacity:o,filter:s}=r;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,r]=e.split(/\(|\)/);return[t,Number(r.match(/^[0-9\.]+/))]})).forEach((e=>{const[r,n]=e;switch(r){case"brightness":(n<.1||n>3)&&(t=!1);break;case"blur":n>3&&(t=!1);break;case"opacity":n<.1&&(t=!1)}})),t)})),Ir(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})),Ir(this,"checkActualCssVisibleIncludeInherit",(e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty))),Ir(this,"getSizeAboutClient",(e=>{const{width:t,height:r,left:n,right:i,top:o,bottom:s}=e.getBoundingClientRect(),a=this.getClientWidth(),c=this.getClientHeight();return{width:t,height:r,left:n,right:i,top:o,bottom:s,clientWidth:a,clientHeight:c,clientMin:Math.min(a,c)}})),Ir(this,"checkActualSize",(()=>{const{width:e,height:t,clientMin:r}=this._clientSize;return this.checkSizeIsVisible(e,t,r)})),Ir(this,"elementFromPoint",((e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null)),Ir(this,"checkCoverForAPoint",((e,t,r)=>{const n=this.elementFromPoint(e,t);return null!==n&&n!==r})),Ir(this,"getPointPositionList",(()=>{const{width:e,height:t,left:r,top:n}=this._clientSize,i=e/6,o=t/6,s=[],a=10**6;for(let e=0;e<5;e++)for(let t=0;t<5;t++){const c=(r*a+(0===e?.1:4===e?(i*e*a-1e5)/a:i*e)*a)/a,d=(n*a+(0===t?.1:4===t?(o*t*a-1e5)/a:o*t)*a)/a;s.push({x:c,y:d})}return[...s]})),Ir(this,"checkElementCover",(e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((e=>!!e)).length>6)),Ir(this,"checkSizeIsVisible",((e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10))),Ir(this,"checkSizeOfPartInClient",(()=>{const{left:e,right:t,top:r,bottom:n,clientHeight:i,clientWidth:o,clientMin:s}=this._clientSize;let a,c,d,u;if(e<0)a=0;else{if(!(e<o))return!1;a=e}if(t<0)return!1;if(c=t<o?t:o,r<0)d=0;else{if(!(r<i))return!1;d=r}if(n<0)return!1;u=n<i?n:i;const l=c-a,h=u-d;return this.checkSizeIsVisible(l,h,s)})),Ir(this,"returnHiddenResult",(e=>(this._clientSize=null,{visible:!1,reason:e}))),Ir(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(Mr.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(Mr.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(Mr.SIZE)}}return this.returnHiddenResult(Mr.STYLE)}return this.returnHiddenResult(Ur.UNMOUNTED)}return this.returnHiddenResult(Ur.INVALID_HTML_ELEMENT)})),Ir(this,"checkElementIsMountedOnDom",(e=>this.checkPropertyUpToAllParentNodes(e,(e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))))}};const Vr=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 Fr{constructor(){Ir(this,"_events",{}),Ir(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 Br(){return!!Gr()}let jr=null;function Gr(){if(jr)return jr;if(window.electron)return jr=window.electron;if(!window.require)return null;try{return jr=window.require("electron"),jr}catch(e){return null}}let Wr=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.DATACHANNEL_FAILBACK="Client._datachannelFailback",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}({}),Hr=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.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.FALLBACK="FALLBACK",e.LICENSE_MISSING="LICENSE_MISSING",e.LICENSE_EXPIRED="LICENSE_EXPIRED",e.LICENSE_MINUTES_EXCEEDED="LICENSE_MINUTES_EXCEEDED",e.LICENSE_PERIOD_INVALID="LICENSE_PERIOD_INVALID",e.LICENSE_MULTIPLE_SDK_SERVICE="LICENSE_MULTIPLE_SDK_SERVICE",e.LICENSE_ILLEGAL="LICENSE_ILLEGAL",e.TOKEN_EXPIRE="TOKEN_EXPIRE"}({}),function(e){e.CONNECTION_STATE_CHANGE="connection-state-change",e.MEDIA_RECONNECT_START="media-reconnect-start",e.MEDIA_RECONNECT_END="media-reconnect-end",e.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",e.USER_JOINED="user-joined",e.USER_LEAVED="user-left",e.USER_PUBLISHED="user-published",e.USER_UNPUBLISHED="user-unpublished",e.USER_INFO_UPDATED="user-info-updated",e.CLIENT_BANNED="client-banned",e.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",e.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",e.VOLUME_INDICATOR="volume-indicator",e.CRYPT_ERROR="crypt-error",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGED="stream-type-changed",e.STREAM_FALLBACK="stream-fallback",e.RECEIVE_METADATA="receive-metadata",e.STREAM_MESSAGE="stream-message",e.LIVE_STREAMING_ERROR="live-streaming-error",e.LIVE_STREAMING_WARNING="live-streaming-warning",e.INJECT_STREAM_STATUS="stream-inject-status",e.EXCEPTION="exception",e.ERROR="error",e.P2P_LOST="p2p_lost",e.JOIN_FALLBACK_TO_PROXY="join-fallback-to-proxy",e.CHANNEL_FALLBACK_TO_WEBSOCKET="channel-fallback-to-websocket",e.MEDIA_CONNECTION_TYPE_CHANGE="media-connection-type-change",e.PUBLISHED_USER_LIST="published-user-list",e.CONTENT_INSPECT_CONNECTION_STATE_CHANGE="content-inspect-connection-state-change",e.CONTENT_INSPECT_ERROR="content-inspect-error",e.CONTENT_INSPECT_RESULT="content-inspect-result",e.IMAGE_MODERATION_CONNECTION_STATE_CHANGE="image-moderation-connection-state-change"}({}),function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.MULTI_IP="MULTI_IP",e.TIMEOUT="TIMEOUT",e.OFFLINE="OFFLINE",e.LEAVE="LEAVE",e.P2P_FAILED="P2P_FAILED",e.FALLBACK="FALLBACK"}({});let zr=function(e){return e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({}),Kr=function(e){return e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({});function Yr(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 Cr(wr.UNEXPECTED_ERROR,"can not emit promise")):new Promise(((r,i)=>{e.emit(t,...n,r,i)}))}function Jr(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 Yr(e,t,...n)}function Zr(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 Cr(wr.UNEXPECTED_ERROR,"handler is not sync");return r}(e,t,...n)}const Xr=new class extends Fr{set networkState(e){this.emit(Kr.NETWORK_STATE_CHANGE,e,this._networkState),e===zr.ONLINE?this.emit(Kr.ONLINE):e===zr.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(Kr.ONLINE,(()=>{this.onlineWaiter=void 0,e(zr.ONLINE)}))})),this.emit(Kr.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}get isOnline(){return this._networkState===zr.ONLINE}constructor(){super(),Ir(this,"_moduleName","network-indicator"),Ir(this,"_networkState",zr.ONLINE),Ir(this,"onlineWaiter",void 0),window.addEventListener("online",(()=>{this.networkState=zr.ONLINE})),window.addEventListener("offline",(()=>{this.networkState=zr.OFFLINE}))}};function qr(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function Qr(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function $r(e){return JSON.parse(JSON.stringify(e))}function en(e){try{return $r(e)}catch(t){return e}}const tn={};function rn(e,t){tn[t]||(tn[t]=!0,e())}function nn(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function on(e){return new Promise((t=>{window.setTimeout(t,e)}))}function sn(){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)+sn(e-r.length,"")}const an=()=>{},cn=new class{constructor(){Ir(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,Or(Or({},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})}}},dn=cn.throttleByKey.bind(cn);function un(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function ln(e,t){if(!un(e)||!un(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]=ln(e[n],t[n]);return r}{const r=Or({},e);for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?r[n]=ln(e[n],t[n]):r[n]=t[n]);return r}}function hn(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}let pn=1,fn=console;class _n{static setLogger(e){fn=e}constructor(e){Ir(this,"lockingPromise",Promise.resolve()),Ir(this,"locks",0),Ir(this,"name",""),Ir(this,"lockId",void 0),this.lockId=pn++,e&&(this.name=e),fn.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}get isLocked(){return this.locks>0}lock(e){let t;this.locks+=1,fn.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is locked, current queue ").concat(this.locks,". ").concat("string"==typeof e?e:""));const r=new Promise((r=>{t=()=>{this.locks-=1,fn.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is not locked, current queue ").concat(this.locks,". ").concat("string"==typeof e?e:"")),r()}})),n=this.lockingPromise.then((()=>t));return this.lockingPromise=this.lockingPromise.then((()=>r)),n}}function mn(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 En={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function gn(e,t,r,n){const i=Object.assign({},En,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 Cr(wr.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 Tn=0,Sn=0;function vn(e,t,r,n){return new Promise(((i,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),Tn+=nn(t.data)):r&&(t.data.size?Tn+=t.data.size:t.data instanceof FormData?Tn+=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?nn(e):e.size})),t+138}(t.data):Tn+=nn(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,qt.request(t).then((e=>{"string"==typeof e.data?Sn+=nn(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?Sn+=e.data.byteLength:Sn+=nn(JSON.stringify(e.data)),n&&i({data:e.data,headers:e.headers}),i(e.data)})).catch((e=>{qt.isCancel(e)?o(new Cr(wr.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?o(new Cr(wr.NETWORK_TIMEOUT,e.message)):e.response?o(new Cr(wr.NETWORK_RESPONSE_ERROR,e.response.status)):o(new Cr(wr.NETWORK_ERROR,e.message))}))}))}async function yn(e,t){const r=new Blob([t.data],{type:"buffer"});return await vn(e,Or(Or({},t),{},{data:r,headers:{"Content-Type":"application/octet-stream"}}),!0)}const bn=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-alpha\.([0-9]+)/);if(t&&t[1]&&t[2]){const e=t[1],r=t[2];return"".concat(e,".").concat(r)}const r=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-special\.([0-9]+)/);if(r&&r[1]&&r[2]){const e=r[1],t=r[2];return"".concat(e,".").concat(100*(Number(t)+1))}return"4.0.0.999"}("4.21.0"),Rn=function(){try{return!0===JSON.parse("true")}catch(e){return!0}}();!function(e){e.Default="default",e.Auto="auto",e.Relay="relay",e.SdRtn="sd-rtn"}({});const An={PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",ENABLE_EVENT_REPORT:!0,GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,UPLOAD_LOG:!1,NOT_REPORT_EVENT:[],SUBSCRIBE_TWCC:!0,PUBLISH_TWCC:!1,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,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",TURN_DOMAIN:"edge.agora.io",EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,GET_VOLUME_OF_MUTED_AUDIO_TRACK:!1,STATS_UPDATE_INTERVAL:250,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,PRELOAD_MEDIA_COUNT:0,USE_PUB_RTX:!0,USE_SUB_RTX:!0,USE_XR:!0,ENABLE_LOSSBASED_BWE:!0,ENABLE_AUT_CC:void 0,ENABLE_CC_FALLBACK:void 0,CHECK_VIDEO_VISIBLE_INTERVAL:3e4,CHECK_LOCAL_STATS_INTERVAL:250,PROFILE_SWITCH_INTERVAL:2e3,UNSUPPORTED_VIDEO_CODEC:[],ENUMERATE_DEVICES_INTERVAL:!1,ENUMERATE_DEVICES_INTERVAL_TIME:1e4,USE_NEW_TOKEN:!1,CLOSE_AFB_FOR_LOCAL_AP:!0,JOIN_MAX_CONCURRENCY:6,JOIN_WITH_FALLBACK_SIGNAL_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE:!1,JOIN_GATEWAY_TRY_443PORT_DURATION:2e3,JOIN_GATEWAY_USE_443PORT_ONLY:!1,JOIN_GATEWAY_USE_DUAL_DOMAIN:!0,JOIN_GATEWAY_FALLBACK_PORT:443,USE_TURN_SERVER_OF_GATEWAY:!1,H264_PROFILE_LEVEL_ID:"",USE_NEW_LOG:!1,LOG_VERSION:3,MEDIA_DEVICE_CONSTRAINTS:null,ENCRYPT_PROXY_USERNAME_AND_PSW:!0,SDP_LOGGING:!1,CSP_DETECTED_HOSTNAME_LIST:["agora.io","sd-rtn.com"],REMOTE_AUDIO_TRACK_USES_WEB_AUDIO:!1,LOCAL_AUDIO_TRACK_USES_WEB_AUDIO:!1,BITRATE_ADAPTER_TYPE:"STANDARD_BITRATE",AI_DENOISER_PARAMETERS:{excludedLinks:[]},ADJUST_3A_FROM_PLUGINS:!0,RAISE_H264_BASELINE_PRIORITY:!0,FILTER_SEND_H264_BASELINE:!1,ENABLE_PUBLISHED_USER_LIST:!0,MAX_SUBSCRIPTION:50,X_GOOGLE_START_BITRATE:void 0,NEW_REPORT_SERVER:!1,NEW_REPORT_SERVER_DOMAINS:["data-reporting.agora.io","data-reporting.agora.io"],VIDEO_INSPECT_WORKER_MESSAGE_LENGTH_LIMIT:3e5,VIDEO_INSPECT_INTERVAL_MINIMUM:1e3,VIDEO_INSPECT_QUALITY_RATIO:.9,VIDEO_INSPECT_WORKER_MANAGER_HOST:"edge.agora.io",VIDEO_INSPECT_WORKER_MANAGER_PORT:"",VIDEO_INSPECT_WORKER_PORT:"",SHOW_VIDEO_INSPECT_WORKER_MESSAGE:!1,STATS_COLLECTOR_PORT:443,FORCE_TURN_TCP:!1,SUBSCRIBE_AUDIO_FILTER_TOPN:void 0,ENABLE_PUBLISH_AUDIO_FILTER:void 0,DISABLE_FEC:void 0,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,ICE_RESTART_INTERVAL:1e4,NEW_ICE_RESTART:!1,ENABLE_USER_LICENSE_CHECK:!0,SIGNAL_CHANNEL:0,TRANSMITTER_INITIAL_RTT:30,TRANSMITTER_INITIAL_RTO:30,TRANSMITTER_MAX_BATCH_ACK_COUNT:2,TRANSMITTER_MAX_RTO:500,DATACHANNEL_COMPRESS:!1,FINGERPRINT:null,DC_JOIN_WITH_FAILBACK:5e3,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,AP_AREA:!0,SVC:[],ENABLE_ENCODED_TRANSFORM:!1,ENABLE_VIDEO_SEI:!1,IMAGE_MODERATION_WORKER_HOST:"edge.agora.io",IMAGE_MODERATION_WORKER_MESSAGE_LENGTH_LIMIT:3e5,IMAGE_MODERATION_INTERVAL_MINIMUM:1e3,SHOW_IMAGE_MODERATION_WORKER_MESSAGE:!1,IMAGE_MODERATION_QUALITY_RATIO:.9,IMAGE_MODERATION_UPLOAD_REPORT_INTERVAL:5e3,SHOW_GLOBAL_CLIENT_LIST:!1,ENABLE_DATASTREAM_2:!1,DATASTREAM_MAX_RETRANSMITS:10,ENABLE_USER_AUTO_REBALANCE_CHECK:!0,ENABLE_INSTANT_VIDEO:!1,ENABLE_NTP_REPORT:!1,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,ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,FILEPATH_LENMAX:255,DUALSTREAM_OPERATION_CHECK:!0,MEDIA_ELEMENT_EXISTS_DEPTH:3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,STATS_FILTER:{transportId:!0,googTrackId:!0},FILTER_VIDEO_CODEC:[],USE_NEW_NETWORK_CONFIG:!1,AUTO_RESET_AUDIO_ROUTE:!1,PLUGIN_INFO:[],OVERUSE_DETECTOR_PARAMS:{MIN_FRAME_RATE:1,MAX_FRAME_RATE:30,MAX_THRESHOLD_FRAMERATE:30,BITRATE_MIN_THRESHOLD:100,BITRATE_MAX_THRESHOLD:100,MAX_SCALE:5,BWE_SCALE_UP_THRESHOLD:.6,BWE_SCALE_DOWN_THRESHOLD:.6,PERF_SCALE_UP_THRESHOLD:.7,PERF_SCALE_DOWN_THRESHOLD:.6,MOTION_RESOLUTION_FACTOR:.8,MOTION_BITRATE_FACTOR:.6,DETAIL_FRAMERATE_FACTOR:.8,DETAIL_BITRATE_FACTOR:.6,BALANCE_RESOLUTION_FACTOR:.9,BALANCE_FRAMERATE_FACTOR:.9,BALANCE_BITRATE_FACTOR:.6,OVERUSE_TIMES_THRESHOLD:10,UNDERUSE_TIMES_THRESHOLD:40},ENABLE_AG_ADAPTATION:!0,FORCE_AG_HIGH_FRAMERATE:!1,FORCE_SUPPORT_AG_ADAPTATION:!1,CUSTOM_ADAPTATION_DEFAULT_MODE:"",ENCODER_CONFIG_LIMIT:{},CAMERA_CAPTURE_CONFIG:void 0,HIDE_NO_POSTER:!1,AP_CACHE_NUM:10,AP_UPDATE_INTERVAL:12e4,AP_CACHE_LIFETIME:12e4,MAX_PRELOAD_ASYNC_LENGTH:3,ENABLE_PRELOAD:!0};function On(e,t,r){var n;Object.keys(An).includes(e)&&(!r&&Object.keys(wn).includes(e)||(An[e]=t,"ENABLE_VIDEO_SEI"===e&&!0===t&&(An.ENABLE_ENCODED_TRANSFORM=!0),"USE_NEW_NETWORK_CONFIG"===e&&t&&(n=!!t,An.USE_NEW_NETWORK_CONFIG=n,n&&(An.WEBCS_DOMAIN=["webrtc2-2.ap.sd-rtn.com"],An.WEBCS_DOMAIN_BACKUP_LIST=["webrtc2-4.ap.sd-rtn.com"],An.CDS_AP=["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],An.ACCOUNT_REGISTER=["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],An.EVENT_REPORT_DOMAIN="web-2.statscollector.sd-rtn.com",An.EVENT_REPORT_BACKUP_DOMAIN="statscollector-1.agora.io",An.GATEWAY_DOMAINS=["edge.sd-rtn.com"]))))}function In(e){return An[e]}const wn={};var Cn=function(e){return e.SET_SESSION_ID="SET_SESSION_ID",e.SET_P2P_ID="SET_P2P_id",e.SET_DC_ID="SET_DC_id",e.SET_UID="SET_UID",e.SET_INT_UID="SET_INT_UID",e.SET_PUB_ID="SET_PUB_ID",e.SET_CLOUD_PROXY_SERVER_MODE="SET_CLOUD_PROXY_SERVER_MODE",e.KEY_METRIC_CLIENT_CREATED="KEY_METRIC_CLIENT_CREATED",e.KEY_METRIC_JOIN_START="KEY_METRIC_JOIN_START",e.AVOID_JOIN_START="AVOID_JOIN_START",e.KEY_METRIC_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_DESCRIPTION_START="KEY_METRIC_DESCRIPTION_START",e.KEY_METRIC_ICE_CONNECTION_END="KEY_METRIC_ICE_CONNECTION_END",e.KEY_METRIC_SIGNAL_CHANNEL_OPEN="KEY_METRIC_SIGNAL_CHANNEL_OPEN",e.KEY_METRIC_PUBLISH="KEY_METRIC_PUBLISH",e.KEY_METRIC_SUBSCRIBE="KEY_METRIC_SUBSCRIBE",e.RECORD_JOIN_CHANNEL_SERVICE="RECORD_JOIN_CHANNEL_SERVICE",e.RESET_JOIN_CHANNEL_SERVICE_RECORDS="RESET_JOIN_CHANNEL_SERVICE_RECORDS",e.RESET_KEY_METRICS="RESET_KEY_METRICS",e.SET_USE_DATACHANNEL="SET_USE_DATACHANNEL",e.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE",e}(Cn||{});function Nn(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 kn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nn(Object(r),!0).forEach((function(t){Dn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Dn(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var 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:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e.h264="h264",e.h265="h265",e.vp8="vp8",e.vp9="vp9",e.av1="av1"}({}),function(e){e.opus="opus",e.pcma="pcma",e.pcmu="pcmu",e.g722="g722"}({});const Pn=new class extends Fr{constructor(){super(...arguments),Dn(this,"currentUploadLogID",0)}reportLogUploadError(e){const{errorRange:t}=e;t[t.length-1]&&t[t.length-1]>this.currentUploadLogID&&(this.currentUploadLogID=t[t.length-1],this.emit("REPORT_LOG_UPLOAD",e))}};class Ln{constructor(e){Dn(this,"logger",void 0),Dn(this,"prefixLists",[]),this.logger=e}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.debug(...this.prefixLists,...t)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.info(...this.prefixLists,...t)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.warning(...this.prefixLists,...t)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.error(...this.prefixLists,...t)}prefix(e){return this.prefixLists.push(e),this}popPrefix(){return this.prefixLists.pop(),this}}function Mn(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function Un(){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 xn={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},Vn=Date.now(),Fn=e=>{for(const t in xn)if(Object.prototype.hasOwnProperty.call(xn,t)&&xn[t]===e)return t;return"DEFAULT"};const Bn=new class{constructor(){Dn(this,"proxyServerURL",void 0),Dn(this,"logLevel",xn.DEBUG),Dn(this,"uploadState","collecting"),Dn(this,"uploadLogWaitingList",[]),Dn(this,"uploadLogUploadingList",[]),Dn(this,"uploadErrorCount",0),Dn(this,"currentLogID",0),Dn(this,"url",void 0),Dn(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=[xn.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=[xn.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=[xn.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=[xn.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=[xn.DEBUG].concat(t);this.uploadLog.apply(this,n)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){On("UPLOAD_LOG",!0)}disableLogUpload(){On("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new Ln(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()-Vn<100)return void setTimeout((()=>{this.log(...t)}),Date.now()-Vn);const n=Math.max(0,Math.min(4,t[0]));if(t[0]=Mn()+" Agora-SDK [".concat(Fn(n),"]:"),this.appendLogToWaitingList(n,...t),n<this.logLevel)return;const i=Mn()+" %cAgora-SDK [".concat(Fn(n),"]:");let o=[];if(!In("USE_NEW_LOG"))switch(n){case xn.DEBUG:o=[i,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case xn.INFO:o=[i,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case xn.WARNING:o=[i,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case xn.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()-Vn<100)return void setTimeout((()=>{this.uploadLog(...t)}),Date.now()-Vn);const n=Math.max(0,Math.min(4,t[0]));t[0]=Mn()+" Agora-SDK [".concat(Fn(n),"]:"),this.appendLogToWaitingList(n,...t)}appendLogToWaitingList(e){if(!In("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]=Un()+" Agora-SDK [".concat(Fn(e),"]:"):r[0]=Un()+" Agora-SDK [".concat(Fn(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",0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}async uploadLogs(){const e=this.uploadLogUploadingList,t={sdk_version:bn,process_id:In("PROCESS_ID"),payload:JSON.stringify(e)};return gn((async()=>{const e=await qt.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(In("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(In("LOG_UPLOAD_SERVER"),"/upload/v1")),t,{responseType:"text"});if("OK"!==e.data){const t=new Error("unexpected upload log response");throw t.response=e,t}}),(()=>(this.uploadLogUploadingList=[],!1)),(t=>{const r={status:-1,message:t.message,errorRange:e.map((e=>e.log_item_id))};return t.response?(r.status=t.response.status,r.data=t.response.data,r.headers=t.response.headers):t.request&&(r.status=t.request.status),Pn.reportLogUploadError(r),!0}),{timeout:In("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:In("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,In("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),In("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),In("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),In("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}};var jn;(jn={}).FREE="free",jn.UPLOADING="uploading",function(e){e[e.MISC=0]="MISC",e[e.INTERNAL_EVENT=1]="INTERNAL_EVENT",e[e.PUBLIC_EVENT=2]="PUBLIC_EVENT",e[e.WEB_EVENT=3]="WEB_EVENT",e[e.INTERNAL_API=4]="INTERNAL_API",e[e.WEB_API=5]="WEB_API",e[e.PUBLIC_API=6]="PUBLIC_API"}({});const Gn={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let Wn=function(e){return e.PUBLISH="publish",e.SUBSCRIBE="subscribe",e.WS_COMPRESSOR_INIT="ws_compressor_init",e.SESSION_INIT="session_init",e.JOIN_CHOOSE_SERVER="join_choose_server",e.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics",e.PC_STATS="pc_stats",e.UPDATE_REMOTE_RTPCAPABILITIES="update_remote_rtpCapabilities",e}({}),Hn=function(e){return e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_GATEWAY="io.agora.pb.Wrtc.JoinGateway",e.RE_JOIN_GATEWAY="io.agora.pb.Wrtc.ReJoinGateway",e.PUBLISH="io.agora.pb.Wrtc.Publish",e.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",e.WS_COMPRESSOR_INIT="io.agora.pb.Wrtc.WsCompressorInit",e.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",e.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",e.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",e.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",e.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",e.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",e.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",e.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",e.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",e.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",e.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",e.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",e.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",e.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",e.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",e.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",e.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",e.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",e.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",e.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",e.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics",e.AUTOPLAY_FAILED="io.agora.pb.Wrtc.AutoplayFailed",e.PC_STATS="io.agora.pb.Wrtc.PCStats",e.UPDATE_REMOTE_RTPCAPABILITIES="io.agora.pb.Wrtc.UpdateRemoteRTPCapabilities",e}({});!function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}({}),function(e){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"}({});class zn{constructor(){Dn(this,"baseInfoMap",new Map),Dn(this,"proxyServer",void 0),Dn(this,"eventUploadTimer",void 0),Dn(this,"setSessionIdTimer",void 0),Dn(this,"url",void 0),Dn(this,"backupUrl",void 0),Dn(this,"_appId",void 0),Dn(this,"keyEventUploadPendingItems",[]),Dn(this,"normalEventUploadPendingItems",[]),Dn(this,"apiInvokeUploadPendingItems",[]),Dn(this,"apiInvokeCount",0),Dn(this,"ltsList",[]),Dn(this,"lastSendNormalEventTime",Date.now()),Dn(this,"customReportCounterTimer",void 0),Dn(this,"customReportCount",0),Dn(this,"extApiInvoke",(async e=>{for(const t of e){const e=kn(kn({},t),{},{sid:null,invokeId:++this.apiInvokeCount,tag:Hr.TRACER});this.sendApiInvoke(e)}})),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),In("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),In("EVENT_REPORT_SEND_INTERVAL"))}getBaseInfoBySessionId(e){return this.baseInfoMap.get(e)}adjustSessionStartTime(e){if(!this.baseInfoMap.has(e)&&!this.baseInfoMap.get(e))return void Bn.error("adjust session ".concat(e," start time, sid is not exist or info is undefined"));const t=this.baseInfoMap.get(e),r=Date.now(),n=t.startTime;t.startTime=r,Bn.debug("rewrite session ".concat(e," startTime: ").concat(r," , ").concat(r-n,"ms")),this.baseInfoMap.set(e,t)}setAppId(e){this._appId=e}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=()=>({tag:t.tag,invokeId:i,sid:e,name:t.name,apiInvokeTime:n,options:t.options,states:t.states||null}),s=!!In("SHOW_REPORT_INVOKER_LOG");s&&Bn.info("".concat(t.name," start"),t.options);let a=!1;on(t.timeout).then((()=>{a||(this.sendApiInvoke(kn(kn({},o()),{},{error:wr.API_INVOKE_TIMEOUT,success:!1})),Bn.debug("".concat(t.name," timeout")))}));const c=new Cr(wr.UNEXPECTED_ERROR,"".concat(t.name,": this api invoke is end"));return{onSuccess:e=>{const n=()=>{if(a)throw c;return a=!0,this.sendApiInvoke(kn(kn({},o()),{},{success:!0},t.reportResult&&{result:e})),s&&Bn.info("".concat(t.name," onSuccess")),e};return r?dn(n,t.name+"Success",r,(()=>a=!0)):n()},onError:e=>{const n=()=>{if(a)throw e;a=!0,this.sendApiInvoke(kn(kn({},o()),{},{success:!1,error:e})),s&&Bn.info("".concat(t.name," onFailure"),e.toString())};return r?dn(n,t.name+"Error",r,(()=>a=!0)):n()}}}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),n=this.createBaseInfo(e,r);n.cname=t.cname;const i=Object.assign({},{willUploadConsoleLog:In("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:Rn?"global":"oversea",areas:In("AREAS")&&In("AREAS").join(",")},t.extend),{stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientRole:u}=t,l=Date.now(),h=kn(kn({},n),{},{eventType:Wn.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,buildFormat:t.buildFormat,build:"v4.21.0-0-g16fdae2c-dirty(6/3/2024, 2:55:18 PM)",lts:l,elapse:l-r,extend:JSON.stringify(i),mode:t.mode,process:In("PROCESS_ID"),appType:In("APP_TYPE"),success:!0,version:bn,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientType:20,clientRole:u,serviceId:In("PROCESS_ID"),extensionID:In("PLUGIN_INFO").join(",")||"",preload:t.preload?1:0});this.send({type:Hn.SESSION,data:h},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=kn(kn({},n),{},{eventType:Wn.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});this.send({type:Hn.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=kn(kn({},n),{},{eventType:Wn.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:Hn.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(),{firstSuccess:o,avoidJoinStartTime:s,isProxy:a,addr:c}=t,d=i-(o&&s?s:r.startTime),u=kn(kn({},n),{},{eventType:Wn.JOIN_GATEWAY,lts:i,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,elapse:d,eventElapse:i-t.lts,firstSuccess:o,signalChannel:t.signalChannel}),l=u.success?1:0;if(t.succ&&(r.lastJoinSuccessTime=i),o)this.send({type:Hn.JOIN_GATEWAY,data:u},!0);else{let e;if(c)if(a){const t=c.match(/h=(\d{1,3}-){3}\d{1,3}/g),r=c.match(/p=[0-9]{1,6}/g);e={isSuccess:l,gatewayIp:t&&t.length?t[0].split("=")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split("=")[1]:"",isProxy:a?1:0}}else{const t=c.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),r=c.match(/(:|p=)[0-9]{1,6}/g);e={isSuccess:l,gatewayIp:t&&t.length?t[0].split("//")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split(/:|p=/g)[1]:"",isProxy:a?1:0}}else e={isSuccess:l,gatewayIp:"",port:"",isProxy:a?1:0};delete u.success,delete u.eventType,delete u.firstSuccess,u.vid=Number(u.vid);const t=Object.assign({},u,e,{eventType:Wn.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 n=Date.now(),i=kn(kn({},r.info),{},{lts:n,timeout:t,elapse:n-r.startTime});this.send({type:Hn.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=kn(kn({},n),{},{eventType:Wn.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:Hn.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=kn(kn({},i),{},{eventType:Wn.SUBSCRIBE,lts:o,eventElapse:t.eventElapse,elapse:o-n.startTime,success:t.succ,errorCode:t.ec,video:t.video,audio:t.audio,subscribeRequestid:t.subscribeRequestid,p2pid:t.p2pid},r&&{extend:JSON.stringify({isMassSubscribe:!0})});"string"==typeof t.peerid?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",n=this.baseInfoMap.get(r);if(!n)return;const i=n.info,o=Date.now(),s=kn(kn({},i),{},{eventType:Wn.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-n.startTime,status:e.status?1:2});this.send({type:Hn.WS_COMPRESSOR_INIT,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=kn(kn(kn({},o),n),{},{elapse:s-i.startTime,eventType:t,lts:s,firstDecodeFrame:Math.max(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=kn(kn(kn({},o),n),{},{elapse:s-i.startTime,eventType:t,lts:s});this.send({type:r,data:a},!0)}pcStats(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=kn(kn(kn({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),elapse:i-r.startTime,eventType:Wn.PC_STATS,lts:i});this.send({type:Hn.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=kn(kn(kn({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),eventType:Wn.UPDATE_REMOTE_RTPCAPABILITIES,lts:i});this.send({type:Hn.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=kn(kn(kn({},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=kn(kn({},n),{},{eventType:Wn.STREAM_SWITCH,lts:i,isDual:t.isdual,elapse:i-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 n=r.info,i=Date.now(),o=kn(kn({},n),{},{eventType:Wn.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:Hn.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=kn(kn({},n),{},{eventType:Wn.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:Hn.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?Bn.debug("reportProxyServerurl: ".concat(e)):Bn.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=kn(kn({},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:Hn.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=nn(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]=Or(Or({},e),{},{[t]:n.substring(o,c)}),o=c,a=n.charCodeAt(c)<=127?1:3);return o!==n.length-1&&(s[s.length]=Or(Or({},e),{},{[t]:n.substring(o)})),s})(kn(kn(kn({},n),t),{},{elapse:i-r.startTime,lts:i,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 n=r.info,i=Date.now(),o=kn(kn(kn({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:Hn.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=kn(kn(kn({},n),t),{},{elapse:i-r.startTime,lts:i,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 n=r.info,i=Date.now(),o=kn(kn(kn({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:Hn.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>In("CUSTOM_REPORT_LIMIT"))throw new Cr(wr.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((()=>{this.customReportCount=0}),5e3));const r=Date.now(),n=t.map((t=>({type:Hn.USER_ANALYTICS,data:kn(kn({sid:e},t),{},{lts:r})})));try{In("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(n):await this.postDataToStatsCollector(n)}catch(e){throw Bn.error("send custom report message failed",e.toString()),new Cr(wr.CUSTOM_REPORT_SEND_FAILED,e.message)}}sendApiInvoke(e){const t=In("NOT_REPORT_EVENT");if(e.tag&&t.includes&&t.includes(e.tag))return!1;if(null===e.sid)return this.apiInvokeUploadPendingItems.push(e),!1;const r=this.baseInfoMap.get(e.sid);if(!r)return this.apiInvokeUploadPendingItems.push(e),!1;const{cname:n,uid:i,cid:o}=r.info;let s;if(e.lts=e.lts||Date.now(),e.error)if(e.error instanceof Cr){const{code:t,message:r}=e.error;s=t||r||e.error.toString()}else s=e.error.toString();const a={invokeId:e.invokeId,sid:e.sid,cname:n,cid:o,uid:i,lts:e.lts,success:e.success,elapse:e.lts-r.startTime,execElapse:e.lts-e.apiInvokeTime,apiName:e.name,options:e.options?JSON.stringify(e.options):void 0,execStates:e.states?JSON.stringify(e.states):void 0,execResult:e.result?JSON.stringify(e.result):void 0,errorCode:e.error?s:void 0,errorMsg:e.error?JSON.stringify(e.error):void 0};return this.send({type:Hn.API_INVOKE,data:a},!1),!0}appendSessionId(){zn.__CLIENT_LIST__.forEach((e=>{if(e._sessionId){const t=this.apiInvokeUploadPendingItems.length;for(let r=0;r<t;r++){const t=this.apiInvokeUploadPendingItems.shift();t&&(t.sid=e._sessionId,this.sendApiInvoke(Object.assign({},t)))}}}))}send(e,t){if(t)return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0);this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>In("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()),In("ENABLE_EVENT_REPORT")?(r.length&&(In("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{In("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>In("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-In("NORMAL_EVENT_QUEUE_CAPACITY")),Bn.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){Xr.networkState===zr.OFFLINE&&await Promise.race([Xr.onlineWaiter,on(2*En.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(Hn).forEach((r=>{let[n,i]=r;i===e.type&&(t=EventNameToID[n])})),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=Vr(t,new Uint8Array(n)),t=Vr(t,r)})),t},r="event";let n=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(In("NEW_REPORT_SERVER_DOMAINS")[0],"&p=443&d=").concat(r):"https://".concat(In("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(In("NEW_REPORT_SERVER_DOMAINS")[1],"&p=443&d=").concat(r):"https://".concat(In("NEW_REPORT_SERVER_DOMAINS")[1],"/").concat(r));try{await vn(n,{timeout:1e4,data:t(e),headers:kn(kn({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={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:e.map((e=>JSON.stringify(e))),vid:(e=>{const t=e&&e.data.sid&&this.baseInfoMap.get(e.data.sid);return t&&t.info.vid&&+t.info.vid||0})(e[0])};Xr.networkState===zr.OFFLINE&&await Promise.race([Xr.onlineWaiter,on(2*En.maxRetryTimeout)]);const n=t?"/events/proto-raws":"/events/messages";let i=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(In("EVENT_REPORT_DOMAIN"),"&p=").concat(In("STATS_COLLECTOR_PORT"),"&d=").concat(n):"https://".concat(In("EVENT_REPORT_DOMAIN"),":").concat(In("STATS_COLLECTOR_PORT")).concat(n));for(let e=0;e<2;e+=1){1===e&&(i=this.backupUrl||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(In("EVENT_REPORT_BACKUP_DOMAIN"),"&p=").concat(In("STATS_COLLECTOR_PORT"),"&d=").concat(n):"https://".concat(In("EVENT_REPORT_BACKUP_DOMAIN"),":").concat(In("STATS_COLLECTOR_PORT")).concat(n)));try{t?await yn(i,{timeout:1e4,data:r}):await vn(i,{timeout:1e4,data:r})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},Gn);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:Hr.TRACER}).onSuccess()}}function Kn(){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=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];let a=n;if(e.argsMap)try{a=e.argsMap(this,...n)}catch(e){Bn.warning(e),a=[]}try{JSON.stringify(a)}catch(e){Bn.warning("arguments for method ".concat(o,".").concat(String(r)," not serializable for apiInvoke.")),a=[]}const c=(e.report||Yn).reportApiInvoke(this._sessionId||null,{name:"".concat(o,".").concat(String(r)),options:a,tag:Hr.TRACER,reportResult:e.reportResult},e.throttleTime);try{const t=i.apply(this,n);return t instanceof Promise?t.then((t=>(c.onSuccess(e.reportResult&&t),t))).catch((e=>{throw c.onError(e),e})):(c.onSuccess(e.reportResult&&t),t)}catch(e){throw c.onError(e),e}}}return n}}Dn(zn,"__CLIENT_LIST__",[]);const Yn=new zn;Pn.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=Xr.networkState,Yn.reportApiInvoke(null,{name:"logUploadError",options:e,tag:Hr.TRACER}).onSuccess("logUploadError")}));const Jn={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1,supportDataChannel:!1,supportPCSetConfiguration:!1,supportWebRTCEncodedTransform:!1,supportWebRTCInsertableStream:!1,supportRequestVideoFrameCallback:!1,supportWebCrypto:!1};function Zn(){const e=nr();Jn.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),Jn.getStreamFromExtension=e.name===$t.CHROME&&Number(e.version)>34,Jn.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}(),Jn.supportMinBitrate=e.name===$t.CHROME||e.name===$t.EDGE,Jn.supportSetRtpSenderParameters=function(){const e=nr();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!yr()||(!(!dr()&&!ar())||e.name===$t.FIREFOX&&Number(e.version)>=64)}(),e.name===$t.SAFARI&&(Number(e.version)>=14?Jn.supportDualStream=!0:Jn.supportDualStream=!1),Jn.webAudioMediaStreamDest=function(){const e=nr();if(e.name===$t.SAFARI&&Number(e.version)<12)return!1;return!0}(),Jn.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),Jn.supportWebGL="undefined"!=typeof WebGLRenderingContext,Jn.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,yr()||(Jn.webAudioWithAEC=!0),Jn.supportShareAudio=function(){const e=nr();if((e.os===Qt.WIN_10||e.os===Qt.WIN_81||e.os===Qt.WIN_7||e.os===Qt.LINUX||e.os===Qt.MAC_OS||e.os===Qt.CHROMIUM_OS)&&e.name===$t.CHROME&&Number(e.version)>=74)return!0;return!1}(),Jn.supportDataChannel=function(){if(pr(76)||function(e){const t=nr();return!(t.name!==$t.FIREFOX||!t.osVersion)&&Number(t.version)>=e}(68)||function(e){const t=nr();return!(t.name!==$t.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),Jn.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!lr()&&!!e&&e.prototype.setConfiguration instanceof Function}(),Jn.supportWebRTCEncodedTransform=function(){const e=nr();return"Chrome"===e.name&&Number(e.version)>=86||"Safari"===e.name&&Number(e.version)>=15}(),Jn.supportWebRTCInsertableStream=function(){const e=nr();return(e.name===$t.CHROME||e.name===$t.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),Jn.supportRequestVideoFrameCallback=function(){if("requestVideoFrameCallback"in HTMLVideoElement.prototype)return!0;return!1}(),Jn.supportWebCrypto="undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle,Qr((()=>{Jn.supportDualStreamEncoding=function(){const e=nr();if(In("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&In("CHROME_DUAL_STREAM_USE_ENCODING"))}(),Bn.info("browser compatibility",JSON.stringify(Jn),JSON.stringify(e))}))}function Xn(){return Jn}function qn(){return"setSinkId"in HTMLAudioElement.prototype&&(!In("RESTRICTION_SET_PLAYBACK_DEVICE")||(cr()||ur())&&!vr())}let Qn=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 $n=function(e){try{return!!e()}catch(e){return!0}},ei=!$n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),ti=ei,ri=Function.prototype,ni=ri.call,ii=ti&&ri.bind.bind(ni,ni),oi=ti?ii:function(e){return function(){return ni.apply(e,arguments)}},si=oi({}.isPrototypeOf),ai=function(e){return e&&e.Math==Math&&e},ci=ai("object"==typeof globalThis&&globalThis)||ai("object"==typeof window&&window)||ai("object"==typeof self&&self)||ai("object"==typeof J&&J)||function(){return this}()||J||Function("return this")(),di=ei,ui=Function.prototype,li=ui.apply,hi=ui.call,pi="object"==typeof Reflect&&Reflect.apply||(di?hi.bind(li):function(){return hi.apply(li,arguments)}),fi=oi,_i=fi({}.toString),mi=fi("".slice),Ei=function(e){return mi(_i(e),8,-1)},gi=Ei,Ti=oi,Si=function(e){if("Function"===gi(e))return Ti(e)},vi="object"==typeof document&&document.all,yi={all:vi,IS_HTMLDDA:void 0===vi&&void 0!==vi},bi=yi.all,Ri=yi.IS_HTMLDDA?function(e){return"function"==typeof e||e===bi}:function(e){return"function"==typeof e},Ai={},Oi=!$n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Ii=ei,wi=Function.prototype.call,Ci=Ii?wi.bind(wi):function(){return wi.apply(wi,arguments)},Ni={},ki={}.propertyIsEnumerable,Di=Object.getOwnPropertyDescriptor,Pi=Di&&!ki.call({1:2},1);Ni.f=Pi?function(e){var t=Di(this,e);return!!t&&t.enumerable}:ki;var Li,Mi,Ui=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},xi=$n,Vi=Ei,Fi=Object,Bi=oi("".split),ji=xi((function(){return!Fi("z").propertyIsEnumerable(0)}))?function(e){return"String"==Vi(e)?Bi(e,""):Fi(e)}:Fi,Gi=function(e){return null==e},Wi=Gi,Hi=TypeError,zi=function(e){if(Wi(e))throw Hi("Can't call method on "+e);return e},Ki=ji,Yi=zi,Ji=function(e){return Ki(Yi(e))},Zi=Ri,Xi=yi.all,qi=yi.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:Zi(e)||e===Xi}:function(e){return"object"==typeof e?null!==e:Zi(e)},Qi={},$i=Qi,eo=ci,to=Ri,ro=function(e){return to(e)?e:void 0},no=function(e,t){return arguments.length<2?ro($i[e])||ro(eo[e]):$i[e]&&$i[e][t]||eo[e]&&eo[e][t]},io="undefined"!=typeof navigator&&String(navigator.userAgent)||"",oo=ci,so=io,ao=oo.process,co=oo.Deno,uo=ao&&ao.versions||co&&co.version,lo=uo&&uo.v8;lo&&(Mi=(Li=lo.split("."))[0]>0&&Li[0]<4?1:+(Li[0]+Li[1])),!Mi&&so&&(!(Li=so.match(/Edge\/(\d+)/))||Li[1]>=74)&&(Li=so.match(/Chrome\/(\d+)/))&&(Mi=+Li[1]);var ho=Mi,po=ho,fo=$n,_o=ci.String,mo=!!Object.getOwnPropertySymbols&&!fo((function(){var e=Symbol();return!_o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&po&&po<41})),Eo=mo&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,go=no,To=Ri,So=si,vo=Object,yo=Eo?function(e){return"symbol"==typeof e}:function(e){var t=go("Symbol");return To(t)&&So(t.prototype,vo(e))},bo=String,Ro=function(e){try{return bo(e)}catch(e){return"Object"}},Ao=Ri,Oo=Ro,Io=TypeError,wo=function(e){if(Ao(e))return e;throw Io(Oo(e)+" is not a function")},Co=wo,No=Gi,ko=function(e,t){var r=e[t];return No(r)?void 0:Co(r)},Do=Ci,Po=Ri,Lo=qi,Mo=TypeError,Uo={exports:{}},xo=ci,Vo=Object.defineProperty,Fo=function(e,t){try{Vo(xo,e,{value:t,configurable:!0,writable:!0})}catch(r){xo[e]=t}return t},Bo="__core-js_shared__",jo=ci[Bo]||Fo(Bo,{}),Go=jo;(Uo.exports=function(e,t){return Go[e]||(Go[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.31.1",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Wo=Uo.exports,Ho=zi,zo=Object,Ko=function(e){return zo(Ho(e))},Yo=Ko,Jo=oi({}.hasOwnProperty),Zo=Object.hasOwn||function(e,t){return Jo(Yo(e),t)},Xo=oi,qo=0,Qo=Math.random(),$o=Xo(1..toString),es=function(e){return"Symbol("+(void 0===e?"":e)+")_"+$o(++qo+Qo,36)},ts=Wo,rs=Zo,ns=es,is=mo,os=Eo,ss=ci.Symbol,as=ts("wks"),cs=os?ss.for||ss:ss&&ss.withoutSetter||ns,ds=function(e){return rs(as,e)||(as[e]=is&&rs(ss,e)?ss[e]:cs("Symbol."+e)),as[e]},us=Ci,ls=qi,hs=yo,ps=ko,fs=function(e,t){var r,n;if("string"===t&&Po(r=e.toString)&&!Lo(n=Do(r,e)))return n;if(Po(r=e.valueOf)&&!Lo(n=Do(r,e)))return n;if("string"!==t&&Po(r=e.toString)&&!Lo(n=Do(r,e)))return n;throw Mo("Can't convert object to primitive value")},_s=TypeError,ms=ds("toPrimitive"),Es=function(e,t){if(!ls(e)||hs(e))return e;var r,n=ps(e,ms);if(n){if(void 0===t&&(t="default"),r=us(n,e,t),!ls(r)||hs(r))return r;throw _s("Can't convert object to primitive value")}return void 0===t&&(t="number"),fs(e,t)},gs=yo,Ts=function(e){var t=Es(e,"string");return gs(t)?t:t+""},Ss=qi,vs=ci.document,ys=Ss(vs)&&Ss(vs.createElement),bs=function(e){return ys?vs.createElement(e):{}},Rs=bs,As=!Oi&&!$n((function(){return 7!=Object.defineProperty(Rs("div"),"a",{get:function(){return 7}}).a})),Os=Oi,Is=Ci,ws=Ni,Cs=Ui,Ns=Ji,ks=Ts,Ds=Zo,Ps=As,Ls=Object.getOwnPropertyDescriptor;Ai.f=Os?Ls:function(e,t){if(e=Ns(e),t=ks(t),Ps)try{return Ls(e,t)}catch(e){}if(Ds(e,t))return Cs(!Is(ws.f,e,t),e[t])};var Ms=$n,Us=Ri,xs=/#|\.prototype\./,Vs=function(e,t){var r=Bs[Fs(e)];return r==Gs||r!=js&&(Us(t)?Ms(t):!!t)},Fs=Vs.normalize=function(e){return String(e).replace(xs,".").toLowerCase()},Bs=Vs.data={},js=Vs.NATIVE="N",Gs=Vs.POLYFILL="P",Ws=Vs,Hs=wo,zs=ei,Ks=Si(Si.bind),Ys=function(e,t){return Hs(e),void 0===t?e:zs?Ks(e,t):function(){return e.apply(t,arguments)}},Js={},Zs=Oi&&$n((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Xs=qi,qs=String,Qs=TypeError,$s=function(e){if(Xs(e))return e;throw Qs(qs(e)+" is not an object")},ea=Oi,ta=As,ra=Zs,na=$s,ia=Ts,oa=TypeError,sa=Object.defineProperty,aa=Object.getOwnPropertyDescriptor,ca="enumerable",da="configurable",ua="writable";Js.f=ea?ra?function(e,t,r){if(na(e),t=ia(t),na(r),"function"==typeof e&&"prototype"===t&&"value"in r&&ua in r&&!r[ua]){var n=aa(e,t);n&&n[ua]&&(e[t]=r.value,r={configurable:da in r?r[da]:n[da],enumerable:ca in r?r[ca]:n[ca],writable:!1})}return sa(e,t,r)}:sa:function(e,t,r){if(na(e),t=ia(t),na(r),ta)try{return sa(e,t,r)}catch(e){}if("get"in r||"set"in r)throw oa("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var la=Js,ha=Ui,pa=Oi?function(e,t,r){return la.f(e,t,ha(1,r))}:function(e,t,r){return e[t]=r,e},fa=ci,_a=pi,ma=Si,Ea=Ri,ga=Ai.f,Ta=Ws,Sa=Qi,va=Ys,ya=pa,ba=Zo,Ra=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 _a(e,this,arguments)};return t.prototype=e.prototype,t},Aa=function(e,t){var r,n,i,o,s,a,c,d,u,l=e.target,h=e.global,p=e.stat,f=e.proto,_=h?fa:p?fa[l]:(fa[l]||{}).prototype,m=h?Sa:Sa[l]||ya(Sa,l,{})[l],E=m.prototype;for(o in t)n=!(r=Ta(h?o:l+(p?".":"#")+o,e.forced))&&_&&ba(_,o),a=m[o],n&&(c=e.dontCallGetSet?(u=ga(_,o))&&u.value:_[o]),s=n&&c?c:t[o],n&&typeof a==typeof s||(d=e.bind&&n?va(s,fa):e.wrap&&n?Ra(s):f&&Ea(s)?ma(s):s,(e.sham||s&&s.sham||a&&a.sham)&&ya(d,"sham",!0),ya(m,o,d),f&&(ba(Sa,i=l+"Prototype")||ya(Sa,i,{}),ya(Sa[i],o,s),e.real&&E&&(r||!E[o])&&ya(E,o,s)))},Oa=Math.ceil,Ia=Math.floor,wa=Math.trunc||function(e){var t=+e;return(t>0?Ia:Oa)(t)},Ca=wa,Na=function(e){var t=+e;return t!=t||0===t?0:Ca(t)},ka=Na,Da=Math.max,Pa=Math.min,La=function(e,t){var r=ka(e);return r<0?Da(r+t,0):Pa(r,t)},Ma=Na,Ua=Math.min,xa=function(e){return e>0?Ua(Ma(e),9007199254740991):0},Va=function(e){return xa(e.length)},Fa=Ji,Ba=La,ja=Va,Ga=function(e){return function(t,r,n){var i,o=Fa(t),s=ja(o),a=Ba(n,s);if(e&&r!=r){for(;s>a;)if((i=o[a++])!=i)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},Wa={includes:Ga(!0),indexOf:Ga(!1)},Ha=Wa.includes;Aa({target:"Array",proto:!0,forced:$n((function(){return!Array(1).includes()}))},{includes:function(e){return Ha(this,e,arguments.length>1?arguments[1]:void 0)}});var za=Qi,Ka=function(e){return za[e+"Prototype"]},Ya=Ka("Array").includes,Ja=qi,Za=Ei,Xa=ds("match"),qa=function(e){var t;return Ja(e)&&(void 0!==(t=e[Xa])?!!t:"RegExp"==Za(e))},Qa=TypeError,$a={};$a[ds("toStringTag")]="z";var ec="[object z]"===String($a),tc=ec,rc=Ri,nc=Ei,ic=ds("toStringTag"),oc=Object,sc="Arguments"==nc(function(){return arguments}()),ac=tc?nc: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=oc(e),ic))?r:sc?nc(t):"Object"==(n=nc(t))&&rc(t.callee)?"Arguments":n},cc=ac,dc=String,uc=function(e){if("Symbol"===cc(e))throw TypeError("Cannot convert a Symbol value to a string");return dc(e)},lc=ds("match"),hc=Aa,pc=function(e){if(qa(e))throw Qa("The method doesn't accept regular expressions");return e},fc=zi,_c=uc,mc=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[lc]=!1,"/./"[e](t)}catch(e){}}return!1},Ec=oi("".indexOf);hc({target:"String",proto:!0,forced:!mc("includes")},{includes:function(e){return!!~Ec(_c(fc(this)),_c(pc(e)),arguments.length>1?arguments[1]:void 0)}});var gc=Ka("String").includes,Tc=si,Sc=Ya,vc=gc,yc=Array.prototype,bc=String.prototype,Rc=function(e){var t=e.includes;return e===yc||Tc(yc,e)&&t===yc.includes?Sc:"string"==typeof e||e===bc||Tc(bc,e)&&t===bc.includes?vc:t},Ac=Z(Rc);function Oc(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function Ic(e,t,r,n,i){return{width:e,height:t,frameRate:r,bitrateMin:n,bitrateMax:i}}function wc(e,t,r,n,i){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:n,bitrateMax:i}}function Cc(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const Nc={"90p":Ic(160,90),"90p_1":Ic(160,90),"120p":Ic(160,120,15,30,65),"120p_1":Ic(160,120,15,30,65),"120p_3":Ic(120,120,15,30,50),"120p_4":Ic(212,120),"180p":Ic(320,180,15,30,140),"180p_1":Ic(320,180,15,30,140),"180p_3":Ic(180,180,15,30,100),"180p_4":Ic(240,180,15,30,120),"240p":Ic(320,240,15,40,200),"240p_1":Ic(320,240,15,40,200),"240p_3":Ic(240,240,15,40,140),"240p_4":Ic(424,240,15,40,220),"360p":Ic(640,360,15,80,400),"360p_1":Ic(640,360,15,80,400),"360p_3":Ic(360,360,15,80,260),"360p_4":Ic(640,360,30,80,600),"360p_6":Ic(360,360,30,80,400),"360p_7":Ic(480,360,15,80,320),"360p_8":Ic(480,360,30,80,490),"360p_9":Ic(640,360,15,80,800),"360p_10":Ic(640,360,24,80,800),"360p_11":Ic(640,360,24,80,1e3),"480p":Ic(640,480,15,100,500),"480p_1":Ic(640,480,15,100,500),"480p_2":Ic(640,480,30,100,1e3),"480p_3":Ic(480,480,15,100,400),"480p_4":Ic(640,480,30,100,750),"480p_6":Ic(480,480,30,100,600),"480p_8":Ic(848,480,15,100,610),"480p_9":Ic(848,480,30,100,930),"480p_10":Ic(640,480,10,100,400),"720p":Ic(1280,720,15,120,1130),"720p_auto":Ic(1280,720,30,900,3e3),"720p_1":Ic(1280,720,15,120,1130),"720p_2":Ic(1280,720,30,120,2e3),"720p_3":Ic(1280,720,30,120,1710),"720p_5":Ic(960,720,15,120,910),"720p_6":Ic(960,720,30,120,1380),"1080p":Ic(1920,1080,15,120,2080),"1080p_1":Ic(1920,1080,15,120,2080),"1080p_2":Ic(1920,1080,30,120,3e3),"1080p_3":Ic(1920,1080,30,120,3150),"1080p_5":Ic(1920,1080,60,120,4780),"1440p":Ic(2560,1440,30,120,4850),"1440p_1":Ic(2560,1440,30,120,4850),"1440p_2":Ic(2560,1440,60,120,7350),"4k":Ic(3840,2160,30,120,8910),"4k_1":Ic(3840,2160,30,120,8910),"4k_3":Ic(3840,2160,60,120,13500)},kc=[{scaleResolutionDownBy:2,width:1280,height:720,frameRate:30,bitrateMin:300,bitrateMax:900},{scaleResolutionDownBy:1.333333,width:1280,height:720,frameRate:30,bitrateMin:600,bitrateMax:2e3},{scaleResolutionDownBy:1,width:1280,height:720,frameRate:30,bitrateMin:900,bitrateMax:3e3}],Dc={"480p":wc(640,480,5),"480p_1":wc(640,480,5),"480p_2":wc(640,480,30),"480p_3":wc(640,480,15),"720p":wc(1280,720,5),"720p_auto":Ic(1280,720,30,900,3e3),"720p_1":wc(1280,720,5),"720p_2":wc(1280,720,30),"720p_3":wc(1280,720,15),"1080p":wc(1920,1080,5),"1080p_1":wc(1920,1080,5),"1080p_2":wc(1920,1080,30),"1080p_3":wc(1920,1080,15)},Pc={"1SL1TL":Cc(1,1),"3SL3TL":Cc(3,3),"2SL3TL":Cc(2,3)};function Lc(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},Nc[e]):e}function Mc(e){return"string"==typeof e?Object.assign({},Dc[e]):e}function Uc(e){return"string"==typeof e?Object.assign({},Pc[e]):e}const xc={speech_low_quality:Oc(16e3,!1),speech_standard:Oc(32e3,!1,18),music_standard:Oc(48e3,!1),standard_stereo:Oc(48e3,!0,56),high_quality:Oc(48e3,!1,128),high_quality_stereo:Oc(48e3,!0,192)};function Vc(e){return"string"==typeof e?Object.assign({},xc[e]):e}const Fc=[];function Bc(e){Ac(Fc).call(Fc,e)||Fc.push(e)}function jc(e){const t=Fc.indexOf(e);-1!==t&&Fc.splice(t,1)}function Gc(e){return Pr(e.width,"config.width"),Pr(e.height,"config.height"),void 0!==e.frameRate&&Pr(e.frameRate,"config.frameRate"),void 0!==e.bitrateMax&&Dr(e.bitrateMax,"config.bitrateMax"),void 0!==e.bitrateMin&&Dr(e.bitrateMin,"config.bitrateMin"),!0}function Wc(e){return void 0!==e.sampleRate&&Dr(e.sampleRate,"config.sampleRate",0,96e3,!0),void 0!==e.sampleSize&&Dr(e.sampleRate,"config.sampleSize",0,128,!0),void 0!==e.stereo&&Nr(e.stereo,"config.stereo"),void 0!==e.bitrate&&Dr(e.bitrate,"config.bitrate",0,1e4,!1),!0}function Hc(e){return kr(e,"mediaSource",["screen","window","application"]),!0}let zc=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}({}),Kc=function(e){return e.SCREEN_TRACK="screen_track",e.CUSTOM_TRACK="custome_track",e.LOW_STREAM="low_stream",e}({});let Yc=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),Jc=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),Zc=function(e){return e[e.DISABLE=0]="DISABLE",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e}({}),Xc=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}({}),qc=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}({}),Qc=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}({}),$c=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}({}),ed=function(e){return e.UPDATE_TRACK_SOURCE="update-track-source",e}({});const td={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},rd={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},nd={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},id={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 od=function(e){return e.ON_TRACK="on_track",e.ON_NODE="on_node",e}({}),sd=function(e){return e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints",e}({}),ad=function(e){return e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND",e}({}),cd=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}({}),ud=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 hd={exports:{}},pd=Aa,fd=Oi,_d=Js.f;pd({target:"Object",stat:!0,forced:Object.defineProperty!==_d,sham:!fd},{defineProperty:_d});var md=Qi.Object,Ed=hd.exports=function(e,t,r){return md.defineProperty(e,t,r)};md.defineProperty.sham&&(Ed.sham=!0);var gd=Z(hd.exports),Td=Ei,Sd=Array.isArray||function(e){return"Array"==Td(e)},vd=TypeError,yd=Ts,bd=Js,Rd=Ui,Ad=function(e,t,r){var n=yd(t);n in e?bd.f(e,n,Rd(0,r)):e[n]=r},Od=Ri,Id=jo,wd=oi(Function.toString);Od(Id.inspectSource)||(Id.inspectSource=function(e){return wd(e)});var Cd=Id.inspectSource,Nd=oi,kd=$n,Dd=Ri,Pd=ac,Ld=Cd,Md=function(){},Ud=[],xd=no("Reflect","construct"),Vd=/^\s*(?:class|function)\b/,Fd=Nd(Vd.exec),Bd=!Vd.exec(Md),jd=function(e){if(!Dd(e))return!1;try{return xd(Md,Ud,e),!0}catch(e){return!1}},Gd=function(e){if(!Dd(e))return!1;switch(Pd(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Bd||!!Fd(Vd,Ld(e))}catch(e){return!0}};Gd.sham=!0;var Wd=!xd||kd((function(){var e;return jd(jd.call)||!jd(Object)||!jd((function(){e=!0}))||e}))?Gd:jd,Hd=Sd,zd=Wd,Kd=qi,Yd=ds("species"),Jd=Array,Zd=function(e){var t;return Hd(e)&&(t=e.constructor,(zd(t)&&(t===Jd||Hd(t.prototype))||Kd(t)&&null===(t=t[Yd]))&&(t=void 0)),void 0===t?Jd:t},Xd=function(e,t){return new(Zd(e))(0===t?0:t)},qd=$n,Qd=ho,$d=ds("species"),eu=function(e){return Qd>=51||!qd((function(){var t=[];return(t.constructor={})[$d]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},tu=Aa,ru=$n,nu=Sd,iu=qi,ou=Ko,su=Va,au=function(e){if(e>9007199254740991)throw vd("Maximum allowed index exceeded");return e},cu=Ad,du=Xd,uu=eu,lu=ho,hu=ds("isConcatSpreadable"),pu=lu>=51||!ru((function(){var e=[];return e[hu]=!1,e.concat()[0]!==e})),fu=function(e){if(!iu(e))return!1;var t=e[hu];return void 0!==t?!!t:nu(e)};tu({target:"Array",proto:!0,arity:1,forced:!pu||!uu("concat")},{concat:function(e){var t,r,n,i,o,s=ou(this),a=du(s,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(fu(o=-1===t?s:arguments[t]))for(i=su(o),au(c+i),r=0;r<i;r++,c++)r in o&&cu(a,c,o[r]);else au(c+1),cu(a,c++,o);return a.length=c,a}});var _u={},mu={},Eu=Zo,gu=Ji,Tu=Wa.indexOf,Su=mu,vu=oi([].push),yu=function(e,t){var r,n=gu(e),i=0,o=[];for(r in n)!Eu(Su,r)&&Eu(n,r)&&vu(o,r);for(;t.length>i;)Eu(n,r=t[i++])&&(~Tu(o,r)||vu(o,r));return o},bu=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ru=yu,Au=bu,Ou=Object.keys||function(e){return Ru(e,Au)},Iu=Oi,wu=Zs,Cu=Js,Nu=$s,ku=Ji,Du=Ou;_u.f=Iu&&!wu?Object.defineProperties:function(e,t){Nu(e);for(var r,n=ku(t),i=Du(t),o=i.length,s=0;o>s;)Cu.f(e,r=i[s++],n[r]);return e};var Pu,Lu=no("document","documentElement"),Mu=es,Uu=Wo("keys"),xu=function(e){return Uu[e]||(Uu[e]=Mu(e))},Vu=$s,Fu=_u,Bu=bu,ju=mu,Gu=Lu,Wu=bs,Hu="prototype",zu="script",Ku=xu("IE_PROTO"),Yu=function(){},Ju=function(e){return"<"+zu+">"+e+"</"+zu+">"},Zu=function(e){e.write(Ju("")),e.close();var t=e.parentWindow.Object;return e=null,t},Xu=function(){try{Pu=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Xu="undefined"!=typeof document?document.domain&&Pu?Zu(Pu):(t=Wu("iframe"),r="java"+zu+":",t.style.display="none",Gu.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(Ju("document.F=Object")),e.close(),e.F):Zu(Pu);for(var n=Bu.length;n--;)delete Xu[Hu][Bu[n]];return Xu()};ju[Ku]=!0;var qu=Object.create||function(e,t){var r;return null!==e?(Yu[Hu]=Vu(e),r=new Yu,Yu[Hu]=null,r[Ku]=e):r=Xu(),void 0===t?r:Fu.f(r,t)},Qu={},$u=yu,el=bu.concat("length","prototype");Qu.f=Object.getOwnPropertyNames||function(e){return $u(e,el)};var tl={},rl=La,nl=Va,il=Ad,ol=Array,sl=Math.max,al=function(e,t,r){for(var n=nl(e),i=rl(t,n),o=rl(void 0===r?n:r,n),s=ol(sl(o-i,0)),a=0;i<o;i++,a++)il(s,a,e[i]);return s.length=a,s},cl=Ei,dl=Ji,ul=Qu.f,ll=al,hl="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];tl.f=function(e){return hl&&"Window"==cl(e)?function(e){try{return ul(e)}catch(e){return ll(hl)}}(e):ul(dl(e))};var pl={};pl.f=Object.getOwnPropertySymbols;var fl=pa,_l=function(e,t,r,n){return n&&n.enumerable?e[t]=r:fl(e,t,r),e},ml=Js,El=function(e,t,r){return ml.f(e,t,r)},gl={},Tl=ds;gl.f=Tl;var Sl,vl,yl,bl=Qi,Rl=Zo,Al=gl,Ol=Js.f,Il=function(e){var t=bl.Symbol||(bl.Symbol={});Rl(t,e)||Ol(t,e,{value:Al.f(e)})},wl=Ci,Cl=no,Nl=ds,kl=_l,Dl=function(){var e=Cl("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=Nl("toPrimitive");t&&!t[n]&&kl(t,n,(function(e){return wl(r,this)}),{arity:1})},Pl=ac,Ll=ec?{}.toString:function(){return"[object "+Pl(this)+"]"},Ml=ec,Ul=Js.f,xl=pa,Vl=Zo,Fl=Ll,Bl=ds("toStringTag"),jl=function(e,t,r,n){if(e){var i=r?e:e.prototype;Vl(i,Bl)||Ul(i,Bl,{configurable:!0,value:t}),n&&!Ml&&xl(i,"toString",Fl)}},Gl=Ri,Wl=ci.WeakMap,Hl=Gl(Wl)&&/native code/.test(String(Wl)),zl=ci,Kl=qi,Yl=pa,Jl=Zo,Zl=jo,Xl=xu,ql=mu,Ql="Object already initialized",$l=zl.TypeError,eh=zl.WeakMap;if(Hl||Zl.state){var th=Zl.state||(Zl.state=new eh);th.get=th.get,th.has=th.has,th.set=th.set,Sl=function(e,t){if(th.has(e))throw $l(Ql);return t.facade=e,th.set(e,t),t},vl=function(e){return th.get(e)||{}},yl=function(e){return th.has(e)}}else{var rh=Xl("state");ql[rh]=!0,Sl=function(e,t){if(Jl(e,rh))throw $l(Ql);return t.facade=e,Yl(e,rh,t),t},vl=function(e){return Jl(e,rh)?e[rh]:{}},yl=function(e){return Jl(e,rh)}}var nh={set:Sl,get:vl,has:yl,enforce:function(e){return yl(e)?vl(e):Sl(e,{})},getterFor:function(e){return function(t){var r;if(!Kl(t)||(r=vl(t)).type!==e)throw $l("Incompatible receiver, "+e+" required");return r}}},ih=Ys,oh=ji,sh=Ko,ah=Va,ch=Xd,dh=oi([].push),uh=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,d,u,l){for(var h,p,f=sh(c),_=oh(f),m=ih(d,u),E=ah(_),g=0,T=l||ch,S=t?T(c,E):r||s?T(c,0):void 0;E>g;g++)if((a||g in _)&&(p=m(h=_[g],g,f),e))if(t)S[g]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:dh(S,h)}else switch(e){case 4:return!1;case 7:dh(S,h)}return o?-1:n||i?i:S}},lh={forEach:uh(0),map:uh(1),filter:uh(2),some:uh(3),every:uh(4),find:uh(5),findIndex:uh(6),filterReject:uh(7)},hh=Aa,ph=ci,fh=Ci,_h=oi,mh=Oi,Eh=mo,gh=$n,Th=Zo,Sh=si,vh=$s,yh=Ji,bh=Ts,Rh=uc,Ah=Ui,Oh=qu,Ih=Ou,wh=Qu,Ch=tl,Nh=pl,kh=Ai,Dh=Js,Ph=_u,Lh=Ni,Mh=_l,Uh=El,xh=Wo,Vh=mu,Fh=es,Bh=ds,jh=gl,Gh=Il,Wh=Dl,Hh=jl,zh=nh,Kh=lh.forEach,Yh=xu("hidden"),Jh="Symbol",Zh="prototype",Xh=zh.set,qh=zh.getterFor(Jh),Qh=Object[Zh],$h=ph.Symbol,ep=$h&&$h[Zh],tp=ph.TypeError,rp=ph.QObject,np=kh.f,ip=Dh.f,op=Ch.f,sp=Lh.f,ap=_h([].push),cp=xh("symbols"),dp=xh("op-symbols"),up=xh("wks"),lp=!rp||!rp[Zh]||!rp[Zh].findChild,hp=mh&&gh((function(){return 7!=Oh(ip({},"a",{get:function(){return ip(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=np(Qh,t);n&&delete Qh[t],ip(e,t,r),n&&e!==Qh&&ip(Qh,t,n)}:ip,pp=function(e,t){var r=cp[e]=Oh(ep);return Xh(r,{type:Jh,tag:e,description:t}),mh||(r.description=t),r},fp=function(e,t,r){e===Qh&&fp(dp,t,r),vh(e);var n=bh(t);return vh(r),Th(cp,n)?(r.enumerable?(Th(e,Yh)&&e[Yh][n]&&(e[Yh][n]=!1),r=Oh(r,{enumerable:Ah(0,!1)})):(Th(e,Yh)||ip(e,Yh,Ah(1,{})),e[Yh][n]=!0),hp(e,n,r)):ip(e,n,r)},_p=function(e,t){vh(e);var r=yh(t),n=Ih(r).concat(Tp(r));return Kh(n,(function(t){mh&&!fh(mp,r,t)||fp(e,t,r[t])})),e},mp=function(e){var t=bh(e),r=fh(sp,this,t);return!(this===Qh&&Th(cp,t)&&!Th(dp,t))&&(!(r||!Th(this,t)||!Th(cp,t)||Th(this,Yh)&&this[Yh][t])||r)},Ep=function(e,t){var r=yh(e),n=bh(t);if(r!==Qh||!Th(cp,n)||Th(dp,n)){var i=np(r,n);return!i||!Th(cp,n)||Th(r,Yh)&&r[Yh][n]||(i.enumerable=!0),i}},gp=function(e){var t=op(yh(e)),r=[];return Kh(t,(function(e){Th(cp,e)||Th(Vh,e)||ap(r,e)})),r},Tp=function(e){var t=e===Qh,r=op(t?dp:yh(e)),n=[];return Kh(r,(function(e){!Th(cp,e)||t&&!Th(Qh,e)||ap(n,cp[e])})),n};Eh||($h=function(){if(Sh(ep,this))throw tp("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Rh(arguments[0]):void 0,t=Fh(e),r=function(e){this===Qh&&fh(r,dp,e),Th(this,Yh)&&Th(this[Yh],t)&&(this[Yh][t]=!1),hp(this,t,Ah(1,e))};return mh&&lp&&hp(Qh,t,{configurable:!0,set:r}),pp(t,e)},Mh(ep=$h[Zh],"toString",(function(){return qh(this).tag})),Mh($h,"withoutSetter",(function(e){return pp(Fh(e),e)})),Lh.f=mp,Dh.f=fp,Ph.f=_p,kh.f=Ep,wh.f=Ch.f=gp,Nh.f=Tp,jh.f=function(e){return pp(Bh(e),e)},mh&&Uh(ep,"description",{configurable:!0,get:function(){return qh(this).description}})),hh({global:!0,constructor:!0,wrap:!0,forced:!Eh,sham:!Eh},{Symbol:$h}),Kh(Ih(up),(function(e){Gh(e)})),hh({target:Jh,stat:!0,forced:!Eh},{useSetter:function(){lp=!0},useSimple:function(){lp=!1}}),hh({target:"Object",stat:!0,forced:!Eh,sham:!mh},{create:function(e,t){return void 0===t?Oh(e):_p(Oh(e),t)},defineProperty:fp,defineProperties:_p,getOwnPropertyDescriptor:Ep}),hh({target:"Object",stat:!0,forced:!Eh},{getOwnPropertyNames:gp}),Wh(),Hh($h,Jh),Vh[Yh]=!0;var Sp=mo&&!!Symbol.for&&!!Symbol.keyFor,vp=Aa,yp=no,bp=Zo,Rp=uc,Ap=Wo,Op=Sp,Ip=Ap("string-to-symbol-registry"),wp=Ap("symbol-to-string-registry");vp({target:"Symbol",stat:!0,forced:!Op},{for:function(e){var t=Rp(e);if(bp(Ip,t))return Ip[t];var r=yp("Symbol")(t);return Ip[t]=r,wp[r]=t,r}});var Cp=Aa,Np=Zo,kp=yo,Dp=Ro,Pp=Sp,Lp=Wo("symbol-to-string-registry");Cp({target:"Symbol",stat:!0,forced:!Pp},{keyFor:function(e){if(!kp(e))throw TypeError(Dp(e)+" is not a symbol");if(Np(Lp,e))return Lp[e]}});var Mp=oi([].slice),Up=Sd,xp=Ri,Vp=Ei,Fp=uc,Bp=oi([].push),jp=Aa,Gp=no,Wp=pi,Hp=Ci,zp=oi,Kp=$n,Yp=Ri,Jp=yo,Zp=Mp,Xp=function(e){if(xp(e))return e;if(Up(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?Bp(r,i):"number"!=typeof i&&"Number"!=Vp(i)&&"String"!=Vp(i)||Bp(r,Fp(i))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(Up(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}},qp=mo,Qp=String,$p=Gp("JSON","stringify"),ef=zp(/./.exec),tf=zp("".charAt),rf=zp("".charCodeAt),nf=zp("".replace),of=zp(1..toString),sf=/[\uD800-\uDFFF]/g,af=/^[\uD800-\uDBFF]$/,cf=/^[\uDC00-\uDFFF]$/,df=!qp||Kp((function(){var e=Gp("Symbol")();return"[null]"!=$p([e])||"{}"!=$p({a:e})||"{}"!=$p(Object(e))})),uf=Kp((function(){return'"\\udf06\\ud834"'!==$p("\udf06\ud834")||'"\\udead"'!==$p("\udead")})),lf=function(e,t){var r=Zp(arguments),n=Xp(t);if(Yp(n)||void 0!==e&&!Jp(e))return r[1]=function(e,t){if(Yp(n)&&(t=Hp(n,this,Qp(e),t)),!Jp(t))return t},Wp($p,null,r)},hf=function(e,t,r){var n=tf(r,t-1),i=tf(r,t+1);return ef(af,e)&&!ef(cf,i)||ef(cf,e)&&!ef(af,n)?"\\u"+of(rf(e,0),16):e};$p&&jp({target:"JSON",stat:!0,arity:3,forced:df||uf},{stringify:function(e,t,r){var n=Zp(arguments),i=Wp(df?lf:$p,null,n);return uf&&"string"==typeof i?nf(i,sf,hf):i}});var pf=pl,ff=Ko;Aa({target:"Object",stat:!0,forced:!mo||$n((function(){pf.f(1)}))},{getOwnPropertySymbols:function(e){var t=pf.f;return t?t(ff(e)):[]}}),Il("asyncIterator"),Il("hasInstance"),Il("isConcatSpreadable"),Il("iterator"),Il("match"),Il("matchAll"),Il("replace"),Il("search"),Il("species"),Il("split");var _f=Dl;Il("toPrimitive"),_f();var mf=no,Ef=jl;Il("toStringTag"),Ef(mf("Symbol"),"Symbol"),Il("unscopables"),jl(ci.JSON,"JSON",!0);var gf,Tf,Sf,vf=Qi.Symbol,yf={},bf=Oi,Rf=Zo,Af=Function.prototype,Of=bf&&Object.getOwnPropertyDescriptor,If=Rf(Af,"name"),wf={EXISTS:If,PROPER:If&&"something"===function(){}.name,CONFIGURABLE:If&&(!bf||bf&&Of(Af,"name").configurable)},Cf=!$n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Nf=Zo,kf=Ri,Df=Ko,Pf=Cf,Lf=xu("IE_PROTO"),Mf=Object,Uf=Mf.prototype,xf=Pf?Mf.getPrototypeOf:function(e){var t=Df(e);if(Nf(t,Lf))return t[Lf];var r=t.constructor;return kf(r)&&t instanceof r?r.prototype:t instanceof Mf?Uf:null},Vf=$n,Ff=Ri,Bf=qi,jf=qu,Gf=xf,Wf=_l,Hf=ds("iterator"),zf=!1;[].keys&&("next"in(Sf=[].keys())?(Tf=Gf(Gf(Sf)))!==Object.prototype&&(gf=Tf):zf=!0);var Kf=!Bf(gf)||Vf((function(){var e={};return gf[Hf].call(e)!==e}));Ff((gf=Kf?{}:jf(gf))[Hf])||Wf(gf,Hf,(function(){return this}));var Yf={IteratorPrototype:gf,BUGGY_SAFARI_ITERATORS:zf},Jf=Yf.IteratorPrototype,Zf=qu,Xf=Ui,qf=jl,Qf=yf,$f=function(){return this},e_=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Zf(Jf,{next:Xf(+!n,r)}),qf(e,i,!1,!0),Qf[i]=$f,e},t_=oi,r_=wo,n_=Ri,i_=String,o_=TypeError,s_=function(e,t,r){try{return t_(r_(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},a_=$s,c_=function(e){if("object"==typeof e||n_(e))return e;throw o_("Can't set "+i_(e)+" as a prototype")},d_=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=s_(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return a_(r),c_(n),t?e(r,n):r.__proto__=n,r}}():void 0),u_=Aa,l_=Ci,h_=wf,p_=e_,f_=xf,__=jl,m_=_l,E_=yf,g_=Yf,T_=h_.PROPER,S_=g_.BUGGY_SAFARI_ITERATORS,v_=ds("iterator"),y_="keys",b_="values",R_="entries",A_=function(){return this},O_=function(e,t,r,n,i,o,s){p_(r,t,n);var a,c,d,u=function(e){if(e===i&&_)return _;if(!S_&&e in p)return p[e];switch(e){case y_:case b_:case R_:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[v_]||p["@@iterator"]||i&&p[i],_=!S_&&f||u(i),m="Array"==t&&p.entries||f;if(m&&(a=f_(m.call(new e)))!==Object.prototype&&a.next&&(__(a,l,!0,!0),E_[l]=A_),T_&&i==b_&&f&&f.name!==b_&&(h=!0,_=function(){return l_(f,this)}),i)if(c={values:u(b_),keys:o?_:u(y_),entries:u(R_)},s)for(d in c)(S_||h||!(d in p))&&m_(p,d,c[d]);else u_({target:t,proto:!0,forced:S_||h},c);return s&&p[v_]!==_&&m_(p,v_,_,{name:i}),E_[t]=_,c},I_=function(e,t){return{value:e,done:t}},w_=Ji,C_=yf,N_=nh;Js.f;var k_=O_,D_=I_,P_="Array Iterator",L_=N_.set,M_=N_.getterFor(P_);k_(Array,"Array",(function(e,t){L_(this,{type:P_,target:w_(e),index:0,kind:t})}),(function(){var e=M_(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,D_(void 0,!0)):D_("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),C_.Arguments=C_.Array;var U_={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},x_=ci,V_=ac,F_=pa,B_=yf,j_=ds("toStringTag");for(var G_ in U_){var W_=x_[G_],H_=W_&&W_.prototype;H_&&V_(H_)!==j_&&F_(H_,j_,G_),B_[G_]=B_.Array}var z_=vf,K_=ds,Y_=Js.f,J_=K_("metadata"),Z_=Function.prototype;void 0===Z_[J_]&&Y_(Z_,J_,{value:null}),Il("dispose"),Il("metadata");var X_=z_;Il("asyncDispose");var q_=oi,Q_=no("Symbol"),$_=Q_.keyFor,em=q_(Q_.prototype.valueOf),tm=Q_.isRegisteredSymbol||function(e){try{return void 0!==$_(em(e))}catch(e){return!1}};Aa({target:"Symbol",stat:!0},{isRegisteredSymbol:tm});for(var rm=Wo,nm=no,im=oi,om=yo,sm=ds,am=nm("Symbol"),cm=am.isWellKnownSymbol,dm=nm("Object","getOwnPropertyNames"),um=im(am.prototype.valueOf),lm=rm("wks"),hm=0,pm=dm(am),fm=pm.length;hm<fm;hm++)try{var _m=pm[hm];om(am[_m])&&sm(_m)}catch(e){}var mm=function(e){if(cm&&cm(e))return!0;try{for(var t=um(e),r=0,n=dm(lm),i=n.length;r<i;r++)if(lm[n[r]]==t)return!0}catch(e){}return!1};Aa({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:mm}),Il("matcher"),Il("observable"),Aa({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:tm}),Aa({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:mm}),Il("metadataKey"),Il("patternMatch"),Il("replaceAll");var Em=Z(X_),gm=oi,Tm=Na,Sm=uc,vm=zi,ym=gm("".charAt),bm=gm("".charCodeAt),Rm=gm("".slice),Am=function(e){return function(t,r){var n,i,o=Sm(vm(t)),s=Tm(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=bm(o,s))<55296||n>56319||s+1===a||(i=bm(o,s+1))<56320||i>57343?e?ym(o,s):n:e?Rm(o,s,s+2):i-56320+(n-55296<<10)+65536}},Om={codeAt:Am(!1),charAt:Am(!0)},Im=Om.charAt,wm=uc,Cm=nh,Nm=O_,km=I_,Dm="String Iterator",Pm=Cm.set,Lm=Cm.getterFor(Dm);Nm(String,"String",(function(e){Pm(this,{type:Dm,string:wm(e),index:0})}),(function(){var e,t=Lm(this),r=t.string,n=t.index;return n>=r.length?km(void 0,!0):(e=Im(r,n),t.index+=e.length,km(e,!1))}));var Mm=Z(gl.f("iterator"));function Um(e){return Um="function"==typeof Em&&"symbol"==typeof Mm?function(e){return typeof e}:function(e){return e&&"function"==typeof Em&&e.constructor===Em&&e!==Em.prototype?"symbol":typeof e},Um(e)}var xm=Z(gl.f("toPrimitive"));function Vm(e){var t=function(e,t){if("object"!==Um(e)||null===e)return e;var r=e[xm];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Um(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Um(t)?t:String(t)}function Fm(e,t,r){return(t=Vm(t))in e?gd(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Bm=$n,jm=function(e,t){var r=[][e];return!!r&&Bm((function(){r.call(null,t||function(){return 1},1)}))},Gm=lh.forEach,Wm=jm("forEach")?[].forEach:function(e){return Gm(this,e,arguments.length>1?arguments[1]:void 0)};Aa({target:"Array",proto:!0,forced:[].forEach!=Wm},{forEach:Wm});var Hm=Ka("Array").forEach,zm=ac,Km=Zo,Ym=si,Jm=Hm,Zm=Array.prototype,Xm={DOMTokenList:!0,NodeList:!0},qm=function(e){var t=e.forEach;return e===Zm||Ym(Zm,e)&&t===Zm.forEach||Km(Xm,zm(e))?Jm:t},Qm=Z(qm),$m=Ko,eE=Ou;Aa({target:"Object",stat:!0,forced:$n((function(){eE(1)}))},{keys:function(e){return eE($m(e))}});var tE=Z(Qi.Object.keys),rE=wo,nE=Ko,iE=ji,oE=Va,sE=TypeError,aE=function(e){return function(t,r,n,i){rE(r);var o=nE(t),s=iE(o),a=oE(o),c=e?a-1:0,d=e?-1:1;if(n<2)for(;;){if(c in s){i=s[c],c+=d;break}if(c+=d,e?c<0:a<=c)throw sE("Reduce of empty array with no initial value")}for(;e?c>=0:a>c;c+=d)c in s&&(i=r(i,s[c],c,o));return i}},cE={left:aE(!1),right:aE(!0)},dE="undefined"!=typeof process&&"process"==Ei(process),uE=cE.left;Aa({target:"Array",proto:!0,forced:!dE&&ho>79&&ho<83||!jm("reduce")},{reduce:function(e){var t=arguments.length;return uE(this,e,t,t>1?arguments[1]:void 0)}});var lE=Ka("Array").reduce,hE=si,pE=lE,fE=Array.prototype,_E=function(e){var t=e.reduce;return e===fE||hE(fE,e)&&t===fE.reduce?pE:t},mE=_E,EE=Z(mE),gE=Aa,TE=Sd,SE=oi([].reverse),vE=[1,2];gE({target:"Array",proto:!0,forced:String(vE)===String(vE.reverse())},{reverse:function(){return TE(this)&&(this.length=this.length),SE(this)}});var yE=Ka("Array").reverse,bE=si,RE=yE,AE=Array.prototype,OE=function(e){var t=e.reverse;return e===AE||bE(AE,e)&&t===AE.reverse?RE:t},IE=Z(OE),wE=Aa,CE=Sd,NE=Wd,kE=qi,DE=La,PE=Va,LE=Ji,ME=Ad,UE=ds,xE=Mp,VE=eu("slice"),FE=UE("species"),BE=Array,jE=Math.max;wE({target:"Array",proto:!0,forced:!VE},{slice:function(e,t){var r,n,i,o=LE(this),s=PE(o),a=DE(e,s),c=DE(void 0===t?s:t,s);if(CE(o)&&(r=o.constructor,(NE(r)&&(r===BE||CE(r.prototype))||kE(r)&&null===(r=r[FE]))&&(r=void 0),r===BE||void 0===r))return xE(o,a,c);for(n=new(void 0===r?BE:r)(jE(c-a,0)),i=0;a<c;a++,i++)a in o&&ME(n,i,o[a]);return n.length=i,n}});var GE=Ka("Array").slice,WE=si,HE=GE,zE=Array.prototype,KE=function(e){var t=e.slice;return e===zE||WE(zE,e)&&t===zE.slice?HE:t},YE=Z(KE);function JE(e,t,r,n,i){var o,s,a,c={};return Qm(o=tE(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=EE(s=IE(a=YE(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&&(gd(e,t,c),c=null),c}var ZE=no,XE=Qu,qE=pl,QE=$s,$E=oi([].concat),eg=ZE("Reflect","ownKeys")||function(e){var t=XE.f(QE(e)),r=qE.f;return r?$E(t,r(e)):t},tg=Zo,rg=eg,ng=Ai,ig=Js,og=qi,sg=pa,ag=Error,cg=oi("".replace),dg=String(ag("zxcasd").stack),ug=/\n\s*at [^:]*:[^\n]*/,lg=ug.test(dg),hg=Ui,pg=!$n((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",hg(1,7)),7!==e.stack)})),fg=pa,_g=function(e,t){if(lg&&"string"==typeof e&&!ag.prepareStackTrace)for(;t--;)e=cg(e,ug,"");return e},mg=pg,Eg=Error.captureStackTrace,gg=yf,Tg=ds("iterator"),Sg=Array.prototype,vg=function(e){return void 0!==e&&(gg.Array===e||Sg[Tg]===e)},yg=ac,bg=ko,Rg=Gi,Ag=yf,Og=ds("iterator"),Ig=function(e){if(!Rg(e))return bg(e,Og)||bg(e,"@@iterator")||Ag[yg(e)]},wg=Ci,Cg=wo,Ng=$s,kg=Ro,Dg=Ig,Pg=TypeError,Lg=function(e,t){var r=arguments.length<2?Dg(e):t;if(Cg(r))return Ng(wg(r,e));throw Pg(kg(e)+" is not iterable")},Mg=Ci,Ug=$s,xg=ko,Vg=function(e,t,r){var n,i;Ug(e);try{if(!(n=xg(e,"return"))){if("throw"===t)throw r;return r}n=Mg(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return Ug(n),r},Fg=Ys,Bg=Ci,jg=$s,Gg=Ro,Wg=vg,Hg=Va,zg=si,Kg=Lg,Yg=Ig,Jg=Vg,Zg=TypeError,Xg=function(e,t){this.stopped=e,this.result=t},qg=Xg.prototype,Qg=function(e,t,r){var n,i,o,s,a,c,d,u=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),_=Fg(t,u),m=function(e){return n&&Jg(n,"normal",e),new Xg(!0,e)},E=function(e){return l?(jg(e),f?_(e[0],e[1],m):_(e[0],e[1])):f?_(e,m):_(e)};if(h)n=e.iterator;else if(p)n=e;else{if(!(i=Yg(e)))throw Zg(Gg(e)+" is not iterable");if(Wg(i)){for(o=0,s=Hg(e);s>o;o++)if((a=E(e[o]))&&zg(qg,a))return a;return new Xg(!1)}n=Kg(e,i)}for(c=h?e.next:n.next;!(d=Bg(c,n)).done;){try{a=E(d.value)}catch(e){Jg(n,"throw",e)}if("object"==typeof a&&a&&zg(qg,a))return a}return new Xg(!1)},$g=uc,eT=Aa,tT=si,rT=xf,nT=d_,iT=function(e,t,r){for(var n=rg(t),i=ig.f,o=ng.f,s=0;s<n.length;s++){var a=n[s];tg(e,a)||r&&tg(r,a)||i(e,a,o(t,a))}},oT=qu,sT=pa,aT=Ui,cT=function(e,t){og(t)&&"cause"in t&&sg(e,"cause",t.cause)},dT=function(e,t,r,n){mg&&(Eg?Eg(e,t):fg(e,"stack",_g(r,n)))},uT=Qg,lT=function(e,t){return void 0===e?arguments.length<2?"":t:$g(e)},hT=ds("toStringTag"),pT=Error,fT=[].push,_T=function(e,t){var r,n=tT(mT,this);nT?r=nT(pT(),n?rT(this):mT):(r=n?this:oT(mT),sT(r,hT,"Error")),void 0!==t&&sT(r,"message",lT(t)),dT(r,_T,r.stack,1),arguments.length>2&&cT(r,arguments[2]);var i=[];return uT(e,fT,{that:i}),sT(r,"errors",i),r};nT?nT(_T,pT):iT(_T,pT,{name:!0});var mT=_T.prototype=oT(pT.prototype,{constructor:aT(1,_T),message:aT(1,""),name:aT(1,"AggregateError")});eT({global:!0,constructor:!0,arity:2},{AggregateError:_T});var ET,gT,TT,ST,vT=no,yT=El,bT=Oi,RT=ds("species"),AT=si,OT=TypeError,IT=function(e,t){if(AT(t,e))return e;throw OT("Incorrect invocation")},wT=Wd,CT=Ro,NT=TypeError,kT=$s,DT=function(e){if(wT(e))return e;throw NT(CT(e)+" is not a constructor")},PT=Gi,LT=ds("species"),MT=function(e,t){var r,n=kT(e).constructor;return void 0===n||PT(r=kT(n)[LT])?t:DT(r)},UT=TypeError,xT=function(e,t){if(e<t)throw UT("Not enough arguments");return e},VT=/(?:ipad|iphone|ipod).*applewebkit/i.test(io),FT=ci,BT=pi,jT=Ys,GT=Ri,WT=Zo,HT=$n,zT=Lu,KT=Mp,YT=bs,JT=xT,ZT=VT,XT=dE,qT=FT.setImmediate,QT=FT.clearImmediate,$T=FT.process,eS=FT.Dispatch,tS=FT.Function,rS=FT.MessageChannel,nS=FT.String,iS=0,oS={},sS="onreadystatechange";HT((function(){ET=FT.location}));var aS=function(e){if(WT(oS,e)){var t=oS[e];delete oS[e],t()}},cS=function(e){return function(){aS(e)}},dS=function(e){aS(e.data)},uS=function(e){FT.postMessage(nS(e),ET.protocol+"//"+ET.host)};qT&&QT||(qT=function(e){JT(arguments.length,1);var t=GT(e)?e:tS(e),r=KT(arguments,1);return oS[++iS]=function(){BT(t,void 0,r)},gT(iS),iS},QT=function(e){delete oS[e]},XT?gT=function(e){$T.nextTick(cS(e))}:eS&&eS.now?gT=function(e){eS.now(cS(e))}:rS&&!ZT?(ST=(TT=new rS).port2,TT.port1.onmessage=dS,gT=jT(ST.postMessage,ST)):FT.addEventListener&&GT(FT.postMessage)&&!FT.importScripts&&ET&&"file:"!==ET.protocol&&!HT(uS)?(gT=uS,FT.addEventListener("message",dS,!1)):gT=sS in YT("script")?function(e){zT.appendChild(YT("script"))[sS]=function(){zT.removeChild(this),aS(e)}}:function(e){setTimeout(cS(e),0)});var lS={set:qT,clear:QT},hS=function(){this.head=null,this.tail=null};hS.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 pS,fS,_S,mS,ES,gS=hS,TS=/ipad|iphone|ipod/i.test(io)&&"undefined"!=typeof Pebble,SS=/web0s(?!.*chrome)/i.test(io),vS=ci,yS=Ys,bS=Ai.f,RS=lS.set,AS=gS,OS=VT,IS=TS,wS=SS,CS=dE,NS=vS.MutationObserver||vS.WebKitMutationObserver,kS=vS.document,DS=vS.process,PS=vS.Promise,LS=bS(vS,"queueMicrotask"),MS=LS&&LS.value;if(!MS){var US=new AS,xS=function(){var e,t;for(CS&&(e=DS.domain)&&e.exit();t=US.get();)try{t()}catch(e){throw US.head&&pS(),e}e&&e.enter()};OS||CS||wS||!NS||!kS?!IS&&PS&&PS.resolve?((mS=PS.resolve(void 0)).constructor=PS,ES=yS(mS.then,mS),pS=function(){ES(xS)}):CS?pS=function(){DS.nextTick(xS)}:(RS=yS(RS,vS),pS=function(){RS(xS)}):(fS=!0,_S=kS.createTextNode(""),new NS(xS).observe(_S,{characterData:!0}),pS=function(){_S.data=fS=!fS}),MS=function(e){US.head||pS(),US.add(e)}}var VS=MS,FS=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},BS=ci.Promise,jS="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,GS=!jS&&!dE&&"object"==typeof window&&"object"==typeof document,WS=ci,HS=BS,zS=Ri,KS=Ws,YS=Cd,JS=ds,ZS=GS,XS=jS,qS=ho,QS=HS&&HS.prototype,$S=JS("species"),ev=!1,tv=zS(WS.PromiseRejectionEvent),rv=KS("Promise",(function(){var e=YS(HS),t=e!==String(HS);if(!t&&66===qS)return!0;if(!QS.catch||!QS.finally)return!0;if(!qS||qS<51||!/native code/.test(e)){var r=new HS((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[$S]=n,!(ev=r.then((function(){}))instanceof n))return!0}return!t&&(ZS||XS)&&!tv})),nv={CONSTRUCTOR:rv,REJECTION_EVENT:tv,SUBCLASSING:ev},iv={},ov=wo,sv=TypeError,av=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw sv("Bad Promise constructor");t=e,r=n})),this.resolve=ov(t),this.reject=ov(r)};iv.f=function(e){return new av(e)};var cv,dv,uv=Aa,lv=dE,hv=ci,pv=Ci,fv=_l,_v=jl,mv=function(e){var t=vT(e);bT&&t&&!t[RT]&&yT(t,RT,{configurable:!0,get:function(){return this}})},Ev=wo,gv=Ri,Tv=qi,Sv=IT,vv=MT,yv=lS.set,bv=VS,Rv=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}},Av=FS,Ov=gS,Iv=nh,wv=BS,Cv=nv,Nv=iv,kv="Promise",Dv=Cv.CONSTRUCTOR,Pv=Cv.REJECTION_EVENT,Lv=Iv.getterFor(kv),Mv=Iv.set,Uv=wv&&wv.prototype,xv=wv,Vv=Uv,Fv=hv.TypeError,Bv=hv.document,jv=hv.process,Gv=Nv.f,Wv=Gv,Hv=!!(Bv&&Bv.createEvent&&hv.dispatchEvent),zv="unhandledrejection",Kv=function(e){var t;return!(!Tv(e)||!gv(t=e.then))&&t},Yv=function(e,t){var r,n,i,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,d=e.reject,u=e.domain;try{a?(s||(2===t.rejection&&Qv(t),t.rejection=1),!0===a?r=o:(u&&u.enter(),r=a(o),u&&(u.exit(),i=!0)),r===e.promise?d(Fv("Promise-chain cycle")):(n=Kv(r))?pv(n,r,c,d):c(r)):d(o)}catch(e){u&&!i&&u.exit(),d(e)}},Jv=function(e,t){e.notified||(e.notified=!0,bv((function(){for(var r,n=e.reactions;r=n.get();)Yv(r,e);e.notified=!1,t&&!e.rejection&&Xv(e)})))},Zv=function(e,t,r){var n,i;Hv?((n=Bv.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),hv.dispatchEvent(n)):n={promise:t,reason:r},!Pv&&(i=hv["on"+e])?i(n):e===zv&&Rv("Unhandled promise rejection",r)},Xv=function(e){pv(yv,hv,(function(){var t,r=e.facade,n=e.value;if(qv(e)&&(t=Av((function(){lv?jv.emit("unhandledRejection",n,r):Zv(zv,r,n)})),e.rejection=lv||qv(e)?2:1,t.error))throw t.value}))},qv=function(e){return 1!==e.rejection&&!e.parent},Qv=function(e){pv(yv,hv,(function(){var t=e.facade;lv?jv.emit("rejectionHandled",t):Zv("rejectionhandled",t,e.value)}))},$v=function(e,t,r){return function(n){e(t,n,r)}},ey=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Jv(e,!0))},ty=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Fv("Promise can't be resolved itself");var n=Kv(t);n?bv((function(){var r={done:!1};try{pv(n,t,$v(ty,r,e),$v(ey,r,e))}catch(t){ey(r,t,e)}})):(e.value=t,e.state=1,Jv(e,!1))}catch(t){ey({done:!1},t,e)}}};Dv&&(Vv=(xv=function(e){Sv(this,Vv),Ev(e),pv(cv,this);var t=Lv(this);try{e($v(ty,t),$v(ey,t))}catch(e){ey(t,e)}}).prototype,(cv=function(e){Mv(this,{type:kv,done:!1,notified:!1,parent:!1,reactions:new Ov,rejection:!1,state:0,value:void 0})}).prototype=fv(Vv,"then",(function(e,t){var r=Lv(this),n=Gv(vv(this,xv));return r.parent=!0,n.ok=!gv(e)||e,n.fail=gv(t)&&t,n.domain=lv?jv.domain:void 0,0==r.state?r.reactions.add(n):bv((function(){Yv(n,r)})),n.promise})),dv=function(){var e=new cv,t=Lv(e);this.promise=e,this.resolve=$v(ty,t),this.reject=$v(ey,t)},Nv.f=Gv=function(e){return e===xv||undefined===e?new dv(e):Wv(e)}),uv({global:!0,constructor:!0,wrap:!0,forced:Dv},{Promise:xv}),_v(xv,kv,!1,!0),mv(kv);var ry=ds("iterator"),ny=!1;try{var iy=0,oy={next:function(){return{done:!!iy++}},return:function(){ny=!0}};oy[ry]=function(){return this},Array.from(oy,(function(){throw 2}))}catch(e){}var sy=BS,ay=function(e,t){if(!t&&!ny)return!1;var r=!1;try{var n={};n[ry]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},cy=nv.CONSTRUCTOR||!ay((function(e){sy.all(e).then(void 0,(function(){}))})),dy=Ci,uy=wo,ly=iv,hy=FS,py=Qg;Aa({target:"Promise",stat:!0,forced:cy},{all:function(e){var t=this,r=ly.f(t),n=r.resolve,i=r.reject,o=hy((function(){var r=uy(t.resolve),o=[],s=0,a=1;py(e,(function(e){var c=s++,d=!1;a++,dy(r,t,e).then((function(e){d||(d=!0,o[c]=e,--a||n(o))}),i)})),--a||n(o)}));return o.error&&i(o.value),r.promise}});var fy=Aa,_y=nv.CONSTRUCTOR;BS&&BS.prototype,fy({target:"Promise",proto:!0,forced:_y,real:!0},{catch:function(e){return this.then(void 0,e)}});var my=Ci,Ey=wo,gy=iv,Ty=FS,Sy=Qg;Aa({target:"Promise",stat:!0,forced:cy},{race:function(e){var t=this,r=gy.f(t),n=r.reject,i=Ty((function(){var i=Ey(t.resolve);Sy(e,(function(e){my(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var vy=Ci,yy=iv;Aa({target:"Promise",stat:!0,forced:nv.CONSTRUCTOR},{reject:function(e){var t=yy.f(this);return vy(t.reject,void 0,e),t.promise}});var by=$s,Ry=qi,Ay=iv,Oy=function(e,t){if(by(e),Ry(t)&&t.constructor===e)return t;var r=Ay.f(e);return(0,r.resolve)(t),r.promise},Iy=Aa,wy=BS,Cy=nv.CONSTRUCTOR,Ny=Oy,ky=no("Promise"),Dy=!Cy;Iy({target:"Promise",stat:!0,forced:true},{resolve:function(e){return Ny(Dy&&this===ky?wy:this,e)}});var Py=Ci,Ly=wo,My=iv,Uy=FS,xy=Qg;Aa({target:"Promise",stat:!0,forced:cy},{allSettled:function(e){var t=this,r=My.f(t),n=r.resolve,i=r.reject,o=Uy((function(){var r=Ly(t.resolve),i=[],o=0,s=1;xy(e,(function(e){var a=o++,c=!1;s++,Py(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 Vy=Ci,Fy=wo,By=no,jy=iv,Gy=FS,Wy=Qg,Hy="No one promise resolved";Aa({target:"Promise",stat:!0,forced:cy},{any:function(e){var t=this,r=By("AggregateError"),n=jy.f(t),i=n.resolve,o=n.reject,s=Gy((function(){var n=Fy(t.resolve),s=[],a=0,c=1,d=!1;Wy(e,(function(e){var u=a++,l=!1;c++,Vy(n,t,e).then((function(e){l||d||(d=!0,i(e))}),(function(e){l||d||(l=!0,s[u]=e,--c||o(new r(s,Hy)))}))})),--c||o(new r(s,Hy))}));return s.error&&o(s.value),n.promise}});var zy=Aa,Ky=BS,Yy=$n,Jy=no,Zy=Ri,Xy=MT,qy=Oy,Qy=Ky&&Ky.prototype;zy({target:"Promise",proto:!0,real:!0,forced:!!Ky&&Yy((function(){Qy.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Xy(this,Jy("Promise")),r=Zy(e);return this.then(r?function(r){return qy(t,e()).then((function(){return r}))}:e,r?function(r){return qy(t,e()).then((function(){throw r}))}:e)}});var $y=Z(Qi.Promise);class eb extends Fr{set _mediaStreamTrack(e){e!==this.mediaStreamTrack&&(this.safeEmit(Xc.TRACK_UPDATED,e),this.mediaStreamTrack=e)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),Fm(this,"trackMediaType",void 0),Fm(this,"_ID",void 0),Fm(this,"_rtpTransceiver",void 0),Fm(this,"_lowRtpTransceiver",void 0),Fm(this,"_hints",[]),Fm(this,"_isClosed",!1),Fm(this,"_originMediaStreamTrack",void 0),Fm(this,"mediaStreamTrack",void 0),Fm(this,"_external",{}),this._ID=t||sn(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,Bc(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||rn((()=>{var e;Yn.reportApiInvoke(null,{name:Wr.GET_MEDIA_STREAM_TRACK,options:[],tag:Hr.TRACER}).onSuccess((null===(e=this._mediaStreamTrack)||void 0===e?void 0:e.label)||"")}),this.mediaStreamTrack.id||this.getTrackId()),this._mediaStreamTrack}getRTCRtpTransceiver(e){return e===Yc.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,jc(this),this.emit(qc.CLOSED),this.removeAllListeners(Xc.SEI_RECEIVED)}_updateRtpTransceiver(e,t){if(t===Yc.LOW_STREAM){if(this._lowRtpTransceiver===e)return;this._lowRtpTransceiver=e}else{if(this._rtpTransceiver===e)return;this._rtpTransceiver=e}this.emit(Xc.TRANSCEIVER_UPDATED,e,t)}}class tb extends eb{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),Fm(this,"_enabled",!0),Fm(this,"_muted",!1),Fm(this,"_isExternalTrack",!1),Fm(this,"_isClosed",!1),Fm(this,"_enabledMutex",void 0),Fm(this,"processor",void 0),Fm(this,"_processorContext",void 0),Fm(this,"_handleTrackEnded",(()=>{this.onTrackEnded()})),this._enabledMutex=new _n("".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,Bn.debug("[".concat(this.getTrackId(),"] close")),this.emit(zc.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 Jr(this,zc.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){Bn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(qc.TRACK_ENDED)}stateCheck(e,t){if(Bn.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),Nr(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new Cr(wr.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print("error",Bn);if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new Cr(wr.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print("error",Bn)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():$y.resolve([])}}function rb(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 nb=window.AudioContext||window.webkitAudioContext;let ib=null;const ob=new class extends Fr{constructor(){super(...arguments),Fm(this,"prevState",void 0),Fm(this,"curState",void 0),Fm(this,"currentTime",void 0),Fm(this,"currentTimeStuckAt",void 0),Fm(this,"interruptDetectorTrack",void 0),Fm(this,"onLocalAudioTrackMute",(()=>{Bn.info("ios15-interruption-start"),this.emit(Qn.IOS_15_16_INTERRUPTION_START)})),Fm(this,"onLocalAudioTrackUnmute",(async()=>{Bn.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?Bn.info("ios15-interruption-end-canceled"):(ib&&await ib.suspend(),this.emit(Qn.IOS_15_16_INTERRUPTION_END))}))}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){Bn.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){Bn.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 sb(){if(!nb)return void Bn.error("your browser is not support web audio");Bn.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?rb(Object(r),!0).forEach((function(t){Fm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rb(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},In("WEBAUDIO_INIT_OPTIONS"));Bn.debug("audio context init option:",JSON.stringify(e)),ib=new nb(e),ob.curState=ib.state,ib.onstatechange=()=>{ob.prevState=ob.curState,ob.curState=ib?ib.state:void 0;const{prevState:e,curState:t}=ob,r="running"===t,n="interrupted"===t,i="running"===e,o="suspended"===e,s="interrupted"===e,a=nr().osVersion;(hr()||Tr())&&i&&n&&(Bn.info("ios".concat(a,"-interruption-start")),ob.emit(Qn.IOS_INTERRUPTION_START)),(hr()||Tr())&&(o||s)&&r&&(Bn.info("ios".concat(a,"-interruption-end")),ob.emit(Qn.IOS_INTERRUPTION_END)),e!==t&&ob.emit(Qn.STATE_CHANGE,t,e)},setInterval((()=>{var e;const t=null===(e=ib)||void 0===e?void 0:e.currentTime;if(ob.currentTime!==t)ob.currentTimeStuckAt&&(Bn.debug("AudioContext current time resume at ".concat(t)),ob.currentTimeStuckAt=void 0),ob.currentTime=t;else{if(t!==ob.currentTimeStuckAt){Yn.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:Hr.TRACER}).onSuccess(),Bn.warning("AudioContext current time stuck at ".concat(t))}ob.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):hr()||Tr()?"suspended"===e.state&&(a(!0),t&&e.resume().then(d,d)):"closed"!==e.state&&(a(!0),t&&e.resume().then(d,d))}function a(e){if(n!==e){n=e;for(let r=0,n=t;r<n.length;r+=1){const t=n[r];e?window.addEventListener(t,u,{capture:!0,passive:!0}):window.removeEventListener(t,u,{capture:!0,passive:!0})}}}function c(){s(!0)}function d(){s(!1)}function u(){s(!0)}function l(e){if(!o)if(r.paused)if(e){let e;h(!1),o=!0;try{e=r.play(),e?e.then(p,p):(r.addEventListener("playing",p),r.addEventListener("abort",p),r.addEventListener("error",p))}catch(e){p()}}else h(!0);else h(!1)}function h(e){if(i!==e){i=e;for(let r=0,n=t;r<n.length;r++){const t=n[r];e?window.addEventListener(t,f,{capture:!0,passive:!0}):window.removeEventListener(t,f,{capture:!0,passive:!0})}}}function p(){r.removeEventListener("playing",p),r.removeEventListener("abort",p),r.removeEventListener("error",p),o=!1,l(!1)}function f(){l(!0)}if(hr()){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,l(!0)}ob.on(Qn.STATE_CHANGE,c),s(!1)}(ib)}function ab(){if(!ib){if(sb(),!ib)throw new Cr(wr.NOT_SUPPORTED,"can not create audio context");return ib}return ib}function cb(){return!!ib}function db(e){if(function(){if(null!==lb)return lb;const e=ab(),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(),lb=i,i}())return;const t=e.connect,r=e.disconnect;e.connect=(r,n,i)=>{var o;return e._inputNodes||(e._inputNodes=[]),Ac(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?qr(e._inputNodes,n):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function ub(e){const t=ab();return new $y(((r,n)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{n(new Cr(wr.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let lb=null;let hb=null;function pb(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 fb=Z(mE);class _b{constructor(){Fm(this,"context",void 0),Fm(this,"analyserNode",void 0),Fm(this,"sourceNode",void 0),this.context=ab(),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||hr()||Tr()||"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=fb(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){Bn.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class mb extends Fr{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(),Fm(this,"outputNode",void 0),Fm(this,"outputTrack",void 0),Fm(this,"isPlayed",!1),Fm(this,"sourceNode",void 0),Fm(this,"context",void 0),Fm(this,"audioBufferNode",void 0),Fm(this,"destNode",void 0),Fm(this,"audioOutputLevel",0),Fm(this,"volumeLevelAnalyser",void 0),Fm(this,"_processedNode",void 0),Fm(this,"playNode",void 0),Fm(this,"isDestroyed",!1),Fm(this,"onNoAudioInput",void 0),Fm(this,"isNoAudioInput",!1),Fm(this,"_noAudioInputCount",0),this.context=ab(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),db(this.outputNode),this.volumeLevelAnalyser=new _b}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($c.ON_AUDIO_BUFFER,pb(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!Xn().webAudioMediaStreamDest)throw new Cr(wr.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&&Qr((()=>{ob.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;hr()||Tr()?"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 on(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 Eb extends mb{get isFreeze(){return!1}constructor(e,t,r){var n;if(super(),Fm(this,"sourceNode",void 0),Fm(this,"track",void 0),Fm(this,"clonedTrack",void 0),Fm(this,"audioElement",void 0),Fm(this,"isCurrentTrackCloned",!1),Fm(this,"isRemoteTrack",!1),Fm(this,"originVolumeLevelAnalyser",void 0),Fm(this,"rebuildWebAudio",(async()=>{if(Bn.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 Bn.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>Bn.info("resume success"))),Bn.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),db(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),db(this.outputNode),this.emit($c.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=t,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()})),"audio"!==e.kind)throw new Cr(wr.UNEXPECTED_ERROR);this.track=e;const i=new MediaStream([this.track]);if(this.isRemoteTrack=!!t,this.sourceNode=this.context.createMediaStreamSource(i),db(this.sourceNode),r){const e=r.clone();e.enabled=!0,this.clonedTrack=e,Bn.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]));db(t),this.originVolumeLevelAnalyser=new _b,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=i;const o=nr();t&&o.os===Qt.IOS&&Number(null===(n=o.osVersion)||void 0===n?void 0:n.split(".")[0])<15&&(ob.on(Qn.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),db(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit($c.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),ob.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),Bn.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]));db(r),this.originVolumeLevelAnalyser&&this.originVolumeLevelAnalyser.updateSource(r)}getOriginVolumeLevel(){return this.originVolumeLevelAnalyser?this.originVolumeLevelAnalyser.getVolumeLevel():this.getAccurateVolumeLevel()}}async function gb(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 Tb(e,t){const r=await Sb(e.mediaSource),{sourceId:n,audio:i}=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 d=document.createElement("button");d.innerHTML="cancel",d.setAttribute("style","width: 85px;"),d.onclick=()=>{document.body.removeChild(h);const e=new Error("NotAllowedError");e.name="NotAllowedError",n(e)};let u=t;const l=document.createElement("div");if(t){const e=document.createElement("input");e.setAttribute("type","checkbox");const t=document.createElement("span");e.setAttribute("style","margin-right: 6px;"),t.innerText="Share audio",e.checked=u,e.onchange=()=>{u=e.checked},l.appendChild(e),l.appendChild(t)}c.appendChild(l),c.appendChild(d),o.appendChild(s),o.appendChild(a),o.appendChild(c);const h=document.createElement("div");h.setAttribute("style","position: fixed; z-index: 99999999; top: 50%; left: 50%; width: 620px; height: 525px; background: #ECECEC; border-radius: 4px; -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);"),h.appendChild(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{const{width:e}=n.getSize();e>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:u})},a.appendChild(t)}}))}))}(r,t);return await gb(n,e,i)}async function Sb(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=Gr();if(!r)throw console.error("failed to fetch electron, please mount it to window"),new Cr(wr.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 $y(((e,n)=>{r.desktopCapturer.getSources({types:t},((t,r)=>{t?n(t):e(r)}))})));try{return await n}catch(e){throw new Cr(wr.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.toString())}}function vb(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 yb=new _n("safari");async function bb(e,t){let r=0,n=null;for(;r<2;)try{n=await Rb(e,t,r>0);break}catch(e){if(e instanceof Cr)throw Bn.error("[".concat(t,"] ").concat(e.toString())),e;const n=Ab(e.name||e.code||e,e.message);if(n.code===wr.MEDIA_OPTION_INVALID){Bn.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await on(500);continue}throw Bn.error("[".concat(t,"] ").concat(n.toString())),n}if(!n)throw new Cr(wr.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return n}async function Rb(t,r,n){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Cr(wr.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=Xn(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return Bn.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(Br())if(t.screen.sourceId){Ob(o,await gb(t.screen.sourceId,t.screen,t.screenAudio))}else{Ob(o,await Tb(t.screen,t.screenAudio))}else if(cr()&&t.screen.extensionId&&t.screen.mandatory){if(!i.getStreamFromExtension)throw new Cr(wr.NOT_SUPPORTED,"This browser does not support screen sharing");Bn.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new $y(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return Bn.error("[".concat(c,"] No response from Chrome Plugin. Plugin not installed properly"),r),void t(new Cr(wr.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){Bn.error("[".concat(c,"] AgoraRTC screensharing plugin is not accessible(").concat(a,")"),e.toString()),t(new Cr(wr.CHROME_PLUGIN_NOT_INSTALL))}})));t.screen.mandatory.chromeMediaSourceId=e;Ob(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(i.getDisplayMedia){var s;t.screen.mediaSource&&Hc(t.screen.mediaSource);const e={width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate,displaySurface:null!==(s=t.screen.displaySurface)&&void 0!==s?s:"screen"===t.screen.mediaSource?"monitor":t.screen.mediaSource},{selfBrowserSurface:n,surfaceSwitching:i,systemAudio:a}=t.screen,c={selfBrowserSurface:n,surfaceSwitching:i,systemAudio:a};!n&&delete c.selfBrowserSurface,!i&&delete c.surfaceSwitching,!a&&delete c.systemAudio,Bn.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:!!t.screenAudio,controls:c}));const d=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vb(Object(r),!0).forEach((function(t){Fm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vb(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:!!t.screenAudio},c));Ob(o,d)}else{if(!lr())throw Bn.error("[".concat(r,"] This browser does not support screenSharing")),new Cr(wr.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&Hc(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};Bn.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));Ob(o,await navigator.mediaDevices.getUserMedia(e))}}var a,c;if(!t.video&&!t.audio)return o;let d={video:t.video,audio:t.audio},u=In("MEDIA_DEVICE_CONSTRAINTS");if(u)try{"string"==typeof u&&(u=JSON.parse(u)),d=ln(d,u)}catch(e){}Bn.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(d)),nr();let l,h=null;(dr()||hr()||ar())&&(h=await yb.lock());try{l=await navigator.mediaDevices.getUserMedia(d)}catch(e){throw h&&h(),e}return d.audio&&(e.HAS_GUM_AUDIO=!0),d.video&&(e.HAS_GUM_VIDEO=!0),Ob(o,l),h&&h(),o}function Ab(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new Cr(wr.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new Cr(wr.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new Cr(wr.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new Cr(wr.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new Cr(wr.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new Cr(wr.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return Bn.error("getUserMedia unexpected error",e),new Cr(wr.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function Ob(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 Ib extends Fr{get state(){return this._state}set state(e){e!==this._state&&(this.emit(cd.STATE_CHANGE,e),this._state=e)}constructor(){super(),Fm(this,"_state",ad.IDLE),Fm(this,"isAccessMicrophonePermission",!1),Fm(this,"isAccessCameraPermission",!1),Fm(this,"lastAccessMicrophonePermission",!1),Fm(this,"lastAccessCameraPermission",!1),Fm(this,"checkdeviceMatched",!1),Fm(this,"deviceInfoMap",new Map),this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(In("ENUMERATE_DEVICES_INTERVAL")||(br()||or()===Qt.HARMONY_OS)&&yr())&&this.updateDevicesInfo()}),In("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>Bn.error(e.toString())))}async enumerateDevices(t,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){return new Cr(wr.NOT_SUPPORTED,"enumerateDevices() not supported.").throw()}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,d=null,u=null;if(!n&&(s||a)){if(yb.isLocked){Bn.debug("[device manager] wait GUM lock");(await yb.lock())(),Bn.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),Bn.debug("[device manager] check media device permissions",t,r,s,a),s&&a){try{u=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(e){const t=Ab(e.name||e.code||e,e.message);if(t.code===wr.PERMISSION_DENIED)throw t;Bn.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=Ab(e.name||e.code||e,e.message);if(t.code===wr.PERMISSION_DENIED)throw t;Bn.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{d=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=Ab(e.name||e.code||e,e.message);if(t.code===wr.PERMISSION_DENIED)throw t;Bn.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}Bn.debug("[device manager] mic permission",t,"cam permission",r)}try{const e=await navigator.mediaDevices.enumerateDevices();return c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null,e}catch(e){c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null;return new Cr(wr.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 Cr(wr.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=ad.INITING;try{await this.updateDevicesInfo(),this.state=ad.INITEND}catch(e){if(Bn.warning("Device Detection functionality cannot start properly.",e.toString()),this.state=ad.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname)){new Cr(wr.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.").throw()}throw e}}async updateDevicesInfo(){const e=await this.enumerateDevices(!0,!0,!0),t=Date.now(),r=[];if(e[0]&&e[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const t=e.find((e=>"audioinput"===e.kind&&"default"===e.deviceId)),r=e.find((e=>"audiooutput"===e.kind&&"default"===e.deviceId));t&&r?r.groupId===t.groupId?Bn.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):Bn.warning("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):Bn.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!==ad.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(cd.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(cd.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(cd.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 wb=new Ib;let Cb=!1;const Nb=new class extends Fr{constructor(){super(...arguments),Fm(this,"onAutoplayFailed",void 0),Fm(this,"onAudioAutoplayFailed",void 0)}};function kb(){if(nr(),!Cb){const e=t=>{t.preventDefault(),Cb=!1,Rr()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};Cb=!0,Rr()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),Bn.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),Nb.onAutoplayFailed?Nb.onAutoplayFailed():Nb.onAudioAutoplayFailed?Bn.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 ."):Bn.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 ."),Nb.emit("autoplay-failed")}}function Db(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 Pb(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Db(Object(r),!0).forEach((function(t){Fm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Db(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Lb(e,t,r,n){if(!e)return;const i=Yn.getBaseInfoBySessionId(e);if(!i)return;const o=i.info,s=Date.now(),a=Pb(Pb({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-i.startTime,cbRegistered:Nb.onAutoplayFailed||Nb.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:n,extend:void 0});Yn.send({type:Hn.AUTOPLAY_FAILED,data:a},!0)}const Mb=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],Ub=new class{constructor(){Fm(this,"onAutoplayFailed",void 0),Fm(this,"elementMap",new Map),Fm(this,"elementStateMap",new Map),Fm(this,"elementsNeedToResume",[]),Fm(this,"sinkIdMap",new Map),Fm(this,"autoResumeAfterInterruption",(e=>{Array.from(this.elementMap.entries()).forEach((t=>{let[r,n]=t;const i=this.elementStateMap.get(r),o=n.srcObject.getAudioTracks()[0],s=o&&o.readyState;if(Bn.debug("resume after interrupted, ele: ".concat(i," audio: ").concat(s," ").concat(e)),"live"===s){if(e)return n.pause(),void n.play();if("running"===ob.curState)return mr()?(n.pause(),void n.play()):void(i&&"paused"===i&&n.play())}}))})),Fm(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let[t,r]=e;const n=r.srcObject.getAudioTracks()[0];n&&"live"===n.readyState&&(Bn.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))})),this.autoResumeAudioElement(),ob.on(Qn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),ob.on(Qn.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),ob.on(Qn.STATE_CHANGE,(()=>{hr()&&"suspended"===ob.prevState&&"running"===ob.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 Cr(wr.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=>{Bn.warning("[".concat(t,"] set sink id failed"),e.toString())}))}catch(e){Bn.warning("[".concat(t,"] set sink id failed"),e.toString())}const s=i.play();s&&s.then&&s.catch((e=>{n&&Lb(n,"audio",e.message,t),Bn.warning("audio element play warning",e.toString()),this.elementMap.has(t)&&"NotAllowedError"===e.name&&(Bn.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(i),Qr((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),kb()})))}))}updateTrack(e,t){const r=this.elementMap.get(e);r&&(r.srcObject=new MediaStream([t]))}isPlaying(e){return this.elementMap.has(e)&&"playing"===this.elementStateMap.get(e)}setVolume(e,t){const r=this.elementMap.get(e);r&&(t=Math.max(0,Math.min(100,t)),r.volume=t/100)}stop(e){const t=this.elementMap.get(e);if(this.sinkIdMap.delete(e),!t)return;const r=this.elementsNeedToResume.indexOf(t);this.elementsNeedToResume.splice(r,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}bindAudioElementEvents(e,t){Mb.forEach((r=>{t.addEventListener(r,(r=>{const n=this.elementStateMap.get(e),i="pause"===r.type?"paused":r.type;if(Bn.debug("[".concat(e,"] audio-element-status change ").concat(n," => ").concat(i)),"error"===r.type){const r=null==t?void 0:t.error;r&&Bn.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=>{Bn.debug("Auto resume audio element success")})).catch((e=>{Bn.warning("Auto resume audio element failed!",e)}))})),this.elementsNeedToResume=[]};new Promise((e=>{document.body?e():window.addEventListener("load",(()=>e()))})).then((()=>{Rr()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function xb(){return function(e,t,r){const n=r.value;return"function"==typeof n&&(r.value=function(){this._isClosed&&new Cr(wr.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",Bn);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 $y?new $y(((e,t)=>{i.then(e).catch(t)})):i}),r}}var Vb=Ka("Array").values,Fb=ac,Bb=Zo,jb=si,Gb=Vb,Wb=Array.prototype,Hb={DOMTokenList:!0,NodeList:!0},zb=function(e){var t=e.values;return e===Wb||jb(Wb,e)&&t===Wb.values||Bb(Hb,Fb(e))?Gb:t},Kb=Z(zb);function Yb(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 Jb(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yb(Object(r),!0).forEach((function(t){Fm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yb(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class Zb extends Fr{constructor(e){super(),Fm(this,"name","VideoProcessorDestination"),Fm(this,"ID","0"),Fm(this,"_source",void 0),Fm(this,"videoContext",void 0),Fm(this,"inputTrack",void 0),this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new Cr(wr.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new Cr(wr.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(od.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(od.ON_TRACK,void 0)}}class Xb extends Fr{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),Fm(this,"constraintsMap",new Map),Fm(this,"statsRegistry",[]),Fm(this,"usageRegistry",[]),Fm(this,"trackId",void 0),Fm(this,"direction",void 0),Fm(this,"_chained",!1),this.trackId=e,this.direction=t}async getConstraints(){return await Yr(this,sd.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return Bn.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),Jr(this,sd.REQUEST_UPDATE_CONSTRAINTS,Array.from(Kb(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return Bn.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),Jr(this,sd.REQUEST_UPDATE_CONSTRAINTS,Array.from(Kb(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const{processorID:t,processorName:r,type:n,cb:i}of this.statsRegistry)try{const o=i();e.push({processorID:t,processorName:r,type:n,stats:o})}catch(e){Bn.error(new Cr(wr.UNEXPECTED_ERROR,e.message))}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const{cb:t}of this.usageRegistry)try{let r=t();r instanceof $y&&(r=await r),e.push(Jb(Jb({},r),{},{direction:this.direction}))}catch(e){Bn.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class qb extends Fr{constructor(e){super(),Fm(this,"name","AudioProcessorDestination"),Fm(this,"ID","0"),Fm(this,"inputTrack",void 0),Fm(this,"inputNode",void 0),Fm(this,"audioProcessorContext",void 0),Fm(this,"_source",void 0),this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new Cr(wr.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new Cr(wr.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(od.ON_TRACK,void 0),this.emit(od.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(od.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.audioProcessorContext.chained=!0,this.inputNode=e.node,this.emit(od.ON_NODE,this.inputNode))}}class Qb extends Fr{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),Fm(this,"constraintsMap",new Map),Fm(this,"statsRegistry",[]),Fm(this,"audioContext",void 0),Fm(this,"trackId",void 0),Fm(this,"direction",void 0),Fm(this,"usageRegistry",[]),Fm(this,"_chained",!1),this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return Yr(this,sd.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return Bn.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),Jr(this,sd.REQUEST_UPDATE_CONSTRAINTS,Array.from(Kb(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),Jr(this,sd.REQUEST_UPDATE_CONSTRAINTS,Array.from(Kb(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const{processorID:t,processorName:r,type:n,cb:i}of this.statsRegistry)try{const o=i();e.push({processorID:t,processorName:r,type:n,stats:o})}catch(e){Bn.error(new Cr(wr.UNEXPECTED_ERROR,e.message))}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const{cb:t}of this.usageRegistry)try{let r=t();r instanceof $y&&(r=await r),e.push(Jb(Jb({},r),{},{direction:this.direction}))}catch(e){Bn.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class $b extends Fr{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),Fm(this,"context",void 0),Fm(this,"processSourceNode",void 0),Fm(this,"outputTrack",void 0),Fm(this,"processedNode",void 0),Fm(this,"clonedTrack",void 0),Fm(this,"outputNode",void 0),this.outputNode=new eR}setVolume(){}createOutputTrack(){throw new Cr(wr.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 eR{disconnect(){}connect(){}}function tR(e){return new $y(((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=hr()?"canplay":"playing";i.addEventListener(o,(()=>{const e=i.videoWidth,r=i.videoHeight;!e&&lr()||(n=!0,i.srcObject=null,i.remove(),t([e,r]))})),i.srcObject=new MediaStream([e]),i.play().catch(an),setTimeout((()=>{n||(i.srcObject=null,i.remove(),t([i.videoWidth,i.videoHeight]))}),4e3)}))}function rR(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=Lc(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!Sr()&&r.frameRate&&(t.frameRate=r.frameRate),ur()&&"object"==typeof t.frameRate&&(t.frameRate.max=60),lr()&&(t.frameRate={ideal:30,max:30}),t}function nR(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&cr()&&(t.extensionId=e.extensionId);const{displaySurface:r,selfBrowserSurface:n,surfaceSwitching:i,systemAudio:o}=e;(pr(107)||fr(107)||_r(93))&&(r&&(kr(r,"displaySurface",["browser","window","monitor"]),t.displaySurface=r),n?(kr(n,"selfBrowserSurface",["exclude","include"]),t.selfBrowserSurface=n):t.selfBrowserSurface="include",i&&(kr(i,"surfaceSwitching",["exclude","include"]),t.surfaceSwitching=i)),(pr(105)||fr(105)||_r(91))&&o&&(kr(o,"systemAudio",["exclude","include"]),t.systemAudio=o),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const s=e.encoderConfig?Mc(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:s?s.width:void 0,maxHeight:s?s.height:void 0},s&&(s.frameRate&&("number"==typeof s.frameRate?(t.mandatory.maxFrameRate=s.frameRate,t.mandatory.minFrameRate=s.frameRate):(t.mandatory.maxFrameRate=s.frameRate.max||s.frameRate.ideal||s.frameRate.exact||void 0,t.mandatory.minFrameRate=s.frameRate.min||s.frameRate.ideal||s.frameRate.exact||void 0),t.frameRate=s.frameRate),s.width&&(t.width=s.width),s.height&&(t.height=s.height)),t}function iR(e){const t={};if(Sr()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,cr()&&e.ANS&&(t.googHighpassFilter=e.ANS))),e.encoderConfig){const r=Vc(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),br()&&(t.sampleRate=void 0),t}function oR(e,t,r,n,i){const o=In("BITRATE_ADAPTER_TYPE");if("DEFAULT_BITRATE"===o)return{min:n,max:i};if(void 0===i){var s;const a=Math.floor(200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75));i="STANDARD_BITRATE"===o?4*a:2*a,n=null!==(s=n)&&void 0!==s?s:a}else{var a;n=null!==(a=n)&&void 0!==a?a:Math.floor(i/10)}return{min:n,max:i}}function sR(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 aR=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 d=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 u,l,h,p,f,_=1732584193,m=-271733879,E=-1732584194,g=271733878;for(u=0;u<d.length;u+=16)l=_,h=m,p=E,f=g,_=o(_,m,E,g,d[u+0],7,-680876936),g=o(g,_,m,E,d[u+1],12,-389564586),E=o(E,g,_,m,d[u+2],17,606105819),m=o(m,E,g,_,d[u+3],22,-1044525330),_=o(_,m,E,g,d[u+4],7,-176418897),g=o(g,_,m,E,d[u+5],12,1200080426),E=o(E,g,_,m,d[u+6],17,-1473231341),m=o(m,E,g,_,d[u+7],22,-45705983),_=o(_,m,E,g,d[u+8],7,1770035416),g=o(g,_,m,E,d[u+9],12,-1958414417),E=o(E,g,_,m,d[u+10],17,-42063),m=o(m,E,g,_,d[u+11],22,-1990404162),_=o(_,m,E,g,d[u+12],7,1804603682),g=o(g,_,m,E,d[u+13],12,-40341101),E=o(E,g,_,m,d[u+14],17,-1502002290),m=o(m,E,g,_,d[u+15],22,1236535329),_=s(_,m,E,g,d[u+1],5,-165796510),g=s(g,_,m,E,d[u+6],9,-1069501632),E=s(E,g,_,m,d[u+11],14,643717713),m=s(m,E,g,_,d[u+0],20,-373897302),_=s(_,m,E,g,d[u+5],5,-701558691),g=s(g,_,m,E,d[u+10],9,38016083),E=s(E,g,_,m,d[u+15],14,-660478335),m=s(m,E,g,_,d[u+4],20,-405537848),_=s(_,m,E,g,d[u+9],5,568446438),g=s(g,_,m,E,d[u+14],9,-1019803690),E=s(E,g,_,m,d[u+3],14,-187363961),m=s(m,E,g,_,d[u+8],20,1163531501),_=s(_,m,E,g,d[u+13],5,-1444681467),g=s(g,_,m,E,d[u+2],9,-51403784),E=s(E,g,_,m,d[u+7],14,1735328473),m=s(m,E,g,_,d[u+12],20,-1926607734),_=a(_,m,E,g,d[u+5],4,-378558),g=a(g,_,m,E,d[u+8],11,-2022574463),E=a(E,g,_,m,d[u+11],16,1839030562),m=a(m,E,g,_,d[u+14],23,-35309556),_=a(_,m,E,g,d[u+1],4,-1530992060),g=a(g,_,m,E,d[u+4],11,1272893353),E=a(E,g,_,m,d[u+7],16,-155497632),m=a(m,E,g,_,d[u+10],23,-1094730640),_=a(_,m,E,g,d[u+13],4,681279174),g=a(g,_,m,E,d[u+0],11,-358537222),E=a(E,g,_,m,d[u+3],16,-722521979),m=a(m,E,g,_,d[u+6],23,76029189),_=a(_,m,E,g,d[u+9],4,-640364487),g=a(g,_,m,E,d[u+12],11,-421815835),E=a(E,g,_,m,d[u+15],16,530742520),m=a(m,E,g,_,d[u+2],23,-995338651),_=c(_,m,E,g,d[u+0],6,-198630844),g=c(g,_,m,E,d[u+7],10,1126891415),E=c(E,g,_,m,d[u+14],15,-1416354905),m=c(m,E,g,_,d[u+5],21,-57434055),_=c(_,m,E,g,d[u+12],6,1700485571),g=c(g,_,m,E,d[u+3],10,-1894986606),E=c(E,g,_,m,d[u+10],15,-1051523),m=c(m,E,g,_,d[u+1],21,-2054922799),_=c(_,m,E,g,d[u+8],6,1873313359),g=c(g,_,m,E,d[u+15],10,-30611744),E=c(E,g,_,m,d[u+6],15,-1560198380),m=c(m,E,g,_,d[u+13],21,1309151649),_=c(_,m,E,g,d[u+4],6,-145523070),g=c(g,_,m,E,d[u+11],10,-1120210379),E=c(E,g,_,m,d[u+2],15,718787259),m=c(m,E,g,_,d[u+9],21,-343485551),_=n(_,l),m=n(m,h),E=n(E,p),g=n(g,f);return r(_)+r(m)+r(E)+r(g)}(""+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))},cR=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new $y(((r,n)=>{t.toBlob((async e=>{if(t.remove(),e){const n=await dR(e);r({buffer:n,width:t.width,height:t.height})}else n(new Cr(wr.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},dR=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function uR(e,t){if("VideoFrame"in window&&"TransformStream"in window&&Xn().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 d=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(d).pipeTo(n.writable),n}}var lR,hR,pR,fR,_R,mR,ER,gR,TR,SR,vR,yR,bR,RR,AR,OR,IR,wR,CR,NR,kR,DR,PR,LR,MR,UR,xR,VR,FR,BR,jR,GR,WR,HR,zR,KR,YR,JR,ZR,XR;function qR(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 QR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qR(Object(r),!0).forEach((function(t){Fm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let $R=(lR=Kn({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),hR=Kn({argsMap:(e,t)=>[e.getTrackId(),t]}),pR=xb(),fR=mn("LocalAudioTrack","_enabledMutex"),_R=Kn({argsMap:(e,t)=>[e.getTrackId(),t]}),mR=xb(),ER=mn("LocalAudioTrack","_enabledMutex"),gR=Kn({argsMap:(e,t)=>[e.getTrackId(),t]}),TR=xb(),SR=xb(),vR=xb(),yR=Kn({argsMap:e=>[e.getTrackId()]}),bR=xb(),RR=Kn({argsMap:e=>[e.getTrackId()]}),AR=xb(),OR=Kn({argsMap:e=>[e.getTrackId()]}),IR=Kn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),wR=Kn({argsMap:e=>[e.getTrackId()]}),CR=class extends tb{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?Ub.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,n){super(e,r),Fm(this,"trackMediaType","audio"),Fm(this,"_encoderConfig",void 0),Fm(this,"_trackSource",void 0),Fm(this,"_enabled",!0),Fm(this,"_volume",100),Fm(this,"_useAudioElement",!0),Fm(this,"_bypassWebAudio",!1),Fm(this,"processor",void 0),Fm(this,"_processorContext",void 0),Fm(this,"_processorDestination",void 0),Fm(this,"_getOriginVolumeLevel",void 0),this._encoderConfig=t,this._getOriginVolumeLevel=!!n,this._trackSource=new $b,In("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),In("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);dr()&&!cb()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(e){Dr(e,"volume",0,1e3),this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&Ub.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void Bn.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,Jr(this,zc.NEED_REPLACE_TRACK,this).then((()=>{Bn.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{Bn.warning("[".concat(this.getTrackId(),"] replace web audio track failed"),e)})))}catch(e){}}getVolumeLevel(){return this._muted&&this.enabled&&this._getOriginVolumeLevel?this._source.getOriginVolumeLevel():this._source.getAccurateVolumeLevel()}async setPlaybackDevice(e){if(!this._useAudioElement||!qn())throw new Cr(wr.NOT_SUPPORTED,"your browser does not support setting the audio output device");await Ub.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(Bn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await Jr(this,zc.NEED_ENABLE_TRACK,this),Bn.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success"))}catch(e){throw r||(this._enabled=!1),Bn.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await Jr(this,zc.NEED_DISABLE_TRACK,this)}catch(e){throw r||(this._enabled=!0),Bn.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,Bn.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await Jr(this,zc.NEED_MUTE_TRACK,this):await Jr(this,zc.NEED_UNMUTE_TRACK,this))}getStats(){rn((()=>{Bn.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const e=Zr(this,zc.GET_STATS);return e||QR({},td)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners($c.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners($c.ON_AUDIO_BUFFER),this._source.on($c.ON_AUDIO_BUFFER,(t=>e(t)))}play(){Bn.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(Bn.debug("[".concat(this.getTrackId(),"] start audio playback in element")),Ub.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){Bn.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?Ub.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];Bn.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&Ub.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 Jr(this,zc.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(e))}renewMediaStreamTrack(e){return $y.resolve(void 0)}pipe(e){if(this._bypassWebAudio)throw new Cr(wr.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new Cr(wr.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(od.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e),await Jr(this,zc.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await Jr(this,zc.NEED_REPLACE_TRACK,this))})),e.on(od.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(e){e.removeAllListeners(od.ON_TRACK),e.removeAllListeners(od.ON_NODE)}bindProcessorContextEvents(e){e.on(sd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(e){e.removeAllListeners(sd.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof $b&&(this._trackSource=new Eb(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const e=new Qb(this._source.context,this.getTrackId(),"local"),t=new qb(e);return this._processorContext=e,this._processorDestination=t,this.bindProcessorContextEvents(e),this.bindProcessorDestinationEvents(t),this._source.on($c.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:e})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(Ub.stop(this.getTrackId()),this._source.play()),Jr(this,zc.NEED_REPLACE_MIXING_TRACK,this).then((()=>{Bn.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{Bn.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:e,processorDestination:t}}},JE(CR.prototype,"setVolume",[lR],Object.getOwnPropertyDescriptor(CR.prototype,"setVolume"),CR.prototype),JE(CR.prototype,"setPlaybackDevice",[hR,pR],Object.getOwnPropertyDescriptor(CR.prototype,"setPlaybackDevice"),CR.prototype),JE(CR.prototype,"setEnabled",[fR,_R,mR],Object.getOwnPropertyDescriptor(CR.prototype,"setEnabled"),CR.prototype),JE(CR.prototype,"setMuted",[ER,gR,TR],Object.getOwnPropertyDescriptor(CR.prototype,"setMuted"),CR.prototype),JE(CR.prototype,"getStats",[SR],Object.getOwnPropertyDescriptor(CR.prototype,"getStats"),CR.prototype),JE(CR.prototype,"setAudioFrameCallback",[vR],Object.getOwnPropertyDescriptor(CR.prototype,"setAudioFrameCallback"),CR.prototype),JE(CR.prototype,"play",[yR,bR],Object.getOwnPropertyDescriptor(CR.prototype,"play"),CR.prototype),JE(CR.prototype,"stop",[RR,AR],Object.getOwnPropertyDescriptor(CR.prototype,"stop"),CR.prototype),JE(CR.prototype,"close",[OR],Object.getOwnPropertyDescriptor(CR.prototype,"close"),CR.prototype),JE(CR.prototype,"pipe",[IR],Object.getOwnPropertyDescriptor(CR.prototype,"pipe"),CR.prototype),JE(CR.prototype,"unpipe",[wR],Object.getOwnPropertyDescriptor(CR.prototype,"unpipe"),CR.prototype),CR),eA=(NR=Kn({argsMap:(e,t)=>[e.getTrackId(),t]}),kR=xb(),DR=mn("MicrophoneAudioTrack","_enabledMutex"),PR=Kn({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),LR=xb(),MR=Kn({argsMap:e=>[e.getTrackId()]}),UR=class extends $R{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,n){super(e,t.encoderConfig?Vc(t.encoderConfig):{},n,In("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),Fm(this,"_config",void 0),Fm(this,"_deviceName","default"),Fm(this,"_constraints",void 0),Fm(this,"_originalConstraints",void 0),Fm(this,"_enabled",!0),this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),(mr()||Er())&&ob.bindInterruptDetectorTrack(this)}async setDevice(e){if(Bn.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await wb.getDeviceById(e),r={};r.audio=QR({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let n=null;try{n=await bb(r,this.getTrackId())}catch(e){throw Bn.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await bb({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 Bn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await wb.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw Bn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Bn.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(e,t,r){if(t)return Bn.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(Bn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),In("AUTO_RESET_AUDIO_ROUTE")&&(hr()||Tr())){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 Jr(this,zc.NEED_DISABLE_TRACK,this)}catch(e){throw Bn.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const i=QR({},this._constraints),o=wb.searchDeviceIdByName(this._deviceName);o&&!i.deviceId&&(i.deviceId=o);try{r||(this._enabled=!0);const e=await bb({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await Jr(this,zc.NEED_ENABLE_TRACK,this)}catch(e){throw r||(this._enabled=!1),Bn.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}Bn.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(mr()||Er())&&ob.unbindInterruptDetectorTrack(this)}onTrackEnded(){if((hr()||Tr())&&this._enabled&&!this._isClosed&&ob.duringInterruption){const e=async()=>{ob.off(Qn.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Bn.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};ob.on(Qn.IOS_INTERRUPTION_END,e)}else Bn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(qc.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=wb.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await bb({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(e){super.bindProcessorContextEvents(e),e.on(sd.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(sd.REQUEST_UPDATE_CONSTRAINTS)}},JE(UR.prototype,"setDevice",[NR,kR],Object.getOwnPropertyDescriptor(UR.prototype,"setDevice"),UR.prototype),JE(UR.prototype,"setEnabled",[DR,PR,LR],Object.getOwnPropertyDescriptor(UR.prototype,"setEnabled"),UR.prototype),JE(UR.prototype,"close",[MR],Object.getOwnPropertyDescriptor(UR.prototype,"close"),UR.prototype),UR),tA=(xR=Kn({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),VR=xb(),FR=Kn({argsMap:e=>[e.getTrackId()]}),BR=xb(),jR=Kn({argsMap:e=>[e.getTrackId()]}),GR=xb(),WR=Kn({argsMap:e=>[e.getTrackId()]}),HR=xb(),zR=Kn({argsMap:e=>[e.getTrackId()]}),KR=xb(),YR=Kn({argsMap:e=>[e.getTrackId()]}),JR=Kn({argsMap:e=>[e.getTrackId()]}),ZR=xb(),JE((XR=class extends $R{get __className__(){return"BufferSourceAudioTrack"}constructor(e,t,r,n){super(t.createOutputTrack(),r,n),Fm(this,"source",void 0),Fm(this,"_bufferSource",void 0),this._useAudioElement=!1,this.source=e,this._bufferSource=t,this._bufferSource.on($c.AUDIO_SOURCE_STATE_CHANGE,(e=>{this.safeEmit(qc.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){Dr(e,"speed",0),this._bufferSource.setAudioBufferPlaybackSpeed(e)}}).prototype,"startProcessAudioBuffer",[xR,VR],Object.getOwnPropertyDescriptor(XR.prototype,"startProcessAudioBuffer"),XR.prototype),JE(XR.prototype,"pauseProcessAudioBuffer",[FR,BR],Object.getOwnPropertyDescriptor(XR.prototype,"pauseProcessAudioBuffer"),XR.prototype),JE(XR.prototype,"seekAudioBuffer",[jR,GR],Object.getOwnPropertyDescriptor(XR.prototype,"seekAudioBuffer"),XR.prototype),JE(XR.prototype,"resumeProcessAudioBuffer",[WR,HR],Object.getOwnPropertyDescriptor(XR.prototype,"resumeProcessAudioBuffer"),XR.prototype),JE(XR.prototype,"stopProcessAudioBuffer",[zR,KR],Object.getOwnPropertyDescriptor(XR.prototype,"stopProcessAudioBuffer"),XR.prototype),JE(XR.prototype,"close",[YR],Object.getOwnPropertyDescriptor(XR.prototype,"close"),XR.prototype),JE(XR.prototype,"setAudioBufferPlaybackSpeed",[JR,ZR],Object.getOwnPropertyDescriptor(XR.prototype,"setAudioBufferPlaybackSpeed"),XR.prototype),XR);class rA extends $R{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=ab().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,sn(8,"track-mix-")),Fm(this,"trackList",void 0),Fm(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)?(Bn.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):Bn.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){Bn.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}qr(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 rA?t.emit(Xc.TRANSCEIVER_UPDATED,e):t._updateRtpTransceiver(e)})))}}class nA extends mb{set currentState(e){e!==this._currentState&&(this._currentState=e,this.safeEmit($c.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(),Fm(this,"audioBuffer",void 0),Fm(this,"sourceNode",void 0),Fm(this,"startPlayTime",0),Fm(this,"startPlayOffset",0),Fm(this,"pausePlayTime",0),Fm(this,"options",void 0),Fm(this,"currentLoopCount",0),Fm(this,"currentPlaybackSpeed",100),Fm(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):Bn.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 iA=new Map;function oA(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 sA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oA(Object(r),!0).forEach((function(t){Fm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class aA{get rendFrameRate(){if(this.renderStats&&this.renderStats.curTs!==this.renderStats.lastTs){const e=this.renderStats.curTs-this.renderStats.lastTs,t=(this.renderStats.renderNum-this.renderStats.lastRenderNum)/e;return this.renderStats.lastRenderNum=this.renderStats.renderNum,this.renderStats.lastTs=this.renderStats.curTs,t}return 0}get videoElementStatus(){return this._videoElementStatus}set videoElementStatus(e){e!==this._videoElementStatus&&(Bn.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){Fm(this,"trackId",void 0),Fm(this,"config",void 0),Fm(this,"onFirstVideoFrameDecoded",void 0),Fm(this,"onVideoStateChanged",void 0),Fm(this,"freezeTimeCounterList",[]),Fm(this,"renderFreezeAccTime",0),Fm(this,"isKeepLastFrame",!1),Fm(this,"timeUpdatedCount",0),Fm(this,"freezeTime",0),Fm(this,"playbackTime",0),Fm(this,"lastTimeUpdatedTime",0),Fm(this,"autoplayFailed",!1),Fm(this,"videoTrack",void 0),Fm(this,"videoElement",void 0),Fm(this,"cacheVideoElement",void 0),Fm(this,"renderStats",void 0),Fm(this,"_videoState",ud.VideoStateStopped),Fm(this,"videoElementCheckInterval",void 0),Fm(this,"videoElementFreezeTimeout",void 0),Fm(this,"_videoElementStatus",dd.NONE),Fm(this,"isGettingVideoDimensions",!1),Fm(this,"startGetVideoDimensions",(()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return Bn.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()})),Fm(this,"autoResumeAfterInterruption",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===ob.curState&&(Bn.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(sr())),gr()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),Fm(this,"handleVideoEvents",(e=>{switch(e.type){case"play":case"playing":this.startGetVideoDimensions(),this.videoElementStatus=dd.PLAYING;break;case"loadeddata":if(this.videoState=ud.VideoStateStarting,this.onFirstVideoFrameDecoded&&this.onFirstVideoFrameDecoded(),this.cacheVideoElement){try{this.cacheVideoElement.srcObject=null,this.cacheVideoElement.remove()}catch(e){}this.cacheVideoElement=void 0}break;case"canplay":this.videoElementStatus=dd.CANPLAY;break;case"stalled":this.videoElementStatus=dd.STALLED;break;case"suspend":this.videoElementStatus=dd.SUSPEND;break;case"pause":this.videoElementStatus=dd.PAUSED,hr()||Tr()||dr()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(Bn.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,Bn.error("[".concat(this.trackId,"] media error: ").concat(e.message," (").concat(e.code,")"))):Bn.debug("[".concat(this.trackId,"] media not been an error."));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,_O.lastVisibleTime<_O.lastHiddenTime||r<_O.lastHiddenTime||r<_O.lastVisibleTime)return;for(t>In("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}}})),Fm(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(Bn.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(sr())),gr()?(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"),ob.on(Qn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),ob.on(Qn.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&&Lb(e,"video",t.message,this.trackId),"NotAllowedError"===t.name?(Bn.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):Bn.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=nr();if(("Safari"===r.name&&15===Number(r.version)||mr())&&t&&t.then){const e=()=>{this.config.mirror&&(this.videoElement.style.transform="rotateY(180deg)")};t.then(e).catch(e)}}getCurrentFrame(){const e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;const t=e.getContext("2d");if(!t)return Bn.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 $y(((n,i)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await dR(e);n({buffer:t,width:r.width,height:r.height})}else i(new Cr(wr.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,t<0?.1:t>1?1:t)}))):await cR(e)}destroy(){this.renderStats=void 0,ob.off(Qn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),ob.off(Qn.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=ud.VideoStateStopped}initVideoElement(){if(this.videoElementStatus=dd.INIT,!this.videoElementCheckInterval&&(cA.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{(function(e){return e!==document.body&&document.body.contains(e)})(this.videoElement)||(this.videoElementStatus=dd.DESTROYED)}),1e3),In("ENABLE_VIDEO_FRAME_CALLBACK"))){var e,t;let r;const n=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",n),this.videoElementFreezeTimeout=window.setTimeout(i,In("VIDEO_FREEZE_DURATION")))},i=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===ud.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=ud.VideoStateFrozen:document.addEventListener("visibilitychange",n))},o=(e,t)=>{if(this.videoElementStatus===dd.PLAYING){if(this.renderStats?(this.renderStats.renderNum++,this.renderStats.curTs=t.mediaTime):this.renderStats={lastTs:t.mediaTime,curTs:t.mediaTime,lastRenderNum:0,renderNum:0},r){const e=t.presentationTime-r.presentationTime;this.videoState===ud.VideoStateStarting&&(this.videoState=ud.VideoStateDecoding),this.videoState===ud.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(i,In("VIDEO_FREEZE_DURATION"))),e<In("VIDEO_FREEZE_DURATION")&&this.videoState===ud.VideoStateFrozen&&(this.videoState=ud.VideoStateDecoding),e>In("VIDEO_FREEZE_DURATION")&&_O.lastVisibleTime>=_O.lastHiddenTime&&r.timestamp>_O.lastVisibleTime&&r.timestamp>_O.lastHiddenTime&&(this.renderFreezeAccTime+=e)}r=sA(sA({},t),{},{timestamp:e})}var n,s;In("ENABLE_VIDEO_FRAME_CALLBACK")&&(null===(n=(s=this.videoElement).requestVideoFrameCallback)||void 0===n||n.call(s,o))};null===(e=(t=this.videoElement).requestVideoFrameCallback)||void 0===e||e.call(t,o)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),br()&&!In("HIDE_NO_POSTER")&&(this.videoElement.poster="noposter");const r=nr();if("Safari"===r.name&&15===Number(r.version)||mr()||!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,lr()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,lr()&&this.videoElement.load();const n=this.videoElement.play();void 0!==n&&n.catch((e=>{Bn.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){cA.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.videoElementStatus=dd.NONE}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{Bn.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{Bn.error(e)})),this.autoplayFailed=!1,Rr()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};Rr()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),kb()}}const cA=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class dA extends aA{constructor(e){super(e),Fm(this,"container",void 0),Fm(this,"slot",void 0),this.slot=e.element,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;t!==this.slot&&(this.destroy(),this.slot=t),this.createElements()}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}play(e){var t;null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)&&super.play(e)}getCurrentFrame(){var e;return null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)?super.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameToUint8Array(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)?await super.getCurrentFrameToUint8Array(e,r):await cR(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{this.container.remove(),this.slot.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",In("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),this.slot.appendChild(this.container)}mountedVideoElement(){var e;!this.container||null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)||this.container.appendChild(this.videoElement),super.initVideoElement(),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.left="0",this.videoElement.style.top="0"}unmountedVideoElement(){var e;if(null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)){super.resetVideoElement();try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=document.createElement("video")}}resetVideoElement(){var e;null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)&&(super.resetVideoElement(),this.cacheVideoElement=this.videoElement,this.videoElement=document.createElement("video"))}getContainerElement(){return this.container}}var uA,lA,hA,pA,fA,_A,mA,EA,gA,TA,SA,vA,yA,bA,RA,AA,OA,IA,wA,CA,NA,kA,DA,PA,LA,MA,UA,xA,VA,FA,BA,jA,GA,WA,HA;function zA(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 KA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zA(Object(r),!0).forEach((function(t){Fm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let YA=(uA=Kn({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),lA=xb(),hA=Kn({argsMap:e=>[e.getTrackId()]}),pA=mn("LocalVideoTrack","_enabledMutex"),fA=Kn({argsMap:(e,t)=>[e.getTrackId(),t]}),_A=xb(),mA=mn("LocalVideoTrack","_enabledMutex"),EA=Kn({argsMap:(e,t)=>[e.getTrackId(),t]}),gA=xb(),TA=Kn({argsMap:(e,t)=>[e.getTrackId(),t]}),SA=xb(),vA=xb(),yA=Kn({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),bA=xb(),RA=xb(),AA=xb(),OA=xb(),IA=xb(),wA=xb(),CA=xb(),NA=Kn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),kA=Kn({argsMap:e=>[e.getTrackId()]}),DA=Kn({argsMap:e=>[e.getTrackId()]}),PA=Kn({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),LA=Kn(),MA=class e extends tb{get videoHeight(){if(dr()){const{height:e}=this._mediaStreamTrack.getSettings();return this._videoHeight=e,this._videoHeight}return this._videoHeight}get videoWidth(){if(dr()){const{width:e}=this._mediaStreamTrack.getSettings();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),Fm(this,"trackMediaType","video"),Fm(this,"_player",void 0),Fm(this,"isUseScaleResolutionDownBy",!1),Fm(this,"_videoVisibleTimer",null),Fm(this,"_statsTimer",null),Fm(this,"_previousVideoVisibleStatus",void 0),Fm(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),Fm(this,"_encoderConfig",void 0),Fm(this,"_scalabilityMode",{numSpatialLayers:1,numTemporalLayers:1}),Fm(this,"_optimizationMode",void 0),Fm(this,"_videoHeight",void 0),Fm(this,"_videoWidth",void 0),Fm(this,"_forceBitrateLimit",void 0),Fm(this,"_enabled",!0),Fm(this,"_processorDestination",void 0),Fm(this,"_processorContext",void 0),dr()){const{width:t,height:r}=e.getSettings();this._videoWidth=t,this._videoHeight=r}else this.updateMediaStreamTrackResolution();if(this._encoderConfig=t,this._scalabilityMode=r,this._optimizationMode=n,this._hints=o||[],-1===this._hints.indexOf(Kc.SCREEN_TRACK))this.updateBitrateFromProfile();else if(function(e,t,r){const n=nr();return!(n.name!==e||!n.osVersion)&&(r?Number(n.version)>=t&&Number(n.version)<=r:Number(n.version)===t)}($t.CHROME,115)&&-1!==or().indexOf("Windows")){const t=uR(e);t&&(Bn.info("local screen video track begin to inject frame"),this._mediaStreamTrack=t)}t&&-1!==this._hints.indexOf(Kc.CUSTOM_TRACK)&&this.setEncoderConfiguration(t),this._processorContext=new Xb(this.getTrackId(),"local"),this._processorDestination=new Zb(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:(Bn.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Bn.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=KA(KA(KA({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new aA(r):this._player=new dA(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(qc.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),In("CHECK_VIDEO_VISIBLE_INTERVAL"))}stop(){this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._statsTimer&&(this.isUseScaleResolutionDownBy=!1,window.clearInterval(this._statsTimer),this._statsTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(),this._player=void 0,Bn.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Bn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),!e){this._originMediaStreamTrack.enabled=!1;try{await Jr(this,zc.NEED_DISABLE_TRACK,this)}catch(e){throw Bn.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return t||(this._enabled=!1),void Bn.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await Jr(this,zc.NEED_ENABLE_TRACK,this)}catch(e){throw Bn.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}Bn.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,Bn.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await Jr(this,zc.NEED_MUTE_TRACK,this):await Jr(this,zc.NEED_UNMUTE_TRACK,this))}async setEncoderConfiguration(e,t){if(!this._enabled)throw new Cr(wr.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");if("720p_auto"===e?this.startMonitorStats():this._statsTimer&&(window.clearInterval(this._statsTimer),this._statsTimer=null),e=Lc(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),e.width||e.height||e.frameRate){const t=rR({encoderConfig:e});(dr()||hr()||Tr())&&(t.deviceId=void 0),Bn.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 Cr(wr.UNEXPECTED_ERROR,e.toString());throw Bn.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=e,-1===this._hints.indexOf(Kc.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Jr(this,zc.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Bn)}}getStats(){rn((()=>{Bn.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const e=Zr(this,zc.GET_STATS);return e||KA({},rd)}async setBeautyEffect(e){Bn.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 cR(e)}async setBitrateLimit(e){if(Bn.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);try{await Jr(this,zc.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Bn)}}}async setOptimizationMode(e){if("motion"!==e&&"detail"!==e&&"balanced"!==e)return void Bn.error(wr.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const t=this._optimizationMode;try{this._optimizationMode=e,await Jr(this,zc.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=t,Bn.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}Bn.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return Bn.error(wr.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,Bn.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){tR(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(an)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}async setSenderConfiguration(e){if(!this._enabled)throw new Cr(wr.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");Bn.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(e)),e=Lc(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(Kc.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Jr(this,zc.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Bn)}}updateBitrateFromProfile(){if(!this._encoderConfig)return;const{width:e,height:t,frameRate:r}=this.getMediaStreamTrackSettings();if(!e||!t||!r)return;const{bitrateMax:n,bitrateMin:i}=this._encoderConfig;if(null==i||null==n){const{max:o,min:s}=oR(e,t,r,i,n);this._encoderConfig.bitrateMin=s,this._encoderConfig.bitrateMax=o,Bn.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(e,", h: ").concat(t,", fps: ").concat(r,"] => [brMax: ").concat(o,", brMin: ").concat(s,"]"))}}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},{element:i,slot:o}=n;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=xr.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Yn.reportApiInvoke(null,{tag:Hr.TRACER,name:Wr.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 Cr(wr.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}pipe(e){if(this.processor===e)return e;if(e._source)throw new Cr(wr.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],n=this._encoderConfig;t&&(n=KA(KA({},n),Lc(t))),n=en(n);const i=sn(8,"track-video-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,n,en(this._scalabilityMode),this._optimizationMode,i,en(this._hints));return t&&n&&o.setEncoderConfiguration(n),Bn.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 Cr(wr.INVALID_PARAMS,"track should be an instance of MediaStreamTrack");if("video"!==e.kind)throw new Cr(wr.INVALID_PARAMS,"track should be a video MediaStreamTrack");await this._updateOriginMediaStreamTrack(e,t,!0),this.updateMediaStreamTrackResolution()}startMonitorStats(){if(!dr()&&!hr())return;this._statsTimer&&window.clearInterval(this._statsTimer);let e=2,t=kc[e];let r=-1;let n=Date.now();const i=e=>{e>2||e<0||(n=Date.now(),t=kc[e],this.setSenderConfiguration(t))};this.isUseScaleResolutionDownBy=!0,this._statsTimer=window.setInterval((()=>{const o=this.getStats(),s=Zr(this,zc.GET_RTC_STATS);if(o.sendPackets>0&&s){-1===r&&(r=Date.now());const a=Date.now();if(a-r<1e3||a-n<In("PROFILE_SWITCH_INTERVAL"))return;const c=o.sendFrameRate,d=.6*t.frameRate,u=.9*t.frameRate;"number"==typeof c&&c>0&&c<d?e>0&&(e--,i(e),Bn.debug("[".concat(this.getTrackId(),"] step down for fps ").concat(c,", switchProfile to ").concat(e))):s.OutgoingAvailableBandwidth<t.bitrateMin?e>0&&(e--,i(e),Bn.debug("[".concat(this.getTrackId(),"] step down for OutgoingAvailableBandwidth ").concat(s.OutgoingAvailableBandwidth,", bitrateMin ").concat(t.bitrateMin,", switchProfile to ").concat(e))):"number"==typeof c&&c>u&&e<kc.length-1&&s.OutgoingAvailableBandwidth>1.2*kc[e+1].bitrateMin&&(e++,i(e),Bn.debug("[".concat(this.getTrackId(),"] step up for fps ").concat(c,", OutgoingAvailableBandwidth ").concat(s.OutgoingAvailableBandwidth,", switchProfile to ").concat(e)))}}),In("CHECK_LOCAL_STATS_INTERVAL"))}sendSeiData(e){if(rn((()=>{Yn.reportApiInvoke(null,{name:Wr.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:Hr.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!In("ENABLE_VIDEO_SEI")||!In("ENABLE_ENCODED_TRANSFORM"))return void Bn.warning('To send/receive SEI, please call AgoraRTC.setParameter("ENABLE_VIDEO_SEI", true) before instantiate IAgoraRtcClient');if(e instanceof Uint8Array==!1)return new Cr(wr.INVALID_PARAMS,"Invalid argument type, ILocalVideoTrack.sendSeiData() only accept Uint8Array argument.").throw();const t=this.getRTCRtpTransceiver();if(!t)return void Bn.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?this.safeEmit("sei-to-send",e):Bn.warning("SEI is not supported by ".concat(n))}bindProcessorDestinationEvents(){this.processorDestination.on(od.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await Jr(this,zc.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await Jr(this,zc.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(od.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(sd.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(sd.REQUEST_CONSTRAINTS)}},JE(MA.prototype,"play",[uA,lA],Object.getOwnPropertyDescriptor(MA.prototype,"play"),MA.prototype),JE(MA.prototype,"stop",[hA],Object.getOwnPropertyDescriptor(MA.prototype,"stop"),MA.prototype),JE(MA.prototype,"setEnabled",[pA,fA,_A],Object.getOwnPropertyDescriptor(MA.prototype,"setEnabled"),MA.prototype),JE(MA.prototype,"setMuted",[mA,EA,gA],Object.getOwnPropertyDescriptor(MA.prototype,"setMuted"),MA.prototype),JE(MA.prototype,"setEncoderConfiguration",[TA,SA],Object.getOwnPropertyDescriptor(MA.prototype,"setEncoderConfiguration"),MA.prototype),JE(MA.prototype,"getStats",[vA],Object.getOwnPropertyDescriptor(MA.prototype,"getStats"),MA.prototype),JE(MA.prototype,"setBeautyEffect",[yA,bA],Object.getOwnPropertyDescriptor(MA.prototype,"setBeautyEffect"),MA.prototype),JE(MA.prototype,"getCurrentFrameData",[RA],Object.getOwnPropertyDescriptor(MA.prototype,"getCurrentFrameData"),MA.prototype),JE(MA.prototype,"getCurrentFrameImage",[AA],Object.getOwnPropertyDescriptor(MA.prototype,"getCurrentFrameImage"),MA.prototype),JE(MA.prototype,"setBitrateLimit",[OA],Object.getOwnPropertyDescriptor(MA.prototype,"setBitrateLimit"),MA.prototype),JE(MA.prototype,"setOptimizationMode",[IA],Object.getOwnPropertyDescriptor(MA.prototype,"setOptimizationMode"),MA.prototype),JE(MA.prototype,"setScalabiltyMode",[wA],Object.getOwnPropertyDescriptor(MA.prototype,"setScalabiltyMode"),MA.prototype),JE(MA.prototype,"updateMediaStreamTrackResolution",[CA],Object.getOwnPropertyDescriptor(MA.prototype,"updateMediaStreamTrackResolution"),MA.prototype),JE(MA.prototype,"pipe",[NA],Object.getOwnPropertyDescriptor(MA.prototype,"pipe"),MA.prototype),JE(MA.prototype,"unpipe",[kA],Object.getOwnPropertyDescriptor(MA.prototype,"unpipe"),MA.prototype),JE(MA.prototype,"close",[DA],Object.getOwnPropertyDescriptor(MA.prototype,"close"),MA.prototype),JE(MA.prototype,"replaceTrack",[PA],Object.getOwnPropertyDescriptor(MA.prototype,"replaceTrack"),MA.prototype),JE(MA.prototype,"startMonitorStats",[LA],Object.getOwnPropertyDescriptor(MA.prototype,"startMonitorStats"),MA.prototype),MA),JA=(UA=Kn({argsMap:(e,t)=>[e.getTrackId(),t]}),xA=xb(),VA=mn("CameraVideoTrack","_enabledMutex"),FA=Kn({argsMap:(e,t)=>[e.getTrackId(),t]}),BA=xb(),jA=Kn({argsMap:(e,t)=>[e.getTrackId(),t]}),GA=xb(),WA=Kn({argsMap:e=>[e.getTrackId()]}),HA=class e extends YA{get __className__(){return"CameraVideoTrack"}constructor(e,t,r,n,i,o){super(e,Lc(t.encoderConfig),n,i,o),Fm(this,"_config",void 0),Fm(this,"_originalConstraints",void 0),Fm(this,"_constraints",void 0),Fm(this,"_enabled",!0),Fm(this,"_deviceName","default"),Fm(this,"tryResumeVideoForIOS15_16WeChat",(async()=>{!mr()&&!Er()||function(){const e=nr();if(e.os!==Qt.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()||nr().name!==$t.WECHAT||!this._enabled||this._isClosed||(Bn.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=Lc(this._config.encoderConfig),ob.on(Qn.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),ob.on(Qn.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(Bn.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await wb.getDeviceById(e),r={};r.video=KA({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let n=null;try{n=await bb(r,this.getTrackId())}catch(e){throw Bn.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await bb({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 Bn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await wb.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw Bn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Bn.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){Bn.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:KA(KA({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await bb(t,this.getTrackId())}catch(t){throw Bn.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await bb({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=KA({},t.video),Bn.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Bn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await bb({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await Jr(this,zc.NEED_ENABLE_TRACK,this)}catch(e){throw Bn.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),Bn.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 Jr(this,zc.NEED_DISABLE_TRACK,this)}catch(e){throw Bn.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}Bn.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new Cr(wr.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");"720p_auto"===e?this.startMonitorStats():this._statsTimer&&(window.clearInterval(this._statsTimer),this._statsTimer=null),e=Lc(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate||e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate||e.bitrateMin);const r=$r(this._config);r.encoderConfig=e;const n=rR(r);(dr()||hr()||Tr())&&(n.deviceId=void 0),Bn.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 Cr(wr.UNEXPECTED_ERROR,e.toString());throw Bn.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(Kc.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Jr(this,zc.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Bn)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((hr()||Tr())&&this._enabled&&!this._isClosed&&ob.duringInterruption){const e=async()=>{ob.off(Qn.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Bn.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};ob.on(Qn.IOS_INTERRUPTION_END,e)}else Bn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(qc.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=wb.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await bb({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),ob.off(Qn.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),ob.off(Qn.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._encoderConfig;t&&(n=KA(KA({},n),Lc(t))),n=en(n);const i=sn(8,"track-cam-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,en(KA(KA({},this._config),{},{encoderConfig:n})),en(this._constraints),en(this._scalabilityMode),this._optimizationMode,i);return t&&n&&o.setEncoderConfiguration(n),Bn.debug("clone track from ".concat(this.getTrackId()," to ").concat(i,", clone ").concat(r)),o}bindProcessorContextEvents(){this.processorContext.on(sd.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(sd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}},JE(HA.prototype,"setDevice",[UA,xA],Object.getOwnPropertyDescriptor(HA.prototype,"setDevice"),HA.prototype),JE(HA.prototype,"setEnabled",[VA,FA,BA],Object.getOwnPropertyDescriptor(HA.prototype,"setEnabled"),HA.prototype),JE(HA.prototype,"setEncoderConfiguration",[jA,GA],Object.getOwnPropertyDescriptor(HA.prototype,"setEncoderConfiguration"),HA.prototype),JE(HA.prototype,"close",[WA],Object.getOwnPropertyDescriptor(HA.prototype,"close"),HA.prototype),HA);function ZA(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 XA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ZA(Object(r),!0).forEach((function(t){Fm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function qA(e,t,r,n){r.optimizationMode&&(n&&n.width&&n.height?(r.encoderConfig=XA(XA({},n),{},{bitrateMin:n.bitrateMin,bitrateMax:n.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?Bn.debug("[".concat(e,"] set content hint to"),r.optimizationMode):Bn.debug("[".concat(e,"] set content hint failed")))):Bn.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}var QA,$A,eO,tO,rO,nO,iO,oO,sO,aO,cO,dO;function uO(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 lO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?uO(Object(r),!0).forEach((function(t){Fm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class hO extends eb{getUserId(){return this._userId}constructor(e,t,r,n){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(n.clientId,"_").concat(sn(5,""))),Fm(this,"_userId",void 0),Fm(this,"_uintId",void 0),Fm(this,"_isDestroyed",!1),Fm(this,"store",void 0),Fm(this,"processor",void 0),Fm(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,Bn.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}let pO=(QA=Kn({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),$A=Kn({argsMap:e=>[e.getTrackId()]}),eO=Kn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),tO=Kn({argsMap:e=>[e.getTrackId()]}),rO=class extends hO{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==dd.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,n){super(e,t,r,n),Fm(this,"_videoVisibleTimer",null),Fm(this,"_previousVideoVisibleStatus",void 0),Fm(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),Fm(this,"trackMediaType","video"),Fm(this,"_videoWidth",void 0),Fm(this,"_videoHeight",void 0),Fm(this,"_player",void 0),Fm(this,"processorDestination",void 0),Fm(this,"processorContext",void 0),this.updateMediaStreamTrackResolution(),this.processorContext=new Xb(this.getTrackId(),"remote"),this.processorDestination=new Zb(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){rn((()=>{Bn.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return Zr(this,zc.GET_STATS)||lO({},id)}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:(Bn.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Bn.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=lO(lO({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new aA(r):this._player=new dA(r),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(Qc.FIRST_FRAME_DECODED)},this._player.onVideoStateChanged=e=>{this.safeEmit(Qc.VIDEO_STATE_CHANGED,e)}),this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(Qc.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),In("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,Bn.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){tR(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(an)}_updatePlayerSource(){Bn.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},{element:i,slot:o}=n;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=xr.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Yn.reportApiInvoke(null,{tag:Hr.TRACER,name:Wr.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 Cr(wr.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}pipe(e){if(this.processor===e)return e;if(e._source)throw new Cr(wr.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(od.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(od.ON_TRACK)}_destroy(){super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(e){this.emit(Xc.SEI_RECEIVED,e)}},JE(rO.prototype,"play",[QA],Object.getOwnPropertyDescriptor(rO.prototype,"play"),rO.prototype),JE(rO.prototype,"stop",[$A],Object.getOwnPropertyDescriptor(rO.prototype,"stop"),rO.prototype),JE(rO.prototype,"pipe",[eO],Object.getOwnPropertyDescriptor(rO.prototype,"pipe"),rO.prototype),JE(rO.prototype,"unpipe",[tO],Object.getOwnPropertyDescriptor(rO.prototype,"unpipe"),rO.prototype),rO),fO=(nO=Kn({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),iO=Kn({argsMap:(e,t)=>[e.getTrackId(),t]}),oO=Kn({argsMap:e=>[e.getTrackId()]}),sO=Kn({argsMap:e=>[e.getTrackId()]}),aO=Kn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),cO=Kn({argsMap:e=>[e.getTrackId()]}),dO=class extends hO{get isPlaying(){return this._useAudioElement?Ub.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(e,t,r,n){super(e,t,r,n),Fm(this,"trackMediaType","audio"),Fm(this,"_source",void 0),Fm(this,"_useAudioElement",!0),Fm(this,"_volume",100),Fm(this,"processorContext",void 0),Fm(this,"processorDestination",void 0),Fm(this,"_played",!1),Fm(this,"_bypassWebAudio",!1),In("DISABLE_WEBAUDIO")?(this._source=new $b,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new Eb(e,!0),In("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once($c.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(Qc.FIRST_FRAME_DECODED)})),this.processorContext=new Qb(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new qb(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on($c.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($c.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners($c.ON_AUDIO_BUFFER),this._source.on($c.ON_AUDIO_BUFFER,(t=>e(t)))}setVolume(e){this._volume=e,this._useAudioElement?Ub.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!qn())throw new Cr(wr.NOT_SUPPORTED,"your browser does not support setting the audio output device");await Ub.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getStats(){rn((()=>{Bn.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return Zr(this,zc.GET_STATS)||lO({},nd)}play(){Bn.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement?(Bn.debug("[".concat(this.getTrackId(),"] use audio element to play")),Ub.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):this._source.play()}stop(){Bn.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?Ub.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];Bn.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&Ub.updateTrack(this.getTrackId(),this._mediaStreamTrack)}pipe(e){if(this._bypassWebAudio)throw new Cr(wr.NOT_SUPPORTED,"can not pipe extension when WebAudio disabled");if(this.processor===e)return e;if(e._source)throw new Cr(wr.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 Cr(wr.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(od.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(od.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(od.ON_TRACK),this.processorDestination.removeAllListeners(od.ON_NODE)}},JE(dO.prototype,"setVolume",[nO],Object.getOwnPropertyDescriptor(dO.prototype,"setVolume"),dO.prototype),JE(dO.prototype,"setPlaybackDevice",[iO],Object.getOwnPropertyDescriptor(dO.prototype,"setPlaybackDevice"),dO.prototype),JE(dO.prototype,"play",[oO],Object.getOwnPropertyDescriptor(dO.prototype,"play"),dO.prototype),JE(dO.prototype,"stop",[sO],Object.getOwnPropertyDescriptor(dO.prototype,"stop"),dO.prototype),JE(dO.prototype,"pipe",[aO],Object.getOwnPropertyDescriptor(dO.prototype,"pipe"),dO.prototype),JE(dO.prototype,"unpipe",[cO],Object.getOwnPropertyDescriptor(dO.prototype,"unpipe"),dO.prototype),dO);const _O=new class extends Fr{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),Fm(this,"_lastHiddenTime",0),Fm(this,"_lastVisibleTime",0),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),Bn.debug("document visibility went ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}};
6
- /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function mO(e){let t=e.length;for(;--t>=0;)e[t]=0}const EO=256,gO=286,TO=30,SO=15,vO=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),yO=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),bO=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),RO=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),AO=new Array(576);mO(AO);const OO=new Array(60);mO(OO);const IO=new Array(512);mO(IO);const wO=new Array(256);mO(wO);const CO=new Array(29);mO(CO);const NO=new Array(TO);function kO(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}let DO,PO,LO;function MO(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}mO(NO);const UO=e=>e<256?IO[e]:IO[256+(e>>>7)],xO=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},VO=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,xO(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)},FO=(e,t,r)=>{VO(e,r[2*t],r[2*t+1])},BO=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},jO=(e,t,r)=>{const n=new Array(16);let i,o,s=0;for(i=1;i<=SO;i++)s=s+r[i-1]<<1,n[i]=s;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=BO(n[t]++,t))}},GO=e=>{let t;for(t=0;t<gO;t++)e.dyn_ltree[2*t]=0;for(t=0;t<TO;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},WO=e=>{e.bi_valid>8?xO(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},HO=(e,t,r,n)=>{const i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]},zO=(e,t,r)=>{const n=e.heap[r];let i=r<<1;for(;i<=e.heap_len&&(i<e.heap_len&&HO(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!HO(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n},KO=(e,t,r)=>{let n,i,o,s,a=0;if(0!==e.sym_next)do{n=255&e.pending_buf[e.sym_buf+a++],n+=(255&e.pending_buf[e.sym_buf+a++])<<8,i=e.pending_buf[e.sym_buf+a++],0===n?FO(e,i,t):(o=wO[i],FO(e,o+EO+1,t),s=vO[o],0!==s&&(i-=CO[o],VO(e,i,s)),n--,o=UO(n),FO(e,o,r),s=yO[o],0!==s&&(n-=NO[o],VO(e,n,s)))}while(a<e.sym_next);FO(e,256,t)},YO=(e,t)=>{const r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let s,a,c,d=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<o;s++)0!==r[2*s]?(e.heap[++e.heap_len]=d=s,e.depth[s]=0):r[2*s+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=d<2?++d:0,r[2*c]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=n[2*c+1]);for(t.max_code=d,s=e.heap_len>>1;s>=1;s--)zO(e,r,s);c=o;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],zO(e,r,1),a=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=a,r[2*c]=r[2*s]+r[2*a],e.depth[c]=(e.depth[s]>=e.depth[a]?e.depth[s]:e.depth[a])+1,r[2*s+1]=r[2*a+1]=c,e.heap[1]=c++,zO(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,c=t.stat_desc.max_length;let d,u,l,h,p,f,_=0;for(h=0;h<=SO;h++)e.bl_count[h]=0;for(r[2*e.heap[e.heap_max]+1]=0,d=e.heap_max+1;d<573;d++)u=e.heap[d],h=r[2*r[2*u+1]+1]+1,h>c&&(h=c,_++),r[2*u+1]=h,u>n||(e.bl_count[h]++,p=0,u>=a&&(p=s[u-a]),f=r[2*u],e.opt_len+=f*(h+p),o&&(e.static_len+=f*(i[2*u+1]+p)));if(0!==_){do{for(h=c-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[c]--,_-=2}while(_>0);for(h=c;0!==h;h--)for(u=e.bl_count[h];0!==u;)l=e.heap[--d],l>n||(r[2*l+1]!==h&&(e.opt_len+=(h-r[2*l+1])*r[2*l],r[2*l+1]=h),u--)}})(e,t),jO(r,d,e.bl_count)},JO=(e,t,r)=>{let n,i,o=-1,s=t[1],a=0,c=7,d=4;for(0===s&&(c=138,d=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=s,s=t[2*(n+1)+1],++a<c&&i===s||(a<d?e.bl_tree[2*i]+=a:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,o=i,0===s?(c=138,d=3):i===s?(c=6,d=3):(c=7,d=4))},ZO=(e,t,r)=>{let n,i,o=-1,s=t[1],a=0,c=7,d=4;for(0===s&&(c=138,d=3),n=0;n<=r;n++)if(i=s,s=t[2*(n+1)+1],!(++a<c&&i===s)){if(a<d)do{FO(e,i,e.bl_tree)}while(0!=--a);else 0!==i?(i!==o&&(FO(e,i,e.bl_tree),a--),FO(e,16,e.bl_tree),VO(e,a-3,2)):a<=10?(FO(e,17,e.bl_tree),VO(e,a-3,3)):(FO(e,18,e.bl_tree),VO(e,a-11,7));a=0,o=i,0===s?(c=138,d=3):i===s?(c=6,d=3):(c=7,d=4)}};let XO=!1;const qO=(e,t,r,n)=>{VO(e,0+(n?1:0),3),WO(e),xO(e,r),xO(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var QO=(e,t,r,n)=>{let i,o,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<EO;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),YO(e,e.l_desc),YO(e,e.d_desc),s=(e=>{let t;for(JO(e,e.dyn_ltree,e.l_desc.max_code),JO(e,e.dyn_dtree,e.d_desc.max_code),YO(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*RO[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?qO(e,t,r,n):4===e.strategy||o===i?(VO(e,2+(n?1:0),3),KO(e,AO,OO)):(VO(e,4+(n?1:0),3),((e,t,r,n)=>{let i;for(VO(e,t-257,5),VO(e,r-1,5),VO(e,n-4,4),i=0;i<n;i++)VO(e,e.bl_tree[2*RO[i]+1],3);ZO(e,e.dyn_ltree,t-1),ZO(e,e.dyn_dtree,r-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),KO(e,e.dyn_ltree,e.dyn_dtree)),GO(e),n&&WO(e)},$O={_tr_init:e=>{XO||((()=>{let e,t,r,n,i;const o=new Array(16);for(r=0,n=0;n<28;n++)for(CO[n]=r,e=0;e<1<<vO[n];e++)wO[r++]=n;for(wO[r-1]=n,i=0,n=0;n<16;n++)for(NO[n]=i,e=0;e<1<<yO[n];e++)IO[i++]=n;for(i>>=7;n<TO;n++)for(NO[n]=i<<7,e=0;e<1<<yO[n]-7;e++)IO[256+i++]=n;for(t=0;t<=SO;t++)o[t]=0;for(e=0;e<=143;)AO[2*e+1]=8,e++,o[8]++;for(;e<=255;)AO[2*e+1]=9,e++,o[9]++;for(;e<=279;)AO[2*e+1]=7,e++,o[7]++;for(;e<=287;)AO[2*e+1]=8,e++,o[8]++;for(jO(AO,287,o),e=0;e<TO;e++)OO[2*e+1]=5,OO[2*e]=BO(e,5);DO=new kO(AO,vO,257,gO,SO),PO=new kO(OO,yO,0,TO,SO),LO=new kO(new Array(0),bO,0,19,7)})(),XO=!0),e.l_desc=new MO(e.dyn_ltree,DO),e.d_desc=new MO(e.dyn_dtree,PO),e.bl_desc=new MO(e.bl_tree,LO),e.bi_buf=0,e.bi_valid=0,GO(e)},_tr_stored_block:qO,_tr_flush_block:QO,_tr_tally:(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(wO[r]+EO+1)]++,e.dyn_dtree[2*UO(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{VO(e,2,3),FO(e,256,AO),(e=>{16===e.bi_valid?(xO(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var eI=(e,t,r,n)=>{let i=65535&e|0,o=e>>>16&65535|0,s=0;for(;0!==r;){s=r>2e3?2e3:r,r-=s;do{i=i+t[n++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0};const tI=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var rI=(e,t,r,n)=>{const i=tI,o=n+r;e^=-1;for(let r=n;r<o;r++)e=e>>>8^i[255&(e^t[r])];return-1^e},nI={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},iI={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:oI,_tr_stored_block:sI,_tr_flush_block:aI,_tr_tally:cI,_tr_align:dI}=$O,{Z_NO_FLUSH:uI,Z_PARTIAL_FLUSH:lI,Z_FULL_FLUSH:hI,Z_FINISH:pI,Z_BLOCK:fI,Z_OK:_I,Z_STREAM_END:mI,Z_STREAM_ERROR:EI,Z_DATA_ERROR:gI,Z_BUF_ERROR:TI,Z_DEFAULT_COMPRESSION:SI,Z_FILTERED:vI,Z_HUFFMAN_ONLY:yI,Z_RLE:bI,Z_FIXED:RI,Z_DEFAULT_STRATEGY:AI,Z_UNKNOWN:OI,Z_DEFLATED:II}=iI,wI=286,CI=30,NI=19,kI=2*wI+1,DI=15,PI=258,LI=262,MI=42,UI=113,xI=666,VI=(e,t)=>(e.msg=nI[t],t),FI=e=>2*e-(e>4?9:0),BI=e=>{let t=e.length;for(;--t>=0;)e[t]=0},jI=e=>{let t,r,n,i=e.w_size;t=e.hash_size,n=t;do{r=e.head[--n],e.head[n]=r>=i?r-i:0}while(--t);t=i,n=t;do{r=e.prev[--n],e.prev[n]=r>=i?r-i:0}while(--t)};let GI=(e,t,r)=>(t<<e.hash_shift^r)&e.hash_mask;const WI=e=>{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},HI=(e,t)=>{aI(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,WI(e.strm)},zI=(e,t)=>{e.pending_buf[e.pending++]=t},KI=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},YI=(e,t,r,n)=>{let i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),r),1===e.state.wrap?e.adler=eI(e.adler,t,i,r):2===e.state.wrap&&(e.adler=rI(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)},JI=(e,t)=>{let r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match;const c=e.strstart>e.w_size-LI?e.strstart-(e.w_size-LI):0,d=e.window,u=e.w_mask,l=e.prev,h=e.strstart+PI;let p=d[o+s-1],f=d[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(r=t,d[r+s]===f&&d[r+s-1]===p&&d[r]===d[o]&&d[++r]===d[o+1]){o+=2,r++;do{}while(d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&o<h);if(n=PI-(h-o),o=h-PI,n>s){if(e.match_start=t,s=n,n>=a)break;p=d[o+s-1],f=d[o+s]}}}while((t=l[t&u])>c&&0!=--i);return s<=e.lookahead?s:e.lookahead},ZI=e=>{const t=e.w_size;let r,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-LI)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),jI(e),n+=t),0===e.strm.avail_in)break;if(r=YI(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=r,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=GI(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=GI(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<LI&&0!==e.strm.avail_in)},XI=(e,t)=>{let r,n,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,s=0,a=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,n=e.strstart-e.block_start,r>n+e.strm.avail_in&&(r=n+e.strm.avail_in),r>i&&(r=i),r<o&&(0===r&&t!==pI||t===uI||r!==n+e.strm.avail_in))break;s=t===pI&&r===n+e.strm.avail_in?1:0,sI(e,0,0,s),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,WI(e.strm),n&&(n>r&&(n=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,r-=n),r&&(YI(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===s);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?4:t!==uI&&t!==pI&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(YI(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,n=e.strstart-e.block_start,(n>=o||(n||t===pI)&&t!==uI&&0===e.strm.avail_in&&n<=i)&&(r=n>i?i:n,s=t===pI&&0===e.strm.avail_in&&r===n?1:0,sI(e,e.block_start,r,s),e.block_start+=r,WI(e.strm)),s?3:1)},qI=(e,t)=>{let r,n;for(;;){if(e.lookahead<LI){if(ZI(e),e.lookahead<LI&&t===uI)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=GI(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-LI&&(e.match_length=JI(e,r)),e.match_length>=3)if(n=cI(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=GI(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=GI(e,e.ins_h,e.window[e.strstart+1]);else n=cI(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(HI(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===pI?(HI(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(HI(e,!1),0===e.strm.avail_out)?1:2},QI=(e,t)=>{let r,n,i;for(;;){if(e.lookahead<LI){if(ZI(e),e.lookahead<LI&&t===uI)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=GI(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-LI&&(e.match_length=JI(e,r),e.match_length<=5&&(e.strategy===vI||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=cI(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=GI(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(HI(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=cI(e,0,e.window[e.strstart-1]),n&&HI(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=cI(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===pI?(HI(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(HI(e,!1),0===e.strm.avail_out)?1:2};function $I(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}const ew=[new $I(0,0,0,0,XI),new $I(4,4,8,4,qI),new $I(4,5,16,8,qI),new $I(4,6,32,32,qI),new $I(4,4,16,16,QI),new $I(8,16,32,32,QI),new $I(8,16,128,128,QI),new $I(8,32,128,256,QI),new $I(32,128,258,1024,QI),new $I(32,258,258,4096,QI)];function tw(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=II,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(2*kI),this.dyn_dtree=new Uint16Array(2*(2*CI+1)),this.bl_tree=new Uint16Array(2*(2*NI+1)),BI(this.dyn_ltree),BI(this.dyn_dtree),BI(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(DI+1),this.heap=new Uint16Array(2*wI+1),BI(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*wI+1),BI(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const rw=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==MI&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==UI&&t.status!==xI?1:0},nw=e=>{if(rw(e))return VI(e,EI);e.total_in=e.total_out=0,e.data_type=OI;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?MI:UI,e.adler=2===t.wrap?0:1,t.last_flush=-2,oI(t),_I},iw=e=>{const t=nw(e);var r;return t===_I&&((r=e.state).window_size=2*r.w_size,BI(r.head),r.max_lazy_match=ew[r.level].max_lazy,r.good_match=ew[r.level].good_length,r.nice_match=ew[r.level].nice_length,r.max_chain_length=ew[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},ow=(e,t,r,n,i,o)=>{if(!e)return EI;let s=1;if(t===SI&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>9||r!==II||n<8||n>15||t<0||t>9||o<0||o>RI||8===n&&1!==s)return VI(e,EI);8===n&&(n=9);const a=new tw;return e.state=a,a.strm=e,a.status=MI,a.wrap=s,a.gzhead=null,a.w_bits=n,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=o,a.method=r,iw(e)};var sw=(e,t)=>{if(rw(e)||t>fI||t<0)return e?VI(e,EI):EI;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===xI&&t!==pI)return VI(e,0===e.avail_out?TI:EI);const n=r.last_flush;if(r.last_flush=t,0!==r.pending){if(WI(e),0===e.avail_out)return r.last_flush=-1,_I}else if(0===e.avail_in&&FI(t)<=FI(n)&&t!==pI)return VI(e,TI);if(r.status===xI&&0!==e.avail_in)return VI(e,TI);if(r.status===MI&&0===r.wrap&&(r.status=UI),r.status===MI){let t=II+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=yI||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=n<<6,0!==r.strstart&&(t|=32),t+=31-t%31,KI(r,t),0!==r.strstart&&(KI(r,e.adler>>>16),KI(r,65535&e.adler)),e.adler=1,r.status=UI,WI(e),0!==r.pending)return r.last_flush=-1,_I}if(57===r.status)if(e.adler=0,zI(r,31),zI(r,139),zI(r,8),r.gzhead)zI(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),zI(r,255&r.gzhead.time),zI(r,r.gzhead.time>>8&255),zI(r,r.gzhead.time>>16&255),zI(r,r.gzhead.time>>24&255),zI(r,9===r.level?2:r.strategy>=yI||r.level<2?4:0),zI(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(zI(r,255&r.gzhead.extra.length),zI(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=rI(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(zI(r,0),zI(r,0),zI(r,0),zI(r,0),zI(r,0),zI(r,9===r.level?2:r.strategy>=yI||r.level<2?4:0),zI(r,3),r.status=UI,WI(e),0!==r.pending)return r.last_flush=-1,_I;if(69===r.status){if(r.gzhead.extra){let t=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let i=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=rI(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=i,WI(e),0!==r.pending)return r.last_flush=-1,_I;t=0,n-=i}let i=new Uint8Array(r.gzhead.extra);r.pending_buf.set(i.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>t&&(e.adler=rI(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=rI(e.adler,r.pending_buf,r.pending-n,n)),WI(e),0!==r.pending)return r.last_flush=-1,_I;n=0}t=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,zI(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=rI(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=rI(e.adler,r.pending_buf,r.pending-n,n)),WI(e),0!==r.pending)return r.last_flush=-1,_I;n=0}t=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,zI(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=rI(e.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(WI(e),0!==r.pending))return r.last_flush=-1,_I;zI(r,255&e.adler),zI(r,e.adler>>8&255),e.adler=0}if(r.status=UI,WI(e),0!==r.pending)return r.last_flush=-1,_I}if(0!==e.avail_in||0!==r.lookahead||t!==uI&&r.status!==xI){let n=0===r.level?XI(r,t):r.strategy===yI?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(ZI(e),0===e.lookahead)){if(t===uI)return 1;break}if(e.match_length=0,r=cI(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(HI(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===pI?(HI(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(HI(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===bI?((e,t)=>{let r,n,i,o;const s=e.window;for(;;){if(e.lookahead<=PI){if(ZI(e),e.lookahead<=PI&&t===uI)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){o=e.strstart+PI;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<o);e.match_length=PI-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=cI(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=cI(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(HI(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===pI?(HI(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(HI(e,!1),0===e.strm.avail_out)?1:2})(r,t):ew[r.level].func(r,t);if(3!==n&&4!==n||(r.status=xI),1===n||3===n)return 0===e.avail_out&&(r.last_flush=-1),_I;if(2===n&&(t===lI?dI(r):t!==fI&&(sI(r,0,0,!1),t===hI&&(BI(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),WI(e),0===e.avail_out))return r.last_flush=-1,_I}return t!==pI?_I:r.wrap<=0?mI:(2===r.wrap?(zI(r,255&e.adler),zI(r,e.adler>>8&255),zI(r,e.adler>>16&255),zI(r,e.adler>>24&255),zI(r,255&e.total_in),zI(r,e.total_in>>8&255),zI(r,e.total_in>>16&255),zI(r,e.total_in>>24&255)):(KI(r,e.adler>>>16),KI(r,65535&e.adler)),WI(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?_I:mI)},aw=(e,t)=>{let r=t.length;if(rw(e))return EI;const n=e.state,i=n.wrap;if(2===i||1===i&&n.status!==MI||n.lookahead)return EI;if(1===i&&(e.adler=eI(e.adler,t,r,0)),n.wrap=0,r>=n.w_size){0===i&&(BI(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(r-n.w_size,r),0),t=e,r=n.w_size}const o=e.avail_in,s=e.next_in,a=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,ZI(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=GI(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++}while(--t);n.strstart=e,n.lookahead=2,ZI(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=s,e.input=a,e.avail_in=o,n.wrap=i,_I},cw={deflateInit:(e,t)=>ow(e,t,II,15,8,AI),deflateInit2:ow,deflateReset:iw,deflateResetKeep:nw,deflateSetHeader:(e,t)=>rw(e)||2!==e.state.wrap?EI:(e.state.gzhead=t,_I),deflate:sw,deflateEnd:e=>{if(rw(e))return EI;const t=e.state.status;return e.state=null,t===UI?VI(e,gI):_I},deflateSetDictionary:aw,deflateInfo:"pako deflate (from Nodeca project)"};const dw=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var uw={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)dw(r,t)&&(e[t]=r[t])}}return e},flattenChunks:e=>{let t=0;for(let r=0,n=e.length;r<n;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,n=0,i=e.length;t<i;t++){let i=e[t];r.set(i,n),n+=i.length}return r}};let lw=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){lw=!1}const hw=new Uint8Array(256);for(let e=0;e<256;e++)hw[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;hw[254]=hw[254]=1;var pw={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,n,i,o,s=e.length,a=0;for(i=0;i<s;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<s&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),a+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(a),o=0,i=0;o<a;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<s&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},buf2string:(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let t=e[n++];if(t<128){o[i++]=t;continue}let s=hw[t];if(s>4)o[i++]=65533,n+=s-1;else{for(t&=2===s?31:3===s?15:7;s>1&&n<r;)t=t<<6|63&e[n++],s--;s>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&lw)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r})(o,i)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+hw[e[r]]>t?r:t}};var fw=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const _w=Object.prototype.toString,{Z_NO_FLUSH:mw,Z_SYNC_FLUSH:Ew,Z_FULL_FLUSH:gw,Z_FINISH:Tw,Z_OK:Sw,Z_STREAM_END:vw,Z_DEFAULT_COMPRESSION:yw,Z_DEFAULT_STRATEGY:bw,Z_DEFLATED:Rw}=iI;function Aw(e){this.options=uw.assign({level:yw,method:Rw,chunkSize:16384,windowBits:15,memLevel:8,strategy:bw},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new fw,this.strm.avail_out=0;let r=cw.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Sw)throw new Error(nI[r]);if(t.header&&cw.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?pw.string2buf(t.dictionary):"[object ArrayBuffer]"===_w.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=cw.deflateSetDictionary(this.strm,e),r!==Sw)throw new Error(nI[r]);this._dict_set=!0}}function Ow(e,t){const r=new Aw(t);if(r.push(e,!0),r.err)throw r.msg||nI[r.err];return r.result}Aw.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?Tw:mw,"string"==typeof e?r.input=pw.string2buf(e):"[object ArrayBuffer]"===_w.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===Ew||o===gw)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=cw.deflate(r,o),i===vw)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=cw.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Sw;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},Aw.prototype.onData=function(e){this.chunks.push(e)},Aw.prototype.onEnd=function(e){e===Sw&&(this.result=uw.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Iw={Deflate:Aw,deflate:Ow,deflateRaw:function(e,t){return(t=t||{}).raw=!0,Ow(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,Ow(e,t)},constants:iI};const ww=16209;var Cw=function(e,t){let r,n,i,o,s,a,c,d,u,l,h,p,f,_,m,E,g,T,S,v,y,b,R,A;const O=e.state;r=e.next_in,R=e.input,n=r+(e.avail_in-5),i=e.next_out,A=e.output,o=i-(t-e.avail_out),s=i+(e.avail_out-257),a=O.dmax,c=O.wsize,d=O.whave,u=O.wnext,l=O.window,h=O.hold,p=O.bits,f=O.lencode,_=O.distcode,m=(1<<O.lenbits)-1,E=(1<<O.distbits)-1;e:do{p<15&&(h+=R[r++]<<p,p+=8,h+=R[r++]<<p,p+=8),g=f[h&m];t:for(;;){if(T=g>>>24,h>>>=T,p-=T,T=g>>>16&255,0===T)A[i++]=65535&g;else{if(!(16&T)){if(0==(64&T)){g=f[(65535&g)+(h&(1<<T)-1)];continue t}if(32&T){O.mode=16191;break e}e.msg="invalid literal/length code",O.mode=ww;break e}S=65535&g,T&=15,T&&(p<T&&(h+=R[r++]<<p,p+=8),S+=h&(1<<T)-1,h>>>=T,p-=T),p<15&&(h+=R[r++]<<p,p+=8,h+=R[r++]<<p,p+=8),g=_[h&E];r:for(;;){if(T=g>>>24,h>>>=T,p-=T,T=g>>>16&255,!(16&T)){if(0==(64&T)){g=_[(65535&g)+(h&(1<<T)-1)];continue r}e.msg="invalid distance code",O.mode=ww;break e}if(v=65535&g,T&=15,p<T&&(h+=R[r++]<<p,p+=8,p<T&&(h+=R[r++]<<p,p+=8)),v+=h&(1<<T)-1,v>a){e.msg="invalid distance too far back",O.mode=ww;break e}if(h>>>=T,p-=T,T=i-o,v>T){if(T=v-T,T>d&&O.sane){e.msg="invalid distance too far back",O.mode=ww;break e}if(y=0,b=l,0===u){if(y+=c-T,T<S){S-=T;do{A[i++]=l[y++]}while(--T);y=i-v,b=A}}else if(u<T){if(y+=c+u-T,T-=u,T<S){S-=T;do{A[i++]=l[y++]}while(--T);if(y=0,u<S){T=u,S-=T;do{A[i++]=l[y++]}while(--T);y=i-v,b=A}}}else if(y+=u-T,T<S){S-=T;do{A[i++]=l[y++]}while(--T);y=i-v,b=A}for(;S>2;)A[i++]=b[y++],A[i++]=b[y++],A[i++]=b[y++],S-=3;S&&(A[i++]=b[y++],S>1&&(A[i++]=b[y++]))}else{y=i-v;do{A[i++]=A[y++],A[i++]=A[y++],A[i++]=A[y++],S-=3}while(S>2);S&&(A[i++]=A[y++],S>1&&(A[i++]=A[y++]))}break}}break}}while(r<n&&i<s);S=p>>3,r-=S,p-=S<<3,h&=(1<<p)-1,e.next_in=r,e.next_out=i,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=i<s?s-i+257:257-(i-s),O.hold=h,O.bits=p};const Nw=15,kw=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Dw=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Pw=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Lw=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Mw=(e,t,r,n,i,o,s,a)=>{const c=a.bits;let d,u,l,h,p,f,_=0,m=0,E=0,g=0,T=0,S=0,v=0,y=0,b=0,R=0,A=null;const O=new Uint16Array(16),I=new Uint16Array(16);let w,C,N,k=null;for(_=0;_<=Nw;_++)O[_]=0;for(m=0;m<n;m++)O[t[r+m]]++;for(T=c,g=Nw;g>=1&&0===O[g];g--);if(T>g&&(T=g),0===g)return i[o++]=20971520,i[o++]=20971520,a.bits=1,0;for(E=1;E<g&&0===O[E];E++);for(T<E&&(T=E),y=1,_=1;_<=Nw;_++)if(y<<=1,y-=O[_],y<0)return-1;if(y>0&&(0===e||1!==g))return-1;for(I[1]=0,_=1;_<Nw;_++)I[_+1]=I[_]+O[_];for(m=0;m<n;m++)0!==t[r+m]&&(s[I[t[r+m]]++]=m);if(0===e?(A=k=s,f=20):1===e?(A=kw,k=Dw,f=257):(A=Pw,k=Lw,f=0),R=0,m=0,_=E,p=o,S=T,v=0,l=-1,b=1<<T,h=b-1,1===e&&b>852||2===e&&b>592)return 1;for(;;){w=_-v,s[m]+1<f?(C=0,N=s[m]):s[m]>=f?(C=k[s[m]-f],N=A[s[m]-f]):(C=96,N=0),d=1<<_-v,u=1<<S,E=u;do{u-=d,i[p+(R>>v)+u]=w<<24|C<<16|N|0}while(0!==u);for(d=1<<_-1;R&d;)d>>=1;if(0!==d?(R&=d-1,R+=d):R=0,m++,0==--O[_]){if(_===g)break;_=t[r+s[m]]}if(_>T&&(R&h)!==l){for(0===v&&(v=T),p+=E,S=_-v,y=1<<S;S+v<g&&(y-=O[S+v],!(y<=0));)S++,y<<=1;if(b+=1<<S,1===e&&b>852||2===e&&b>592)return 1;l=R&h,i[l]=T<<24|S<<16|p-o|0}}return 0!==R&&(i[p+R]=_-v<<24|64<<16|0),a.bits=T,0};const{Z_FINISH:Uw,Z_BLOCK:xw,Z_TREES:Vw,Z_OK:Fw,Z_STREAM_END:Bw,Z_NEED_DICT:jw,Z_STREAM_ERROR:Gw,Z_DATA_ERROR:Ww,Z_MEM_ERROR:Hw,Z_BUF_ERROR:zw,Z_DEFLATED:Kw}=iI,Yw=16180,Jw=16190,Zw=16191,Xw=16192,qw=16194,Qw=16199,$w=16200,eC=16206,tC=16209,rC=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function nC(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const iC=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<Yw||t.mode>16211?1:0},oC=e=>{if(iC(e))return Gw;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=Yw,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Fw},sC=e=>{if(iC(e))return Gw;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,oC(e)},aC=(e,t)=>{let r;if(iC(e))return Gw;const n=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Gw:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,sC(e))},cC=(e,t)=>{if(!e)return Gw;const r=new nC;e.state=r,r.strm=e,r.window=null,r.mode=Yw;const n=aC(e,t);return n!==Fw&&(e.state=null),n};let dC,uC,lC=!0;const hC=e=>{if(lC){dC=new Int32Array(512),uC=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Mw(1,e.lens,0,288,dC,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Mw(2,e.lens,0,32,uC,0,e.work,{bits:5}),lC=!1}e.lencode=dC,e.lenbits=9,e.distcode=uC,e.distbits=5},pC=(e,t,r,n)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(t.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(t.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(t.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var fC=(e,t)=>{let r,n,i,o,s,a,c,d,u,l,h,p,f,_,m,E,g,T,S,v,y,b,R=0;const A=new Uint8Array(4);let O,I;const w=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(iC(e)||!e.output||!e.input&&0!==e.avail_in)return Gw;r=e.state,r.mode===Zw&&(r.mode=Xw),s=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,d=r.hold,u=r.bits,l=a,h=c,b=Fw;e:for(;;)switch(r.mode){case Yw:if(0===r.wrap){r.mode=Xw;break}for(;u<16;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(2&r.wrap&&35615===d){0===r.wbits&&(r.wbits=15),r.check=0,A[0]=255&d,A[1]=d>>>8&255,r.check=rI(r.check,A,2,0),d=0,u=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&d)<<8)+(d>>8))%31){e.msg="incorrect header check",r.mode=tC;break}if((15&d)!==Kw){e.msg="unknown compression method",r.mode=tC;break}if(d>>>=4,u-=4,y=8+(15&d),0===r.wbits&&(r.wbits=y),y>15||y>r.wbits){e.msg="invalid window size",r.mode=tC;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&d?16189:Zw,d=0,u=0;break;case 16181:for(;u<16;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(r.flags=d,(255&r.flags)!==Kw){e.msg="unknown compression method",r.mode=tC;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=tC;break}r.head&&(r.head.text=d>>8&1),512&r.flags&&4&r.wrap&&(A[0]=255&d,A[1]=d>>>8&255,r.check=rI(r.check,A,2,0)),d=0,u=0,r.mode=16182;case 16182:for(;u<32;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.head&&(r.head.time=d),512&r.flags&&4&r.wrap&&(A[0]=255&d,A[1]=d>>>8&255,A[2]=d>>>16&255,A[3]=d>>>24&255,r.check=rI(r.check,A,4,0)),d=0,u=0,r.mode=16183;case 16183:for(;u<16;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.head&&(r.head.xflags=255&d,r.head.os=d>>8),512&r.flags&&4&r.wrap&&(A[0]=255&d,A[1]=d>>>8&255,r.check=rI(r.check,A,2,0)),d=0,u=0,r.mode=16184;case 16184:if(1024&r.flags){for(;u<16;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.length=d,r.head&&(r.head.extra_len=d),512&r.flags&&4&r.wrap&&(A[0]=255&d,A[1]=d>>>8&255,r.check=rI(r.check,A,2,0)),d=0,u=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(p=r.length,p>a&&(p=a),p&&(r.head&&(y=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+p),y)),512&r.flags&&4&r.wrap&&(r.check=rI(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===a)break e;p=0;do{y=n[o+p++],r.head&&y&&r.length<65536&&(r.head.name+=String.fromCharCode(y))}while(y&&p<a);if(512&r.flags&&4&r.wrap&&(r.check=rI(r.check,n,p,o)),a-=p,o+=p,y)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===a)break e;p=0;do{y=n[o+p++],r.head&&y&&r.length<65536&&(r.head.comment+=String.fromCharCode(y))}while(y&&p<a);if(512&r.flags&&4&r.wrap&&(r.check=rI(r.check,n,p,o)),a-=p,o+=p,y)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;u<16;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(4&r.wrap&&d!==(65535&r.check)){e.msg="header crc mismatch",r.mode=tC;break}d=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Zw;break;case 16189:for(;u<32;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}e.adler=r.check=rC(d),d=0,u=0,r.mode=Jw;case Jw:if(0===r.havedict)return e.next_out=s,e.avail_out=c,e.next_in=o,e.avail_in=a,r.hold=d,r.bits=u,jw;e.adler=r.check=1,r.mode=Zw;case Zw:if(t===xw||t===Vw)break e;case Xw:if(r.last){d>>>=7&u,u-=7&u,r.mode=eC;break}for(;u<3;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}switch(r.last=1&d,d>>>=1,u-=1,3&d){case 0:r.mode=16193;break;case 1:if(hC(r),r.mode=Qw,t===Vw){d>>>=2,u-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=tC}d>>>=2,u-=2;break;case 16193:for(d>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if((65535&d)!=(d>>>16^65535)){e.msg="invalid stored block lengths",r.mode=tC;break}if(r.length=65535&d,d=0,u=0,r.mode=qw,t===Vw)break e;case qw:r.mode=16195;case 16195:if(p=r.length,p){if(p>a&&(p=a),p>c&&(p=c),0===p)break e;i.set(n.subarray(o,o+p),s),a-=p,o+=p,c-=p,s+=p,r.length-=p;break}r.mode=Zw;break;case 16196:for(;u<14;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(r.nlen=257+(31&d),d>>>=5,u-=5,r.ndist=1+(31&d),d>>>=5,u-=5,r.ncode=4+(15&d),d>>>=4,u-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=tC;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;u<3;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.lens[w[r.have++]]=7&d,d>>>=3,u-=3}for(;r.have<19;)r.lens[w[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,O={bits:r.lenbits},b=Mw(0,r.lens,0,19,r.lencode,0,r.work,O),r.lenbits=O.bits,b){e.msg="invalid code lengths set",r.mode=tC;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;R=r.lencode[d&(1<<r.lenbits)-1],m=R>>>24,E=R>>>16&255,g=65535&R,!(m<=u);){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(g<16)d>>>=m,u-=m,r.lens[r.have++]=g;else{if(16===g){for(I=m+2;u<I;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(d>>>=m,u-=m,0===r.have){e.msg="invalid bit length repeat",r.mode=tC;break}y=r.lens[r.have-1],p=3+(3&d),d>>>=2,u-=2}else if(17===g){for(I=m+3;u<I;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}d>>>=m,u-=m,y=0,p=3+(7&d),d>>>=3,u-=3}else{for(I=m+7;u<I;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}d>>>=m,u-=m,y=0,p=11+(127&d),d>>>=7,u-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=tC;break}for(;p--;)r.lens[r.have++]=y}}if(r.mode===tC)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=tC;break}if(r.lenbits=9,O={bits:r.lenbits},b=Mw(1,r.lens,0,r.nlen,r.lencode,0,r.work,O),r.lenbits=O.bits,b){e.msg="invalid literal/lengths set",r.mode=tC;break}if(r.distbits=6,r.distcode=r.distdyn,O={bits:r.distbits},b=Mw(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,O),r.distbits=O.bits,b){e.msg="invalid distances set",r.mode=tC;break}if(r.mode=Qw,t===Vw)break e;case Qw:r.mode=$w;case $w:if(a>=6&&c>=258){e.next_out=s,e.avail_out=c,e.next_in=o,e.avail_in=a,r.hold=d,r.bits=u,Cw(e,h),s=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,d=r.hold,u=r.bits,r.mode===Zw&&(r.back=-1);break}for(r.back=0;R=r.lencode[d&(1<<r.lenbits)-1],m=R>>>24,E=R>>>16&255,g=65535&R,!(m<=u);){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(E&&0==(240&E)){for(T=m,S=E,v=g;R=r.lencode[v+((d&(1<<T+S)-1)>>T)],m=R>>>24,E=R>>>16&255,g=65535&R,!(T+m<=u);){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}d>>>=T,u-=T,r.back+=T}if(d>>>=m,u-=m,r.back+=m,r.length=g,0===E){r.mode=16205;break}if(32&E){r.back=-1,r.mode=Zw;break}if(64&E){e.msg="invalid literal/length code",r.mode=tC;break}r.extra=15&E,r.mode=16201;case 16201:if(r.extra){for(I=r.extra;u<I;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.length+=d&(1<<r.extra)-1,d>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;R=r.distcode[d&(1<<r.distbits)-1],m=R>>>24,E=R>>>16&255,g=65535&R,!(m<=u);){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(0==(240&E)){for(T=m,S=E,v=g;R=r.distcode[v+((d&(1<<T+S)-1)>>T)],m=R>>>24,E=R>>>16&255,g=65535&R,!(T+m<=u);){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}d>>>=T,u-=T,r.back+=T}if(d>>>=m,u-=m,r.back+=m,64&E){e.msg="invalid distance code",r.mode=tC;break}r.offset=g,r.extra=15&E,r.mode=16203;case 16203:if(r.extra){for(I=r.extra;u<I;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.offset+=d&(1<<r.extra)-1,d>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=tC;break}r.mode=16204;case 16204:if(0===c)break e;if(p=h-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=tC;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),_=r.window}else _=i,f=s-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{i[s++]=_[f++]}while(--p);0===r.length&&(r.mode=$w);break;case 16205:if(0===c)break e;i[s++]=r.length,c--,r.mode=$w;break;case eC:if(r.wrap){for(;u<32;){if(0===a)break e;a--,d|=n[o++]<<u,u+=8}if(h-=c,e.total_out+=h,r.total+=h,4&r.wrap&&h&&(e.adler=r.check=r.flags?rI(r.check,i,h,s-h):eI(r.check,i,h,s-h)),h=c,4&r.wrap&&(r.flags?d:rC(d))!==r.check){e.msg="incorrect data check",r.mode=tC;break}d=0,u=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;u<32;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(4&r.wrap&&d!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=tC;break}d=0,u=0}r.mode=16208;case 16208:b=Bw;break e;case tC:b=Ww;break e;case 16210:return Hw;default:return Gw}return e.next_out=s,e.avail_out=c,e.next_in=o,e.avail_in=a,r.hold=d,r.bits=u,(r.wsize||h!==e.avail_out&&r.mode<tC&&(r.mode<eC||t!==Uw))&&pC(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,4&r.wrap&&h&&(e.adler=r.check=r.flags?rI(r.check,i,h,e.next_out-h):eI(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===Zw?128:0)+(r.mode===Qw||r.mode===qw?256:0),(0===l&&0===h||t===Uw)&&b===Fw&&(b=zw),b},_C={inflateReset:sC,inflateReset2:aC,inflateResetKeep:oC,inflateInit:e=>cC(e,15),inflateInit2:cC,inflate:fC,inflateEnd:e=>{if(iC(e))return Gw;let t=e.state;return t.window&&(t.window=null),e.state=null,Fw},inflateGetHeader:(e,t)=>{if(iC(e))return Gw;const r=e.state;return 0==(2&r.wrap)?Gw:(r.head=t,t.done=!1,Fw)},inflateSetDictionary:(e,t)=>{const r=t.length;let n,i,o;return iC(e)?Gw:(n=e.state,0!==n.wrap&&n.mode!==Jw?Gw:n.mode===Jw&&(i=1,i=eI(i,t,r,0),i!==n.check)?Ww:(o=pC(e,t,r,r),o?(n.mode=16210,Hw):(n.havedict=1,Fw)))},inflateInfo:"pako inflate (from Nodeca project)"};var mC=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const EC=Object.prototype.toString,{Z_NO_FLUSH:gC,Z_FINISH:TC,Z_OK:SC,Z_STREAM_END:vC,Z_NEED_DICT:yC,Z_STREAM_ERROR:bC,Z_DATA_ERROR:RC,Z_MEM_ERROR:AC}=iI;function OC(e){this.options=uw.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new fw,this.strm.avail_out=0;let r=_C.inflateInit2(this.strm,t.windowBits);if(r!==SC)throw new Error(nI[r]);if(this.header=new mC,_C.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=pw.string2buf(t.dictionary):"[object ArrayBuffer]"===EC.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=_C.inflateSetDictionary(this.strm,t.dictionary),r!==SC)))throw new Error(nI[r])}function IC(e,t){const r=new OC(t);if(r.push(e),r.err)throw r.msg||nI[r.err];return r.result}OC.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(s=t===~~t?t:!0===t?TC:gC,"[object ArrayBuffer]"===EC.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=_C.inflate(r,s),o===yC&&i&&(o=_C.inflateSetDictionary(r,i),o===SC?o=_C.inflate(r,s):o===RC&&(o=yC));r.avail_in>0&&o===vC&&r.state.wrap>0&&0!==e[r.next_in];)_C.inflateReset(r),o=_C.inflate(r,s);switch(o){case bC:case RC:case yC:case AC:return this.onEnd(o),this.ended=!0,!1}if(a=r.avail_out,r.next_out&&(0===r.avail_out||o===vC))if("string"===this.options.to){let e=pw.utf8border(r.output,r.next_out),t=r.next_out-e,i=pw.buf2string(r.output,e);r.next_out=t,r.avail_out=n-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==SC||0!==a){if(o===vC)return o=_C.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},OC.prototype.onData=function(e){this.chunks.push(e)},OC.prototype.onEnd=function(e){e===SC&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=uw.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var wC={Inflate:OC,inflate:IC,inflateRaw:function(e,t){return(t=t||{}).raw=!0,IC(e,t)},ungzip:IC,constants:iI};const{Deflate:CC,deflate:NC,deflateRaw:kC,gzip:DC}=Iw,{Inflate:PC,inflate:LC,inflateRaw:MC,ungzip:UC}=wC;var xC=NC,VC=LC,FC=function(e){return e[e.ONE_BYTE=0]="ONE_BYTE",e[e.TWO_BYTE=1]="TWO_BYTE",e}(FC||{});class BC{constructor(){Fm(this,"_sequence",0),Fm(this,"_startTime",Date.now()),Fm(this,"isUseOneByte",!0)}get startTime(){const e=Date.now()-this._startTime;return e<Math.pow(2,16)?e:(this._startTime+=Math.pow(2,16),this.startTime)}get sequence(){return this._sequence<Math.pow(2,32)?this._sequence++:(this._sequence-=Math.pow(2,32),this.sequence)}serialize(e){const t={commonPacketHeader:{length:0,reserved:0,extension:0,sequence:this.sequence},commonStreamHeader:this.startTime,extension:void 0,payload:e};if(e.byteLength>128){const r=new Uint8Array(4);r.set([1,0,0,0]);const n={id:0,length:4,data:r.buffer},i={profile:this.isUseOneByte?0:1,length:this.isUseOneByte?5:6,datas:[n]};t.commonPacketHeader.extension=1,t.extension=i,t.payload=this.compress(e),t.commonPacketHeader.length=8+(t.extension.length+2)+t.payload.byteLength}else t.commonPacketHeader.length=8+t.payload.byteLength;In("SHOW_DATASTREAM2_LOG")&&Bn.debug("send data header: ".concat(JSON.stringify(t.commonPacketHeader)));const r=new ArrayBuffer(t.commonPacketHeader.length),n=new Uint8Array(r),i=new DataView(r);let o=0;if(i.setUint16(o,t.commonPacketHeader.extension<<15|t.commonPacketHeader.reserved<<14|t.commonPacketHeader.length,!0),o+=2,i.setUint32(o,t.commonPacketHeader.sequence,!0),o+=4,i.setUint16(o,t.commonStreamHeader,!0),o+=2,t.extension){const e=this.serializeExtension(t.extension);n.set(new Uint8Array(e),o),o+=e.byteLength}if(n.set(new Uint8Array(t.payload),o),o+=t.payload.byteLength,o!==t.commonPacketHeader.length)throw Error("serialize error!");return r}deserialize(e){if(e.byteLength<4)return new ArrayBuffer(0);const t=new DataView(e);let r=0;const n=t.getUint16(r,!0);r+=2;const i={length:16383&n,reserved:(16384&n)>>14,extension:(32768&n)>>15,sequence:t.getUint16(r+2,!0)<<16|t.getUint16(r,!0)};let o,s;if(r+=4,In("SHOW_DATASTREAM2_LOG")&&Bn.debug("receive data header: ".concat(JSON.stringify(i))),t.getUint16(r,!0),r+=2,i.extension){s=this.deserializeExtension(e.slice(r)),r+=2+s.length,o=e.slice(r);let t=!1;if(s.datas.length>0){const e=s.datas.find((e=>0===e.id));if(e){t=1==(1&new DataView(e.data).getUint32(0,!0))}}o=t?this.decompress(o):o}else o=e.slice(8);return o}serializeExtension(e){const{profile:t,length:r,datas:n}=e,i=new ArrayBuffer(r+2),o=new Uint8Array(i),s=new DataView(i);let a=0;if(s.setUint8(a++,t),s.setUint8(a++,r),n.forEach((e=>{t?(s.setUint8(a++,e.id),s.setUint8(a++,e.length),o.set(new Uint8Array(e.data),a),a+=e.data.byteLength):(s.setUint8(a++,e.id|e.length<<4),o.set(new Uint8Array(e.data),a),a+=e.data.byteLength)})),a!==r+2)throw Error("serialize extension error, is ".concat(a,"!==").concat(r+2));return i}deserializeExtension(e){const t=new DataView(e);let r=0;const n=t.getUint8(r);r++;const i=t.getUint8(r);r++;const o=n===FC.TWO_BYTE,s=[],a=new DataView(e,2);let c=0;for(;c<i;){let e=0,t=0,r=new ArrayBuffer(0);o?(e=a.getUint8(c),c++,t=a.getUint8(c),c++):(e=15&a.getUint8(c),t=a.getUint8(c)>>4,c++),t>0&&(r=a.buffer.slice(c+2,c+2+t),c+=r.byteLength),s.push({id:e,length:t,data:r})}if(c!==i)throw Error("parse error");return{profile:n,length:i,datas:s}}decompress(e){return VC(new Uint8Array(e))}compress(e){return xC(new Uint8Array(e))}}class jC extends Fr{constructor(e,t){super(),Fm(this,"_version",1),Fm(this,"_type",3),Fm(this,"_config",void 0),Fm(this,"_originDataChannel",void 0),Fm(this,"_dataStreamPacketHeader",new ArrayBuffer(4)),Fm(this,"_dataStreamPacketHandler",void 0),Fm(this,"_datachannelEventMap",new Map),this._config=e,t&&(this._originDataChannel=t,this._bandDataChannelEvents(t)),this._initPacketHeader(),this._dataStreamPacketHandler=new BC}get id(){return this._config.id}get ordered(){return this._config.ordered}get maxRetransmits(){return In("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 $y(((e,t)=>{if(this._originDataChannel){"open"===this._originDataChannel.readyState&&e();const r=setTimeout((()=>{var e;t(new Cr(wr.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 Cr(wr.DATACHANNEL_CONNECTION_TIMEOUT)}}else t(new Cr(wr.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,n]=t;e.removeEventListener(r,n)})),this._datachannelEventMap.clear()}}var GC=$n,WC=ds("iterator"),HC=!GC((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2"),n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),r.delete("a",2),!e.toJSON||!r.has("a",1)||r.has("a",2)||!t.size&&true||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[WC]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host})),zC=_l,KC=al,YC=Math.floor,JC=function(e,t){var r=e.length,n=YC(r/2);return r<8?ZC(e,t):XC(e,JC(KC(e,0,n),t),JC(KC(e,n),t),t)},ZC=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},XC=function(e,t,r,n){for(var i=t.length,o=r.length,s=0,a=0;s<i||a<o;)e[s+a]=s<i&&a<o?n(t[s],r[a])<=0?t[s++]:r[a++]:s<i?t[s++]:r[a++];return e},qC=Aa,QC=ci,$C=Ci,eN=oi,tN=Oi,rN=HC,nN=_l,iN=El,oN=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:zC(e,n,t[n],r);return e},sN=jl,aN=e_,cN=nh,dN=IT,uN=Ri,lN=Zo,hN=Ys,pN=ac,fN=$s,_N=qi,mN=uc,EN=qu,gN=Ui,TN=Lg,SN=Ig,vN=xT,yN=JC,bN=ds("iterator"),RN="URLSearchParams",AN=RN+"Iterator",ON=cN.set,IN=cN.getterFor(RN),wN=cN.getterFor(AN),CN=Object.getOwnPropertyDescriptor,NN=function(e){if(!tN)return QC[e];var t=CN(QC,e);return t&&t.value},kN=NN("fetch"),DN=NN("Request"),PN=NN("Headers"),LN=DN&&DN.prototype,MN=PN&&PN.prototype,UN=QC.RegExp,xN=QC.TypeError,VN=QC.decodeURIComponent,FN=QC.encodeURIComponent,BN=eN("".charAt),jN=eN([].join),GN=eN([].push),WN=eN("".replace),HN=eN([].shift),zN=eN([].splice),KN=eN("".split),YN=eN("".slice),JN=/\+/g,ZN=Array(4),XN=function(e){return ZN[e-1]||(ZN[e-1]=UN("((?:%[\\da-f]{2}){"+e+"})","gi"))},qN=function(e){try{return VN(e)}catch(t){return e}},QN=function(e){var t=WN(e,JN," "),r=4;try{return VN(t)}catch(e){for(;r;)t=WN(t,XN(r--),qN);return t}},$N=/[!'()~]|%20/g,ek={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},tk=function(e){return ek[e]},rk=function(e){return WN(FN(e),$N,tk)},nk=aN((function(e,t){ON(this,{type:AN,iterator:TN(IN(e).entries),kind:t})}),"Iterator",(function(){var e=wN(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),ik=function(e){this.entries=[],this.url=null,void 0!==e&&(_N(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===BN(e,0)?YN(e,1):e:mN(e)))};ik.prototype={type:RN,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,s,a,c=SN(e);if(c)for(r=(t=TN(e,c)).next;!(n=$C(r,t)).done;){if(o=(i=TN(fN(n.value))).next,(s=$C(o,i)).done||(a=$C(o,i)).done||!$C(o,i).done)throw xN("Expected sequence with length 2");GN(this.entries,{key:mN(s.value),value:mN(a.value)})}else for(var d in e)lN(e,d)&&GN(this.entries,{key:d,value:mN(e[d])})},parseQuery:function(e){if(e)for(var t,r,n=KN(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=KN(t,"="),GN(this.entries,{key:QN(HN(r)),value:QN(jN(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],GN(r,rk(e.key)+"="+rk(e.value));return jN(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var ok=function(){dN(this,sk);var e=ON(this,new ik(arguments.length>0?arguments[0]:void 0));tN||(this.size=e.entries.length)},sk=ok.prototype;if(oN(sk,{append:function(e,t){var r=IN(this);vN(arguments.length,2),GN(r.entries,{key:mN(e),value:mN(t)}),tN||this.length++,r.updateURL()},delete:function(e){for(var t=IN(this),r=vN(arguments.length,1),n=t.entries,i=mN(e),o=r<2?void 0:arguments[1],s=void 0===o?o:mN(o),a=0;a<n.length;){var c=n[a];if(c.key!==i||void 0!==s&&c.value!==s)a++;else if(zN(n,a,1),void 0!==s)break}tN||(this.size=n.length),t.updateURL()},get:function(e){var t=IN(this).entries;vN(arguments.length,1);for(var r=mN(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=IN(this).entries;vN(arguments.length,1);for(var r=mN(e),n=[],i=0;i<t.length;i++)t[i].key===r&&GN(n,t[i].value);return n},has:function(e){for(var t=IN(this).entries,r=vN(arguments.length,1),n=mN(e),i=r<2?void 0:arguments[1],o=void 0===i?i:mN(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=IN(this);vN(arguments.length,1);for(var n,i=r.entries,o=!1,s=mN(e),a=mN(t),c=0;c<i.length;c++)(n=i[c]).key===s&&(o?zN(i,c--,1):(o=!0,n.value=a));o||GN(i,{key:s,value:a}),tN||(this.size=i.length),r.updateURL()},sort:function(){var e=IN(this);yN(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=IN(this).entries,n=hN(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 nk(this,"keys")},values:function(){return new nk(this,"values")},entries:function(){return new nk(this,"entries")}},{enumerable:!0}),nN(sk,bN,sk.entries,{name:"entries"}),nN(sk,"toString",(function(){return IN(this).serialize()}),{enumerable:!0}),tN&&iN(sk,"size",{get:function(){return IN(this).entries.length},configurable:!0,enumerable:!0}),sN(ok,RN),qC({global:!0,constructor:!0,forced:!rN},{URLSearchParams:ok}),!rN&&uN(PN)){var ak=eN(MN.has),ck=eN(MN.set),dk=function(e){if(_N(e)){var t,r=e.body;if(pN(r)===RN)return t=e.headers?new PN(e.headers):new PN,ak(t,"content-type")||ck(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),EN(e,{body:gN(0,mN(r)),headers:gN(0,t)})}return e};if(uN(kN)&&qC({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return kN(e,arguments.length>1?dk(arguments[1]):{})}}),uN(DN)){var uk=function(e){return dN(this,LN),new DN(e,arguments.length>1?dk(arguments[1]):{})};LN.constructor=uk,uk.prototype=LN,qC({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:uk})}}var lk,hk={URLSearchParams:ok,getState:IN},pk=Oi,fk=oi,_k=Ci,mk=$n,Ek=Ou,gk=pl,Tk=Ni,Sk=Ko,vk=ji,yk=Object.assign,bk=Object.defineProperty,Rk=fk([].concat),Ak=!yk||mk((function(){if(pk&&1!==yk({b:1},yk(bk({},"a",{enumerable:!0,get:function(){bk(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=yk({},e)[r]||Ek(yk({},t)).join("")!=n}))?function(e,t){for(var r=Sk(e),n=arguments.length,i=1,o=gk.f,s=Tk.f;n>i;)for(var a,c=vk(arguments[i++]),d=o?Rk(Ek(c),o(c)):Ek(c),u=d.length,l=0;u>l;)a=d[l++],pk&&!_k(s,c,a)||(r[a]=c[a]);return r}:yk,Ok=$s,Ik=Vg,wk=Ys,Ck=Ci,Nk=Ko,kk=function(e,t,r,n){try{return n?t(Ok(r)[0],r[1]):t(r)}catch(t){Ik(e,"throw",t)}},Dk=vg,Pk=Wd,Lk=Va,Mk=Ad,Uk=Lg,xk=Ig,Vk=Array,Fk=oi,Bk=2147483647,jk=/[^\0-\u007E]/,Gk=/[.\u3002\uFF0E\uFF61]/g,Wk="Overflow: input needs wider integers to process",Hk=RangeError,zk=Fk(Gk.exec),Kk=Math.floor,Yk=String.fromCharCode,Jk=Fk("".charCodeAt),Zk=Fk([].join),Xk=Fk([].push),qk=Fk("".replace),Qk=Fk("".split),$k=Fk("".toLowerCase),eD=function(e){return e+22+75*(e<26)},tD=function(e,t,r){var n=0;for(e=r?Kk(e/700):e>>1,e+=Kk(e/t);e>455;)e=Kk(e/35),n+=36;return Kk(n+36*e/(e+38))},rD=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=Jk(e,r++);if(i>=55296&&i<=56319&&r<n){var o=Jk(e,r++);56320==(64512&o)?Xk(t,((1023&i)<<10)+(1023&o)+65536):(Xk(t,i),r--)}else Xk(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&&Xk(t,Yk(n));var c=t.length,d=c;for(c&&Xk(t,"-");d<i;){var u=Bk;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<u&&(u=n);var l=d+1;if(u-o>Kk((Bk-s)/l))throw Hk(Wk);for(s+=(u-o)*l,o=u,r=0;r<e.length;r++){if((n=e[r])<o&&++s>Bk)throw Hk(Wk);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 _=h-f,m=36-f;Xk(t,Yk(eD(f+_%m))),h=Kk(_/m),p+=36}Xk(t,Yk(eD(h))),a=tD(s,l,d==c),s=0,d++}}s++,o++}return Zk(t,"")},nD=Aa,iD=Oi,oD=HC,sD=ci,aD=Ys,cD=oi,dD=_l,uD=El,lD=IT,hD=Zo,pD=Ak,fD=function(e){var t=Nk(e),r=Pk(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=wk(i,n>2?arguments[2]:void 0));var s,a,c,d,u,l,h=xk(t),p=0;if(!h||this===Vk&&Dk(h))for(s=Lk(t),a=r?new this(s):Vk(s);s>p;p++)l=o?i(t[p],p):t[p],Mk(a,p,l);else for(u=(d=Uk(t,h)).next,a=r?new this:[];!(c=Ck(u,d)).done;p++)l=o?kk(d,i,[c.value,p],!0):c.value,Mk(a,p,l);return a.length=p,a},_D=al,mD=Om.codeAt,ED=function(e){var t,r,n=[],i=Qk(qk($k(e),Gk,"."),".");for(t=0;t<i.length;t++)r=i[t],Xk(n,zk(jk,r)?"xn--"+rD(r):r);return Zk(n,".")},gD=uc,TD=jl,SD=xT,vD=hk,yD=nh,bD=yD.set,RD=yD.getterFor("URL"),AD=vD.URLSearchParams,OD=vD.getState,ID=sD.URL,wD=sD.TypeError,CD=sD.parseInt,ND=Math.floor,kD=Math.pow,DD=cD("".charAt),PD=cD(/./.exec),LD=cD([].join),MD=cD(1..toString),UD=cD([].pop),xD=cD([].push),VD=cD("".replace),FD=cD([].shift),BD=cD("".split),jD=cD("".slice),GD=cD("".toLowerCase),WD=cD([].unshift),HD="Invalid scheme",zD="Invalid host",KD="Invalid port",YD=/[a-z]/i,JD=/[\d+-.a-z]/i,ZD=/\d/,XD=/^0x/i,qD=/^[0-7]+$/,QD=/^\d+$/,$D=/^[\da-f]+$/i,eP=/[\0\t\n\r #%/:<>?@[\\\]^|]/,tP=/[\0\t\n\r #/:<>?@[\\\]^|]/,rP=/^[\u0000-\u0020]+/,nP=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,iP=/[\t\n\r]/g,oP=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)WD(t,e%256),e=ND(e/256);return LD(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=MD(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},sP={},aP=pD({},sP,{" ":1,'"':1,"<":1,">":1,"`":1}),cP=pD({},aP,{"#":1,"?":1,"{":1,"}":1}),dP=pD({},cP,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),uP=function(e,t){var r=mD(e,0);return r>32&&r<127&&!hD(t,e)?e:encodeURIComponent(e)},lP={ftp:21,file:null,http:80,https:443,ws:80,wss:443},hP=function(e,t){var r;return 2==e.length&&PD(YD,DD(e,0))&&(":"==(r=DD(e,1))||!t&&"|"==r)},pP=function(e){var t;return e.length>1&&hP(jD(e,0,2))&&(2==e.length||"/"===(t=DD(e,2))||"\\"===t||"?"===t||"#"===t)},fP=function(e){return"."===e||"%2e"===GD(e)},_P={},mP={},EP={},gP={},TP={},SP={},vP={},yP={},bP={},RP={},AP={},OP={},IP={},wP={},CP={},NP={},kP={},DP={},PP={},LP={},MP={},UP=function(e,t,r){var n,i,o,s=gD(e);if(t){if(i=this.parse(s))throw wD(i);this.searchParams=null}else{if(void 0!==r&&(n=new UP(r,!0)),i=this.parse(s,null,n))throw wD(i);(o=OD(new AD)).bindURL(this),this.searchParams=o}};UP.prototype={type:"URL",parse:function(e,t,r){var n,i,o,s,a,c=this,d=t||_P,u=0,l="",h=!1,p=!1,f=!1;for(e=gD(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=VD(e,rP,""),e=VD(e,nP,"$1")),e=VD(e,iP,""),n=fD(e);u<=n.length;){switch(i=n[u],d){case _P:if(!i||!PD(YD,i)){if(t)return HD;d=EP;continue}l+=GD(i),d=mP;break;case mP:if(i&&(PD(JD,i)||"+"==i||"-"==i||"."==i))l+=GD(i);else{if(":"!=i){if(t)return HD;l="",d=EP,u=0;continue}if(t&&(c.isSpecial()!=hD(lP,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&lP[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?d=wP:c.isSpecial()&&r&&r.scheme==c.scheme?d=gP:c.isSpecial()?d=yP:"/"==n[u+1]?(d=TP,u++):(c.cannotBeABaseURL=!0,xD(c.path,""),d=PP)}break;case EP:if(!r||r.cannotBeABaseURL&&"#"!=i)return HD;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=_D(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,d=MP;break}d="file"==r.scheme?wP:SP;continue;case gP:if("/"!=i||"/"!=n[u+1]){d=SP;continue}d=bP,u++;break;case TP:if("/"==i){d=RP;break}d=DP;continue;case SP:if(c.scheme=r.scheme,i==lk)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=_D(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())d=vP;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=_D(r.path),c.query="",d=LP;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=_D(r.path),c.path.length--,d=DP;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=_D(r.path),c.query=r.query,c.fragment="",d=MP}break;case vP:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,d=DP;continue}d=RP}else d=bP;break;case yP:if(d=bP,"/"!=i||"/"!=DD(l,u+1))continue;u++;break;case bP:if("/"!=i&&"\\"!=i){d=RP;continue}break;case RP:if("@"==i){h&&(l="%40"+l),h=!0,o=fD(l);for(var _=0;_<o.length;_++){var m=o[_];if(":"!=m||f){var E=uP(m,dP);f?c.password+=E:c.username+=E}else f=!0}l=""}else if(i==lk||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";u-=fD(l).length+1,l="",d=AP}else l+=i;break;case AP:case OP:if(t&&"file"==c.scheme){d=NP;continue}if(":"!=i||p){if(i==lk||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return zD;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",d=kP,t)return;continue}"["==i?p=!0:"]"==i&&(p=!1),l+=i}else{if(""==l)return zD;if(s=c.parseHost(l))return s;if(l="",d=IP,t==OP)return}break;case IP:if(!PD(ZD,i)){if(i==lk||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var g=CD(l,10);if(g>65535)return KD;c.port=c.isSpecial()&&g===lP[c.scheme]?null:g,l=""}if(t)return;d=kP;continue}return KD}l+=i;break;case wP:if(c.scheme="file","/"==i||"\\"==i)d=CP;else{if(!r||"file"!=r.scheme){d=DP;continue}if(i==lk)c.host=r.host,c.path=_D(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=_D(r.path),c.query="",d=LP;else{if("#"!=i){pP(LD(_D(n,u),""))||(c.host=r.host,c.path=_D(r.path),c.shortenPath()),d=DP;continue}c.host=r.host,c.path=_D(r.path),c.query=r.query,c.fragment="",d=MP}}break;case CP:if("/"==i||"\\"==i){d=NP;break}r&&"file"==r.scheme&&!pP(LD(_D(n,u),""))&&(hP(r.path[0],!0)?xD(c.path,r.path[0]):c.host=r.host),d=DP;continue;case NP:if(i==lk||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&hP(l))d=DP;else if(""==l){if(c.host="",t)return;d=kP}else{if(s=c.parseHost(l))return s;if("localhost"==c.host&&(c.host=""),t)return;l="",d=kP}continue}l+=i;break;case kP:if(c.isSpecial()){if(d=DP,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=lk&&(d=DP,"/"!=i))continue}else c.fragment="",d=MP;else c.query="",d=LP;break;case DP:if(i==lk||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(a=GD(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||xD(c.path,"")):fP(l)?"/"==i||"\\"==i&&c.isSpecial()||xD(c.path,""):("file"==c.scheme&&!c.path.length&&hP(l)&&(c.host&&(c.host=""),l=DD(l,0)+":"),xD(c.path,l)),l="","file"==c.scheme&&(i==lk||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)FD(c.path);"?"==i?(c.query="",d=LP):"#"==i&&(c.fragment="",d=MP)}else l+=uP(i,cP);break;case PP:"?"==i?(c.query="",d=LP):"#"==i?(c.fragment="",d=MP):i!=lk&&(c.path[0]+=uP(i,sP));break;case LP:t||"#"!=i?i!=lk&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":uP(i,sP)):(c.fragment="",d=MP);break;case MP:i!=lk&&(c.fragment+=uP(i,aP))}u++}},parseHost:function(e){var t,r,n;if("["==DD(e,0)){if("]"!=DD(e,e.length-1))return zD;if(t=function(e){var t,r,n,i,o,s,a,c=[0,0,0,0,0,0,0,0],d=0,u=null,l=0,h=function(){return DD(e,l)};if(":"==h()){if(":"!=DD(e,1))return;l+=2,u=++d}for(;h();){if(8==d)return;if(":"!=h()){for(t=r=0;r<4&&PD($D,h());)t=16*t+CD(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,d>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!PD(ZD,h()))return;for(;PD(ZD,h());){if(o=CD(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[d]=256*c[d]+i,2!=++n&&4!=n||d++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[d++]=t}else{if(null!==u)return;l++,u=++d}}if(null!==u)for(s=d-u,d=7;0!=d&&s>0;)a=c[d],c[d--]=c[u+s-1],c[u+--s]=a;else if(8!=d)return;return c}(jD(e,1,-1)),!t)return zD;this.host=t}else if(this.isSpecial()){if(e=ED(e),PD(eP,e))return zD;if(t=function(e){var t,r,n,i,o,s,a,c=BD(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==DD(i,0)&&(o=PD(XD,i)?16:8,i=jD(i,8==o?1:2)),""===i)s=0;else{if(!PD(10==o?QD:8==o?qD:$D,i))return e;s=CD(i,o)}xD(r,s)}for(n=0;n<t;n++)if(s=r[n],n==t-1){if(s>=kD(256,5-t))return null}else if(s>255)return null;for(a=UD(r),n=0;n<r.length;n++)a+=r[n]*kD(256,3-n);return a}(e),null===t)return zD;this.host=t}else{if(PD(tP,e))return zD;for(t="",r=fD(e),n=0;n<r.length;n++)t+=uP(r[n],sP);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return hD(lP,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&hP(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,d=t+":";return null!==i?(d+="//",e.includesCredentials()&&(d+=r+(n?":"+n:"")+"@"),d+=oP(i),null!==o&&(d+=":"+o)):"file"==t&&(d+="//"),d+=e.cannotBeABaseURL?s[0]:s.length?"/"+LD(s,"/"):"",null!==a&&(d+="?"+a),null!==c&&(d+="#"+c),d},setHref:function(e){var t=this.parse(e);if(t)throw wD(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new xP(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+oP(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(gD(e)+":",_P)},getUsername:function(){return this.username},setUsername:function(e){var t=fD(gD(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=uP(t[r],dP)}},getPassword:function(){return this.password},setPassword:function(e){var t=fD(gD(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=uP(t[r],dP)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?oP(e):oP(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,AP)},getHostname:function(){var e=this.host;return null===e?"":oP(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,OP)},getPort:function(){var e=this.port;return null===e?"":gD(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=gD(e))?this.port=null:this.parse(e,IP))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+LD(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,kP))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=gD(e))?this.query=null:("?"==DD(e,0)&&(e=jD(e,1)),this.query="",this.parse(e,LP)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=gD(e))?("#"==DD(e,0)&&(e=jD(e,1)),this.fragment="",this.parse(e,MP)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var xP=function(e){var t=lD(this,VP),r=SD(arguments.length,1)>1?arguments[1]:void 0,n=bD(t,new UP(e,!1,r));iD||(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())},VP=xP.prototype,FP=function(e,t){return{get:function(){return RD(this)[e]()},set:t&&function(e){return RD(this)[t](e)},configurable:!0,enumerable:!0}};if(iD&&(uD(VP,"href",FP("serialize","setHref")),uD(VP,"origin",FP("getOrigin")),uD(VP,"protocol",FP("getProtocol","setProtocol")),uD(VP,"username",FP("getUsername","setUsername")),uD(VP,"password",FP("getPassword","setPassword")),uD(VP,"host",FP("getHost","setHost")),uD(VP,"hostname",FP("getHostname","setHostname")),uD(VP,"port",FP("getPort","setPort")),uD(VP,"pathname",FP("getPathname","setPathname")),uD(VP,"search",FP("getSearch","setSearch")),uD(VP,"searchParams",FP("getSearchParams")),uD(VP,"hash",FP("getHash","setHash"))),dD(VP,"toJSON",(function(){return RD(this).serialize()}),{enumerable:!0}),dD(VP,"toString",(function(){return RD(this).serialize()}),{enumerable:!0}),ID){var BP=ID.createObjectURL,jP=ID.revokeObjectURL;BP&&dD(xP,"createObjectURL",aD(BP,ID)),jP&&dD(xP,"revokeObjectURL",aD(jP,ID))}TD(xP,"URL"),nD({global:!0,constructor:!0,forced:!oD,sham:!iD},{URL:xP});var GP=Aa,WP=$n,HP=xT,zP=uc,KP=HC,YP=no("URL");GP({target:"URL",stat:!0,forced:!(KP&&WP((function(){YP.canParse()})))},{canParse:function(e){var t=HP(arguments.length,1),r=zP(e),n=t<2||void 0===arguments[1]?void 0:zP(arguments[1]);try{return!!new YP(r,n)}catch(e){return!1}}});var JP=Z(Qi.URL);function ZP(){const e=new Blob([atob("ZnVuY3Rpb24gZShlKXtjb25zdCB0PW5ldyBEYXRhVmlldyhlLmRhdGEpO2lmKDA9PT10LmdldFVpbnQ4KDApJiYwPT09dC5nZXRVaW50OCgxKSYmMD09PXQuZ2V0VWludDgoMikmJjE9PT10LmdldFVpbnQ4KDMpJiY2PT09dC5nZXRVaW50OCg0KSl7bGV0IG49NixyPTAsbz0wO2Zvcig7MjU1PT09KG89dC5nZXRVaW50OChuKyspKTspcis9MjU1O3IrPW87Y29uc3QgYT1mdW5jdGlvbihlLHQsbil7bGV0IHI9bmV3IFVpbnQ4QXJyYXkoZSx0LG4pLG89W10sYT0wO2Zvcig7YTxuOylhKzM8biYmMD09PXJbYV0mJjA9PT1yW2ErMV0mJjM9PT1yW2ErMl0mJigwPT09clthKzNdfHwxPT09clthKzNdfHwyPT09clthKzNdfHwzPT09clthKzNdKT8oby5wdXNoKHJbYV0sclthKzFdLHJbYSszXSksYSs9NCk6KG8ucHVzaChyW2FdKSxhKyspO3JldHVybiBuZXcgVWludDhBcnJheShvKX0oZS5kYXRhLG4scik7cmV0dXJuIG5ldyBVaW50OEFycmF5KGEpfXJldHVybiBudWxsfWZ1bmN0aW9uIHQoZSx0KXtjb25zdCBuPWZ1bmN0aW9uKGUpe2NvbnN0IHQ9ZS5sZW5ndGg7bGV0IG49W10scj0wO2Zvcig7cjx0OylyKzI8dCYmMD09PWVbcl0mJjA9PT1lW3IrMV0mJigwPT09ZVtyKzJdfHwxPT09ZVtyKzJdfHwyPT09ZVtyKzJdfHwzPT09ZVtyKzJdKT8obi5wdXNoKGVbcl0sZVtyKzFdLDMsZVtyKzJdKSxyKz0zKToobi5wdXNoKGVbcl0pLHIrKyk7cmV0dXJuIG5ldyBVaW50OEFycmF5KG4pfSh0KSxyPW4ubGVuZ3RoLG89TWF0aC5mbG9vcihyLzI1NSksYT1yJTI1NSxzPW5ldyBVaW50OEFycmF5KDYrbysxK3IrZS5ieXRlTGVuZ3RoKTtzWzBdPTAsc1sxXT0wLHNbMl09MCxzWzNdPTEsc1s0XT02LHNbNV09MTAxO2xldCBpPTA7Zm9yKDtpPG87KXNbNitpXT0yNTUsaSsrO3JldHVybiBzWzYraV09YSxpKysscy5zZXQobiw2K2kpLHMuc2V0KG5ldyBVaW50OEFycmF5KGUpLDYraStyKSxzLmJ1ZmZlcn1uYXZpZ2F0b3IudXNlckFnZW50LmluZGV4T2YoIlNhZmFyaSIpPi0xJiYtMT09PW5hdmlnYXRvci51c2VyQWdlbnQuaW5kZXhPZigiQ2hyb21lIikmJihzZWxmLm9ucnRjdHJhbnNmb3JtPW49Pntjb25zdCByPW4udHJhbnNmb3JtZXI7bGV0IG89W107ci5vcHRpb25zLnBvcnQub25tZXNzYWdlPWU9PntlLmRhdGEuc2VpJiZvLnB1c2goZS5kYXRhLnNlaSl9LHNlbGYucG9zdE1lc3NhZ2UoInN0YXJ0ZWQiKTtjb25zdCBhPXIucmVhZGFibGUuZ2V0UmVhZGVyKCkscz1yLndyaXRhYmxlLmdldFdyaXRlcigpOyJyeCI9PT1yLm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KG4pe2EucmVhZCgpLnRoZW4oKHI9PntpZighci5kb25lKXtpZihyLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IHQ9ZShyLnZhbHVlKTt0JiZuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7c2VpOnR9KX1zLndyaXRlKHIudmFsdWUpLG4ub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQobil9fSkpfShyKToidHgiPT09ci5vcHRpb25zLm5hbWUmJmZ1bmN0aW9uIGUobil7YS5yZWFkKCkudGhlbigocj0+e2lmKCFyLmRvbmUpe2lmKHIudmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3QgZT1vLnNoaWZ0KCk7ZSYmKHIudmFsdWUuZGF0YT10KHIudmFsdWUuZGF0YSxlKSl9cy53cml0ZShyLnZhbHVlKSxuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSxlKG4pfX0pKX0ocil9LHNlbGYucG9zdE1lc3NhZ2UoInJlZ2lzdGVyZWQiKSk7Cg==")],{type:"text/javascript"});return setTimeout((()=>JP.revokeObjectURL(e)),0),new Worker(JP.createObjectURL(e))}const XP=new Map;const qP=new Map;function QP(e){const t=new DataView(e.data);if(0===t.getUint8(0)&&0===t.getUint8(1)&&0===t.getUint8(2)&&1===t.getUint8(3)&&6===t.getUint8(4)){let r=6,n=0,i=0;for(;255===(i=t.getUint8(r++));)n+=255;n+=i;const o=function(e,t,r){let n=new Uint8Array(e,t,r),i=[],o=0;for(;o<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)}(e.data,r,n);return new Uint8Array(o)}return null}function $P(e,t){const r=function(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)}(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}const eL=new Map;const tL=new Map;Zn(),e.AUDIO_CONTEXT_EVENT=Qn,e.AUDIO_ENCODER_CONFIG_SETTINGS=xc,e.AUDIO_TRACK_EVENT=ed,e.AudioProcessorContext=Qb,e.AudioProcessorDestination=qb,e.AudioSourceEvents=$c,e.BufferSourceAudioTrack=tA,e.CameraVideoTrack=JA,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=td,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=rd,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=nd,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=id,e.DataChannel=jC,e.DataChannelEvents=ld,e.DeviceManager=Ib,e.DeviceManagerEvent=cd,e.DeviceManagerState=ad,e.LocalAudioTrack=$R,e.LocalDataChannel=class extends jC{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=tb,e.LocalTrackEvents=qc,e.LocalVideoTrack=YA,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=eA,e.MixingAudioTrack=rA,e.PROCESSOR_CONTEXT_EVENTS=sd,e.PROCESSOR_DESTINATION_EVENTS=od,e.RemoteAudioTrack=fO,e.RemoteDataChannel=class extends jC{constructor(e){super(e),Fm(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(In("SHOW_DATASTREAM2_LOG")&&Bn.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)}}_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=Zc,e.RemoteStreamType=Jc,e.RemoteTrack=hO,e.RemoteTrackEvents=Qc,e.RemoteVideoTrack=pO,e.SAFARI_GLOBAL_GUM_LOCK=yb,e.SUPPORT_720P_AUTO_CONFIG_LIST=kc,e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=Dc,e.SUPPORT_SVC_CONFIG_LIST=Pc,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=Nc,e.StreamType=Yc,e.Track=eb,e.TrackEvents=Xc,e.TrackHint=Kc,e.TrackInternalEvent=zc,e.VideoProcessorContext=Xb,e.VideoProcessorDestination=Zb,e.VideoState=ud,e.__TRACK_LIST__=Fc,e.addTrack=Bc,e.audioContextState=ob,e.audioElementPlayCenter=Ub,e.audioTimerLoop=function(e,t){let r=!1;const n=1/t;if(In("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*n)}else{const t=ab();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=Nb,e.blob2Uint8Array=dR,e.checkMediaStreamTrackResolution=tR,e.checkTrackState=xb,e.createBufferSourceAudioTrack=async function(e){var t;const{cacheOnlineFile:r,encoderConfig:n}=e;let{source:i}=e;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=Yn.reportApiInvoke(null,{tag:Hr.TRACER,name:Wr.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(In("DISABLE_WEBAUDIO"))throw new Cr(wr.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");const a=sn(8,"track-buf-");Bn.info("start create buffer source audio track with config",JSON.stringify(o),"trackId",a);const c=i;if(!(i instanceof AudioBuffer))try{i=await async function(e,t){let r=null;if("string"==typeof e){const t=iA.get(e);if(t)return Bn.debug("use cached audio resource: ",e),t;try{r=(await gn((()=>qt.get(e,{responseType:"arraybuffer"})),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new Cr(wr.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new $y(((t,r)=>{const n=new FileReader;n.onload=e=>{e.target?t(e.target.result):r(new Cr(wr.READ_LOCAL_AUDIO_FILE_ERROR))},n.onerror=()=>{r(new Cr(wr.READ_LOCAL_AUDIO_FILE_ERROR))},n.readAsArrayBuffer(e)}));r=await t}const n=await ub(r);return"string"==typeof e&&t&&iA.set(e,n),n}(i,r)}catch(e){return s.onError(e),e.throw(Bn)}const d=new nA(i),u=new tA(c,d,n?Vc(n):{},a);return Bn.info("create buffer source audio track success, trackId:",a),s.onSuccess(u.getTrackId()),u},e.createCameraVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=In("CAMERA_CAPTURE_CONFIG"),r=Yn.reportApiInvoke(null,{tag:Hr.TRACER,name:Wr.CREATE_CAM_VIDEO_TRACK,options:[XA({},e),t]});t&&(e.encoderConfig=t);const n=rR(e),i=sn(8,"track-cam-");let o=null;const s="720p_auto"===e.encoderConfig;Bn.info("start create camera video track with config",JSON.stringify(e),"trackId",i);try{o=(await bb({video:n},i)).getVideoTracks()[0]||null}catch(e){throw r.onError(e),e}if(!o){const e=new Cr(wr.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(Bn)}e.optimizationMode&&qA(i,o,e,Lc(e.encoderConfig));const a=new JA(o,e,n,e.scalabiltyMode?Uc(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,i);return s&&a.startMonitorStats(),r.onSuccess(a.getTrackId()),Bn.info("create camera video success, trackId:",i),a},e.createCustomAudioTrack=function(e){const t=Yn.reportApiInvoke(null,{tag:Hr.TRACER,name:Wr.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),r=new $R(e.mediaStreamTrack,e.encoderConfig?Vc(e.encoderConfig):{},sn(8,"track-cus-"),!1);return Bn.info("create custom audio track success with config",e,"trackId",r.getTrackId()),t.onSuccess(r.getTrackId()),r},e.createCustomVideoTrack=function(e){const t=Yn.reportApiInvoke(null,{tag:Hr.TRACER,name:Wr.CREATE_CUSTOM_VIDEO_TRACK,options:[e]}),r=new YA(e.mediaStreamTrack,{width:e.width,height:e.height,frameRate:e.frameRate,bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin},e.scalabiltyMode?Uc(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,sn(8,"track-cus-"),[Kc.CUSTOM_TRACK]);return t.onSuccess(r.getTrackId()),Bn.info("create custom video track success with config",e,"trackId",r.getTrackId()),r},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=In("CAMERA_CAPTURE_CONFIG"),n=Yn.reportApiInvoke(null,{tag:Hr.TRACER,name:Wr.CREATE_MIC_AND_CAM_TRACKS,options:[e,t,r]});r&&(t.encoderConfig=r);const i="720p_auto"===t.encoderConfig,o=rR(t),s=iR(e),a=sn(8,"track-mic-"),c=sn(8,"track-cam-");let d=null,u=null;Bn.info("start create camera video track(".concat(c,") and microphone audio track(").concat(a,") with config, audio: ").concat(JSON.stringify(e),", video: ").concat(JSON.stringify(t)));try{const e=await bb({audio:s,video:o},"".concat(a,"-").concat(c));d=e.getAudioTracks()[0],u=e.getVideoTracks()[0]}catch(e){throw n.onError(e),e}if(!d||!u){const e=new Cr(wr.UNEXPECTED_ERROR,"can not find tracks in media stream");return n.onError(e),e.throw(Bn)}t.optimizationMode&&qA(c,u,t,Lc(t.encoderConfig));const l=new eA(d,e,s,a),h=new JA(u,t,o,t.scalabiltyMode?Uc(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,c);return i&&h.startMonitorStats(),n.onSuccess([l.getTrackId(),h.getTrackId()]),Bn.info("create camera video track(".concat(c,") and microphone audio track(").concat(a,") success")),[l,h]},e.createMicrophoneAudioTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Yn.reportApiInvoke(null,{tag:Hr.TRACER,name:Wr.CREATE_MIC_AUDIO_TRACK,options:[e]}),r=iR(e),n=sn(8,"track-mic-");let i=null;Bn.info("start create microphone audio track with config",JSON.stringify(e),"trackId",n);try{i=(await bb({audio:r},n)).getAudioTracks()[0]||null}catch(e){throw t.onError(e),e}if(!i){const e=new Cr(wr.UNEXPECTED_ERROR,"can not find track in media stream");return t.onError(e),e.throw(Bn)}const o=new eA(i,e,r,n);return t.onSuccess(o.getTrackId()),Bn.info("create microphone audio track success, trackId:",n),o},e.createMixingAudioTrack=function(e){const t=new rA;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=Yn.reportApiInvoke(null,{tag:Hr.TRACER,name:Wr.CREATE_SCREEN_VIDEO_TRACK,options:[XA({},e),t]}),n="720p_auto"===e.encoderConfig;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 i=nR(e),o=sn(8,"track-scr-v-");let s=null,a=null;const c=Xn();if(!c.supportShareAudio&&"enable"===t){const e=new Cr(wr.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return r.onError(e),e.throw(Bn)}Bn.info("start create screen video track with config",e,"withAudio",t,"trackId",o);try{const e=await bb({screen:i,screenAudio:"auto"===t?c.supportShareAudio:"enable"===t},o);s=e.getVideoTracks()[0]||null,a=e.getAudioTracks()[0]||null}catch(e){throw r.onError(e),e}if(!s){const e=new Cr(wr.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(Bn)}if(!a&&"enable"===t){s&&s.stop();const e=new Cr(wr.SHARE_AUDIO_NOT_ALLOWED);return r.onError(e),e.throw(Bn)}if(e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode){qA(o,s,e,e.encoderConfig&&Mc(e.encoderConfig)||void 0),e.encoderConfig&&"string"!=typeof e.encoderConfig&&(e.encoderConfig.bitrateMin=e.encoderConfig.bitrateMax)}const d=new YA(s,e.encoderConfig?Mc(e.encoderConfig):{},e.scalabiltyMode?Uc(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,o,[Kc.SCREEN_TRACK]);if(n&&d.startMonitorStats(),!a)return r.onSuccess(d.getTrackId()),Bn.info("create screen video track success","video:",d.getTrackId()),d;const u=new $R(a,void 0,sn(8,"track-scr-a-"),!1);return r.onSuccess([d.getTrackId(),u.getTrackId()]),Bn.info("create screen video track success","video:",d.getTrackId(),"audio:",u.getTrackId()),[d,u]},e.decodeAudioData=ub,e.detectSupportAudioElementSetSinkId=qn,e.deviceManager=wb,e.emptyImage2TypedArray=cR,e.frameData2CryptoBuffer=async(e,t,r)=>await aR(e.buffer,t,r),e.getAudioContext=ab,e.getAudioEncoderConfiguration=Vc,e.getBitrateConstrainRange=oR,e.getBitrateFromResAndFps=sR,e.getCompatibility=Xn,e.getConstraintsFromCameraConfig=rR,e.getConstraintsFromMicrophoneConfig=iR,e.getConstraintsFromScreenConfig=nR,e.getElectronScreenSources=Sb,e.getElectronScreenStream=gb,e.getElectronScreenStreamByUserSelect=Tb,e.getLocalStream=bb,e.getOriginSenderConfig=e=>{const t=e._encoderConfig;if(!t)return;const{frameRate:r,width:n,height:i}=e.getMediaStreamTrackSettings();let{frameRate:o=r,width:s=n,height:a=i}=t;if(!o||!s||!a)return;s=hn(s),a=hn(a),o=hn(o);const{max:c,min:d}=sR(s,a,o),{bitrateMax:u,bitrateMin:l}=t||{};u||Bn.debug("calculate bitrate: [w: ".concat(s,", h: ").concat(a,", fps: ").concat(o,"] => [brMax: ").concat(u,", brMin: ").concat(l,"]"));const{maxFramerate:h}=In("ENCODER_CONFIG_LIMIT");return h&&"number"==typeof h&&(o=Math.min(o,h)),{frameRate:o,bitrateMax:u||c,bitrateMin:l||d,scaleResolutionDownBy:1,scale:0}},e.getScalabilityConfiguration=Uc,e.getScreenEncoderConfiguration=Mc,e.getSilenceAudioTrack=function(){if(hb)return hb;const e=ab();if(!e.createMediaStreamDestination)throw new Cr(wr.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),hb=n.stream.getAudioTracks()[0],hb},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=uR,e.getVideoEncoderConfiguration=Lc,e.handleGetUserMediaError=Ab,e.hasAudioContext=cb,e.interceptLocalAudioFrame=async function(e){if(!Xn().supportWebRTCEncodedTransform)return void Bn.warning("browser not support audio encoded transform");if(XP.has(e))return;if(!e.track)return;const t={track:e.track};if(cr()){if(!e.createEncodedStreams)return void Bn.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Bn.error("create audio-encoded-streams error",e&&e.message)}const i=new TransformStream({transform(n,i){t.controller||(t.controller=i),e.track&&e.track.id!==t.track.id&&(Bn.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r)),i.enqueue(n)}});n.readable.pipeThrough(i).pipeTo(n.writable)}else if(dr()){if("undefined"==typeof RTCRtpScriptTransform)return void Bn.warning("browser not support RTCRtpScriptTransform");const n=ZP(),i=new MessageChannel;await new $y((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(n,{name:"tx",port:i.port2},[i.port2]);e.transform=o,await new $y((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),i.port1.onmessage=n=>{var i;n.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==t.track.id&&(Bn.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r))},t.worker=n}function r(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",r)}const t=XP.get(e);if(t){XP.delete(e);try{var n,i;null===(n=t.controller)||void 0===n||n.terminate(),null===(i=t.worker)||void 0===i||i.terminate()}catch(e){Bn.warning(e&&e.message)}}}XP.set(e,t),e.track.addEventListener("ended",r)},e.interceptLocalVideoFrame=async function(e,t){if(!Xn().supportWebRTCEncodedTransform)return void Bn.warning("browser not support video encoded transform");if(eL.has(e))return;if(!e.track)return;const r={track:e.track};if(cr()){if(!e.createEncodedStreams)return void Bn.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void Bn.error("create video-encoded-streams error",e&&e.message)}let 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&&(Bn.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=o.shift();s&&(t.data=$P(t.data,s)),i.enqueue(t)}});i.readable.pipeThrough(s).pipeTo(i.writable)}else{if(!dr())return;{if("undefined"==typeof RTCRtpScriptTransform)return void Bn.warning("browser not support RTCRtpScriptTransform");const i=ZP(),o=new MessageChannel;await new $y((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(i,{name:"tx",port:o.port2},[o.port2]);e.transform=s,await new $y((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&&(Bn.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=eL.get(e);if(t){eL.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){Bn.warning(e&&e.message)}}}eL.set(e,r),e.track.addEventListener("ended",n)},e.interceptRemoteAudioFrame=async function(e){if(!Xn().supportWebRTCEncodedTransform)return void Bn.warning("browser not support audio encoded transform");if(qP.has(e))return;const t={track:e.track};if(cr()){if(!e.createEncodedStreams)return void Bn.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Bn.error("create audio-encoded-streams error",e&&e.message)}const i=new TransformStream({transform(n,i){t.controller||(t.controller=i),e.track&&e.track.id!==t.track.id&&(Bn.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r)),i.enqueue(n)}});n.readable.pipeThrough(i).pipeTo(n.writable)}else if(dr()){if("undefined"==typeof RTCRtpScriptTransform)return void Bn.warning("browser not support RTCRtpScriptTransform");const n=ZP(),i=new MessageChannel;await new $y((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(n,{name:"rx",port:i.port2},[i.port2]);e.transform=o,await new $y((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),i.port1.onmessage=n=>{var i;n.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==t.track.id&&(Bn.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r))},t.worker=n}function r(){e.track.removeEventListener("ended",r),function(e){const t=qP.get(e);if(t){qP.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){Bn.warning(e&&e.message)}}}(e)}qP.set(e,t),e.track.addEventListener("ended",r)},e.interceptRemoteVideoFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Xn().supportWebRTCEncodedTransform)return void Bn.warning("browser not support video encoded transform");if(!e.track)return;if(tL.has(e)){const r=tL.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(cr()){if(!e.createEncodedStreams)return void Bn.warning("browser not support createEncodedStreams() API");let t=null;try{t=e.createEncodedStreams()}catch(e){return void Bn.error("create video-encoded-streams error",e&&e.message)}const i=new TransformStream({transform(t,i){r.controller||(r.controller=i),e.track&&e.track.id!==r.track.id&&(Bn.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 o=QP(t);o&&r.onSei&&r.onSei(o),i.enqueue(t)}});t.readable.pipeThrough(i).pipeTo(t.writable)}else if(dr()){if("undefined"==typeof RTCRtpScriptTransform)return void Bn.warning("browser not support RTCRtpScriptTransform");const t=ZP(),i=new MessageChannel;await new $y((e=>t.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(t,{name:"rx",port:i.port2},[i.port2]);e.transform=o,await new $y((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?(Bn.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)):t.data.sei&&r.onSei&&r.onSei(t.data.sei)},r.worker=t}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}!function(e){const t=tL.get(e);if(t){tL.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){Bn.warning(e&&e.message)}}}(e)}tL.set(e,r),e.track.addEventListener("ended",n)},e.isAudioEncoderConfiguration=Wc,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?kr(e,"profile",Object.keys(xc)):Wc(e),!0},e.isBeautyEffectOptions=function(e){return void 0!==e.smoothnessLevel&&Dr(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&Dr(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&Dr(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&kr(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),!0},e.isElectron=Br,e.isLowStreamParameter=function(e){if(!e)throw new Cr(wr.INVALID_PARAMS);return Lr(e.width)||Pr(e.width,"streamParameter.width"),Lr(e.height)||Pr(e.height,"streamParameter.height"),Lr(e.framerate)||Pr(e.framerate,"streamParameter.framerate"),Lr(e.bitrate)||Dr(e.bitrate,"streamParameter.bitrate"),!0},e.isScreenSourceType=Hc,e.isVideoEncoderConfiguration=Gc,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?kr(e,"profile",Object.keys(Nc)):Gc(e),!0},e.polyfillAudioNode=db,e.removeTrack=jc,e.requestAutoplayGesture=kb,e.silenceScriptProcessHandler=pb,e.updateAgoraRTCCompatibility=Zn,e.visibilityWatcher=_O}));
5
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).AgoraRTCMedia={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}let r=!0,i=!0;function n(e,t,r){const i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function o(e,t,r){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);const o=e=>{const t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};const o=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const i=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,i])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function s(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(r=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function a(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(i=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function c(){if("object"==typeof window){if(r)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function d(e,t){i&&console.warn(e+" is deprecated, please use "+t+" instead.")}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e){return u(e)?Object.keys(e).reduce((function(t,r){const i=u(e[r]),n=i?l(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,{[r]:n})}),{}):e}function p(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((i=>{i.endsWith("Id")?p(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((t=>{p(e,e.get(t),r)}))})))}function h(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&&p(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=>h(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=>h(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,i;return this.getSenders().forEach((r=>{r.track===e&&(t?i=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?i=!0:r=t),t.track===e))),i||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function v(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const i=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(i)};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),n.apply(this,arguments)}}function y(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return v(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}i.apply(this,[t])};const n=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const n=this._streams[r.id];if(n)n.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const i=new e.MediaStream([t]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=i[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function R(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}))}function A(e,t){o(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var O=Object.freeze({__proto__:null,fixNegotiationNeeded:A,shimAddTrackRemoveTrack:y,shimAddTrackRemoveTrackWithNative:v,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{const i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))},shimGetSendersWithDtmf:T,shimGetStats:g,shimGetUserMedia:E,shimMediaStream:m,shimOnTrack:_,shimPeerConnection:R,shimSenderReceiverGetStats:S});function I(e,t){const r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){d("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function b(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function C(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,o]=arguments;return i.apply(this,[e||null]).then((e=>{if(t.version<53&&!n)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,i)=>{e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(n,o)}}function N(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function w(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),o(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function D(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){d("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function P(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function k(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const r=e.length>0;r&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const i=t.apply(this,arguments);if(r){const{sender:t}=i,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(r).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return i})}function L(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function M(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var x=Object.freeze({__proto__:null,shimAddTransceiver:k,shimCreateAnswer:U,shimCreateOffer:M,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})},shimGetParameters:L,shimGetUserMedia:I,shimOnTrack:b,shimPeerConnection:C,shimRTCDataChannel:P,shimReceiverGetStats:w,shimRemoveStream:D,shimSenderGetStats:N});function V(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))})}}function F(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}))}),t.apply(e,arguments)}}}function B(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n};let a=function(e,t,r){const i=n.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};t.setLocalDescription=a,a=function(e,t,r){const i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.setRemoteDescription=a,a=function(e,t,r){const i=s.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.addIceCandidate=a}function j(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(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")?(d("RTCIceServer.url","RTCIceServer.urls"),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function H(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function K(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function z(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Y=Object.freeze({__proto__:null,shimAudioContext:z,shimCallbacksAPI:B,shimConstraints:W,shimCreateOfferLegacy:K,shimGetUserMedia:j,shimLocalStreamsAPI:V,shimRTCIceServerUrls:G,shimRemoteStreamsAPI:F,shimTrackEventTransceiver:H}),X="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function J(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var q={exports:{}};!function(e){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){const r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((e=>0===e.indexOf(r)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const r={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":r.relatedAddress=t[e+1];break;case"rport":r.relatedPort=parseInt(t[e+1],10);break;case"tcptype":r.tcpType=t[e+1];break;case"ufrag":r.ufrag=t[e+1],r.usernameFragment=t[e+1];break;default:void 0===r[t[e]]&&(r[t[e]]=t[e+1])}return r},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const i=e.type;return t.push("typ"),t.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let r;const i=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<i.length;e++)r=i[e].trim().split("="),t[r[0].trim()]=r[1];return t},t.writeFmtp=function(e){let t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const i=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),r={ssrc:parseInt(e.substring(7,t),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substring(t+1,i),r.value=e.substring(i+1)):r.attribute=e.substring(t+1),r},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){const i=t.matchPrefix(e+r,"a=ice-ufrag:")[0],n=t.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substring(12),password:n.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(e)[0].split(" ");r.profile=i[2];for(let n=3;n<i.length;n++){const o=i[n],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){const i=t.parseRtpMap(s),n=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(i.parameters=n.length?t.parseFmtp(n[0]):{},i.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(i.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{r.headerExtensions.push(t.parseExtmap(e))}));const n=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return r.codecs.forEach((e=>{n.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),r},t.writeRtpDescription=function(e,r){let i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((e=>{i+=t.writeRtpMap(e),i+=t.writeFmtp(e),i+=t.writeRtcpFb(e)}));let n=0;return r.codecs.forEach((e=>{e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((e=>{i+=t.writeExtmap(e)})),i},t.parseRtpEncodingParameters=function(e){const r=[],i=t.parseRtpParameters(e),n=-1!==i.fecMechanisms.indexOf("RED"),o=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),a=s.length>0&&s[0].ssrc;let c;const d=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));d.length>0&&d[0].length>1&&d[0][0]===a&&(c=d[0][1]),i.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),r.push(t),n&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&a&&r.push({ssrc:a});let u=t.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substring(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=u}))),r},t.parseRtcpParameters=function(e){const r={},i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);const n=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;const o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let r;const i=t.matchPrefix(e,"a=msid:");if(1===i.length)return r=i[0].substring(7).split(" "),{stream:r[0],track:r[1]};const n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return n.length>0?(r=n[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},t.parseSctpDescription=function(e){const r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");let n;i.length>0&&(n=parseInt(i[0].substring(19),10)),isNaN(n)&&(n=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:r.fmt,maxMessageSize:n};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:n}}},t.writeSctpDescription=function(e,t){let r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,r,i){let n;const o=void 0!==r?r:2;n=e||t.generateSessionId();return"v=0\r\no="+(i||"thisisadapterortc")+" "+n+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){const i=t.splitLines(e);for(let e=0;e<i.length;e++)switch(i[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[e].substring(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const r=t.splitLines(e)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){const r=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const r=t.splitLines(e);for(let e=0;e<r.length;e++)if(r[e].length<2||"="!==r[e].charAt(1))return!1;return!0},e.exports=t}(q);var Q=q.exports,Z=J(Q),$=t({__proto__:null,default:Z},[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=Z.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=Z.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=Z.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=Z.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=Z.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(!O||!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=O,se(e,i),ae(e),E(e,i),m(e),R(e,i),_(e),y(e,i),T(e),g(e),S(e),A(e,i),ee(e),te(e),ne(e),re(e,i),ie(e),oe(e,i);break;case"firefox":if(!x||!C||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=x,se(e,i),ae(e),I(e,i),C(e,i),b(e),D(e),N(e),w(e),P(e),k(e),L(e),M(e),U(e),ee(e),ne(e),re(e,i),ie(e);break;case"safari":if(!Y||!t.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=Y,se(e,i),ae(e),G(e),K(e),B(e),V(e),F(e),H(e),j(e),z(e),ee(e),te(e),re(e,i),ie(e),oe(e,i);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var de={exports:{}};!function(e,t){!function(r,i){var n="function",o="undefined",s="object",a="string",c="major",d="model",u="name",l="type",p="vendor",h="version",f="architecture",E="console",m="mobile",_="tablet",T="smarttv",g="wearable",S="embedded",v="Amazon",y="Apple",R="ASUS",A="BlackBerry",O="Browser",I="Chrome",b="Firefox",C="Google",N="Huawei",w="LG",D="Microsoft",P="Motorola",k="Opera",L="Samsung",M="Sharp",U="Sony",x="Xiaomi",V="Zebra",F="Facebook",B="Chromium OS",j="Mac OS",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)},z=function(e,t){for(var r,o,a,c,d,u,l=0;l<t.length&&!d;){var p=t[l],h=t[l+1];for(r=o=0;r<p.length&&!d&&p[r];)if(d=p[r++].exec(e))for(a=0;a<h.length;a++)u=d[++o],typeof(c=h[a])===s&&c.length>0?2===c.length?typeof c[1]==n?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?typeof c[1]!==n||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):i:this[c[0]]=u?c[1].call(this,u,c[2]):i:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):i):this[c]=u||i;l+=2}},Y=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(G(t[r][n],e))return"?"===r?i:r}else if(G(t[r],e))return"?"===r?i:r;return e},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},J={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,h],[/opios[\/ ]+([\w\.]+)/i],[h,[u,k+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[u,k]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[u,"UC"+O]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[h,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+O],h],[/\bfocus\/([\w\.]+)/i],[h,[u,b+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[u,k+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[u,k+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[u,"MIUI "+O]],[/fxios\/([-\w\.]+)/i],[h,[u,b]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+O]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+O],h],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],h],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[u,I+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,I+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[u,"Android "+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[h,Y,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[u,b+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[u,h],[/(cobalt)\/([\w\.]+)/i],[u,[h,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,H]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",H]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,H]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[p,L],[l,_]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[p,L],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[d,[p,y],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[p,y],[l,_]],[/(macintosh);/i],[d,[p,y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[p,M],[l,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[p,N],[l,_]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[p,N],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[d,/_/g," "],[p,x],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[p,x],[l,_]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[p,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[p,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[d,[p,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[p,P],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[p,P],[l,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[p,w],[l,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[p,w],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[p,"Lenovo"],[l,_]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[p,"Nokia"],[l,m]],[/(pixel c)\b/i],[d,[p,C],[l,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[p,C],[l,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[p,U],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[p,U],[l,_]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[p,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[p,v],[l,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[p,v],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[d,p,[l,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[p,A],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[p,R],[l,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[p,R],[l,m]],[/(nexus 9)/i],[d,[p,"HTC"],[l,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[d,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[p,"Acer"],[l,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[p,"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],[p,d,[l,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,d,[l,_]],[/(surface duo)/i],[d,[p,D],[l,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[p,"Fairphone"],[l,m]],[/(u304aa)/i],[d,[p,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[d,[p,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[d,[p,"RCA"],[l,_]],[/\b(venue[\d ]{2,7}) b/i],[d,[p,"Dell"],[l,_]],[/\b(q(?:mv|ta)\w+) b/i],[d,[p,"Verizon"],[l,_]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[p,"Barnes & Noble"],[l,_]],[/\b(tm\d{3}\w+) b/i],[d,[p,"NuVision"],[l,_]],[/\b(k88) b/i],[d,[p,"ZTE"],[l,_]],[/\b(nx\d{3}j) b/i],[d,[p,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[d,[p,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[d,[p,"Swiss"],[l,_]],[/\b((zeki)?tb.*\b) b/i],[d,[p,"Zeki"],[l,_]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],d,[l,_]],[/\b(ns-?\w{0,9}) b/i],[d,[p,"Insignia"],[l,_]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[p,"NextBook"],[l,_]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],d,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],d,[l,m]],[/\b(ph-1) /i],[d,[p,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[p,"Envizen"],[l,_]],[/\b(trio[-\w\. ]+) b/i],[d,[p,"MachSpeed"],[l,_]],[/\btu_(1491) b/i],[d,[p,"Rotor"],[l,_]],[/(shield[\w ]+) b/i],[d,[p,"Nvidia"],[l,_]],[/(sprint) (\w+)/i],[p,d,[l,m]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[p,D],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[p,V],[l,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[p,V],[l,m]],[/smart-tv.+(samsung)/i],[p,[l,T]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[p,L],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,w],[l,T]],[/(apple) ?tv/i],[p,[d,y+" TV"],[l,T]],[/crkey/i],[[d,I+"cast"],[p,C],[l,T]],[/droid.+aft(\w)( bui|\))/i],[d,[p,v],[l,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[p,M],[l,T]],[/(bravia[\w ]+)( bui|\))/i],[d,[p,U],[l,T]],[/(mitv-\w{5}) bui/i],[d,[p,x],[l,T]],[/Hbbtv.*(technisat) (.*);/i],[p,d,[l,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,K],[d,K],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,d,[l,E]],[/droid.+; (shield) bui/i],[d,[p,"Nvidia"],[l,E]],[/(playstation [345portablevi]+)/i],[d,[p,U],[l,E]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[p,D],[l,E]],[/((pebble))app/i],[p,d,[l,g]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[p,y],[l,g]],[/droid.+; (glass) \d/i],[d,[p,C],[l,g]],[/droid.+; (wt63?0{2,3})\)/i],[d,[p,V],[l,g]],[/(quest( 2| pro)?)/i],[d,[p,F],[l,g]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[l,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[d,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[l,_]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[h,Y,X]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[h,Y,X]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,j],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,h],[/\(bb(10);/i],[h,[u,A]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[u,b+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[h,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[h,[u,I+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,B],h],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,h],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,h]]},q=function(e,t){if(typeof e===s&&(t=e,e=i),!(this instanceof q))return new q(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}(J,t):J;return this.getBrowser=function(){var e={};return e[u]=i,e[h]=i,z.call(e,T,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i}(e[h]),E&&E.brave&&typeof E.brave.isBrave==n&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[f]=i,z.call(e,T,S.cpu),e},this.getDevice=function(){var e={};return e[p]=i,e[d]=i,e[l]=i,z.call(e,T,S.device),!e[l]&&g&&g.mobile&&(e[l]=m),"Macintosh"==e[d]&&E&&typeof E.standalone!==o&&E.maxTouchPoints&&E.maxTouchPoints>2&&(e[d]="iPad",e[l]=_),e},this.getEngine=function(){var e={};return e[u]=i,e[h]=i,z.call(e,T,S.engine),e},this.getOS=function(){var e={};return e[u]=i,e[h]=i,z.call(e,T,S.os),!e[u]&&g&&"Unknown"!=g.platform&&(e[u]=g.platform.replace(/chrome os/i,B).replace(/macos/i,j)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return T},this.setUA=function(e){return T=typeof e===a&&e.length>350?K(e,350):e,this},this.setUA(T),this};q.VERSION="0.7.34",q.BROWSER=W([u,h,c]),q.CPU=W([f]),q.DEVICE=W([d,p,l,E,m,T,_,g,S]),q.ENGINE=q.OS=W([u,h]),e.exports&&(t=e.exports=q),t.UAParser=q;var Q=typeof r!==o&&(r.jQuery||r.Zepto);if(Q&&!Q.ua){var Z=new q;Q.ua=Z.getResult(),Q.ua.get=function(){return Z.getUA()},Q.ua.set=function(e){Z.setUA(e);var t=Z.getResult();for(var r in t)Q.ua[r]=t[r]}}}("object"==typeof window?window:X)}(de,de.exports);var ue=J(de.exports);function le(e,t){return function(){return e.apply(t,arguments)}}const{toString:pe}=Object.prototype,{getPrototypeOf:he}=Object,fe=(Ee=Object.create(null),e=>{const t=pe.call(e);return Ee[t]||(Ee[t]=t.slice(8,-1).toLowerCase())});var Ee;const me=e=>(e=e.toLowerCase(),t=>fe(t)===e),_e=e=>t=>typeof t===e,{isArray:Te}=Array,ge=_e("undefined");const Se=me("ArrayBuffer");const ve=_e("string"),ye=_e("function"),Re=_e("number"),Ae=e=>null!==e&&"object"==typeof e,Oe=e=>{if("object"!==fe(e))return!1;const t=he(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Ie=me("Date"),be=me("File"),Ce=me("Blob"),Ne=me("FileList"),we=me("URLSearchParams");function De(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let i,n;if("object"!=typeof e&&(e=[e]),Te(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{const n=r?Object.getOwnPropertyNames(e):Object.keys(e),o=n.length;let s;for(i=0;i<o;i++)s=n[i],t.call(null,e[s],s,e)}}function Pe(e,t){t=t.toLowerCase();const r=Object.keys(e);let i,n=r.length;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const ke="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Le=e=>!ge(e)&&e!==ke;const Me=(Ue="undefined"!=typeof Uint8Array&&he(Uint8Array),e=>Ue&&e instanceof Ue);var Ue;const xe=me("HTMLFormElement"),Ve=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Fe=me("RegExp"),Be=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),i={};De(r,((r,n)=>{let o;!1!==(o=t(r,n,e))&&(i[n]=o||r)})),Object.defineProperties(e,i)},je="abcdefghijklmnopqrstuvwxyz",We="0123456789",Ge={DIGIT:We,ALPHA:je,ALPHA_DIGIT:je+je.toUpperCase()+We};const He=me("AsyncFunction");var Ke={isArray:Te,isArrayBuffer:Se,isBuffer:function(e){return null!==e&&!ge(e)&&null!==e.constructor&&!ge(e.constructor)&&ye(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||ye(e.append)&&("formdata"===(t=fe(e))||"object"===t&&ye(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Se(e.buffer),t},isString:ve,isNumber:Re,isBoolean:e=>!0===e||!1===e,isObject:Ae,isPlainObject:Oe,isUndefined:ge,isDate:Ie,isFile:be,isBlob:Ce,isRegExp:Fe,isFunction:ye,isStream:e=>Ae(e)&&ye(e.pipe),isURLSearchParams:we,isTypedArray:Me,isFileList:Ne,forEach:De,merge:function e(){const{caseless:t}=Le(this)&&this||{},r={},i=(i,n)=>{const o=t&&Pe(r,n)||n;Oe(r[o])&&Oe(i)?r[o]=e(r[o],i):Oe(i)?r[o]=e({},i):Te(i)?r[o]=i.slice():r[o]=i};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&De(arguments[e],i);return r},extend:(e,t,r,{allOwnKeys:i}={})=>(De(t,((t,i)=>{r&&ye(t)?e[i]=le(t,r):e[i]=t}),{allOwnKeys:i}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,i)=>{let n,o,s;const a={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),o=n.length;o-- >0;)s=n[o],i&&!i(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==r&&he(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:fe,kindOfTest:me,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(Te(e))return e;let t=e.length;if(!Re(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).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:xe,hasOwnProperty:Ve,hasOwnProp:Ve,reduceDescriptors:Be,freezeMethods:e=>{Be(e,((t,r)=>{if(ye(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const i=e[r];ye(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},i=e=>{e.forEach((e=>{r[e]=!0}))};return Te(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)=>(e=+e,Number.isFinite(e)?e:t),findKey:Pe,global:ke,isContextDefined:Le,ALPHABET:Ge,generateString:(e=16,t=Ge.ALPHA_DIGIT)=>{let r="";const{length:i}=t;for(;e--;)r+=t[Math.random()*i|0];return r},isSpecCompliantForm:function(e){return!!(e&&ye(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,i)=>{if(Ae(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[i]=e;const n=Te(e)?[]:{};return De(e,((e,t)=>{const o=r(e,i+1);!ge(o)&&(n[t]=o)})),t[i]=void 0,n}}return e};return r(e,0)},isAsyncFn:He,isThenable:e=>e&&(Ae(e)||ye(e))&&ye(e.then)&&ye(e.catch)};function ze(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n)}Ke.inherits(ze,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Ke.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Ye=ze.prototype,Xe={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Xe[e]={value:e}})),Object.defineProperties(ze,Xe),Object.defineProperty(Ye,"isAxiosError",{value:!0}),ze.from=(e,t,r,i,n,o)=>{const s=Object.create(Ye);return Ke.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),ze.call(s,e.message,t,r,i,n),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};function Je(e){return Ke.isPlainObject(e)||Ke.isArray(e)}function qe(e){return Ke.endsWith(e,"[]")?e.slice(0,-2):e}function Qe(e,t,r){return e?e.concat(t).map((function(e,t){return e=qe(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const Ze=Ke.toFlatObject(Ke,{},null,(function(e){return/^is[A-Z]/.test(e)}));function $e(e,t,r){if(!Ke.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const i=(r=Ke.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Ke.isUndefined(t[e])}))).metaTokens,n=r.visitor||d,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Ke.isSpecCompliantForm(t);if(!Ke.isFunction(n))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Ke.isDate(e))return e.toISOString();if(!a&&Ke.isBlob(e))throw new ze("Blob is not supported. Use a Buffer instead.");return Ke.isArrayBuffer(e)||Ke.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,r,n){let a=e;if(e&&!n&&"object"==typeof e)if(Ke.endsWith(r,"{}"))r=i?r:r.slice(0,-2),e=JSON.stringify(e);else if(Ke.isArray(e)&&function(e){return Ke.isArray(e)&&!e.some(Je)}(e)||(Ke.isFileList(e)||Ke.endsWith(r,"[]"))&&(a=Ke.toArray(e)))return r=qe(r),a.forEach((function(e,i){!Ke.isUndefined(e)&&null!==e&&t.append(!0===s?Qe([r],i,o):null===s?r:r+"[]",c(e))})),!1;return!!Je(e)||(t.append(Qe(n,r,o),c(e)),!1)}const u=[],l=Object.assign(Ze,{defaultVisitor:d,convertValue:c,isVisitable:Je});if(!Ke.isObject(e))throw new TypeError("data must be an object");return function e(r,i){if(!Ke.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+i.join("."));u.push(r),Ke.forEach(r,(function(r,o){!0===(!(Ke.isUndefined(r)||null===r)&&n.call(t,r,Ke.isString(o)?o.trim():o,i,l))&&e(r,i?i.concat(o):[o])})),u.pop()}}(e),t}function et(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function tt(e,t){this._pairs=[],e&&$e(e,this,t)}const rt=tt.prototype;function it(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function nt(e,t,r){if(!t)return e;const i=r&&r.encode||it,n=r&&r.serialize;let o;if(o=n?n(t,r):Ke.isURLSearchParams(t)?t.toString():new tt(t,r).toString(i),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}rt.append=function(e,t){this._pairs.push([e,t])},rt.toString=function(e){const t=e?function(t){return e.call(this,t,et)}:et;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var ot=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){Ke.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},st={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},at={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:tt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ct="undefined"!=typeof window&&"undefined"!=typeof document,dt=(ut="undefined"!=typeof navigator&&navigator.product,ct&&["ReactNative","NativeScript","NS"].indexOf(ut)<0);var ut;const lt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var pt={...Object.freeze({__proto__:null,hasBrowserEnv:ct,hasStandardBrowserEnv:dt,hasStandardBrowserWebWorkerEnv:lt}),...at};function ht(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&&Ke.isArray(i)?i.length:o,a)return Ke.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!s;i[o]&&Ke.isObject(i[o])||(i[o]=[]);return t(e,r,i[o],n)&&Ke.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(Ke.isFormData(e)&&Ke.isFunction(e.entries)){const r={};return Ke.forEachEntry(e,((e,i)=>{t(function(e){return Ke.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,r,0)})),r}return null}const ft={transitional:st,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,n=Ke.isObject(e);n&&Ke.isHTMLForm(e)&&(e=new FormData(e));if(Ke.isFormData(e))return i?JSON.stringify(ht(e)):e;if(Ke.isArrayBuffer(e)||Ke.isBuffer(e)||Ke.isStream(e)||Ke.isFile(e)||Ke.isBlob(e))return e;if(Ke.isArrayBufferView(e))return e.buffer;if(Ke.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return $e(e,new pt.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,i){return pt.isNode&&Ke.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=Ke.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return $e(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||i?(t.setContentType("application/json",!1),function(e,t,r){if(Ke.isString(e))try{return(t||JSON.parse)(e),Ke.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ft.transitional,r=t&&t.forcedJSONParsing,i="json"===this.responseType;if(e&&Ke.isString(e)&&(r&&!this.responseType||i)){const r=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw ze.from(e,ze.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pt.classes.FormData,Blob:pt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ke.forEach(["delete","get","head","post","put","patch"],(e=>{ft.headers[e]={}}));var Et=ft;const mt=Ke.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 _t=Symbol("internals");function Tt(e){return e&&String(e).trim().toLowerCase()}function gt(e){return!1===e||null==e?e:Ke.isArray(e)?e.map(gt):String(e)}function St(e,t,r,i,n){return Ke.isFunction(i)?i.call(this,t,r):(n&&(t=r),Ke.isString(t)?Ke.isString(i)?-1!==t.indexOf(i):Ke.isRegExp(i)?i.test(t):void 0:void 0)}class vt{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function n(e,t,r){const n=Tt(t);if(!n)throw new Error("header name must be a non-empty string");const o=Ke.findKey(i,n);(!o||void 0===i[o]||!0===r||void 0===r&&!1!==i[o])&&(i[o||t]=gt(e))}const o=(e,t)=>Ke.forEach(e,((e,r)=>n(e,r,t)));return Ke.isPlainObject(e)||e instanceof this.constructor?o(e,t):Ke.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]&&mt[r]||("set-cookie"===r?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)})),t})(e),t):null!=e&&n(t,e,r),this}get(e,t){if(e=Tt(e)){const r=Ke.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(Ke.isFunction(t))return t.call(this,e,r);if(Ke.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Tt(e)){const r=Ke.findKey(this,e);return!(!r||void 0===this[r]||t&&!St(0,this[r],r,t))}return!1}delete(e,t){const r=this;let i=!1;function n(e){if(e=Tt(e)){const n=Ke.findKey(r,e);!n||t&&!St(0,r[n],n,t)||(delete r[n],i=!0)}}return Ke.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&&!St(0,this[n],n,e,!0)||(delete this[n],i=!0)}return i}normalize(e){const t=this,r={};return Ke.forEach(this,((i,n)=>{const o=Ke.findKey(r,n);if(o)return t[o]=gt(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]=gt(i),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ke.forEach(this,((r,i)=>{null!=r&&!1!==r&&(t[i]=e&&Ke.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")}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[_t]=this[_t]={accessors:{}}).accessors,r=this.prototype;function i(e){const i=Tt(e);t[i]||(!function(e,t){const r=Ke.toCamelCase(" "+t);["get","set","has"].forEach((i=>{Object.defineProperty(e,i+r,{value:function(e,r,n){return this[i].call(this,t,e,r,n)},configurable:!0})}))}(r,e),t[i]=!0)}return Ke.isArray(e)?e.forEach(i):i(e),this}}vt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ke.reduceDescriptors(vt.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),Ke.freezeMethods(vt);var yt=vt;function Rt(e,t){const r=this||Et,i=t||r,n=yt.from(i.headers);let o=i.data;return Ke.forEach(e,(function(e){o=e.call(r,o,n.normalize(),t?t.status:void 0)})),n.normalize(),o}function At(e){return!(!e||!e.__CANCEL__)}function Ot(e,t,r){ze.call(this,null==e?"canceled":e,ze.ERR_CANCELED,t,r),this.name="CanceledError"}Ke.inherits(Ot,ze,{__CANCEL__:!0});var It=pt.hasStandardBrowserEnv?{write(e,t,r,i,n,o){const s=[e+"="+encodeURIComponent(t)];Ke.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),Ke.isString(i)&&s.push("path="+i),Ke.isString(n)&&s.push("domain="+n),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function bt(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Ct=pt.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function i(r){let i=r;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(e){const t=Ke.isString(e)?i(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function Nt(e,t){let r=0;const i=function(e,t){e=e||10;const r=new Array(e),i=new Array(e);let n,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),d=i[s];n||(n=c),r[o]=a,i[o]=c;let u=s,l=0;for(;u!==o;)l+=r[u++],u%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-n<t)return;const p=d&&c-d;return p?Math.round(1e3*l/p):void 0}}(50,250);return n=>{const o=n.loaded,s=n.lengthComputable?n.total:void 0,a=o-r,c=i(a);r=o;const d={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:n};d[t?"download":"upload"]=!0,e(d)}}var wt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let i=e.data;const n=yt.from(e.headers).normalize();let o,s,{responseType:a,withXSRFToken:c}=e;function d(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}if(Ke.isFormData(i))if(pt.hasStandardBrowserEnv||pt.hasStandardBrowserWebWorkerEnv)n.setContentType(!1);else if(!1!==(s=n.getContentType())){const[e,...t]=s?s.split(";").map((e=>e.trim())).filter(Boolean):[];n.setContentType([e||"multipart/form-data",...t].join("; "))}let u=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";n.set("Authorization","Basic "+btoa(t+":"+r))}const l=bt(e.baseURL,e.url);function p(){if(!u)return;const i=yt.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(e,t,r){const i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(new ze("Request failed with status code "+r.status,[ze.ERR_BAD_REQUEST,ze.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),d()}),(function(e){r(e),d()}),{data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:i,config:e,request:u}),u=null}if(u.open(e.method.toUpperCase(),nt(l,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=p:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(p)},u.onabort=function(){u&&(r(new ze("Request aborted",ze.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new ze("Network Error",ze.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||st;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new ze(t,i.clarifyTimeoutError?ze.ETIMEDOUT:ze.ECONNABORTED,e,u)),u=null},pt.hasStandardBrowserEnv&&(c&&Ke.isFunction(c)&&(c=c(e)),c||!1!==c&&Ct(l))){const t=e.xsrfHeaderName&&e.xsrfCookieName&&It.read(e.xsrfCookieName);t&&n.set(e.xsrfHeaderName,t)}void 0===i&&n.setContentType(null),"setRequestHeader"in u&&Ke.forEach(n.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),Ke.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),a&&"json"!==a&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",Nt(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",Nt(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{u&&(r(!t||t.type?new Ot(null,e,u):t),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const h=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(l);h&&-1===pt.protocols.indexOf(h)?r(new ze("Unsupported protocol "+h+":",ze.ERR_BAD_REQUEST,e)):u.send(i||null)}))};const Dt={http:null,xhr:wt};Ke.forEach(Dt,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Pt=e=>`- ${e}`,kt=e=>Ke.isFunction(e)||null===e||!1===e;var Lt={getAdapter:e=>{e=Ke.isArray(e)?e:[e];const{length:t}=e;let r,i;const n={};for(let o=0;o<t;o++){let t;if(r=e[o],i=r,!kt(r)&&(i=Dt[(t=String(r)).toLowerCase()],void 0===i))throw new ze(`Unknown adapter '${t}'`);if(i)break;n[t||"#"+o]=i}if(!i){const e=Object.entries(n).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new ze("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Pt).join("\n"):" "+Pt(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i},adapters:Dt};function Mt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ot(null,e)}function Ut(e){Mt(e),e.headers=yt.from(e.headers),e.data=Rt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Lt.getAdapter(e.adapter||Et.adapter)(e).then((function(t){return Mt(e),t.data=Rt.call(e,e.transformResponse,t),t.headers=yt.from(t.headers),t}),(function(t){return At(t)||(Mt(e),t&&t.response&&(t.response.data=Rt.call(e,e.transformResponse,t.response),t.response.headers=yt.from(t.response.headers))),Promise.reject(t)}))}const xt=e=>e instanceof yt?{...e}:e;function Vt(e,t){t=t||{};const r={};function i(e,t,r){return Ke.isPlainObject(e)&&Ke.isPlainObject(t)?Ke.merge.call({caseless:r},e,t):Ke.isPlainObject(t)?Ke.merge({},t):Ke.isArray(t)?t.slice():t}function n(e,t,r){return Ke.isUndefined(t)?Ke.isUndefined(e)?void 0:i(void 0,e,r):i(e,t,r)}function o(e,t){if(!Ke.isUndefined(t))return i(void 0,t)}function s(e,t){return Ke.isUndefined(t)?Ke.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function a(r,n,o){return o in t?i(r,n):o in e?i(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t)=>n(xt(e),xt(t),!0)};return Ke.forEach(Object.keys(Object.assign({},e,t)),(function(i){const o=c[i]||n,s=o(e[i],t[i],i);Ke.isUndefined(s)&&o!==a||(r[i]=s)})),r}const Ft="1.6.8",Bt={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Bt[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const jt={};Bt.transitional=function(e,t,r){function i(e,t){return"[Axios v"+Ft+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,o)=>{if(!1===e)throw new ze(i(n," has been removed"+(t?" in "+t:"")),ze.ERR_DEPRECATED);return t&&!jt[n]&&(jt[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)}};var Wt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new ze("options must be an object",ze.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let n=i.length;for(;n-- >0;){const o=i[n],s=t[o];if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new ze("option "+o+" must be "+r,ze.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new ze("Unknown option "+o,ze.ERR_BAD_OPTION)}},validators:Bt};const Gt=Wt.validators;let Ht=class{constructor(e){this.defaults=e,this.interceptors={request:new ot,response:new ot}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Vt(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:n}=t;void 0!==r&&Wt.assertOptions(r,{silentJSONParsing:Gt.transitional(Gt.boolean),forcedJSONParsing:Gt.transitional(Gt.boolean),clarifyTimeoutError:Gt.transitional(Gt.boolean)},!1),null!=i&&(Ke.isFunction(i)?t.paramsSerializer={serialize:i}:Wt.assertOptions(i,{encode:Gt.function,serialize:Gt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=n&&Ke.merge(n.common,n[t.method]);n&&Ke.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete n[e]})),t.headers=yt.concat(o,n);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let d;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,l=0;if(!a){const e=[Ut.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),u=e.length,d=Promise.resolve(t);l<u;)d=d.then(e[l++],e[l++]);return d}u=s.length;let p=t;for(l=0;l<u;){const e=s[l++],t=s[l++];try{p=e(p)}catch(e){t.call(this,e);break}}try{d=Ut.call(this,p)}catch(e){return Promise.reject(e)}for(l=0,u=c.length;l<u;)d=d.then(c[l++],c[l++]);return d}getUri(e){return nt(bt((e=Vt(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};Ke.forEach(["delete","get","head","options"],(function(e){Ht.prototype[e]=function(t,r){return this.request(Vt(r||{},{method:e,url:t,data:(r||{}).data}))}})),Ke.forEach(["post","put","patch"],(function(e){function t(t){return function(r,i,n){return this.request(Vt(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}Ht.prototype[e]=t(),Ht.prototype[e+"Form"]=t(!0)}));var Kt=Ht;class zt{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 Ot(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)}static source(){let e;return{token:new zt((function(t){e=t})),cancel:e}}}var Yt=zt;const Xt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Xt).forEach((([e,t])=>{Xt[t]=e}));var Jt=Xt;const qt=function e(t){const r=new Kt(t),i=le(Kt.prototype.request,r);return Ke.extend(i,Kt.prototype,r,{allOwnKeys:!0}),Ke.extend(i,r,null,{allOwnKeys:!0}),i.create=function(r){return e(Vt(t,r))},i}(Et);qt.Axios=Kt,qt.CanceledError=Ot,qt.CancelToken=Yt,qt.isCancel=At,qt.VERSION=Ft,qt.toFormData=$e,qt.AxiosError=ze,qt.Cancel=qt.CanceledError,qt.all=function(e){return Promise.all(e)},qt.spread=function(e){return function(t){return e.apply(null,t)}},qt.isAxiosError=function(e){return Ke.isObject(e)&&!0===e.isAxiosError},qt.mergeConfig=Vt,qt.AxiosHeaders=yt,qt.formToJSON=e=>ht(Ke.isHTMLForm(e)?new FormData(e):e),qt.getAdapter=Lt.getAdapter,qt.HttpStatusCode=Jt,qt.default=qt;var Qt=qt;let Zt=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}({}),$t=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 er=new ue;let tr=er.getResult(),rr=null;function ir(e){if(!rr){e&&er.setUA(e),tr=er.getResult();const t=function(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return $t.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return $t.CHROME;case"Safari":case"Mobile Safari":return $t.SAFARI;case"Edge":return $t.EDGE;case"Firefox":return $t.FIREFOX;case"QQ":case"QQBrowser":return $t.QQ;case"Opera":return $t.OPERA;case"WeChat":return $t.WECHAT;default:return e.browser.name||""}}(tr),r=nr(tr),i=function(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}(tr),n=tr.os.version,o=nr(tr,!1),s=tr.device.type;if(!(t&&r&&i&&n))return{name:t,version:r,os:i,osVersion:n,browserVersion:o,deviceType:s};rr={name:t,version:r,os:i,osVersion:n,browserVersion:o,deviceType:s}}return rr}function nr(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 or(){return ir().os}function sr(){const e=ir();return"".concat(e.os," ").concat(e.osVersion)}function ar(){const e=ir();return!!("WebKit"===tr.engine.name&&e.os===Zt.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==$t.SAFARI||pr()&&e.name!==$t.SAFARI)}function cr(){return ir().name===$t.CHROME}function dr(){return ir().name===$t.SAFARI}function ur(){return ir().name===$t.EDGE}function lr(){return ir().name===$t.FIREFOX}function pr(){return ir().os===Zt.IOS}function hr(e){const t=ir();return!(t.name!==$t.CHROME||!t.osVersion)&&Number(t.version)>=e}function fr(e){const t=ir();return!(t.name!==$t.EDGE||!t.osVersion)&&Number(t.version)>=e}function Er(e){const t=ir();return!(t.name!==$t.OPERA||!t.osVersion)&&Number(t.version)>=e}function mr(){const e=ir();if(e.os!==Zt.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function _r(){const e=ir();if(e.os!==Zt.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function Tr(){const e=ir();if(e.os!==Zt.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function gr(){return dr()&&navigator.maxTouchPoints>0}function Sr(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function vr(){const e=or();return function(){const{deviceType:e}=ir();return"mobile"===e||"tablet"===e}()||e===Zt.ANDROID||e===Zt.IOS||e===Zt.HARMONY_OS}function yr(){const e=ir();return e.name!==$t.EDGE&&e.name!==$t.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function Rr(){return or()===Zt.ANDROID}function Ar(){const e=ir();return Rr()&&(e.name===$t.CHROME||e.name===$t.WECHAT||/chrome|chromium/i.test(navigator.userAgent))}function Or(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 Ir(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 br(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ir(Object(r),!0).forEach((function(t){Or(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ir(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let Cr=function(e){return e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",e.TIMEOUT="TIMEOUT",e.INVALID_PARAMS="INVALID_PARAMS",e.NOT_READABLE="NOT_READABLE",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INVALID_OPERATION="INVALID_OPERATION",e.OPERATION_ABORTED="OPERATION_ABORTED",e.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",e.EXCHANGE_SDP_FAILED="EXCHANGE_SDP_FAILED",e.ADD_CANDIDATE_FAILED="ADD_CANDIDATE_FAILED",e.DATACHANNEL_FAILED="DATACHANNEL_FAILED",e.NETWORK_ERROR="NETWORK_ERROR",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",e.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",e.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",e.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",e.ELECTRON_IS_NULL="ELECTRON_IS_NULL",e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",e.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",e.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",e.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",e.PERMISSION_DENIED="PERMISSION_DENIED",e.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",e.TRACK_IS_DISABLED="TRACK_IS_DISABLED",e.GET_VIDEO_ELEMENT_VISIBLE_ERROR="GET_VIDEO_ELEMENT_VISIBLE_ERROR",e.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",e.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",e.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",e.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",e.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",e.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",e.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",e.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",e.UID_CONFLICT="UID_CONFLICT",e.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",e.UPDATE_TICKET_FAILED="UPDATE_TICKET_FAILED",e.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 Nr 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),Or(this,"code",void 0),Or(this,"message",void 0),Or(this,"data",void 0),Or(this,"name","AgoraRTCException"),this.code=e,this.message="AgoraRTCError ".concat(this.code,": ").concat(t),this.data=r}toString(){return this.data?"data: ".concat(JSON.stringify(this.data),"\n").concat(this.stack):"".concat(this.stack)}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 wr(e,t){if("boolean"!=typeof e)throw new Nr(Cr.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function Dr(e,t,r){if(!r.includes(e))throw new Nr(Cr.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(r)))}function Pr(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 Nr(Cr.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(r,", ").concat(i,"]. integer only"))}function kr(e,t){if("number"!=typeof e){if(!(e.min||e.max||e.ideal||e.exact))throw new Nr(Cr.INVALID_PARAMS,"".concat(t," is not a valid ConstrainLong"));void 0!==e.min&&Pr(e.min,"".concat(t,".min"),0,1/0),void 0!==e.max&&Pr(e.max,"".concat(t,".max"),1,1/0),void 0!==e.exact&&Pr(e.exact,"".concat(t,".exact"),1,1/0),void 0!==e.ideal&&Pr(e.ideal,"".concat(t,".ideal"),1,1/0)}else Pr(e,t,1,1/0)}function Lr(e){return null==e}var Mr=function(e){return e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE",e}(Mr||{}),Ur=function(e){return e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT",e}(Ur||{});const xr=new class{constructor(){Or(this,"_clientSize",null),Or(this,"getClientWidth",(()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth)),Or(this,"getClientHeight",(()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight)),Or(this,"getStyle",(e=>window.getComputedStyle(e,null))),Or(this,"checkCssVisibleProperty",(e=>{let t=!0;const r=this.getStyle(e),{display:i,visibility:n,opacity:o,filter:s}=r;return("none"===i||["hidden","collapse"].includes(n)||Number(o)<.1)&&(t=!1),!!t&&(s&&s.split(" ").filter((e=>{const t=e.split("(")[0];return["brightness","blur","opacity"].includes(t)})).map((e=>{const[t,r]=e.split(/\(|\)/);return[t,Number(r.match(/^[0-9\.]+/))]})).forEach((e=>{const[r,i]=e;switch(r){case"brightness":(i<.1||i>3)&&(t=!1);break;case"blur":i>3&&(t=!1);break;case"opacity":i<.1&&(t=!1)}})),t)})),Or(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})),Or(this,"checkActualCssVisibleIncludeInherit",(e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty))),Or(this,"getSizeAboutClient",(e=>{const{width:t,height:r,left:i,right:n,top:o,bottom:s}=e.getBoundingClientRect(),a=this.getClientWidth(),c=this.getClientHeight();return{width:t,height:r,left:i,right:n,top:o,bottom:s,clientWidth:a,clientHeight:c,clientMin:Math.min(a,c)}})),Or(this,"checkActualSize",(()=>{const{width:e,height:t,clientMin:r}=this._clientSize;return this.checkSizeIsVisible(e,t,r)})),Or(this,"elementFromPoint",((e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null)),Or(this,"checkCoverForAPoint",((e,t,r)=>{const i=this.elementFromPoint(e,t);return null!==i&&i!==r})),Or(this,"getPointPositionList",(()=>{const{width:e,height:t,left:r,top:i}=this._clientSize,n=e/6,o=t/6,s=[],a=10**6;for(let e=0;e<5;e++)for(let t=0;t<5;t++){const c=(r*a+(0===e?.1:4===e?(n*e*a-1e5)/a:n*e)*a)/a,d=(i*a+(0===t?.1:4===t?(o*t*a-1e5)/a:o*t)*a)/a;s.push({x:c,y:d})}return[...s]})),Or(this,"checkElementCover",(e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((e=>!!e)).length>6)),Or(this,"checkSizeIsVisible",((e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10))),Or(this,"checkSizeOfPartInClient",(()=>{const{left:e,right:t,top:r,bottom:i,clientHeight:n,clientWidth:o,clientMin:s}=this._clientSize;let a,c,d,u;if(e<0)a=0;else{if(!(e<o))return!1;a=e}if(t<0)return!1;if(c=t<o?t:o,r<0)d=0;else{if(!(r<n))return!1;d=r}if(i<0)return!1;u=i<n?i:n;const l=c-a,p=u-d;return this.checkSizeIsVisible(l,p,s)})),Or(this,"returnHiddenResult",(e=>(this._clientSize=null,{visible:!1,reason:e}))),Or(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(Mr.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(Mr.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(Mr.SIZE)}}return this.returnHiddenResult(Mr.STYLE)}return this.returnHiddenResult(Ur.UNMOUNTED)}return this.returnHiddenResult(Ur.INVALID_HTML_ELEMENT)})),Or(this,"checkElementIsMountedOnDom",(e=>this.checkPropertyUpToAllParentNodes(e,(e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))))}};const Vr=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 Fr{constructor(){Or(this,"_events",{}),Or(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 Br(){return!!Wr()}let jr=null;function Wr(){if(jr)return jr;if(window.electron)return jr=window.electron;if(!window.require)return null;try{return jr=window.require("electron"),jr}catch(e){return null}}let Gr=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}({}),Hr=function(e){return e.TRACER="tracer",e}({});!function(e){e[e.AUDIENCE_LEVEL_LOW_LATENCY=1]="AUDIENCE_LEVEL_LOW_LATENCY",e[e.AUDIENCE_LEVEL_ULTRA_LOW_LATENCY=2]="AUDIENCE_LEVEL_ULTRA_LOW_LATENCY",e[e.AUDIENCE_LEVEL_SYNC_LATENCY=3]="AUDIENCE_LEVEL_SYNC_LATENCY"}({}),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.FALLBACK="FALLBACK",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.LICENSE_MISSING="LICENSE_MISSING",e.LICENSE_EXPIRED="LICENSE_EXPIRED",e.LICENSE_MINUTES_EXCEEDED="LICENSE_MINUTES_EXCEEDED",e.LICENSE_PERIOD_INVALID="LICENSE_PERIOD_INVALID",e.LICENSE_MULTIPLE_SDK_SERVICE="LICENSE_MULTIPLE_SDK_SERVICE",e.LICENSE_ILLEGAL="LICENSE_ILLEGAL",e.TOKEN_EXPIRE="TOKEN_EXPIRE"}({}),function(e){e.CONNECTION_STATE_CHANGE="connection-state-change",e.MEDIA_RECONNECT_START="media-reconnect-start",e.MEDIA_RECONNECT_END="media-reconnect-end",e.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",e.USER_JOINED="user-joined",e.USER_LEAVED="user-left",e.USER_PUBLISHED="user-published",e.USER_UNPUBLISHED="user-unpublished",e.USER_INFO_UPDATED="user-info-updated",e.CLIENT_BANNED="client-banned",e.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",e.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",e.VOLUME_INDICATOR="volume-indicator",e.CRYPT_ERROR="crypt-error",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGED="stream-type-changed",e.STREAM_FALLBACK="stream-fallback",e.RECEIVE_METADATA="receive-metadata",e.STREAM_MESSAGE="stream-message",e.LIVE_STREAMING_ERROR="live-streaming-error",e.LIVE_STREAMING_WARNING="live-streaming-warning",e.EXCEPTION="exception",e.ERROR="error",e.P2P_LOST="p2p_lost",e.JOIN_FALLBACK_TO_PROXY="join-fallback-to-proxy",e.CHANNEL_FALLBACK_TO_WEBSOCKET="channel-fallback-to-websocket",e.MEDIA_CONNECTION_TYPE_CHANGE="media-connection-type-change",e.PUBLISHED_USER_LIST="published-user-list",e.CONTENT_INSPECT_CONNECTION_STATE_CHANGE="content-inspect-connection-state-change",e.CONTENT_INSPECT_ERROR="content-inspect-error",e.CONTENT_INSPECT_RESULT="content-inspect-result",e.IMAGE_MODERATION_CONNECTION_STATE_CHANGE="image-moderation-connection-state-change"}({}),function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.MULTI_IP="MULTI_IP",e.TIMEOUT="TIMEOUT",e.OFFLINE="OFFLINE",e.LEAVE="LEAVE",e.P2P_FAILED="P2P_FAILED",e.FALLBACK="FALLBACK"}({});let Kr=function(e){return e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({}),zr=function(e){return e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({});function Yr(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 Nr(Cr.UNEXPECTED_ERROR,"can not emit promise")):new Promise(((r,n)=>{e.emit(t,...i,r,n)}))}function Xr(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 Yr(e,t,...i)}function Jr(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 Nr(Cr.UNEXPECTED_ERROR,"handler is not sync");return r}(e,t,...i)}const qr=new class extends Fr{set networkState(e){this.emit(zr.NETWORK_STATE_CHANGE,e,this._networkState),e===Kr.ONLINE?this.emit(zr.ONLINE):e===Kr.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(zr.ONLINE,(()=>{this.onlineWaiter=void 0,e(Kr.ONLINE)}))})),this.emit(zr.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}get isOnline(){return this._networkState===Kr.ONLINE}constructor(){super(),Or(this,"_moduleName","network-indicator"),Or(this,"_networkState",Kr.ONLINE),Or(this,"onlineWaiter",void 0),window.addEventListener("online",(()=>{this.networkState=Kr.ONLINE})),window.addEventListener("offline",(()=>{this.networkState=Kr.OFFLINE}))}};function Qr(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function Zr(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function $r(e){return JSON.parse(JSON.stringify(e))}function ei(e){try{return $r(e)}catch(t){return e}}const ti={};function ri(e,t){ti[t]||(ti[t]=!0,e())}function ii(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function ni(e){return new Promise((t=>{window.setTimeout(t,e)}))}function oi(){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)+oi(e-r.length,"")}const si=()=>{},ai=new class{constructor(){Or(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,br(br({},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})}}},ci=ai.throttleByKey.bind(ai);function di(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function ui(e,t){if(!di(e)||!di(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]=ui(e[i],t[i]);return r}{const r=br({},e);for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?r[i]=ui(e[i],t[i]):r[i]=t[i]);return r}}function li(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}let pi=1,hi=console;class fi{static setLogger(e){hi=e}constructor(e){Or(this,"lockingPromise",Promise.resolve()),Or(this,"locks",0),Or(this,"name",""),Or(this,"lockId",void 0),this.lockId=pi++,e&&(this.name=e),hi.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}get isLocked(){return this.locks>0}lock(e){let t;this.locks+=1,hi.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is locked, current queue ").concat(this.locks,". ").concat("string"==typeof e?e:""));const r=new Promise((r=>{t=()=>{this.locks-=1,hi.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is not locked, current queue ").concat(this.locks,". ").concat("string"==typeof e?e:"")),r()}})),i=this.lockingPromise.then((()=>t));return this.lockingPromise=this.lockingPromise.then((()=>r)),i}}function Ei(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 mi={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function _i(e,t,r,i){const n=Object.assign({},mi,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 Nr(Cr.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 Ti=0,gi=0;function Si(e,t,r,i){return new Promise(((n,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),Ti+=ii(t.data)):r&&(t.data.size?Ti+=t.data.size:t.data instanceof FormData?Ti+=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?ii(e):e.size})),t+138}(t.data):Ti+=ii(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,Qt.request(t).then((e=>{"string"==typeof e.data?gi+=ii(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?gi+=e.data.byteLength:gi+=ii(JSON.stringify(e.data)),i&&n({data:e.data,headers:e.headers}),n(e.data)})).catch((e=>{Qt.isCancel(e)?o(new Nr(Cr.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?o(new Nr(Cr.NETWORK_TIMEOUT,e.message)):e.response?o(new Nr(Cr.NETWORK_RESPONSE_ERROR,e.response.status)):o(new Nr(Cr.NETWORK_ERROR,e.message))}))}))}async function vi(e,t){const r=new Blob([t.data],{type:"buffer"});return await Si(e,br(br({},t),{},{data:r,headers:{"Content-Type":"application/octet-stream"}}),!0)}const yi=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-alpha\.([0-9]+)/);if(t&&t[1]&&t[2]){const e=t[1],r=t[2];return"".concat(e,".").concat(r)}const r=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-special\.([0-9]+)/);if(r&&r[1]&&r[2]){const e=r[1],t=r[2];return"".concat(e,".").concat(100*(Number(t)+1))}return"4.0.0.999"}("4.22.0"),Ri=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 Ai=br(br({PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",ENABLE_EVENT_REPORT:!0,GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,UPLOAD_LOG:!1,NOT_REPORT_EVENT:[],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,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",TURN_DOMAIN:"edge.agora.io",EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,GET_VOLUME_OF_MUTED_AUDIO_TRACK:!1,STATS_UPDATE_INTERVAL:250,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,PRELOAD_MEDIA_COUNT:0,CHECK_VIDEO_VISIBLE_INTERVAL:3e4,CHECK_LOCAL_STATS_INTERVAL:250,PROFILE_SWITCH_INTERVAL:2e3,UNSUPPORTED_VIDEO_CODEC:[],ENUMERATE_DEVICES_INTERVAL:!1,ENUMERATE_DEVICES_INTERVAL_TIME:1e4,USE_NEW_TOKEN:!1,CLOSE_AFB_FOR_LOCAL_AP:!0,JOIN_MAX_CONCURRENCY:6,JOIN_WITH_FALLBACK_SIGNAL_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE:!1,JOIN_GATEWAY_TRY_443PORT_DURATION:2e3,JOIN_GATEWAY_USE_443PORT_ONLY:!1,JOIN_GATEWAY_USE_DUAL_DOMAIN:!0,JOIN_GATEWAY_FALLBACK_PORT:443,USE_TURN_SERVER_OF_GATEWAY:!1,H264_PROFILE_LEVEL_ID:"",USE_NEW_LOG:!1,LOG_VERSION:3,MEDIA_DEVICE_CONSTRAINTS:null,ENCRYPT_PROXY_USERNAME_AND_PSW:!0,SDP_LOGGING:!1,CSP_DETECTED_HOSTNAME_LIST:["agora.io","sd-rtn.com"],REMOTE_AUDIO_TRACK_USES_WEB_AUDIO:!1,LOCAL_AUDIO_TRACK_USES_WEB_AUDIO:!1,BITRATE_ADAPTER_TYPE:"STANDARD_BITRATE",AI_DENOISER_PARAMETERS:{excludedLinks:[]},ADJUST_3A_FROM_PLUGINS:!0,RAISE_H264_BASELINE_PRIORITY:!0,FILTER_SEND_H264_BASELINE:!1,X_GOOGLE_START_BITRATE:void 0,NEW_REPORT_SERVER:!1,NEW_REPORT_SERVER_DOMAINS:["data-reporting.agora.io","data-reporting.agora.io"],VIDEO_INSPECT_WORKER_MESSAGE_LENGTH_LIMIT:3e5,VIDEO_INSPECT_INTERVAL_MINIMUM:1e3,VIDEO_INSPECT_QUALITY_RATIO:.9,VIDEO_INSPECT_WORKER_MANAGER_HOST:"edge.agora.io",VIDEO_INSPECT_WORKER_MANAGER_PORT:"",VIDEO_INSPECT_WORKER_PORT:"",SHOW_VIDEO_INSPECT_WORKER_MESSAGE:!1,STATS_COLLECTOR_PORT:443,FORCE_TURN_TCP:!1,WEBAUDIO_INIT_OPTIONS:void 0,FILTER_VIDEO_FEC:!0,FILTER_AUDIO_FEC:!1,CHROME_DUAL_STREAM_USE_ENCODING:!0,DISABLE_DUAL_STREAM_USE_ENCODING:!1,EXTENSION_USAGE_UPLOAD_INTERVAL:1e4,ICE_RESTART:!0,ICE_RESTART_INTERVAL:1e4,NEW_ICE_RESTART:!1,TRANSMITTER_INITIAL_RTT:30,TRANSMITTER_INITIAL_RTO:30,TRANSMITTER_MAX_BATCH_ACK_COUNT:2,TRANSMITTER_MAX_RTO:500,DATACHANNEL_COMPRESS:!1,FINGERPRINT:null,DC_JOIN_WITH_FAILBACK:5e3,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,AP_AREA:!0,ENABLE_ENCODED_TRANSFORM:!1,ENABLE_VIDEO_SEI:!1,IMAGE_MODERATION_WORKER_HOST:"edge.agora.io",IMAGE_MODERATION_WORKER_MESSAGE_LENGTH_LIMIT:3e5,IMAGE_MODERATION_INTERVAL_MINIMUM:1e3,SHOW_IMAGE_MODERATION_WORKER_MESSAGE:!1,IMAGE_MODERATION_QUALITY_RATIO:.9,IMAGE_MODERATION_UPLOAD_REPORT_INTERVAL:5e3,SHOW_GLOBAL_CLIENT_LIST:!1,DATASTREAM_MAX_RETRANSMITS:10,TCP_CANDIDATE_ONLY:!1,EXTERNAL_SIGNAL_REQUEST_TIMEOUT:3e3,SHOW_P2P_LOG:!1,MAX_P2P_TIMEOUT:3e4,P2P_TOKEN_INTERVAL:1e3,SHOW_DATASTREAM2_LOG:!1,RESTRICTION_SET_PLAYBACK_DEVICE:!0,USE_PURE_ENCRYPTION_MASTER_KEY:!1,ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,FILEPATH_LENMAX:255,DUALSTREAM_OPERATION_CHECK:!0,MEDIA_ELEMENT_EXISTS_DEPTH:3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,STATS_FILTER:{transportId:!0,googTrackId:!0},FILTER_VIDEO_CODEC:[],USE_NEW_NETWORK_CONFIG:!1,AUTO_RESET_AUDIO_ROUTE:!1,PLUGIN_INFO:[],OVERUSE_DETECTOR_PARAMS:{MIN_FRAME_RATE:1,MAX_FRAME_RATE:30,MAX_THRESHOLD_FRAMERATE:30,BITRATE_MIN_THRESHOLD:100,BITRATE_MAX_THRESHOLD:100,MAX_SCALE:5,BWE_SCALE_UP_THRESHOLD:.6,BWE_SCALE_DOWN_THRESHOLD:.6,PERF_SCALE_UP_THRESHOLD:.7,PERF_SCALE_DOWN_THRESHOLD:.6,MOTION_RESOLUTION_FACTOR:.8,MOTION_BITRATE_FACTOR:.6,DETAIL_FRAMERATE_FACTOR:.8,DETAIL_BITRATE_FACTOR:.6,BALANCE_RESOLUTION_FACTOR:.9,BALANCE_FRAMERATE_FACTOR:.9,BALANCE_BITRATE_FACTOR:.6,OVERUSE_TIMES_THRESHOLD:10,UNDERUSE_TIMES_THRESHOLD:40},ENABLE_AG_ADAPTATION:!0,FORCE_AG_HIGH_FRAMERATE:!1,FORCE_SUPPORT_AG_ADAPTATION:!1,CUSTOM_ADAPTATION_DEFAULT_MODE:"",ENCODER_CONFIG_LIMIT:{},CAMERA_CAPTURE_CONFIG:void 0,HIDE_NO_POSTER:!1,AP_CACHE_NUM:10,AP_UPDATE_INTERVAL:12e4,AP_CACHE_LIFETIME:12e4,MAX_PRELOAD_ASYNC_LENGTH:3,ENABLE_PRELOAD:!0},{ENABLE_PUBLISHED_USER_LIST:!0,MAX_SUBSCRIPTION:50,SUBSCRIBE_AUDIO_FILTER_TOPN:void 0,ENABLE_PUBLISH_AUDIO_FILTER:void 0,ENABLE_USER_LICENSE_CHECK:!0,USE_PUB_RTX:!0,USE_SUB_RTX:!0,DISABLE_FEC:void 0,ENABLE_NTP_REPORT:!1,ENABLE_INSTANT_VIDEO:!1,ENABLE_DATASTREAM_2:!1,ENABLE_USER_AUTO_REBALANCE_CHECK:!0,USE_XR:!0,ENABLE_LOSSBASED_BWE:!0,ENABLE_AUT_CC:!1,ENABLE_CC_FALLBACK:void 0,ENABLE_PREALLOC_PC:!1,SUBSCRIBE_TWCC:!0,PUBLISH_TWCC:!1,ENABLE_SVC:!1,ENABLE_SVC_DEFAULT_CODECS:["H264","VP8","VP9","AV1"],SVC:[],ENABLE_FULL_LINK_AV_SYNC:!1,SVC_MODE:null,PRE_SUB_NUM:2,ENABLE_PRE_SUB:!1,ENABLE_AUT_FEEDBACK:!1}),{},{USE_CANDIDATE_FROM_AP_DETAIL:!1});function Oi(e,t,r){var i;Object.keys(Ai).includes(e)&&(!r&&Object.keys(bi).includes(e)||(Ai[e]=t,"ENABLE_VIDEO_SEI"===e&&!0===t&&(Ai.ENABLE_ENCODED_TRANSFORM=!0),"USE_NEW_NETWORK_CONFIG"===e&&t&&(i=!!t,Ai.USE_NEW_NETWORK_CONFIG=i,i&&(Ai.WEBCS_DOMAIN=["webrtc2-2.ap.sd-rtn.com"],Ai.WEBCS_DOMAIN_BACKUP_LIST=["webrtc2-4.ap.sd-rtn.com"],Ai.CDS_AP=["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],Ai.ACCOUNT_REGISTER=["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],Ai.EVENT_REPORT_DOMAIN="web-2.statscollector.sd-rtn.com",Ai.EVENT_REPORT_BACKUP_DOMAIN="statscollector-1.agora.io",Ai.GATEWAY_DOMAINS=["edge.sd-rtn.com"])),"ENABLE_PRE_SUB"===e&&t&&(Ai.ENABLE_INSTANT_VIDEO=!0,Ai.ENABLE_PREALLOC_PC=!0),"ENABLE_SVC"===e&&t&&(Ai.ENABLE_AUT_CC=!0)))}function Ii(e){return Ai[e]}const bi={};var Ci=function(e){return e.SET_SESSION_ID="SET_SESSION_ID",e.SET_P2P_ID="SET_P2P_id",e.SET_DC_ID="SET_DC_id",e.SET_UID="SET_UID",e.SET_INT_UID="SET_INT_UID",e.SET_PUB_ID="SET_PUB_ID",e.SET_CLOUD_PROXY_SERVER_MODE="SET_CLOUD_PROXY_SERVER_MODE",e.KEY_METRIC_CLIENT_CREATED="KEY_METRIC_CLIENT_CREATED",e.KEY_METRIC_JOIN_START="KEY_METRIC_JOIN_START",e.AVOID_JOIN_START="AVOID_JOIN_START",e.KEY_METRIC_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_DESCRIPTION_START="KEY_METRIC_DESCRIPTION_START",e.KEY_METRIC_ICE_CONNECTION_END="KEY_METRIC_ICE_CONNECTION_END",e.KEY_METRIC_SIGNAL_CHANNEL_OPEN="KEY_METRIC_SIGNAL_CHANNEL_OPEN",e.KEY_METRIC_PUBLISH="KEY_METRIC_PUBLISH",e.KEY_METRIC_SUBSCRIBE="KEY_METRIC_SUBSCRIBE",e.RECORD_JOIN_CHANNEL_SERVICE="RECORD_JOIN_CHANNEL_SERVICE",e.RESET_JOIN_CHANNEL_SERVICE_RECORDS="RESET_JOIN_CHANNEL_SERVICE_RECORDS",e.RESET_KEY_METRICS="RESET_KEY_METRICS",e.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE",e}(Ci||{});function Ni(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 wi(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?wi(Object(r),!0).forEach((function(t){Ni(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(e){e.h264="h264",e.h265="h265",e.vp8="vp8",e.vp9="vp9",e.av1="av1"}({}),function(e){e.opus="opus",e.pcma="pcma",e.pcmu="pcmu",e.g722="g722"}({});const Pi=new class extends Fr{constructor(){super(...arguments),Ni(this,"currentUploadLogID",0)}reportLogUploadError(e){const{errorRange:t}=e;t[t.length-1]&&t[t.length-1]>this.currentUploadLogID&&(this.currentUploadLogID=t[t.length-1],this.emit("REPORT_LOG_UPLOAD",e))}};class ki{constructor(e){Ni(this,"logger",void 0),Ni(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 Mi(){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 Ui={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},xi=Date.now(),Vi=e=>{for(const t in Ui)if(Object.prototype.hasOwnProperty.call(Ui,t)&&Ui[t]===e)return t;return"DEFAULT"};const Fi=new class{constructor(){Ni(this,"proxyServerURL",void 0),Ni(this,"logLevel",Ui.DEBUG),Ni(this,"uploadState","collecting"),Ni(this,"uploadLogWaitingList",[]),Ni(this,"uploadLogUploadingList",[]),Ni(this,"uploadErrorCount",0),Ni(this,"currentLogID",0),Ni(this,"url",void 0),Ni(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=[Ui.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=[Ui.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=[Ui.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=[Ui.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=[Ui.DEBUG].concat(t);this.uploadLog.apply(this,i)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){Oi("UPLOAD_LOG",!0)}disableLogUpload(){Oi("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new ki(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()-xi<100)return void setTimeout((()=>{this.log(...t)}),Date.now()-xi);const i=Math.max(0,Math.min(4,t[0]));if(t[0]=Li()+" Agora-SDK [".concat(Vi(i),"]:"),this.appendLogToWaitingList(i,...t),i<this.logLevel)return;const n=Li()+" %cAgora-SDK [".concat(Vi(i),"]:");let o=[];if(!Ii("USE_NEW_LOG"))switch(i){case Ui.DEBUG:o=[n,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case Ui.INFO:o=[n,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case Ui.WARNING:o=[n,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case Ui.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()-xi<100)return void setTimeout((()=>{this.uploadLog(...t)}),Date.now()-xi);const i=Math.max(0,Math.min(4,t[0]));t[0]=Li()+" Agora-SDK [".concat(Vi(i),"]:"),this.appendLogToWaitingList(i,...t)}appendLogToWaitingList(e){if(!Ii("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]=Mi()+" Agora-SDK [".concat(Vi(e),"]:"):r[0]=Mi()+" Agora-SDK [".concat(Vi(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:yi,process_id:Ii("PROCESS_ID"),payload:JSON.stringify(e)};return _i((async()=>{const e=await Qt.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(Ii("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(Ii("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),Pi.reportLogUploadError(r),!0}),{timeout:Ii("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:Ii("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,Ii("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),Ii("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),Ii("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),Ii("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}};var Bi;(Bi={}).FREE="free",Bi.UPLOADING="uploading",function(e){e[e.MISC=0]="MISC",e[e.INTERNAL_EVENT=1]="INTERNAL_EVENT",e[e.PUBLIC_EVENT=2]="PUBLIC_EVENT",e[e.WEB_EVENT=3]="WEB_EVENT",e[e.INTERNAL_API=4]="INTERNAL_API",e[e.WEB_API=5]="WEB_API",e[e.PUBLIC_API=6]="PUBLIC_API"}({});const ji={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let Wi=function(e){return e.PUBLISH="publish",e.SUBSCRIBE="subscribe",e.WS_COMPRESSOR_INIT="ws_compressor_init",e.SESSION_INIT="session_init",e.JOIN_CHOOSE_SERVER="join_choose_server",e.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics",e.PC_STATS="pc_stats",e.UPDATE_REMOTE_RTPCAPABILITIES="update_remote_rtpCapabilities",e}({}),Gi=function(e){return e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_GATEWAY="io.agora.pb.Wrtc.JoinGateway",e.RE_JOIN_GATEWAY="io.agora.pb.Wrtc.ReJoinGateway",e.PUBLISH="io.agora.pb.Wrtc.Publish",e.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",e.WS_COMPRESSOR_INIT="io.agora.pb.Wrtc.WsCompressorInit",e.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",e.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",e.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",e.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",e.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",e.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",e.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",e.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",e.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",e.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",e.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",e.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",e.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",e.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",e.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",e.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",e.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",e.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",e.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",e.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",e.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics",e.AUTOPLAY_FAILED="io.agora.pb.Wrtc.AutoplayFailed",e.PC_STATS="io.agora.pb.Wrtc.PCStats",e.UPDATE_REMOTE_RTPCAPABILITIES="io.agora.pb.Wrtc.UpdateRemoteRTPCapabilities",e}({});!function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}({});let Hi=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}({});class Ki{constructor(){Ni(this,"baseInfoMap",new Map),Ni(this,"proxyServer",void 0),Ni(this,"eventUploadTimer",void 0),Ni(this,"setSessionIdTimer",void 0),Ni(this,"url",void 0),Ni(this,"backupUrl",void 0),Ni(this,"_appId",void 0),Ni(this,"keyEventUploadPendingItems",[]),Ni(this,"normalEventUploadPendingItems",[]),Ni(this,"apiInvokeUploadPendingItems",[]),Ni(this,"apiInvokeCount",0),Ni(this,"ltsList",[]),Ni(this,"lastSendNormalEventTime",Date.now()),Ni(this,"customReportCounterTimer",void 0),Ni(this,"customReportCount",0),Ni(this,"extApiInvoke",(async e=>{for(const t of e){const e=Di(Di({},t),{},{sid:null,invokeId:++this.apiInvokeCount,tag:Hr.TRACER});this.sendApiInvoke(e)}})),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),Ii("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),Ii("EVENT_REPORT_SEND_INTERVAL"))}getBaseInfoBySessionId(e){return this.baseInfoMap.get(e)}adjustSessionStartTime(e){if(!this.baseInfoMap.has(e)&&!this.baseInfoMap.get(e))return void Fi.error("adjust session ".concat(e," start time, sid is not exist or info is undefined"));const t=this.baseInfoMap.get(e),r=Date.now(),i=t.startTime;t.startTime=r,Fi.debug("rewrite session ".concat(e," startTime: ").concat(r," , ").concat(r-i,"ms")),this.baseInfoMap.set(e,t)}setAppId(e){this._appId=e}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=()=>({tag:t.tag,invokeId:n,sid:e,name:t.name,apiInvokeTime:i,options:t.options,states:t.states||null}),s=!!Ii("SHOW_REPORT_INVOKER_LOG");s&&Fi.info("".concat(t.name," start"),t.options);let a=!1;ni(t.timeout).then((()=>{a||(this.sendApiInvoke(Di(Di({},o()),{},{error:Cr.API_INVOKE_TIMEOUT,success:!1})),Fi.debug("".concat(t.name," timeout")))}));const c=new Nr(Cr.UNEXPECTED_ERROR,"".concat(t.name,": this api invoke is end"));return{onSuccess:e=>{const i=()=>{if(a)throw c;return a=!0,this.sendApiInvoke(Di(Di({},o()),{},{success:!0},t.reportResult&&{result:e})),s&&Fi.info("".concat(t.name," onSuccess")),e};return r?ci(i,t.name+"Success",r,(()=>a=!0)):i()},onError:e=>{const i=()=>{if(a)throw e;a=!0,this.sendApiInvoke(Di(Di({},o()),{},{success:!1,error:e})),s&&Fi.info("".concat(t.name," onFailure"),e.toString())};return r?ci(i,t.name+"Error",r,(()=>a=!0)):i()}}}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),i=this.createBaseInfo(e,r);i.cname=t.cname;const n=Object.assign({},{willUploadConsoleLog:Ii("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:Ri?"global":"oversea",areas:Ii("AREAS")&&Ii("AREAS").join(",")},t.extend),{stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientRole:u}=t,l=Date.now(),p=Di(Di({},i),{},{eventType:Wi.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,buildFormat:t.buildFormat,build:"v4.22.0-0-g8569241d-dirty(8/15/2024, 7:04:06 PM)",lts:l,elapse:l-r,extend:JSON.stringify(n),mode:t.mode,process:Ii("PROCESS_ID"),appType:Ii("APP_TYPE"),success:!0,version:yi,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientType:window.navigator.userAgent.includes("AgoraWebView")?42:20,clientRole:u,serviceId:Ii("PROCESS_ID"),extensionID:Ii("PLUGIN_INFO").join(",")||""});this.send({type:Gi.SESSION,data:p},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=Di(Di({},i),{},{eventType:Wi.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});this.send({type:Gi.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=Di(Di({},i),{},{eventType:Wi.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:Gi.REQ_USER_ACCOUNT,data:o},!0)}joinGateway(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info;t.vid&&(i.vid=t.vid),i.uid=t.uid,i.cid=t.cid;const n=Date.now(),{firstSuccess:o,avoidJoinStartTime:s}=t,a=n-(o&&s?s:r.startTime),c=Di(Di({},i),{},{eventType:Wi.JOIN_GATEWAY,lts:n,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,errorMsg:t.errorMsg||"",elapse:a,eventElapse:n-t.lts,firstSuccess:o,signalChannel:t.signalChannel,preload:t.preload?1:0});t.succ&&(r.lastJoinSuccessTime=n),this.send({type:Gi.JOIN_GATEWAY,data:c},!0)}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=Date.now(),n=Di(Di({},r.info),{},{lts:i,timeout:t,elapse:i-r.startTime});this.send({type:Gi.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=Di(Di({},i),{},{eventType:Wi.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:Gi.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=Di(Di({},n),{},{eventType:Wi.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:Gi.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=Di(Di({},n),{},{eventType:Wi.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-i.startTime,status:e.status?1:2});this.send({type:Gi.WS_COMPRESSOR_INIT,data:s},!0)}firstRemoteVideoDecode(e,t,r,i){const n=this.baseInfoMap.get(e);if(!n)return;const o=n.info,s=Date.now(),a=Di(Di(Di({},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=Di(Di(Di({},o),i),{},{elapse:s-n.startTime,eventType:t,lts:s});this.send({type:r,data:a},!0)}pcStats(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=Di(Di(Di({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),elapse:n-r.startTime,eventType:Wi.PC_STATS,lts:n,preallocation:t.preallocation?1:0});this.send({type:Gi.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=Di(Di(Di({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),eventType:Wi.UPDATE_REMOTE_RTPCAPABILITIES,lts:n});this.send({type:Gi.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=Di(Di(Di({},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=Di(Di({},i),{},{eventType:Wi.STREAM_SWITCH,lts:n,isDual:t.isdual,elapse:n-r.startTime,success:t.succ});this.send({type:Gi.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=Di(Di({},i),{},{eventType:Wi.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:Gi.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=Di(Di({},i),{},{eventType:Wi.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:Gi.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?Fi.debug("reportProxyServerurl: ".concat(e)):Fi.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=Di(Di({},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:Gi.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=ii(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]=br(br({},e),{},{[t]:i.substring(o,c)}),o=c,a=i.charCodeAt(c)<=127?1:3);return o!==i.length-1&&(s[s.length]=br(br({},e),{},{[t]:i.substring(o)})),s})(Di(Di(Di({},i),t),{},{elapse:n-r.startTime,lts:n,productType:"WebRTC"}),"payload",1300).forEach((e=>this.send({type:Gi.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=Di(Di(Di({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:Gi.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=Di(Di(Di({},i),t),{},{elapse:n-r.startTime,lts:n,extend:t.extend||void 0});this.send({type:Gi.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=Di(Di(Di({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:Gi.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>Ii("CUSTOM_REPORT_LIMIT"))throw new Nr(Cr.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((()=>{this.customReportCount=0}),5e3));const r=Date.now(),i=t.map((t=>({type:Gi.USER_ANALYTICS,data:Di(Di({sid:e},t),{},{lts:r})})));try{Ii("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(i):await this.postDataToStatsCollector(i)}catch(e){throw Fi.error("send custom report message failed",e.toString()),new Nr(Cr.CUSTOM_REPORT_SEND_FAILED,e.message)}}sendApiInvoke(e){const t=Ii("NOT_REPORT_EVENT");if(e.tag&&t.includes&&t.includes(e.tag))return!1;if(null===e.sid)return this.apiInvokeUploadPendingItems.push(e),!1;const r=this.baseInfoMap.get(e.sid);if(!r)return this.apiInvokeUploadPendingItems.push(e),!1;const{cname:i,uid:n,cid:o}=r.info;let s;if(e.lts=e.lts||Date.now(),e.error)if(e.error instanceof Nr){const{code:t,message:r}=e.error;s=t||r||e.error.toString()}else s=e.error.toString();const a={invokeId:e.invokeId,sid:e.sid,cname:i,cid:o,uid:n,lts:e.lts,success:e.success,elapse:e.lts-r.startTime,execElapse:e.lts-e.apiInvokeTime,apiName:e.name,options:e.options?JSON.stringify(e.options):void 0,execStates:e.states?JSON.stringify(e.states):void 0,execResult:e.result?JSON.stringify(e.result):void 0,errorCode:e.error?s:void 0,errorMsg:e.error?JSON.stringify(e.error):void 0};return this.send({type:Gi.API_INVOKE,data:a},!1),!0}appendSessionId(){Ki.__CLIENT_LIST__.forEach((e=>{if(e._sessionId){const t=this.apiInvokeUploadPendingItems.length;for(let r=0;r<t;r++){const t=this.apiInvokeUploadPendingItems.shift();t&&(t.sid=e._sessionId,this.sendApiInvoke(Object.assign({},t)))}}}))}send(e,t){if(t)return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0);this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>Ii("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()),Ii("ENABLE_EVENT_REPORT")?(r.length&&(Ii("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{Ii("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>Ii("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-Ii("NORMAL_EVENT_QUEUE_CAPACITY")),Fi.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){qr.networkState===Kr.OFFLINE&&await Promise.race([qr.onlineWaiter,ni(2*mi.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(Gi).forEach((r=>{let[i,n]=r;n===e.type&&(t=Hi[i])})),t})(e),o=new DataView(i);o.setUint16(0,r.byteLength,!0),o.setUint8(2,255&n),o.setUint8(3,n>>>8&255),o.setUint8(4,n>>>16&255),t=Vr(t,new Uint8Array(i)),t=Vr(t,r)})),t},r="event";let i=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(Ii("NEW_REPORT_SERVER_DOMAINS")[0],"&p=443&d=").concat(r):"https://".concat(Ii("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(Ii("NEW_REPORT_SERVER_DOMAINS")[1],"&p=443&d=").concat(r):"https://".concat(Ii("NEW_REPORT_SERVER_DOMAINS")[1],"/").concat(r));try{await Si(i,{timeout:1e4,data:t(e),headers:Di(Di({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={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:e.map((e=>JSON.stringify(e))),vid:(e=>{const t=e&&e.data.sid&&this.baseInfoMap.get(e.data.sid);return t&&t.info.vid&&+t.info.vid||0})(e[0])};qr.networkState===Kr.OFFLINE&&await Promise.race([qr.onlineWaiter,ni(2*mi.maxRetryTimeout)]);const i=t?"/events/proto-raws":"/events/messages";let n=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(Ii("EVENT_REPORT_DOMAIN"),"&p=").concat(Ii("STATS_COLLECTOR_PORT"),"&d=").concat(i):"https://".concat(Ii("EVENT_REPORT_DOMAIN"),":").concat(Ii("STATS_COLLECTOR_PORT")).concat(i));for(let e=0;e<2;e+=1){1===e&&(n=this.backupUrl||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(Ii("EVENT_REPORT_BACKUP_DOMAIN"),"&p=").concat(Ii("STATS_COLLECTOR_PORT"),"&d=").concat(i):"https://".concat(Ii("EVENT_REPORT_BACKUP_DOMAIN"),":").concat(Ii("STATS_COLLECTOR_PORT")).concat(i)));try{t?await vi(n,{timeout:1e4,data:r}):await Si(n,{timeout:1e4,data:r})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},ji);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:Hr.TRACER}).onSuccess()}}function zi(){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=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];let a=i;if(e.argsMap)try{a=e.argsMap(this,...i)}catch(e){Fi.warning(e),a=[]}try{JSON.stringify(a)}catch(e){Fi.warning("arguments for method ".concat(o,".").concat(String(r)," not serializable for apiInvoke.")),a=[]}const c=(e.report||Yi).reportApiInvoke(this._sessionId||null,{name:"".concat(o,".").concat(String(r)),options:a,tag:Hr.TRACER,reportResult:e.reportResult},e.throttleTime);try{const t=n.apply(this,i);return t instanceof Promise?t.then((t=>(c.onSuccess(e.reportResult&&t),t))).catch((e=>{throw c.onError(e),e})):(c.onSuccess(e.reportResult&&t),t)}catch(e){throw c.onError(e),e}}}return i}}Ni(Ki,"__CLIENT_LIST__",[]);const Yi=new Ki;Pi.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=qr.networkState,Yi.reportApiInvoke(null,{name:"logUploadError",options:e,tag:Hr.TRACER}).onSuccess("logUploadError")}));const Xi={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1,supportDataChannel:!1,supportPCSetConfiguration:!1,supportWebRTCEncodedTransform:!1,supportWebRTCInsertableStream:!1,supportRequestVideoFrameCallback:!1,supportWebCrypto:!1};function Ji(){const e=ir();Xi.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),Xi.getStreamFromExtension=e.name===$t.CHROME&&Number(e.version)>34,Xi.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}(),Xi.supportMinBitrate=e.name===$t.CHROME||e.name===$t.EDGE,Xi.supportSetRtpSenderParameters=function(){const e=ir();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!yr()||(!(!dr()&&!ar())||e.name===$t.FIREFOX&&Number(e.version)>=64)}(),e.name===$t.SAFARI&&(Number(e.version)>=14?Xi.supportDualStream=!0:Xi.supportDualStream=!1),Xi.webAudioMediaStreamDest=function(){const e=ir();if(e.name===$t.SAFARI&&Number(e.version)<12)return!1;return!0}(),Xi.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),Xi.supportWebGL="undefined"!=typeof WebGLRenderingContext,Xi.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,yr()||(Xi.webAudioWithAEC=!0),Xi.supportShareAudio=function(){const e=ir();if((e.os===Zt.WIN_10||e.os===Zt.WIN_81||e.os===Zt.WIN_7||e.os===Zt.LINUX||e.os===Zt.MAC_OS||e.os===Zt.CHROMIUM_OS)&&e.name===$t.CHROME&&Number(e.version)>=74)return!0;return!1}(),Xi.supportDataChannel=function(){if(hr(76)||function(e){const t=ir();return!(t.name!==$t.FIREFOX||!t.osVersion)&&Number(t.version)>=e}(68)||function(e){const t=ir();return!(t.name!==$t.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),Xi.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!lr()&&!!e&&e.prototype.setConfiguration instanceof Function}(),Xi.supportWebRTCEncodedTransform=function(){const e=ir();return"Chrome"===e.name&&Number(e.version)>=86||"Safari"===e.name&&Number(e.version)>=15}(),Xi.supportWebRTCInsertableStream=function(){const e=ir();return(e.name===$t.CHROME||e.name===$t.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),Xi.supportRequestVideoFrameCallback=function(){if("requestVideoFrameCallback"in HTMLVideoElement.prototype)return!0;return!1}(),Xi.supportWebCrypto="undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle,Zr((()=>{Xi.supportDualStreamEncoding=function(){const e=ir();if(Ii("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&Ii("CHROME_DUAL_STREAM_USE_ENCODING"))}(),Fi.info("browser compatibility",JSON.stringify(Xi),JSON.stringify(e))}))}function qi(){return Xi}function Qi(){return"setSinkId"in HTMLAudioElement.prototype&&(!Ii("RESTRICTION_SET_PLAYBACK_DEVICE")||(cr()||ur())&&!vr())}let Zi=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 $i=function(e){try{return!!e()}catch(e){return!0}},en=!$i((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),tn=en,rn=Function.prototype,nn=rn.call,on=tn&&rn.bind.bind(nn,nn),sn=tn?on:function(e){return function(){return nn.apply(e,arguments)}},an=sn({}.isPrototypeOf),cn=function(e){return e&&e.Math==Math&&e},dn=cn("object"==typeof globalThis&&globalThis)||cn("object"==typeof window&&window)||cn("object"==typeof self&&self)||cn("object"==typeof X&&X)||function(){return this}()||X||Function("return this")(),un=en,ln=Function.prototype,pn=ln.apply,hn=ln.call,fn="object"==typeof Reflect&&Reflect.apply||(un?hn.bind(pn):function(){return hn.apply(pn,arguments)}),En=sn,mn=En({}.toString),_n=En("".slice),Tn=function(e){return _n(mn(e),8,-1)},gn=Tn,Sn=sn,vn=function(e){if("Function"===gn(e))return Sn(e)},yn="object"==typeof document&&document.all,Rn={all:yn,IS_HTMLDDA:void 0===yn&&void 0!==yn},An=Rn.all,On=Rn.IS_HTMLDDA?function(e){return"function"==typeof e||e===An}:function(e){return"function"==typeof e},In={},bn=!$i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Cn=en,Nn=Function.prototype.call,wn=Cn?Nn.bind(Nn):function(){return Nn.apply(Nn,arguments)},Dn={},Pn={}.propertyIsEnumerable,kn=Object.getOwnPropertyDescriptor,Ln=kn&&!Pn.call({1:2},1);Dn.f=Ln?function(e){var t=kn(this,e);return!!t&&t.enumerable}:Pn;var Mn,Un,xn=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Vn=$i,Fn=Tn,Bn=Object,jn=sn("".split),Wn=Vn((function(){return!Bn("z").propertyIsEnumerable(0)}))?function(e){return"String"==Fn(e)?jn(e,""):Bn(e)}:Bn,Gn=function(e){return null==e},Hn=Gn,Kn=TypeError,zn=function(e){if(Hn(e))throw Kn("Can't call method on "+e);return e},Yn=Wn,Xn=zn,Jn=function(e){return Yn(Xn(e))},qn=On,Qn=Rn.all,Zn=Rn.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:qn(e)||e===Qn}:function(e){return"object"==typeof e?null!==e:qn(e)},$n={},eo=$n,to=dn,ro=On,io=function(e){return ro(e)?e:void 0},no=function(e,t){return arguments.length<2?io(eo[e])||io(to[e]):eo[e]&&eo[e][t]||to[e]&&to[e][t]},oo="undefined"!=typeof navigator&&String(navigator.userAgent)||"",so=dn,ao=oo,co=so.process,uo=so.Deno,lo=co&&co.versions||uo&&uo.version,po=lo&&lo.v8;po&&(Un=(Mn=po.split("."))[0]>0&&Mn[0]<4?1:+(Mn[0]+Mn[1])),!Un&&ao&&(!(Mn=ao.match(/Edge\/(\d+)/))||Mn[1]>=74)&&(Mn=ao.match(/Chrome\/(\d+)/))&&(Un=+Mn[1]);var ho=Un,fo=ho,Eo=$i,mo=dn.String,_o=!!Object.getOwnPropertySymbols&&!Eo((function(){var e=Symbol();return!mo(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&fo&&fo<41})),To=_o&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,go=no,So=On,vo=an,yo=Object,Ro=To?function(e){return"symbol"==typeof e}:function(e){var t=go("Symbol");return So(t)&&vo(t.prototype,yo(e))},Ao=String,Oo=function(e){try{return Ao(e)}catch(e){return"Object"}},Io=On,bo=Oo,Co=TypeError,No=function(e){if(Io(e))return e;throw Co(bo(e)+" is not a function")},wo=No,Do=Gn,Po=function(e,t){var r=e[t];return Do(r)?void 0:wo(r)},ko=wn,Lo=On,Mo=Zn,Uo=TypeError,xo={exports:{}},Vo=dn,Fo=Object.defineProperty,Bo=function(e,t){try{Fo(Vo,e,{value:t,configurable:!0,writable:!0})}catch(r){Vo[e]=t}return t},jo="__core-js_shared__",Wo=dn[jo]||Bo(jo,{}),Go=Wo;(xo.exports=function(e,t){return Go[e]||(Go[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.31.1",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Ho=xo.exports,Ko=zn,zo=Object,Yo=function(e){return zo(Ko(e))},Xo=Yo,Jo=sn({}.hasOwnProperty),qo=Object.hasOwn||function(e,t){return Jo(Xo(e),t)},Qo=sn,Zo=0,$o=Math.random(),es=Qo(1..toString),ts=function(e){return"Symbol("+(void 0===e?"":e)+")_"+es(++Zo+$o,36)},rs=Ho,is=qo,ns=ts,os=_o,ss=To,as=dn.Symbol,cs=rs("wks"),ds=ss?as.for||as:as&&as.withoutSetter||ns,us=function(e){return is(cs,e)||(cs[e]=os&&is(as,e)?as[e]:ds("Symbol."+e)),cs[e]},ls=wn,ps=Zn,hs=Ro,fs=Po,Es=function(e,t){var r,i;if("string"===t&&Lo(r=e.toString)&&!Mo(i=ko(r,e)))return i;if(Lo(r=e.valueOf)&&!Mo(i=ko(r,e)))return i;if("string"!==t&&Lo(r=e.toString)&&!Mo(i=ko(r,e)))return i;throw Uo("Can't convert object to primitive value")},ms=TypeError,_s=us("toPrimitive"),Ts=function(e,t){if(!ps(e)||hs(e))return e;var r,i=fs(e,_s);if(i){if(void 0===t&&(t="default"),r=ls(i,e,t),!ps(r)||hs(r))return r;throw ms("Can't convert object to primitive value")}return void 0===t&&(t="number"),Es(e,t)},gs=Ro,Ss=function(e){var t=Ts(e,"string");return gs(t)?t:t+""},vs=Zn,ys=dn.document,Rs=vs(ys)&&vs(ys.createElement),As=function(e){return Rs?ys.createElement(e):{}},Os=As,Is=!bn&&!$i((function(){return 7!=Object.defineProperty(Os("div"),"a",{get:function(){return 7}}).a})),bs=bn,Cs=wn,Ns=Dn,ws=xn,Ds=Jn,Ps=Ss,ks=qo,Ls=Is,Ms=Object.getOwnPropertyDescriptor;In.f=bs?Ms:function(e,t){if(e=Ds(e),t=Ps(t),Ls)try{return Ms(e,t)}catch(e){}if(ks(e,t))return ws(!Cs(Ns.f,e,t),e[t])};var Us=$i,xs=On,Vs=/#|\.prototype\./,Fs=function(e,t){var r=js[Bs(e)];return r==Gs||r!=Ws&&(xs(t)?Us(t):!!t)},Bs=Fs.normalize=function(e){return String(e).replace(Vs,".").toLowerCase()},js=Fs.data={},Ws=Fs.NATIVE="N",Gs=Fs.POLYFILL="P",Hs=Fs,Ks=No,zs=en,Ys=vn(vn.bind),Xs=function(e,t){return Ks(e),void 0===t?e:zs?Ys(e,t):function(){return e.apply(t,arguments)}},Js={},qs=bn&&$i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Qs=Zn,Zs=String,$s=TypeError,ea=function(e){if(Qs(e))return e;throw $s(Zs(e)+" is not an object")},ta=bn,ra=Is,ia=qs,na=ea,oa=Ss,sa=TypeError,aa=Object.defineProperty,ca=Object.getOwnPropertyDescriptor,da="enumerable",ua="configurable",la="writable";Js.f=ta?ia?function(e,t,r){if(na(e),t=oa(t),na(r),"function"==typeof e&&"prototype"===t&&"value"in r&&la in r&&!r[la]){var i=ca(e,t);i&&i[la]&&(e[t]=r.value,r={configurable:ua in r?r[ua]:i[ua],enumerable:da in r?r[da]:i[da],writable:!1})}return aa(e,t,r)}:aa:function(e,t,r){if(na(e),t=oa(t),na(r),ra)try{return aa(e,t,r)}catch(e){}if("get"in r||"set"in r)throw sa("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var pa=Js,ha=xn,fa=bn?function(e,t,r){return pa.f(e,t,ha(1,r))}:function(e,t,r){return e[t]=r,e},Ea=dn,ma=fn,_a=vn,Ta=On,ga=In.f,Sa=Hs,va=$n,ya=Xs,Ra=fa,Aa=qo,Oa=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 ma(e,this,arguments)};return t.prototype=e.prototype,t},Ia=function(e,t){var r,i,n,o,s,a,c,d,u,l=e.target,p=e.global,h=e.stat,f=e.proto,E=p?Ea:h?Ea[l]:(Ea[l]||{}).prototype,m=p?va:va[l]||Ra(va,l,{})[l],_=m.prototype;for(o in t)i=!(r=Sa(p?o:l+(h?".":"#")+o,e.forced))&&E&&Aa(E,o),a=m[o],i&&(c=e.dontCallGetSet?(u=ga(E,o))&&u.value:E[o]),s=i&&c?c:t[o],i&&typeof a==typeof s||(d=e.bind&&i?ya(s,Ea):e.wrap&&i?Oa(s):f&&Ta(s)?_a(s):s,(e.sham||s&&s.sham||a&&a.sham)&&Ra(d,"sham",!0),Ra(m,o,d),f&&(Aa(va,n=l+"Prototype")||Ra(va,n,{}),Ra(va[n],o,s),e.real&&_&&(r||!_[o])&&Ra(_,o,s)))},ba=Math.ceil,Ca=Math.floor,Na=Math.trunc||function(e){var t=+e;return(t>0?Ca:ba)(t)},wa=function(e){var t=+e;return t!=t||0===t?0:Na(t)},Da=wa,Pa=Math.max,ka=Math.min,La=function(e,t){var r=Da(e);return r<0?Pa(r+t,0):ka(r,t)},Ma=wa,Ua=Math.min,xa=function(e){return e>0?Ua(Ma(e),9007199254740991):0},Va=function(e){return xa(e.length)},Fa=Jn,Ba=La,ja=Va,Wa=function(e){return function(t,r,i){var n,o=Fa(t),s=ja(o),a=Ba(i,s);if(e&&r!=r){for(;s>a;)if((n=o[a++])!=n)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},Ga={includes:Wa(!0),indexOf:Wa(!1)},Ha=Ga.includes;Ia({target:"Array",proto:!0,forced:$i((function(){return!Array(1).includes()}))},{includes:function(e){return Ha(this,e,arguments.length>1?arguments[1]:void 0)}});var Ka=$n,za=function(e){return Ka[e+"Prototype"]},Ya=za("Array").includes,Xa=Zn,Ja=Tn,qa=us("match"),Qa=function(e){var t;return Xa(e)&&(void 0!==(t=e[qa])?!!t:"RegExp"==Ja(e))},Za=TypeError,$a={};$a[us("toStringTag")]="z";var ec="[object z]"===String($a),tc=ec,rc=On,ic=Tn,nc=us("toStringTag"),oc=Object,sc="Arguments"==ic(function(){return arguments}()),ac=tc?ic: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=oc(e),nc))?r:sc?ic(t):"Object"==(i=ic(t))&&rc(t.callee)?"Arguments":i},cc=ac,dc=String,uc=function(e){if("Symbol"===cc(e))throw TypeError("Cannot convert a Symbol value to a string");return dc(e)},lc=us("match"),pc=Ia,hc=function(e){if(Qa(e))throw Za("The method doesn't accept regular expressions");return e},fc=zn,Ec=uc,mc=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[lc]=!1,"/./"[e](t)}catch(e){}}return!1},_c=sn("".indexOf);pc({target:"String",proto:!0,forced:!mc("includes")},{includes:function(e){return!!~_c(Ec(fc(this)),Ec(hc(e)),arguments.length>1?arguments[1]:void 0)}});var Tc=za("String").includes,gc=an,Sc=Ya,vc=Tc,yc=Array.prototype,Rc=String.prototype,Ac=J((function(e){var t=e.includes;return e===yc||gc(yc,e)&&t===yc.includes?Sc:"string"==typeof e||e===Rc||gc(Rc,e)&&t===Rc.includes?vc:t}));function Oc(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function Ic(e,t,r,i,n){return{width:e,height:t,frameRate:r,bitrateMin:i,bitrateMax:n}}function bc(e,t,r,i,n){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:i,bitrateMax:n}}function Cc(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const Nc={"90p":Ic(160,90),"90p_1":Ic(160,90),"120p":Ic(160,120,15,30,65),"120p_1":Ic(160,120,15,30,65),"120p_3":Ic(120,120,15,30,50),"120p_4":Ic(212,120),"180p":Ic(320,180,15,30,140),"180p_1":Ic(320,180,15,30,140),"180p_3":Ic(180,180,15,30,100),"180p_4":Ic(240,180,15,30,120),"240p":Ic(320,240,15,40,200),"240p_1":Ic(320,240,15,40,200),"240p_3":Ic(240,240,15,40,140),"240p_4":Ic(424,240,15,40,220),"360p":Ic(640,360,15,80,400),"360p_1":Ic(640,360,15,80,400),"360p_3":Ic(360,360,15,80,260),"360p_4":Ic(640,360,30,80,600),"360p_6":Ic(360,360,30,80,400),"360p_7":Ic(480,360,15,80,320),"360p_8":Ic(480,360,30,80,490),"360p_9":Ic(640,360,15,80,800),"360p_10":Ic(640,360,24,80,800),"360p_11":Ic(640,360,24,80,1e3),"480p":Ic(640,480,15,100,500),"480p_1":Ic(640,480,15,100,500),"480p_2":Ic(640,480,30,100,1e3),"480p_3":Ic(480,480,15,100,400),"480p_4":Ic(640,480,30,100,750),"480p_6":Ic(480,480,30,100,600),"480p_8":Ic(848,480,15,100,610),"480p_9":Ic(848,480,30,100,930),"480p_10":Ic(640,480,10,100,400),"720p":Ic(1280,720,15,120,1130),"720p_auto":Ic(1280,720,30,900,3e3),"720p_1":Ic(1280,720,15,120,1130),"720p_2":Ic(1280,720,30,120,2e3),"720p_3":Ic(1280,720,30,120,1710),"720p_5":Ic(960,720,15,120,910),"720p_6":Ic(960,720,30,120,1380),"1080p":Ic(1920,1080,15,120,2080),"1080p_1":Ic(1920,1080,15,120,2080),"1080p_2":Ic(1920,1080,30,120,3e3),"1080p_3":Ic(1920,1080,30,120,3150),"1080p_5":Ic(1920,1080,60,120,4780),"1440p":Ic(2560,1440,30,120,4850),"1440p_1":Ic(2560,1440,30,120,4850),"1440p_2":Ic(2560,1440,60,120,7350),"4k":Ic(3840,2160,30,120,8910),"4k_1":Ic(3840,2160,30,120,8910),"4k_3":Ic(3840,2160,60,120,13500)},wc={"480p":bc(640,480,5),"480p_1":bc(640,480,5),"480p_2":bc(640,480,30),"480p_3":bc(640,480,15),"720p":bc(1280,720,5),"720p_auto":Ic(1280,720,30,900,3e3),"720p_1":bc(1280,720,5),"720p_2":bc(1280,720,30),"720p_3":bc(1280,720,15),"1080p":bc(1920,1080,5),"1080p_1":bc(1920,1080,5),"1080p_2":bc(1920,1080,30),"1080p_3":bc(1920,1080,15)},Dc={"1SL1TL":Cc(1,1),"3SL3TL":Cc(3,3),"2SL3TL":Cc(2,3)};function Pc(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},Nc[e]):e}function kc(e){return"string"==typeof e?Object.assign({},wc[e]):e}function Lc(e){return"string"==typeof e?Object.assign({},Dc[e]):e}const Mc={speech_low_quality:Oc(16e3,!1),speech_standard:Oc(32e3,!1,18),music_standard:Oc(48e3,!1),standard_stereo:Oc(48e3,!0,56),high_quality:Oc(48e3,!1,128),high_quality_stereo:Oc(48e3,!0,192)};function Uc(e){return"string"==typeof e?Object.assign({},Mc[e]):e}const xc=[];function Vc(e){Ac(xc).call(xc,e)||xc.push(e)}function Fc(e){const t=xc.indexOf(e);-1!==t&&xc.splice(t,1)}function Bc(e){return kr(e.width,"config.width"),kr(e.height,"config.height"),void 0!==e.frameRate&&kr(e.frameRate,"config.frameRate"),void 0!==e.bitrateMax&&Pr(e.bitrateMax,"config.bitrateMax"),void 0!==e.bitrateMin&&Pr(e.bitrateMin,"config.bitrateMin"),!0}function jc(e){return void 0!==e.sampleRate&&Pr(e.sampleRate,"config.sampleRate",0,96e3,!0),void 0!==e.sampleSize&&Pr(e.sampleRate,"config.sampleSize",0,128,!0),void 0!==e.stereo&&wr(e.stereo,"config.stereo"),void 0!==e.bitrate&&Pr(e.bitrate,"config.bitrate",0,1e4,!1),!0}function Wc(e){return Dr(e,"mediaSource",["screen","window","application"]),!0}let Gc=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}({}),Hc=function(e){return e.SCREEN_TRACK="screen_track",e.CUSTOM_TRACK="custome_track",e.LOW_STREAM="low_stream",e}({});let Kc=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),zc=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),Yc=function(e){return e[e.DISABLE=0]="DISABLE",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e}({}),Xc=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}({}),Jc=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}({}),qc=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}({}),Qc=function(e){return e.AUDIO="audio",e.VIDEO="video",e.DATA="data",e}({}),Zc=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}({}),$c=function(e){return e.UPDATE_TRACK_SOURCE="update-track-source",e}({});const ed={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},td={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},rd={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},id={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 nd=function(e){return e.ON_TRACK="on_track",e.ON_NODE="on_node",e}({}),od=function(e){return e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints",e}({}),sd=function(e){return e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND",e}({}),ad=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 cd=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}({}),dd=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 ud=function(e){return e.OPEN="open",e.MESSAGE="message",e.CLOSE="close",e.CLOSING="closing",e.ERROR="error",e}({});var ld={exports:{}},pd=Ia,hd=bn,fd=Js.f;pd({target:"Object",stat:!0,forced:Object.defineProperty!==fd,sham:!hd},{defineProperty:fd});var Ed=$n.Object,md=ld.exports=function(e,t,r){return Ed.defineProperty(e,t,r)};Ed.defineProperty.sham&&(md.sham=!0);var _d=J(ld.exports),Td=Tn,gd=Array.isArray||function(e){return"Array"==Td(e)},Sd=TypeError,vd=Ss,yd=Js,Rd=xn,Ad=function(e,t,r){var i=vd(t);i in e?yd.f(e,i,Rd(0,r)):e[i]=r},Od=On,Id=Wo,bd=sn(Function.toString);Od(Id.inspectSource)||(Id.inspectSource=function(e){return bd(e)});var Cd=Id.inspectSource,Nd=sn,wd=$i,Dd=On,Pd=ac,kd=Cd,Ld=function(){},Md=[],Ud=no("Reflect","construct"),xd=/^\s*(?:class|function)\b/,Vd=Nd(xd.exec),Fd=!xd.exec(Ld),Bd=function(e){if(!Dd(e))return!1;try{return Ud(Ld,Md,e),!0}catch(e){return!1}},jd=function(e){if(!Dd(e))return!1;switch(Pd(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Fd||!!Vd(xd,kd(e))}catch(e){return!0}};jd.sham=!0;var Wd=!Ud||wd((function(){var e;return Bd(Bd.call)||!Bd(Object)||!Bd((function(){e=!0}))||e}))?jd:Bd,Gd=gd,Hd=Wd,Kd=Zn,zd=us("species"),Yd=Array,Xd=function(e){var t;return Gd(e)&&(t=e.constructor,(Hd(t)&&(t===Yd||Gd(t.prototype))||Kd(t)&&null===(t=t[zd]))&&(t=void 0)),void 0===t?Yd:t},Jd=function(e,t){return new(Xd(e))(0===t?0:t)},qd=$i,Qd=ho,Zd=us("species"),$d=function(e){return Qd>=51||!qd((function(){var t=[];return(t.constructor={})[Zd]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},eu=Ia,tu=$i,ru=gd,iu=Zn,nu=Yo,ou=Va,su=function(e){if(e>9007199254740991)throw Sd("Maximum allowed index exceeded");return e},au=Ad,cu=Jd,du=$d,uu=ho,lu=us("isConcatSpreadable"),pu=uu>=51||!tu((function(){var e=[];return e[lu]=!1,e.concat()[0]!==e})),hu=function(e){if(!iu(e))return!1;var t=e[lu];return void 0!==t?!!t:ru(e)};eu({target:"Array",proto:!0,arity:1,forced:!pu||!du("concat")},{concat:function(e){var t,r,i,n,o,s=nu(this),a=cu(s,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(hu(o=-1===t?s:arguments[t]))for(n=ou(o),su(c+n),r=0;r<n;r++,c++)r in o&&au(a,c,o[r]);else su(c+1),au(a,c++,o);return a.length=c,a}});var fu={},Eu={},mu=qo,_u=Jn,Tu=Ga.indexOf,gu=Eu,Su=sn([].push),vu=function(e,t){var r,i=_u(e),n=0,o=[];for(r in i)!mu(gu,r)&&mu(i,r)&&Su(o,r);for(;t.length>n;)mu(i,r=t[n++])&&(~Tu(o,r)||Su(o,r));return o},yu=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ru=vu,Au=yu,Ou=Object.keys||function(e){return Ru(e,Au)},Iu=bn,bu=qs,Cu=Js,Nu=ea,wu=Jn,Du=Ou;fu.f=Iu&&!bu?Object.defineProperties:function(e,t){Nu(e);for(var r,i=wu(t),n=Du(t),o=n.length,s=0;o>s;)Cu.f(e,r=n[s++],i[r]);return e};var Pu,ku=no("document","documentElement"),Lu=ts,Mu=Ho("keys"),Uu=function(e){return Mu[e]||(Mu[e]=Lu(e))},xu=ea,Vu=fu,Fu=yu,Bu=Eu,ju=ku,Wu=As,Gu="prototype",Hu="script",Ku=Uu("IE_PROTO"),zu=function(){},Yu=function(e){return"<"+Hu+">"+e+"</"+Hu+">"},Xu=function(e){e.write(Yu("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ju=function(){try{Pu=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Ju="undefined"!=typeof document?document.domain&&Pu?Xu(Pu):(t=Wu("iframe"),r="java"+Hu+":",t.style.display="none",ju.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(Yu("document.F=Object")),e.close(),e.F):Xu(Pu);for(var i=Fu.length;i--;)delete Ju[Gu][Fu[i]];return Ju()};Bu[Ku]=!0;var qu=Object.create||function(e,t){var r;return null!==e?(zu[Gu]=xu(e),r=new zu,zu[Gu]=null,r[Ku]=e):r=Ju(),void 0===t?r:Vu.f(r,t)},Qu={},Zu=vu,$u=yu.concat("length","prototype");Qu.f=Object.getOwnPropertyNames||function(e){return Zu(e,$u)};var el={},tl=La,rl=Va,il=Ad,nl=Array,ol=Math.max,sl=function(e,t,r){for(var i=rl(e),n=tl(t,i),o=tl(void 0===r?i:r,i),s=nl(ol(o-n,0)),a=0;n<o;n++,a++)il(s,a,e[n]);return s.length=a,s},al=Tn,cl=Jn,dl=Qu.f,ul=sl,ll="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];el.f=function(e){return ll&&"Window"==al(e)?function(e){try{return dl(e)}catch(e){return ul(ll)}}(e):dl(cl(e))};var pl={};pl.f=Object.getOwnPropertySymbols;var hl=fa,fl=function(e,t,r,i){return i&&i.enumerable?e[t]=r:hl(e,t,r),e},El=Js,ml=function(e,t,r){return El.f(e,t,r)},_l={},Tl=us;_l.f=Tl;var gl,Sl,vl,yl=$n,Rl=qo,Al=_l,Ol=Js.f,Il=function(e){var t=yl.Symbol||(yl.Symbol={});Rl(t,e)||Ol(t,e,{value:Al.f(e)})},bl=wn,Cl=no,Nl=us,wl=fl,Dl=function(){var e=Cl("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,i=Nl("toPrimitive");t&&!t[i]&&wl(t,i,(function(e){return bl(r,this)}),{arity:1})},Pl=ac,kl=ec?{}.toString:function(){return"[object "+Pl(this)+"]"},Ll=ec,Ml=Js.f,Ul=fa,xl=qo,Vl=kl,Fl=us("toStringTag"),Bl=function(e,t,r,i){if(e){var n=r?e:e.prototype;xl(n,Fl)||Ml(n,Fl,{configurable:!0,value:t}),i&&!Ll&&Ul(n,"toString",Vl)}},jl=On,Wl=dn.WeakMap,Gl=jl(Wl)&&/native code/.test(String(Wl)),Hl=dn,Kl=Zn,zl=fa,Yl=qo,Xl=Wo,Jl=Uu,ql=Eu,Ql="Object already initialized",Zl=Hl.TypeError,$l=Hl.WeakMap;if(Gl||Xl.state){var ep=Xl.state||(Xl.state=new $l);ep.get=ep.get,ep.has=ep.has,ep.set=ep.set,gl=function(e,t){if(ep.has(e))throw Zl(Ql);return t.facade=e,ep.set(e,t),t},Sl=function(e){return ep.get(e)||{}},vl=function(e){return ep.has(e)}}else{var tp=Jl("state");ql[tp]=!0,gl=function(e,t){if(Yl(e,tp))throw Zl(Ql);return t.facade=e,zl(e,tp,t),t},Sl=function(e){return Yl(e,tp)?e[tp]:{}},vl=function(e){return Yl(e,tp)}}var rp={set:gl,get:Sl,has:vl,enforce:function(e){return vl(e)?Sl(e):gl(e,{})},getterFor:function(e){return function(t){var r;if(!Kl(t)||(r=Sl(t)).type!==e)throw Zl("Incompatible receiver, "+e+" required");return r}}},ip=Xs,np=Wn,op=Yo,sp=Va,ap=Jd,cp=sn([].push),dp=function(e){var t=1==e,r=2==e,i=3==e,n=4==e,o=6==e,s=7==e,a=5==e||o;return function(c,d,u,l){for(var p,h,f=op(c),E=np(f),m=ip(d,u),_=sp(E),T=0,g=l||ap,S=t?g(c,_):r||s?g(c,0):void 0;_>T;T++)if((a||T in E)&&(h=m(p=E[T],T,f),e))if(t)S[T]=h;else if(h)switch(e){case 3:return!0;case 5:return p;case 6:return T;case 2:cp(S,p)}else switch(e){case 4:return!1;case 7:cp(S,p)}return o?-1:i||n?n:S}},up={forEach:dp(0),map:dp(1),filter:dp(2),some:dp(3),every:dp(4),find:dp(5),findIndex:dp(6),filterReject:dp(7)},lp=Ia,pp=dn,hp=wn,fp=sn,Ep=bn,mp=_o,_p=$i,Tp=qo,gp=an,Sp=ea,vp=Jn,yp=Ss,Rp=uc,Ap=xn,Op=qu,Ip=Ou,bp=Qu,Cp=el,Np=pl,wp=In,Dp=Js,Pp=fu,kp=Dn,Lp=fl,Mp=ml,Up=Ho,xp=Eu,Vp=ts,Fp=us,Bp=_l,jp=Il,Wp=Dl,Gp=Bl,Hp=rp,Kp=up.forEach,zp=Uu("hidden"),Yp="Symbol",Xp="prototype",Jp=Hp.set,qp=Hp.getterFor(Yp),Qp=Object[Xp],Zp=pp.Symbol,$p=Zp&&Zp[Xp],eh=pp.TypeError,th=pp.QObject,rh=wp.f,ih=Dp.f,nh=Cp.f,oh=kp.f,sh=fp([].push),ah=Up("symbols"),ch=Up("op-symbols"),dh=Up("wks"),uh=!th||!th[Xp]||!th[Xp].findChild,lh=Ep&&_p((function(){return 7!=Op(ih({},"a",{get:function(){return ih(this,"a",{value:7}).a}})).a}))?function(e,t,r){var i=rh(Qp,t);i&&delete Qp[t],ih(e,t,r),i&&e!==Qp&&ih(Qp,t,i)}:ih,ph=function(e,t){var r=ah[e]=Op($p);return Jp(r,{type:Yp,tag:e,description:t}),Ep||(r.description=t),r},hh=function(e,t,r){e===Qp&&hh(ch,t,r),Sp(e);var i=yp(t);return Sp(r),Tp(ah,i)?(r.enumerable?(Tp(e,zp)&&e[zp][i]&&(e[zp][i]=!1),r=Op(r,{enumerable:Ap(0,!1)})):(Tp(e,zp)||ih(e,zp,Ap(1,{})),e[zp][i]=!0),lh(e,i,r)):ih(e,i,r)},fh=function(e,t){Sp(e);var r=vp(t),i=Ip(r).concat(Th(r));return Kp(i,(function(t){Ep&&!hp(Eh,r,t)||hh(e,t,r[t])})),e},Eh=function(e){var t=yp(e),r=hp(oh,this,t);return!(this===Qp&&Tp(ah,t)&&!Tp(ch,t))&&(!(r||!Tp(this,t)||!Tp(ah,t)||Tp(this,zp)&&this[zp][t])||r)},mh=function(e,t){var r=vp(e),i=yp(t);if(r!==Qp||!Tp(ah,i)||Tp(ch,i)){var n=rh(r,i);return!n||!Tp(ah,i)||Tp(r,zp)&&r[zp][i]||(n.enumerable=!0),n}},_h=function(e){var t=nh(vp(e)),r=[];return Kp(t,(function(e){Tp(ah,e)||Tp(xp,e)||sh(r,e)})),r},Th=function(e){var t=e===Qp,r=nh(t?ch:vp(e)),i=[];return Kp(r,(function(e){!Tp(ah,e)||t&&!Tp(Qp,e)||sh(i,ah[e])})),i};mp||(Zp=function(){if(gp($p,this))throw eh("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Rp(arguments[0]):void 0,t=Vp(e),r=function(e){this===Qp&&hp(r,ch,e),Tp(this,zp)&&Tp(this[zp],t)&&(this[zp][t]=!1),lh(this,t,Ap(1,e))};return Ep&&uh&&lh(Qp,t,{configurable:!0,set:r}),ph(t,e)},Lp($p=Zp[Xp],"toString",(function(){return qp(this).tag})),Lp(Zp,"withoutSetter",(function(e){return ph(Vp(e),e)})),kp.f=Eh,Dp.f=hh,Pp.f=fh,wp.f=mh,bp.f=Cp.f=_h,Np.f=Th,Bp.f=function(e){return ph(Fp(e),e)},Ep&&Mp($p,"description",{configurable:!0,get:function(){return qp(this).description}})),lp({global:!0,constructor:!0,wrap:!0,forced:!mp,sham:!mp},{Symbol:Zp}),Kp(Ip(dh),(function(e){jp(e)})),lp({target:Yp,stat:!0,forced:!mp},{useSetter:function(){uh=!0},useSimple:function(){uh=!1}}),lp({target:"Object",stat:!0,forced:!mp,sham:!Ep},{create:function(e,t){return void 0===t?Op(e):fh(Op(e),t)},defineProperty:hh,defineProperties:fh,getOwnPropertyDescriptor:mh}),lp({target:"Object",stat:!0,forced:!mp},{getOwnPropertyNames:_h}),Wp(),Gp(Zp,Yp),xp[zp]=!0;var gh=_o&&!!Symbol.for&&!!Symbol.keyFor,Sh=Ia,vh=no,yh=qo,Rh=uc,Ah=Ho,Oh=gh,Ih=Ah("string-to-symbol-registry"),bh=Ah("symbol-to-string-registry");Sh({target:"Symbol",stat:!0,forced:!Oh},{for:function(e){var t=Rh(e);if(yh(Ih,t))return Ih[t];var r=vh("Symbol")(t);return Ih[t]=r,bh[r]=t,r}});var Ch=Ia,Nh=qo,wh=Ro,Dh=Oo,Ph=gh,kh=Ho("symbol-to-string-registry");Ch({target:"Symbol",stat:!0,forced:!Ph},{keyFor:function(e){if(!wh(e))throw TypeError(Dh(e)+" is not a symbol");if(Nh(kh,e))return kh[e]}});var Lh=sn([].slice),Mh=gd,Uh=On,xh=Tn,Vh=uc,Fh=sn([].push),Bh=Ia,jh=no,Wh=fn,Gh=wn,Hh=sn,Kh=$i,zh=On,Yh=Ro,Xh=Lh,Jh=function(e){if(Uh(e))return e;if(Mh(e)){for(var t=e.length,r=[],i=0;i<t;i++){var n=e[i];"string"==typeof n?Fh(r,n):"number"!=typeof n&&"Number"!=xh(n)&&"String"!=xh(n)||Fh(r,Vh(n))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(Mh(this))return t;for(var i=0;i<o;i++)if(r[i]===e)return t}}},qh=_o,Qh=String,Zh=jh("JSON","stringify"),$h=Hh(/./.exec),ef=Hh("".charAt),tf=Hh("".charCodeAt),rf=Hh("".replace),nf=Hh(1..toString),of=/[\uD800-\uDFFF]/g,sf=/^[\uD800-\uDBFF]$/,af=/^[\uDC00-\uDFFF]$/,cf=!qh||Kh((function(){var e=jh("Symbol")();return"[null]"!=Zh([e])||"{}"!=Zh({a:e})||"{}"!=Zh(Object(e))})),df=Kh((function(){return'"\\udf06\\ud834"'!==Zh("\udf06\ud834")||'"\\udead"'!==Zh("\udead")})),uf=function(e,t){var r=Xh(arguments),i=Jh(t);if(zh(i)||void 0!==e&&!Yh(e))return r[1]=function(e,t){if(zh(i)&&(t=Gh(i,this,Qh(e),t)),!Yh(t))return t},Wh(Zh,null,r)},lf=function(e,t,r){var i=ef(r,t-1),n=ef(r,t+1);return $h(sf,e)&&!$h(af,n)||$h(af,e)&&!$h(sf,i)?"\\u"+nf(tf(e,0),16):e};Zh&&Bh({target:"JSON",stat:!0,arity:3,forced:cf||df},{stringify:function(e,t,r){var i=Xh(arguments),n=Wh(cf?uf:Zh,null,i);return df&&"string"==typeof n?rf(n,of,lf):n}});var pf=pl,hf=Yo;Ia({target:"Object",stat:!0,forced:!_o||$i((function(){pf.f(1)}))},{getOwnPropertySymbols:function(e){var t=pf.f;return t?t(hf(e)):[]}}),Il("asyncIterator"),Il("hasInstance"),Il("isConcatSpreadable"),Il("iterator"),Il("match"),Il("matchAll"),Il("replace"),Il("search"),Il("species"),Il("split");var ff=Dl;Il("toPrimitive"),ff();var Ef=no,mf=Bl;Il("toStringTag"),mf(Ef("Symbol"),"Symbol"),Il("unscopables"),Bl(dn.JSON,"JSON",!0);var _f,Tf,gf,Sf=$n.Symbol,vf={},yf=bn,Rf=qo,Af=Function.prototype,Of=yf&&Object.getOwnPropertyDescriptor,If=Rf(Af,"name"),bf={EXISTS:If,PROPER:If&&"something"===function(){}.name,CONFIGURABLE:If&&(!yf||yf&&Of(Af,"name").configurable)},Cf=!$i((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Nf=qo,wf=On,Df=Yo,Pf=Cf,kf=Uu("IE_PROTO"),Lf=Object,Mf=Lf.prototype,Uf=Pf?Lf.getPrototypeOf:function(e){var t=Df(e);if(Nf(t,kf))return t[kf];var r=t.constructor;return wf(r)&&t instanceof r?r.prototype:t instanceof Lf?Mf:null},xf=$i,Vf=On,Ff=Zn,Bf=qu,jf=Uf,Wf=fl,Gf=us("iterator"),Hf=!1;[].keys&&("next"in(gf=[].keys())?(Tf=jf(jf(gf)))!==Object.prototype&&(_f=Tf):Hf=!0);var Kf=!Ff(_f)||xf((function(){var e={};return _f[Gf].call(e)!==e}));Vf((_f=Kf?{}:Bf(_f))[Gf])||Wf(_f,Gf,(function(){return this}));var zf={IteratorPrototype:_f,BUGGY_SAFARI_ITERATORS:Hf},Yf=zf.IteratorPrototype,Xf=qu,Jf=xn,qf=Bl,Qf=vf,Zf=function(){return this},$f=function(e,t,r,i){var n=t+" Iterator";return e.prototype=Xf(Yf,{next:Jf(+!i,r)}),qf(e,n,!1,!0),Qf[n]=Zf,e},eE=sn,tE=No,rE=On,iE=String,nE=TypeError,oE=function(e,t,r){try{return eE(tE(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},sE=ea,aE=function(e){if("object"==typeof e||rE(e))return e;throw nE("Can't set "+iE(e)+" as a prototype")},cE=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=oE(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return sE(r),aE(i),t?e(r,i):r.__proto__=i,r}}():void 0),dE=Ia,uE=wn,lE=bf,pE=$f,hE=Uf,fE=Bl,EE=fl,mE=vf,_E=zf,TE=lE.PROPER,gE=_E.BUGGY_SAFARI_ITERATORS,SE=us("iterator"),vE="keys",yE="values",RE="entries",AE=function(){return this},OE=function(e,t,r,i,n,o,s){pE(r,t,i);var a,c,d,u=function(e){if(e===n&&E)return E;if(!gE&&e in h)return h[e];switch(e){case vE:case yE:case RE:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",p=!1,h=e.prototype,f=h[SE]||h["@@iterator"]||n&&h[n],E=!gE&&f||u(n),m="Array"==t&&h.entries||f;if(m&&(a=hE(m.call(new e)))!==Object.prototype&&a.next&&(fE(a,l,!0,!0),mE[l]=AE),TE&&n==yE&&f&&f.name!==yE&&(p=!0,E=function(){return uE(f,this)}),n)if(c={values:u(yE),keys:o?E:u(vE),entries:u(RE)},s)for(d in c)(gE||p||!(d in h))&&EE(h,d,c[d]);else dE({target:t,proto:!0,forced:gE||p},c);return s&&h[SE]!==E&&EE(h,SE,E,{name:n}),mE[t]=E,c},IE=function(e,t){return{value:e,done:t}},bE=Jn,CE=vf,NE=rp;Js.f;var wE=OE,DE=IE,PE="Array Iterator",kE=NE.set,LE=NE.getterFor(PE);wE(Array,"Array",(function(e,t){kE(this,{type:PE,target:bE(e),index:0,kind:t})}),(function(){var e=LE(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,DE(void 0,!0)):DE("keys"==r?i:"values"==r?t[i]:[i,t[i]],!1)}),"values"),CE.Arguments=CE.Array;var ME={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},UE=dn,xE=ac,VE=fa,FE=vf,BE=us("toStringTag");for(var jE in ME){var WE=UE[jE],GE=WE&&WE.prototype;GE&&xE(GE)!==BE&&VE(GE,BE,jE),FE[jE]=FE.Array}var HE=Sf,KE=us,zE=Js.f,YE=KE("metadata"),XE=Function.prototype;void 0===XE[YE]&&zE(XE,YE,{value:null}),Il("dispose"),Il("metadata");var JE=HE;Il("asyncDispose");var qE=sn,QE=no("Symbol"),ZE=QE.keyFor,$E=qE(QE.prototype.valueOf),em=QE.isRegisteredSymbol||function(e){try{return void 0!==ZE($E(e))}catch(e){return!1}};Ia({target:"Symbol",stat:!0},{isRegisteredSymbol:em});for(var tm=Ho,rm=no,im=sn,nm=Ro,om=us,sm=rm("Symbol"),am=sm.isWellKnownSymbol,cm=rm("Object","getOwnPropertyNames"),dm=im(sm.prototype.valueOf),um=tm("wks"),lm=0,pm=cm(sm),hm=pm.length;lm<hm;lm++)try{var fm=pm[lm];nm(sm[fm])&&om(fm)}catch(e){}var Em=function(e){if(am&&am(e))return!0;try{for(var t=dm(e),r=0,i=cm(um),n=i.length;r<n;r++)if(um[i[r]]==t)return!0}catch(e){}return!1};Ia({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:Em}),Il("matcher"),Il("observable"),Ia({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:em}),Ia({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:Em}),Il("metadataKey"),Il("patternMatch"),Il("replaceAll");var mm=J(JE),_m=sn,Tm=wa,gm=uc,Sm=zn,vm=_m("".charAt),ym=_m("".charCodeAt),Rm=_m("".slice),Am=function(e){return function(t,r){var i,n,o=gm(Sm(t)),s=Tm(r),a=o.length;return s<0||s>=a?e?"":void 0:(i=ym(o,s))<55296||i>56319||s+1===a||(n=ym(o,s+1))<56320||n>57343?e?vm(o,s):i:e?Rm(o,s,s+2):n-56320+(i-55296<<10)+65536}},Om={codeAt:Am(!1),charAt:Am(!0)},Im=Om.charAt,bm=uc,Cm=rp,Nm=OE,wm=IE,Dm="String Iterator",Pm=Cm.set,km=Cm.getterFor(Dm);Nm(String,"String",(function(e){Pm(this,{type:Dm,string:bm(e),index:0})}),(function(){var e,t=km(this),r=t.string,i=t.index;return i>=r.length?wm(void 0,!0):(e=Im(r,i),t.index+=e.length,wm(e,!1))}));var Lm=J(_l.f("iterator"));function Mm(e){return Mm="function"==typeof mm&&"symbol"==typeof Lm?function(e){return typeof e}:function(e){return e&&"function"==typeof mm&&e.constructor===mm&&e!==mm.prototype?"symbol":typeof e},Mm(e)}var Um=J(_l.f("toPrimitive"));function xm(e){var t=function(e,t){if("object"!==Mm(e)||null===e)return e;var r=e[Um];if(void 0!==r){var i=r.call(e,t||"default");if("object"!==Mm(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Mm(t)?t:String(t)}function Vm(e,t,r){return(t=xm(t))in e?_d(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Fm=$i,Bm=function(e,t){var r=[][e];return!!r&&Fm((function(){r.call(null,t||function(){return 1},1)}))},jm=up.forEach,Wm=Bm("forEach")?[].forEach:function(e){return jm(this,e,arguments.length>1?arguments[1]:void 0)};Ia({target:"Array",proto:!0,forced:[].forEach!=Wm},{forEach:Wm});var Gm=za("Array").forEach,Hm=ac,Km=qo,zm=an,Ym=Gm,Xm=Array.prototype,Jm={DOMTokenList:!0,NodeList:!0},qm=J((function(e){var t=e.forEach;return e===Xm||zm(Xm,e)&&t===Xm.forEach||Km(Jm,Hm(e))?Ym:t})),Qm=Yo,Zm=Ou;Ia({target:"Object",stat:!0,forced:$i((function(){Zm(1)}))},{keys:function(e){return Zm(Qm(e))}});var $m=J($n.Object.keys),e_=No,t_=Yo,r_=Wn,i_=Va,n_=TypeError,o_=function(e){return function(t,r,i,n){e_(r);var o=t_(t),s=r_(o),a=i_(o),c=e?a-1:0,d=e?-1:1;if(i<2)for(;;){if(c in s){n=s[c],c+=d;break}if(c+=d,e?c<0:a<=c)throw n_("Reduce of empty array with no initial value")}for(;e?c>=0:a>c;c+=d)c in s&&(n=r(n,s[c],c,o));return n}},s_={left:o_(!1),right:o_(!0)},a_="undefined"!=typeof process&&"process"==Tn(process),c_=s_.left;Ia({target:"Array",proto:!0,forced:!a_&&ho>79&&ho<83||!Bm("reduce")},{reduce:function(e){var t=arguments.length;return c_(this,e,t,t>1?arguments[1]:void 0)}});var d_=za("Array").reduce,u_=an,l_=d_,p_=Array.prototype,h_=function(e){var t=e.reduce;return e===p_||u_(p_,e)&&t===p_.reduce?l_:t},f_=J(h_),E_=Ia,m_=gd,__=sn([].reverse),T_=[1,2];E_({target:"Array",proto:!0,forced:String(T_)===String(T_.reverse())},{reverse:function(){return m_(this)&&(this.length=this.length),__(this)}});var g_=za("Array").reverse,S_=an,v_=g_,y_=Array.prototype,R_=J((function(e){var t=e.reverse;return e===y_||S_(y_,e)&&t===y_.reverse?v_:t})),A_=Ia,O_=gd,I_=Wd,b_=Zn,C_=La,N_=Va,w_=Jn,D_=Ad,P_=us,k_=Lh,L_=$d("slice"),M_=P_("species"),U_=Array,x_=Math.max;A_({target:"Array",proto:!0,forced:!L_},{slice:function(e,t){var r,i,n,o=w_(this),s=N_(o),a=C_(e,s),c=C_(void 0===t?s:t,s);if(O_(o)&&(r=o.constructor,(I_(r)&&(r===U_||O_(r.prototype))||b_(r)&&null===(r=r[M_]))&&(r=void 0),r===U_||void 0===r))return k_(o,a,c);for(i=new(void 0===r?U_:r)(x_(c-a,0)),n=0;a<c;a++,n++)a in o&&D_(i,n,o[a]);return i.length=n,i}});var V_=za("Array").slice,F_=an,B_=V_,j_=Array.prototype,W_=J((function(e){var t=e.slice;return e===j_||F_(j_,e)&&t===j_.slice?B_:t}));function G_(e,t,r,i,n){var o,s,a,c={};return qm(o=$m(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=f_(s=R_(a=W_(r).call(r)).call(a)).call(s,(function(r,i){return i(e,t,r)||r}),c),n&&void 0!==c.initializer&&(c.value=c.initializer?c.initializer.call(n):void 0,c.initializer=void 0),void 0===c.initializer&&(_d(e,t,c),c=null),c}var H_=no,K_=Qu,z_=pl,Y_=ea,X_=sn([].concat),J_=H_("Reflect","ownKeys")||function(e){var t=K_.f(Y_(e)),r=z_.f;return r?X_(t,r(e)):t},q_=qo,Q_=J_,Z_=In,$_=Js,eT=Zn,tT=fa,rT=Error,iT=sn("".replace),nT=String(rT("zxcasd").stack),oT=/\n\s*at [^:]*:[^\n]*/,sT=oT.test(nT),aT=xn,cT=!$i((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",aT(1,7)),7!==e.stack)})),dT=fa,uT=function(e,t){if(sT&&"string"==typeof e&&!rT.prepareStackTrace)for(;t--;)e=iT(e,oT,"");return e},lT=cT,pT=Error.captureStackTrace,hT=vf,fT=us("iterator"),ET=Array.prototype,mT=function(e){return void 0!==e&&(hT.Array===e||ET[fT]===e)},_T=ac,TT=Po,gT=Gn,ST=vf,vT=us("iterator"),yT=function(e){if(!gT(e))return TT(e,vT)||TT(e,"@@iterator")||ST[_T(e)]},RT=wn,AT=No,OT=ea,IT=Oo,bT=yT,CT=TypeError,NT=function(e,t){var r=arguments.length<2?bT(e):t;if(AT(r))return OT(RT(r,e));throw CT(IT(e)+" is not iterable")},wT=wn,DT=ea,PT=Po,kT=function(e,t,r){var i,n;DT(e);try{if(!(i=PT(e,"return"))){if("throw"===t)throw r;return r}i=wT(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return DT(i),r},LT=Xs,MT=wn,UT=ea,xT=Oo,VT=mT,FT=Va,BT=an,jT=NT,WT=yT,GT=kT,HT=TypeError,KT=function(e,t){this.stopped=e,this.result=t},zT=KT.prototype,YT=function(e,t,r){var i,n,o,s,a,c,d,u=r&&r.that,l=!(!r||!r.AS_ENTRIES),p=!(!r||!r.IS_RECORD),h=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),E=LT(t,u),m=function(e){return i&&GT(i,"normal",e),new KT(!0,e)},_=function(e){return l?(UT(e),f?E(e[0],e[1],m):E(e[0],e[1])):f?E(e,m):E(e)};if(p)i=e.iterator;else if(h)i=e;else{if(!(n=WT(e)))throw HT(xT(e)+" is not iterable");if(VT(n)){for(o=0,s=FT(e);s>o;o++)if((a=_(e[o]))&&BT(zT,a))return a;return new KT(!1)}i=jT(e,n)}for(c=p?e.next:i.next;!(d=MT(c,i)).done;){try{a=_(d.value)}catch(e){GT(i,"throw",e)}if("object"==typeof a&&a&&BT(zT,a))return a}return new KT(!1)},XT=uc,JT=Ia,qT=an,QT=Uf,ZT=cE,$T=function(e,t,r){for(var i=Q_(t),n=$_.f,o=Z_.f,s=0;s<i.length;s++){var a=i[s];q_(e,a)||r&&q_(r,a)||n(e,a,o(t,a))}},eg=qu,tg=fa,rg=xn,ig=function(e,t){eT(t)&&"cause"in t&&tT(e,"cause",t.cause)},ng=function(e,t,r,i){lT&&(pT?pT(e,t):dT(e,"stack",uT(r,i)))},og=YT,sg=function(e,t){return void 0===e?arguments.length<2?"":t:XT(e)},ag=us("toStringTag"),cg=Error,dg=[].push,ug=function(e,t){var r,i=qT(lg,this);ZT?r=ZT(cg(),i?QT(this):lg):(r=i?this:eg(lg),tg(r,ag,"Error")),void 0!==t&&tg(r,"message",sg(t)),ng(r,ug,r.stack,1),arguments.length>2&&ig(r,arguments[2]);var n=[];return og(e,dg,{that:n}),tg(r,"errors",n),r};ZT?ZT(ug,cg):$T(ug,cg,{name:!0});var lg=ug.prototype=eg(cg.prototype,{constructor:rg(1,ug),message:rg(1,""),name:rg(1,"AggregateError")});JT({global:!0,constructor:!0,arity:2},{AggregateError:ug});var pg,hg,fg,Eg,mg=no,_g=ml,Tg=bn,gg=us("species"),Sg=an,vg=TypeError,yg=function(e,t){if(Sg(t,e))return e;throw vg("Incorrect invocation")},Rg=Wd,Ag=Oo,Og=TypeError,Ig=ea,bg=function(e){if(Rg(e))return e;throw Og(Ag(e)+" is not a constructor")},Cg=Gn,Ng=us("species"),wg=function(e,t){var r,i=Ig(e).constructor;return void 0===i||Cg(r=Ig(i)[Ng])?t:bg(r)},Dg=TypeError,Pg=function(e,t){if(e<t)throw Dg("Not enough arguments");return e},kg=/(?:ipad|iphone|ipod).*applewebkit/i.test(oo),Lg=dn,Mg=fn,Ug=Xs,xg=On,Vg=qo,Fg=$i,Bg=ku,jg=Lh,Wg=As,Gg=Pg,Hg=kg,Kg=a_,zg=Lg.setImmediate,Yg=Lg.clearImmediate,Xg=Lg.process,Jg=Lg.Dispatch,qg=Lg.Function,Qg=Lg.MessageChannel,Zg=Lg.String,$g=0,eS={},tS="onreadystatechange";Fg((function(){pg=Lg.location}));var rS=function(e){if(Vg(eS,e)){var t=eS[e];delete eS[e],t()}},iS=function(e){return function(){rS(e)}},nS=function(e){rS(e.data)},oS=function(e){Lg.postMessage(Zg(e),pg.protocol+"//"+pg.host)};zg&&Yg||(zg=function(e){Gg(arguments.length,1);var t=xg(e)?e:qg(e),r=jg(arguments,1);return eS[++$g]=function(){Mg(t,void 0,r)},hg($g),$g},Yg=function(e){delete eS[e]},Kg?hg=function(e){Xg.nextTick(iS(e))}:Jg&&Jg.now?hg=function(e){Jg.now(iS(e))}:Qg&&!Hg?(Eg=(fg=new Qg).port2,fg.port1.onmessage=nS,hg=Ug(Eg.postMessage,Eg)):Lg.addEventListener&&xg(Lg.postMessage)&&!Lg.importScripts&&pg&&"file:"!==pg.protocol&&!Fg(oS)?(hg=oS,Lg.addEventListener("message",nS,!1)):hg=tS in Wg("script")?function(e){Bg.appendChild(Wg("script"))[tS]=function(){Bg.removeChild(this),rS(e)}}:function(e){setTimeout(iS(e),0)});var sS={set:zg,clear:Yg},aS=function(){this.head=null,this.tail=null};aS.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 cS,dS,uS,lS,pS,hS=aS,fS=/ipad|iphone|ipod/i.test(oo)&&"undefined"!=typeof Pebble,ES=/web0s(?!.*chrome)/i.test(oo),mS=dn,_S=Xs,TS=In.f,gS=sS.set,SS=hS,vS=kg,yS=fS,RS=ES,AS=a_,OS=mS.MutationObserver||mS.WebKitMutationObserver,IS=mS.document,bS=mS.process,CS=mS.Promise,NS=TS(mS,"queueMicrotask"),wS=NS&&NS.value;if(!wS){var DS=new SS,PS=function(){var e,t;for(AS&&(e=bS.domain)&&e.exit();t=DS.get();)try{t()}catch(e){throw DS.head&&cS(),e}e&&e.enter()};vS||AS||RS||!OS||!IS?!yS&&CS&&CS.resolve?((lS=CS.resolve(void 0)).constructor=CS,pS=_S(lS.then,lS),cS=function(){pS(PS)}):AS?cS=function(){bS.nextTick(PS)}:(gS=_S(gS,mS),cS=function(){gS(PS)}):(dS=!0,uS=IS.createTextNode(""),new OS(PS).observe(uS,{characterData:!0}),cS=function(){uS.data=dS=!dS}),wS=function(e){DS.head||cS(),DS.add(e)}}var kS=wS,LS=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},MS=dn.Promise,US="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,xS=!US&&!a_&&"object"==typeof window&&"object"==typeof document,VS=dn,FS=MS,BS=On,jS=Hs,WS=Cd,GS=us,HS=xS,KS=US,zS=ho,YS=FS&&FS.prototype,XS=GS("species"),JS=!1,qS=BS(VS.PromiseRejectionEvent),QS=jS("Promise",(function(){var e=WS(FS),t=e!==String(FS);if(!t&&66===zS)return!0;if(!YS.catch||!YS.finally)return!0;if(!zS||zS<51||!/native code/.test(e)){var r=new FS((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[XS]=i,!(JS=r.then((function(){}))instanceof i))return!0}return!t&&(HS||KS)&&!qS})),ZS={CONSTRUCTOR:QS,REJECTION_EVENT:qS,SUBCLASSING:JS},$S={},ev=No,tv=TypeError,rv=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw tv("Bad Promise constructor");t=e,r=i})),this.resolve=ev(t),this.reject=ev(r)};$S.f=function(e){return new rv(e)};var iv,nv,ov=Ia,sv=a_,av=dn,cv=wn,dv=fl,uv=Bl,lv=function(e){var t=mg(e);Tg&&t&&!t[gg]&&_g(t,gg,{configurable:!0,get:function(){return this}})},pv=No,hv=On,fv=Zn,Ev=yg,mv=wg,_v=sS.set,Tv=kS,gv=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}},Sv=LS,vv=hS,yv=rp,Rv=MS,Av=ZS,Ov=$S,Iv="Promise",bv=Av.CONSTRUCTOR,Cv=Av.REJECTION_EVENT,Nv=yv.getterFor(Iv),wv=yv.set,Dv=Rv&&Rv.prototype,Pv=Rv,kv=Dv,Lv=av.TypeError,Mv=av.document,Uv=av.process,xv=Ov.f,Vv=xv,Fv=!!(Mv&&Mv.createEvent&&av.dispatchEvent),Bv="unhandledrejection",jv=function(e){var t;return!(!fv(e)||!hv(t=e.then))&&t},Wv=function(e,t){var r,i,n,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,d=e.reject,u=e.domain;try{a?(s||(2===t.rejection&&Yv(t),t.rejection=1),!0===a?r=o:(u&&u.enter(),r=a(o),u&&(u.exit(),n=!0)),r===e.promise?d(Lv("Promise-chain cycle")):(i=jv(r))?cv(i,r,c,d):c(r)):d(o)}catch(e){u&&!n&&u.exit(),d(e)}},Gv=function(e,t){e.notified||(e.notified=!0,Tv((function(){for(var r,i=e.reactions;r=i.get();)Wv(r,e);e.notified=!1,t&&!e.rejection&&Kv(e)})))},Hv=function(e,t,r){var i,n;Fv?((i=Mv.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),av.dispatchEvent(i)):i={promise:t,reason:r},!Cv&&(n=av["on"+e])?n(i):e===Bv&&gv("Unhandled promise rejection",r)},Kv=function(e){cv(_v,av,(function(){var t,r=e.facade,i=e.value;if(zv(e)&&(t=Sv((function(){sv?Uv.emit("unhandledRejection",i,r):Hv(Bv,r,i)})),e.rejection=sv||zv(e)?2:1,t.error))throw t.value}))},zv=function(e){return 1!==e.rejection&&!e.parent},Yv=function(e){cv(_v,av,(function(){var t=e.facade;sv?Uv.emit("rejectionHandled",t):Hv("rejectionhandled",t,e.value)}))},Xv=function(e,t,r){return function(i){e(t,i,r)}},Jv=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Gv(e,!0))},qv=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Lv("Promise can't be resolved itself");var i=jv(t);i?Tv((function(){var r={done:!1};try{cv(i,t,Xv(qv,r,e),Xv(Jv,r,e))}catch(t){Jv(r,t,e)}})):(e.value=t,e.state=1,Gv(e,!1))}catch(t){Jv({done:!1},t,e)}}};bv&&(kv=(Pv=function(e){Ev(this,kv),pv(e),cv(iv,this);var t=Nv(this);try{e(Xv(qv,t),Xv(Jv,t))}catch(e){Jv(t,e)}}).prototype,(iv=function(e){wv(this,{type:Iv,done:!1,notified:!1,parent:!1,reactions:new vv,rejection:!1,state:0,value:void 0})}).prototype=dv(kv,"then",(function(e,t){var r=Nv(this),i=xv(mv(this,Pv));return r.parent=!0,i.ok=!hv(e)||e,i.fail=hv(t)&&t,i.domain=sv?Uv.domain:void 0,0==r.state?r.reactions.add(i):Tv((function(){Wv(i,r)})),i.promise})),nv=function(){var e=new iv,t=Nv(e);this.promise=e,this.resolve=Xv(qv,t),this.reject=Xv(Jv,t)},Ov.f=xv=function(e){return e===Pv||undefined===e?new nv(e):Vv(e)}),ov({global:!0,constructor:!0,wrap:!0,forced:bv},{Promise:Pv}),uv(Pv,Iv,!1,!0),lv(Iv);var Qv=us("iterator"),Zv=!1;try{var $v=0,ey={next:function(){return{done:!!$v++}},return:function(){Zv=!0}};ey[Qv]=function(){return this},Array.from(ey,(function(){throw 2}))}catch(e){}var ty=MS,ry=function(e,t){if(!t&&!Zv)return!1;var r=!1;try{var i={};i[Qv]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},iy=ZS.CONSTRUCTOR||!ry((function(e){ty.all(e).then(void 0,(function(){}))})),ny=wn,oy=No,sy=$S,ay=LS,cy=YT;Ia({target:"Promise",stat:!0,forced:iy},{all:function(e){var t=this,r=sy.f(t),i=r.resolve,n=r.reject,o=ay((function(){var r=oy(t.resolve),o=[],s=0,a=1;cy(e,(function(e){var c=s++,d=!1;a++,ny(r,t,e).then((function(e){d||(d=!0,o[c]=e,--a||i(o))}),n)})),--a||i(o)}));return o.error&&n(o.value),r.promise}});var dy=Ia,uy=ZS.CONSTRUCTOR;MS&&MS.prototype,dy({target:"Promise",proto:!0,forced:uy,real:!0},{catch:function(e){return this.then(void 0,e)}});var ly=wn,py=No,hy=$S,fy=LS,Ey=YT;Ia({target:"Promise",stat:!0,forced:iy},{race:function(e){var t=this,r=hy.f(t),i=r.reject,n=fy((function(){var n=py(t.resolve);Ey(e,(function(e){ly(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var my=wn,_y=$S;Ia({target:"Promise",stat:!0,forced:ZS.CONSTRUCTOR},{reject:function(e){var t=_y.f(this);return my(t.reject,void 0,e),t.promise}});var Ty=ea,gy=Zn,Sy=$S,vy=function(e,t){if(Ty(e),gy(t)&&t.constructor===e)return t;var r=Sy.f(e);return(0,r.resolve)(t),r.promise},yy=Ia,Ry=MS,Ay=ZS.CONSTRUCTOR,Oy=vy,Iy=no("Promise"),by=!Ay;yy({target:"Promise",stat:!0,forced:true},{resolve:function(e){return Oy(by&&this===Iy?Ry:this,e)}});var Cy=wn,Ny=No,wy=$S,Dy=LS,Py=YT;Ia({target:"Promise",stat:!0,forced:iy},{allSettled:function(e){var t=this,r=wy.f(t),i=r.resolve,n=r.reject,o=Dy((function(){var r=Ny(t.resolve),n=[],o=0,s=1;Py(e,(function(e){var a=o++,c=!1;s++,Cy(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 ky=wn,Ly=No,My=no,Uy=$S,xy=LS,Vy=YT,Fy="No one promise resolved";Ia({target:"Promise",stat:!0,forced:iy},{any:function(e){var t=this,r=My("AggregateError"),i=Uy.f(t),n=i.resolve,o=i.reject,s=xy((function(){var i=Ly(t.resolve),s=[],a=0,c=1,d=!1;Vy(e,(function(e){var u=a++,l=!1;c++,ky(i,t,e).then((function(e){l||d||(d=!0,n(e))}),(function(e){l||d||(l=!0,s[u]=e,--c||o(new r(s,Fy)))}))})),--c||o(new r(s,Fy))}));return s.error&&o(s.value),i.promise}});var By=Ia,jy=MS,Wy=$i,Gy=no,Hy=On,Ky=wg,zy=vy,Yy=jy&&jy.prototype;By({target:"Promise",proto:!0,real:!0,forced:!!jy&&Wy((function(){Yy.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Ky(this,Gy("Promise")),r=Hy(e);return this.then(r?function(r){return zy(t,e()).then((function(){return r}))}:e,r?function(r){return zy(t,e()).then((function(){throw r}))}:e)}});var Xy=J($n.Promise);class Jy extends Fr{set _mediaStreamTrack(e){e!==this.mediaStreamTrack&&(this.safeEmit(Xc.TRACK_UPDATED,e),this.mediaStreamTrack=e)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),Vm(this,"trackMediaType",void 0),Vm(this,"_ID",void 0),Vm(this,"_rtpTransceiver",void 0),Vm(this,"_lowRtpTransceiver",void 0),Vm(this,"_hints",[]),Vm(this,"_isClosed",!1),Vm(this,"_originMediaStreamTrack",void 0),Vm(this,"mediaStreamTrack",void 0),Vm(this,"_external",{}),this._ID=t||oi(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,Vc(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||ri((()=>{var e;Yi.reportApiInvoke(null,{name:Gr.GET_MEDIA_STREAM_TRACK,options:[],tag:Hr.TRACER}).onSuccess((null===(e=this._mediaStreamTrack)||void 0===e?void 0:e.label)||"")}),this.mediaStreamTrack.id||this.getTrackId()),this._mediaStreamTrack}getRTCRtpTransceiver(e){return e===Kc.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,Fc(this),this.emit(Jc.CLOSED),this.removeAllListeners(Xc.SEI_RECEIVED)}_updateRtpTransceiver(e,t){if(t===Kc.LOW_STREAM){if(this._lowRtpTransceiver===e)return;this._lowRtpTransceiver=e}else{if(this._rtpTransceiver===e)return;this._rtpTransceiver=e}this.emit(Xc.TRANSCEIVER_UPDATED,e,t)}}class qy extends Jy{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),Vm(this,"_enabled",!0),Vm(this,"_muted",!1),Vm(this,"_isExternalTrack",!1),Vm(this,"_isClosed",!1),Vm(this,"_enabledMutex",void 0),Vm(this,"processor",void 0),Vm(this,"_processorContext",void 0),Vm(this,"_handleTrackEnded",(()=>{this.onTrackEnded()})),this._enabledMutex=new fi("".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,Fi.debug("[".concat(this.getTrackId(),"] close")),this.emit(Gc.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 Xr(this,Gc.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){Fi.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Jc.TRACK_ENDED)}stateCheck(e,t){if(Fi.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),wr(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new Nr(Cr.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print("error",Fi);if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new Nr(Cr.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print("error",Fi)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():Xy.resolve([])}}function Qy(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 Zy=window.AudioContext||window.webkitAudioContext;let $y=null;const eR=new class extends Fr{constructor(){super(...arguments),Vm(this,"prevState",void 0),Vm(this,"curState",void 0),Vm(this,"currentTime",void 0),Vm(this,"currentTimeStuckAt",void 0),Vm(this,"interruptDetectorTrack",void 0),Vm(this,"onLocalAudioTrackMute",(()=>{Fi.info("ios15-interruption-start"),this.emit(Zi.IOS_15_16_INTERRUPTION_START)})),Vm(this,"onLocalAudioTrackUnmute",(async()=>{Fi.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?Fi.info("ios15-interruption-end-canceled"):($y&&await $y.suspend(),this.emit(Zi.IOS_15_16_INTERRUPTION_END))}))}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){Fi.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){Fi.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 tR(){if(!Zy)return void Fi.error("your browser is not support web audio");Fi.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?Qy(Object(r),!0).forEach((function(t){Vm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qy(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},Ii("WEBAUDIO_INIT_OPTIONS"));Fi.debug("audio context init option:",JSON.stringify(e)),$y=new Zy(e),eR.curState=$y.state,$y.onstatechange=()=>{eR.prevState=eR.curState,eR.curState=$y?$y.state:void 0;const{prevState:e,curState:t}=eR,r="running"===t,i="interrupted"===t,n="running"===e,o="suspended"===e,s="interrupted"===e,a=ir().osVersion;(pr()||gr())&&n&&i&&(Fi.info("ios".concat(a,"-interruption-start")),eR.emit(Zi.IOS_INTERRUPTION_START)),(pr()||gr())&&(o||s)&&r&&(Fi.info("ios".concat(a,"-interruption-end")),eR.emit(Zi.IOS_INTERRUPTION_END)),e!==t&&eR.emit(Zi.STATE_CHANGE,t,e)},setInterval((()=>{var e;const t=null===(e=$y)||void 0===e?void 0:e.currentTime;if(eR.currentTime!==t)eR.currentTimeStuckAt&&(Fi.debug("AudioContext current time resume at ".concat(t)),eR.currentTimeStuckAt=void 0),eR.currentTime=t;else{if(t!==eR.currentTimeStuckAt){Yi.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:Hr.TRACER}).onSuccess(),Fi.warning("AudioContext current time stuck at ".concat(t))}eR.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):pr()||gr()?"suspended"===e.state&&(a(!0),t&&e.resume().then(d,d)):"closed"!==e.state&&(a(!0),t&&e.resume().then(d,d))}function a(e){if(i!==e){i=e;for(let r=0,i=t;r<i.length;r+=1){const t=i[r];e?window.addEventListener(t,u,{capture:!0,passive:!0}):window.removeEventListener(t,u,{capture:!0,passive:!0})}}}function c(){s(!0)}function d(){s(!1)}function u(){s(!0)}function l(e){if(!o)if(r.paused)if(e){let e;p(!1),o=!0;try{e=r.play(),e?e.then(h,h):(r.addEventListener("playing",h),r.addEventListener("abort",h),r.addEventListener("error",h))}catch(e){h()}}else p(!0);else 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,f,{capture:!0,passive:!0}):window.removeEventListener(t,f,{capture:!0,passive:!0})}}}function h(){r.removeEventListener("playing",h),r.removeEventListener("abort",h),r.removeEventListener("error",h),o=!1,l(!1)}function f(){l(!0)}if(pr()){const t=e.createMediaStreamDestination(),i=document.createElement("div");i.innerHTML="<audio x-webkit-airplay='deny'></audio>",r=i.children.item(0),r.controls=!1,r.disableRemotePlayback=!0,r.preload="auto",r.srcObject=t.stream,l(!0)}eR.on(Zi.STATE_CHANGE,c),s(!1)}($y)}function rR(){if(!$y){if(tR(),!$y)throw new Nr(Cr.NOT_SUPPORTED,"can not create audio context");return $y}return $y}function iR(){return!!$y}function nR(e){if(function(){if(null!==sR)return sR;const e=rR(),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(),sR=n,n}())return;const t=e.connect,r=e.disconnect;e.connect=(r,i,n)=>{var o;return e._inputNodes||(e._inputNodes=[]),Ac(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?Qr(e._inputNodes,i):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function oR(e){const t=rR();return new Xy(((r,i)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{i(new Nr(Cr.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let sR=null;let aR=null;function cR(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 dR=J(h_);class uR{constructor(){Vm(this,"context",void 0),Vm(this,"analyserNode",void 0),Vm(this,"sourceNode",void 0),this.context=rR(),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||pr()||gr()||"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=dR(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){Fi.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class lR extends Fr{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(),Vm(this,"outputNode",void 0),Vm(this,"outputTrack",void 0),Vm(this,"isPlayed",!1),Vm(this,"sourceNode",void 0),Vm(this,"context",void 0),Vm(this,"audioBufferNode",void 0),Vm(this,"destNode",void 0),Vm(this,"audioOutputLevel",0),Vm(this,"volumeLevelAnalyser",void 0),Vm(this,"_processedNode",void 0),Vm(this,"playNode",void 0),Vm(this,"isDestroyed",!1),Vm(this,"onNoAudioInput",void 0),Vm(this,"isNoAudioInput",!1),Vm(this,"_noAudioInputCount",0),this.context=rR(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),nR(this.outputNode),this.volumeLevelAnalyser=new uR}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(Zc.ON_AUDIO_BUFFER,cR(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!qi().webAudioMediaStreamDest)throw new Nr(Cr.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&&Zr((()=>{eR.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;pr()||gr()?"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 ni(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 pR extends lR{get isFreeze(){return!1}constructor(e,t,r){var i;if(super(),Vm(this,"sourceNode",void 0),Vm(this,"track",void 0),Vm(this,"clonedTrack",void 0),Vm(this,"audioElement",void 0),Vm(this,"isCurrentTrackCloned",!1),Vm(this,"isRemoteTrack",!1),Vm(this,"originVolumeLevelAnalyser",void 0),Vm(this,"rebuildWebAudio",(async()=>{if(Fi.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 Fi.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>Fi.info("resume success"))),Fi.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),nR(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),nR(this.outputNode),this.emit(Zc.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=t,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()})),"audio"!==e.kind)throw new Nr(Cr.UNEXPECTED_ERROR);this.track=e;const n=new MediaStream([this.track]);if(this.isRemoteTrack=!!t,this.sourceNode=this.context.createMediaStreamSource(n),nR(this.sourceNode),r){const e=r.clone();e.enabled=!0,this.clonedTrack=e,Fi.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]));nR(t),this.originVolumeLevelAnalyser=new uR,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=n;const o=ir();t&&o.os===Zt.IOS&&Number(null===(i=o.osVersion)||void 0===i?void 0:i.split(".")[0])<15&&(eR.on(Zi.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),nR(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(Zc.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),eR.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),Fi.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]));nR(r),this.originVolumeLevelAnalyser&&this.originVolumeLevelAnalyser.updateSource(r)}getOriginVolumeLevel(){return this.originVolumeLevelAnalyser?this.originVolumeLevelAnalyser.getVolumeLevel():this.getAccurateVolumeLevel()}}async function hR(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 fR(e,t){const r=await ER(e.mediaSource),{sourceId:i,audio:n}=await function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(((r,i)=>{const n=document.createElement("div");n.innerText="share screen",n.setAttribute("style","text-align: center; height: 25px; line-height: 25px; border-radius: 4px 4px 0 0; background: #D4D2D4; border-bottom: solid 1px #B9B8B9;");const o=document.createElement("div");o.setAttribute("style","width: 100%; height: 500px; padding: 15px 25px ; box-sizing: border-box;");const s=document.createElement("div");s.innerText="Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",s.setAttribute("style","height: 12%;");const a=document.createElement("div");a.setAttribute("style","width: 100%; height: 80%; background: #FFF; border: solid 1px #CBCBCB; display: flex; flex-wrap: wrap; justify-content: space-around; overflow-y: scroll; padding: 0 15px; box-sizing: border-box;");const c=document.createElement("div");c.setAttribute("style","display: flex; justify-content: space-between; padding: 16px 0;");const d=document.createElement("button");d.innerHTML="cancel",d.setAttribute("style","width: 85px;"),d.onclick=()=>{document.body.removeChild(p);const e=new Error("NotAllowedError");e.name="NotAllowedError",i(e)};let u=t;const l=document.createElement("div");if(t){const e=document.createElement("input");e.setAttribute("type","checkbox");const t=document.createElement("span");e.setAttribute("style","margin-right: 6px;"),t.innerText="Share audio",e.checked=u,e.onchange=()=>{u=e.checked},l.appendChild(e),l.appendChild(t)}c.appendChild(l),c.appendChild(d),o.appendChild(s),o.appendChild(a),o.appendChild(c);const p=document.createElement("div");p.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%);"),p.appendChild(n),p.appendChild(o),document.body.appendChild(p),e.map((e=>{if(e.id){const t=document.createElement("div");t.setAttribute("style","width: 30%; height: 160px; padding: 20px 0; text-align: center;box-sizing: content-box;");let i=e.thumbnail;try{const{width:e}=i.getSize();e>1920&&(i=i.resize({width:1920}))}catch(e){throw e&&e.message.startsWith("Illegal invocation")&&console.error("Operate thumbnail error, please try to set contextIsolation: false. (https://github.com/electron/electron/issues/34953)"),e}t.innerHTML='<div style="height: 120px; display: table-cell; vertical-align: middle;"><img style="width: 100%; background: #333333; box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.2);" src='+i.toDataURL()+' /></div><span style="\theight: 40px; line-height: 40px; display: inline-block; width: 70%; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">'+e.name.replace(/[\u00A0-\u9999<>\&]/g,(function(e){return"&#"+e.charCodeAt(0)+";"}))+"</span>",t.onclick=()=>{document.body.removeChild(p),r({sourceId:e.id,audio:u})},a.appendChild(t)}}))}))}(r,t);return await hR(i,e,n)}async function ER(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=Wr();if(!r)throw console.error("failed to fetch electron, please mount it to window"),new Nr(Cr.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 Xy(((e,i)=>{r.desktopCapturer.getSources({types:t},((t,r)=>{t?i(t):e(r)}))})));try{return await i}catch(e){throw new Nr(Cr.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.toString())}}function mR(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 _R=new fi("safari");async function TR(e,t){let r=0,i=null;for(;r<2;)try{i=await gR(e,t,r>0);break}catch(e){if(e instanceof Nr)throw Fi.error("[".concat(t,"] ").concat(e.toString())),e;const i=SR(e.name||e.code||e,e.message);if(i.code===Cr.MEDIA_OPTION_INVALID){Fi.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await ni(500);continue}throw Fi.error("[".concat(t,"] ").concat(i.toString())),i}if(!i)throw new Nr(Cr.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return i}async function gR(t,r,i){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Nr(Cr.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=qi(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return Fi.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(Br())if(t.screen.sourceId){vR(o,await hR(t.screen.sourceId,t.screen,t.screenAudio))}else{vR(o,await fR(t.screen,t.screenAudio))}else if(cr()&&t.screen.extensionId&&t.screen.mandatory){if(!n.getStreamFromExtension)throw new Nr(Cr.NOT_SUPPORTED,"This browser does not support screen sharing");Fi.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new Xy(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return Fi.error("[".concat(c,"] No response from Chrome Plugin. Plugin not installed properly"),r),void t(new Nr(Cr.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){Fi.error("[".concat(c,"] AgoraRTC screensharing plugin is not accessible(").concat(a,")"),e.toString()),t(new Nr(Cr.CHROME_PLUGIN_NOT_INSTALL))}})));t.screen.mandatory.chromeMediaSourceId=e;vR(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(n.getDisplayMedia){var s;t.screen.mediaSource&&Wc(t.screen.mediaSource);const e={width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate,displaySurface:null!==(s=t.screen.displaySurface)&&void 0!==s?s:"screen"===t.screen.mediaSource?"monitor":t.screen.mediaSource},{selfBrowserSurface:i,surfaceSwitching:n,systemAudio:a}=t.screen,c={selfBrowserSurface:i,surfaceSwitching:n,systemAudio:a};!i&&delete c.selfBrowserSurface,!n&&delete c.surfaceSwitching,!a&&delete c.systemAudio,Fi.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:!!t.screenAudio,controls:c}));const d=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mR(Object(r),!0).forEach((function(t){Vm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:!!t.screenAudio},c));vR(o,d)}else{if(!lr())throw Fi.error("[".concat(r,"] This browser does not support screenSharing")),new Nr(Cr.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&Wc(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};Fi.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));vR(o,await navigator.mediaDevices.getUserMedia(e))}}var a,c;if(!t.video&&!t.audio)return o;let d={video:t.video,audio:t.audio},u=Ii("MEDIA_DEVICE_CONSTRAINTS");if(u)try{"string"==typeof u&&(u=JSON.parse(u)),d=ui(d,u)}catch(e){}Fi.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(d)),ir();let l,p=null;(dr()||pr()||ar())&&(p=await _R.lock());try{l=await navigator.mediaDevices.getUserMedia(d)}catch(e){throw p&&p(),e}return d.audio&&(e.HAS_GUM_AUDIO=!0),d.video&&(e.HAS_GUM_VIDEO=!0),vR(o,l),p&&p(),o}function SR(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new Nr(Cr.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new Nr(Cr.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new Nr(Cr.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new Nr(Cr.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new Nr(Cr.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new Nr(Cr.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return Fi.error("getUserMedia unexpected error",e),new Nr(Cr.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function vR(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 yR extends Fr{get state(){return this._state}set state(e){e!==this._state&&(this.emit(ad.STATE_CHANGE,e),this._state=e)}constructor(){super(),Vm(this,"_state",sd.IDLE),Vm(this,"isAccessMicrophonePermission",!1),Vm(this,"isAccessCameraPermission",!1),Vm(this,"lastAccessMicrophonePermission",!1),Vm(this,"lastAccessCameraPermission",!1),Vm(this,"checkdeviceMatched",!1),Vm(this,"deviceInfoMap",new Map),this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(Ii("ENUMERATE_DEVICES_INTERVAL")||(Rr()||or()===Zt.HARMONY_OS)&&yr())&&this.updateDevicesInfo()}),Ii("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>Fi.error(e.toString())))}async enumerateDevices(t,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){return new Nr(Cr.NOT_SUPPORTED,"enumerateDevices() not supported.").throw()}const n=await navigator.mediaDevices.enumerateDevices(),o=this.checkMediaDeviceInfoIsOk(n);let s=!this.isAccessMicrophonePermission&&t,a=!this.isAccessCameraPermission&&r;o.audio&&(s=!1),o.video&&(a=!1);let c=null,d=null,u=null;if(!i&&(s||a)){if(_R.isLocked){Fi.debug("[device manager] wait GUM lock");(await _R.lock())(),Fi.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),Fi.debug("[device manager] check media device permissions",t,r,s,a),s&&a){try{u=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(e){const t=SR(e.name||e.code||e,e.message);if(t.code===Cr.PERMISSION_DENIED)throw t;Fi.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=SR(e.name||e.code||e,e.message);if(t.code===Cr.PERMISSION_DENIED)throw t;Fi.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{d=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=SR(e.name||e.code||e,e.message);if(t.code===Cr.PERMISSION_DENIED)throw t;Fi.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}Fi.debug("[device manager] mic permission",t,"cam permission",r)}try{const e=await navigator.mediaDevices.enumerateDevices();return c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null,e}catch(e){c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null;return new Nr(Cr.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 Nr(Cr.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=sd.INITING;try{await this.updateDevicesInfo(),this.state=sd.INITEND}catch(e){if(Fi.warning("Device Detection functionality cannot start properly.",e.toString()),this.state=sd.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname)){new Nr(Cr.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.").throw()}throw e}}async updateDevicesInfo(){const e=await this.enumerateDevices(!0,!0,!0),t=Date.now(),r=[];if(e[0]&&e[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const t=e.find((e=>"audioinput"===e.kind&&"default"===e.deviceId)),r=e.find((e=>"audiooutput"===e.kind&&"default"===e.deviceId));t&&r?r.groupId===t.groupId?Fi.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):Fi.warning("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):Fi.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!==sd.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(ad.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(ad.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(ad.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 RR=new yR;let AR=!1;const OR=new class extends Fr{constructor(){super(...arguments),Vm(this,"onAutoplayFailed",void 0),Vm(this,"onAudioAutoplayFailed",void 0)}};function IR(){if(ir(),!AR){const e=t=>{t.preventDefault(),AR=!1,Ar()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};AR=!0,Ar()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),Fi.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),OR.onAutoplayFailed?OR.onAutoplayFailed():OR.onAudioAutoplayFailed?Fi.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 ."):Fi.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 ."),OR.emit("autoplay-failed")}}function bR(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 CR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bR(Object(r),!0).forEach((function(t){Vm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function NR(e,t,r,i){if(!e)return;const n=Yi.getBaseInfoBySessionId(e);if(!n)return;const o=n.info,s=Date.now(),a=CR(CR({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-n.startTime,cbRegistered:OR.onAutoplayFailed||OR.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:i,extend:void 0});Yi.send({type:Gi.AUTOPLAY_FAILED,data:a},!0)}const wR=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],DR=new class{constructor(){Vm(this,"onAutoplayFailed",void 0),Vm(this,"elementMap",new Map),Vm(this,"elementStateMap",new Map),Vm(this,"elementsNeedToResume",[]),Vm(this,"sinkIdMap",new Map),Vm(this,"autoResumeAfterInterruption",(e=>{Array.from(this.elementMap.entries()).forEach((t=>{let[r,i]=t;const n=this.elementStateMap.get(r),o=i.srcObject.getAudioTracks()[0],s=o&&o.readyState;if(Fi.debug("resume after interrupted, ele: ".concat(n," audio: ").concat(s," ").concat(e)),"live"===s){if(e)return i.pause(),void i.play();if("running"===eR.curState)return mr()?(i.pause(),void i.play()):void(n&&"paused"===n&&i.play())}}))})),Vm(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let[t,r]=e;const i=r.srcObject.getAudioTracks()[0];i&&"live"===i.readyState&&(Fi.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))})),this.autoResumeAudioElement(),eR.on(Zi.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),eR.on(Zi.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),eR.on(Zi.STATE_CHANGE,(()=>{pr()&&"suspended"===eR.prevState&&"running"===eR.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 Nr(Cr.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,cd.INIT),this.setVolume(t,r);const o=this.sinkIdMap.get(t);if(o)try{n.setSinkId(o).catch((e=>{Fi.warning("[".concat(t,"] set sink id failed"),e.toString())}))}catch(e){Fi.warning("[".concat(t,"] set sink id failed"),e.toString())}const s=n.play();s&&s.then&&s.catch((e=>{i&&NR(i,"audio",e.message,t),Fi.warning("audio element play warning",e.toString()),this.elementMap.has(t)&&"NotAllowedError"===e.name&&(Fi.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(n),Zr((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),IR()})))}))}updateTrack(e,t){const r=this.elementMap.get(e);r&&(r.srcObject=new MediaStream([t]))}isPlaying(e){return this.elementMap.has(e)&&"playing"===this.elementStateMap.get(e)}setVolume(e,t){const r=this.elementMap.get(e);r&&(t=Math.max(0,Math.min(100,t)),r.volume=t/100)}stop(e){const t=this.elementMap.get(e);if(this.sinkIdMap.delete(e),!t)return;const r=this.elementsNeedToResume.indexOf(t);this.elementsNeedToResume.splice(r,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}bindAudioElementEvents(e,t){wR.forEach((r=>{t.addEventListener(r,(r=>{const i=this.elementStateMap.get(e),n="pause"===r.type?"paused":r.type;if(Fi.debug("[".concat(e,"] audio-element-status change ").concat(i," => ").concat(n)),"error"===r.type){const r=null==t?void 0:t.error;r&&Fi.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=>{Fi.debug("Auto resume audio element success")})).catch((e=>{Fi.warning("Auto resume audio element failed!",e)}))})),this.elementsNeedToResume=[]};new Promise((e=>{document.body?e():window.addEventListener("load",(()=>e()))})).then((()=>{Ar()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function PR(){return function(e,t,r){const i=r.value;return"function"==typeof i&&(r.value=function(){this._isClosed&&new Nr(Cr.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",Fi);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 Xy?new Xy(((e,t)=>{n.then(e).catch(t)})):n}),r}}var kR=za("Array").values,LR=ac,MR=qo,UR=an,xR=kR,VR=Array.prototype,FR={DOMTokenList:!0,NodeList:!0},BR=J((function(e){var t=e.values;return e===VR||UR(VR,e)&&t===VR.values||MR(FR,LR(e))?xR:t}));function jR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function WR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jR(Object(r),!0).forEach((function(t){Vm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class GR extends Fr{constructor(e){super(),Vm(this,"name","VideoProcessorDestination"),Vm(this,"ID","0"),Vm(this,"_source",void 0),Vm(this,"videoContext",void 0),Vm(this,"inputTrack",void 0),this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new Nr(Cr.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new Nr(Cr.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(nd.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(nd.ON_TRACK,void 0)}}class HR extends Fr{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),Vm(this,"constraintsMap",new Map),Vm(this,"statsRegistry",[]),Vm(this,"usageRegistry",[]),Vm(this,"trackId",void 0),Vm(this,"direction",void 0),Vm(this,"_chained",!1),this.trackId=e,this.direction=t}async getConstraints(){return await Yr(this,od.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return Fi.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),Xr(this,od.REQUEST_UPDATE_CONSTRAINTS,Array.from(BR(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return Fi.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),Xr(this,od.REQUEST_UPDATE_CONSTRAINTS,Array.from(BR(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const{processorID:t,processorName:r,type:i,cb:n}of this.statsRegistry)try{const o=n();e.push({processorID:t,processorName:r,type:i,stats:o})}catch(e){Fi.error(new Nr(Cr.UNEXPECTED_ERROR,e.message))}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const{cb:t}of this.usageRegistry)try{let r=t();r instanceof Xy&&(r=await r),e.push(WR(WR({},r),{},{direction:this.direction}))}catch(e){Fi.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class KR extends Fr{constructor(e){super(),Vm(this,"name","AudioProcessorDestination"),Vm(this,"ID","0"),Vm(this,"inputTrack",void 0),Vm(this,"inputNode",void 0),Vm(this,"audioProcessorContext",void 0),Vm(this,"_source",void 0),this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new Nr(Cr.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new Nr(Cr.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(nd.ON_TRACK,void 0),this.emit(nd.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(nd.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.audioProcessorContext.chained=!0,this.inputNode=e.node,this.emit(nd.ON_NODE,this.inputNode))}}class zR extends Fr{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),Vm(this,"constraintsMap",new Map),Vm(this,"statsRegistry",[]),Vm(this,"audioContext",void 0),Vm(this,"trackId",void 0),Vm(this,"direction",void 0),Vm(this,"usageRegistry",[]),Vm(this,"_chained",!1),this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return Yr(this,od.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return Fi.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),Xr(this,od.REQUEST_UPDATE_CONSTRAINTS,Array.from(BR(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),Xr(this,od.REQUEST_UPDATE_CONSTRAINTS,Array.from(BR(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const{processorID:t,processorName:r,type:i,cb:n}of this.statsRegistry)try{const o=n();e.push({processorID:t,processorName:r,type:i,stats:o})}catch(e){Fi.error(new Nr(Cr.UNEXPECTED_ERROR,e.message))}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const{cb:t}of this.usageRegistry)try{let r=t();r instanceof Xy&&(r=await r),e.push(WR(WR({},r),{},{direction:this.direction}))}catch(e){Fi.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class YR extends Fr{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),Vm(this,"context",void 0),Vm(this,"processSourceNode",void 0),Vm(this,"outputTrack",void 0),Vm(this,"processedNode",void 0),Vm(this,"clonedTrack",void 0),Vm(this,"outputNode",void 0),this.outputNode=new XR}setVolume(){}createOutputTrack(){throw new Nr(Cr.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 XR{disconnect(){}connect(){}}function JR(e){return new Xy(((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=pr()?"canplay":"playing";n.addEventListener(o,(()=>{const e=n.videoWidth,r=n.videoHeight;!e&&lr()||(i=!0,n.srcObject=null,n.remove(),t([e,r]))})),n.srcObject=new MediaStream([e]),n.play().catch(si),setTimeout((()=>{i||(n.srcObject=null,n.remove(),t([n.videoWidth,n.videoHeight]))}),4e3)}))}function qR(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=Pc(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!Sr()&&r.frameRate&&(t.frameRate=r.frameRate),ur()&&"object"==typeof t.frameRate&&(t.frameRate.max=60),lr()&&(t.frameRate={ideal:30,max:30}),t}function QR(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&cr()&&(t.extensionId=e.extensionId);const{displaySurface:r,selfBrowserSurface:i,surfaceSwitching:n,systemAudio:o}=e;(hr(107)||fr(107)||Er(93))&&(r&&(Dr(r,"displaySurface",["browser","window","monitor"]),t.displaySurface=r),i?(Dr(i,"selfBrowserSurface",["exclude","include"]),t.selfBrowserSurface=i):t.selfBrowserSurface="include",n&&(Dr(n,"surfaceSwitching",["exclude","include"]),t.surfaceSwitching=n)),(hr(105)||fr(105)||Er(91))&&o&&(Dr(o,"systemAudio",["exclude","include"]),t.systemAudio=o),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const s=e.encoderConfig?kc(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:s?s.width:void 0,maxHeight:s?s.height:void 0},s&&(s.frameRate&&("number"==typeof s.frameRate?(t.mandatory.maxFrameRate=s.frameRate,t.mandatory.minFrameRate=s.frameRate):(t.mandatory.maxFrameRate=s.frameRate.max||s.frameRate.ideal||s.frameRate.exact||void 0,t.mandatory.minFrameRate=s.frameRate.min||s.frameRate.ideal||s.frameRate.exact||void 0),t.frameRate=s.frameRate),s.width&&(t.width=s.width),s.height&&(t.height=s.height)),t}function ZR(e){const t={};if(Sr()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,cr()&&e.ANS&&(t.googHighpassFilter=e.ANS))),e.encoderConfig){const r=Uc(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),Rr()&&(t.sampleRate=void 0),t}function $R(e,t,r,i,n){const o=Ii("BITRATE_ADAPTER_TYPE");if("DEFAULT_BITRATE"===o)return{min:i,max:n};if(void 0===n){var s;const a=Math.floor(200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75));n="STANDARD_BITRATE"===o?4*a:2*a,i=null!==(s=i)&&void 0!==s?s:a}else{var a;i=null!==(a=i)&&void 0!==a?a:Math.floor(n/10)}return{min:i,max:n}}function eA(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 tA=async(e,t,r)=>{const i=function(e){const t=[];for(let r=0;r<e.length;r+=2)t.push(parseInt(e.slice(r,r+2),16));return Uint8Array.from(t)}(function(e){const t="0123456789abcdef";function r(e){let r,i="";for(r=0;r<=3;r++)i+=t.charAt(e>>8*r+4&15)+t.charAt(e>>8*r&15);return i}function i(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function n(e,t,r,n,o,s){return i(function(e,t){return e<<t|e>>>32-t}(i(i(t,e),i(n,s)),o),r)}function o(e,t,r,i,o,s,a){return n(t&r|~t&i,e,t,o,s,a)}function s(e,t,r,i,o,s,a){return n(t&i|r&~i,e,t,o,s,a)}function a(e,t,r,i,o,s,a){return n(t^r^i,e,t,o,s,a)}function c(e,t,r,i,o,s,a){return n(r^(t|~i),e,t,o,s,a)}const d=function(e){let t;const r=1+(e.length+8>>6),i=new Array(16*r);for(t=0;t<16*r;t++)i[t]=0;for(t=0;t<e.length;t++)i[t>>2]|=e.charCodeAt(t)<<t%4*8;return i[t>>2]|=128<<t%4*8,i[16*r-2]=8*e.length,i}(e);let u,l,p,h,f,E=1732584193,m=-271733879,_=-1732584194,T=271733878;for(u=0;u<d.length;u+=16)l=E,p=m,h=_,f=T,E=o(E,m,_,T,d[u+0],7,-680876936),T=o(T,E,m,_,d[u+1],12,-389564586),_=o(_,T,E,m,d[u+2],17,606105819),m=o(m,_,T,E,d[u+3],22,-1044525330),E=o(E,m,_,T,d[u+4],7,-176418897),T=o(T,E,m,_,d[u+5],12,1200080426),_=o(_,T,E,m,d[u+6],17,-1473231341),m=o(m,_,T,E,d[u+7],22,-45705983),E=o(E,m,_,T,d[u+8],7,1770035416),T=o(T,E,m,_,d[u+9],12,-1958414417),_=o(_,T,E,m,d[u+10],17,-42063),m=o(m,_,T,E,d[u+11],22,-1990404162),E=o(E,m,_,T,d[u+12],7,1804603682),T=o(T,E,m,_,d[u+13],12,-40341101),_=o(_,T,E,m,d[u+14],17,-1502002290),m=o(m,_,T,E,d[u+15],22,1236535329),E=s(E,m,_,T,d[u+1],5,-165796510),T=s(T,E,m,_,d[u+6],9,-1069501632),_=s(_,T,E,m,d[u+11],14,643717713),m=s(m,_,T,E,d[u+0],20,-373897302),E=s(E,m,_,T,d[u+5],5,-701558691),T=s(T,E,m,_,d[u+10],9,38016083),_=s(_,T,E,m,d[u+15],14,-660478335),m=s(m,_,T,E,d[u+4],20,-405537848),E=s(E,m,_,T,d[u+9],5,568446438),T=s(T,E,m,_,d[u+14],9,-1019803690),_=s(_,T,E,m,d[u+3],14,-187363961),m=s(m,_,T,E,d[u+8],20,1163531501),E=s(E,m,_,T,d[u+13],5,-1444681467),T=s(T,E,m,_,d[u+2],9,-51403784),_=s(_,T,E,m,d[u+7],14,1735328473),m=s(m,_,T,E,d[u+12],20,-1926607734),E=a(E,m,_,T,d[u+5],4,-378558),T=a(T,E,m,_,d[u+8],11,-2022574463),_=a(_,T,E,m,d[u+11],16,1839030562),m=a(m,_,T,E,d[u+14],23,-35309556),E=a(E,m,_,T,d[u+1],4,-1530992060),T=a(T,E,m,_,d[u+4],11,1272893353),_=a(_,T,E,m,d[u+7],16,-155497632),m=a(m,_,T,E,d[u+10],23,-1094730640),E=a(E,m,_,T,d[u+13],4,681279174),T=a(T,E,m,_,d[u+0],11,-358537222),_=a(_,T,E,m,d[u+3],16,-722521979),m=a(m,_,T,E,d[u+6],23,76029189),E=a(E,m,_,T,d[u+9],4,-640364487),T=a(T,E,m,_,d[u+12],11,-421815835),_=a(_,T,E,m,d[u+15],16,530742520),m=a(m,_,T,E,d[u+2],23,-995338651),E=c(E,m,_,T,d[u+0],6,-198630844),T=c(T,E,m,_,d[u+7],10,1126891415),_=c(_,T,E,m,d[u+14],15,-1416354905),m=c(m,_,T,E,d[u+5],21,-57434055),E=c(E,m,_,T,d[u+12],6,1700485571),T=c(T,E,m,_,d[u+3],10,-1894986606),_=c(_,T,E,m,d[u+10],15,-1051523),m=c(m,_,T,E,d[u+1],21,-2054922799),E=c(E,m,_,T,d[u+8],6,1873313359),T=c(T,E,m,_,d[u+15],10,-30611744),_=c(_,T,E,m,d[u+6],15,-1560198380),m=c(m,_,T,E,d[u+13],21,1309151649),E=c(E,m,_,T,d[u+4],6,-145523070),T=c(T,E,m,_,d[u+11],10,-1120210379),_=c(_,T,E,m,d[u+2],15,718787259),m=c(m,_,T,E,d[u+9],21,-343485551),E=i(E,l),m=i(m,p),_=i(_,h),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))},rA=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new Xy(((r,i)=>{t.toBlob((async e=>{if(t.remove(),e){const i=await iA(e);r({buffer:i,width:t.width,height:t.height})}else i(new Nr(Cr.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},iA=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function nA(e,t){if("VideoFrame"in window&&"TransformStream"in window&&qi().supportWebRTCInsertableStream){const r=new MediaStreamTrackProcessor(e),i=new MediaStreamTrackGenerator({kind:"video"});let n,o,s=Date.now();const a=()=>{c&&(clearInterval(c),c=void 0),n&&(n.close(),n=void 0),e.stop(),o=void 0,i.removeEventListener("ended",a)};let c=window.setInterval((()=>{if(o&&n&&Date.now()-s>(null!=t?t:1e3))try{"live"===i.readyState?o.enqueue(n.clone()):a()}catch(e){a()}}),null!=t?t:1e3);const d=new TransformStream({transform:(e,t)=>{"live"===i.readyState?(o=t,s=Date.now(),void 0===n?(n=e,t.enqueue(e.clone())):(t.enqueue(n),n=e)):e.close()}});return i.addEventListener("ended",a),r.readable.pipeThrough(d).pipeTo(i.writable),i}}var oA,sA,aA,cA,dA,uA,lA,pA,hA,fA,EA,mA,_A,TA,gA,SA,vA,yA,RA,AA,OA,IA,bA,CA,NA,wA,DA,PA,kA,LA,MA,UA,xA,VA,FA,BA,jA,WA,GA,HA;function KA(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 zA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?KA(Object(r),!0).forEach((function(t){Vm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let YA=(oA=zi({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),sA=zi({argsMap:(e,t)=>[e.getTrackId(),t]}),aA=PR(),cA=Ei("LocalAudioTrack","_enabledMutex"),dA=zi({argsMap:(e,t)=>[e.getTrackId(),t]}),uA=PR(),lA=Ei("LocalAudioTrack","_enabledMutex"),pA=zi({argsMap:(e,t)=>[e.getTrackId(),t]}),hA=PR(),fA=PR(),EA=PR(),mA=zi({argsMap:e=>[e.getTrackId()]}),_A=PR(),TA=zi({argsMap:e=>[e.getTrackId()]}),gA=PR(),SA=zi({argsMap:e=>[e.getTrackId()]}),vA=zi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),yA=zi({argsMap:e=>[e.getTrackId()]}),RA=class extends qy{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?DR.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,i){super(e,r),Vm(this,"trackMediaType",Qc.AUDIO),Vm(this,"_encoderConfig",void 0),Vm(this,"_trackSource",void 0),Vm(this,"_enabled",!0),Vm(this,"_volume",100),Vm(this,"_useAudioElement",!0),Vm(this,"_bypassWebAudio",!1),Vm(this,"processor",void 0),Vm(this,"_processorContext",void 0),Vm(this,"_processorDestination",void 0),Vm(this,"_getOriginVolumeLevel",void 0),this._encoderConfig=t,this._getOriginVolumeLevel=!!i,this._trackSource=new YR,Ii("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),Ii("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);dr()&&!iR()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(e){Pr(e,"volume",0,1e3),this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&DR.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void Fi.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,Xr(this,Gc.NEED_REPLACE_TRACK,this).then((()=>{Fi.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{Fi.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||!Qi())throw new Nr(Cr.NOT_SUPPORTED,"your browser does not support setting the audio output device");await DR.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(Fi.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await Xr(this,Gc.NEED_ENABLE_TRACK,this),Fi.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success"))}catch(e){throw r||(this._enabled=!1),Fi.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await Xr(this,Gc.NEED_DISABLE_TRACK,this)}catch(e){throw r||(this._enabled=!0),Fi.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,Fi.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await Xr(this,Gc.NEED_MUTE_TRACK,this):await Xr(this,Gc.NEED_UNMUTE_TRACK,this))}getStats(){ri((()=>{Fi.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const e=Jr(this,Gc.GET_STATS);return e||zA({},ed)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(Zc.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Zc.ON_AUDIO_BUFFER),this._source.on(Zc.ON_AUDIO_BUFFER,(t=>e(t)))}play(){Fi.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(Fi.debug("[".concat(this.getTrackId(),"] start audio playback in element")),DR.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){Fi.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?DR.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];Fi.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&DR.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 Xr(this,Gc.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(e))}renewMediaStreamTrack(e){return Xy.resolve(void 0)}pipe(e){if(this._bypassWebAudio)throw new Nr(Cr.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new Nr(Cr.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(nd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e),await Xr(this,Gc.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await Xr(this,Gc.NEED_REPLACE_TRACK,this))})),e.on(nd.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(e){e.removeAllListeners(nd.ON_TRACK),e.removeAllListeners(nd.ON_NODE)}bindProcessorContextEvents(e){e.on(od.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(e){e.removeAllListeners(od.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof YR&&(this._trackSource=new pR(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const e=new zR(this._source.context,this.getTrackId(),"local"),t=new KR(e);return this._processorContext=e,this._processorDestination=t,this.bindProcessorContextEvents(e),this.bindProcessorDestinationEvents(t),this._source.on(Zc.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:e})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(DR.stop(this.getTrackId()),this._source.play()),Xr(this,Gc.NEED_REPLACE_MIXING_TRACK,this).then((()=>{Fi.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{Fi.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:e,processorDestination:t}}},G_(RA.prototype,"setVolume",[oA],Object.getOwnPropertyDescriptor(RA.prototype,"setVolume"),RA.prototype),G_(RA.prototype,"setPlaybackDevice",[sA,aA],Object.getOwnPropertyDescriptor(RA.prototype,"setPlaybackDevice"),RA.prototype),G_(RA.prototype,"setEnabled",[cA,dA,uA],Object.getOwnPropertyDescriptor(RA.prototype,"setEnabled"),RA.prototype),G_(RA.prototype,"setMuted",[lA,pA,hA],Object.getOwnPropertyDescriptor(RA.prototype,"setMuted"),RA.prototype),G_(RA.prototype,"getStats",[fA],Object.getOwnPropertyDescriptor(RA.prototype,"getStats"),RA.prototype),G_(RA.prototype,"setAudioFrameCallback",[EA],Object.getOwnPropertyDescriptor(RA.prototype,"setAudioFrameCallback"),RA.prototype),G_(RA.prototype,"play",[mA,_A],Object.getOwnPropertyDescriptor(RA.prototype,"play"),RA.prototype),G_(RA.prototype,"stop",[TA,gA],Object.getOwnPropertyDescriptor(RA.prototype,"stop"),RA.prototype),G_(RA.prototype,"close",[SA],Object.getOwnPropertyDescriptor(RA.prototype,"close"),RA.prototype),G_(RA.prototype,"pipe",[vA],Object.getOwnPropertyDescriptor(RA.prototype,"pipe"),RA.prototype),G_(RA.prototype,"unpipe",[yA],Object.getOwnPropertyDescriptor(RA.prototype,"unpipe"),RA.prototype),RA),XA=(AA=zi({argsMap:(e,t)=>[e.getTrackId(),t]}),OA=PR(),IA=Ei("MicrophoneAudioTrack","_enabledMutex"),bA=zi({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),CA=PR(),NA=zi({argsMap:e=>[e.getTrackId()]}),wA=class extends YA{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,i){super(e,t.encoderConfig?Uc(t.encoderConfig):{},i,Ii("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),Vm(this,"_config",void 0),Vm(this,"_deviceName","default"),Vm(this,"_constraints",void 0),Vm(this,"_originalConstraints",void 0),Vm(this,"_enabled",!0),this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),(mr()||_r())&&eR.bindInterruptDetectorTrack(this)}async setDevice(e){if(Fi.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await RR.getDeviceById(e),r={};r.audio=zA({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let i=null;try{i=await TR(r,this.getTrackId())}catch(e){throw Fi.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await TR({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 Fi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await RR.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw Fi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Fi.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(e,t,r){if(t)return Fi.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(Fi.info("[".concat(this.getTrackId(),"] start setEnabled"),e),Ii("AUTO_RESET_AUDIO_ROUTE")&&(pr()||gr())){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 Xr(this,Gc.NEED_DISABLE_TRACK,this)}catch(e){throw Fi.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const n=zA({},this._constraints),o=RR.searchDeviceIdByName(this._deviceName);o&&!n.deviceId&&(n.deviceId=o);try{r||(this._enabled=!0);const e=await TR({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await Xr(this,Gc.NEED_ENABLE_TRACK,this)}catch(e){throw r||(this._enabled=!1),Fi.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}Fi.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(mr()||_r())&&eR.unbindInterruptDetectorTrack(this)}onTrackEnded(){if((pr()||gr())&&this._enabled&&!this._isClosed&&eR.duringInterruption){const e=async()=>{eR.off(Zi.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Fi.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};eR.on(Zi.IOS_INTERRUPTION_END,e)}else Fi.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Jc.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=RR.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await TR({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(e){super.bindProcessorContextEvents(e),e.on(od.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(od.REQUEST_UPDATE_CONSTRAINTS)}},G_(wA.prototype,"setDevice",[AA,OA],Object.getOwnPropertyDescriptor(wA.prototype,"setDevice"),wA.prototype),G_(wA.prototype,"setEnabled",[IA,bA,CA],Object.getOwnPropertyDescriptor(wA.prototype,"setEnabled"),wA.prototype),G_(wA.prototype,"close",[NA],Object.getOwnPropertyDescriptor(wA.prototype,"close"),wA.prototype),wA),JA=(DA=zi({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),PA=PR(),kA=zi({argsMap:e=>[e.getTrackId()]}),LA=PR(),MA=zi({argsMap:e=>[e.getTrackId()]}),UA=PR(),xA=zi({argsMap:e=>[e.getTrackId()]}),VA=PR(),FA=zi({argsMap:e=>[e.getTrackId()]}),BA=PR(),jA=zi({argsMap:e=>[e.getTrackId()]}),WA=zi({argsMap:e=>[e.getTrackId()]}),GA=PR(),G_((HA=class extends YA{get __className__(){return"BufferSourceAudioTrack"}constructor(e,t,r,i){super(t.createOutputTrack(),r,i),Vm(this,"source",void 0),Vm(this,"_bufferSource",void 0),this._useAudioElement=!1,this.source=e,this._bufferSource=t,this._bufferSource.on(Zc.AUDIO_SOURCE_STATE_CHANGE,(e=>{this.safeEmit(Jc.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){Pr(e,"speed",0),this._bufferSource.setAudioBufferPlaybackSpeed(e)}}).prototype,"startProcessAudioBuffer",[DA,PA],Object.getOwnPropertyDescriptor(HA.prototype,"startProcessAudioBuffer"),HA.prototype),G_(HA.prototype,"pauseProcessAudioBuffer",[kA,LA],Object.getOwnPropertyDescriptor(HA.prototype,"pauseProcessAudioBuffer"),HA.prototype),G_(HA.prototype,"seekAudioBuffer",[MA,UA],Object.getOwnPropertyDescriptor(HA.prototype,"seekAudioBuffer"),HA.prototype),G_(HA.prototype,"resumeProcessAudioBuffer",[xA,VA],Object.getOwnPropertyDescriptor(HA.prototype,"resumeProcessAudioBuffer"),HA.prototype),G_(HA.prototype,"stopProcessAudioBuffer",[FA,BA],Object.getOwnPropertyDescriptor(HA.prototype,"stopProcessAudioBuffer"),HA.prototype),G_(HA.prototype,"close",[jA],Object.getOwnPropertyDescriptor(HA.prototype,"close"),HA.prototype),G_(HA.prototype,"setAudioBufferPlaybackSpeed",[WA,GA],Object.getOwnPropertyDescriptor(HA.prototype,"setAudioBufferPlaybackSpeed"),HA.prototype),HA);class qA extends YA{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=rR().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,oi(8,"track-mix-")),Vm(this,"trackList",void 0),Vm(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)?(Fi.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):Fi.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){Fi.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}Qr(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 qA?t.emit(Xc.TRANSCEIVER_UPDATED,e):t._updateRtpTransceiver(e)})))}}class QA extends lR{set currentState(e){e!==this._currentState&&(this._currentState=e,this.safeEmit(Zc.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(),Vm(this,"audioBuffer",void 0),Vm(this,"sourceNode",void 0),Vm(this,"startPlayTime",0),Vm(this,"startPlayOffset",0),Vm(this,"pausePlayTime",0),Vm(this,"options",void 0),Vm(this,"currentLoopCount",0),Vm(this,"currentPlaybackSpeed",100),Vm(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):Fi.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 ZA=new Map;function $A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function eO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$A(Object(r),!0).forEach((function(t){Vm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class tO{get rendFrameRate(){if(this.renderStats&&this.renderStats.curTs!==this.renderStats.lastTs){const e=this.renderStats.curTs-this.renderStats.lastTs,t=(this.renderStats.renderNum-this.renderStats.lastRenderNum)/e;return this.renderStats.lastRenderNum=this.renderStats.renderNum,this.renderStats.lastTs=this.renderStats.curTs,t}return 0}get videoElementStatus(){return this._videoElementStatus}set videoElementStatus(e){e!==this._videoElementStatus&&(Fi.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){Vm(this,"trackId",void 0),Vm(this,"config",void 0),Vm(this,"onFirstVideoFrameDecoded",void 0),Vm(this,"onVideoStateChanged",void 0),Vm(this,"freezeTimeCounterList",[]),Vm(this,"renderFreezeAccTime",0),Vm(this,"isKeepLastFrame",!1),Vm(this,"timeUpdatedCount",0),Vm(this,"freezeTime",0),Vm(this,"playbackTime",0),Vm(this,"lastTimeUpdatedTime",0),Vm(this,"autoplayFailed",!1),Vm(this,"videoTrack",void 0),Vm(this,"videoElement",void 0),Vm(this,"cacheVideoElement",void 0),Vm(this,"renderStats",void 0),Vm(this,"_videoState",dd.VideoStateStopped),Vm(this,"videoElementCheckInterval",void 0),Vm(this,"videoElementFreezeTimeout",void 0),Vm(this,"_videoElementStatus",cd.NONE),Vm(this,"isGettingVideoDimensions",!1),Vm(this,"startGetVideoDimensions",(()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return Fi.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()})),Vm(this,"autoResumeAfterInterruption",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===eR.curState&&(Fi.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(sr())),Tr()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),Vm(this,"handleVideoEvents",(e=>{switch(e.type){case"play":case"playing":this.startGetVideoDimensions(),this.videoElementStatus=cd.PLAYING;break;case"loadeddata":if(this.videoState=dd.VideoStateStarting,this.onFirstVideoFrameDecoded&&this.onFirstVideoFrameDecoded(),this.cacheVideoElement){try{this.cacheVideoElement.srcObject=null,this.cacheVideoElement.remove()}catch(e){}this.cacheVideoElement=void 0}break;case"canplay":this.videoElementStatus=cd.CANPLAY;break;case"stalled":this.videoElementStatus=cd.STALLED;break;case"suspend":this.videoElementStatus=cd.SUSPEND;break;case"pause":this.videoElementStatus=cd.PAUSED,pr()||gr()||dr()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(Fi.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=cd.WAITING;break;case"abort":this.videoElementStatus=cd.ABORT;break;case"ended":this.videoElementStatus=cd.ENDED;break;case"emptied":this.videoElementStatus=cd.EMPTIED;break;case"error":{const e=this.videoElement.error;e?(this.videoElementStatus=cd.ERROR,Fi.error("[".concat(this.trackId,"] media error: ").concat(e.message," (").concat(e.code,")"))):Fi.debug("[".concat(this.trackId,"] media not been an error."));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,cI.lastVisibleTime<cI.lastHiddenTime||r<cI.lastHiddenTime||r<cI.lastVisibleTime)return;for(t>Ii("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}}})),Vm(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(Fi.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(sr())),Tr()?(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"),eR.on(Zi.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),eR.on(Zi.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&&NR(e,"video",t.message,this.trackId),"NotAllowedError"===t.name?(Fi.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):Fi.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=ir();if(("Safari"===r.name&&15===Number(r.version)||mr())&&t&&t.then){const e=()=>{this.config.mirror&&(this.videoElement.style.transform="rotateY(180deg)")};t.then(e).catch(e)}}getCurrentFrame(){const e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;const t=e.getContext("2d");if(!t)return Fi.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 Xy(((i,n)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await iA(e);i({buffer:t,width:r.width,height:r.height})}else n(new Nr(Cr.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,t<0?.1:t>1?1:t)}))):await rA(e)}destroy(){this.renderStats=void 0,eR.off(Zi.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),eR.off(Zi.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=dd.VideoStateStopped}initVideoElement(){if(this.videoElementStatus=cd.INIT,!this.videoElementCheckInterval&&(rO.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{(function(e){return e!==document.body&&document.body.contains(e)})(this.videoElement)||(this.videoElementStatus=cd.DESTROYED)}),1e3),Ii("ENABLE_VIDEO_FRAME_CALLBACK"))){var e,t;let r;const i=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",i),this.videoElementFreezeTimeout=window.setTimeout(n,Ii("VIDEO_FREEZE_DURATION")))},n=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===dd.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=dd.VideoStateFrozen:document.addEventListener("visibilitychange",i))},o=(e,t)=>{if(this.videoElementStatus===cd.PLAYING){if(this.renderStats?(this.renderStats.renderNum++,this.renderStats.curTs=t.mediaTime):this.renderStats={lastTs:t.mediaTime,curTs:t.mediaTime,lastRenderNum:0,renderNum:0},r){const e=t.presentationTime-r.presentationTime;this.videoState===dd.VideoStateStarting&&(this.videoState=dd.VideoStateDecoding),this.videoState===dd.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(n,Ii("VIDEO_FREEZE_DURATION"))),e<Ii("VIDEO_FREEZE_DURATION")&&this.videoState===dd.VideoStateFrozen&&(this.videoState=dd.VideoStateDecoding),e>Ii("VIDEO_FREEZE_DURATION")&&cI.lastVisibleTime>=cI.lastHiddenTime&&r.timestamp>cI.lastVisibleTime&&r.timestamp>cI.lastHiddenTime&&(this.renderFreezeAccTime+=e)}r=eO(eO({},t),{},{timestamp:e})}var i,s;Ii("ENABLE_VIDEO_FRAME_CALLBACK")&&(null===(i=(s=this.videoElement).requestVideoFrameCallback)||void 0===i||i.call(s,o))};null===(e=(t=this.videoElement).requestVideoFrameCallback)||void 0===e||e.call(t,o)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),Rr()&&!Ii("HIDE_NO_POSTER")&&(this.videoElement.poster="noposter");const r=ir();if("Safari"===r.name&&15===Number(r.version)||mr()||!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,lr()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,lr()&&this.videoElement.load();const i=this.videoElement.play();void 0!==i&&i.catch((e=>{Fi.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){rO.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.videoElementStatus=cd.NONE}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{Fi.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{Fi.error(e)})),this.autoplayFailed=!1,Ar()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};Ar()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),IR()}}const rO=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class iO extends tO{constructor(e){super(e),Vm(this,"container",void 0),Vm(this,"slot",void 0),this.slot=e.element,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;t!==this.slot&&(this.destroy(),this.slot=t),this.createElements()}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}play(e){var t;null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)&&super.play(e)}getCurrentFrame(){var e;return null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)?super.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameToUint8Array(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)?await super.getCurrentFrameToUint8Array(e,r):await rA(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{this.container.remove(),this.slot.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",Ii("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),this.slot.appendChild(this.container)}mountedVideoElement(){var e;!this.container||null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)||this.container.appendChild(this.videoElement),super.initVideoElement(),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.left="0",this.videoElement.style.top="0"}unmountedVideoElement(){var e;if(null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)){super.resetVideoElement();try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=document.createElement("video")}}resetVideoElement(){var e;null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)&&(super.resetVideoElement(),this.cacheVideoElement=this.videoElement,this.videoElement=document.createElement("video"))}getContainerElement(){return this.container}}var nO,oO,sO,aO,cO,dO,uO,lO,pO,hO,fO,EO,mO,_O,TO,gO,SO,vO,yO,RO,AO,OO,IO,bO,CO,NO,wO,DO,PO,kO,LO,MO,UO,xO;function VO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function FO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?VO(Object(r),!0).forEach((function(t){Vm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):VO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let BO=(nO=zi({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),oO=PR(),sO=zi({argsMap:e=>[e.getTrackId()]}),aO=Ei("LocalVideoTrack","_enabledMutex"),cO=zi({argsMap:(e,t)=>[e.getTrackId(),t]}),dO=PR(),uO=Ei("LocalVideoTrack","_enabledMutex"),lO=zi({argsMap:(e,t)=>[e.getTrackId(),t]}),pO=PR(),hO=zi({argsMap:(e,t)=>[e.getTrackId(),t]}),fO=PR(),EO=PR(),mO=zi({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),_O=PR(),TO=PR(),gO=PR(),SO=PR(),vO=PR(),yO=PR(),RO=PR(),AO=zi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),OO=zi({argsMap:e=>[e.getTrackId()]}),IO=zi({argsMap:e=>[e.getTrackId()]}),bO=zi({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),CO=class e extends qy{get videoHeight(){if(dr()){const{height:e}=this._mediaStreamTrack.getSettings();return this._videoHeight=e,this._videoHeight}return this._videoHeight}get videoWidth(){if(dr()){const{width:e}=this._mediaStreamTrack.getSettings();return this._videoWidth=e,this._videoWidth}return this._videoWidth}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==cd.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),Vm(this,"trackMediaType",Qc.VIDEO),Vm(this,"_player",void 0),Vm(this,"isUseScaleResolutionDownBy",!1),Vm(this,"_videoVisibleTimer",null),Vm(this,"_previousVideoVisibleStatus",void 0),Vm(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),Vm(this,"_encoderConfig",void 0),Vm(this,"_scalabilityMode",{numSpatialLayers:1,numTemporalLayers:1}),Vm(this,"_optimizationMode",void 0),Vm(this,"_videoHeight",void 0),Vm(this,"_videoWidth",void 0),Vm(this,"_forceBitrateLimit",void 0),Vm(this,"_enabled",!0),Vm(this,"_processorDestination",void 0),Vm(this,"_processorContext",void 0),dr()){const{width:t,height:r}=e.getSettings();this._videoWidth=t,this._videoHeight=r}else this.updateMediaStreamTrackResolution();if(this._encoderConfig=t,this._scalabilityMode=r,this._optimizationMode=i,this._hints=o||[],-1===this._hints.indexOf(Hc.SCREEN_TRACK))this.updateBitrateFromProfile();else if(function(e,t,r){const i=ir();return!(i.name!==e||!i.osVersion)&&(r?Number(i.version)>=t&&Number(i.version)<=r:Number(i.version)===t)}($t.CHROME,115)&&-1!==or().indexOf("Windows")){const t=nA(e);t&&(Fi.info("local screen video track begin to inject frame"),this._mediaStreamTrack=t)}t&&-1!==this._hints.indexOf(Hc.CUSTOM_TRACK)&&this.setEncoderConfiguration(t),this._processorContext=new HR(this.getTrackId(),"local"),this._processorDestination=new GR(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:(Fi.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Fi.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=FO(FO(FO({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new tO(r):this._player=new iO(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(Jc.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),Ii("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,Fi.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Fi.info("[".concat(this.getTrackId(),"] start setEnabled"),e),!e){this._originMediaStreamTrack.enabled=!1;try{await Xr(this,Gc.NEED_DISABLE_TRACK,this)}catch(e){throw Fi.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return t||(this._enabled=!1),void Fi.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await Xr(this,Gc.NEED_ENABLE_TRACK,this)}catch(e){throw Fi.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}Fi.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,Fi.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await Xr(this,Gc.NEED_MUTE_TRACK,this):await Xr(this,Gc.NEED_UNMUTE_TRACK,this))}async setEncoderConfiguration(e,t){if(!this._enabled)throw new Nr(Cr.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");if(e=Pc(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),e.width||e.height||e.frameRate){const t=qR({encoderConfig:e});(dr()||pr()||gr())&&(t.deviceId=void 0),Fi.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 Nr(Cr.UNEXPECTED_ERROR,e.toString());throw Fi.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=e,-1===this._hints.indexOf(Hc.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Xr(this,Gc.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Fi)}}getStats(){ri((()=>{Fi.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const e=Jr(this,Gc.GET_STATS);return e||FO({},td)}async setBeautyEffect(e){Fi.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 rA(e)}async setBitrateLimit(e){if(Fi.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);try{await Xr(this,Gc.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Fi)}}}async setOptimizationMode(e){if("motion"!==e&&"detail"!==e&&"balanced"!==e)return void Fi.error(Cr.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const t=this._optimizationMode;try{this._optimizationMode=e,await Xr(this,Gc.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=t,Fi.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}Fi.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return Fi.error(Cr.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,Fi.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){JR(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(si)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}async setSenderConfiguration(e){if(!this._enabled)throw new Nr(Cr.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");Fi.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(e)),e=Pc(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(Hc.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Xr(this,Gc.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Fi)}}updateBitrateFromProfile(){if(!this._encoderConfig)return;const{width:e,height:t,frameRate:r}=this.getMediaStreamTrackSettings();if(!e||!t||!r)return;const{bitrateMax:i,bitrateMin:n}=this._encoderConfig;if(null==n||null==i){const{max:o,min:s}=$R(e,t,r,n,i);this._encoderConfig.bitrateMin=s,this._encoderConfig.bitrateMax=o,Fi.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(e,", h: ").concat(t,", fps: ").concat(r,"] => [brMax: ").concat(o,", brMin: ").concat(s,"]"))}}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),i={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},{element:n,slot:o}=i;if(this.isPlaying&&n instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=xr.checkOneElementVisible(n),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Yi.reportApiInvoke(null,{tag:Hr.TRACER,name:Gr.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 Nr(Cr.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}pipe(e){if(this.processor===e)return e;if(e._source)throw new Nr(Cr.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=FO(FO({},i),Pc(t))),i=ei(i);const n=oi(8,"track-video-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,i,ei(this._scalabilityMode),this._optimizationMode,n,ei(this._hints));return t&&i&&o.setEncoderConfiguration(i),Fi.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 Nr(Cr.INVALID_PARAMS,"track should be an instance of MediaStreamTrack");if("video"!==e.kind)throw new Nr(Cr.INVALID_PARAMS,"track should be a video MediaStreamTrack");await this._updateOriginMediaStreamTrack(e,t,!0),this.updateMediaStreamTrackResolution()}sendSeiData(e){if(ri((()=>{Yi.reportApiInvoke(null,{name:Gr.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:Hr.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!Ii("ENABLE_VIDEO_SEI")||!Ii("ENABLE_ENCODED_TRANSFORM"))return void Fi.warning('To send/receive SEI, please call AgoraRTC.setParameter("ENABLE_VIDEO_SEI", true) before instantiate IAgoraRtcClient');if(e instanceof Uint8Array==!1)return new Nr(Cr.INVALID_PARAMS,"Invalid argument type, ILocalVideoTrack.sendSeiData() only accept Uint8Array argument.").throw();const t=this.getRTCRtpTransceiver();if(!t)return void Fi.warning("Video track is not published, SEI can not be send");const r=t.sender.getParameters();if(0===r.codecs.length)return;const i=r.codecs[0].mimeType.toLocaleLowerCase();"video/h264"===i?this.safeEmit("sei-to-send",e):Fi.warning("SEI is not supported by ".concat(i))}bindProcessorDestinationEvents(){this.processorDestination.on(nd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await Xr(this,Gc.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await Xr(this,Gc.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(nd.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(od.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(od.REQUEST_CONSTRAINTS)}},G_(CO.prototype,"play",[nO,oO],Object.getOwnPropertyDescriptor(CO.prototype,"play"),CO.prototype),G_(CO.prototype,"stop",[sO],Object.getOwnPropertyDescriptor(CO.prototype,"stop"),CO.prototype),G_(CO.prototype,"setEnabled",[aO,cO,dO],Object.getOwnPropertyDescriptor(CO.prototype,"setEnabled"),CO.prototype),G_(CO.prototype,"setMuted",[uO,lO,pO],Object.getOwnPropertyDescriptor(CO.prototype,"setMuted"),CO.prototype),G_(CO.prototype,"setEncoderConfiguration",[hO,fO],Object.getOwnPropertyDescriptor(CO.prototype,"setEncoderConfiguration"),CO.prototype),G_(CO.prototype,"getStats",[EO],Object.getOwnPropertyDescriptor(CO.prototype,"getStats"),CO.prototype),G_(CO.prototype,"setBeautyEffect",[mO,_O],Object.getOwnPropertyDescriptor(CO.prototype,"setBeautyEffect"),CO.prototype),G_(CO.prototype,"getCurrentFrameData",[TO],Object.getOwnPropertyDescriptor(CO.prototype,"getCurrentFrameData"),CO.prototype),G_(CO.prototype,"getCurrentFrameImage",[gO],Object.getOwnPropertyDescriptor(CO.prototype,"getCurrentFrameImage"),CO.prototype),G_(CO.prototype,"setBitrateLimit",[SO],Object.getOwnPropertyDescriptor(CO.prototype,"setBitrateLimit"),CO.prototype),G_(CO.prototype,"setOptimizationMode",[vO],Object.getOwnPropertyDescriptor(CO.prototype,"setOptimizationMode"),CO.prototype),G_(CO.prototype,"setScalabiltyMode",[yO],Object.getOwnPropertyDescriptor(CO.prototype,"setScalabiltyMode"),CO.prototype),G_(CO.prototype,"updateMediaStreamTrackResolution",[RO],Object.getOwnPropertyDescriptor(CO.prototype,"updateMediaStreamTrackResolution"),CO.prototype),G_(CO.prototype,"pipe",[AO],Object.getOwnPropertyDescriptor(CO.prototype,"pipe"),CO.prototype),G_(CO.prototype,"unpipe",[OO],Object.getOwnPropertyDescriptor(CO.prototype,"unpipe"),CO.prototype),G_(CO.prototype,"close",[IO],Object.getOwnPropertyDescriptor(CO.prototype,"close"),CO.prototype),G_(CO.prototype,"replaceTrack",[bO],Object.getOwnPropertyDescriptor(CO.prototype,"replaceTrack"),CO.prototype),CO),jO=(NO=zi({argsMap:(e,t)=>[e.getTrackId(),t]}),wO=PR(),DO=Ei("CameraVideoTrack","_enabledMutex"),PO=zi({argsMap:(e,t)=>[e.getTrackId(),t]}),kO=PR(),LO=zi({argsMap:(e,t)=>[e.getTrackId(),t]}),MO=PR(),UO=zi({argsMap:e=>[e.getTrackId()]}),xO=class e extends BO{get __className__(){return"CameraVideoTrack"}constructor(e,t,r,i,n,o){super(e,Pc(t.encoderConfig),i,n,o),Vm(this,"_config",void 0),Vm(this,"_originalConstraints",void 0),Vm(this,"_constraints",void 0),Vm(this,"_enabled",!0),Vm(this,"_deviceName","default"),Vm(this,"tryResumeVideoForIOS15_16WeChat",(async()=>{!mr()&&!_r()||function(){const e=ir();if(e.os!==Zt.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()||ir().name!==$t.WECHAT||!this._enabled||this._isClosed||(Fi.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=Pc(this._config.encoderConfig),eR.on(Zi.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),eR.on(Zi.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(Fi.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await RR.getDeviceById(e),r={};r.video=FO({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let i=null;try{i=await TR(r,this.getTrackId())}catch(e){throw Fi.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await TR({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 Fi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await RR.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw Fi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Fi.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){Fi.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:FO(FO({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await TR(t,this.getTrackId())}catch(t){throw Fi.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await TR({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=FO({},t.video),Fi.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Fi.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await TR({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await Xr(this,Gc.NEED_ENABLE_TRACK,this)}catch(e){throw Fi.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),Fi.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 Xr(this,Gc.NEED_DISABLE_TRACK,this)}catch(e){throw Fi.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}Fi.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new Nr(Cr.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");e=Pc(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate||e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate||e.bitrateMin);const r=$r(this._config);r.encoderConfig=e;const i=qR(r);(dr()||pr()||gr())&&(i.deviceId=void 0),Fi.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 Nr(Cr.UNEXPECTED_ERROR,e.toString());throw Fi.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(Hc.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Xr(this,Gc.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Fi)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((pr()||gr())&&this._enabled&&!this._isClosed&&eR.duringInterruption){const e=async()=>{eR.off(Zi.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Fi.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};eR.on(Zi.IOS_INTERRUPTION_END,e)}else Fi.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Jc.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=RR.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await TR({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),eR.off(Zi.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),eR.off(Zi.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this._encoderConfig;t&&(i=FO(FO({},i),Pc(t))),i=ei(i);const n=oi(8,"track-cam-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,ei(FO(FO({},this._config),{},{encoderConfig:i})),ei(this._constraints),ei(this._scalabilityMode),this._optimizationMode,n);return t&&i&&o.setEncoderConfiguration(i),Fi.debug("clone track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(r)),o}bindProcessorContextEvents(){this.processorContext.on(od.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(od.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}},G_(xO.prototype,"setDevice",[NO,wO],Object.getOwnPropertyDescriptor(xO.prototype,"setDevice"),xO.prototype),G_(xO.prototype,"setEnabled",[DO,PO,kO],Object.getOwnPropertyDescriptor(xO.prototype,"setEnabled"),xO.prototype),G_(xO.prototype,"setEncoderConfiguration",[LO,MO],Object.getOwnPropertyDescriptor(xO.prototype,"setEncoderConfiguration"),xO.prototype),G_(xO.prototype,"close",[UO],Object.getOwnPropertyDescriptor(xO.prototype,"close"),xO.prototype),xO);function WO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function GO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?WO(Object(r),!0).forEach((function(t){Vm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function HO(e,t,r,i){r.optimizationMode&&(i&&i.width&&i.height?(r.encoderConfig=GO(GO({},i),{},{bitrateMin:i.bitrateMin,bitrateMax:i.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?Fi.debug("[".concat(e,"] set content hint to"),r.optimizationMode):Fi.debug("[".concat(e,"] set content hint failed")))):Fi.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}var KO,zO,YO,XO,JO,qO,QO,ZO,$O,eI,tI,rI;function iI(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 nI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?iI(Object(r),!0).forEach((function(t){Vm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):iI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class oI extends Jy{getUserId(){return this._userId}constructor(e,t,r,i){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(i.clientId,"_").concat(oi(5,""))),Vm(this,"_userId",void 0),Vm(this,"_uintId",void 0),Vm(this,"_isDestroyed",!1),Vm(this,"store",void 0),Vm(this,"processor",void 0),Vm(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,Fi.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}let sI=(KO=zi({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),zO=zi({argsMap:e=>[e.getTrackId()]}),YO=zi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),XO=zi({argsMap:e=>[e.getTrackId()]}),JO=class extends oI{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==cd.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,i){super(e,t,r,i),Vm(this,"_videoVisibleTimer",null),Vm(this,"_previousVideoVisibleStatus",void 0),Vm(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),Vm(this,"trackMediaType",Qc.VIDEO),Vm(this,"_videoWidth",void 0),Vm(this,"_videoHeight",void 0),Vm(this,"_player",void 0),Vm(this,"processorDestination",void 0),Vm(this,"processorContext",void 0),this.updateMediaStreamTrackResolution(),this.processorContext=new HR(this.getTrackId(),"remote"),this.processorDestination=new GR(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){ri((()=>{Fi.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return Jr(this,Gc.GET_STATS)||nI({},id)}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:(Fi.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Fi.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=nI(nI({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new tO(r):this._player=new iO(r),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(qc.FIRST_FRAME_DECODED)},this._player.onVideoStateChanged=e=>{this.safeEmit(qc.VIDEO_STATE_CHANGED,e)}),this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(qc.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),Ii("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,Fi.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){JR(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(si)}_updatePlayerSource(){Fi.debug("[".concat(this.getTrackId(),"] update player source track")),this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),i={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},{element:n,slot:o}=i;if(this.isPlaying&&n instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=xr.checkOneElementVisible(n),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Yi.reportApiInvoke(null,{tag:Hr.TRACER,name:Gr.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 Nr(Cr.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}pipe(e){if(this.processor===e)return e;if(e._source)throw new Nr(Cr.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(nd.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(nd.ON_TRACK)}_destroy(){super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(e){this.emit(Xc.SEI_RECEIVED,e)}},G_(JO.prototype,"play",[KO],Object.getOwnPropertyDescriptor(JO.prototype,"play"),JO.prototype),G_(JO.prototype,"stop",[zO],Object.getOwnPropertyDescriptor(JO.prototype,"stop"),JO.prototype),G_(JO.prototype,"pipe",[YO],Object.getOwnPropertyDescriptor(JO.prototype,"pipe"),JO.prototype),G_(JO.prototype,"unpipe",[XO],Object.getOwnPropertyDescriptor(JO.prototype,"unpipe"),JO.prototype),JO),aI=(qO=zi({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),QO=zi({argsMap:(e,t)=>[e.getTrackId(),t]}),ZO=zi({argsMap:e=>[e.getTrackId()]}),$O=zi({argsMap:e=>[e.getTrackId()]}),eI=zi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),tI=zi({argsMap:e=>[e.getTrackId()]}),rI=class extends oI{get isPlaying(){return this._useAudioElement?DR.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(e,t,r,i){super(e,t,r,i),Vm(this,"trackMediaType",Qc.AUDIO),Vm(this,"_source",void 0),Vm(this,"_useAudioElement",!0),Vm(this,"_volume",100),Vm(this,"processorContext",void 0),Vm(this,"processorDestination",void 0),Vm(this,"_played",!1),Vm(this,"_bypassWebAudio",!1),Ii("DISABLE_WEBAUDIO")?(this._source=new YR,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new pR(e,!0),Ii("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(Zc.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(qc.FIRST_FRAME_DECODED)})),this.processorContext=new zR(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new KR(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(Zc.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(Zc.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Zc.ON_AUDIO_BUFFER),this._source.on(Zc.ON_AUDIO_BUFFER,(t=>e(t)))}setVolume(e){this._volume=e,this._useAudioElement?DR.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!Qi())throw new Nr(Cr.NOT_SUPPORTED,"your browser does not support setting the audio output device");await DR.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getStats(){ri((()=>{Fi.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return Jr(this,Gc.GET_STATS)||nI({},rd)}play(){Fi.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement?(Fi.debug("[".concat(this.getTrackId(),"] use audio element to play")),DR.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):this._source.play()}stop(){Fi.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?DR.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];Fi.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&DR.updateTrack(this.getTrackId(),this._mediaStreamTrack)}pipe(e){if(this._bypassWebAudio)throw new Nr(Cr.NOT_SUPPORTED,"can not pipe extension when WebAudio disabled");if(this.processor===e)return e;if(e._source)throw new Nr(Cr.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 Nr(Cr.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(nd.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(nd.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(nd.ON_TRACK),this.processorDestination.removeAllListeners(nd.ON_NODE)}},G_(rI.prototype,"setVolume",[qO],Object.getOwnPropertyDescriptor(rI.prototype,"setVolume"),rI.prototype),G_(rI.prototype,"setPlaybackDevice",[QO],Object.getOwnPropertyDescriptor(rI.prototype,"setPlaybackDevice"),rI.prototype),G_(rI.prototype,"play",[ZO],Object.getOwnPropertyDescriptor(rI.prototype,"play"),rI.prototype),G_(rI.prototype,"stop",[$O],Object.getOwnPropertyDescriptor(rI.prototype,"stop"),rI.prototype),G_(rI.prototype,"pipe",[eI],Object.getOwnPropertyDescriptor(rI.prototype,"pipe"),rI.prototype),G_(rI.prototype,"unpipe",[tI],Object.getOwnPropertyDescriptor(rI.prototype,"unpipe"),rI.prototype),rI);const cI=new class extends Fr{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),Vm(this,"_lastHiddenTime",0),Vm(this,"_lastVisibleTime",0),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),Fi.debug("document visibility went ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}};class dI extends Fr{constructor(e,t){super(),Vm(this,"trackMediaType",Qc.DATA),Vm(this,"_version",1),Vm(this,"_type",3),Vm(this,"_config",void 0),Vm(this,"_originDataChannel",void 0),Vm(this,"_dataStreamPacketHeader",new ArrayBuffer(4)),Vm(this,"_dataStreamPacketHandler",{serialize:e=>e,deserialize:e=>e}),Vm(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 Ii("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 Xy(((e,t)=>{if(this._originDataChannel){"open"===this._originDataChannel.readyState&&e();const r=setTimeout((()=>{var e;t(new Nr(Cr.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 Nr(Cr.DATACHANNEL_CONNECTION_TIMEOUT)}}else t(new Nr(Cr.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),[ud.OPEN,ud.CLOSE,ud.ERROR].forEach((t=>{const r=()=>{this.emit(t)};this._datachannelEventMap.set(t,r),e.addEventListener(t,r)}))}_unbindDataChannelEvents(e){Array.from(this._datachannelEventMap.entries()).forEach((t=>{let[r,i]=t;e.removeEventListener(r,i)})),this._datachannelEventMap.clear()}}var uI=$i,lI=us("iterator"),pI=!uI((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2"),i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),r.delete("a",2),!e.toJSON||!r.has("a",1)||r.has("a",2)||!t.size&&true||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[lI]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==i||"x"!==new URL("http://x",void 0).host})),hI=fl,fI=sl,EI=Math.floor,mI=function(e,t){var r=e.length,i=EI(r/2);return r<8?_I(e,t):TI(e,mI(fI(e,0,i),t),mI(fI(e,i),t),t)},_I=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},TI=function(e,t,r,i){for(var n=t.length,o=r.length,s=0,a=0;s<n||a<o;)e[s+a]=s<n&&a<o?i(t[s],r[a])<=0?t[s++]:r[a++]:s<n?t[s++]:r[a++];return e},gI=Ia,SI=dn,vI=wn,yI=sn,RI=bn,AI=pI,OI=fl,II=ml,bI=function(e,t,r){for(var i in t)r&&r.unsafe&&e[i]?e[i]=t[i]:hI(e,i,t[i],r);return e},CI=Bl,NI=$f,wI=rp,DI=yg,PI=On,kI=qo,LI=Xs,MI=ac,UI=ea,xI=Zn,VI=uc,FI=qu,BI=xn,jI=NT,WI=yT,GI=Pg,HI=mI,KI=us("iterator"),zI="URLSearchParams",YI=zI+"Iterator",XI=wI.set,JI=wI.getterFor(zI),qI=wI.getterFor(YI),QI=Object.getOwnPropertyDescriptor,ZI=function(e){if(!RI)return SI[e];var t=QI(SI,e);return t&&t.value},$I=ZI("fetch"),eb=ZI("Request"),tb=ZI("Headers"),rb=eb&&eb.prototype,ib=tb&&tb.prototype,nb=SI.RegExp,ob=SI.TypeError,sb=SI.decodeURIComponent,ab=SI.encodeURIComponent,cb=yI("".charAt),db=yI([].join),ub=yI([].push),lb=yI("".replace),pb=yI([].shift),hb=yI([].splice),fb=yI("".split),Eb=yI("".slice),mb=/\+/g,_b=Array(4),Tb=function(e){return _b[e-1]||(_b[e-1]=nb("((?:%[\\da-f]{2}){"+e+"})","gi"))},gb=function(e){try{return sb(e)}catch(t){return e}},Sb=function(e){var t=lb(e,mb," "),r=4;try{return sb(t)}catch(e){for(;r;)t=lb(t,Tb(r--),gb);return t}},vb=/[!'()~]|%20/g,yb={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Rb=function(e){return yb[e]},Ab=function(e){return lb(ab(e),vb,Rb)},Ob=NI((function(e,t){XI(this,{type:YI,iterator:jI(JI(e).entries),kind:t})}),"Iterator",(function(){var e=qI(this),t=e.kind,r=e.iterator.next(),i=r.value;return r.done||(r.value="keys"===t?i.key:"values"===t?i.value:[i.key,i.value]),r}),!0),Ib=function(e){this.entries=[],this.url=null,void 0!==e&&(xI(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===cb(e,0)?Eb(e,1):e:VI(e)))};Ib.prototype={type:zI,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,s,a,c=WI(e);if(c)for(r=(t=jI(e,c)).next;!(i=vI(r,t)).done;){if(o=(n=jI(UI(i.value))).next,(s=vI(o,n)).done||(a=vI(o,n)).done||!vI(o,n).done)throw ob("Expected sequence with length 2");ub(this.entries,{key:VI(s.value),value:VI(a.value)})}else for(var d in e)kI(e,d)&&ub(this.entries,{key:d,value:VI(e[d])})},parseQuery:function(e){if(e)for(var t,r,i=fb(e,"&"),n=0;n<i.length;)(t=i[n++]).length&&(r=fb(t,"="),ub(this.entries,{key:Sb(pb(r)),value:Sb(db(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],ub(r,Ab(e.key)+"="+Ab(e.value));return db(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var bb=function(){DI(this,Cb);var e=XI(this,new Ib(arguments.length>0?arguments[0]:void 0));RI||(this.size=e.entries.length)},Cb=bb.prototype;if(bI(Cb,{append:function(e,t){var r=JI(this);GI(arguments.length,2),ub(r.entries,{key:VI(e),value:VI(t)}),RI||this.length++,r.updateURL()},delete:function(e){for(var t=JI(this),r=GI(arguments.length,1),i=t.entries,n=VI(e),o=r<2?void 0:arguments[1],s=void 0===o?o:VI(o),a=0;a<i.length;){var c=i[a];if(c.key!==n||void 0!==s&&c.value!==s)a++;else if(hb(i,a,1),void 0!==s)break}RI||(this.size=i.length),t.updateURL()},get:function(e){var t=JI(this).entries;GI(arguments.length,1);for(var r=VI(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){var t=JI(this).entries;GI(arguments.length,1);for(var r=VI(e),i=[],n=0;n<t.length;n++)t[n].key===r&&ub(i,t[n].value);return i},has:function(e){for(var t=JI(this).entries,r=GI(arguments.length,1),i=VI(e),n=r<2?void 0:arguments[1],o=void 0===n?n:VI(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=JI(this);GI(arguments.length,1);for(var i,n=r.entries,o=!1,s=VI(e),a=VI(t),c=0;c<n.length;c++)(i=n[c]).key===s&&(o?hb(n,c--,1):(o=!0,i.value=a));o||ub(n,{key:s,value:a}),RI||(this.size=n.length),r.updateURL()},sort:function(){var e=JI(this);HI(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=JI(this).entries,i=LI(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 Ob(this,"keys")},values:function(){return new Ob(this,"values")},entries:function(){return new Ob(this,"entries")}},{enumerable:!0}),OI(Cb,KI,Cb.entries,{name:"entries"}),OI(Cb,"toString",(function(){return JI(this).serialize()}),{enumerable:!0}),RI&&II(Cb,"size",{get:function(){return JI(this).entries.length},configurable:!0,enumerable:!0}),CI(bb,zI),gI({global:!0,constructor:!0,forced:!AI},{URLSearchParams:bb}),!AI&&PI(tb)){var Nb=yI(ib.has),wb=yI(ib.set),Db=function(e){if(xI(e)){var t,r=e.body;if(MI(r)===zI)return t=e.headers?new tb(e.headers):new tb,Nb(t,"content-type")||wb(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),FI(e,{body:BI(0,VI(r)),headers:BI(0,t)})}return e};if(PI($I)&&gI({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return $I(e,arguments.length>1?Db(arguments[1]):{})}}),PI(eb)){var Pb=function(e){return DI(this,rb),new eb(e,arguments.length>1?Db(arguments[1]):{})};rb.constructor=Pb,Pb.prototype=rb,gI({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Pb})}}var kb,Lb={URLSearchParams:bb,getState:JI},Mb=bn,Ub=sn,xb=wn,Vb=$i,Fb=Ou,Bb=pl,jb=Dn,Wb=Yo,Gb=Wn,Hb=Object.assign,Kb=Object.defineProperty,zb=Ub([].concat),Yb=!Hb||Vb((function(){if(Mb&&1!==Hb({b:1},Hb(Kb({},"a",{enumerable:!0,get:function(){Kb(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!=Hb({},e)[r]||Fb(Hb({},t)).join("")!=i}))?function(e,t){for(var r=Wb(e),i=arguments.length,n=1,o=Bb.f,s=jb.f;i>n;)for(var a,c=Gb(arguments[n++]),d=o?zb(Fb(c),o(c)):Fb(c),u=d.length,l=0;u>l;)a=d[l++],Mb&&!xb(s,c,a)||(r[a]=c[a]);return r}:Hb,Xb=ea,Jb=kT,qb=Xs,Qb=wn,Zb=Yo,$b=function(e,t,r,i){try{return i?t(Xb(r)[0],r[1]):t(r)}catch(t){Jb(e,"throw",t)}},eC=mT,tC=Wd,rC=Va,iC=Ad,nC=NT,oC=yT,sC=Array,aC=sn,cC=2147483647,dC=/[^\0-\u007E]/,uC=/[.\u3002\uFF0E\uFF61]/g,lC="Overflow: input needs wider integers to process",pC=RangeError,hC=aC(uC.exec),fC=Math.floor,EC=String.fromCharCode,mC=aC("".charCodeAt),_C=aC([].join),TC=aC([].push),gC=aC("".replace),SC=aC("".split),vC=aC("".toLowerCase),yC=function(e){return e+22+75*(e<26)},RC=function(e,t,r){var i=0;for(e=r?fC(e/700):e>>1,e+=fC(e/t);e>455;)e=fC(e/35),i+=36;return fC(i+36*e/(e+38))},AC=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=mC(e,r++);if(n>=55296&&n<=56319&&r<i){var o=mC(e,r++);56320==(64512&o)?TC(t,((1023&n)<<10)+(1023&o)+65536):(TC(t,n),r--)}else TC(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&&TC(t,EC(i));var c=t.length,d=c;for(c&&TC(t,"-");d<n;){var u=cC;for(r=0;r<e.length;r++)(i=e[r])>=o&&i<u&&(u=i);var l=d+1;if(u-o>fC((cC-s)/l))throw pC(lC);for(s+=(u-o)*l,o=u,r=0;r<e.length;r++){if((i=e[r])<o&&++s>cC)throw pC(lC);if(i==o){for(var p=s,h=36;;){var f=h<=a?1:h>=a+26?26:h-a;if(p<f)break;var E=p-f,m=36-f;TC(t,EC(yC(f+E%m))),p=fC(E/m),h+=36}TC(t,EC(yC(p))),a=RC(s,l,d==c),s=0,d++}}s++,o++}return _C(t,"")},OC=Ia,IC=bn,bC=pI,CC=dn,NC=Xs,wC=sn,DC=fl,PC=ml,kC=yg,LC=qo,MC=Yb,UC=function(e){var t=Zb(e),r=tC(this),i=arguments.length,n=i>1?arguments[1]:void 0,o=void 0!==n;o&&(n=qb(n,i>2?arguments[2]:void 0));var s,a,c,d,u,l,p=oC(t),h=0;if(!p||this===sC&&eC(p))for(s=rC(t),a=r?new this(s):sC(s);s>h;h++)l=o?n(t[h],h):t[h],iC(a,h,l);else for(u=(d=nC(t,p)).next,a=r?new this:[];!(c=Qb(u,d)).done;h++)l=o?$b(d,n,[c.value,h],!0):c.value,iC(a,h,l);return a.length=h,a},xC=sl,VC=Om.codeAt,FC=function(e){var t,r,i=[],n=SC(gC(vC(e),uC,"."),".");for(t=0;t<n.length;t++)r=n[t],TC(i,hC(dC,r)?"xn--"+AC(r):r);return _C(i,".")},BC=uc,jC=Bl,WC=Pg,GC=Lb,HC=rp,KC=HC.set,zC=HC.getterFor("URL"),YC=GC.URLSearchParams,XC=GC.getState,JC=CC.URL,qC=CC.TypeError,QC=CC.parseInt,ZC=Math.floor,$C=Math.pow,eN=wC("".charAt),tN=wC(/./.exec),rN=wC([].join),iN=wC(1..toString),nN=wC([].pop),oN=wC([].push),sN=wC("".replace),aN=wC([].shift),cN=wC("".split),dN=wC("".slice),uN=wC("".toLowerCase),lN=wC([].unshift),pN="Invalid scheme",hN="Invalid host",fN="Invalid port",EN=/[a-z]/i,mN=/[\d+-.a-z]/i,_N=/\d/,TN=/^0x/i,gN=/^[0-7]+$/,SN=/^\d+$/,vN=/^[\da-f]+$/i,yN=/[\0\t\n\r #%/:<>?@[\\\]^|]/,RN=/[\0\t\n\r #/:<>?@[\\\]^|]/,AN=/^[\u0000-\u0020]+/,ON=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,IN=/[\t\n\r]/g,bN=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)lN(t,e%256),e=ZC(e/256);return rN(t,".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,r=1,i=null,n=0,o=0;o<8;o++)0!==e[o]?(n>r&&(t=i,r=n),i=null,n=0):(null===i&&(i=o),++n);return n>r&&(t=i,r=n),t}(e),r=0;r<8;r++)n&&0===e[r]||(n&&(n=!1),i===r?(t+=r?":":"::",n=!0):(t+=iN(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},CN={},NN=MC({},CN,{" ":1,'"':1,"<":1,">":1,"`":1}),wN=MC({},NN,{"#":1,"?":1,"{":1,"}":1}),DN=MC({},wN,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),PN=function(e,t){var r=VC(e,0);return r>32&&r<127&&!LC(t,e)?e:encodeURIComponent(e)},kN={ftp:21,file:null,http:80,https:443,ws:80,wss:443},LN=function(e,t){var r;return 2==e.length&&tN(EN,eN(e,0))&&(":"==(r=eN(e,1))||!t&&"|"==r)},MN=function(e){var t;return e.length>1&&LN(dN(e,0,2))&&(2==e.length||"/"===(t=eN(e,2))||"\\"===t||"?"===t||"#"===t)},UN=function(e){return"."===e||"%2e"===uN(e)},xN={},VN={},FN={},BN={},jN={},WN={},GN={},HN={},KN={},zN={},YN={},XN={},JN={},qN={},QN={},ZN={},$N={},ew={},tw={},rw={},iw={},nw=function(e,t,r){var i,n,o,s=BC(e);if(t){if(n=this.parse(s))throw qC(n);this.searchParams=null}else{if(void 0!==r&&(i=new nw(r,!0)),n=this.parse(s,null,i))throw qC(n);(o=XC(new YC)).bindURL(this),this.searchParams=o}};nw.prototype={type:"URL",parse:function(e,t,r){var i,n,o,s,a,c=this,d=t||xN,u=0,l="",p=!1,h=!1,f=!1;for(e=BC(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=sN(e,AN,""),e=sN(e,ON,"$1")),e=sN(e,IN,""),i=UC(e);u<=i.length;){switch(n=i[u],d){case xN:if(!n||!tN(EN,n)){if(t)return pN;d=FN;continue}l+=uN(n),d=VN;break;case VN:if(n&&(tN(mN,n)||"+"==n||"-"==n||"."==n))l+=uN(n);else{if(":"!=n){if(t)return pN;l="",d=FN,u=0;continue}if(t&&(c.isSpecial()!=LC(kN,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&kN[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?d=qN:c.isSpecial()&&r&&r.scheme==c.scheme?d=BN:c.isSpecial()?d=HN:"/"==i[u+1]?(d=jN,u++):(c.cannotBeABaseURL=!0,oN(c.path,""),d=tw)}break;case FN:if(!r||r.cannotBeABaseURL&&"#"!=n)return pN;if(r.cannotBeABaseURL&&"#"==n){c.scheme=r.scheme,c.path=xC(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,d=iw;break}d="file"==r.scheme?qN:WN;continue;case BN:if("/"!=n||"/"!=i[u+1]){d=WN;continue}d=KN,u++;break;case jN:if("/"==n){d=zN;break}d=ew;continue;case WN:if(c.scheme=r.scheme,n==kb)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=xC(r.path),c.query=r.query;else if("/"==n||"\\"==n&&c.isSpecial())d=GN;else if("?"==n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=xC(r.path),c.query="",d=rw;else{if("#"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=xC(r.path),c.path.length--,d=ew;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=xC(r.path),c.query=r.query,c.fragment="",d=iw}break;case GN:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,d=ew;continue}d=zN}else d=KN;break;case HN:if(d=KN,"/"!=n||"/"!=eN(l,u+1))continue;u++;break;case KN:if("/"!=n&&"\\"!=n){d=zN;continue}break;case zN:if("@"==n){p&&(l="%40"+l),p=!0,o=UC(l);for(var E=0;E<o.length;E++){var m=o[E];if(":"!=m||f){var _=PN(m,DN);f?c.password+=_:c.username+=_}else f=!0}l=""}else if(n==kb||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(p&&""==l)return"Invalid authority";u-=UC(l).length+1,l="",d=YN}else l+=n;break;case YN:case XN:if(t&&"file"==c.scheme){d=ZN;continue}if(":"!=n||h){if(n==kb||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return hN;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",d=$N,t)return;continue}"["==n?h=!0:"]"==n&&(h=!1),l+=n}else{if(""==l)return hN;if(s=c.parseHost(l))return s;if(l="",d=JN,t==XN)return}break;case JN:if(!tN(_N,n)){if(n==kb||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var T=QC(l,10);if(T>65535)return fN;c.port=c.isSpecial()&&T===kN[c.scheme]?null:T,l=""}if(t)return;d=$N;continue}return fN}l+=n;break;case qN:if(c.scheme="file","/"==n||"\\"==n)d=QN;else{if(!r||"file"!=r.scheme){d=ew;continue}if(n==kb)c.host=r.host,c.path=xC(r.path),c.query=r.query;else if("?"==n)c.host=r.host,c.path=xC(r.path),c.query="",d=rw;else{if("#"!=n){MN(rN(xC(i,u),""))||(c.host=r.host,c.path=xC(r.path),c.shortenPath()),d=ew;continue}c.host=r.host,c.path=xC(r.path),c.query=r.query,c.fragment="",d=iw}}break;case QN:if("/"==n||"\\"==n){d=ZN;break}r&&"file"==r.scheme&&!MN(rN(xC(i,u),""))&&(LN(r.path[0],!0)?oN(c.path,r.path[0]):c.host=r.host),d=ew;continue;case ZN:if(n==kb||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&LN(l))d=ew;else if(""==l){if(c.host="",t)return;d=$N}else{if(s=c.parseHost(l))return s;if("localhost"==c.host&&(c.host=""),t)return;l="",d=$N}continue}l+=n;break;case $N:if(c.isSpecial()){if(d=ew,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=kb&&(d=ew,"/"!=n))continue}else c.fragment="",d=iw;else c.query="",d=rw;break;case ew:if(n==kb||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(a=uN(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||oN(c.path,"")):UN(l)?"/"==n||"\\"==n&&c.isSpecial()||oN(c.path,""):("file"==c.scheme&&!c.path.length&&LN(l)&&(c.host&&(c.host=""),l=eN(l,0)+":"),oN(c.path,l)),l="","file"==c.scheme&&(n==kb||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)aN(c.path);"?"==n?(c.query="",d=rw):"#"==n&&(c.fragment="",d=iw)}else l+=PN(n,wN);break;case tw:"?"==n?(c.query="",d=rw):"#"==n?(c.fragment="",d=iw):n!=kb&&(c.path[0]+=PN(n,CN));break;case rw:t||"#"!=n?n!=kb&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":PN(n,CN)):(c.fragment="",d=iw);break;case iw:n!=kb&&(c.fragment+=PN(n,NN))}u++}},parseHost:function(e){var t,r,i;if("["==eN(e,0)){if("]"!=eN(e,e.length-1))return hN;if(t=function(e){var t,r,i,n,o,s,a,c=[0,0,0,0,0,0,0,0],d=0,u=null,l=0,p=function(){return eN(e,l)};if(":"==p()){if(":"!=eN(e,1))return;l+=2,u=++d}for(;p();){if(8==d)return;if(":"!=p()){for(t=r=0;r<4&&tN(vN,p());)t=16*t+QC(p(),16),l++,r++;if("."==p()){if(0==r)return;if(l-=r,d>6)return;for(i=0;p();){if(n=null,i>0){if(!("."==p()&&i<4))return;l++}if(!tN(_N,p()))return;for(;tN(_N,p());){if(o=QC(p(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;l++}c[d]=256*c[d]+n,2!=++i&&4!=i||d++}if(4!=i)return;break}if(":"==p()){if(l++,!p())return}else if(p())return;c[d++]=t}else{if(null!==u)return;l++,u=++d}}if(null!==u)for(s=d-u,d=7;0!=d&&s>0;)a=c[d],c[d--]=c[u+s-1],c[u+--s]=a;else if(8!=d)return;return c}(dN(e,1,-1)),!t)return hN;this.host=t}else if(this.isSpecial()){if(e=FC(e),tN(yN,e))return hN;if(t=function(e){var t,r,i,n,o,s,a,c=cN(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],i=0;i<t;i++){if(""==(n=c[i]))return e;if(o=10,n.length>1&&"0"==eN(n,0)&&(o=tN(TN,n)?16:8,n=dN(n,8==o?1:2)),""===n)s=0;else{if(!tN(10==o?SN:8==o?gN:vN,n))return e;s=QC(n,o)}oN(r,s)}for(i=0;i<t;i++)if(s=r[i],i==t-1){if(s>=$C(256,5-t))return null}else if(s>255)return null;for(a=nN(r),i=0;i<r.length;i++)a+=r[i]*$C(256,3-i);return a}(e),null===t)return hN;this.host=t}else{if(tN(RN,e))return hN;for(t="",r=UC(e),i=0;i<r.length;i++)t+=PN(r[i],CN);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return LC(kN,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&LN(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,i=e.password,n=e.host,o=e.port,s=e.path,a=e.query,c=e.fragment,d=t+":";return null!==n?(d+="//",e.includesCredentials()&&(d+=r+(i?":"+i:"")+"@"),d+=bN(n),null!==o&&(d+=":"+o)):"file"==t&&(d+="//"),d+=e.cannotBeABaseURL?s[0]:s.length?"/"+rN(s,"/"):"",null!==a&&(d+="?"+a),null!==c&&(d+="#"+c),d},setHref:function(e){var t=this.parse(e);if(t)throw qC(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new ow(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+bN(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(BC(e)+":",xN)},getUsername:function(){return this.username},setUsername:function(e){var t=UC(BC(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=PN(t[r],DN)}},getPassword:function(){return this.password},setPassword:function(e){var t=UC(BC(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=PN(t[r],DN)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?bN(e):bN(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,YN)},getHostname:function(){var e=this.host;return null===e?"":bN(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,XN)},getPort:function(){var e=this.port;return null===e?"":BC(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=BC(e))?this.port=null:this.parse(e,JN))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+rN(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,$N))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=BC(e))?this.query=null:("?"==eN(e,0)&&(e=dN(e,1)),this.query="",this.parse(e,rw)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=BC(e))?("#"==eN(e,0)&&(e=dN(e,1)),this.fragment="",this.parse(e,iw)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var ow=function(e){var t=kC(this,sw),r=WC(arguments.length,1)>1?arguments[1]:void 0,i=KC(t,new nw(e,!1,r));IC||(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())},sw=ow.prototype,aw=function(e,t){return{get:function(){return zC(this)[e]()},set:t&&function(e){return zC(this)[t](e)},configurable:!0,enumerable:!0}};if(IC&&(PC(sw,"href",aw("serialize","setHref")),PC(sw,"origin",aw("getOrigin")),PC(sw,"protocol",aw("getProtocol","setProtocol")),PC(sw,"username",aw("getUsername","setUsername")),PC(sw,"password",aw("getPassword","setPassword")),PC(sw,"host",aw("getHost","setHost")),PC(sw,"hostname",aw("getHostname","setHostname")),PC(sw,"port",aw("getPort","setPort")),PC(sw,"pathname",aw("getPathname","setPathname")),PC(sw,"search",aw("getSearch","setSearch")),PC(sw,"searchParams",aw("getSearchParams")),PC(sw,"hash",aw("getHash","setHash"))),DC(sw,"toJSON",(function(){return zC(this).serialize()}),{enumerable:!0}),DC(sw,"toString",(function(){return zC(this).serialize()}),{enumerable:!0}),JC){var cw=JC.createObjectURL,dw=JC.revokeObjectURL;cw&&DC(ow,"createObjectURL",NC(cw,JC)),dw&&DC(ow,"revokeObjectURL",NC(dw,JC))}jC(ow,"URL"),OC({global:!0,constructor:!0,forced:!bC,sham:!IC},{URL:ow});var uw=Ia,lw=$i,pw=Pg,hw=uc,fw=pI,Ew=no("URL");uw({target:"URL",stat:!0,forced:!(fw&&lw((function(){Ew.canParse()})))},{canParse:function(e){var t=pw(arguments.length,1),r=hw(e),i=t<2||void 0===arguments[1]?void 0:hw(arguments[1]);try{return!!new Ew(r,i)}catch(e){return!1}}});var mw=J($n.URL);function _w(){const e=new Blob([atob("ZnVuY3Rpb24gZShlLHQsbil7bGV0IHI9bmV3IFVpbnQ4QXJyYXkoZSx0LG4pLGE9W10sbz0wO2Zvcig7YS5sZW5ndGg8bjspbyszPG4mJjA9PT1yW29dJiYwPT09cltvKzFdJiYzPT09cltvKzJdJiYoMD09PXJbbyszXXx8MT09PXJbbyszXXx8Mj09PXJbbyszXXx8Mz09PXJbbyszXSk/KGEucHVzaChyW29dLHJbbysxXSxyW28rM10pLG8rPTQpOihhLnB1c2gocltvXSksbysrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkoYSl9ZnVuY3Rpb24gdChlLHQpe2NvbnN0IG49ZnVuY3Rpb24oZSl7Y29uc3QgdD1lLmxlbmd0aDtsZXQgbj1bXSxyPTA7Zm9yKDtyPHQ7KXIrMjx0JiYwPT09ZVtyXSYmMD09PWVbcisxXSYmKDA9PT1lW3IrMl18fDE9PT1lW3IrMl18fDI9PT1lW3IrMl18fDM9PT1lW3IrMl0pPyhuLnB1c2goZVtyXSxlW3IrMV0sMyxlW3IrMl0pLHIrPTMpOihuLnB1c2goZVtyXSkscisrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkobil9KHQpLHI9bi5sZW5ndGgsYT1NYXRoLmZsb29yKHIvMjU1KSxvPXIlMjU1LHM9bmV3IFVpbnQ4QXJyYXkoNithKzErcitlLmJ5dGVMZW5ndGgpO3NbMF09MCxzWzFdPTAsc1syXT0wLHNbM109MSxzWzRdPTYsc1s1XT0xMDE7bGV0IGk9MDtmb3IoO2k8YTspc1s2K2ldPTI1NSxpKys7cmV0dXJuIHNbNitpXT1vLGkrKyxzLnNldChuLDYraSkscy5zZXQobmV3IFVpbnQ4QXJyYXkoZSksNitpK3IpLHMuYnVmZmVyfW5hdmlnYXRvci51c2VyQWdlbnQuaW5kZXhPZigiU2FmYXJpIik+LTEmJi0xPT09bmF2aWdhdG9yLnVzZXJBZ2VudC5pbmRleE9mKCJDaHJvbWUiKSYmKHNlbGYub25ydGN0cmFuc2Zvcm09bj0+e2NvbnN0IHI9bi50cmFuc2Zvcm1lcjtsZXQgYT1bXTtyLm9wdGlvbnMucG9ydC5vbm1lc3NhZ2U9ZT0+e2UuZGF0YS5zZWkmJmEucHVzaChlLmRhdGEuc2VpKX0sc2VsZi5wb3N0TWVzc2FnZSgic3RhcnRlZCIpO2NvbnN0IG89ci5yZWFkYWJsZS5nZXRSZWFkZXIoKSxzPXIud3JpdGFibGUuZ2V0V3JpdGVyKCk7InJ4Ij09PXIub3B0aW9ucy5uYW1lP2Z1bmN0aW9uIHQobil7by5yZWFkKCkudGhlbigocj0+e2lmKCFyLmRvbmUpe2lmKHIudmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3QgdD1mdW5jdGlvbih0KXtjb25zdCBuPW5ldyBEYXRhVmlldyh0LmRhdGEpO2xldCByPTA7Zm9yKDtyKzQ8dC5kYXRhLmJ5dGVMZW5ndGg7KXtpZigwPT09bi5nZXRVaW50OChyKzApJiYwPT09bi5nZXRVaW50OChyKzEpJiYwPT09bi5nZXRVaW50OChyKzIpJiYxPT09bi5nZXRVaW50OChyKzMpJiY2PT09bi5nZXRVaW50OChyKzQpKXtsZXQgYT1yKzYsbz0wLHM9MDtmb3IoOzI1NT09PShzPW4uZ2V0VWludDgoYSsrKSk7KW8rPTI1NTtvKz1zO2NvbnN0IGk9ZSh0LmRhdGEsYSxvKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkoaSl9cisrfXJldHVybiBudWxsfShyLnZhbHVlKTt0JiZuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7c2VpOnR9KX1zLndyaXRlKHIudmFsdWUpLG4ub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQobil9fSkpfShyKToidHgiPT09ci5vcHRpb25zLm5hbWUmJmZ1bmN0aW9uIGUobil7by5yZWFkKCkudGhlbigocj0+e2lmKCFyLmRvbmUpe2lmKHIudmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3QgZT1hLnNoaWZ0KCk7ZSYmKHIudmFsdWUuZGF0YT10KHIudmFsdWUuZGF0YSxlKSl9cy53cml0ZShyLnZhbHVlKSxuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSxlKG4pfX0pKX0ocil9LHNlbGYucG9zdE1lc3NhZ2UoInJlZ2lzdGVyZWQiKSk7Cg==")],{type:"text/javascript"});return setTimeout((()=>mw.revokeObjectURL(e)),0),new Worker(mw.createObjectURL(e))}const Tw=new Map;const gw=new Map;function Sw(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 vw(e,t){const r=function(e){const t=e.length;let r=[],i=0;for(;i<t;)i+2<t&&0===e[i]&&0===e[i+1]&&(0===e[i+2]||1===e[i+2]||2===e[i+2]||3===e[i+2])?(r.push(e[i],e[i+1],3,e[i+2]),i+=3):(r.push(e[i]),i++);return new Uint8Array(r)}(t),i=r.length,n=Math.floor(i/255),o=i%255,s=new Uint8Array(6+n+1+i+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=6,s[5]=101;let a=0;for(;a<n;)s[6+a]=255,a++;return s[6+a]=o,a++,s.set(r,6+a),s.set(new Uint8Array(e),6+a+i),s.buffer}const yw=new Map;const Rw=new Map;Ji(),e.AUDIO_CONTEXT_EVENT=Zi,e.AUDIO_ENCODER_CONFIG_SETTINGS=Mc,e.AUDIO_TRACK_EVENT=$c,e.AudioProcessorContext=zR,e.AudioProcessorDestination=KR,e.AudioSourceEvents=Zc,e.BufferSourceAudioTrack=JA,e.CameraVideoTrack=jO,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=ed,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=td,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=rd,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=id,e.DataChannel=dI,e.DataChannelEvents=ud,e.DeviceManager=yR,e.DeviceManagerEvent=ad,e.DeviceManagerState=sd,e.LocalAudioTrack=YA,e.LocalDataChannel=class extends dI{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=qy,e.LocalTrackEvents=Jc,e.LocalVideoTrack=BO,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=cd,e.MicrophoneAudioTrack=XA,e.MixingAudioTrack=qA,e.PROCESSOR_CONTEXT_EVENTS=od,e.PROCESSOR_DESTINATION_EVENTS=nd,e.RemoteAudioTrack=aI,e.RemoteDataChannel=class extends dI{constructor(e){super(e),Vm(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(Ii("SHOW_DATASTREAM2_LOG")&&Fi.debug("invalid datachannel id: ".concat(r," !== ").concat(this.id)));let i=e.data.slice(this._dataStreamPacketHeader.byteLength);i=this._dataStreamPacketHandler.deserialize(i),this.emit(ud.MESSAGE,i)}}_updateOriginDataChannel(e){super._updateOriginDataChannel(e),this._bandRemoteDataChannelEvents()}_close(){this._originDataChannel&&(this._originDataChannel.removeEventListener("message",this._messageListener),super._close())}_bandRemoteDataChannelEvents(){this._originDataChannel&&this._originDataChannel.addEventListener("message",this._messageListener)}},e.RemoteStreamFallbackType=Yc,e.RemoteStreamType=zc,e.RemoteTrack=oI,e.RemoteTrackEvents=qc,e.RemoteVideoTrack=sI,e.SAFARI_GLOBAL_GUM_LOCK=_R,e.SUPPORT_720P_AUTO_CONFIG_LIST=[{scaleResolutionDownBy:2,width:1280,height:720,frameRate:30,bitrateMin:300,bitrateMax:900},{scaleResolutionDownBy:1.333333,width:1280,height:720,frameRate:30,bitrateMin:600,bitrateMax:2e3},{scaleResolutionDownBy:1,width:1280,height:720,frameRate:30,bitrateMin:900,bitrateMax:3e3}],e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=wc,e.SUPPORT_SVC_CONFIG_LIST=Dc,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=Nc,e.StreamType=Kc,e.Track=Jy,e.TrackEvents=Xc,e.TrackHint=Hc,e.TrackInternalEvent=Gc,e.TrackMediaType=Qc,e.VideoProcessorContext=HR,e.VideoProcessorDestination=GR,e.VideoState=dd,e.__TRACK_LIST__=xc,e.addTrack=Vc,e.audioContextState=eR,e.audioElementPlayCenter=DR,e.audioTimerLoop=function(e,t){let r=!1;const i=1/t;if(Ii("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*i)}else{const t=rR();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=OR,e.blob2Uint8Array=iA,e.checkMediaStreamTrackResolution=JR,e.checkTrackState=PR,e.createBufferSourceAudioTrack=async function(e){var t;const{cacheOnlineFile:r,encoderConfig:i}=e;let{source:n}=e;const o={source:n instanceof AudioBuffer?"AudioBuffer":n instanceof File?null!==(t=File.name)&&void 0!==t?t:"File":n,cacheOnlineFile:r,encoderConfig:i},s=Yi.reportApiInvoke(null,{tag:Hr.TRACER,name:Gr.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(Ii("DISABLE_WEBAUDIO"))throw new Nr(Cr.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");const a=oi(8,"track-buf-");Fi.info("start create buffer source audio track with config",JSON.stringify(o),"trackId",a);const c=n;if(!(n instanceof AudioBuffer))try{n=await async function(e,t){let r=null;if("string"==typeof e){const t=ZA.get(e);if(t)return Fi.debug("use cached audio resource: ",e),t;try{r=(await _i((()=>Qt.get(e,{responseType:"arraybuffer"})),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new Nr(Cr.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new Xy(((t,r)=>{const i=new FileReader;i.onload=e=>{e.target?t(e.target.result):r(new Nr(Cr.READ_LOCAL_AUDIO_FILE_ERROR))},i.onerror=()=>{r(new Nr(Cr.READ_LOCAL_AUDIO_FILE_ERROR))},i.readAsArrayBuffer(e)}));r=await t}const i=await oR(r);return"string"==typeof e&&t&&ZA.set(e,i),i}(n,r)}catch(e){return s.onError(e),e.throw(Fi)}const d=new QA(n),u=new JA(c,d,i?Uc(i):{},a);return Fi.info("create buffer source audio track success, trackId:",a),s.onSuccess(u.getTrackId()),u},e.createCameraVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Ii("CAMERA_CAPTURE_CONFIG"),r=Yi.reportApiInvoke(null,{tag:Hr.TRACER,name:Gr.CREATE_CAM_VIDEO_TRACK,options:[GO({},e),t]});t&&(e.encoderConfig=t);const i=qR(e),n=oi(8,"track-cam-");let o=null;Fi.info("start create camera video track with config",JSON.stringify(e),"trackId",n);try{o=(await TR({video:i},n)).getVideoTracks()[0]||null}catch(e){throw r.onError(e),e}if(!o){const e=new Nr(Cr.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(Fi)}e.optimizationMode&&HO(n,o,e,Pc(e.encoderConfig));const s=new jO(o,e,i,e.scalabiltyMode?Lc(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,n);return r.onSuccess(s.getTrackId()),Fi.info("create camera video success, trackId:",n),s},e.createCustomAudioTrack=function(e){const t=Yi.reportApiInvoke(null,{tag:Hr.TRACER,name:Gr.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),r=new YA(e.mediaStreamTrack,e.encoderConfig?Uc(e.encoderConfig):{},oi(8,"track-cus-"),!1);return Fi.info("create custom audio track success with config",e,"trackId",r.getTrackId()),t.onSuccess(r.getTrackId()),r},e.createCustomVideoTrack=function(e){const t=Yi.reportApiInvoke(null,{tag:Hr.TRACER,name:Gr.CREATE_CUSTOM_VIDEO_TRACK,options:[e]}),r=new BO(e.mediaStreamTrack,{width:e.width,height:e.height,frameRate:e.frameRate,bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin},e.scalabiltyMode?Lc(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,oi(8,"track-cus-"),[Hc.CUSTOM_TRACK]);return t.onSuccess(r.getTrackId()),Fi.info("create custom video track success with config",e,"trackId",r.getTrackId()),r},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=Ii("CAMERA_CAPTURE_CONFIG"),i=Yi.reportApiInvoke(null,{tag:Hr.TRACER,name:Gr.CREATE_MIC_AND_CAM_TRACKS,options:[e,t,r]});r&&(t.encoderConfig=r);const n=qR(t),o=ZR(e),s=oi(8,"track-mic-"),a=oi(8,"track-cam-");let c=null,d=null;Fi.info("start create camera video track(".concat(a,") and microphone audio track(").concat(s,") with config, audio: ").concat(JSON.stringify(e),", video: ").concat(JSON.stringify(t)));try{const e=await TR({audio:o,video:n},"".concat(s,"-").concat(a));c=e.getAudioTracks()[0],d=e.getVideoTracks()[0]}catch(e){throw i.onError(e),e}if(!c||!d){const e=new Nr(Cr.UNEXPECTED_ERROR,"can not find tracks in media stream");return i.onError(e),e.throw(Fi)}t.optimizationMode&&HO(a,d,t,Pc(t.encoderConfig));const u=new XA(c,e,o,s),l=new jO(d,t,n,t.scalabiltyMode?Lc(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,a);return i.onSuccess([u.getTrackId(),l.getTrackId()]),Fi.info("create camera video track(".concat(a,") and microphone audio track(").concat(s,") success")),[u,l]},e.createMicrophoneAudioTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Yi.reportApiInvoke(null,{tag:Hr.TRACER,name:Gr.CREATE_MIC_AUDIO_TRACK,options:[e]}),r=ZR(e),i=oi(8,"track-mic-");let n=null;Fi.info("start create microphone audio track with config",JSON.stringify(e),"trackId",i);try{n=(await TR({audio:r},i)).getAudioTracks()[0]||null}catch(e){throw t.onError(e),e}if(!n){const e=new Nr(Cr.UNEXPECTED_ERROR,"can not find track in media stream");return t.onError(e),e.throw(Fi)}const o=new XA(n,e,r,i);return t.onSuccess(o.getTrackId()),Fi.info("create microphone audio track success, trackId:",i),o},e.createMixingAudioTrack=function(e){const t=new qA;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=Yi.reportApiInvoke(null,{tag:Hr.TRACER,name:Gr.CREATE_SCREEN_VIDEO_TRACK,options:[GO({},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 i=QR(e),n=oi(8,"track-scr-v-");let o=null,s=null;const a=qi();if(!a.supportShareAudio&&"enable"===t){const e=new Nr(Cr.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return r.onError(e),e.throw(Fi)}Fi.info("start create screen video track with config",e,"withAudio",t,"trackId",n);try{const e=await TR({screen:i,screenAudio:"auto"===t?a.supportShareAudio:"enable"===t},n);o=e.getVideoTracks()[0]||null,s=e.getAudioTracks()[0]||null}catch(e){throw r.onError(e),e}if(!o){const e=new Nr(Cr.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(Fi)}if(!s&&"enable"===t){o&&o.stop();const e=new Nr(Cr.SHARE_AUDIO_NOT_ALLOWED);return r.onError(e),e.throw(Fi)}if(e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode){HO(n,o,e,e.encoderConfig&&kc(e.encoderConfig)||void 0),e.encoderConfig&&"string"!=typeof e.encoderConfig&&(e.encoderConfig.bitrateMin=e.encoderConfig.bitrateMax)}const c=new BO(o,e.encoderConfig?kc(e.encoderConfig):{},e.scalabiltyMode?Lc(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,n,[Hc.SCREEN_TRACK]);if(!s)return r.onSuccess(c.getTrackId()),Fi.info("create screen video track success","video:",c.getTrackId()),c;const d=new YA(s,void 0,oi(8,"track-scr-a-"),!1);return r.onSuccess([c.getTrackId(),d.getTrackId()]),Fi.info("create screen video track success","video:",c.getTrackId(),"audio:",d.getTrackId()),[c,d]},e.decodeAudioData=oR,e.detectSupportAudioElementSetSinkId=Qi,e.deviceManager=RR,e.emptyImage2TypedArray=rA,e.frameData2CryptoBuffer=async(e,t,r)=>await tA(e.buffer,t,r),e.getAudioContext=rR,e.getAudioEncoderConfiguration=Uc,e.getBitrateConstrainRange=$R,e.getBitrateFromResAndFps=eA,e.getCompatibility=qi,e.getConstraintsFromCameraConfig=qR,e.getConstraintsFromMicrophoneConfig=ZR,e.getConstraintsFromScreenConfig=QR,e.getElectronScreenSources=ER,e.getElectronScreenStream=hR,e.getElectronScreenStreamByUserSelect=fR,e.getLocalStream=TR,e.getOriginSenderConfig=e=>{const t=e._encoderConfig;if(!t)return;const{frameRate:r,width:i,height:n}=e.getMediaStreamTrackSettings();let{frameRate:o=r,width:s=i,height:a=n}=t;if(!o||!s||!a)return;s=li(s),a=li(a),o=li(o);const{max:c,min:d}=eA(s,a,o),{bitrateMax:u,bitrateMin:l}=t||{};u||Fi.debug("calculate bitrate: [w: ".concat(s,", h: ").concat(a,", fps: ").concat(o,"] => [brMax: ").concat(u,", brMin: ").concat(l,"]"));const{maxFramerate:p}=Ii("ENCODER_CONFIG_LIMIT");return p&&"number"==typeof p&&(o=Math.min(o,p)),{frameRate:o,bitrateMax:u||c,bitrateMin:l||d,scaleResolutionDownBy:1,scale:0}},e.getScalabilityConfiguration=Lc,e.getScreenEncoderConfiguration=kc,e.getSilenceAudioTrack=function(){if(aR)return aR;const e=rR();if(!e.createMediaStreamDestination)throw new Nr(Cr.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),aR=i.stream.getAudioTracks()[0],aR},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=nA,e.getVideoEncoderConfiguration=Pc,e.handleGetUserMediaError=SR,e.hasAudioContext=iR,e.interceptLocalAudioFrame=async function(e){if(!qi().supportWebRTCEncodedTransform)return void Fi.warning("browser not support audio encoded transform");if(Tw.has(e))return;if(!e.track)return;const t={track:e.track};if(cr()){if(!e.createEncodedStreams)return void Fi.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void Fi.error("create audio-encoded-streams error",e&&e.message)}const n=new TransformStream({transform(i,n){t.controller||(t.controller=n),e.track&&e.track.id!==t.track.id&&(Fi.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r)),n.enqueue(i)}});i.readable.pipeThrough(n).pipeTo(i.writable)}else if(dr()){if("undefined"==typeof RTCRtpScriptTransform)return void Fi.warning("browser not support RTCRtpScriptTransform");const i=_w(),n=new MessageChannel;await new Xy((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(i,{name:"tx",port:n.port2},[n.port2]);e.transform=o,await new Xy((e=>i.onmessage=t=>{"started"===t.data&&e(void 0)})),n.port1.onmessage=i=>{var n;i.data.transformed&&e.track&&(null===(n=e.track)||void 0===n?void 0:n.id)!==t.track.id&&(Fi.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r))},t.worker=i}function r(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",r)}const t=Tw.get(e);if(t){Tw.delete(e);try{var i,n;null===(i=t.controller)||void 0===i||i.terminate(),null===(n=t.worker)||void 0===n||n.terminate()}catch(e){Fi.warning(e&&e.message)}}}Tw.set(e,t),e.track.addEventListener("ended",r)},e.interceptLocalVideoFrame=async function(e,t){if(!qi().supportWebRTCEncodedTransform)return void Fi.warning("browser not support video encoded transform");if(yw.has(e))return;if(!e.track)return;const r={track:e.track};if(cr()){if(!e.createEncodedStreams)return void Fi.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Fi.error("create video-encoded-streams error",e&&e.message)}let 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&&(Fi.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i));const s=o.shift();s&&(t.data=vw(t.data,s)),n.enqueue(t)}});n.readable.pipeThrough(s).pipeTo(n.writable)}else{if(!dr())return;{if("undefined"==typeof RTCRtpScriptTransform)return void Fi.warning("browser not support RTCRtpScriptTransform");const n=_w(),o=new MessageChannel;await new Xy((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(n,{name:"tx",port:o.port2},[o.port2]);e.transform=s,await new Xy((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&&(Fi.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=yw.get(e);if(t){yw.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){Fi.warning(e&&e.message)}}}yw.set(e,r),e.track.addEventListener("ended",i)},e.interceptRemoteAudioFrame=async function(e){if(!qi().supportWebRTCEncodedTransform)return void Fi.warning("browser not support audio encoded transform");if(gw.has(e))return;const t={track:e.track};if(cr()){if(!e.createEncodedStreams)return void Fi.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void Fi.error("create audio-encoded-streams error",e&&e.message)}const n=new TransformStream({transform(i,n){t.controller||(t.controller=n),e.track&&e.track.id!==t.track.id&&(Fi.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r)),n.enqueue(i)}});i.readable.pipeThrough(n).pipeTo(i.writable)}else if(dr()){if("undefined"==typeof RTCRtpScriptTransform)return void Fi.warning("browser not support RTCRtpScriptTransform");const i=_w(),n=new MessageChannel;await new Xy((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(i,{name:"rx",port:n.port2},[n.port2]);e.transform=o,await new Xy((e=>i.onmessage=t=>{"started"===t.data&&e(void 0)})),n.port1.onmessage=i=>{var n;i.data.transformed&&e.track&&(null===(n=e.track)||void 0===n?void 0:n.id)!==t.track.id&&(Fi.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r))},t.worker=i}function r(){e.track.removeEventListener("ended",r),function(e){const t=gw.get(e);if(t){gw.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){Fi.warning(e&&e.message)}}}(e)}gw.set(e,t),e.track.addEventListener("ended",r)},e.interceptRemoteVideoFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!qi().supportWebRTCEncodedTransform)return void Fi.warning("browser not support video encoded transform");if(!e.track)return;if(Rw.has(e)){const r=Rw.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(cr()){if(!e.createEncodedStreams)return void Fi.warning("browser not support createEncodedStreams() API");let t=null;try{t=e.createEncodedStreams()}catch(e){return void Fi.error("create video-encoded-streams error",e&&e.message)}const n=new TransformStream({transform(t,n){r.controller||(r.controller=n),e.track&&e.track.id!==r.track.id&&(Fi.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i));const o=function(e){const t=new DataView(e.data);let r=0;for(;r+4<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&6===t.getUint8(r+4)){let i=r+6,n=0,o=0;for(;255===(o=t.getUint8(i++));)n+=255;n+=o;const s=Sw(e.data,i,n);return new Uint8Array(s)}r++}return null}(t);o&&r.onSei&&r.onSei(o),n.enqueue(t)}});t.readable.pipeThrough(n).pipeTo(t.writable)}else if(dr()){if("undefined"==typeof RTCRtpScriptTransform)return void Fi.warning("browser not support RTCRtpScriptTransform");const t=_w(),n=new MessageChannel;await new Xy((e=>t.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(t,{name:"rx",port:n.port2},[n.port2]);e.transform=o,await new Xy((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?(Fi.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i)):t.data.sei&&r.onSei&&r.onSei(t.data.sei)},r.worker=t}function i(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",i)}!function(e){const t=Rw.get(e);if(t){Rw.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){Fi.warning(e&&e.message)}}}(e)}Rw.set(e,r),e.track.addEventListener("ended",i)},e.isAudioEncoderConfiguration=jc,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?Dr(e,"profile",Object.keys(Mc)):jc(e),!0},e.isBeautyEffectOptions=function(e){return void 0!==e.smoothnessLevel&&Pr(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&Pr(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&Pr(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&Dr(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),!0},e.isElectron=Br,e.isLowStreamParameter=function(e){if(!e)throw new Nr(Cr.INVALID_PARAMS);return Lr(e.width)||kr(e.width,"streamParameter.width"),Lr(e.height)||kr(e.height,"streamParameter.height"),Lr(e.framerate)||kr(e.framerate,"streamParameter.framerate"),Lr(e.bitrate)||Pr(e.bitrate,"streamParameter.bitrate"),!0},e.isPlanB=function(){return!Xi.supportUnifiedPlan||Ii("CHROME_FORCE_PLAN_B")&&yr()},e.isScreenSourceType=Wc,e.isVideoEncoderConfiguration=Bc,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?Dr(e,"profile",Object.keys(Nc)):Bc(e),!0},e.polyfillAudioNode=nR,e.removeTrack=Fc,e.requestAutoplayGesture=IR,e.silenceScriptProcessHandler=cR,e.updateAgoraRTCCompatibility=Ji,e.visibilityWatcher=cI}));