armcloud-rtc 1.0.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.
- package/README.md +5 -0
- package/dist/index.cjs.js +21 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.es.js +21 -0
- package/dist/index.es.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/lib/constant.d.ts +122 -0
- package/dist/types/lib/enums.d.ts +8 -0
- package/dist/types/lib/error.d.ts +26 -0
- package/dist/types/lib/huoshanGroupRtc.d.ts +17 -0
- package/dist/types/lib/huoshanRtc.d.ts +159 -0
- package/dist/types/lib/pkg.d.ts +92 -0
- package/dist/types/lib/shake.d.ts +8 -0
- package/dist/types/lib/type.d.ts +88 -0
- package/dist/types/lib/utils.d.ts +5 -0
- package/dist/types/lib/webRtc.d.ts +178 -0
- package/dist/types/types/index.d.ts +88 -0
- package/package.json +36 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}let t=!0,r=!0;function n(e,t,r){const n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function i(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 o(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(t=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."):(r=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function s(){if("object"==typeof window){if(t)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function c(e,t){r&&console.warn(e+" is deprecated, please use "+t+" instead.")}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function d(e){return u(e)?Object.keys(e).reduce((function(t,r){const n=u(e[r]),i=n?d(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[r]:i})}),{}):e}function l(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?l(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((t=>{l(e,e.get(t),r)}))})))}function h(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&&l(e,r,i)}))})),i}const p=s;function f(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 a=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||a)){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 a=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!a&&r.length&&t.includes("back")&&(a=r[r.length-1]),a&&(e.video.deviceId=o.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=n(e.video),p("chrome: "+JSON.stringify(e)),i(e)}))}e.video=n(e.video)}return p("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 v(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function _(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else i(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function m(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function g(e){if(!("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}),i(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,n;return this.getSenders().forEach((r=>{r.track===e&&(t?n=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?n=!0:r=t),t.track===e))),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function y(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function S(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return y(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[r.id];if(i)i.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const n=new e.MediaStream([t]);this._streams[r.id]=n,this._reverseStreams[n.id]=r,this.addStream(n)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=n[t]}));const a=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]),a.apply(this,arguments)):a.apply(this,arguments)};const s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=s.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 E(e,t){i(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var k=Object.freeze({__proto__:null,fixNegotiationNeeded:E,shimAddTrackRemoveTrack:S,shimAddTrackRemoveTrackWithNative:y,shimGetSendersWithDtmf:m,shimGetUserMedia:f,shimMediaStream:v,shimOnTrack:_,shimPeerConnection:b,shimSenderReceiverGetStats:g});function T(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){c("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 R(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 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}),i(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function A(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){c("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function x(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function O(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 P(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 N(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 M(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 D=Object.freeze({__proto__:null,shimAddTransceiver:O,shimCreateAnswer:M,shimCreateOffer:N,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:P,shimGetUserMedia:T,shimOnTrack:I,shimPeerConnection:R,shimRTCDataChannel:x,shimReceiverGetStats:w,shimRemoveStream:A,shimSenderGetStats:C});function L(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 U(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 V(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,a=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 s=function(e,t,r){const n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){const n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){const n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}function F(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(B(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function B(e){return e&&void 0!==e.video?Object.assign({},e,{video:d(e.video)}):e}function j(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];void 0===n.urls&&n.url?(c("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 G(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var W=Object.freeze({__proto__:null,shimAudioContext:G,shimCallbacksAPI:V,shimConstraints:B,shimCreateOfferLegacy:z,shimGetUserMedia:F,shimLocalStreamsAPI:L,shimRTCIceServerUrls:j,shimRemoteStreamsAPI:U,shimTrackEventTransceiver:H}),K="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function X(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function J(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}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 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],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){const n=t.parseRtpMap(a),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"),a=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),s=a.length>0&&a[0].ssrc;let c;const u=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));u.length>0&&u[0].length>1&&u[0][0]===s&&(c=u[0][1]),n.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:s,codecPayloadType:parseInt(e.parameters.apt,10)};s&&c&&(t.rtx={ssrc:c}),r.push(t),i&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:s,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&s&&r.push({ssrc:s});let d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){const r={},n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);const i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;const o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let r;const n=t.matchPrefix(e,"a=msid:");if(1===n.length)return r=n[0].substring(7).split(" "),{stream:r[0],track:r[1]};const i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return i.length>0?(r=i[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},t.parseSctpDescription=function(e){const r=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");let i;n.length>0&&(i=parseInt(n[0].substring(19),10)),isNaN(i)&&(i=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:r.fmt,maxMessageSize:i};const a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){const e=a[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}(q);var Y=q.exports,Q=X(Y),Z=e({__proto__:null,default:Q},[Y]);function $(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.substring(2)),e.candidate&&e.candidate.length){const r=new t(e),n=Q.parseCandidate(e.candidate);for(const e in n)e in r||Object.defineProperty(r,e,{value:n[e]});return r.toJSON=function(){return{candidate:r.candidate,sdpMid:r.sdpMid,sdpMLineIndex:r.sdpMLineIndex,usernameFragment:r.usernameFragment}},r}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,i(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function ee(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||i(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 te(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=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(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")}))}(arguments[0])){const e=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}(arguments[0]),r=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}(e),n=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].substring(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n}(arguments[0],e);let i;i=0===r&&0===n?Number.POSITIVE_INFINITY:0===r||0===n?Math.max(r,n):Math.min(r,n);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return r.apply(this,arguments)}}function re(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},i(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 ie(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 oe(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 se=Object.freeze({__proto__:null,removeExtmapAllowMixed:ie,shimAddIceCandidateNullOrEmpty:oe,shimConnectionState:ne,shimMaxMessageSize:te,shimParameterlessSetLocalDescription:ae,shimRTCIceCandidate:$,shimRTCIceCandidateRelayProtocol:ee,shimSendThrowTypeError:re});function ce(e,t){return function(){return e.apply(t,arguments)}}!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=s,i=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.userAgentData&&r.userAgentData.brands){const e=r.userAgentData.brands.find((e=>"Chromium"===e.brand));if(e)return{browser:"chrome",version:parseInt(e.version,10)}}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),c={browserDetails:i,commonShim:se,extractVersion:n,disableLog:o,disableWarnings:a,sdp:Z};switch(i.browser){case"chrome":if(!k||!b||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),c;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),c;r("adapter.js shimming chrome."),c.browserShim=k,oe(e,i),ae(e),f(e,i),v(e),b(e,i),_(e),S(e,i),m(e),g(e),E(e,i),$(e),ee(e),ne(e),te(e,i),re(e),ie(e,i);break;case"firefox":if(!D||!R||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),c;r("adapter.js shimming firefox."),c.browserShim=D,oe(e,i),ae(e),T(e,i),R(e,i),I(e),A(e),C(e),w(e),x(e),O(e),P(e),N(e),M(e),$(e),ne(e),te(e,i),re(e);break;case"safari":if(!W||!t.shimSafari)return r("Safari shim is not included in this adapter release."),c;r("adapter.js shimming safari."),c.browserShim=W,oe(e,i),ae(e),j(e),z(e),V(e),L(e),U(e),H(e),F(e),G(e),$(e),ee(e),te(e,i),re(e),ie(e,i);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});const{toString:ue}=Object.prototype,{getPrototypeOf:de}=Object,le=(he=Object.create(null),e=>{const t=ue.call(e);return he[t]||(he[t]=t.slice(8,-1).toLowerCase())});var he;const pe=e=>(e=e.toLowerCase(),t=>le(t)===e),fe=e=>t=>typeof t===e,{isArray:ve}=Array,_e=fe("undefined");const me=pe("ArrayBuffer");const ge=fe("string"),ye=fe("function"),Se=fe("number"),be=e=>null!==e&&"object"==typeof e,Ee=e=>{if("object"!==le(e))return!1;const t=de(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},ke=pe("Date"),Te=pe("File"),Ie=pe("Blob"),Re=pe("FileList"),Ce=pe("URLSearchParams"),[we,Ae,xe,Oe]=["ReadableStream","Request","Response","Headers"].map(pe);function Pe(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),ve(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 a;for(n=0;n<o;n++)a=i[n],t.call(null,e[a],a,e)}}function Ne(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 Me="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,De=e=>!_e(e)&&e!==Me;const Le=(Ue="undefined"!=typeof Uint8Array&&de(Uint8Array),e=>Ue&&e instanceof Ue);var Ue;const Ve=pe("HTMLFormElement"),Fe=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Be=pe("RegExp"),je=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Pe(r,((r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)})),Object.defineProperties(e,n)},He="abcdefghijklmnopqrstuvwxyz",ze="0123456789",Ge={DIGIT:ze,ALPHA:He,ALPHA_DIGIT:He+He.toUpperCase()+ze};const We=pe("AsyncFunction"),Ke=(Xe="function"==typeof setImmediate,Je=ye(Me.postMessage),Xe?setImmediate:Je?(qe=`axios@${Math.random()}`,Ye=[],Me.addEventListener("message",(({source:e,data:t})=>{e===Me&&t===qe&&Ye.length&&Ye.shift()()}),!1),e=>{Ye.push(e),Me.postMessage(qe,"*")}):e=>setTimeout(e));var Xe,Je,qe,Ye;const Qe="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Me):"undefined"!=typeof process&&process.nextTick||Ke;var Ze={isArray:ve,isArrayBuffer:me,isBuffer:function(e){return null!==e&&!_e(e)&&null!==e.constructor&&!_e(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=le(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&&me(e.buffer),t},isString:ge,isNumber:Se,isBoolean:e=>!0===e||!1===e,isObject:be,isPlainObject:Ee,isReadableStream:we,isRequest:Ae,isResponse:xe,isHeaders:Oe,isUndefined:_e,isDate:ke,isFile:Te,isBlob:Ie,isRegExp:Be,isFunction:ye,isStream:e=>be(e)&&ye(e.pipe),isURLSearchParams:Ce,isTypedArray:Le,isFileList:Re,forEach:Pe,merge:function e(){const{caseless:t}=De(this)&&this||{},r={},n=(n,i)=>{const o=t&&Ne(r,i)||i;Ee(r[o])&&Ee(n)?r[o]=e(r[o],n):Ee(n)?r[o]=e({},n):ve(n)?r[o]=n.slice():r[o]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Pe(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(Pe(t,((t,n)=>{r&&ye(t)?e[n]=ce(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,a;const s={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)a=i[o],n&&!n(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==r&&de(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:le,kindOfTest:pe,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(ve(e))return e;let t=e.length;if(!Se(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:Ve,hasOwnProperty:Fe,hasOwnProp:Fe,reduceDescriptors:je,freezeMethods:e=>{je(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 ve(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Ne,global:Me,isContextDefined:De,ALPHABET:Ge,generateString:(e=16,t=Ge.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(be(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=ve(e)?[]:{};return Pe(e,((e,t)=>{const o=r(e,n+1);!_e(o)&&(i[t]=o)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:We,isThenable:e=>e&&(be(e)||ye(e))&&ye(e.then)&&ye(e.catch),setImmediate:Ke,asap:Qe};function $e(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($e,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 et=$e.prototype,tt={};["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=>{tt[e]={value:e}})),Object.defineProperties($e,tt),Object.defineProperty(et,"isAxiosError",{value:!0}),$e.from=(e,t,r,n,i,o)=>{const a=Object.create(et);return Ze.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),$e.call(a,e.message,t,r,n,i),a.cause=e,a.name=e.name,o&&Object.assign(a,o),a};function rt(e){return Ze.isPlainObject(e)||Ze.isArray(e)}function nt(e){return Ze.endsWith(e,"[]")?e.slice(0,-2):e}function it(e,t,r){return e?e.concat(t).map((function(e,t){return e=nt(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const ot=Ze.toFlatObject(Ze,{},null,(function(e){return/^is[A-Z]/.test(e)}));function at(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||u,o=r.dots,a=r.indexes,s=(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(!s&&Ze.isBlob(e))throw new $e("Blob is not supported. Use a Buffer instead.");return Ze.isArrayBuffer(e)||Ze.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,i){let s=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(rt)}(e)||(Ze.isFileList(e)||Ze.endsWith(r,"[]"))&&(s=Ze.toArray(e)))return r=nt(r),s.forEach((function(e,n){!Ze.isUndefined(e)&&null!==e&&t.append(!0===a?it([r],n,o):null===a?r:r+"[]",c(e))})),!1;return!!rt(e)||(t.append(it(i,r,o),c(e)),!1)}const d=[],l=Object.assign(ot,{defaultVisitor:u,convertValue:c,isVisitable:rt});if(!Ze.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Ze.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.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])})),d.pop()}}(e),t}function st(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ct(e,t){this._pairs=[],e&&at(e,this,t)}const ut=ct.prototype;function dt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function lt(e,t,r){if(!t)return e;const n=r&&r.encode||dt,i=r&&r.serialize;let o;if(o=i?i(t,r):Ze.isURLSearchParams(t)?t.toString():new ct(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}ut.append=function(e,t){this._pairs.push([e,t])},ut.toString=function(e){const t=e?function(t){return e.call(this,t,st)}:st;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class ht{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)}))}}var pt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ft={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ct,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const vt="undefined"!=typeof window&&"undefined"!=typeof document,_t=(mt="undefined"!=typeof navigator&&navigator.product,vt&&["ReactNative","NativeScript","NS"].indexOf(mt)<0);var mt;const gt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,yt=vt&&window.location.href||"http://localhost";var St={...Object.freeze({__proto__:null,hasBrowserEnv:vt,hasStandardBrowserEnv:_t,hasStandardBrowserWebWorkerEnv:gt,origin:yt}),...ft};function bt(e){function t(e,r,n,i){let o=e[i++];if("__proto__"===o)return!0;const a=Number.isFinite(+o),s=i>=e.length;if(o=!o&&Ze.isArray(n)?n.length:o,s)return Ze.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!a;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])),!a}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 Et={transitional:pt,adapter:["xhr","http","fetch"],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(bt(e)):e;if(Ze.isArrayBuffer(e)||Ze.isBuffer(e)||Ze.isStream(e)||Ze.isFile(e)||Ze.isBlob(e)||Ze.isReadableStream(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 at(e,new St.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return St.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 at(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||Et.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(Ze.isResponse(e)||Ze.isReadableStream(e))return e;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 $e.from(e,$e.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:St.classes.FormData,Blob:St.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=>{Et.headers[e]={}}));const kt=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 Tt=Symbol("internals");function It(e){return e&&String(e).trim().toLowerCase()}function Rt(e){return!1===e||null==e?e:Ze.isArray(e)?e.map(Rt):String(e)}function Ct(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 wt{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=It(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]=Rt(e))}const o=(e,t)=>Ze.forEach(e,((e,r)=>i(e,r,t)));if(Ze.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(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]&&kt[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t);else if(Ze.isHeaders(e))for(const[t,n]of e.entries())i(n,t,r);else null!=e&&i(t,e,r);return this}get(e,t){if(e=It(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=It(e)){const r=Ze.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ct(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=It(e)){const i=Ze.findKey(r,e);!i||t&&!Ct(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&&!Ct(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]=Rt(n),void delete t[i];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();a!==i&&delete t[i],t[a]=Rt(n),r[a]=!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[Tt]=this[Tt]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=It(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}}function At(e,t){const r=this||Et,n=t||r,i=wt.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 xt(e){return!(!e||!e.__CANCEL__)}function Ot(e,t,r){$e.call(this,null==e?"canceled":e,$e.ERR_CANCELED,t,r),this.name="CanceledError"}function Pt(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new $e("Request failed with status code "+r.status,[$e.ERR_BAD_REQUEST,$e.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}wt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ze.reduceDescriptors(wt.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),Ze.freezeMethods(wt),Ze.inherits(Ot,$e,{__CANCEL__:!0});const Nt=(e,t,r=3)=>{let n=0;const i=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,o=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=n[a];i||(i=c),r[o]=s,n[o]=c;let d=a,l=0;for(;d!==o;)l+=r[d++],d%=e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),c-i<t)return;const h=u&&c-u;return h?Math.round(1e3*l/h):void 0}}(50,250);return function(e,t){let r,n,i=0,o=1e3/t;const a=(t,o=Date.now())=>{i=o,r=null,n&&(clearTimeout(n),n=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),s=t-i;s>=o?a(e,t):(r=e,n||(n=setTimeout((()=>{n=null,a(r)}),o-s)))},()=>r&&a(r)]}((r=>{const o=r.loaded,a=r.lengthComputable?r.total:void 0,s=o-n,c=i(s);n=o;e({loaded:o,total:a,progress:a?o/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&o<=a?(a-o)/c:void 0,event:r,lengthComputable:null!=a,[t?"download":"upload"]:!0})}),r)},Mt=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Dt=e=>(...t)=>Ze.asap((()=>e(...t)));var Lt=St.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},Ut=St.hasStandardBrowserEnv?{write(e,t,r,n,i,o){const a=[e+"="+encodeURIComponent(t)];Ze.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),Ze.isString(n)&&a.push("path="+n),Ze.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.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 Vt(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}const Ft=e=>e instanceof wt?{...e}:e;function Bt(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 a(e,t){return Ze.isUndefined(t)?Ze.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(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:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(e,t)=>i(Ft(e),Ft(t),!0)};return Ze.forEach(Object.keys(Object.assign({},e,t)),(function(n){const o=c[n]||i,a=o(e[n],t[n],n);Ze.isUndefined(a)&&o!==s||(r[n]=a)})),r}var jt=e=>{const t=Bt({},e);let r,{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:a,headers:s,auth:c}=t;if(t.headers=s=wt.from(s),t.url=lt(Vt(t.baseURL,t.url),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),Ze.isFormData(n))if(St.hasStandardBrowserEnv||St.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(!1!==(r=s.getContentType())){const[e,...t]=r?r.split(";").map((e=>e.trim())).filter(Boolean):[];s.setContentType([e||"multipart/form-data",...t].join("; "))}if(St.hasStandardBrowserEnv&&(i&&Ze.isFunction(i)&&(i=i(t)),i||!1!==i&&Lt(t.url))){const e=o&&a&&Ut.read(a);e&&s.set(o,e)}return t};var Ht="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const n=jt(e);let i=n.data;const o=wt.from(n.headers).normalize();let a,s,c,u,d,{responseType:l,onUploadProgress:h,onDownloadProgress:p}=n;function f(){u&&u(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(a),n.signal&&n.signal.removeEventListener("abort",a)}let v=new XMLHttpRequest;function _(){if(!v)return;const n=wt.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders());Pt((function(e){t(e),f()}),(function(e){r(e),f()}),{data:l&&"text"!==l&&"json"!==l?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:n,config:e,request:v}),v=null}v.open(n.method.toUpperCase(),n.url,!0),v.timeout=n.timeout,"onloadend"in v?v.onloadend=_:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))&&setTimeout(_)},v.onabort=function(){v&&(r(new $e("Request aborted",$e.ECONNABORTED,e,v)),v=null)},v.onerror=function(){r(new $e("Network Error",$e.ERR_NETWORK,e,v)),v=null},v.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||pt;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new $e(t,i.clarifyTimeoutError?$e.ETIMEDOUT:$e.ECONNABORTED,e,v)),v=null},void 0===i&&o.setContentType(null),"setRequestHeader"in v&&Ze.forEach(o.toJSON(),(function(e,t){v.setRequestHeader(t,e)})),Ze.isUndefined(n.withCredentials)||(v.withCredentials=!!n.withCredentials),l&&"json"!==l&&(v.responseType=n.responseType),p&&([c,d]=Nt(p,!0),v.addEventListener("progress",c)),h&&v.upload&&([s,u]=Nt(h),v.upload.addEventListener("progress",s),v.upload.addEventListener("loadend",u)),(n.cancelToken||n.signal)&&(a=t=>{v&&(r(!t||t.type?new Ot(null,e,v):t),v.abort(),v=null)},n.cancelToken&&n.cancelToken.subscribe(a),n.signal&&(n.signal.aborted?a():n.signal.addEventListener("abort",a)));const m=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);m&&-1===St.protocols.indexOf(m)?r(new $e("Unsupported protocol "+m+":",$e.ERR_BAD_REQUEST,e)):v.send(i||null)}))};const zt=(e,t)=>{let r,n=new AbortController;const i=function(e){if(!r){r=!0,a();const t=e instanceof Error?e:this.reason;n.abort(t instanceof $e?t:new Ot(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{i(new $e(`timeout ${t} of ms exceeded`,$e.ETIMEDOUT))}),t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e&&(e.removeEventListener?e.removeEventListener("abort",i):e.unsubscribe(i))})),e=null)};e.forEach((e=>e&&e.addEventListener&&e.addEventListener("abort",i)));const{signal:s}=n;return s.unsubscribe=a,[s,()=>{o&&clearTimeout(o),o=null}]},Gt=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,i=0;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},Wt=(e,t,r,n,i)=>{const o=async function*(e,t,r){for await(const n of e)yield*Gt(ArrayBuffer.isView(n)?n:await r(String(n)),t)}(e,t,i);let a,s=0,c=e=>{a||(a=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await o.next();if(t)return c(),void e.close();let i=n.byteLength;if(r){let e=s+=i;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw c(e),e}},cancel:e=>(c(e),o.return())},{highWaterMark:2})},Kt="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Xt=Kt&&"function"==typeof ReadableStream,Jt=Kt&&("function"==typeof TextEncoder?(qt=new TextEncoder,e=>qt.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var qt;const Yt=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Qt=Xt&&Yt((()=>{let e=!1;const t=new Request(St.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),Zt=Xt&&Yt((()=>Ze.isReadableStream(new Response("").body))),$t={stream:Zt&&(e=>e.body)};var er;Kt&&(er=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!$t[e]&&($t[e]=Ze.isFunction(er[e])?t=>t[e]():(t,r)=>{throw new $e(`Response type '${e}' is not supported`,$e.ERR_NOT_SUPPORT,r)})})));const tr=async(e,t)=>{const r=Ze.toFiniteNumber(e.getContentLength());return null==r?(async e=>null==e?0:Ze.isBlob(e)?e.size:Ze.isSpecCompliantForm(e)?(await new Request(e).arrayBuffer()).byteLength:Ze.isArrayBufferView(e)||Ze.isArrayBuffer(e)?e.byteLength:(Ze.isURLSearchParams(e)&&(e+=""),Ze.isString(e)?(await Jt(e)).byteLength:void 0))(t):r};var rr=Kt&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:o,timeout:a,onDownloadProgress:s,onUploadProgress:c,responseType:u,headers:d,withCredentials:l="same-origin",fetchOptions:h}=jt(e);u=u?(u+"").toLowerCase():"text";let p,f,[v,_]=i||o||a?zt([i,o],a):[];const m=()=>{!p&&setTimeout((()=>{v&&v.unsubscribe()})),p=!0};let g;try{if(c&&Qt&&"get"!==r&&"head"!==r&&0!==(g=await tr(d,n))){let e,r=new Request(t,{method:"POST",body:n,duplex:"half"});if(Ze.isFormData(n)&&(e=r.headers.get("content-type"))&&d.setContentType(e),r.body){const[e,t]=Mt(g,Nt(Dt(c)));n=Wt(r.body,65536,e,t,Jt)}}Ze.isString(l)||(l=l?"include":"omit"),f=new Request(t,{...h,signal:v,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:l});let i=await fetch(f);const o=Zt&&("stream"===u||"response"===u);if(Zt&&(s||o)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=i[t]}));const t=Ze.toFiniteNumber(i.headers.get("content-length")),[r,n]=s&&Mt(t,Nt(Dt(s),!0))||[];i=new Response(Wt(i.body,65536,r,(()=>{n&&n(),o&&m()}),Jt),e)}u=u||"text";let a=await $t[Ze.findKey($t,u)||"text"](i,e);return!o&&m(),_&&_(),await new Promise(((t,r)=>{Pt(t,r,{data:a,headers:wt.from(i.headers),status:i.status,statusText:i.statusText,config:e,request:f})}))}catch(t){if(m(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new $e("Network Error",$e.ERR_NETWORK,e,f),{cause:t.cause||t});throw $e.from(t,t&&t.code,e,f)}});const nr={http:null,xhr:Ht,fetch:rr};Ze.forEach(nr,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const ir=e=>`- ${e}`,or=e=>Ze.isFunction(e)||null===e||!1===e;var ar=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,!or(r)&&(n=nr[(t=String(r)).toLowerCase()],void 0===n))throw new $e(`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 $e("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(ir).join("\n"):" "+ir(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function sr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ot(null,e)}function cr(e){sr(e),e.headers=wt.from(e.headers),e.data=At.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ar(e.adapter||Et.adapter)(e).then((function(t){return sr(e),t.data=At.call(e,e.transformResponse,t),t.headers=wt.from(t.headers),t}),(function(t){return xt(t)||(sr(e),t&&t.response&&(t.response.data=At.call(e,e.transformResponse,t.response),t.response.headers=wt.from(t.response.headers))),Promise.reject(t)}))}const ur="1.7.3",dr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{dr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const lr={};dr.transitional=function(e,t,r){function n(e,t){return"[Axios v1.7.3] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new $e(n(i," has been removed"+(t?" in "+t:"")),$e.ERR_DEPRECATED);return t&&!lr[i]&&(lr[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 hr={assertOptions:function(e,t,r){if("object"!=typeof e)throw new $e("options must be an object",$e.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],a=t[o];if(a){const t=e[o],r=void 0===t||a(t,o,e);if(!0!==r)throw new $e("option "+o+" must be "+r,$e.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new $e("Unknown option "+o,$e.ERR_BAD_OPTION)}},validators:dr};const pr=hr.validators;class fr{constructor(e){this.defaults=e,this.interceptors={request:new ht,response:new ht}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Bt(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&hr.assertOptions(r,{silentJSONParsing:pr.transitional(pr.boolean),forcedJSONParsing:pr.transitional(pr.boolean),clarifyTimeoutError:pr.transitional(pr.boolean)},!1),null!=n&&(Ze.isFunction(n)?t.paramsSerializer={serialize:n}:hr.assertOptions(n,{encode:pr.function,serialize:pr.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=wt.concat(o,i);const a=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let d,l=0;if(!s){const e=[cr.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,c),d=e.length,u=Promise.resolve(t);l<d;)u=u.then(e[l++],e[l++]);return u}d=a.length;let h=t;for(l=0;l<d;){const e=a[l++],t=a[l++];try{h=e(h)}catch(e){t.call(this,e);break}}try{u=cr.call(this,h)}catch(e){return Promise.reject(e)}for(l=0,d=c.length;l<d;)u=u.then(c[l++],c[l++]);return u}getUri(e){return lt(Vt((e=Bt(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}Ze.forEach(["delete","get","head","options"],(function(e){fr.prototype[e]=function(t,r){return this.request(Bt(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(Bt(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}fr.prototype[e]=t(),fr.prototype[e+"Form"]=t(!0)}));class vr{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 Ot(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;const t=new vr((function(t){e=t}));return{token:t,cancel:e}}}const _r={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(_r).forEach((([e,t])=>{_r[t]=e}));const mr=function e(t){const r=new fr(t),n=ce(fr.prototype.request,r);return Ze.extend(n,fr.prototype,r,{allOwnKeys:!0}),Ze.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Bt(t,r))},n}(Et);mr.Axios=fr,mr.CanceledError=Ot,mr.CancelToken=vr,mr.isCancel=xt,mr.VERSION=ur,mr.toFormData=at,mr.AxiosError=$e,mr.Cancel=mr.CanceledError,mr.all=function(e){return Promise.all(e)},mr.spread=function(e){return function(t){return e.apply(null,t)}},mr.isAxiosError=function(e){return Ze.isObject(e)&&!0===e.isAxiosError},mr.mergeConfig=Bt,mr.AxiosHeaders=wt,mr.formToJSON=e=>bt(Ze.isHTMLForm(e)?new FormData(e):e),mr.getAdapter=ar,mr.HttpStatusCode=_r,mr.default=mr;var gr=function(){return gr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},gr.apply(this,arguments)};function yr(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function Sr(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}"function"==typeof SuppressedError&&SuppressedError;var br="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Er(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kr={exports:{}},Tr=function(e){return e&&e.Math===Math&&e},Ir=Tr("object"==typeof globalThis&&globalThis)||Tr("object"==typeof window&&window)||Tr("object"==typeof self&&self)||Tr("object"==typeof br&&br)||function(){return this}()||br||Function("return this")(),Rr=function(e){try{return!!e()}catch(e){return!0}},Cr=!Rr((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),wr=Cr,Ar=Function.prototype,xr=Ar.apply,Or=Ar.call,Pr="object"==typeof Reflect&&Reflect.apply||(wr?Or.bind(xr):function(){return Or.apply(xr,arguments)}),Nr=Cr,Mr=Function.prototype,Dr=Mr.call,Lr=Nr&&Mr.bind.bind(Dr,Dr),Ur=Nr?Lr:function(e){return function(){return Dr.apply(e,arguments)}},Vr=Ur,Fr=Vr({}.toString),Br=Vr("".slice),jr=function(e){return Br(Fr(e),8,-1)},Hr=jr,zr=Ur,Gr=function(e){if("Function"===Hr(e))return zr(e)},Wr="object"==typeof document&&document.all,Kr={all:Wr,IS_HTMLDDA:void 0===Wr&&void 0!==Wr},Xr=Kr.all,Jr=Kr.IS_HTMLDDA?function(e){return"function"==typeof e||e===Xr}:function(e){return"function"==typeof e},qr={},Yr=!Rr((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Qr=Cr,Zr=Function.prototype.call,$r=Qr?Zr.bind(Zr):function(){return Zr.apply(Zr,arguments)},en={},tn={}.propertyIsEnumerable,rn=Object.getOwnPropertyDescriptor,nn=rn&&!tn.call({1:2},1);en.f=nn?function(e){var t=rn(this,e);return!!t&&t.enumerable}:tn;var on,an,sn=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},cn=Rr,un=jr,dn=Object,ln=Ur("".split),hn=cn((function(){return!dn("z").propertyIsEnumerable(0)}))?function(e){return"String"===un(e)?ln(e,""):dn(e)}:dn,pn=function(e){return null==e},fn=pn,vn=TypeError,_n=function(e){if(fn(e))throw vn("Can't call method on "+e);return e},mn=hn,gn=_n,yn=function(e){return mn(gn(e))},Sn=Jr,bn=Kr.all,En=Kr.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:Sn(e)||e===bn}:function(e){return"object"==typeof e?null!==e:Sn(e)},kn={},Tn=kn,In=Ir,Rn=Jr,Cn=function(e){return Rn(e)?e:void 0},wn=function(e,t){return arguments.length<2?Cn(Tn[e])||Cn(In[e]):Tn[e]&&Tn[e][t]||In[e]&&In[e][t]},An=Ur({}.isPrototypeOf),xn="undefined"!=typeof navigator&&String(navigator.userAgent)||"",On=Ir,Pn=xn,Nn=On.process,Mn=On.Deno,Dn=Nn&&Nn.versions||Mn&&Mn.version,Ln=Dn&&Dn.v8;Ln&&(an=(on=Ln.split("."))[0]>0&&on[0]<4?1:+(on[0]+on[1])),!an&&Pn&&(!(on=Pn.match(/Edge\/(\d+)/))||on[1]>=74)&&(on=Pn.match(/Chrome\/(\d+)/))&&(an=+on[1]);var Un=an,Vn=Un,Fn=Rr,Bn=Ir.String,jn=!!Object.getOwnPropertySymbols&&!Fn((function(){var e=Symbol("symbol detection");return!Bn(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Vn&&Vn<41})),Hn=jn&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,zn=wn,Gn=Jr,Wn=An,Kn=Object,Xn=Hn?function(e){return"symbol"==typeof e}:function(e){var t=zn("Symbol");return Gn(t)&&Wn(t.prototype,Kn(e))},Jn=String,qn=function(e){try{return Jn(e)}catch(e){return"Object"}},Yn=Jr,Qn=qn,Zn=TypeError,$n=function(e){if(Yn(e))return e;throw Zn(Qn(e)+" is not a function")},ei=$n,ti=pn,ri=function(e,t){var r=e[t];return ti(r)?void 0:ei(r)},ni=$r,ii=Jr,oi=En,ai=TypeError,si={exports:{}},ci=!0,ui=Ir,di=Object.defineProperty,li=function(e,t){try{di(ui,e,{value:t,configurable:!0,writable:!0})}catch(r){ui[e]=t}return t},hi="__core-js_shared__",pi=Ir[hi]||li(hi,{}),fi=pi;(si.exports=function(e,t){return fi[e]||(fi[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.32.1",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE",source:"https://github.com/zloirock/core-js"});var vi=si.exports,_i=_n,mi=Object,gi=function(e){return mi(_i(e))},yi=gi,Si=Ur({}.hasOwnProperty),bi=Object.hasOwn||function(e,t){return Si(yi(e),t)},Ei=Ur,ki=0,Ti=Math.random(),Ii=Ei(1..toString),Ri=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ii(++ki+Ti,36)},Ci=vi,wi=bi,Ai=Ri,xi=jn,Oi=Hn,Pi=Ir.Symbol,Ni=Ci("wks"),Mi=Oi?Pi.for||Pi:Pi&&Pi.withoutSetter||Ai,Di=function(e){return wi(Ni,e)||(Ni[e]=xi&&wi(Pi,e)?Pi[e]:Mi("Symbol."+e)),Ni[e]},Li=$r,Ui=En,Vi=Xn,Fi=ri,Bi=function(e,t){var r,n;if("string"===t&&ii(r=e.toString)&&!oi(n=ni(r,e)))return n;if(ii(r=e.valueOf)&&!oi(n=ni(r,e)))return n;if("string"!==t&&ii(r=e.toString)&&!oi(n=ni(r,e)))return n;throw ai("Can't convert object to primitive value")},ji=TypeError,Hi=Di("toPrimitive"),zi=function(e,t){if(!Ui(e)||Vi(e))return e;var r,n=Fi(e,Hi);if(n){if(void 0===t&&(t="default"),r=Li(n,e,t),!Ui(r)||Vi(r))return r;throw ji("Can't convert object to primitive value")}return void 0===t&&(t="number"),Bi(e,t)},Gi=Xn,Wi=function(e){var t=zi(e,"string");return Gi(t)?t:t+""},Ki=En,Xi=Ir.document,Ji=Ki(Xi)&&Ki(Xi.createElement),qi=function(e){return Ji?Xi.createElement(e):{}},Yi=qi,Qi=!Yr&&!Rr((function(){return 7!==Object.defineProperty(Yi("div"),"a",{get:function(){return 7}}).a})),Zi=Yr,$i=$r,eo=en,to=sn,ro=yn,no=Wi,io=bi,oo=Qi,ao=Object.getOwnPropertyDescriptor;qr.f=Zi?ao:function(e,t){if(e=ro(e),t=no(t),oo)try{return ao(e,t)}catch(e){}if(io(e,t))return to(!$i(eo.f,e,t),e[t])};var so=Rr,co=Jr,uo=/#|\.prototype\./,lo=function(e,t){var r=po[ho(e)];return r===vo||r!==fo&&(co(t)?so(t):!!t)},ho=lo.normalize=function(e){return String(e).replace(uo,".").toLowerCase()},po=lo.data={},fo=lo.NATIVE="N",vo=lo.POLYFILL="P",_o=lo,mo=$n,go=Cr,yo=Gr(Gr.bind),So=function(e,t){return mo(e),void 0===t?e:go?yo(e,t):function(){return e.apply(t,arguments)}},bo={},Eo=Yr&&Rr((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ko=En,To=String,Io=TypeError,Ro=function(e){if(ko(e))return e;throw Io(To(e)+" is not an object")},Co=Yr,wo=Qi,Ao=Eo,xo=Ro,Oo=Wi,Po=TypeError,No=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,Do="enumerable",Lo="configurable",Uo="writable";bo.f=Co?Ao?function(e,t,r){if(xo(e),t=Oo(t),xo(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Uo in r&&!r[Uo]){var n=Mo(e,t);n&&n[Uo]&&(e[t]=r.value,r={configurable:Lo in r?r[Lo]:n[Lo],enumerable:Do in r?r[Do]:n[Do],writable:!1})}return No(e,t,r)}:No:function(e,t,r){if(xo(e),t=Oo(t),xo(r),wo)try{return No(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Po("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Vo=bo,Fo=sn,Bo=Yr?function(e,t,r){return Vo.f(e,t,Fo(1,r))}:function(e,t,r){return e[t]=r,e},jo=Ir,Ho=Pr,zo=Gr,Go=Jr,Wo=qr.f,Ko=_o,Xo=kn,Jo=So,qo=Bo,Yo=bi,Qo=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 Ho(e,this,arguments)};return t.prototype=e.prototype,t},Zo=function(e,t){var r,n,i,o,a,s,c,u,d,l=e.target,h=e.global,p=e.stat,f=e.proto,v=h?jo:p?jo[l]:(jo[l]||{}).prototype,_=h?Xo:Xo[l]||qo(Xo,l,{})[l],m=_.prototype;for(o in t)n=!(r=Ko(h?o:l+(p?".":"#")+o,e.forced))&&v&&Yo(v,o),s=_[o],n&&(c=e.dontCallGetSet?(d=Wo(v,o))&&d.value:v[o]),a=n&&c?c:t[o],n&&typeof s==typeof a||(u=e.bind&&n?Jo(a,jo):e.wrap&&n?Qo(a):f&&Go(a)?zo(a):a,(e.sham||a&&a.sham||s&&s.sham)&&qo(u,"sham",!0),qo(_,o,u),f&&(Yo(Xo,i=l+"Prototype")||qo(Xo,i,{}),qo(Xo[i],o,a),e.real&&m&&(r||!m[o])&&qo(m,o,a)))},$o=Zo,ea=Yr,ta=bo.f;$o({target:"Object",stat:!0,forced:Object.defineProperty!==ta,sham:!ea},{defineProperty:ta});var ra=kn.Object,na=kr.exports=function(e,t,r){return ra.defineProperty(e,t,r)};ra.defineProperty.sham&&(na.sham=!0);var ia=kr.exports,oa=Er(ia),aa=jr,sa=Array.isArray||function(e){return"Array"===aa(e)},ca=Math.ceil,ua=Math.floor,da=Math.trunc||function(e){var t=+e;return(t>0?ua:ca)(t)},la=da,ha=function(e){var t=+e;return t!=t||0===t?0:la(t)},pa=ha,fa=Math.min,va=function(e){return e>0?fa(pa(e),9007199254740991):0},_a=va,ma=function(e){return _a(e.length)},ga=TypeError,ya=function(e){if(e>9007199254740991)throw ga("Maximum allowed index exceeded");return e},Sa=Wi,ba=bo,Ea=sn,ka=function(e,t,r){var n=Sa(t);n in e?ba.f(e,n,Ea(0,r)):e[n]=r},Ta={};Ta[Di("toStringTag")]="z";var Ia="[object z]"===String(Ta),Ra=Ia,Ca=Jr,wa=jr,Aa=Di("toStringTag"),xa=Object,Oa="Arguments"===wa(function(){return arguments}()),Pa=Ra?wa: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=xa(e),Aa))?r:Oa?wa(t):"Object"===(n=wa(t))&&Ca(t.callee)?"Arguments":n},Na=Jr,Ma=pi,Da=Ur(Function.toString);Na(Ma.inspectSource)||(Ma.inspectSource=function(e){return Da(e)});var La=Ma.inspectSource,Ua=Ur,Va=Rr,Fa=Jr,Ba=Pa,ja=La,Ha=function(){},za=[],Ga=wn("Reflect","construct"),Wa=/^\s*(?:class|function)\b/,Ka=Ua(Wa.exec),Xa=!Wa.exec(Ha),Ja=function(e){if(!Fa(e))return!1;try{return Ga(Ha,za,e),!0}catch(e){return!1}},qa=function(e){if(!Fa(e))return!1;switch(Ba(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Xa||!!Ka(Wa,ja(e))}catch(e){return!0}};qa.sham=!0;var Ya=!Ga||Va((function(){var e;return Ja(Ja.call)||!Ja(Object)||!Ja((function(){e=!0}))||e}))?qa:Ja,Qa=sa,Za=Ya,$a=En,es=Di("species"),ts=Array,rs=function(e){var t;return Qa(e)&&(t=e.constructor,(Za(t)&&(t===ts||Qa(t.prototype))||$a(t)&&null===(t=t[es]))&&(t=void 0)),void 0===t?ts:t},ns=function(e,t){return new(rs(e))(0===t?0:t)},is=Rr,os=Un,as=Di("species"),ss=function(e){return os>=51||!is((function(){var t=[];return(t.constructor={})[as]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},cs=Zo,us=Rr,ds=sa,ls=En,hs=gi,ps=ma,fs=ya,vs=ka,_s=ns,ms=ss,gs=Un,ys=Di("isConcatSpreadable"),Ss=gs>=51||!us((function(){var e=[];return e[ys]=!1,e.concat()[0]!==e})),bs=function(e){if(!ls(e))return!1;var t=e[ys];return void 0!==t?!!t:ds(e)};cs({target:"Array",proto:!0,arity:1,forced:!Ss||!ms("concat")},{concat:function(e){var t,r,n,i,o,a=hs(this),s=_s(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(bs(o=-1===t?a:arguments[t]))for(i=ps(o),fs(c+i),r=0;r<i;r++,c++)r in o&&vs(s,c,o[r]);else fs(c+1),vs(s,c++,o);return s.length=c,s}});var Es=Pa,ks=String,Ts=function(e){if("Symbol"===Es(e))throw TypeError("Cannot convert a Symbol value to a string");return ks(e)},Is={},Rs=ha,Cs=Math.max,ws=Math.min,As=function(e,t){var r=Rs(e);return r<0?Cs(r+t,0):ws(r,t)},xs=yn,Os=As,Ps=ma,Ns=function(e){return function(t,r,n){var i,o=xs(t),a=Ps(o),s=Os(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},Ms={includes:Ns(!0),indexOf:Ns(!1)},Ds={},Ls=bi,Us=yn,Vs=Ms.indexOf,Fs=Ds,Bs=Ur([].push),js=function(e,t){var r,n=Us(e),i=0,o=[];for(r in n)!Ls(Fs,r)&&Ls(n,r)&&Bs(o,r);for(;t.length>i;)Ls(n,r=t[i++])&&(~Vs(o,r)||Bs(o,r));return o},Hs=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],zs=js,Gs=Hs,Ws=Object.keys||function(e){return zs(e,Gs)},Ks=Yr,Xs=Eo,Js=bo,qs=Ro,Ys=yn,Qs=Ws;Is.f=Ks&&!Xs?Object.defineProperties:function(e,t){qs(e);for(var r,n=Ys(t),i=Qs(t),o=i.length,a=0;o>a;)Js.f(e,r=i[a++],n[r]);return e};var Zs,$s=wn("document","documentElement"),ec=Ri,tc=vi("keys"),rc=function(e){return tc[e]||(tc[e]=ec(e))},nc=Ro,ic=Is,oc=Hs,ac=Ds,sc=$s,cc=qi,uc="prototype",dc="script",lc=rc("IE_PROTO"),hc=function(){},pc=function(e){return"<"+dc+">"+e+"</"+dc+">"},fc=function(e){e.write(pc("")),e.close();var t=e.parentWindow.Object;return e=null,t},vc=function(){try{Zs=new ActiveXObject("htmlfile")}catch(e){}vc="undefined"!=typeof document?document.domain&&Zs?fc(Zs):function(){var e,t=cc("iframe"),r="java"+dc+":";return t.style.display="none",sc.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(pc("document.F=Object")),e.close(),e.F}():fc(Zs);for(var e=oc.length;e--;)delete vc[uc][oc[e]];return vc()};ac[lc]=!0;var _c=Object.create||function(e,t){var r;return null!==e?(hc[uc]=nc(e),r=new hc,hc[uc]=null,r[lc]=e):r=vc(),void 0===t?r:ic.f(r,t)},mc={},gc=js,yc=Hs.concat("length","prototype");mc.f=Object.getOwnPropertyNames||function(e){return gc(e,yc)};var Sc={},bc=As,Ec=ma,kc=ka,Tc=Array,Ic=Math.max,Rc=function(e,t,r){for(var n=Ec(e),i=bc(t,n),o=bc(void 0===r?n:r,n),a=Tc(Ic(o-i,0)),s=0;i<o;i++,s++)kc(a,s,e[i]);return a.length=s,a},Cc=jr,wc=yn,Ac=mc.f,xc=Rc,Oc="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Sc.f=function(e){return Oc&&"Window"===Cc(e)?function(e){try{return Ac(e)}catch(e){return xc(Oc)}}(e):Ac(wc(e))};var Pc={};Pc.f=Object.getOwnPropertySymbols;var Nc=Bo,Mc=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Nc(e,t,r),e},Dc=bo,Lc=function(e,t,r){return Dc.f(e,t,r)},Uc={},Vc=Di;Uc.f=Vc;var Fc,Bc,jc,Hc=kn,zc=bi,Gc=Uc,Wc=bo.f,Kc=function(e){var t=Hc.Symbol||(Hc.Symbol={});zc(t,e)||Wc(t,e,{value:Gc.f(e)})},Xc=$r,Jc=wn,qc=Di,Yc=Mc,Qc=function(){var e=Jc("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=qc("toPrimitive");t&&!t[n]&&Yc(t,n,(function(e){return Xc(r,this)}),{arity:1})},Zc=Pa,$c=Ia?{}.toString:function(){return"[object "+Zc(this)+"]"},eu=Ia,tu=bo.f,ru=Bo,nu=bi,iu=$c,ou=Di("toStringTag"),au=function(e,t,r,n){if(e){var i=r?e:e.prototype;nu(i,ou)||tu(i,ou,{configurable:!0,value:t}),n&&!eu&&ru(i,"toString",iu)}},su=Jr,cu=Ir.WeakMap,uu=su(cu)&&/native code/.test(String(cu)),du=Ir,lu=En,hu=Bo,pu=bi,fu=pi,vu=rc,_u=Ds,mu="Object already initialized",gu=du.TypeError,yu=du.WeakMap;if(uu||fu.state){var Su=fu.state||(fu.state=new yu);Su.get=Su.get,Su.has=Su.has,Su.set=Su.set,Fc=function(e,t){if(Su.has(e))throw gu(mu);return t.facade=e,Su.set(e,t),t},Bc=function(e){return Su.get(e)||{}},jc=function(e){return Su.has(e)}}else{var bu=vu("state");_u[bu]=!0,Fc=function(e,t){if(pu(e,bu))throw gu(mu);return t.facade=e,hu(e,bu,t),t},Bc=function(e){return pu(e,bu)?e[bu]:{}},jc=function(e){return pu(e,bu)}}var Eu={set:Fc,get:Bc,has:jc,enforce:function(e){return jc(e)?Bc(e):Fc(e,{})},getterFor:function(e){return function(t){var r;if(!lu(t)||(r=Bc(t)).type!==e)throw gu("Incompatible receiver, "+e+" required");return r}}},ku=So,Tu=hn,Iu=gi,Ru=ma,Cu=ns,wu=Ur([].push),Au=function(e){var t=1===e,r=2===e,n=3===e,i=4===e,o=6===e,a=7===e,s=5===e||o;return function(c,u,d,l){for(var h,p,f=Iu(c),v=Tu(f),_=ku(u,d),m=Ru(v),g=0,y=l||Cu,S=t?y(c,m):r||a?y(c,0):void 0;m>g;g++)if((s||g in v)&&(p=_(h=v[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:wu(S,h)}else switch(e){case 4:return!1;case 7:wu(S,h)}return o?-1:n||i?i:S}},xu={forEach:Au(0),map:Au(1),filter:Au(2),some:Au(3),every:Au(4),find:Au(5),findIndex:Au(6),filterReject:Au(7)},Ou=Zo,Pu=Ir,Nu=$r,Mu=Ur,Du=Yr,Lu=jn,Uu=Rr,Vu=bi,Fu=An,Bu=Ro,ju=yn,Hu=Wi,zu=Ts,Gu=sn,Wu=_c,Ku=Ws,Xu=mc,Ju=Sc,qu=Pc,Yu=qr,Qu=bo,Zu=Is,$u=en,ed=Mc,td=Lc,rd=vi,nd=Ds,id=Ri,od=Di,ad=Uc,sd=Kc,cd=Qc,ud=au,dd=Eu,ld=xu.forEach,hd=rc("hidden"),pd="Symbol",fd="prototype",vd=dd.set,_d=dd.getterFor(pd),md=Object[fd],gd=Pu.Symbol,yd=gd&&gd[fd],Sd=Pu.TypeError,bd=Pu.QObject,Ed=Yu.f,kd=Qu.f,Td=Ju.f,Id=$u.f,Rd=Mu([].push),Cd=rd("symbols"),wd=rd("op-symbols"),Ad=rd("wks"),xd=!bd||!bd[fd]||!bd[fd].findChild,Od=Du&&Uu((function(){return 7!==Wu(kd({},"a",{get:function(){return kd(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Ed(md,t);n&&delete md[t],kd(e,t,r),n&&e!==md&&kd(md,t,n)}:kd,Pd=function(e,t){var r=Cd[e]=Wu(yd);return vd(r,{type:pd,tag:e,description:t}),Du||(r.description=t),r},Nd=function(e,t,r){e===md&&Nd(wd,t,r),Bu(e);var n=Hu(t);return Bu(r),Vu(Cd,n)?(r.enumerable?(Vu(e,hd)&&e[hd][n]&&(e[hd][n]=!1),r=Wu(r,{enumerable:Gu(0,!1)})):(Vu(e,hd)||kd(e,hd,Gu(1,{})),e[hd][n]=!0),Od(e,n,r)):kd(e,n,r)},Md=function(e,t){Bu(e);var r=ju(t),n=Ku(r).concat(Vd(r));return ld(n,(function(t){Du&&!Nu(Dd,r,t)||Nd(e,t,r[t])})),e},Dd=function(e){var t=Hu(e),r=Nu(Id,this,t);return!(this===md&&Vu(Cd,t)&&!Vu(wd,t))&&(!(r||!Vu(this,t)||!Vu(Cd,t)||Vu(this,hd)&&this[hd][t])||r)},Ld=function(e,t){var r=ju(e),n=Hu(t);if(r!==md||!Vu(Cd,n)||Vu(wd,n)){var i=Ed(r,n);return!i||!Vu(Cd,n)||Vu(r,hd)&&r[hd][n]||(i.enumerable=!0),i}},Ud=function(e){var t=Td(ju(e)),r=[];return ld(t,(function(e){Vu(Cd,e)||Vu(nd,e)||Rd(r,e)})),r},Vd=function(e){var t=e===md,r=Td(t?wd:ju(e)),n=[];return ld(r,(function(e){!Vu(Cd,e)||t&&!Vu(md,e)||Rd(n,Cd[e])})),n};Lu||(ed(yd=(gd=function(){if(Fu(yd,this))throw Sd("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?zu(arguments[0]):void 0,t=id(e),r=function(e){this===md&&Nu(r,wd,e),Vu(this,hd)&&Vu(this[hd],t)&&(this[hd][t]=!1),Od(this,t,Gu(1,e))};return Du&&xd&&Od(md,t,{configurable:!0,set:r}),Pd(t,e)})[fd],"toString",(function(){return _d(this).tag})),ed(gd,"withoutSetter",(function(e){return Pd(id(e),e)})),$u.f=Dd,Qu.f=Nd,Zu.f=Md,Yu.f=Ld,Xu.f=Ju.f=Ud,qu.f=Vd,ad.f=function(e){return Pd(od(e),e)},Du&&td(yd,"description",{configurable:!0,get:function(){return _d(this).description}})),Ou({global:!0,constructor:!0,wrap:!0,forced:!Lu,sham:!Lu},{Symbol:gd}),ld(Ku(Ad),(function(e){sd(e)})),Ou({target:pd,stat:!0,forced:!Lu},{useSetter:function(){xd=!0},useSimple:function(){xd=!1}}),Ou({target:"Object",stat:!0,forced:!Lu,sham:!Du},{create:function(e,t){return void 0===t?Wu(e):Md(Wu(e),t)},defineProperty:Nd,defineProperties:Md,getOwnPropertyDescriptor:Ld}),Ou({target:"Object",stat:!0,forced:!Lu},{getOwnPropertyNames:Ud}),cd(),ud(gd,pd),nd[hd]=!0;var Fd=jn&&!!Symbol.for&&!!Symbol.keyFor,Bd=Zo,jd=wn,Hd=bi,zd=Ts,Gd=vi,Wd=Fd,Kd=Gd("string-to-symbol-registry"),Xd=Gd("symbol-to-string-registry");Bd({target:"Symbol",stat:!0,forced:!Wd},{for:function(e){var t=zd(e);if(Hd(Kd,t))return Kd[t];var r=jd("Symbol")(t);return Kd[t]=r,Xd[r]=t,r}});var Jd=Zo,qd=bi,Yd=Xn,Qd=qn,Zd=Fd,$d=vi("symbol-to-string-registry");Jd({target:"Symbol",stat:!0,forced:!Zd},{keyFor:function(e){if(!Yd(e))throw TypeError(Qd(e)+" is not a symbol");if(qd($d,e))return $d[e]}});var el=Ur([].slice),tl=sa,rl=Jr,nl=jr,il=Ts,ol=Ur([].push),al=Zo,sl=wn,cl=Pr,ul=$r,dl=Ur,ll=Rr,hl=Jr,pl=Xn,fl=el,vl=function(e){if(rl(e))return e;if(tl(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?ol(r,i):"number"!=typeof i&&"Number"!==nl(i)&&"String"!==nl(i)||ol(r,il(i))}var o=r.length,a=!0;return function(e,t){if(a)return a=!1,t;if(tl(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}},_l=jn,ml=String,gl=sl("JSON","stringify"),yl=dl(/./.exec),Sl=dl("".charAt),bl=dl("".charCodeAt),El=dl("".replace),kl=dl(1..toString),Tl=/[\uD800-\uDFFF]/g,Il=/^[\uD800-\uDBFF]$/,Rl=/^[\uDC00-\uDFFF]$/,Cl=!_l||ll((function(){var e=sl("Symbol")("stringify detection");return"[null]"!==gl([e])||"{}"!==gl({a:e})||"{}"!==gl(Object(e))})),wl=ll((function(){return'"\\udf06\\ud834"'!==gl("\udf06\ud834")||'"\\udead"'!==gl("\udead")})),Al=function(e,t){var r=fl(arguments),n=vl(t);if(hl(n)||void 0!==e&&!pl(e))return r[1]=function(e,t){if(hl(n)&&(t=ul(n,this,ml(e),t)),!pl(t))return t},cl(gl,null,r)},xl=function(e,t,r){var n=Sl(r,t-1),i=Sl(r,t+1);return yl(Il,e)&&!yl(Rl,i)||yl(Rl,e)&&!yl(Il,n)?"\\u"+kl(bl(e,0),16):e};gl&&al({target:"JSON",stat:!0,arity:3,forced:Cl||wl},{stringify:function(e,t,r){var n=fl(arguments),i=cl(Cl?Al:gl,null,n);return wl&&"string"==typeof i?El(i,Tl,xl):i}});var Ol=Pc,Pl=gi;Zo({target:"Object",stat:!0,forced:!jn||Rr((function(){Ol.f(1)}))},{getOwnPropertySymbols:function(e){var t=Ol.f;return t?t(Pl(e)):[]}}),Kc("asyncIterator"),Kc("hasInstance"),Kc("isConcatSpreadable"),Kc("iterator"),Kc("match"),Kc("matchAll"),Kc("replace"),Kc("search"),Kc("species"),Kc("split");var Nl=Qc;Kc("toPrimitive"),Nl();var Ml=wn,Dl=au;Kc("toStringTag"),Dl(Ml("Symbol"),"Symbol"),Kc("unscopables"),au(Ir.JSON,"JSON",!0);var Ll,Ul,Vl,Fl=kn.Symbol,Bl={},jl=Yr,Hl=bi,zl=Function.prototype,Gl=jl&&Object.getOwnPropertyDescriptor,Wl=Hl(zl,"name"),Kl={EXISTS:Wl,PROPER:Wl&&"something"===function(){}.name,CONFIGURABLE:Wl&&(!jl||jl&&Gl(zl,"name").configurable)},Xl=!Rr((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Jl=bi,ql=Jr,Yl=gi,Ql=Xl,Zl=rc("IE_PROTO"),$l=Object,eh=$l.prototype,th=Ql?$l.getPrototypeOf:function(e){var t=Yl(e);if(Jl(t,Zl))return t[Zl];var r=t.constructor;return ql(r)&&t instanceof r?r.prototype:t instanceof $l?eh:null},rh=Rr,nh=Jr,ih=En,oh=_c,ah=th,sh=Mc,ch=Di("iterator"),uh=!1;[].keys&&("next"in(Vl=[].keys())?(Ul=ah(ah(Vl)))!==Object.prototype&&(Ll=Ul):uh=!0);var dh=!ih(Ll)||rh((function(){var e={};return Ll[ch].call(e)!==e}));nh((Ll=dh?{}:oh(Ll))[ch])||sh(Ll,ch,(function(){return this}));var lh={IteratorPrototype:Ll,BUGGY_SAFARI_ITERATORS:uh},hh=lh.IteratorPrototype,ph=_c,fh=sn,vh=au,_h=Bl,mh=function(){return this},gh=function(e,t,r,n){var i=t+" Iterator";return e.prototype=ph(hh,{next:fh(+!n,r)}),vh(e,i,!1,!0),_h[i]=mh,e},yh=Ur,Sh=$n,bh=Jr,Eh=String,kh=TypeError,Th=function(e,t,r){try{return yh(Sh(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},Ih=Ro,Rh=function(e){if("object"==typeof e||bh(e))return e;throw kh("Can't set "+Eh(e)+" as a prototype")},Ch=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Th(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return Ih(r),Rh(n),t?e(r,n):r.__proto__=n,r}}():void 0),wh=Zo,Ah=$r,xh=gh,Oh=th,Ph=au,Nh=Mc,Mh=Bl,Dh=Kl.PROPER,Lh=lh.BUGGY_SAFARI_ITERATORS,Uh=Di("iterator"),Vh="keys",Fh="values",Bh="entries",jh=function(){return this},Hh=function(e,t,r,n,i,o,a){xh(r,t,n);var s,c,u,d=function(e){if(e===i&&v)return v;if(!Lh&&e in p)return p[e];switch(e){case Vh:case Fh:case Bh:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[Uh]||p["@@iterator"]||i&&p[i],v=!Lh&&f||d(i),_="Array"===t&&p.entries||f;if(_&&(s=Oh(_.call(new e)))!==Object.prototype&&s.next&&(Ph(s,l,!0,!0),Mh[l]=jh),Dh&&i===Fh&&f&&f.name!==Fh&&(h=!0,v=function(){return Ah(f,this)}),i)if(c={values:d(Fh),keys:o?v:d(Vh),entries:d(Bh)},a)for(u in c)(Lh||h||!(u in p))&&Nh(p,u,c[u]);else wh({target:t,proto:!0,forced:Lh||h},c);return a&&p[Uh]!==v&&Nh(p,Uh,v,{name:i}),Mh[t]=v,c},zh=function(e,t){return{value:e,done:t}},Gh=yn,Wh=Bl,Kh=Eu;bo.f;var Xh=Hh,Jh=zh,qh="Array Iterator",Yh=Kh.set,Qh=Kh.getterFor(qh);Xh(Array,"Array",(function(e,t){Yh(this,{type:qh,target:Gh(e),index:0,kind:t})}),(function(){var e=Qh(this),t=e.target,r=e.kind,n=e.index++;if(!t||n>=t.length)return e.target=void 0,Jh(void 0,!0);switch(r){case"keys":return Jh(n,!1);case"values":return Jh(t[n],!1)}return Jh([n,t[n]],!1)}),"values"),Wh.Arguments=Wh.Array;var Zh={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},$h=Ir,ep=Pa,tp=Bo,rp=Bl,np=Di("toStringTag");for(var ip in Zh){var op=$h[ip],ap=op&&op.prototype;ap&&ep(ap)!==np&&tp(ap,np,ip),rp[ip]=rp.Array}var sp=Fl,cp=Di,up=bo.f,dp=cp("metadata"),lp=Function.prototype;void 0===lp[dp]&&up(lp,dp,{value:null}),Kc("asyncDispose"),Kc("dispose"),Kc("metadata");var hp=sp,pp=Ur,fp=wn("Symbol"),vp=fp.keyFor,_p=pp(fp.prototype.valueOf),mp=fp.isRegisteredSymbol||function(e){try{return void 0!==vp(_p(e))}catch(e){return!1}};Zo({target:"Symbol",stat:!0},{isRegisteredSymbol:mp});for(var gp=vi,yp=wn,Sp=Ur,bp=Xn,Ep=Di,kp=yp("Symbol"),Tp=kp.isWellKnownSymbol,Ip=yp("Object","getOwnPropertyNames"),Rp=Sp(kp.prototype.valueOf),Cp=gp("wks"),wp=0,Ap=Ip(kp),xp=Ap.length;wp<xp;wp++)try{var Op=Ap[wp];bp(kp[Op])&&Ep(Op)}catch(RA){}var Pp=function(e){if(Tp&&Tp(e))return!0;try{for(var t=Rp(e),r=0,n=Ip(Cp),i=n.length;r<i;r++)if(Cp[n[r]]==t)return!0}catch(e){}return!1};Zo({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:Pp}),Kc("matcher"),Kc("observable"),Zo({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:mp}),Zo({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:Pp}),Kc("metadataKey"),Kc("patternMatch"),Kc("replaceAll");var Np=hp,Mp=Er(Np),Dp=Ur,Lp=ha,Up=Ts,Vp=_n,Fp=Dp("".charAt),Bp=Dp("".charCodeAt),jp=Dp("".slice),Hp=function(e){return function(t,r){var n,i,o=Up(Vp(t)),a=Lp(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=Bp(o,a))<55296||n>56319||a+1===s||(i=Bp(o,a+1))<56320||i>57343?e?Fp(o,a):n:e?jp(o,a,a+2):i-56320+(n-55296<<10)+65536}},zp={codeAt:Hp(!1),charAt:Hp(!0)},Gp=zp.charAt,Wp=Ts,Kp=Eu,Xp=Hh,Jp=zh,qp="String Iterator",Yp=Kp.set,Qp=Kp.getterFor(qp);Xp(String,"String",(function(e){Yp(this,{type:qp,string:Wp(e),index:0})}),(function(){var e,t=Qp(this),r=t.string,n=t.index;return n>=r.length?Jp(void 0,!0):(e=Gp(r,n),t.index+=e.length,Jp(e,!1))}));var Zp=Er(Uc.f("iterator"));function $p(e){return($p="function"==typeof Mp&&"symbol"==typeof Zp?function(e){return typeof e}:function(e){return e&&"function"==typeof Mp&&e.constructor===Mp&&e!==Mp.prototype?"symbol":typeof e})(e)}var ef=Er(Uc.f("toPrimitive"));function tf(e){var t=function(e,t){if("object"!==$p(e)||null===e)return e;var r=e[ef];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==$p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===$p(t)?t:String(t)}function rf(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),oa(e,tf(n.key),n)}}function nf(e,t,r){return t&&rf(e.prototype,t),r&&rf(e,r),oa(e,"prototype",{writable:!1}),e}function of(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function af(e,t,r){return(t=tf(t))in e?oa(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Zo({target:"Object",stat:!0,sham:!Yr},{create:_c});var sf=kn.Object,cf=function(e,t){return sf.create(e,t)},uf=Er(cf),df=gi,lf=th,hf=Xl;Zo({target:"Object",stat:!0,forced:Rr((function(){lf(1)})),sham:!hf},{getPrototypeOf:function(e){return lf(df(e))}});var pf=Er(kn.Object.getPrototypeOf),ff=Rr,vf=function(e,t){var r=[][e];return!!r&&ff((function(){r.call(null,t||function(){return 1},1)}))},_f=xu.forEach,mf=vf("forEach")?[].forEach:function(e){return _f(this,e,arguments.length>1?arguments[1]:void 0)};Zo({target:"Array",proto:!0,forced:[].forEach!==mf},{forEach:mf});var gf=kn,yf=function(e){return gf[e+"Prototype"]},Sf=yf("Array").forEach,bf=Pa,Ef=bi,kf=An,Tf=Sf,If=Array.prototype,Rf={DOMTokenList:!0,NodeList:!0},Cf=function(e){var t=e.forEach;return e===If||kf(If,e)&&t===If.forEach||Ef(Rf,bf(e))?Tf:t},wf=Er(Cf),Af=Yr,xf=sa,Of=TypeError,Pf=Object.getOwnPropertyDescriptor,Nf=Af&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}(),Mf=Nf?function(e,t){if(xf(e)&&!Pf(e,"length").writable)throw Of("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Df=Zo,Lf=gi,Uf=ma,Vf=Mf,Ff=ya,Bf=Rr((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}();Df({target:"Array",proto:!0,arity:1,forced:Bf},{push:function(e){var t=Lf(this),r=Uf(t),n=arguments.length;Ff(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return Vf(t,r),r}});var jf=yf("Array").push,Hf=An,zf=jf,Gf=Array.prototype,Wf=function(e){var t=e.push;return e===Gf||Hf(Gf,e)&&t===Gf.push?zf:t},Kf=Er(Wf);Zo({target:"Object",stat:!0},{setPrototypeOf:Ch});var Xf=kn.Object.setPrototypeOf,Jf=Er(Xf),qf=wn,Yf=mc,Qf=Pc,Zf=Ro,$f=Ur([].concat),ev=qf("Reflect","ownKeys")||function(e){var t=Yf.f(Zf(e)),r=Qf.f;return r?$f(t,r(e)):t},tv=bi,rv=ev,nv=qr,iv=bo,ov=En,av=Bo,sv=Error,cv=Ur("".replace),uv=String(sv("zxcasd").stack),dv=/\n\s*at [^:]*:[^\n]*/,lv=dv.test(uv),hv=sn,pv=!Rr((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",hv(1,7)),7!==e.stack)})),fv=Bo,vv=function(e,t){if(lv&&"string"==typeof e&&!sv.prepareStackTrace)for(;t--;)e=cv(e,dv,"");return e},_v=pv,mv=Error.captureStackTrace,gv=Bl,yv=Di("iterator"),Sv=Array.prototype,bv=function(e){return void 0!==e&&(gv.Array===e||Sv[yv]===e)},Ev=Pa,kv=ri,Tv=pn,Iv=Bl,Rv=Di("iterator"),Cv=function(e){if(!Tv(e))return kv(e,Rv)||kv(e,"@@iterator")||Iv[Ev(e)]},wv=$r,Av=$n,xv=Ro,Ov=qn,Pv=Cv,Nv=TypeError,Mv=function(e,t){var r=arguments.length<2?Pv(e):t;if(Av(r))return xv(wv(r,e));throw Nv(Ov(e)+" is not iterable")},Dv=$r,Lv=Ro,Uv=ri,Vv=function(e,t,r){var n,i;Lv(e);try{if(!(n=Uv(e,"return"))){if("throw"===t)throw r;return r}n=Dv(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return Lv(n),r},Fv=So,Bv=$r,jv=Ro,Hv=qn,zv=bv,Gv=ma,Wv=An,Kv=Mv,Xv=Cv,Jv=Vv,qv=TypeError,Yv=function(e,t){this.stopped=e,this.result=t},Qv=Yv.prototype,Zv=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),v=Fv(t,d),_=function(e){return n&&Jv(n,"normal",e),new Yv(!0,e)},m=function(e){return l?(jv(e),f?v(e[0],e[1],_):v(e[0],e[1])):f?v(e,_):v(e)};if(h)n=e.iterator;else if(p)n=e;else{if(!(i=Xv(e)))throw qv(Hv(e)+" is not iterable");if(zv(i)){for(o=0,a=Gv(e);a>o;o++)if((s=m(e[o]))&&Wv(Qv,s))return s;return new Yv(!1)}n=Kv(e,i)}for(c=h?e.next:n.next;!(u=Bv(c,n)).done;){try{s=m(u.value)}catch(e){Jv(n,"throw",e)}if("object"==typeof s&&s&&Wv(Qv,s))return s}return new Yv(!1)},$v=Ts,e_=Zo,t_=An,r_=th,n_=Ch,i_=function(e,t,r){for(var n=rv(t),i=iv.f,o=nv.f,a=0;a<n.length;a++){var s=n[a];tv(e,s)||r&&tv(r,s)||i(e,s,o(t,s))}},o_=_c,a_=Bo,s_=sn,c_=function(e,t){ov(t)&&"cause"in t&&av(e,"cause",t.cause)},u_=function(e,t,r,n){_v&&(mv?mv(e,t):fv(e,"stack",vv(r,n)))},d_=Zv,l_=function(e,t){return void 0===e?arguments.length<2?"":t:$v(e)},h_=Di("toStringTag"),p_=Error,f_=[].push,v_=function(e,t){var r,n=t_(__,this);n_?r=n_(p_(),n?r_(this):__):(r=n?this:o_(__),a_(r,h_,"Error")),void 0!==t&&a_(r,"message",l_(t)),u_(r,v_,r.stack,1),arguments.length>2&&c_(r,arguments[2]);var i=[];return d_(e,f_,{that:i}),a_(r,"errors",i),r};n_?n_(v_,p_):i_(v_,p_,{name:!0});var __=v_.prototype=o_(p_.prototype,{constructor:s_(1,v_),message:s_(1,""),name:s_(1,"AggregateError")});e_({global:!0,constructor:!0,arity:2},{AggregateError:v_});var m_,g_,y_,S_,b_="process"===jr(Ir.process),E_=wn,k_=Lc,T_=Yr,I_=Di("species"),R_=function(e){var t=E_(e);T_&&t&&!t[I_]&&k_(t,I_,{configurable:!0,get:function(){return this}})},C_=An,w_=TypeError,A_=function(e,t){if(C_(t,e))return e;throw w_("Incorrect invocation")},x_=Ya,O_=qn,P_=TypeError,N_=function(e){if(x_(e))return e;throw P_(O_(e)+" is not a constructor")},M_=Ro,D_=N_,L_=pn,U_=Di("species"),V_=function(e,t){var r,n=M_(e).constructor;return void 0===n||L_(r=M_(n)[U_])?t:D_(r)},F_=TypeError,B_=function(e,t){if(e<t)throw F_("Not enough arguments");return e},j_=/(?:ipad|iphone|ipod).*applewebkit/i.test(xn),H_=Ir,z_=Pr,G_=So,W_=Jr,K_=bi,X_=Rr,J_=$s,q_=el,Y_=qi,Q_=B_,Z_=j_,$_=b_,em=H_.setImmediate,tm=H_.clearImmediate,rm=H_.process,nm=H_.Dispatch,im=H_.Function,om=H_.MessageChannel,am=H_.String,sm=0,cm={},um="onreadystatechange";X_((function(){m_=H_.location}));var dm=function(e){if(K_(cm,e)){var t=cm[e];delete cm[e],t()}},lm=function(e){return function(){dm(e)}},hm=function(e){dm(e.data)},pm=function(e){H_.postMessage(am(e),m_.protocol+"//"+m_.host)};em&&tm||(em=function(e){Q_(arguments.length,1);var t=W_(e)?e:im(e),r=q_(arguments,1);return cm[++sm]=function(){z_(t,void 0,r)},g_(sm),sm},tm=function(e){delete cm[e]},$_?g_=function(e){rm.nextTick(lm(e))}:nm&&nm.now?g_=function(e){nm.now(lm(e))}:om&&!Z_?(S_=(y_=new om).port2,y_.port1.onmessage=hm,g_=G_(S_.postMessage,S_)):H_.addEventListener&&W_(H_.postMessage)&&!H_.importScripts&&m_&&"file:"!==m_.protocol&&!X_(pm)?(g_=pm,H_.addEventListener("message",hm,!1)):g_=um in Y_("script")?function(e){J_.appendChild(Y_("script"))[um]=function(){J_.removeChild(this),dm(e)}}:function(e){setTimeout(lm(e),0)});var fm={set:em,clear:tm},vm=function(){this.head=null,this.tail=null};vm.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 _m,mm,gm,ym,Sm,bm=vm,Em=/ipad|iphone|ipod/i.test(xn)&&"undefined"!=typeof Pebble,km=/web0s(?!.*chrome)/i.test(xn),Tm=Ir,Im=So,Rm=qr.f,Cm=fm.set,wm=bm,Am=j_,xm=Em,Om=km,Pm=b_,Nm=Tm.MutationObserver||Tm.WebKitMutationObserver,Mm=Tm.document,Dm=Tm.process,Lm=Tm.Promise,Um=Rm(Tm,"queueMicrotask"),Vm=Um&&Um.value;if(!Vm){var Fm=new wm,Bm=function(){var e,t;for(Pm&&(e=Dm.domain)&&e.exit();t=Fm.get();)try{t()}catch(e){throw Fm.head&&_m(),e}e&&e.enter()};Am||Pm||Om||!Nm||!Mm?!xm&&Lm&&Lm.resolve?((ym=Lm.resolve(void 0)).constructor=Lm,Sm=Im(ym.then,ym),_m=function(){Sm(Bm)}):Pm?_m=function(){Dm.nextTick(Bm)}:(Cm=Im(Cm,Tm),_m=function(){Cm(Bm)}):(mm=!0,gm=Mm.createTextNode(""),new Nm(Bm).observe(gm,{characterData:!0}),_m=function(){gm.data=mm=!mm}),Vm=function(e){Fm.head||_m(),Fm.add(e)}}var jm=Vm,Hm=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},zm=Ir.Promise,Gm="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Wm=!Gm&&!b_&&"object"==typeof window&&"object"==typeof document,Km=Ir,Xm=zm,Jm=Jr,qm=_o,Ym=La,Qm=Di,Zm=Wm,$m=Gm,eg=Un,tg=Xm&&Xm.prototype,rg=Qm("species"),ng=!1,ig=Jm(Km.PromiseRejectionEvent),og=qm("Promise",(function(){var e=Ym(Xm),t=e!==String(Xm);if(!t&&66===eg)return!0;if(!tg.catch||!tg.finally)return!0;if(!eg||eg<51||!/native code/.test(e)){var r=new Xm((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[rg]=n,!(ng=r.then((function(){}))instanceof n))return!0}return!t&&(Zm||$m)&&!ig})),ag={CONSTRUCTOR:og,REJECTION_EVENT:ig,SUBCLASSING:ng},sg={},cg=$n,ug=TypeError,dg=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw ug("Bad Promise constructor");t=e,r=n})),this.resolve=cg(t),this.reject=cg(r)};sg.f=function(e){return new dg(e)};var lg,hg,pg=Zo,fg=b_,vg=Ir,_g=$r,mg=Mc,gg=au,yg=R_,Sg=$n,bg=Jr,Eg=En,kg=A_,Tg=V_,Ig=fm.set,Rg=jm,Cg=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},wg=Hm,Ag=bm,xg=Eu,Og=zm,Pg=sg,Ng="Promise",Mg=ag.CONSTRUCTOR,Dg=ag.REJECTION_EVENT,Lg=xg.getterFor(Ng),Ug=xg.set,Vg=Og&&Og.prototype,Fg=Og,Bg=Vg,jg=vg.TypeError,Hg=vg.document,zg=vg.process,Gg=Pg.f,Wg=Gg,Kg=!!(Hg&&Hg.createEvent&&vg.dispatchEvent),Xg="unhandledrejection",Jg=function(e){var t;return!(!Eg(e)||!bg(t=e.then))&&t},qg=function(e,t){var r,n,i,o=t.value,a=1===t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&ey(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(jg("Promise-chain cycle")):(n=Jg(r))?_g(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},Yg=function(e,t){e.notified||(e.notified=!0,Rg((function(){for(var r,n=e.reactions;r=n.get();)qg(r,e);e.notified=!1,t&&!e.rejection&&Zg(e)})))},Qg=function(e,t,r){var n,i;Kg?((n=Hg.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),vg.dispatchEvent(n)):n={promise:t,reason:r},!Dg&&(i=vg["on"+e])?i(n):e===Xg&&Cg("Unhandled promise rejection",r)},Zg=function(e){_g(Ig,vg,(function(){var t,r=e.facade,n=e.value;if($g(e)&&(t=wg((function(){fg?zg.emit("unhandledRejection",n,r):Qg(Xg,r,n)})),e.rejection=fg||$g(e)?2:1,t.error))throw t.value}))},$g=function(e){return 1!==e.rejection&&!e.parent},ey=function(e){_g(Ig,vg,(function(){var t=e.facade;fg?zg.emit("rejectionHandled",t):Qg("rejectionhandled",t,e.value)}))},ty=function(e,t,r){return function(n){e(t,n,r)}},ry=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Yg(e,!0))},ny=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw jg("Promise can't be resolved itself");var n=Jg(t);n?Rg((function(){var r={done:!1};try{_g(n,t,ty(ny,r,e),ty(ry,r,e))}catch(t){ry(r,t,e)}})):(e.value=t,e.state=1,Yg(e,!1))}catch(t){ry({done:!1},t,e)}}};Mg&&(Bg=(Fg=function(e){kg(this,Bg),Sg(e),_g(lg,this);var t=Lg(this);try{e(ty(ny,t),ty(ry,t))}catch(e){ry(t,e)}}).prototype,(lg=function(e){Ug(this,{type:Ng,done:!1,notified:!1,parent:!1,reactions:new Ag,rejection:!1,state:0,value:void 0})}).prototype=mg(Bg,"then",(function(e,t){var r=Lg(this),n=Gg(Tg(this,Fg));return r.parent=!0,n.ok=!bg(e)||e,n.fail=bg(t)&&t,n.domain=fg?zg.domain:void 0,0===r.state?r.reactions.add(n):Rg((function(){qg(n,r)})),n.promise})),hg=function(){var e=new lg,t=Lg(e);this.promise=e,this.resolve=ty(ny,t),this.reject=ty(ry,t)},Pg.f=Gg=function(e){return e===Fg||undefined===e?new hg(e):Wg(e)}),pg({global:!0,constructor:!0,wrap:!0,forced:Mg},{Promise:Fg}),gg(Fg,Ng,!1,!0),yg(Ng);var iy=Di("iterator"),oy=!1;try{var ay=0,sy={next:function(){return{done:!!ay++}},return:function(){oy=!0}};sy[iy]=function(){return this},Array.from(sy,(function(){throw 2}))}catch(RA){}var cy=function(e,t){if(!t&&!oy)return!1;var r=!1;try{var n={};n[iy]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},uy=zm,dy=ag.CONSTRUCTOR||!cy((function(e){uy.all(e).then(void 0,(function(){}))})),ly=$r,hy=$n,py=sg,fy=Hm,vy=Zv;Zo({target:"Promise",stat:!0,forced:dy},{all:function(e){var t=this,r=py.f(t),n=r.resolve,i=r.reject,o=fy((function(){var r=hy(t.resolve),o=[],a=0,s=1;vy(e,(function(e){var c=a++,u=!1;s++,ly(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var _y=Zo,my=ag.CONSTRUCTOR;zm&&zm.prototype,_y({target:"Promise",proto:!0,forced:my,real:!0},{catch:function(e){return this.then(void 0,e)}});var gy=$r,yy=$n,Sy=sg,by=Hm,Ey=Zv;Zo({target:"Promise",stat:!0,forced:dy},{race:function(e){var t=this,r=Sy.f(t),n=r.reject,i=by((function(){var i=yy(t.resolve);Ey(e,(function(e){gy(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var ky=$r,Ty=sg;Zo({target:"Promise",stat:!0,forced:ag.CONSTRUCTOR},{reject:function(e){var t=Ty.f(this);return ky(t.reject,void 0,e),t.promise}});var Iy=Ro,Ry=En,Cy=sg,wy=function(e,t){if(Iy(e),Ry(t)&&t.constructor===e)return t;var r=Cy.f(e);return(0,r.resolve)(t),r.promise},Ay=Zo,xy=zm,Oy=ag.CONSTRUCTOR,Py=wy,Ny=wn("Promise"),My=!Oy;Ay({target:"Promise",stat:!0,forced:true},{resolve:function(e){return Py(My&&this===Ny?xy:this,e)}});var Dy=$r,Ly=$n,Uy=sg,Vy=Hm,Fy=Zv;Zo({target:"Promise",stat:!0,forced:dy},{allSettled:function(e){var t=this,r=Uy.f(t),n=r.resolve,i=r.reject,o=Vy((function(){var r=Ly(t.resolve),i=[],o=0,a=1;Fy(e,(function(e){var s=o++,c=!1;a++,Dy(r,t,e).then((function(e){c||(c=!0,i[s]={status:"fulfilled",value:e},--a||n(i))}),(function(e){c||(c=!0,i[s]={status:"rejected",reason:e},--a||n(i))}))})),--a||n(i)}));return o.error&&i(o.value),r.promise}});var By=$r,jy=$n,Hy=wn,zy=sg,Gy=Hm,Wy=Zv,Ky="No one promise resolved";Zo({target:"Promise",stat:!0,forced:dy},{any:function(e){var t=this,r=Hy("AggregateError"),n=zy.f(t),i=n.resolve,o=n.reject,a=Gy((function(){var n=jy(t.resolve),a=[],s=0,c=1,u=!1;Wy(e,(function(e){var d=s++,l=!1;c++,By(n,t,e).then((function(e){l||u||(u=!0,i(e))}),(function(e){l||u||(l=!0,a[d]=e,--c||o(new r(a,Ky)))}))})),--c||o(new r(a,Ky))}));return a.error&&o(a.value),n.promise}});var Xy=Zo,Jy=zm,qy=Rr,Yy=wn,Qy=Jr,Zy=V_,$y=wy,eS=Jy&&Jy.prototype;Xy({target:"Promise",proto:!0,real:!0,forced:!!Jy&&qy((function(){eS.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Zy(this,Yy("Promise")),r=Qy(e);return this.then(r?function(r){return $y(t,e()).then((function(){return r}))}:e,r?function(r){return $y(t,e()).then((function(){throw r}))}:e)}});var tS=kn.Promise,rS=sg;Zo({target:"Promise",stat:!0},{withResolvers:function(){var e=rS.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}});var nS=tS,iS=sg,oS=Hm;Zo({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=iS.f(this),r=oS(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var aS=nS,sS=Er(aS),cS=Zo,uS=sa,dS=Ur([].reverse),lS=[1,2];cS({target:"Array",proto:!0,forced:String(lS)===String(lS.reverse())},{reverse:function(){return uS(this)&&(this.length=this.length),dS(this)}});var hS=yf("Array").reverse,pS=An,fS=hS,vS=Array.prototype,_S=function(e){var t=e.reverse;return e===vS||pS(vS,e)&&t===vS.reverse?fS:t},mS=_S,gS=Er(mS),yS=Zo,SS=sa,bS=Ya,ES=En,kS=As,TS=ma,IS=yn,RS=ka,CS=Di,wS=el,AS=ss("slice"),xS=CS("species"),OS=Array,PS=Math.max;yS({target:"Array",proto:!0,forced:!AS},{slice:function(e,t){var r,n,i,o=IS(this),a=TS(o),s=kS(e,a),c=kS(void 0===t?a:t,a);if(SS(o)&&(r=o.constructor,(bS(r)&&(r===OS||SS(r.prototype))||ES(r)&&null===(r=r[xS]))&&(r=void 0),r===OS||void 0===r))return wS(o,s,c);for(n=new(void 0===r?OS:r)(PS(c-s,0)),i=0;s<c;s++,i++)s in o&&RS(n,i,o[s]);return n.length=i,n}});var NS=yf("Array").slice,MS=An,DS=NS,LS=Array.prototype,US=function(e){var t=e.slice;return e===LS||MS(LS,e)&&t===LS.slice?DS:t},VS=US,FS=Er(VS);function BS(){
|
|
2
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
3
|
+
BS=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,i=oa||function(e,t,r){e[t]=r.value},o="function"==typeof Mp?Mp:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,r){return oa(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function d(e,t,r,n){var o=t&&t.prototype instanceof m?t:m,a=uf(o.prototype),s=new A(n||[]);return i(a,"_invoke",{value:I(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var h="suspendedStart",p="suspendedYield",f="executing",v="completed",_={};function m(){}function g(){}function y(){}var S={};u(S,a,(function(){return this}));var b=pf&&pf(pf(x([])));b&&b!==r&&n.call(b,a)&&(S=b);var E=y.prototype=m.prototype=uf(S);function k(e){var t;wf(t=["next","throw","return"]).call(t,(function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function r(i,o,a,s){var c=l(e[i],e,o);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==$p(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,s)}))}s(c.arg)}var o;i(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,i){r(e,n,t,i)}))}return o=o?o.then(i,i):i()}})}function I(t,r,n){var i=h;return function(o,a){if(i===f)throw new Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var c=R(s,n);if(c){if(c===_)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===h)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=f;var u=l(t,r,n);if("normal"===u.type){if(i=n.done?v:p,u.arg===_)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(i=v,n.method="throw",n.arg=u.arg)}}}function R(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,R(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),_;var o=l(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,_;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,_):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,_)}function C(e){var t,r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),Kf(t=this.tryEntries).call(t,r)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],wf(e).call(e,C,this),this.reset(!0)}function x(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError($p(t)+" is not iterable")}return g.prototype=y,i(E,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:g,configurable:!0}),g.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Jf?Jf(e,y):(e.__proto__=y,u(e,c,"GeneratorFunction")),e.prototype=uf(E),e},t.awrap=function(e){return{__await:e}},k(T.prototype),u(T.prototype,s,(function(){return this})),t.AsyncIterator=T,t.async=function(e,r,n,i,o){void 0===o&&(o=sS);var a=new T(d(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(E),u(E,c,"Generator"),u(E,a,(function(){return this})),u(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)Kf(r).call(r,n);return gS(r).call(r),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=x,A.prototype={constructor:A,reset:function(t){var r;if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,wf(r=this.tryEntries).call(r,w),!t)for(var i in this)"t"===i.charAt(0)&&n.call(this,i)&&!isNaN(+FS(i).call(i,1))&&(this[i]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,_):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;w(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:x(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),_}},t}function jS(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):sS.resolve(c).then(n,i)}function HS(e){return function(){var t=this,r=arguments;return new sS((function(n,i){var o=e.apply(t,r);function a(e){jS(o,n,i,a,s,"next",e)}function s(e){jS(o,n,i,a,s,"throw",e)}a(void 0)}))}}var zS=yf("Array").concat,GS=An,WS=zS,KS=Array.prototype,XS=function(e){var t=e.concat;return e===KS||GS(KS,e)&&t===KS.concat?WS:t},JS=Er(XS),qS=Er(aS),YS=kn,QS=Pr;YS.JSON||(YS.JSON={stringify:JSON.stringify});var ZS=Er((function(e,t,r){return QS(YS.JSON.stringify,null,arguments)})),$S=xu.map;Zo({target:"Array",proto:!0,forced:!ss("map")},{map:function(e){return $S(this,e,arguments.length>1?arguments[1]:void 0)}});var eb=yf("Array").map,tb=An,rb=eb,nb=Array.prototype,ib=function(e){var t=e.map;return e===nb||tb(nb,e)&&t===nb.map?rb:t},ob=Er(ib),ab=Er(Cv);Zo({target:"Array",stat:!0},{isArray:sa});var sb=Er(kn.Array.isArray),cb=Ro,ub=Vv,db=So,lb=$r,hb=gi,pb=function(e,t,r,n){try{return n?t(cb(r)[0],r[1]):t(r)}catch(t){ub(e,"throw",t)}},fb=bv,vb=Ya,_b=ma,mb=ka,gb=Mv,yb=Cv,Sb=Array,bb=function(e){var t=hb(e),r=vb(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=db(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=yb(t),p=0;if(!h||this===Sb&&fb(h))for(a=_b(t),s=r?new this(a):Sb(a);a>p;p++)l=o?i(t[p],p):t[p],mb(s,p,l);else for(d=(u=gb(t,h)).next,s=r?new this:[];!(c=lb(d,u)).done;p++)l=o?pb(u,i,[c.value,p],!0):c.value,mb(s,p,l);return s.length=p,s},Eb=Zo,kb=bb,Tb=!cy((function(e){Array.from(e)}));Eb({target:"Array",stat:!0,forced:Tb},{from:kb});var Ib=kn.Array.from,Rb=Er(Ib);function Cb(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function wb(e,t){var r;if(e){if("string"==typeof e)return Cb(e,t);var n=FS(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Rb(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cb(e,t):void 0}}function Ab(e,t){var r=void 0!==Mp&&ab(e)||e["@@iterator"];if(!r){if(sb(e)||(r=wb(e))||t){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function xb(e,t){return function(e){if(sb(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==Mp&&ab(e)||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(Kf(s).call(s,n.value),s.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(e,t)||wb(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Ob=Zo,Pb=Rr,Nb=Sc.f;Ob({target:"Object",stat:!0,forced:Pb((function(){return!Object.getOwnPropertyNames(1)}))},{getOwnPropertyNames:Nb});var Mb=kn.Object,Db=function(e){return Mb.getOwnPropertyNames(e)},Lb=Er(Db),Ub=xu.filter;Zo({target:"Array",proto:!0,forced:!ss("filter")},{filter:function(e){return Ub(this,e,arguments.length>1?arguments[1]:void 0)}});var Vb=yf("Array").filter,Fb=An,Bb=Vb,jb=Array.prototype,Hb=function(e){var t=e.filter;return e===jb||Fb(jb,e)&&t===jb.filter?Bb:t},zb=Hb,Gb=Er(zb),Wb=Er(zb),Kb=Ms.includes;Zo({target:"Array",proto:!0,forced:Rr((function(){return!Array(1).includes()}))},{includes:function(e){return Kb(this,e,arguments.length>1?arguments[1]:void 0)}});var Xb=yf("Array").includes,Jb=En,qb=jr,Yb=Di("match"),Qb=function(e){var t;return Jb(e)&&(void 0!==(t=e[Yb])?!!t:"RegExp"===qb(e))},Zb=TypeError,$b=function(e){if(Qb(e))throw Zb("The method doesn't accept regular expressions");return e},eE=Di("match"),tE=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[eE]=!1,"/./"[e](t)}catch(e){}}return!1},rE=Zo,nE=$b,iE=_n,oE=Ts,aE=tE,sE=Ur("".indexOf);rE({target:"String",proto:!0,forced:!aE("includes")},{includes:function(e){return!!~sE(oE(iE(this)),oE(nE(e)),arguments.length>1?arguments[1]:void 0)}});var cE=yf("String").includes,uE=An,dE=Xb,lE=cE,hE=Array.prototype,pE=String.prototype,fE=function(e){var t=e.includes;return e===hE||uE(hE,e)&&t===hE.includes?dE:"string"==typeof e||e===pE||uE(pE,e)&&t===pE.includes?lE:t},vE=Er(fE),_E=$n,mE=gi,gE=hn,yE=ma,SE=TypeError,bE=function(e){return function(t,r,n,i){_E(r);var o=mE(t),a=gE(o),s=yE(o),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw SE("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(i=r(i,a[c],c,o));return i}},EE={left:bE(!1),right:bE(!0)}.left;Zo({target:"Array",proto:!0,forced:!b_&&Un>79&&Un<83||!vf("reduce")},{reduce:function(e){var t=arguments.length;return EE(this,e,t,t>1?arguments[1]:void 0)}});var kE=yf("Array").reduce,TE=An,IE=kE,RE=Array.prototype,CE=function(e){var t=e.reduce;return e===RE||TE(RE,e)&&t===RE.reduce?IE:t},wE=Er(CE),AE=Yr,xE=Rr,OE=Ur,PE=th,NE=Ws,ME=yn,DE=OE(en.f),LE=OE([].push),UE=AE&&xE((function(){var e=Object.create(null);return e[2]=2,!DE(e,2)})),VE=function(e){return function(t){for(var r,n=ME(t),i=NE(n),o=UE&&null===PE(n),a=i.length,s=0,c=[];a>s;)r=i[s++],AE&&!(o?r in n:DE(n,r))||LE(c,e?[r,n[r]]:n[r]);return c}},FE={entries:VE(!0),values:VE(!1)}.entries;Zo({target:"Object",stat:!0},{entries:function(e){return FE(e)}});var BE=Er(kn.Object.entries),jE=gi,HE=Ws;Zo({target:"Object",stat:!0,forced:Rr((function(){HE(1)}))},{keys:function(e){return HE(jE(e))}});var zE,GE,WE,KE,XE,JE,qE,YE,QE,ZE,$E,ek,tk,rk,nk,ik,ok,ak=kn.Object.keys,sk=Er(ak),ck=Er(ak),uk={};function dk(e,t){try{var r;return vE(r=e[t].toString()).call(r,"[native code]")?"native":"non-native"}catch(e){return"untouchable"}}var lk=wE(zE="undefined"!=typeof window?[[null===(GE=window.RTCPeerConnection)||void 0===GE?void 0:GE.prototype,"RTCPeerConnection.prototype"],[window.RTCPeerConnection,"RTCPeerConnection"],[null===(WE=window.RTCDataChannel)||void 0===WE?void 0:WE.prototype,"RTCDataChannel.prototype"],[window.RTCDataChannel,"RTCDataChannel"],[null===(KE=window.MediaStreamTrack)||void 0===KE?void 0:KE.prototype,"MediaStreamTrack.prototype"],[window.MediaStreamTrack,"MediaStreamTrack"],[null===(XE=window.MediaStream)||void 0===XE?void 0:XE.prototype,"MediaStream.prototype"],[window.MediaStream,"MediaStream"],[null===(JE=window.HTMLAudioElement)||void 0===JE?void 0:JE.prototype,"HTMLAudioElement.prototype"],[null===(qE=window.HTMLVideoElement)||void 0===qE?void 0:qE.prototype,"HTMLVideoElement.prototype"],[null===(YE=window.HTMLMediaElement)||void 0===YE?void 0:YE.prototype,"HTMLMediaElement.prototype"],[null!==(QE=null===(ZE=window.AudioContext)||void 0===ZE?void 0:ZE.prototype)&&void 0!==QE?QE:null===($E=window.webkitAudioContext)||void 0===$E?void 0:$E.prototype,"AudioContext.prototype"],[null===(ek=window.BaseAudioContext)||void 0===ek?void 0:ek.prototype,"BaseAudioContext.prototype"],[null===(tk=window.AudioNode)||void 0===tk?void 0:tk.prototype,"AudioNode.prototype"],[window.navigator.mediaDevices,"navigator.mediaDevices"],[window.console,"console"]]:[]).call(zE,(function(e,t){var r=xb(t,2),n=r[0],i=r[1];return JS(e).call(e,function(e,t){var r;if(!e)return[];var n=Lb(e);return ob(r=Wb(n).call(n,(function(t){if("peerIdentity"===t)return!1;try{return"function"==typeof e[t]||void 0===e[t]}catch(e){return!1}}))).call(r,(function(r){return{obj:e,prefix:t,attr:r}}))}(n,i))}),[]);"undefined"!=typeof window&&lk.push({obj:window.navigator.mediaDevices,prefix:"navigator.mediaDevices",attr:"getUserMedia"},{obj:window.navigator.mediaDevices,prefix:"navigator.mediaDevices",attr:"getDisplayMedia"},{obj:window.navigator.mediaDevices,prefix:"navigator.mediaDevices",attr:"enumerateDevices"},{obj:window.navigator.mediaDevices,prefix:"navigator.mediaDevices",attr:"getSupportedConstraints"});var hk,pk=Ab(lk);try{for(pk.s();!(hk=pk.n()).done;){var fk,vk=hk.value,_k=vk.obj,mk=vk.prefix,gk=vk.attr,yk=JS(fk="".concat(mk,".")).call(fk,gk);uk[yk]=dk(_k,gk)}}catch(RA){pk.e(RA)}finally{pk.f()}"undefined"!=typeof window&&(vE(rk=window.location.search).call(rk,"_rtc_debug_")||(null===(nk=window.localStorage)||void 0===nk?void 0:nk.getItem("_rtc_debug_")))&&console.log("RTC_AMBULANCE",uk);var Sk=ob(ik=Wb(ok=BE(uk)).call(ok,(function(e){var t=xb(e,2);return t[0],"non-native"===t[1]}))).call(ik,(function(e){var t=xb(e,2),r=t[0];return t[1],r}));ck(Sk).length&&console.warn("RTC_AMBULANCE","have non-native code:\n",Sk.join("\n"));var bk="\t\n\v\f\r \u2028\u2029\ufeff",Ek=_n,kk=Ts,Tk=bk,Ik=Ur("".replace),Rk=RegExp("^["+Tk+"]+"),Ck=RegExp("(^|[^"+Tk+"])["+Tk+"]+$"),wk=function(e){return function(t){var r=kk(Ek(t));return 1&e&&(r=Ik(r,Rk,"")),2&e&&(r=Ik(r,Ck,"$1")),r}},Ak={start:wk(1),end:wk(2),trim:wk(3)},xk=Ir,Ok=Rr,Pk=Ur,Nk=Ts,Mk=Ak.trim,Dk=bk,Lk=xk.parseInt,Uk=xk.Symbol,Vk=Uk&&Uk.iterator,Fk=/^[+-]?0x/i,Bk=Pk(Fk.exec),jk=8!==Lk(Dk+"08")||22!==Lk(Dk+"0x16")||Vk&&!Ok((function(){Lk(Object(Vk))}))?function(e,t){var r=Mk(Nk(e));return Lk(r,t>>>0||(Bk(Fk,r)?16:10))}:Lk;Zo({global:!0,forced:parseInt!==jk},{parseInt:jk});var Hk=Er(kn.parseInt),zk={exports:{}},Gk=Rr((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Wk=Rr,Kk=En,Xk=jr,Jk=Gk,qk=Object.isExtensible,Yk=Wk((function(){qk(1)}))||Jk?function(e){return!!Kk(e)&&(!Jk||"ArrayBuffer"!==Xk(e))&&(!qk||qk(e))}:qk,Qk=!Rr((function(){return Object.isExtensible(Object.preventExtensions({}))})),Zk=Zo,$k=Ur,eT=Ds,tT=En,rT=bi,nT=bo.f,iT=mc,oT=Sc,aT=Yk,sT=Qk,cT=!1,uT=Ri("meta"),dT=0,lT=function(e){nT(e,uT,{value:{objectID:"O"+dT++,weakData:{}}})},hT=zk.exports={enable:function(){hT.enable=function(){},cT=!0;var e=iT.f,t=$k([].splice),r={};r[uT]=1,e(r).length&&(iT.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===uT){t(n,i,1);break}return n},Zk({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:oT.f}))},fastKey:function(e,t){if(!tT(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!rT(e,uT)){if(!aT(e))return"F";if(!t)return"E";lT(e)}return e[uT].objectID},getWeakData:function(e,t){if(!rT(e,uT)){if(!aT(e))return!0;if(!t)return!1;lT(e)}return e[uT].weakData},onFreeze:function(e){return sT&&cT&&aT(e)&&!rT(e,uT)&&lT(e),e}};eT[uT]=!0;var pT=zk.exports,fT=Zo,vT=Ir,_T=pT,mT=Rr,gT=Bo,yT=Zv,ST=A_,bT=Jr,ET=En,kT=pn,TT=au,IT=bo.f,RT=xu.forEach,CT=Yr,wT=Eu.set,AT=Eu.getterFor,xT=function(e,t,r){var n,i=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),a=i?"set":"add",s=vT[e],c=s&&s.prototype,u={};if(CT&&bT(s)&&(o||c.forEach&&!mT((function(){(new s).entries().next()})))){var d=(n=t((function(t,r){wT(ST(t,d),{type:e,collection:new s}),kT(r)||yT(r,t[a],{that:t,AS_ENTRIES:i})}))).prototype,l=AT(e);RT(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"===e||"set"===e;!(e in c)||o&&"clear"===e||gT(d,e,(function(r,n){var i=l(this).collection;if(!t&&o&&!ET(r))return"get"===e&&void 0;var a=i[e](0===r?0:r,n);return t?this:a}))})),o||IT(d,"size",{configurable:!0,get:function(){return l(this).collection.size}})}else n=r.getConstructor(t,e,i,a),_T.enable();return TT(n,e,!1,!0),u[e]=n,fT({global:!0,forced:!0},u),o||r.setStrong(n,e,i),n},OT=Mc,PT=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:OT(e,n,t[n],r);return e},NT=_c,MT=Lc,DT=PT,LT=So,UT=A_,VT=pn,FT=Zv,BT=Hh,jT=zh,HT=R_,zT=Yr,GT=pT.fastKey,WT=Eu.set,KT=Eu.getterFor,XT={getConstructor:function(e,t,r,n){var i=e((function(e,i){UT(e,o),WT(e,{type:t,index:NT(null),first:void 0,last:void 0,size:0}),zT||(e.size=0),VT(i)||FT(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=KT(t),s=function(e,t,r){var n,i,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:i=GT(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),zT?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=GT(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key===t)return r};return DT(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,zT?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first===n&&(r.first=i),r.last===n&&(r.last=o),zT?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=LT(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),DT(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),zT&&MT(o,"size",{configurable:!0,get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=KT(t),o=KT(n);BT(e,t,(function(e,t){WT(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?jT("keys"===t?r.key:"values"===t?r.value:[r.key,r.value],!1):(e.target=void 0,jT(void 0,!0))}),r?"entries":"values",!r,!0),HT(t)}};xT("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),XT);var JT=kn.Map,qT=function(e,t){return 1===t?function(t,r){return t[e](r)}:function(t,r,n){return t[e](r,n)}},YT=qT,QT=wn("Map"),ZT={Map:QT,set:YT("set",2),get:YT("get",1),has:YT("has",1),remove:YT("delete",1),proto:QT.prototype},$T=Zo,eI=$n,tI=_n,rI=Zv,nI=ZT.Map,iI=ZT.has,oI=ZT.get,aI=ZT.set,sI=Ur([].push);$T({target:"Map",stat:!0,forced:true},{groupBy:function(e,t){tI(e),eI(t);var r=new nI,n=0;return rI(e,(function(e){var i=t(e,n++);iI(r,i)?sI(oI(r,i),e):aI(r,i,[e])})),r}});var cI=JT,uI=So,dI=$r,lI=$n,hI=N_,pI=pn,fI=Zv,vI=[].push,_I=function(e){var t,r,n,i,o=arguments.length,a=o>1?arguments[1]:void 0;return hI(this),(t=void 0!==a)&&lI(a),pI(e)?new this:(r=[],t?(n=0,i=uI(a,o>2?arguments[2]:void 0),fI(e,(function(e){dI(vI,r,i(e,n++))}))):fI(e,vI,{that:r}),new this(r))};Zo({target:"Map",stat:!0,forced:!0},{from:_I});var mI=el,gI=function(){return new this(mI(arguments))};Zo({target:"Map",stat:!0,forced:!0},{of:gI});var yI=qn,SI=function(e){if("object"==typeof e&&"size"in e&&"has"in e&&"get"in e&&"set"in e&&"delete"in e&&"entries"in e)return e;throw TypeError(yI(e)+" is not a map")},bI=SI,EI=ZT.remove;Zo({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=bI(this),r=!0,n=0,i=arguments.length;n<i;n++)e=EI(t,arguments[n]),r=r&&e;return!!r}});var kI=SI,TI=ZT.get,II=ZT.has,RI=ZT.set;Zo({target:"Map",proto:!0,real:!0,forced:!0},{emplace:function(e,t){var r,n,i=kI(this);return II(i,e)?(r=TI(i,e),"update"in t&&(r=t.update(r,e,i),RI(i,e,r)),r):(n=t.insert(e,i),RI(i,e,n),n)}});var CI=$r,wI=function(e,t,r){for(var n,i,o=r?e:e.iterator,a=e.next;!(n=CI(a,o)).done;)if(void 0!==(i=t(n.value)))return i},AI=wI,xI=function(e,t,r){return r?AI(e.entries(),(function(e){return t(e[1],e[0])}),!0):e.forEach(t)},OI=So,PI=SI,NI=xI;Zo({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=PI(this),r=OI(e,arguments.length>1?arguments[1]:void 0);return!1!==NI(t,(function(e,n){if(!r(e,n,t))return!1}),!0)}});var MI=So,DI=SI,LI=xI,UI=ZT.Map,VI=ZT.set;Zo({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=DI(this),r=MI(e,arguments.length>1?arguments[1]:void 0),n=new UI;return LI(t,(function(e,i){r(e,i,t)&&VI(n,i,e)})),n}});var FI=So,BI=SI,jI=xI;Zo({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=BI(this),r=FI(e,arguments.length>1?arguments[1]:void 0),n=jI(t,(function(e,n){if(r(e,n,t))return{value:e}}),!0);return n&&n.value}});var HI=So,zI=SI,GI=xI;Zo({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=zI(this),r=HI(e,arguments.length>1?arguments[1]:void 0),n=GI(t,(function(e,n){if(r(e,n,t))return{key:n}}),!0);return n&&n.key}});var WI=function(e,t){return e===t||e!=e&&t!=t},KI=SI,XI=xI;Zo({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return!0===XI(KI(this),(function(t){if(WI(t,e))return!0}),!0)}});var JI=$r,qI=Zv,YI=Jr,QI=$n,ZI=ZT.Map;Zo({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var r=new(YI(this)?this:ZI);QI(t);var n=QI(r.set);return qI(e,(function(e){JI(n,r,t(e),e)})),r}});var $I=SI,eR=xI;Zo({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){var t=eR($I(this),(function(t,r){if(t===e)return{key:r}}),!0);return t&&t.key}});var tR=So,rR=SI,nR=xI,iR=ZT.Map,oR=ZT.set;Zo({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=rR(this),r=tR(e,arguments.length>1?arguments[1]:void 0),n=new iR;return nR(t,(function(e,i){oR(n,r(e,i,t),e)})),n}});var aR=So,sR=SI,cR=xI,uR=ZT.Map,dR=ZT.set;Zo({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=sR(this),r=aR(e,arguments.length>1?arguments[1]:void 0),n=new uR;return cR(t,(function(e,i){dR(n,i,r(e,i,t))})),n}});var lR=SI,hR=Zv,pR=ZT.set;Zo({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=lR(this),r=arguments.length,n=0;n<r;)hR(arguments[n++],(function(e,r){pR(t,e,r)}),{AS_ENTRIES:!0});return t}});var fR=$n,vR=SI,_R=xI,mR=TypeError;Zo({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=vR(this),r=arguments.length<2,n=r?void 0:arguments[1];if(fR(e),_R(t,(function(i,o){r?(r=!1,n=i):n=e(n,i,o,t)})),r)throw mR("Reduce of empty map with no initial value");return n}});var gR=So,yR=SI,SR=xI;Zo({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=yR(this),r=gR(e,arguments.length>1?arguments[1]:void 0);return!0===SR(t,(function(e,n){if(r(e,n,t))return!0}),!0)}});var bR=$n,ER=SI,kR=TypeError,TR=ZT.get,IR=ZT.has,RR=ZT.set;Zo({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var r=ER(this),n=arguments.length;bR(t);var i=IR(r,e);if(!i&&n<3)throw kR("Updating absent value");var o=i?TR(r,e):bR(n>2?arguments[2]:void 0)(e,r);return RR(r,e,t(o,e,r)),r}});var CR=$r,wR=$n,AR=Jr,xR=Ro,OR=TypeError,PR=function(e,t){var r,n=xR(this),i=wR(n.get),o=wR(n.has),a=wR(n.set),s=arguments.length>2?arguments[2]:void 0;if(!AR(t)&&!AR(s))throw OR("At least one callback required");return CR(o,n,e)?(r=CR(i,n,e),AR(t)&&(r=t(r),CR(a,n,e,r))):AR(s)&&(r=s(),CR(a,n,e,r)),r};Zo({target:"Map",proto:!0,real:!0,forced:!0},{upsert:PR}),Zo({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:PR});var NR=cI,MR=Er(NR),DR=Er(NR),LR=Er(ia),UR=Yr,VR=Ur,FR=$r,BR=Rr,jR=Ws,HR=Pc,zR=en,GR=gi,WR=hn,KR=Object.assign,XR=Object.defineProperty,JR=VR([].concat),qR=!KR||BR((function(){if(UR&&1!==KR({b:1},KR(XR({},"a",{enumerable:!0,get:function(){XR(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!==KR({},e)[r]||jR(KR({},t)).join("")!==n}))?function(e,t){for(var r=GR(e),n=arguments.length,i=1,o=HR.f,a=zR.f;n>i;)for(var s,c=WR(arguments[i++]),u=o?JR(jR(c),o(c)):jR(c),d=u.length,l=0;d>l;)s=u[l++],UR&&!FR(a,c,s)||(r[s]=c[s]);return r}:KR,YR=qR;Zo({target:"Object",stat:!0,arity:2,forced:Object.assign!==YR},{assign:YR});var QR=Er(kn.Object.assign),ZR=Zo,$R=Gr;qr.f;var eC=va,tC=Ts,rC=$b,nC=_n,iC=tE,oC=$R("".endsWith),aC=$R("".slice),sC=Math.min;ZR({target:"String",proto:!0,forced:!iC("endsWith")},{endsWith:function(e){var t=tC(nC(this));rC(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:sC(eC(r),n),o=tC(e);return oC?oC(t,o,i):aC(t,i-o.length,i)===o}});var cC=yf("String").endsWith,uC=An,dC=cC,lC=String.prototype,hC=function(e){var t=e.endsWith;return"string"==typeof e||e===lC||uC(lC,e)&&t===lC.endsWith?dC:t},pC=Er(hC),fC=!0,vC=!0;function _C(e,t,r){var n=e.match(t);return n&&n.length>=r&&Hk(n[r],10)}function mC(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new DR),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===ck(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},LR(n,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function gC(e){return"boolean"!=typeof e?new Error("Argument type: "+$p(e)+". Please use a boolean."):(fC=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function yC(e){return"boolean"!=typeof e?new Error("Argument type: "+$p(e)+". Please use a boolean."):(vC=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function SC(){if("object"===("undefined"==typeof window?"undefined":$p(window))){if(fC)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function bC(e,t){vC&&console.warn(e+" is deprecated, please use "+t+" instead.")}function EC(e){return"[object Object]"===Object.prototype.toString.call(e)}function kC(e){var t;return EC(e)?wE(t=ck(e)).call(t,(function(t,r){var n=EC(e[r]),i=n?kC(e[r]):e[r],o=n&&!ck(i).length;return void 0===i||o?t:QR(t,af({},r,i))}),{}):e}function TC(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),ck(t).forEach((function(n){pC(n).call(n,"Id")?TC(e,e.get(t[n]),r):pC(n).call(n,"Ids")&&t[n].forEach((function(t){TC(e,e.get(t),r)}))})))}function IC(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new DR;if(null===t)return i;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(r){r.type===n&&r.trackId===t.id&&TC(e,r,i)}))})),i}var RC=Zo,CC=xu.find,wC="find",AC=!0;wC in[]&&Array(1)[wC]((function(){AC=!1})),RC({target:"Array",proto:!0,forced:AC},{find:function(e){return CC(this,e,arguments.length>1?arguments[1]:void 0)}});var xC=yf("Array").find,OC=An,PC=xC,NC=Array.prototype,MC=function(e){var t=e.find;return e===NC||OC(NC,e)&&t===NC.find?PC:t},DC=Er(MC),LC=Er(VS),UC=Zo,VC=Ms.indexOf,FC=vf,BC=Gr([].indexOf),jC=!!BC&&1/BC([1],1,-0)<0;UC({target:"Array",proto:!0,forced:jC||!FC("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return jC?BC(this,e,t)||0:VC(this,e,t)}});var HC=yf("Array").indexOf,zC=An,GC=HC,WC=Array.prototype,KC=function(e){var t=e.indexOf;return e===WC||zC(WC,e)&&t===WC.indexOf?GC:t},XC=KC,JC=Er(XC),qC=Er(XC),YC=qn,QC=TypeError,ZC=function(e,t){if(!delete e[t])throw QC("Cannot delete property "+YC(t)+" of "+YC(e))},$C=Zo,ew=gi,tw=As,rw=ha,nw=ma,iw=Mf,ow=ya,aw=ns,sw=ka,cw=ZC,uw=ss("splice"),dw=Math.max,lw=Math.min;$C({target:"Array",proto:!0,forced:!uw},{splice:function(e,t){var r,n,i,o,a,s,c=ew(this),u=nw(c),d=tw(e,u),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=lw(dw(rw(t),0),u-d)),ow(u+r-n),i=aw(c,n),o=0;o<n;o++)(a=d+o)in c&&sw(i,o,c[a]);if(i.length=n,r<n){for(o=d;o<u-n;o++)s=o+r,(a=o+n)in c?c[s]=c[a]:cw(c,s);for(o=u;o>u-n+r;o--)cw(c,o-1)}else if(r>n)for(o=u-n;o>d;o--)s=o+r-1,(a=o+n-1)in c?c[s]=c[a]:cw(c,s);for(o=0;o<r;o++)c[o+d]=arguments[o+2];return iw(c,u-n+r),i}});var hw=yf("Array").splice,pw=An,fw=hw,vw=Array.prototype,_w=function(e){var t=e.splice;return e===vw||pw(vw,e)&&t===vw.splice?fw:t},mw=Er(_w),gw={exports:{}},yw=Zo,Sw=Rr,bw=yn,Ew=qr.f,kw=Yr;yw({target:"Object",stat:!0,forced:!kw||Sw((function(){Ew(1)})),sham:!kw},{getOwnPropertyDescriptor:function(e,t){return Ew(bw(e),t)}});var Tw=kn.Object,Iw=gw.exports=function(e,t){return Tw.getOwnPropertyDescriptor(e,t)};Tw.getOwnPropertyDescriptor.sham&&(Iw.sham=!0);var Rw=gw.exports,Cw=Er(Rw),ww=Er(Rw),Aw=SC;function xw(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==$p(e)||e.mandatory||e.optional)return e;var t,r={};return ck(e).forEach((function(t){if("require"!==t&&"advanced"!==t&&"mediaSource"!==t){var n="object"===$p(e[t])?e[t]:{ideal:e[t]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+LC(t).call(t,1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){r.optional=r.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",t)]=n.ideal,r.optional.push(o),(o={})[i("max",t)]=n.ideal,r.optional.push(o)):(o[i("",t)]=n.ideal,r.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(r.mandatory=r.mandatory||{},r.mandatory[i("",t)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(r.mandatory=r.mandatory||{},r.mandatory[i(e,t)]=n[e])}))}})),e.advanced&&(r.optional=JS(t=r.optional||[]).call(t,e.advanced)),r},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(ZS(e)))&&"object"===$p(e.audio)){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};o((e=JSON.parse(ZS(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===$p(e.video)){var a=e.video.facingMode;a=a&&("object"===$p(a)?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c)&&(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s))return r.mediaDevices.enumerateDevices().then((function(t){t=Wb(t).call(t,(function(e){return"videoinput"===e.kind}));var r=DC(t).call(t,(function(e){return s.some((function(t){var r;return vE(r=e.label.toLowerCase()).call(r,t)}))}));return!r&&t.length&&vE(s).call(s,"back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),Aw("chrome: "+ZS(e)),i(e)}));e.video=n(e.video)}return Aw("chrome: "+ZS(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return a(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return qS.reject(o(e))}))}))}}}}function Ow(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Pw(e){if("object"===$p(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){LR(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var r=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(n){var i,o;i=e.RTCPeerConnection.prototype.getReceivers?DC(o=r.getReceivers()).call(o,(function(e){return e.track&&e.track.id===n.track.id})):{track:n.track};var a=new Event("track");a.track=n.track,a.receiver=i,a.transceiver={receiver:i},a.streams=[t.stream],r.dispatchEvent(a)})),t.stream.getTracks().forEach((function(n){var i,o;i=e.RTCPeerConnection.prototype.getReceivers?DC(o=r.getReceivers()).call(o,(function(e){return e.track&&e.track.id===n.id})):{track:n};var a=new Event("track");a.track=n,a.receiver=i,a.transceiver={receiver:i},a.streams=[t.stream],r.dispatchEvent(a)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else mC(e,"track",(function(e){return e.transceiver||LR(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Nw(e){if("object"===$p(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){var e;return this._senders=this._senders||[],LC(e=this._senders).call(e)};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t;n.apply(this,arguments);var r,i=qC(t=this._senders).call(t,e);-1!==i&&mw(r=this._senders).call(r,i,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){r._senders.push(t(r,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var r,n,i,o=DC(r=t._senders).call(r,(function(t){return t.track===e}));o&&mw(n=t._senders).call(n,qC(i=t._senders).call(i,o),1)}))}}else if("object"===$p(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},LR(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Mw(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=LC(Array.prototype).call(arguments),n=r[0],i=r[1],o=r[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),t},s=function(e){var t;return new DR(ob(t=ck(e)).call(t,(function(t){return[t,e[t]]})))};return arguments.length>=2?t.apply(this,[function(e){i(s(a(e)))},n]):new qS((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function Dw(e){if("object"===$p(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return IC(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),mC(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return IC(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(r?n=!0:r=e),e.track===o})),n||t&&r?qS.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():qS.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Lw(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e,t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},ob(e=ck(this._shimmedLocalStreams)).call(e,(function(e){return t._shimmedLocalStreams[e][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var n;if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===qC(n=this._shimmedLocalStreams[r.id]).call(n,i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t,n,i=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){var t;if(DC(t=i.getSenders()).call(t,(function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var o=this.getSenders();r.apply(this,arguments);var a=Wb(t=this.getSenders()).call(t,(function(e){return-1===qC(o).call(o,e)}));this._shimmedLocalStreams[e.id]=JS(n=[e]).call(n,a)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&ck(this._shimmedLocalStreams).forEach((function(r){var n,i,o=qC(n=t._shimmedLocalStreams[r]).call(n,e);-1!==o&&mw(i=t._shimmedLocalStreams[r]).call(i,o,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function Uw(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Lw(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},ob(t).call(t,(function(t){return e._reverseStreams[t.id]}))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){var t;if(DC(t=r.getSenders()).call(t,(function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){var n,i,o,a=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var s=LC([]).call(arguments,1);if(1!==s.length||!DC(n=s[0].getTracks()).call(n,(function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(DC(i=this.getSenders()).call(i,(function(e){return e.track===t})))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var c=this._streams[r.id];if(c)c.addTrack(t),qS.resolve().then((function(){a.dispatchEvent(new Event("negotiationneeded"))}));else{var u=new e.MediaStream([t]);this._streams[r.id]=u,this._reverseStreams[u.id]=r,this.addStream(u)}return DC(o=this.getSenders()).call(o,(function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=af({},t,(function(){var e=this,t=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=(e=this,r=(t=arguments[0]).sdp,ck(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})),o.apply(this,arguments)):o.apply(this,arguments);var e,t,r};var a=ww(e.RTCPeerConnection.prototype,"localDescription");LR(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},ck(this._streams).forEach((function(n){var i;DC(i=r._streams[n].getTracks()).call(i,(function(t){return e.track===t}))&&(t=r._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var r=t.sdp;return ck(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function Vw(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=af({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}))}function Fw(e,t){mC(e,"negotiationneeded",(function(e){var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var Bw=Object.freeze({__proto__:null,fixNegotiationNeeded:Fw,shimAddTrackRemoveTrack:Uw,shimAddTrackRemoveTrackWithNative:Lw,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))},shimGetSendersWithDtmf:Nw,shimGetStats:Mw,shimGetUserMedia:xw,shimMediaStream:Ow,shimOnTrack:Pw,shimPeerConnection:Vw,shimSenderReceiverGetStats:Dw});function jw(e){return function(e){if(sb(e))return Cb(e)}(e)||function(e){if(void 0!==Mp&&null!=ab(e)||null!=e["@@iterator"])return Rb(e)}(e)||wb(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Hw=Ir,zw=Rr,Gw=Ts,Ww=Ak.trim,Kw=bk,Xw=Ur("".charAt),Jw=Hw.parseFloat,qw=Hw.Symbol,Yw=qw&&qw.iterator,Qw=1/Jw(Kw+"-0")!=-1/0||Yw&&!zw((function(){Jw(Object(Yw))}))?function(e){var t=Ww(Gw(e)),r=Jw(t);return 0===r&&"-"===Xw(t,0)?-0:r}:Jw;Zo({global:!0,forced:parseFloat!==Qw},{parseFloat:Qw});var Zw=Er(kn.parseFloat);function $w(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){bC("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===$p(e)&&"object"===$p(e.audio)&&(e=JSON.parse(ZS(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var a=n.prototype.getSettings;n.prototype.getSettings=function(){var e=a.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===$p(e)&&(e=JSON.parse(ZS(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function eA(e){"object"===$p(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&LR(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function tA(e,t){if("object"===$p(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=af({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=LC(Array.prototype).call(arguments),i=e[0],o=e[1],a=e[2];return n.apply(this,[i||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,n){e.set(n,QR({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function rA(e){if("object"===$p(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):qS.resolve(new DR)}}}function nA(e){if("object"===$p(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r}),mC(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function iA(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;bC("removeStream","removeTrack"),this.getSenders().forEach((function(r){var n;r.track&&vE(n=e.getTracks()).call(n,r.track)&&t.removeTrack(r)}))})}function oA(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function aA(e){if("object"===$p(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var r=(e=jw(e)).length>0;r&&e.forEach((function(e){if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(Zw(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(Zw(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var n=t.apply(this,arguments);if(r){var i=n.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===ck(o.encodings[0]).length)&&(o.encodings=e,i.sendEncodings=e,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function sA(e){if("object"===$p(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e,r=t.apply(this,arguments);return"encodings"in r||(r.encodings=JS(e=[]).call(e,this.sendEncodings||[{}])),r})}}function cA(e){if("object"===$p(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?qS.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function uA(e){if("object"===$p(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?qS.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var dA=Object.freeze({__proto__:null,shimAddTransceiver:aA,shimCreateAnswer:uA,shimCreateOffer:cA,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,qS.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})},shimGetParameters:sA,shimGetUserMedia:$w,shimOnTrack:eA,shimPeerConnection:tA,shimRTCDataChannel:oA,shimReceiverGetStats:nA,shimRemoveStream:iA,shimSenderGetStats:rA});function lA(e){if("object"===$p(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var r,n=this;this._localStreams||(this._localStreams=[]),vE(r=this._localStreams).call(r,e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return t.call(n,r,e)})),e.getVideoTracks().forEach((function(r){return t.call(n,r,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return i&&i.forEach((function(e){var t;r._localStreams?vE(t=r._localStreams).call(t,e)||r._localStreams.push(e):r._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t,r,n=this;this._localStreams||(this._localStreams=[]);var i=qC(t=this._localStreams).call(t,e);if(-1!==i){mw(r=this._localStreams).call(r,i,1);var o=e.getTracks();this.getSenders().forEach((function(e){vE(o).call(o,e.track)&&n.removeTrack(e)}))}})}}function hA(e){if("object"===$p(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){LR(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){var r;if(t._remoteStreams||(t._remoteStreams=[]),!vE(r=t._remoteStreams).call(r,e)){t._remoteStreams.push(e);var n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){var r;if(e._remoteStreams||(e._remoteStreams=[]),!(qC(r=e._remoteStreams).call(r,t)>=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}}))}),t.apply(e,arguments)}}}function pA(e){if("object"===$p(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),qS.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),qS.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),qS.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),qS.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),qS.resolve()):n},t.addIceCandidate=s}}function fA(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return n(vA(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function vA(e){return e&&void 0!==e.video?QR({},e,{video:kC(e.video)}):e}function _A(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(bC("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(ZS(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&LR(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function mA(e){"object"===$p(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&LR(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function gA(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){var r,n;void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=DC(r=this.getTransceivers()).call(r,(function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveAudio||i||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var o=DC(n=this.getTransceivers()).call(n,(function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&o?"sendrecv"===o.direction?o.setDirection?o.setDirection("sendonly"):o.direction="sendonly":"recvonly"===o.direction&&(o.setDirection?o.setDirection("inactive"):o.direction="inactive"):!0!==e.offerToReceiveVideo||o||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function yA(e){"object"!==$p(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var SA=Object.freeze({__proto__:null,shimAudioContext:yA,shimCallbacksAPI:pA,shimConstraints:vA,shimCreateOfferLegacy:gA,shimGetUserMedia:fA,shimLocalStreamsAPI:lA,shimRTCIceServerUrls:_A,shimRemoteStreamsAPI:hA,shimTrackEventTransceiver:mA}),bA=Kl.PROPER,EA=Rr,kA=bk,TA=Ak.trim,IA=function(e){return EA((function(){return!!kA[e]()||"
"!=="
"[e]()||bA&&kA[e].name!==e}))};Zo({target:"String",proto:!0,forced:IA("trim")},{trim:function(){return TA(this)}});var RA,CA,wA=yf("String").trim,AA=An,xA=wA,OA=String.prototype,PA=function(e){var t=e.trim;return"string"==typeof e||e===OA||AA(OA,e)&&t===OA.trim?xA:t},NA=Er(PA),MA={exports:{}};RA=MA,(CA={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=CA.generateIdentifier(),CA.splitLines=function(e){var t;return ob(t=NA(e).call(e).split("\n")).call(t,(function(e){return NA(e).call(e)}))},CA.splitSections=function(e){var t=e.split("\nm=");return ob(t).call(t,(function(e,t){var r;return NA(r=t>0?"m="+e:e).call(r)+"\r\n"}))},CA.getDescription=function(e){var t=CA.splitSections(e);return t&&t[0]},CA.getMediaSections=function(e){var t=CA.splitSections(e);return t.shift(),t},CA.matchPrefix=function(e,t){var r;return Wb(r=CA.splitLines(e)).call(r,(function(e){return 0===qC(e).call(e,t)}))},CA.parseCandidate=function(e){for(var t,r={foundation:(t=0===qC(e).call(e,"a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:Hk(t[3],10),ip:t[4],address:t[4],port:Hk(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=Hk(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},CA.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},CA.parseIceOptions=function(e){return e.substr(14).split(" ")},CA.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:Hk(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=Hk(t[1],10),r.channels=3===t.length?Hk(t[2],10):1,r.numChannels=r.channels,r},CA.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},CA.parseExtmap=function(e){var t,r=e.substr(9).split(" ");return{id:Hk(r[0],10),direction:qC(t=r[0]).call(t,"/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},CA.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},CA.parseFmtp=function(e){for(var t,r={},n=e.substr(qC(e).call(e," ")+1).split(";"),i=0;i<n.length;i++){var o,a;t=NA(o=n[i]).call(o).split("="),r[NA(a=t[0]).call(a)]=t[1]}return r},CA.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&ck(e.parameters).length){var n=[];ck(e.parameters).forEach((function(t){void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},CA.parseRtcpFb=function(e){var t=e.substr(qC(e).call(e," ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},CA.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},CA.parseSsrcMedia=function(e){var t=qC(e).call(e," "),r={ssrc:Hk(e.substr(7,t-7),10)},n=qC(e).call(e,":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},CA.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:ob(t).call(t,(function(e){return Hk(e,10)}))}},CA.getMid=function(e){var t=CA.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},CA.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},CA.getDtlsParameters=function(e,t){var r=CA.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:ob(r).call(r,CA.parseFingerprint)}},CA.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},CA.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:Hk(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:LC(t).call(t,3)}},CA.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===$p(e.keyParams)?CA.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},CA.parseCryptoKeyParams=function(e){if(0!==qC(e).call(e,"inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},CA.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},CA.getCryptoParameters=function(e,t){var r=CA.matchPrefix(e+t,"a=crypto:");return ob(r).call(r,CA.parseCryptoLine)},CA.getIceParameters=function(e,t){var r=CA.matchPrefix(e+t,"a=ice-ufrag:")[0],n=CA.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},CA.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},CA.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=CA.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],o=CA.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){var a,s=CA.parseRtpMap(o),c=CA.matchPrefix(e,"a=fmtp:"+i+" ");switch(s.parameters=c.length?CA.parseFmtp(c[0]):{},s.rtcpFeedback=ob(a=CA.matchPrefix(e,"a=rtcp-fb:"+i+" ")).call(a,CA.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return CA.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(CA.parseExtmap(e))})),t},CA.writeRtpDescription=function(e,t){var r,n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=ob(r=t.codecs).call(r,(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){n+=CA.writeRtpMap(e),n+=CA.writeFmtp(e),n+=CA.writeRtcpFb(e)}));var i=0;return t.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){n+=CA.writeExtmap(e)})),n},CA.parseRtpEncodingParameters=function(e){var t,r,n,i,o,a,s=[],c=CA.parseRtpParameters(e),u=-1!==qC(t=c.fecMechanisms).call(t,"RED"),d=-1!==qC(r=c.fecMechanisms).call(r,"ULPFEC"),l=Wb(n=ob(i=CA.matchPrefix(e,"a=ssrc:")).call(i,(function(e){return CA.parseSsrcMedia(e)}))).call(n,(function(e){return"cname"===e.attribute})),h=l.length>0&&l[0].ssrc,p=ob(o=CA.matchPrefix(e,"a=ssrc-group:FID")).call(o,(function(e){var t=e.substr(17).split(" ");return ob(t).call(t,(function(e){return Hk(e,10)}))}));p.length>0&&p[0].length>1&&p[0][0]===h&&(a=p[0][1]),c.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:h,codecPayloadType:Hk(e.parameters.apt,10)};h&&a&&(t.rtx={ssrc:a}),s.push(t),u&&((t=JSON.parse(ZS(t))).fec={ssrc:h,mechanism:d?"red+ulpfec":"red"},s.push(t))}})),0===s.length&&h&&s.push({ssrc:h});var f,v,_=CA.matchPrefix(e,"b=");return _.length&&(_=0===qC(f=_[0]).call(f,"b=TIAS:")?Hk(_[0].substr(7),10):0===qC(v=_[0]).call(v,"b=AS:")?1e3*Hk(_[0].substr(5),10)*.95-16e3:void 0,s.forEach((function(e){e.maxBitrate=_}))),s},CA.parseRtcpParameters=function(e){var t,r,n={},i=Wb(t=ob(r=CA.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return CA.parseSsrcMedia(e)}))).call(t,(function(e){return"cname"===e.attribute}))[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);var o=CA.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=0===o.length;var a=CA.matchPrefix(e,"a=rtcp-mux");return n.mux=a.length>0,n},CA.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},CA.parseMsid=function(e){var t,r,n,i=CA.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(n=i[0].substr(7).split(" "))[0],track:n[1]};var o=Wb(t=ob(r=CA.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return CA.parseSsrcMedia(e)}))).call(t,(function(e){return"msid"===e.attribute}));return o.length>0?{stream:(n=o[0].value.split(" "))[0],track:n[1]}:void 0},CA.parseSctpDescription=function(e){var t,r=CA.parseMLine(e),n=CA.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=Hk(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=CA.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:Hk(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var o=CA.matchPrefix(e,"a=sctpmap:");if(o.length>0){var a=o[0].substr(10).split(" ");return{port:Hk(a[0],10),protocol:a[1],maxMessageSize:t}}},CA.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},CA.generateSessionId=function(){return Math.random().toString().substr(2,21)},CA.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||CA.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},CA.getDirection=function(e,t){for(var r=CA.splitLines(e),n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].substr(2)}return t?CA.getDirection(t):"sendrecv"},CA.getKind=function(e){return CA.splitLines(e)[0].split(" ")[0].substr(2)},CA.isRejected=function(e){return"0"===e.split(" ",2)[1]},CA.parseMLine=function(e){var t=CA.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:Hk(t[1],10),protocol:t[2],fmt:LC(t).call(t,3).join(" ")}},CA.parseOLine=function(e){var t=CA.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:Hk(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},CA.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=CA.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},RA.exports=CA;var DA=MA.exports,LA=Er(DA),UA=function(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)}({__proto__:null,default:LA},[DA]);function VA(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){var r;if("object"===$p(e)&&e.candidate&&0===qC(r=e.candidate).call(r,"a=")&&((e=JSON.parse(ZS(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var n=new t(e),i=LA.parseCandidate(e.candidate),o=QR(n,i);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,mC(e,"icecandidate",(function(t){return t.candidate&&LR(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function FA(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||mC(e,"icecandidate",(function(e){if(e.candidate){var t=LA.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function BA(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||LR(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e,n;if(this._sctp=null,"chrome"===t.browser&&t.version>=76&&"plan-b"===this.getConfiguration().sdpSemantics&&LR(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0}),function(e){if(!e||!e.sdp)return!1;var t=LA.splitSections(e.sdp);return t.shift(),t.some((function(e){var t,r=LA.parseMLine(e);return r&&"application"===r.kind&&-1!==qC(t=r.protocol).call(t,"SCTP")}))}(arguments[0])){var i,o=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=Hk(t[1],10);return r!=r?-1:r}(arguments[0]),a=(e=o,n=65536,"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n),s=function(e,r){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=LA.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=Hk(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n}(arguments[0],o);i=0===a&&0===s?Number.POSITIVE_INFINITY:0===a||0===s?Math.max(a,s):Math.min(a,s);var c={};LR(c,"maxMessageSize",{get:function(){return i}}),this._sctp=c}return r.apply(this,arguments)}}}function jA(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return r(e),e},mC(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){return r.apply(e,arguments)}}}function HA(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;LR(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),LR(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function zA(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){var n;if(t&&t.sdp&&-1!==qC(n=t.sdp).call(n,"\na=extmap-allow-mixed")){var i,o=Wb(i=t.sdp.split("\n")).call(i,(function(e){return"a=extmap-allow-mixed"!==NA(e).call(e)})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:o}):t.sdp=o}return r.apply(this,arguments)}}}function GA(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?qS.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),qS.resolve())})}}function WA(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==$p(t)||t.type&&t.sdp)return r.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}return t.sdp||"offer"!==t.type&&"answer"!==t.type?r.apply(this,[t]):("offer"===t.type?this.createOffer:this.createAnswer).apply(this).then((function(t){return r.apply(e,[t])}))})}}var KA=Object.freeze({__proto__:null,removeExtmapAllowMixed:zA,shimAddIceCandidateNullOrEmpty:GA,shimConnectionState:HA,shimMaxMessageSize:BA,shimParameterlessSetLocalDescription:WA,shimRTCIceCandidate:VA,shimRTCIceCandidateRelayProtocol:FA,shimSendThrowTypeError:jA});if(function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).window,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},r=SC,n=function(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var r=e.navigator;if(r.mozGetUserMedia)t.browser="firefox",t.version=_C(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=_C(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=_C(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:n,commonShim:KA,extractVersion:_C,disableLog:gC,disableWarnings:yC,sdp:UA};switch(n.browser){case"chrome":if(!Bw||!Vw||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),i;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),i;r("adapter.js shimming chrome."),i.browserShim=Bw,GA(e,n),WA(e),xw(e,n),Ow(e),Vw(e,n),Pw(e),Uw(e,n),Nw(e),Mw(e),Dw(e),Fw(e,n),VA(e),FA(e),HA(e),BA(e,n),jA(e),zA(e,n);break;case"firefox":if(!dA||!tA||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),i;r("adapter.js shimming firefox."),i.browserShim=dA,GA(e,n),WA(e),$w(e,n),tA(e,n),eA(e),iA(e),rA(e),nA(e),oA(e),aA(e),sA(e),cA(e),uA(e),VA(e),HA(e),BA(e,n),jA(e);break;case"safari":if(!SA||!t.shimSafari)return r("Safari shim is not included in this adapter release."),i;r("adapter.js shimming safari."),i.browserShim=SA,GA(e,n),WA(e),_A(e),gA(e),pA(e),lA(e),hA(e),mA(e),fA(e),yA(e),VA(e),FA(e),BA(e,n),jA(e),zA(e,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),"undefined"!=typeof MediaStreamTrack){var XA=MediaStreamTrack.prototype.getSettings;MediaStreamTrack.prototype.getSettings=function(){var e=XA.call(this);return e.width&&(e.width=Math.floor(e.width)),e.height&&(e.height=Math.floor(e.height)),e.frameRate&&(e.frameRate=Math.floor(e.frameRate)),e}}var JA=kn.Object.getOwnPropertySymbols,qA=Er(JA),YA=ev,QA=yn,ZA=qr,$A=ka;Zo({target:"Object",stat:!0,sham:!Yr},{getOwnPropertyDescriptors:function(e){for(var t,r,n=QA(e),i=ZA.f,o=YA(n),a={},s=0;o.length>s;)void 0!==(r=i(n,t=o[s++]))&&$A(a,t,r);return a}});var ex=Er(kn.Object.getOwnPropertyDescriptors),tx={exports:{}},rx=Zo,nx=Yr,ix=Is.f;rx({target:"Object",stat:!0,forced:Object.defineProperties!==ix,sham:!nx},{defineProperties:ix});var ox=kn.Object,ax=tx.exports=function(e,t){return ox.defineProperties(e,t)};ox.defineProperties.sham&&(ax.sham=!0);var sx=Er(tx.exports);function cx(e,t){var r=sk(e);if(qA){var n=qA(e);t&&(n=Gb(n).call(n,(function(t){return Cw(e,t).enumerable}))),Kf(r).apply(r,n)}return r}function ux(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?wf(r=cx(Object(i),!0)).call(r,(function(t){af(e,t,i[t])})):ex?sx(e,ex(i)):wf(n=cx(Object(i))).call(n,(function(t){oa(e,t,Cw(i,t))}))}return e}function dx(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var lx=bi,hx=function(e){return void 0!==e&&(lx(e,"value")||lx(e,"writable"))},px=$r,fx=En,vx=Ro,_x=hx,mx=qr,gx=th;Zo({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return vx(t)===o?t[r]:(n=mx.f(t,r))?_x(n)?n.value:void 0===n.get?void 0:px(n.get,o):fx(i=gx(t))?e(i,r,o):void 0}});var yx=kn.Reflect.get,Sx=Er(yx),bx=Ur,Ex=$n,kx=En,Tx=bi,Ix=el,Rx=Cr,Cx=Function,wx=bx([].concat),Ax=bx([].join),xx={},Ox=Rx?Cx.bind:function(e){var t=Ex(this),r=t.prototype,n=Ix(arguments,1),i=function(){var r=wx(n,Ix(arguments));return this instanceof i?function(e,t,r){if(!Tx(xx,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";xx[t]=Cx("C,a","return new C("+Ax(n,",")+")")}return xx[t](e,r)}(t,r.length,r):t.apply(e,r)};return kx(r)&&(i.prototype=r),i},Px=Ox;Zo({target:"Function",proto:!0,forced:Function.bind!==Px},{bind:Px});var Nx=yf("Function").bind,Mx=An,Dx=Nx,Lx=Function.prototype,Ux=function(e){var t=e.bind;return e===Lx||Mx(Lx,e)&&t===Lx.bind?Dx:t},Vx=Er(Ux);function Fx(e){var t;return(Fx=Jf?Vx(t=pf).call(t):function(e){return e.__proto__||pf(e)})(e)}function Bx(){var e;return Bx="undefined"!=typeof Reflect&&Sx?Vx(e=Sx).call(e):function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Fx(e)););return e}(e,t);if(n){var i=Cw(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},Bx.apply(this,arguments)}function jx(e,t){var r;return(jx=Jf?Vx(r=Jf).call(r):function(e,t){return e.__proto__=t,e})(e,t)}function Hx(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=uf(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),oa(e,"prototype",{writable:!1}),t&&jx(e,t)}var zx=Zo,Gx=Pr,Wx=Ox,Kx=N_,Xx=Ro,Jx=En,qx=_c,Yx=Rr,Qx=wn("Reflect","construct"),Zx=Object.prototype,$x=[].push,eO=Yx((function(){function e(){}return!(Qx((function(){}),[],e)instanceof e)})),tO=!Yx((function(){Qx((function(){}))})),rO=eO||tO;zx({target:"Reflect",stat:!0,forced:rO,sham:rO},{construct:function(e,t){Kx(e),Xx(t);var r=arguments.length<3?e:Kx(arguments[2]);if(tO&&!eO)return Qx(e,t,r);if(e===r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return Gx($x,n,t),new(Gx(Wx,e,n))}var i=r.prototype,o=qx(Jx(i)?i:Zx),a=Gx(e,o,t);return Jx(a)?a:o}});var nO=Er(kn.Reflect.construct);function iO(){if("undefined"==typeof Reflect||!nO)return!1;if(nO.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(nO(Boolean,[],(function(){}))),!0}catch(e){return!1}}function oO(e){var t=iO();return function(){var r,n=Fx(e);if(t){var i=Fx(this).constructor;r=nO(n,arguments,i)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===$p(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return dx(e)}(this,r)}}var aO=Rc,sO=Math.floor,cO=function(e,t){var r=e.length,n=sO(r/2);return r<8?uO(e,t):dO(e,cO(aO(e,0,n),t),cO(aO(e,n),t),t)},uO=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},dO=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},lO=cO,hO=xn.match(/firefox\/(\d+)/i),pO=!!hO&&+hO[1],fO=/MSIE|Trident/.test(xn),vO=xn.match(/AppleWebKit\/(\d+)\./),_O=!!vO&&+vO[1],mO=Zo,gO=Ur,yO=$n,SO=gi,bO=ma,EO=ZC,kO=Ts,TO=Rr,IO=lO,RO=vf,CO=pO,wO=fO,AO=Un,xO=_O,OO=[],PO=gO(OO.sort),NO=gO(OO.push),MO=TO((function(){OO.sort(void 0)})),DO=TO((function(){OO.sort(null)})),LO=RO("sort"),UO=!TO((function(){if(AO)return AO<70;if(!(CO&&CO>3)){if(wO)return!0;if(xO)return xO<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)OO.push({k:t+n,v:r})}for(OO.sort((function(e,t){return t.v-e.v})),n=0;n<OO.length;n++)t=OO[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));mO({target:"Array",proto:!0,forced:MO||!DO||!LO||!UO},{sort:function(e){void 0!==e&&yO(e);var t=SO(this);if(UO)return void 0===e?PO(t):PO(t,e);var r,n,i=[],o=bO(t);for(n=0;n<o;n++)n in t&&NO(i,t[n]);for(IO(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:kO(t)>kO(r)?1:-1}}(e)),r=bO(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)EO(t,n++);return t}});var VO=yf("Array").sort,FO=An,BO=VO,jO=Array.prototype,HO=function(e){var t=e.sort;return e===jO||FO(jO,e)&&t===jO.sort?BO:t},zO=Er(HO),GO=Zo,WO=xu.findIndex,KO="findIndex",XO=!0;KO in[]&&Array(1)[KO]((function(){XO=!1})),GO({target:"Array",proto:!0,forced:XO},{findIndex:function(e){return WO(this,e,arguments.length>1?arguments[1]:void 0)}});var JO=yf("Array").findIndex,qO=An,YO=JO,QO=Array.prototype,ZO=function(e){var t=e.findIndex;return e===QO||qO(QO,e)&&t===QO.findIndex?YO:t},$O=Er(ZO),eP=Zo,tP=Gr;qr.f;var rP=va,nP=Ts,iP=$b,oP=_n,aP=tE,sP=tP("".startsWith),cP=tP("".slice),uP=Math.min;eP({target:"String",proto:!0,forced:!aP("startsWith")},{startsWith:function(e){var t=nP(oP(this));iP(e);var r=rP(uP(arguments.length>1?arguments[1]:void 0,t.length)),n=nP(e);return sP?sP(t,n,r):cP(t,r,r+n.length)===n}});var dP=yf("String").startsWith,lP=An,hP=dP,pP=String.prototype,fP=function(e){var t=e.startsWith;return"string"==typeof e||e===pP||lP(pP,e)&&t===pP.startsWith?hP:t},vP=Er(fP),_P=function(e){return e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.TOKEN_NO_PUBLISH_PERMISSION="TOKEN_NO_PUBLISH_PERMISSION",e.TOKEN_NO_SUBSCRIBE_PERMISSION="TOKEN_NO_SUBSCRIBE_PERMISSION",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.INVOKED_BEFORE_CAPTURE="INVOKED_BEFORE_CAPTURE",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INTERRUPT="INTERRUPT",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_EXCEED_QPS="USER_MESSAGE_EXCEED_QPS",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED",e.SUBTITLE_ALREADY_ON="SUBTITLE_ALREADY_ON",e.SUBTITLE_NOT_TURNED_ON="SUBTITLE_NOT_TURNED_ON",e.SUBTITLE_ERR_POSTPROCESS="SUBTITLE_ERR_POSTPROCESS",e.SUBTITLE_ERR_CONNECTION_ERROR="SUBTITLE_ERR_CONNECTION_ERROR",e.SUBTITLE_ERR_PROCESS_ERROR="SUBTITLE_ERR_PROCESS_ERROR",e.SUBTITLE_ERR_UNKNOWN="SUBTITLE_ERR_UNKNOWN",e.UNEXPECTED_INVOKE_FORWARD_STREAM="UNEXPECTED_INVOKE_FORWARD_STREAM",e.ROOM_FORBIDDEN="ROOM_FORBIDDEN",e.USER_FORBIDDEN="USER_FORBIDDEN",e}(_P||{}),mP=function(e){return e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK",e}(mP||{}),gP=function(e){return e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL",e}(gP||{}),yP=function(e){return e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL",e}(yP||{}),SP=function(e){return e[e.QUIT=0]="QUIT",e[e.DROPPED=1]="DROPPED",e[e.SWITCH_TO_INVISIBLE=2]="SWITCH_TO_INVISIBLE",e[e.KICKED_BY_ADMIN=3]="KICKED_BY_ADMIN",e}(SP||{}),bP=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(bP||{}),EP=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(EP||{}),kP=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(kP||{}),TP=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(TP||{}),IP=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(IP||{}),RP=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e[e.RENDER_MODE_FILL=2]="RENDER_MODE_FILL",e}(RP||{}),CP=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(CP||{}),wP=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(wP||{}),AP=function(e){return e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER",e[e.STREAM_REMOVE_REASON_TOKEN_PRIVILEGE_EXPIRED=6]="STREAM_REMOVE_REASON_TOKEN_PRIVILEGE_EXPIRED",e}(AP||{}),xP=function(e){return e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST",e}(xP||{}),OP=function(e){return e.ICE_FAILED="iceFailed",e.NODE_CHANGE="nodeChange",e.JOIN_TIMEOUT="joinTimeout",e.NOTIFY_RECONNECT="notifyReconnect",e}(OP||{}),PP=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(PP||{}),NP=function(e){return e[e.NORMAL=0]="NORMAL",e[e.DISCONNECT=1]="DISCONNECT",e[e.RESET=2]="RESET",e}(NP||{}),MP=function(e){return e[e.MICROPHONE=0]="MICROPHONE",e[e.AUDIOMIXING=1]="AUDIOMIXING",e}(MP||{}),DP=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(DP||{}),LP=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(LP||{}),UP=function(e){return e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY",e}(UP||{}),VP=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(VP||{}),FP=function(e){return e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e}(FP||{}),BP=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(BP||{}),jP=function(e){return e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD",e[e.DOWN=6]="DOWN",e}(jP||{}),HP=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(HP||{}),zP=function(e){return e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom",e}(zP||{}),GP=function(e){return e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono",e}(GP||{}),WP=function(e){return e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY",e}(WP||{}),KP=function(e){return e.LC="LC",e.HEv1="HEv1",e.HEv2="HEv2",e}(KP||{}),XP=function(e){return e.H264="H264",e.H265="H265",e}(XP||{}),JP=function(e){return e[e.ASR_ONLY=0]="ASR_ONLY",e[e.ASR_AND_TRANSLATION=1]="ASR_AND_TRANSLATION",e}(JP||{}),qP=function(e){return e[e.STARTED=0]="STARTED",e[e.STOPPED=1]="STOPPED",e[e.ERROR=2]="ERROR",e[e.UPDATED=3]="UPDATED",e}(qP||{}),YP=function(e){return e[e.FORWARD_STREAM_STATE_SUCCESS=0]="FORWARD_STREAM_STATE_SUCCESS",e[e.FORWARD_STREAM_STATE_FAILURE=1]="FORWARD_STREAM_STATE_FAILURE",e}(YP||{}),QP=function(e){return e[e.FORWARD_STREAM_ERROR_OK=0]="FORWARD_STREAM_ERROR_OK",e[e.FORWARD_STREAM_ERROR_INVALID_TOKEN=1202]="FORWARD_STREAM_ERROR_INVALID_TOKEN",e[e.FORWARD_STREAM_ERROR_RESPONSE=1203]="FORWARD_STREAM_ERROR_RESPONSE",e[e.FORWARD_STREAM_ERROR_REMOTE_KICKED=1204]="FORWARD_STREAM_ERROR_REMOTE_KICKED",e[e.FORWARD_STREAM_ERROR_NOT_SUPPORT=1205]="FORWARD_STREAM_ERROR_NOT_SUPPORT",e}(QP||{}),ZP=function(e){return e[e.DEFAULT=0]="DEFAULT",e[e.HIGH=1]="HIGH",e}(ZP||{});function $P(e,t,r){var n;return $P=iO()?Vx(n=nO).call(n):function(e,t,r){var n=[null];Kf(n).apply(n,t);var i=new(Vx(Function).apply(e,n));return r&&jx(i,r.prototype),i},$P.apply(null,arguments)}function eN(e){var t="function"==typeof MR?new MR:void 0;return eN=function(e){if(null===e||!function(e){var t;return-1!==JC(t=Function.toString.call(e)).call(t,"[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return $P(e,arguments,Fx(this).constructor)}return r.prototype=uf(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),jx(r,e)},eN(e)}var tN=Er(Xf),rN=function(){Hx(t,eN(Error));var e=oO(t);function t(r,n,i){var o;return of(this,t),af(dx(o=e.call(this,n)),"code",void 0),af(dx(o),"message",void 0),af(dx(o),"error",void 0),o.code=r,o.message=n,o.error=i,tN(dx(o),t.prototype),o}return nf(t,[{key:"toString",value:function(){var e;return JS(e="SDKError: ".concat(this.code," ")).call(e,this.message)}}]),t}(),nN=ha,iN=Ts,oN=_n,aN=RangeError,sN=Ur,cN=va,uN=Ts,dN=function(e){var t=iN(oN(this)),r="",n=nN(e);if(n<0||n===1/0)throw aN("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},lN=_n,hN=sN(dN),pN=sN("".slice),fN=Math.ceil,vN=function(e){return function(t,r,n){var i,o,a=uN(lN(t)),s=cN(r),c=a.length,u=void 0===n?" ":uN(n);return s<=c||""===u?a:((o=hN(u,fN((i=s-c)/u.length))).length>i&&(o=pN(o,0,i)),e?a+o:o+a)}},_N={start:vN(!1),end:vN(!0)},mN=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(xn),gN=_N.end;Zo({target:"String",proto:!0,forced:mN},{padEnd:function(e){return gN(this,e,arguments.length>1?arguments[1]:void 0)}});var yN=yf("String").padEnd,SN=An,bN=yN,EN=String.prototype,kN=function(e){var t=e.padEnd;return"string"==typeof e||e===EN||SN(EN,e)&&t===EN.padEnd?bN:t},TN=Er(kN),IN=jk;Zo({target:"Number",stat:!0,forced:Number.parseInt!==IN},{parseInt:IN});var RN=Er(kn.Number.parseInt),CN=Er(Ib),wN=Er(mS),AN=Math.log,xN=Math.LOG10E,ON=Math.log10||function(e){return AN(e)*xN};Zo({target:"Math",stat:!0},{log10:ON});var PN=Er(kn.Math.log10);Zo({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{MAX_SAFE_INTEGER:9007199254740991});var NN,MN=Er(9007199254740991),DN=yf("Array").values,LN=Pa,UN=bi,VN=An,FN=DN,BN=Array.prototype,jN={DOMTokenList:!0,NodeList:!0},HN=function(e){var t=e.values;return e===BN||VN(BN,e)&&t===BN.values||UN(jN,LN(e))?FN:t},zN=Er(HN),GN=yf("Array").keys,WN=Pa,KN=bi,XN=An,JN=GN,qN=Array.prototype,YN={DOMTokenList:!0,NodeList:!0},QN=function(e){var t=e.keys;return e===qN||XN(qN,e)&&t===qN.keys||KN(YN,WN(e))?JN:t},ZN=Er(QN),$N=new Uint8Array(16);function eM(){if(!NN&&!(NN="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return NN($N)}var tM=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var rM=[],nM=0;nM<256;++nM)rM.push((nM+256).toString(16).substr(1));function iM(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(rM[e[t+0]]+rM[e[t+1]]+rM[e[t+2]]+rM[e[t+3]]+"-"+rM[e[t+4]]+rM[e[t+5]]+"-"+rM[e[t+6]]+rM[e[t+7]]+"-"+rM[e[t+8]]+rM[e[t+9]]+"-"+rM[e[t+10]]+rM[e[t+11]]+rM[e[t+12]]+rM[e[t+13]]+rM[e[t+14]]+rM[e[t+15]]).toLowerCase();if(!function(e){return"string"==typeof e&&tM.test(e)}(r))throw TypeError("Stringified UUID is invalid");return r}function oM(e,t,r){var n=(e=e||{}).random||(e.rng||eM)();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,iM(n)}var aM=function(){return"undefined"==typeof window},sM=function(){return oM()},cM=function(e){return"number"==typeof e},uM=function(e){var t;return vE(t=Function.prototype.toString.call(e)).call(t,"[native code]")};function dM(e){return null==e?"undefined | null":"string"==typeof e?e:ZS({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function lM(e){return null==e?"undefined | null":"string"==typeof e?e:ZS({id:e.id,active:e.active})}function hM(e){return null==e?"undefined | null":"string"==typeof e?e:ZS({track:dM(e.track)})}function pM(e){return null==e?"undefined | null":"string"==typeof e?e:ZS({track:dM(e.track)})}function fM(e){return null==e?"undefined | null":"string"==typeof e?e:ZS({currentDirection:e.currentDirection,direction:e.direction,mid:e.mid,stopped:e.stopped,receiver:pM(e.receiver),sender:hM(e.sender)})}var vM="@byted/ve-rtc",_M="@byted/ve-rtc-cache-size",mM=function(){function e(){of(this,e),af(this,"storeKey",void 0),af(this,"logLevel",void 0),af(this,"LogfileSize",void 0),af(this,"db",void 0),af(this,"logId",void 0),af(this,"cacheLog",void 0),af(this,"cachedSize",void 0),af(this,"preCacheTime",void 0),af(this,"timer",void 0),af(this,"_getSize",(function(e){return new Blob(e).size/1048576})),this.storeKey="",this.logId=1,this.cacheLog="",this.logLevel="none",this.LogfileSize=100,this._createStore()}return nf(e,[{key:"_createStore",value:function(){var e=this;if(!aM()&&window.indexedDB){var t=indexedDB.open("@byted/ve-rtc");t.onupgradeneeded=function(){t.result.createObjectStore(vM);try{localStorage.removeItem(_M)}catch(e){}},t.onerror=function(e){},t.onsuccess=function(){e.db=t.result,e._getCachedSize()}}}},{key:"_getCachedSize",value:function(){var e=this;try{var t=localStorage.getItem(_M);t?this.cachedSize=Number(t):zN(this).call(this).then((function(t){e.cachedSize=e._getSize(t),e._setCachedSize()}))}catch(e){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(_M,"".concat(this.cachedSize))}catch(e){}}},{key:"_getStore",value:function(e){if(this.db)return this.db.transaction(vM,e).objectStore(vM)}},{key:"set",value:function(e){var t=this;return new qS((function(r,n){if("none"===t.logLevel)return r();var i;if(e&&t.preCacheTime&&t.preCacheTime-Date.now()<1e3)return t.cacheLog+=JS(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,t.timer||(t.timer=setTimeout((function(){t.set("")}),1e3-(t.preCacheTime-Date.now()))),r();clearTimeout(t.timer),t.timer=null;var o=t._getStore("readwrite");if(!o)return n("get store fail");t.cachedSize&&t.cachedSize>t.LogfileSize&&t.keyEarliest().then((function(e){t.get(e).then((function(r){t.del(e).then((function(){t.cachedSize=t.cachedSize-t._getSize(["".concat(r)]),t._setCachedSize()}))}))}));var a=o.get(t.storeKey);a.onsuccess=function(){try{var i,s,c,u,d,l=JS(i="".concat(a.result||"")).call(i,t.cacheLog),h=e?JS(s=JS(c="".concat(l?"\n\n":"")).call(c,t.logId,": ")).call(s,e):"";o.put(JS(u="".concat(l)).call(u,h),t.storeKey),e&&t.logId++,t.cacheLog="",t.cachedSize=(t.cachedSize||0)+t._getSize([JS(d="".concat(t.cacheLog)).call(d,h)]),t._setCachedSize(),t.preCacheTime=Date.now(),r()}catch(r){var p;if(!e)return n(r);t.cacheLog+=JS(p="\n\n".concat(t.logId,": ")).call(p,e),t.logId++,n(r)}},a.onerror=function(r){var i;if(!e)return n(r);t.cacheLog+=JS(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,n(r)}}))}},{key:"get",value:function(e){var t=this;return new qS((function(r,n){var i=t._getStore("readonly");if(!i)return n();var o=i.get(e);o.onsuccess=function(){r(o.result)},o.onerror=function(e){n(e)}}))}},{key:"del",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.storeKey;return new qS((function(r,n){var i=e._getStore("readwrite");if(!i)return n();var o=i.delete(t);o.onsuccess=function(){return r(o.result)},o.onerror=function(e){return n(e)}}))}},{key:"keyEarliest",value:function(){return ZN(this).call(this).then((function(e){var t,r=Date.now();return e.forEach((function(e){if(e&&e.length){var n=e.split("-")[0];Number(n)<r&&(r=Number(n),t=e)}})),t}))}},{key:"keys",value:function(){var e=this;return new qS((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAllKeys){var i=n.getAllKeys();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.key),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"values",value:function(){var e=this;return new qS((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAll){var i=n.getAll();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.value),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"download",value:function(e){e=e||this.storeKey,this.get(e).then((function(t){var r=document.createElement("a");r.download="".concat(e,".txt"),r.href="data:text/paint;utf-8,".concat(t||""),r.click()}))}}]),e}(),gM=new mM,yM=_N.start;Zo({target:"String",proto:!0,forced:mN},{padStart:function(e){return yM(this,e,arguments.length>1?arguments[1]:void 0)}});var SM=yf("String").padStart,bM=An,EM=SM,kM=String.prototype,TM=function(e){var t=e.padStart;return"string"==typeof e||e===kM||bM(kM,e)&&t===kM.padStart?EM:t},IM=Er(TM),RM=function(){function e(){of(this,e),af(this,"_all",{})}return nf(e,[{key:"on",value:function(e,t){var r=this._all[e];r?r.push(t):this._all[e]=[t]}},{key:"once",value:function(e,t){var r=this;this.on(e,(function n(){t.apply(void 0,arguments),r.off(e,n)}))}},{key:"off",value:function(e,t){var r=this._all[e];null==r||mw(r).call(r,qC(r).call(r,t)>>>0,1)}},{key:"emit",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=this._all[e];null==i||LC(i).call(i).forEach((function(e){return e.apply(void 0,r)}))}},{key:"safeEmit",value:function(e){try{for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return this.emit.apply(this,JS(t=[e]).call(t,n))}catch(e){console.error(e)}}},{key:"destroy",value:function(){this._all={}}}]),e}(),CM=["UPLOAD_CONSOLE_LENGTH_CUT","UPLOAD_REPORT_LIMIT"];var wM=function(){Hx(t,RM);var e=oO(t);function t(){var r,n;of(this,t);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return af(dx(n=e.call.apply(e,JS(r=[this]).call(r,o))),"config",{UPLOAD_CONSOLE_ON:!1,UPLOAD_CONSOLE_LENGTH_CUT:200,UPLOAD_REPORT_LIMIT:45e4,ENABLE_REPORT_IDB_BUFFER:!1}),n}return nf(t,[{key:"setParameter",value:function(e,t){if(function(e){return vE(CM).call(CM,e)}(e))try{var r=Number(t);if(Number.isNaN(r))return;this.config[e]=r}catch(r){var n;return void console.warn(JS(n="Cannot convert core lib parameter ".concat(e,":")).call(n,t," into number"))}else this.config[e]=t;this.emit(e,this.config[e])}},{key:"getParameter",value:function(e){return this.config[e]}},{key:"getKeys",value:function(){return ck(this.config)}}]),t}(),AM=new wM,xM=sa,OM=ma,PM=ya,NM=So,MM=function(e,t,r,n,i,o,a,s){for(var c,u,d=i,l=0,h=!!a&&NM(a,s);l<n;)l in r&&(c=h?h(r[l],l,t):r[l],o>0&&xM(c)?(u=OM(c),d=MM(e,t,c,u,d,o-1)-1):(PM(d+1),e[d]=c),d++),l++;return d},DM=MM,LM=gi,UM=ma,VM=ha,FM=ns;Zo({target:"Array",proto:!0},{flat:function(){var e=arguments.length?arguments[0]:void 0,t=LM(this),r=UM(t),n=FM(t,0);return n.length=DM(n,t,t,r,0,void 0===e?1:VM(e)),n}});var BM=yf("Array").flat,jM=An,HM=BM,zM=Array.prototype,GM=function(e){var t=e.flat;return e===zM||jM(zM,e)&&t===zM.flat?HM:t},WM=Er(GM),KM={};!function(e){var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=LC(Array.prototype).call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==$p(n))throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(e[i]=n[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},i={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return JS([]).apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)}(KM);var XM={},JM={},qM={},YM=KM,QM=0,ZM=1;function $M(e){for(var t=e.length;--t>=0;)e[t]=0}var eD=0,tD=29,rD=256,nD=rD+1+tD,iD=30,oD=19,aD=2*nD+1,sD=15,cD=16,uD=7,dD=256,lD=16,hD=17,pD=18,fD=[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],vD=[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],_D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],mD=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],gD=new Array(2*(nD+2));$M(gD);var yD=new Array(2*iD);$M(yD);var SD=new Array(512);$M(SD);var bD=new Array(256);$M(bD);var ED=new Array(tD);$M(ED);var kD,TD,ID,RD=new Array(iD);function CD(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function wD(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function AD(e){return e<256?SD[e]:SD[256+(e>>>7)]}function xD(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function OD(e,t,r){e.bi_valid>cD-r?(e.bi_buf|=t<<e.bi_valid&65535,xD(e,e.bi_buf),e.bi_buf=t>>cD-e.bi_valid,e.bi_valid+=r-cD):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function PD(e,t,r){OD(e,r[2*t],r[2*t+1])}function ND(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function MD(e,t,r){var n,i,o=new Array(sD+1),a=0;for(n=1;n<=sD;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=ND(o[s]++,s))}}function DD(e){var t;for(t=0;t<nD;t++)e.dyn_ltree[2*t]=0;for(t=0;t<iD;t++)e.dyn_dtree[2*t]=0;for(t=0;t<oD;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*dD]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function LD(e){e.bi_valid>8?xD(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function UD(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function VD(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&UD(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!UD(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function FD(e,t,r){var n,i,o,a,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?PD(e,i,t):(PD(e,(o=bD[i])+rD+1,t),0!==(a=fD[o])&&OD(e,i-=ED[o],a),PD(e,o=AD(--n),r),0!==(a=vD[o])&&OD(e,n-=RD[o],a))}while(s<e.last_lit);PD(e,dD,t)}function BD(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=aD,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)VD(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],VD(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,VD(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,f=t.stat_desc.max_length,v=0;for(o=0;o<=sD;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<aD;r++)(o=c[2*c[2*(n=e.heap[r])+1]+1]+1)>f&&(o=f,v++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=p&&(a=h[n-p]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==v){do{for(o=f-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[f]--,v-=2}while(v>0);for(o=f;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),MD(o,u,e.bl_count)}function jD(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[2*lD]++):s<=10?e.bl_tree[2*hD]++:e.bl_tree[2*pD]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))}function HD(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{PD(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(PD(e,i,e.bl_tree),s--),PD(e,lD,e.bl_tree),OD(e,s-3,2)):s<=10?(PD(e,hD,e.bl_tree),OD(e,s-3,3)):(PD(e,pD,e.bl_tree),OD(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}$M(RD);var zD=!1;function GD(e,t,r,n){OD(e,(eD<<1)+(n?1:0),3),function(e,t,r){LD(e),xD(e,r),xD(e,~r),YM.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r)}qM._tr_init=function(e){zD||(function(){var e,t,r,n,i,o=new Array(sD+1);for(r=0,n=0;n<tD-1;n++)for(ED[n]=r,e=0;e<1<<fD[n];e++)bD[r++]=n;for(bD[r-1]=n,i=0,n=0;n<16;n++)for(RD[n]=i,e=0;e<1<<vD[n];e++)SD[i++]=n;for(i>>=7;n<iD;n++)for(RD[n]=i<<7,e=0;e<1<<vD[n]-7;e++)SD[256+i++]=n;for(t=0;t<=sD;t++)o[t]=0;for(e=0;e<=143;)gD[2*e+1]=8,e++,o[8]++;for(;e<=255;)gD[2*e+1]=9,e++,o[9]++;for(;e<=279;)gD[2*e+1]=7,e++,o[7]++;for(;e<=287;)gD[2*e+1]=8,e++,o[8]++;for(MD(gD,nD+1,o),e=0;e<iD;e++)yD[2*e+1]=5,yD[2*e]=ND(e,5);kD=new CD(gD,fD,rD+1,nD,sD),TD=new CD(yD,vD,0,iD,sD),ID=new CD(new Array(0),_D,0,oD,uD)}(),zD=!0),e.l_desc=new wD(e.dyn_ltree,kD),e.d_desc=new wD(e.dyn_dtree,TD),e.bl_desc=new wD(e.bl_tree,ID),e.bi_buf=0,e.bi_valid=0,DD(e)},qM._tr_stored_block=GD,qM._tr_flush_block=function(e,t,r,n){var i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return QM;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return ZM;for(t=32;t<rD;t++)if(0!==e.dyn_ltree[2*t])return ZM;return QM}(e)),BD(e,e.l_desc),BD(e,e.d_desc),a=function(e){var t;for(jD(e,e.dyn_ltree,e.l_desc.max_code),jD(e,e.dyn_dtree,e.d_desc.max_code),BD(e,e.bl_desc),t=oD-1;t>=3&&0===e.bl_tree[2*mD[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?GD(e,t,r,n):4===e.strategy||o===i?(OD(e,2+(n?1:0),3),FD(e,gD,yD)):(OD(e,4+(n?1:0),3),function(e,t,r,n){var i;for(OD(e,t-257,5),OD(e,r-1,5),OD(e,n-4,4),i=0;i<n;i++)OD(e,e.bl_tree[2*mD[i]+1],3);HD(e,e.dyn_ltree,t-1),HD(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),FD(e,e.dyn_ltree,e.dyn_dtree)),DD(e),n&&LD(e)},qM._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(bD[r]+rD+1)]++,e.dyn_dtree[2*AD(t)]++),e.last_lit===e.lit_bufsize-1},qM._tr_align=function(e){OD(e,2,3),PD(e,dD,gD),function(e){16===e.bi_valid?(xD(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 WD=function(e,t,r,n){for(var i=65535&e,o=e>>>16&65535,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16};var KD=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var XD,JD=function(e,t,r,n){var i=KD,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return~e},qD={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"},YD=KM,QD=qM,ZD=WD,$D=JD,eL=qD,tL=0,rL=4,nL=0,iL=-2,oL=-1,aL=4,sL=2,cL=8,uL=9,dL=286,lL=30,hL=19,pL=2*dL+1,fL=15,vL=3,_L=258,mL=_L+vL+1,gL=42,yL=103,SL=113,bL=666,EL=1,kL=2,TL=3,IL=4;function RL(e,t){return e.msg=eL[t],t}function CL(e){return(e<<1)-(e>4?9:0)}function wL(e){for(var t=e.length;--t>=0;)e[t]=0}function AL(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(YD.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function xL(e,t){QD._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,AL(e.strm)}function OL(e,t){e.pending_buf[e.pending++]=t}function PL(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function NL(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,YD.arraySet(t,e.input,e.next_in,i,r),1===e.state.wrap?e.adler=ZD(e.adler,t,i,r):2===e.state.wrap&&(e.adler=$D(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function ML(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-mL?e.strstart-(e.w_size-mL):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+_L,p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===f&&u[r+a-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(n=_L-(h-o),o=h-_L,n>a){if(e.match_start=t,a=n,n>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function DL(e){var t,r,n,i,o,a=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=a+(a-mL)){YD.arraySet(e.window,e.window,a,a,0),e.match_start-=a,e.strstart-=a,e.block_start-=a,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=a?n-a:0}while(--r);t=r=a;do{n=e.prev[--t],e.prev[t]=n>=a?n-a:0}while(--r);i+=a}if(0===e.strm.avail_in)break;if(r=NL(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=vL)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+vL-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<vL)););}while(e.lookahead<mL&&0!==e.strm.avail_in)}function LL(e,t){for(var r,n;;){if(e.lookahead<mL){if(DL(e),e.lookahead<mL&&t===tL)return EL;if(0===e.lookahead)break}if(r=0,e.lookahead>=vL&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+vL-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-mL&&(e.match_length=ML(e,r)),e.match_length>=vL)if(n=QD._tr_tally(e,e.strstart-e.match_start,e.match_length-vL),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=vL){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+vL-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=QD._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(xL(e,!1),0===e.strm.avail_out))return EL}return e.insert=e.strstart<vL-1?e.strstart:vL-1,t===rL?(xL(e,!0),0===e.strm.avail_out?TL:IL):e.last_lit&&(xL(e,!1),0===e.strm.avail_out)?EL:kL}function UL(e,t){for(var r,n,i;;){if(e.lookahead<mL){if(DL(e),e.lookahead<mL&&t===tL)return EL;if(0===e.lookahead)break}if(r=0,e.lookahead>=vL&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+vL-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=vL-1,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-mL&&(e.match_length=ML(e,r),e.match_length<=5&&(1===e.strategy||e.match_length===vL&&e.strstart-e.match_start>4096)&&(e.match_length=vL-1)),e.prev_length>=vL&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-vL,n=QD._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-vL),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+vL-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=vL-1,e.strstart++,n&&(xL(e,!1),0===e.strm.avail_out))return EL}else if(e.match_available){if((n=QD._tr_tally(e,0,e.window[e.strstart-1]))&&xL(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return EL}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=QD._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<vL-1?e.strstart:vL-1,t===rL?(xL(e,!0),0===e.strm.avail_out?TL:IL):e.last_lit&&(xL(e,!1),0===e.strm.avail_out)?EL:kL}function VL(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function FL(){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=cL,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 YD.Buf16(2*pL),this.dyn_dtree=new YD.Buf16(2*(2*lL+1)),this.bl_tree=new YD.Buf16(2*(2*hL+1)),wL(this.dyn_ltree),wL(this.dyn_dtree),wL(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new YD.Buf16(fL+1),this.heap=new YD.Buf16(2*dL+1),wL(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new YD.Buf16(2*dL+1),wL(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function BL(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=sL,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?gL:SL,e.adler=2===t.wrap?0:1,t.last_flush=tL,QD._tr_init(t),nL):RL(e,iL)}function jL(e){var t=BL(e);return t===nL&&function(e){e.window_size=2*e.w_size,wL(e.head),e.max_lazy_match=XD[e.level].max_lazy,e.good_match=XD[e.level].good_length,e.nice_match=XD[e.level].nice_length,e.max_chain_length=XD[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=vL-1,e.match_available=0,e.ins_h=0}(e.state),t}function HL(e,t,r,n,i,o){if(!e)return iL;var a=1;if(t===oL&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>uL||r!==cL||n<8||n>15||t<0||t>9||o<0||o>aL)return RL(e,iL);8===n&&(n=9);var s=new FL;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+vL-1)/vL),s.window=new YD.Buf8(2*s.w_size),s.head=new YD.Buf16(s.hash_size),s.prev=new YD.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new YD.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=r,jL(e)}XD=[new VL(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(DL(e),0===e.lookahead&&t===tL)return EL;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,xL(e,!1),0===e.strm.avail_out))return EL;if(e.strstart-e.block_start>=e.w_size-mL&&(xL(e,!1),0===e.strm.avail_out))return EL}return e.insert=0,t===rL?(xL(e,!0),0===e.strm.avail_out?TL:IL):(e.strstart>e.block_start&&(xL(e,!1),e.strm.avail_out),EL)})),new VL(4,4,8,4,LL),new VL(4,5,16,8,LL),new VL(4,6,32,32,LL),new VL(4,4,16,16,UL),new VL(8,16,32,32,UL),new VL(8,16,128,128,UL),new VL(8,32,128,256,UL),new VL(32,128,258,1024,UL),new VL(32,258,258,4096,UL)],JM.deflateInit=function(e,t){return HL(e,t,cL,15,8,0)},JM.deflateInit2=HL,JM.deflateReset=jL,JM.deflateResetKeep=BL,JM.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?iL:(e.state.gzhead=t,nL):iL},JM.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?RL(e,iL):iL;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===bL&&t!==rL)return RL(e,0===e.avail_out?-5:iL);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===gL)if(2===n.wrap)e.adler=0,OL(n,31),OL(n,139),OL(n,8),n.gzhead?(OL(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),OL(n,255&n.gzhead.time),OL(n,n.gzhead.time>>8&255),OL(n,n.gzhead.time>>16&255),OL(n,n.gzhead.time>>24&255),OL(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),OL(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(OL(n,255&n.gzhead.extra.length),OL(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=$D(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(OL(n,0),OL(n,0),OL(n,0),OL(n,0),OL(n,0),OL(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),OL(n,3),n.status=SL);else{var a=cL+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=SL,PL(n,a),0!==n.strstart&&(PL(n,e.adler>>>16),PL(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=$D(e.adler,n.pending_buf,n.pending-i,i)),AL(e),i=n.pending,n.pending!==n.pending_buf_size));)OL(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=$D(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=$D(e.adler,n.pending_buf,n.pending-i,i)),AL(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,OL(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=$D(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=$D(e.adler,n.pending_buf,n.pending-i,i)),AL(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,OL(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=$D(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=yL)}else n.status=yL;if(n.status===yL&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&AL(e),n.pending+2<=n.pending_buf_size&&(OL(n,255&e.adler),OL(n,e.adler>>8&255),e.adler=0,n.status=SL)):n.status=SL),0!==n.pending){if(AL(e),0===e.avail_out)return n.last_flush=-1,nL}else if(0===e.avail_in&&CL(t)<=CL(r)&&t!==rL)return RL(e,-5);if(n.status===bL&&0!==e.avail_in)return RL(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==tL&&n.status!==bL){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(DL(e),0===e.lookahead)){if(t===tL)return EL;break}if(e.match_length=0,r=QD._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(xL(e,!1),0===e.strm.avail_out))return EL}return e.insert=0,t===rL?(xL(e,!0),0===e.strm.avail_out?TL:IL):e.last_lit&&(xL(e,!1),0===e.strm.avail_out)?EL:kL}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=_L){if(DL(e),e.lookahead<=_L&&t===tL)return EL;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=vL&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+_L;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=_L-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=vL?(r=QD._tr_tally(e,1,e.match_length-vL),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=QD._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(xL(e,!1),0===e.strm.avail_out))return EL}return e.insert=0,t===rL?(xL(e,!0),0===e.strm.avail_out?TL:IL):e.last_lit&&(xL(e,!1),0===e.strm.avail_out)?EL:kL}(n,t):XD[n.level].func(n,t);if(s!==TL&&s!==IL||(n.status=bL),s===EL||s===TL)return 0===e.avail_out&&(n.last_flush=-1),nL;if(s===kL&&(1===t?QD._tr_align(n):5!==t&&(QD._tr_stored_block(n,0,0,!1),3===t&&(wL(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),AL(e),0===e.avail_out))return n.last_flush=-1,nL}return t!==rL?nL:n.wrap<=0?1:(2===n.wrap?(OL(n,255&e.adler),OL(n,e.adler>>8&255),OL(n,e.adler>>16&255),OL(n,e.adler>>24&255),OL(n,255&e.total_in),OL(n,e.total_in>>8&255),OL(n,e.total_in>>16&255),OL(n,e.total_in>>24&255)):(PL(n,e.adler>>>16),PL(n,65535&e.adler)),AL(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?nL:1)},JM.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==gL&&69!==t&&73!==t&&91!==t&&t!==yL&&t!==SL&&t!==bL?RL(e,iL):(e.state=null,t===SL?RL(e,-3):nL):iL},JM.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return iL;if(2===(o=(r=e.state).wrap)||1===o&&r.status!==gL||r.lookahead)return iL;for(1===o&&(e.adler=ZD(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(wL(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new YD.Buf8(r.w_size),YD.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,DL(r);r.lookahead>=vL;){n=r.strstart,i=r.lookahead-(vL-1);do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+vL-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=vL-1,DL(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=vL-1,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,r.wrap=o,nL},JM.deflateInfo="pako deflate (from Nodeca project)";var zL={},GL=KM,WL=!0,KL=!0;try{String.fromCharCode.apply(null,[0])}catch(RA){WL=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(RA){KL=!1}for(var XL=new GL.Buf8(256),JL=0;JL<256;JL++)XL[JL]=JL>=252?6:JL>=248?5:JL>=240?4:JL>=224?3:JL>=192?2:1;function qL(e,t){if(t<65534&&(e.subarray&&KL||!e.subarray&&WL))return String.fromCharCode.apply(null,GL.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}XL[254]=XL[254]=1,zL.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new GL.Buf8(s),o=0,i=0;o<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},zL.buf2binstring=function(e){return qL(e,e.length)},zL.binstring2buf=function(e){for(var t=new GL.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},zL.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)s[n++]=i;else if((o=XL[i])>4)s[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return qL(s,n)},zL.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+XL[e[r]]>t?r:t};var YL=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},QL=JM,ZL=KM,$L=zL,eU=qD,tU=YL,rU=Object.prototype.toString,nU=0,iU=-1,oU=0,aU=8;function sU(e){if(!(this instanceof sU))return new sU(e);this.options=ZL.assign({level:iU,method:aU,chunkSize:16384,windowBits:15,memLevel:8,strategy:oU,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new tU,this.strm.avail_out=0;var r=QL.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==nU)throw new Error(eU[r]);if(t.header&&QL.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?$L.string2buf(t.dictionary):"[object ArrayBuffer]"===rU.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(r=QL.deflateSetDictionary(this.strm,n))!==nU)throw new Error(eU[r]);this._dict_set=!0}}function cU(e,t){var r=new sU(t);if(r.push(e,!0),r.err)throw r.msg||eU[r.err];return r.result}sU.prototype.push=function(e,t){var r,n,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=$L.string2buf(e):"[object ArrayBuffer]"===rU.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new ZL.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=QL.deflate(i,n))&&r!==nU)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData($L.buf2binstring(ZL.shrinkBuf(i.output,i.next_out))):this.onData(ZL.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=QL.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===nU):2!==n||(this.onEnd(nU),i.avail_out=0,!0)},sU.prototype.onData=function(e){this.chunks.push(e)},sU.prototype.onEnd=function(e){e===nU&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=ZL.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},XM.Deflate=sU,XM.deflate=cU,XM.deflateRaw=function(e,t){return(t=t||{}).raw=!0,cU(e,t)},XM.gzip=function(e,t){return(t=t||{}).gzip=!0,cU(e,t)};var uU={},dU=Ro,lU=$r,hU=bi,pU=An,fU=function(){var e=dU(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},vU=RegExp.prototype,_U=function(e){var t=e.flags;return void 0!==t||"flags"in vU||hU(e,"flags")||!pU(vU,e)?t:lU(fU,e)},mU=An,gU=_U,yU=RegExp.prototype,SU=function(e){return e===yU||mU(yU,e)?gU(e):e.flags},bU=Er(SU),EU={},kU=KM,TU=15,IU=[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],RU=[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],CU=[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],wU=[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],AU=KM,xU=WD,OU=JD,PU=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),o=e.next_out,R=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,p=r.hold,f=r.bits,v=r.lencode,_=r.distcode,m=(1<<r.lenbits)-1,g=(1<<r.distbits)-1;e:do{f<15&&(p+=I[n++]<<f,f+=8,p+=I[n++]<<f,f+=8),y=v[p&m];t:for(;;){if(p>>>=S=y>>>24,f-=S,0==(S=y>>>16&255))R[o++]=65535&y;else{if(!(16&S)){if(!(64&S)){y=v[(65535&y)+(p&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&y,(S&=15)&&(f<S&&(p+=I[n++]<<f,f+=8),b+=p&(1<<S)-1,p>>>=S,f-=S),f<15&&(p+=I[n++]<<f,f+=8,p+=I[n++]<<f,f+=8),y=_[p&g];r:for(;;){if(p>>>=S=y>>>24,f-=S,!(16&(S=y>>>16&255))){if(!(64&S)){y=_[(65535&y)+(p&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&y,f<(S&=15)&&(p+=I[n++]<<f,(f+=8)<S&&(p+=I[n++]<<f,f+=8)),(E+=p&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=S,f-=S,E>(S=o-a)){if((S=E-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=u-S,S<b){b-=S;do{R[o++]=h[k++]}while(--S);k=o-E,T=R}}else if(l<S){if(k+=u+l-S,(S-=l)<b){b-=S;do{R[o++]=h[k++]}while(--S);if(k=0,l<b){b-=S=l;do{R[o++]=h[k++]}while(--S);k=o-E,T=R}}}else if(k+=l-S,S<b){b-=S;do{R[o++]=h[k++]}while(--S);k=o-E,T=R}for(;b>2;)R[o++]=T[k++],R[o++]=T[k++],R[o++]=T[k++],b-=3;b&&(R[o++]=T[k++],b>1&&(R[o++]=T[k++]))}else{k=o-E;do{R[o++]=R[k++],R[o++]=R[k++],R[o++]=R[k++],b-=3}while(b>2);b&&(R[o++]=R[k++],b>1&&(R[o++]=R[k++]))}break}}break}}while(n<i&&o<s);n-=b=f>>3,p&=(1<<(f-=b<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=p,r.bits=f},NU=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,p,f,v,_,m=s.bits,g=0,y=0,S=0,b=0,E=0,k=0,T=0,I=0,R=0,C=0,w=null,A=0,x=new kU.Buf16(16),O=new kU.Buf16(16),P=null,N=0;for(g=0;g<=TU;g++)x[g]=0;for(y=0;y<n;y++)x[t[r+y]]++;for(E=m,b=TU;b>=1&&0===x[b];b--);if(E>b&&(E=b),0===b)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<b&&0===x[S];S++);for(E<S&&(E=S),I=1,g=1;g<=TU;g++)if(I<<=1,(I-=x[g])<0)return-1;if(I>0&&(0===e||1!==b))return-1;for(O[1]=0,g=1;g<TU;g++)O[g+1]=O[g]+x[g];for(y=0;y<n;y++)0!==t[r+y]&&(a[O[t[r+y]]++]=y);if(0===e?(w=P=a,p=19):1===e?(w=IU,A-=257,P=RU,N-=257,p=256):(w=CU,P=wU,p=-1),C=0,y=0,g=S,h=o,k=E,T=0,d=-1,l=(R=1<<E)-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){f=g-T,a[y]<p?(v=0,_=a[y]):a[y]>p?(v=P[N+a[y]],_=w[A+a[y]]):(v=96,_=0),c=1<<g-T,S=u=1<<k;do{i[h+(C>>T)+(u-=c)]=f<<24|v<<16|_}while(0!==u);for(c=1<<g-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,y++,0==--x[g]){if(g===b)break;g=t[r+a[y]]}if(g>E&&(C&l)!==d){for(0===T&&(T=E),h+=S,I=1<<(k=g-T);k+T<b&&!((I-=x[k+T])<=0);)k++,I<<=1;if(R+=1<<k,1===e&&R>852||2===e&&R>592)return 1;i[d=C&l]=E<<24|k<<16|h-o}}return 0!==C&&(i[h+C]=g-T<<24|64<<16),s.bits=E,0},MU=1,DU=2,LU=0,UU=-2,VU=1,FU=12,BU=30,jU=852,HU=592;function zU(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function GU(){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 AU.Buf16(320),this.work=new AU.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function WU(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=VU,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new AU.Buf32(jU),t.distcode=t.distdyn=new AU.Buf32(HU),t.sane=1,t.back=-1,LU):UU}function KU(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,WU(e)):UU}function XU(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?UU:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,KU(e))):UU}function JU(e,t){var r,n;return e?(n=new GU,e.state=n,n.window=null,(r=XU(e,t))!==LU&&(e.state=null),r):UU}var qU,YU,QU=!0;function ZU(e){if(QU){var t;for(qU=new AU.Buf32(512),YU=new AU.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(NU(MU,e.lens,0,288,qU,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;NU(DU,e.lens,0,32,YU,0,e.work,{bits:5}),QU=!1}e.lencode=qU,e.lenbits=9,e.distcode=YU,e.distbits=5}function $U(e,t,r,n){var i,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new AU.Buf8(o.wsize)),n>=o.wsize?(AU.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),AU.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(AU.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}EU.inflateReset=KU,EU.inflateReset2=XU,EU.inflateResetKeep=WU,EU.inflateInit=function(e){return JU(e,15)},EU.inflateInit2=JU,EU.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R=0,C=new AU.Buf8(4),w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return UU;(r=e.state).mode===FU&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,k=LU;e:for(;;)switch(r.mode){case VU:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,C[0]=255&u,C[1]=u>>>8&255,r.check=OU(r.check,C,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=BU;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=BU;break}if(d-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=BU;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&u?10:FU,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.flags=u,8!=(255&bU(r))){e.msg="unknown compression method",r.mode=BU;break}if(57344&bU(r)){e.msg="unknown header flags set",r.mode=BU;break}r.head&&(r.head.text=u>>8&1),512&bU(r)&&(C[0]=255&u,C[1]=u>>>8&255,r.check=OU(r.check,C,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.time=u),512&bU(r)&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,r.check=OU(r.check,C,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&bU(r)&&(C[0]=255&u,C[1]=u>>>8&255,r.check=OU(r.check,C,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&bU(r)){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&bU(r)&&(C[0]=255&u,C[1]=u>>>8&255,r.check=OU(r.check,C,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&bU(r)&&((p=r.length)>s&&(p=s),p&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),AU.arraySet(r.head.extra,n,o,p,E)),512&bU(r)&&(r.check=OU(r.check,n,p,o)),s-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&bU(r)){if(0===s)break e;p=0;do{E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&p<s);if(512&bU(r)&&(r.check=OU(r.check,n,p,o)),s-=p,o+=p,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&bU(r)){if(0===s)break e;p=0;do{E=n[o+p++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&p<s);if(512&bU(r)&&(r.check=OU(r.check,n,p,o)),s-=p,o+=p,E)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&bU(r)){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=BU;break}u=0,d=0}r.head&&(r.head.hcrc=bU(r)>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=FU;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=zU(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=FU;case FU:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(ZU(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=BU}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=BU;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;AU.arraySet(i,n,o,p,a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=FU;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=BU;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.lens[w[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[w[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},k=NU(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=BU;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(R=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,g=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(g<16)u>>>=_,d-=_,r.lens[r.have++]=g;else{if(16===g){for(I=_+2;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=_,d-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=BU;break}E=r.lens[r.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===g){for(I=_+3;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,E=0,p=3+(7&(u>>>=_)),u>>>=3,d-=3}else{for(I=_+7;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,E=0,p=11+(127&(u>>>=_)),u>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=BU;break}for(;p--;)r.lens[r.have++]=E}}if(r.mode===BU)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=BU;break}if(r.lenbits=9,T={bits:r.lenbits},k=NU(MU,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid literal/lengths set",r.mode=BU;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=NU(DU,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,k){e.msg="invalid distances set",r.mode=BU;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,PU(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===FU&&(r.back=-1);break}for(r.back=0;m=(R=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,g=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&!(240&m)){for(y=_,S=m,b=g;m=(R=r.lencode[b+((u&(1<<y+S)-1)>>y)])>>>16&255,g=65535&R,!(y+(_=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}if(u>>>=_,d-=_,r.back+=_,r.length=g,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=FU;break}if(64&m){e.msg="invalid literal/length code",r.mode=BU;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(R=r.distcode[u&(1<<r.distbits)-1])>>>16&255,g=65535&R,!((_=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(!(240&m)){for(y=_,S=m,b=g;m=(R=r.distcode[b+((u&(1<<y+S)-1)>>y)])>>>16&255,g=65535&R,!(y+(_=R>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=y,d-=y,r.back+=y}if(u>>>=_,d-=_,r.back+=_,64&m){e.msg="invalid distance code",r.mode=BU;break}r.offset=g,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=BU;break}r.mode=25;case 25:if(0===c)break e;if(p=h-c,r.offset>p){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=BU;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),v=r.window}else v=i,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{i[a++]=v[f++]}while(--p);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=bU(r)?OU(r.check,i,h,a-h):xU(r.check,i,h,a-h)),h=c,(bU(r)?u:zU(u))!==r.check){e.msg="incorrect data check",r.mode=BU;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&bU(r)){for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=BU;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case BU:k=-3;break e;case 31:return-4;default:return UU}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<BU&&(r.mode<27||4!==t))&&$U(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=bU(r)?OU(r.check,i,h,e.next_out-h):xU(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===FU?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&k===LU&&(k=-5),k},EU.inflateEnd=function(e){if(!e||!e.state)return UU;var t=e.state;return t.window&&(t.window=null),e.state=null,LU},EU.inflateGetHeader=function(e,t){var r;return e&&e.state&&2&(r=e.state).wrap?(r.head=t,t.done=!1,LU):UU},EU.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?UU:11===r.mode&&xU(1,t,n,0)!==r.check?-3:$U(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,LU):UU},EU.inflateInfo="pako inflate (from Nodeca project)";var eV={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var tV=EU,rV=KM,nV=zL,iV=eV,oV=qD,aV=YL,sV=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},cV=Object.prototype.toString;function uV(e){if(!(this instanceof uV))return new uV(e);this.options=rV.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new aV,this.strm.avail_out=0;var r=tV.inflateInit2(this.strm,t.windowBits);if(r!==iV.Z_OK)throw new Error(oV[r]);if(this.header=new sV,tV.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=nV.string2buf(t.dictionary):"[object ArrayBuffer]"===cV.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=tV.inflateSetDictionary(this.strm,t.dictionary))!==iV.Z_OK))throw new Error(oV[r])}function dV(e,t){var r=new uV(t);if(r.push(e,!0),r.err)throw r.msg||oV[r.err];return r.result}uV.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?iV.Z_FINISH:iV.Z_NO_FLUSH,"string"==typeof e?s.input=nV.binstring2buf(e):"[object ArrayBuffer]"===cV.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new rV.Buf8(c),s.next_out=0,s.avail_out=c),(r=tV.inflate(s,iV.Z_NO_FLUSH))===iV.Z_NEED_DICT&&u&&(r=tV.inflateSetDictionary(this.strm,u)),r===iV.Z_BUF_ERROR&&!0===d&&(r=iV.Z_OK,d=!1),r!==iV.Z_STREAM_END&&r!==iV.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==iV.Z_STREAM_END&&(0!==s.avail_in||n!==iV.Z_FINISH&&n!==iV.Z_SYNC_FLUSH)||("string"===this.options.to?(i=nV.utf8border(s.output,s.next_out),o=s.next_out-i,a=nV.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&rV.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(rV.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&r!==iV.Z_STREAM_END);return r===iV.Z_STREAM_END&&(n=iV.Z_FINISH),n===iV.Z_FINISH?(r=tV.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===iV.Z_OK):n!==iV.Z_SYNC_FLUSH||(this.onEnd(iV.Z_OK),s.avail_out=0,!0)},uV.prototype.onData=function(e){this.chunks.push(e)},uV.prototype.onEnd=function(e){e===iV.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=rV.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},uU.Inflate=uV,uU.inflate=dV,uU.inflateRaw=function(e,t){return(t=t||{}).raw=!0,dV(e,t)},uU.ungzip=dV;var lV={};(0,KM.assign)(lV,XM,uU,eV);var hV=Er(lV),pV=1,fV=function(){function e(t){of(this,e),af(this,"lockingPromise",qS.resolve()),af(this,"locks",0),af(this,"name",""),af(this,"lockId",void 0),this.lockId=pV++,t&&(this.name=t)}return nf(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t=this;this.locks+=1;var r=new qS((function(r){e=function(){t.locks-=1,r()}})),n=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),n}}]),e}(),vV="VERTC",_V=function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},mV=function(){function e(t){of(this,e),af(this,"storeName",void 0),af(this,"pendingList",[]),this.storeName=t,!aM()&&_V()&&this._checkAndCreateStore(t)}var t,r,n,i,o,a,s;return nf(e,[{key:"_checkAndCreateStore",value:(s=HS(BS().mark((function t(r,n){var i,o,a=this;return BS().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e._promiseLock.lock();case 2:if(i=t.sent,!_V.databases){t.next=6;break}return t.next=6,new qS((function(e){var t=function(){return _V.databases().finally(e)};o=setInterval(t,100),t()})).finally((function(){return clearInterval(o)}));case 6:return t.abrupt("return",new qS((function(t){e.db&&(e.db.close(),delete e.db);var o=n?_V().open(vV,n):_V().open(vV);o.onupgradeneeded=function(){o.result.createObjectStore(r)},o.onerror=function(){console.error("IndexedDBInterface error",o.error)},o.onsuccess=function(){var n=o.result;e.db=n;try{e.db.transaction(a.storeName,"readonly"),a.pendingList.forEach(function(){var e=HS(BS().mark((function e(t){var r,n,i,o;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.txMode,n=t.pendResolve,i=t.pendReject,e.prev=1,e.next=4,a._getStore(r);case 4:o=e.sent,n(o),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),i();case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()),t()}catch(e){t(a._checkAndCreateStore(r,n.version+1))}finally{i()}}})));case 7:case"end":return t.stop()}}),t)}))),function(e,t){return s.apply(this,arguments)})},{key:"_getStore",value:(a=HS(BS().mark((function t(r){var n,i=this;return BS().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e._promiseLock.lock();case 2:return n=t.sent,t.abrupt("return",new qS((function(t,o){if(!e.db)return i.pendingList.push({txMode:r,pendResolve:t,pendReject:o}),void n();try{t(e.db.transaction(i.storeName,r).objectStore(i.storeName))}catch(e){return void i.pendingList.push({txMode:r,pendResolve:t,pendReject:o})}finally{n()}})));case 4:case"end":return t.stop()}}),t)}))),function(e){return a.apply(this,arguments)})},{key:"put2String",value:(o=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{n=ZS(t)}catch(e){n=t}return e.next=3,this.put(n,r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"get4String",value:(i=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.get(t);case 2:r=e.sent;try{n=JSON.parse(r)}catch(e){n=r}return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"put",value:(n=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readwrite");case 2:return n=e.sent,e.abrupt("return",new qS((function(e,i){var o=n.put(t,r);o.onsuccess=function(){e()},o.onerror=function(e){i(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"get",value:(r=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readonly");case 2:return r=e.sent,e.abrupt("return",new qS((function(e,n){var i=r.get(t);i.onsuccess=function(){e(i.result)},i.onerror=function(e){n(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"del",value:(t=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readwrite");case 2:return r=e.sent,e.abrupt("return",new qS((function(e,n){var i=r.delete(t);i.onsuccess=function(){e()},i.onerror=function(e){n(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();function gV(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=sk(e);for(n=0;n<o.length;n++)r=o[n],JC(t).call(t,r)>=0||(i[r]=e[r]);return i}(e,t);if(qA){var o=qA(e);for(n=0;n<o.length;n++)r=o[n],JC(t).call(t,r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}af(mV,"db",void 0),af(mV,"state","init"),af(mV,"_promiseLock",new fV("iDB"));var yV=["message"];var SV,bV,EV,kV=function(){function e(){of(this,e),af(this,"name","LongStringReportor"),af(this,"inBuffer",[]),af(this,"outBuffer",[])}return nf(e,[{key:"push",value:function(e){var t;e.message&&this.inBuffer.push(ux(ux({},e),{},{message:{id:LC(t=sM()).call(t,0,3),index:0,end:!0,msg:e.message}}))}},{key:"splice",value:function(e){for(var t=[],r=0;this.outBuffer.length;){var n=ZS(this.outBuffer[0]).length;if(!(n<e))break;e-=n,r+=n,t.push(this.outBuffer.shift())}for(;this.inBuffer[0]&&e>0;){var i=this.inBuffer[0],o=i.message,a=ux(ux({},gV(i,yV)),{},{message:ux(ux({},o),{},{msg:""})}),s=ZS(a).length,c=e-s,u=ux({},a);if(c>o.msg.length)u.message.msg=o.msg,this.inBuffer.shift();else{if(!(c>=10))break;var d,l,h=LC(d=o.msg).call(d,0,c);u.message.msg=h,u.message.end=!1,this.inBuffer[0].message.msg=LC(l=o.msg).call(l,c),this.inBuffer[0].message.index++}var p=ZS(u.message),f=p.length;e-=f+s,r+=f+s,t.push(ux(ux({},u),{},{message:p}))}return{payload:t,payloadSize:r}}},{key:"unshift",value:function(e){this.outBuffer=JS(e).call(e,this.outBuffer)}},{key:"get",value:function(){var e,t;return JS(e=[]).call(e,jw(this.outBuffer),jw(ob(t=this.inBuffer).call(t,(function(e){return ux(ux({},e),{},{message:ZS(e.message)})}))))}},{key:"set",value:function(e){var t=this,r=[],n=[];e.forEach((function(e){!function(e){return void 0!==e.report_id}(e)?(e.message||(e.message=""),t.inBuffer.push(ux(ux({},e),{},{message:JSON.parse(e.message)}))):t.outBuffer.push(e)})),this.outBuffer=JS(r).call(r,this.outBuffer),this.inBuffer=JS(n).call(n,this.inBuffer)}},{key:"isEmpty",value:function(){return 0===this.inBuffer.length&&0===this.outBuffer.length}}]),e}(),TV=new kV,IV={product_line:"rtc",report_version:"5",os:"web",user_agent:aM()?"":null===(SV=navigator)||void 0===SV?void 0:SV.userAgent,platform:"web",product:"webrtc",app_state:"active"},RV="LogReportor",CV="undefined"!=typeof window&&(vE(bV=window.location.search).call(bV,"_rtc_debug_")||(null===(EV=window.localStorage)||void 0===EV?void 0:EV.getItem("_rtc_debug_"))),wV=function(){function e(t){of(this,e),af(this,"_buffer",void 0),this._buffer=new mV(t)}var t,r;return nf(e,[{key:"set",value:(r=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._buffer.put2String(t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"get",value:(t=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[],e.prev=1,e.next=4,this._buffer.get4String(t);case 4:n=e.sent,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:return e.abrupt("return",null!==(r=n)&&void 0!==r?r:[]);case 10:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e){return t.apply(this,arguments)})}]),e}(),AV=function(){function e(){var t=this;of(this,e),af(this,"reportCommon",IV),af(this,"reportIds",new DR),af(this,"dataBuffer",[]),af(this,"reportorList",[]),af(this,"dbBuffer",void 0),af(this,"posting",!1),af(this,"sucSendTimer",void 0),af(this,"preSucTime",0),af(this,"errSendTimer",void 0),af(this,"errSendDelay",100),af(this,"_logServerUrl",void 0),af(this,"_retryCount",0),af(this,"_reportLimit",5e5),af(this,"_disableTimeout",!1),aM()||(window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(void 0,!0)})),document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?t.setCommonStats({app_state:"active"}):"hidden"===document.visibilityState&&t.setCommonStats({app_state:"background"})})),CV&&(window.__rtc_debug_reportor__=this)),AM.on("UPLOAD_REPORT_LIMIT",(function(e){t.setReportLimit(e)})),AM.on("ENABLE_REPORT_IDB_BUFFER",(function(e){e&&t.enableIndexedDBBuffer()})),setTimeout((function(){t.reportorList.push(oF),t.reportorList.push(TV)}))}var t;return nf(e,[{key:"setUrl",value:function(e){this._logServerUrl=e}},{key:"setCommonStats",value:function(e){this.reportCommon=QR(this.reportCommon,e)}},{key:"getCommonStats",value:function(){return this.reportCommon}},{key:"setReportLimit",value:function(e){this._reportLimit=Math.max(e,5e4),this._reportLimit=Math.min(e,5e5)}},{key:"getReportId",value:function(e){var t;e=null!==(t=e)&&void 0!==t?t:"__global__",this.reportIds.has(e)||this.reportIds.set(e,0);var r=this.reportIds.get(e);return void 0===r&&(jV("no reportId in reportId map with engine-session-id ".concat(e),0,{}),r=0),this.reportIds.set(e,r+1),r}},{key:"push",value:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])this.send(e);else{var t,r=null!==(t=e.engine_session_id)&&void 0!==t?t:"__global__";this.reportIds.has(r)||this.reportIds.set(r,0),this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send())}}},{key:"enableIndexedDBBuffer",value:function(){var e=this;this.dbBuffer||(this.dbBuffer=new wV("ReportorDBBuffer"),this.dbBuffer.get(RV).then((function(t){t.forEach((function(t){e.push(t)}))})),this.reportorList.forEach((function(t){var r;null===(r=e.dbBuffer)||void 0===r||r.get(t.name).then((function(e){t.set(e)}))})))}},{key:"backup",value:function(){var e=this;try{var t;null===(t=this.dbBuffer)||void 0===t||t.set(jw(this.dataBuffer),RV),this.reportorList.forEach((function(t){var r;null===(r=e.dbBuffer)||void 0===r||r.set(jw(t.get()),t.name)}))}catch(e){jV("Error when save log into IDB",-1,e)}}},{key:"unshift",value:function(e){var t;this.dataBuffer=JS(t=e[0]).call(t,this.dataBuffer),this.reportorList.forEach((function(t,r){var n;t.unshift(null!==(n=e[r+1])&&void 0!==n?n:[])}))}},{key:"_splice",value:function(){var e,t=this,r=function(e,t){for(var r=0,n=0;n<e.length;n++)if((r+=ZS(e[n]).length)>t)return n;return e.length}(this.dataBuffer,this._reportLimit);0===r&&this.dataBuffer.length>0&&(this._reportLimit=ZS(this.dataBuffer[0]).length+10,r=1,jV("update report limit to ".concat(this._reportLimit),0,null));var n=mw(e=this.dataBuffer).call(e,0,r),i=ZS(n).length,o=[n],a=this._reportLimit-i;return this.reportorList.forEach((function(e){var r=mw(e).call(e,a),n=r.payload,i=r.payloadSize;n.forEach((function(e){var r,n,i;void 0===e.report_id&&(e.report_id=t.getReportId(e.engine_session_id),!aM()&&window.__onRTCReport&&(null===(r=(n=window).__onRTCReport)||void 0===r||r.call(n,null!==(i=e.engine_session_id)&&void 0!==i?i:"global",e,t.getCommonStats())))})),o.push(n),a-=i})),o}},{key:"send",value:(t=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.backup(),i=wE(n=this.reportorList).call(n,(function(e,t){return e&&t.isEmpty()}),!0),(t||this.dataBuffer.length||!i)&&this._logServerUrl){e.next=4;break}return e.abrupt("return");case 4:if(t||(this.posting=!0),o=[],t||(o=this._splice()),a=CV,s={data:t||WM(o).call(o),header:ux(ux({},this.reportCommon),{},{http_retry_count:this._retryCount}),from:"web",os:"web",version:"1"},c={method:"POST",body:a?ZS(s):hV.gzip(ZS(s))},!this._disableTimeout)try{u=new AbortController,c.signal=u.signal,setTimeout((function(){u.abort()}),1e4)}catch(e){console.warn("AbortController is not supported"),this._disableTimeout=!0}return a||(c.headers={"Content-Encoding":"gzip","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}),h=null,e.prev=13,e.next=16,fetch(this._logServerUrl,c);case 16:if(200!==(d=e.sent).status&&304!==d.status){e.next=23;break}return e.t0=JSON,e.next=21,d.text();case 21:e.t1=e.sent,h=e.t0.parse.call(e.t0,e.t1);case 23:e.next=28;break;case 25:e.prev=25,e.t2=e.catch(13),l=e.t2;case 28:t||(this.posting=!1),h&&0===h.StatusCode?t||r||this.sucSend():(setTimeout((function(){var e,t,r,n;jV(JS(e="reportor post error, resJSON:".concat(null===(t=h)||void 0===t?void 0:t.toString()," err:")).call(e,l),null!==(r=null===(n=d)||void 0===n?void 0:n.status)&&void 0!==r?r:-1,l)}),0),t?this.send(t):(this.unshift(o),r?this.send():this.errSend()));case 30:case"end":return e.stop()}}),e,this,[[13,25]])}))),function(e,r){return t.apply(this,arguments)})},{key:"sucSend",value:function(){this.errSendDelay=100,this._retryCount=0,this.preSucTime=Date.now(),this.sucSendTimer=window.setTimeout(this.send.bind(this),2e3)}},{key:"errSend",value:function(){var e=this;this.errSendTimer=window.setTimeout((function(){e.send(),delete e.errSendTimer}),this.errSendDelay),this.errSendDelay*=2,this._retryCount++}}]),e}();var xV=new AV,OV=function(){function e(t){of(this,e),af(this,"modifyIds",{pre_connection:!1}),this.id=t}return nf(e,[{key:"report",value:function(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=ux(ux(ux({event_key:e,rtc_timestamp:Date.now()},this.modifyIds),t),{},{common_extra_info:ZS(i),report_id:xV.getReportId(this.modifyIds.engine_session_id)});!aM()&&window.__onRTCReport&&(null===(r=(n=window).__onRTCReport)||void 0===r||r.call(n,this.modifyIds.engine_session_id,o,xV.getCommonStats())),xV.push(o)}},{key:"reportLog",value:function(e){var t=ux(ux({event_key:"rtc_invoke_status",sdk_api_name:"console_log",rtc_timestamp:Date.now()},this.modifyIds),{},{message:e});oF.push(t)}},{key:"reportLongString",value:function(e,t){var r=ux(ux({event_key:"rtc_invoke_status",sdk_api_name:"sdk_long_string_".concat(e),rtc_timestamp:Date.now()},this.modifyIds),{},{message:t});TV.push(r)}},{key:"set",value:function(e){this.modifyIds=QR(this.modifyIds,e)}},{key:"destroy",value:function(){}}]),e}(),PV=function(){function e(t){of(this,e),af(this,"_preTime",Date.now()),af(this,"_one2oneNum",0),af(this,"_one2manyNum",0),af(this,"_one2oneMsgCache",new DR),af(this,"_one2manyMsgCache",new DR),af(this,"roomId",""),af(this,"userId",""),af(this,"rtsSessionId",""),af(this,"logger",void 0),af(this,"serverUrl","server"),this.id=t,this.logger=new dF("MessageReportor",1)}return nf(e,[{key:"needReport",value:function(t){return!!e.config&&(Date.now()-this._preTime>=36e5&&(this._preTime=Date.now(),this._one2oneNum=0,this._one2manyNum=0),"one2one"===t&&this._one2oneNum<e.config.max_one2one_fpt_per_hour&&Math.random()<=e.config.one2one_fpt_ratio/100||"one2many"===t&&this._one2manyNum<e.config.max_one2many_fpt_per_hour&&Math.random()<=e.config.one2many_fpt_ratio/100)}},{key:"cacheP2PMsg",value:function(t){var r;this._one2oneMsgCache.set(t.msg_id,ux({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateP2PMsg",value:function(e,t){var r=this._one2oneMsgCache.get(e);r&&this._one2oneMsgCache.set(e,ux(ux({},r),t))}},{key:"cacheCustomMsg",value:function(t){var r;this._one2manyMsgCache.set(t.msg_id,ux({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateOne2ManyMsg",value:function(e,t){var r=this._one2manyMsgCache.get(e);r&&this._one2manyMsgCache.set(e,ux(ux({},r),t))}},{key:"reportP2PMsg",value:function(e){var t,r=this._one2oneMsgCache.get(e);r&&(this.logger.info("reportP2PMsg",r.type,ZS(r)),null===(t=GV(this.id))||void 0===t||t.report("rts_message",r))}},{key:"reportOne2ManyMsg",value:function(e){var t,r=this._one2manyMsgCache.get(e);r&&(this.logger.info("reportOne2ManyMsg",r.type,ZS(r)),null===(t=GV(this.id))||void 0===t||t.report("rts_message",r))}},{key:"reportMsgRecv",value:function(t){var r,n;t.config_version=(null===(r=e.config)||void 0===r?void 0:r.version)||"",this.logger.info("reportMsgRecv",t.type,ZS(t)),null===(n=GV(this.id))||void 0===n||n.report("rts_message",t)}},{key:"destroy",value:function(){this._one2manyNum=0,this._one2oneNum=0,this._one2manyMsgCache.clear(),this._one2oneMsgCache.clear(),this._preTime=Date.now(),this.roomId="",this.userId="",this.rtsSessionId=""}}]),e}();af(PV,"config",void 0);var NV=new DR,MV={_cache:NV,setServerUrl:function(e,t){var r=NV.get(e);r&&(r.serverUrl=t)},setConfig:function(e){new dF("MessageReportor",1).info("setConfig","get config: ".concat(ZS(e))),PV.config=e},setRtsSessionId:function(e,t){var r=NV.get(e);r&&(r.rtsSessionId=t)},createRTSMsgReportor:function(e){var t=NV.get(e)||new PV(e);return NV.set(e,t),t},destroyRTSMsgReportor:function(e){var t=NV.get(e);t&&(t.destroy(),NV.delete(e))},setRoomId:function(e,t){var r=NV.get(e);r&&(r.roomId=t||"")},setUserId:function(e,t){var r=NV.get(e);r&&(r.userId=t||"")},samplingP2PMsg:function(e,t){var r=NV.get(e);if(null!=r&&r.needReport("one2one")){var n=t.to?"one2one":"one2server";t.enable_report=!0,t.report_msg_id=t.id,r.cacheP2PMsg({rts_session_id:r.rtsSessionId,msg_id:"".concat(t.id),node_role:"src_sdk",from:t.from,to:t.to||r.serverUrl,msg_type:n,type:n,rts_room_id:t.room,req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0,error_code:0,recv_msg_ts:0,fwd_msg_ts:0,reply_ack_ts:0,cur_dst_uid:""})}return t},updateP2PMsgReq:function(e,t,r){var n;t.enable_report&&cM(t.report_msg_id)&&(null===(n=NV.get(e))||void 0===n||n.updateP2PMsg("".concat(t.report_msg_id),{send_ts:Date.now(),msg_size:r}))},updateP2PMsgAck:function(e,t,r){if(t.enable_report&&cM(t.report_msg_id)){var n=NV.get(e);null==n||n.updateP2PMsg("".concat(t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==n||n.reportP2PMsg("".concat(t.report_msg_id))}},samplingOne2ManyMsg:function(e,t,r){var n=NV.get(e);return null!=n&&n.needReport("one2many")&&(r.enable_report=!0,r.report_msg_id=t,n.cacheCustomMsg({rts_session_id:n.rtsSessionId,msg_id:"".concat(t),node_role:"src_sdk",from:r.clientId,to:n.roomId||r.roomId,msg_type:"one2many",type:"one2many",rts_room_id:n.roomId,req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0,error_code:0,recv_msg_ts:0,fwd_msg_ts:0,reply_ack_ts:0,cur_dst_uid:""})),r},reportP2PMsgRecv:function(e,t,r){if(t.enable_report&&cM(t.report_msg_id)){var n=NV.get(e),i=t.to?"one2one":"one2many";null==n||n.reportMsgRecv({rts_session_id:n.rtsSessionId,msg_id:"".concat(t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:i,type:i,rts_room_id:t.room,from:t.from,to:t.to||t.room,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:t.to?"":n.userId,config_version:"",req_ts:0,send_ts:0,ack_ts:0})}},updateOne2ManyMsgAck:function(e,t,r){if(t.enable_report&&cM(t.report_msg_id)){var n=NV.get(e);n&&(null==n||n.updateOne2ManyMsg("".concat(t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==n||n.reportOne2ManyMsg("".concat(t.report_msg_id)))}},updateOne2ManyMsgReq:function(e,t,r){if(t.enable_report&&cM(t.report_msg_id)){var n=NV.get(e);n&&n.updateOne2ManyMsg("".concat(t.report_msg_id),{send_ts:Date.now(),msg_size:r})}},reportOne2ManyMsgRecv:function(e,t,r){if(t.enable_report&&cM(t.report_msg_id)){var n=NV.get(e);null==n||n.reportMsgRecv({rts_session_id:n.rtsSessionId,msg_id:"".concat(t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:"one2many",type:"one2many",rts_room_id:t.roomId,from:t.clientId,to:t.roomId,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:n.userId,config_version:"",req_ts:0,send_ts:0,ack_ts:0})}}},DV=function(){function e(t){of(this,e),af(this,"_timer",void 0),af(this,"userMessage",{}),af(this,"roomMessage",{}),this.id=t,this._setTimer()}return nf(e,[{key:"_setTimer",value:function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()}},{key:"_reportAndgReset",value:function(){(ck(this.userMessage).length||ck(this.roomMessage).length)&&(this._report(),this._reset())}},{key:"_report",value:function(){var e,t,r,n=this;null===(e=GV(this.id))||void 0===e||e.report("rtc_message_statistics",{dc_user_message:ob(t=ck(this.userMessage)).call(t,(function(e){return n.userMessage[e]})),dc_room_message:ob(r=ck(this.roomMessage)).call(r,(function(e){return n.roomMessage[e]})),media_server_ip:""})}},{key:"_reset",value:function(){this.userMessage={},this.roomMessage={}}},{key:"_checkInitUserMessage",value:function(e,t){var r,n;this.userMessage[JS(r="".concat(t,"-")).call(r,e)]||(this.userMessage[JS(n="".concat(t,"-")).call(n,e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_fail_timeout:0,dc_fail_no_receiver:0,dc_fail_no_relay_path:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:Number(1/0),dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})}},{key:"_sendUserMessage",value:function(e,t,r){var n,i;this._checkInitUserMessage(e,t),this.userMessage[JS(n="".concat(t,"-")).call(n,e)].dc_send_total++,r&&this.userMessage[JS(i="".concat(t,"-")).call(i,e)].dc_send_binary++}},{key:"_recvUserMessage",value:function(e,t){var r;this._checkInitUserMessage(e,t),this.userMessage[JS(r="".concat(t,"-")).call(r,e)].dc_recv_total++}},{key:"_sendUserFail",value:function(e,t,r){var n,i=this.userMessage[JS(n="".concat(t,"-")).call(n,e)];i&&(i.dc_send_fail++,this._handleUserFail(i,r))}},{key:"_handleUserFail",value:function(e,t){var r;t&&(t.code||t.err)&&(vE(r=["TIME_OUT","USER_MESSAGE_TIMEOUT"]).call(r,t.code)?e.dc_fail_timeout++:3===t.err?e.dc_fail_no_receiver++:4===t.err?e.dc_fail_no_relay_path++:1===t.err&&e.dc_fail_timeout++)}},{key:"_sendUserAck",value:function(e,t,r,n,i){var o,a=this.userMessage[JS(o="".concat(t,"-")).call(o,e)];a&&(a.dc_send_ack++,a.dc_cost_time+=r,a.dc_cost_s2s+=n||0,a.dc_cost_peer_s2e+=i,a.dc_cost_e2s+=r-(n||0)-i,r/2<=100?(a.dc_send_ack_100++,a.dc_send_ack_200++,a.dc_send_ack_400++,a.dc_send_ack_1s++):r/2<=200?(a.dc_send_ack_200++,a.dc_send_ack_400++,a.dc_send_ack_1s++):r/2<=400?(a.dc_send_ack_400++,a.dc_send_ack_1s++):r/2<=1e3&&a.dc_send_ack_1s++,r<a.dc_least_time&&(a.dc_least_time=r),r>a.dc_most_time&&(a.dc_most_time=r))}},{key:"sendRoomMessage",value:function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:Number(1/0),dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++}},{key:"sendRoomFail",value:function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++}},{key:"sendRoomAck",value:function(e,t){var r=this.roomMessage[e];r&&(r.dc_send_ack++,r.dc_cost_time+=t,t<r.dc_least_time&&(r.dc_least_time=t),t>r.dc_most_time&&(r.dc_most_time=t),t/2<=100?(r.dc_send_ack_100++,r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t/2<=200?(r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t/2<=400?(r.dc_send_ack_400++,r.dc_send_ack_1s++):t/2<=1e3&&r.dc_send_ack_1s++)}},{key:"sendP2PMessage",value:function(e,t){this._sendUserMessage(e,"p2p",t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,"p2p")}},{key:"sendP2PFail",value:function(e,t){this._sendUserFail(e,"p2p",t)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,"p2p",t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,"p2p_outside_room",t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,"p2p_outside_room")}},{key:"sendP2POutRoomFail",value:function(e,t){this._sendUserFail(e,"p2p_outside_room",t)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,"p2p_outside_room",t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("","p2server",e)}},{key:"sendP2serverFail",value:function(e){this._sendUserFail("","p2server",e)}},{key:"sendP2serveAck",value:function(e,t,r){this._sendUserAck("","p2server",e,t,r)}},{key:"countP2PMessage",value:function(e,t,r,n,i){this.sendP2PMessage(t,r),e?this.sendP2PAck(t,Date.now()-n,i.s2s_time||0,i.s2e_time||0):this.sendP2PFail(t,i)}},{key:"countRoomMessage",value:function(e,t,r,n){this.sendRoomMessage(t,r),e?this.sendRoomAck(t,Date.now()-n):this.sendRoomFail(t)}},{key:"countUserMessageOutsideRoom",value:function(e,t,r,n,i){this.sendP2POutRoomMessage(t,r),e?this.sendP2POutRoomAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2POutRoomFail(t,i)}},{key:"countServerMessage",value:function(e,t,r,n){this.sendP2serverMessage(t),e?(n=n||{},this.sendP2serveAck(Date.now()-r,n.s2s_time||0,n.s2e_time||0)):this.sendP2serverFail(n)}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),LV=function(e){xV.setCommonStats(e)},UV=function(e){xV.setUrl(e)},VV=new OV("global"),FV=function(e,t,r){VV.report("rtc_sdk_api_call",{sdk_api_name:e,error_code:t,message:r})},BV=function(e,t,r){VV.report("rtc_sdk_callback",{sdk_callback_name:e,error_code:t,message:r})},jV=function(e,t,r){VV.report("rtc_error",{message:e,error_code:t},r)},HV=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4?arguments[4]:void 0;VV.report("rtc_invoke_status",{sdk_api_name:e,message:t,error_code:r,stream_id:n,elapse:0},i)};var zV=new DR,GV=function(e){return zV.get(e)},WV=function(e,t){var r=new OV(e);return r.set(ux(ux({},t),{},{engine_session_id:sM()})),r.report("sdk_init_engine",{start:Date.now(),type:"begin"}),zV.set(e,r),r};function KV(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e,r,n){if("function"==typeof n.value){var i=n.value;n.value=function(){for(var e,n,o,a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];var u,d,l,h=this.engineId||this.id,p={};t.forEach((function(e,t){p[e]=s[t]})),"joinRoom"===r&&(null===(u=GV(h))||void 0===u||u.set({room_id:s[1],user_id:null===(d=s[2])||void 0===d?void 0:d.userId})),null===(e=GV(h))||void 0===e||e.report("rtc_sdk_api_call",{sdk_api_name:r,message:ZS(QV(s)),error_code:0},p);try{l=i.apply(this,s)}catch(e){throw JV(h,r,e.message,e.code||-1),e}return"function"==typeof(null===(n=l)||void 0===n?void 0:n.then)?l.then((function(e){return JV(h,r,[null!=e?e:{}]),e})).catch((function(e){throw JV(h,r,e.message,e.code),e})):(JV(h,r,[null!==(o=l)&&void 0!==o?o:{}]),l)}}}}var XV,JV=function(e,t,r){var n,i=arguments.length>4?arguments[4]:void 0,o={sdk_callback_name:t,error_code:arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,message:ZS(Array.isArray(r)?QV(r):r)};i&&(o.room_id=i),null===(n=GV(e))||void 0===n||n.report("rtc_sdk_callback",o)},qV=function(e,t,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",a=arguments.length>5?arguments[5]:void 0;null===(n=GV(e))||void 0===n||n.report("rtc_invoke_status",{sdk_api_name:t,message:r,error_code:i,stream_id:o,elapse:0},a)},YV=10;function QV(e){return ob(e).call(e,(function e(t){var r;if(null!=t&&t._reportName)return t._reportName;if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var n,i,o=ArrayBuffer.isView(t)?t.buffer:t,a=o.byteLength,s=[];if(a>YV){var c,u,d,l,h,p=new DataView(o),f=ob(c=CN({length:YV/2})).call(c,(function(e,t){return p.getUint8(t)})),v=ob(u=wN(d=ob(l=CN({length:YV/2})).call(l,(function(e,t){return a-1-t}))).call(d)).call(u,(function(e){return p.getUint8(e)}));s=JS(h=[]).call(h,jw(f),["..."],jw(v))}else s=CN(new Uint8Array(o));return JS(n=JS(i="".concat(t.constructor.name,"(")).call(i,a,") [")).call(n,s.join(", "),"]")}if(t instanceof ImageData)return"ImageData";if(Array.isArray(t))return ob(t).call(t,e);if(vE(r=["[object Object]","[object MediaStreamTrack]"]).call(r,Object.prototype.toString.call(t))){var _={};for(var m in t)_[m]=e(t[m]);return _}return t}))}var ZV="undefined"!=typeof window&&vE(XV=window.location.search).call(XV,"_rtc_upload_console_"),$V=function(){function e(){var t=this;of(this,e),af(this,"name","ConsoleReportor"),af(this,"_uuid","".concat(Math.floor(899*Math.random())+100)),af(this,"_consoleReportId",0),af(this,"_engineReportIdMap",new DR),af(this,"_enabled","NULL"),af(this,"_consoleCutLength",AM.getParameter("UPLOAD_CONSOLE_LENGTH_CUT")),af(this,"buffer",[]),ZV&&setTimeout((function(){t.switchOn()}),0),AM.on("UPLOAD_CONSOLE_ON",(function(e){e?t.switchOn():t.turnOff()})),AM.on("UPLOAD_CONSOLE_LENGTH_CUT",(function(e){t._consoleCutLength=e}))}return nf(e,[{key:"enabled",get:function(){return"OFF"!==this._enabled}},{key:"switchOn",value:function(){"NULL"===this._enabled&&(console.log("[LoggerReportor.constructor] console upload switch ON"),this._enabled="ON")}},{key:"turnOff",value:function(){"NULL"===this._enabled&&(console.log("[LoggerReportor.constructor] console upload switch OFF"),this._enabled="OFF",this.buffer=[])}},{key:"getEngineConsoleId",value:function(e){var t,r=null!==(t=this._engineReportIdMap.get(e))&&void 0!==t?t:0;return this._engineReportIdMap.set(e,r+1),r}},{key:"report",value:function(e,t,r,n,i,o,a,s,c){var u,d,l,h,p,f,v,_,m,g,y,S=this;if("OFF"!==this._enabled){var b=GV(t),E=this._consoleReportId++,k=this.getEngineConsoleId(t),T=eF(c,this._consoleCutLength),I=jw(c),R="".concat(s).replace(/%o|%s/gi,(function(){return eF([I.shift()],S._consoleCutLength)})),C=JS(u=JS(d=JS(l=JS(h=JS(p=JS(f=JS(v=JS(_=JS(m=JS(g=JS(y="[".concat(this._uuid,"-")).call(y,E,"][")).call(g,t,"-")).call(m,k,"]-")).call(_,r,"-")).call(v,e,"[")).call(f,n,"]")).call(p,i,"[")).call(h,o,".")).call(l,a,"] ")).call(d,R," ")).call(u,T);b?b.reportLog(C):function(e){VV.reportLog(e)}(C)}}},{key:"push",value:function(e){"OFF"!==this._enabled&&this.buffer.push(e)}},{key:"splice",value:function(e){var t;if("ON"!==this._enabled)return{payload:[],payloadSize:0};var r=function(e,t){for(var r=0,n=0;n<e.length;n++){var i=ZS(e[n]).length;if((r+=i)>t)return{index:n,size:r-i}}return{index:e.length,size:r}}(this.buffer,e),n=r.index,i=r.size;return{payload:mw(t=this.buffer).call(t,0,n),payloadSize:i}}},{key:"unshift",value:function(e){this.buffer=JS(e).call(e,this.buffer)}},{key:"get",value:function(){return this.buffer}},{key:"set",value:function(e){this.buffer=JS(e).call(e,this.buffer)}},{key:"isEmpty",value:function(){return"OFF"===this._enabled||0===this.buffer.length}}]),e}();function eF(e,t){return ob(e).call(e,(function(e){var r="";try{if("string"==typeof e)return e;if(void 0===e)return"undefined";if(null===e)return"null";if(e instanceof MediaStreamTrack)return dM(e);if(e instanceof MediaStream)return lM(e);if(e instanceof RTCRtpSender)return hM(e);if(e instanceof RTCRtpReceiver)return pM(e);if(e instanceof RTCRtpTransceiver)return fM(e);r=ZS(e)}catch(t){r=e.toString()}return r&&r.length>=t&&(r=LC(r).call(r,0,t)),r})).join(", ")}var tF,rF,nF,iF,oF=new $V,aF="[VERTC]",sF="#0050b3",cF=(af(tF={},"DEBUG","rgba(0, 0, 0, 0)"),af(tF," INFO","rgba(93, 173, 226, 0)"),af(tF," WARN","rgba(255, 119, 0, 0.3)"),af(tF,"ERROR","rgba(255, 0, 0, 0.3)"),af(tF," SUCC","rgba(0, 119, 0, 0.3)"),tF),uF="undefined"!=typeof window&&(vE(rF=window.location.search).call(rF,"_rtc_debug_")||(null===(nF=window.localStorage)||void 0===nF?void 0:nF.getItem("_rtc_debug_"))),dF=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"global";of(this,e),af(this,"indent",void 0),af(this,"module",void 0),af(this,"_engineId",void 0),this.module=t,this.indent=r,this._engineId=n}return nf(e,[{key:"_print",value:function(e,t){for(var r,n,i,o,a,s,c,u,d=arguments.length,l=new Array(d>2?d-2:0),h=2;h<d;h++)l[h-2]=arguments[h];var p=l.shift();try{var f,v,_,m,g=JS(f=[]).call(f,l),y="".concat(p).replace(/%o/gi,(function(){var e=g.shift();return ZS(e)}));gM.set(JS(v=JS(_=JS(m="".concat(aF,"[").concat(this.module,".")).call(m,t,"] ")).call(_,y," ")).call(v,ob(g).call(g,(function(e){return ZS(e)})).join(", ")))}catch(e){}for(var S="",b=0;b<this.indent;b++)S+=" ";var E=lF();oF.report(aF,this._engineId,E,e,S,this.module,t,p,l),uF&&(r=console).log.apply(r,JS(n=[JS(i=JS(o=JS(a=JS(s=JS(c=JS(u="%c".concat(E,"-")).call(u,aF,"%c[")).call(c,e,"]%c")).call(s,S,"[")).call(a,this.module,".")).call(o,t,"] ")).call(i,p),"color:".concat(sF,";"),"background-color:".concat(cF[e],";"),"color:".concat(sF,";")]).call(n,l))}},{key:"print",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._print.apply(this,JS(t=[" INFO",e]).call(t,n))}},{key:"debug",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._print.apply(this,JS(t=["DEBUG",e]).call(t,n))}},{key:"info",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._print.apply(this,JS(t=[" INFO",e]).call(t,n))}},{key:"warn",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._print.apply(this,JS(t=[" WARN",e]).call(t,n))}},{key:"error",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._print.apply(this,JS(t=["ERROR",e]).call(t,n))}},{key:"success",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._print.apply(this,JS(t=[" SUCC",e]).call(t,n))}}]),e}(),lF=function(){var e,t,r=new Date;return JS(e="".concat(r.toTimeString().split(" ")[0],":")).call(e,IM(t=r.getMilliseconds().toString()).call(t,3,"0"))},hF=function(e){var t,r=GV(e.engineId),n={keys:ZN(e),labelSelector:"",sdkVersion:e.sdkVersion,deviceType:"web",appId:e.appId,deviceId:e.deviceId},i=ob(t=e.requestDomains).call(t,(function(e){return"https://".concat(e,"/decision/v1/multi")}));null==r||r.report("rtc_get_config",{error_code:0,message:ZS(n),elapse:0,host:i.join(","),type:"request",config_id:"",enable_cloud_proxy:!1});var o=ob(i).call(i,function(){var e=HS(BS().mark((function e(t,r){var i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t,{method:"POST",body:ZS(n)}).then((function(e){return e.json()}));case 2:return i=e.sent,e.abrupt("return",{result:i,index:r});case 4:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}());return new qS((function(e){(function(e){return new qS((function(t,r){var n=(e=Array.isArray(e)?e:[]).length,i=[];0===n?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){n--,i.push(e),0===n&&r(i)}))}))}))})(o).then((function(t){var n=t.result,o=t.index;null==r||r.report("rtc_get_config",{error_code:200,message:ZS(n),elapse:0,host:i[o],type:"response",config_id:"",enable_cloud_proxy:!1}),e(n)})).catch((function(e){var t;null==r||r.report("rtc_get_config",{error_code:500,message:null===(t=e[0])||void 0===t?void 0:t.message,elapse:0,host:"",type:"response",config_id:"",enable_cloud_proxy:!1})}))}))},pF=new Uint8Array(16);function fF(){if(!iF&&!(iF="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return iF(pF)}for(var vF=[],_F=0;_F<256;++_F){var mF;vF.push(LC(mF=(_F+256).toString(16)).call(mF,1))}var gF={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function yF(e,t,r){if(gF.randomUUID&&!t&&!e)return gF.randomUUID();var n=(e=e||{}).random||(e.rng||fF)();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(vF[e[t+0]]+vF[e[t+1]]+vF[e[t+2]]+vF[e[t+3]]+"-"+vF[e[t+4]]+vF[e[t+5]]+"-"+vF[e[t+6]]+vF[e[t+7]]+"-"+vF[e[t+8]]+vF[e[t+9]]+"-"+vF[e[t+10]]+vF[e[t+11]]+vF[e[t+12]]+vF[e[t+13]]+vF[e[t+14]]+vF[e[t+15]]).toLowerCase()}(n)}var SF=new TextDecoder,bF=new TextEncoder,EF=function(){return yF()},kF=function(){return Date.now()};function TF(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var o=0,a=n;o<a.length;o++)t+=a[o].length;for(var s=new e(t),c=0,u=0,d=n;u<d.length;u++){var l=d[u];s.set(l,c),c+=l.length}return s}var IF=function(){function e(){of(this,e)}var t,r;return nf(e,null,[{key:"token2auth",value:function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))}},{key:"createUnsafeToken",value:function(e,t,r){var n;return window.btoa(Wb(n=[e,t,r]).call(n,(function(e){return null!==e})).join(":"))}},{key:"merge",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,i=BE(t);n<i.length;n++){var o=xb(i[n],2),a=o[0],s=o[1];null!==s&&"object"===$p(s)?e.merge(t[a],r[a]):void 0!==r[a]&&(t[a]=r[a])}}},{key:"ab2str",value:function(e){return SF.decode(e)}},{key:"ab2obj",value:function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}}},{key:"str2ab",value:function(e){return bF.encode(e).buffer}},{key:"ab2b64str",value:(r=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new qS((function(e){var r=new FileReader;r.onload=function(){return e(r.result)},r.readAsDataURL(new Blob([t]))}));case 2:return r=e.sent,e.abrupt("return",r.split(",",2)[1]);case 4:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"b64str2ab",value:(t=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fetch("data:application/octet;base64,".concat(t)).then((function(e){return e.arrayBuffer()})).catch((function(e){var n;throw r&&r.report("rtc_error",{error_code:2001,message:JS(n="".concat(e.message," -> ")).call(n,t)}),e})));case 1:case"end":return e.stop()}}),e)}))),function(e,r){return t.apply(this,arguments)})}]),e}();function RF(){for(var e,t,r=Number(TN(e=LC(t="".concat(Math.random())).call(t,-7)).call(e,7,"0")).toString(2),n=TN(r).call(r,28,"1").split(""),i=[];n.length;)i.push(mw(n).call(n,0,7));return ob(i).call(i,(function(e,t){var r=t===i.length-1?"0":"1";return RN(r+e.join(""),2)}))}var CF,wF=function(){return Math.floor(65535*Math.random())};function AF(e){return!(128&~e)}function xF(e){return"string"==typeof e&&qC(e).call(e,"__web__rtc__rtt__")>-1}var OF=function(){var e=HS(BS().mark((function e(){var t,r,n,i=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],!CF){e.next=3;break}return e.abrupt("return",CF);case 3:return(r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),t&&(r.addTransceiver("audio",{direction:"sendonly"}),r.addTransceiver("video",{direction:"sendonly"})),e.next=10,r.createOffer();case 10:return n=e.sent,r.close(),CF=n.sdp,e.abrupt("return",n.sdp);case 14:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),PF=function(e){return new qS((function(t,r){var n=(e=Array.isArray(e)?e:[]).length,i=[];0===n?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){n--,i.push(e),0===n&&r(i)}))}))}))};function NF(e){return Number(Math.max(-127,10*PN(Math.pow(e/255,2))).toFixed(2))}function MF(e){return(e&wP.AUDIO)===wP.AUDIO}function DF(e){return(e&wP.VIDEO)===wP.VIDEO}function LF(e){var t={};return ck(e).forEach((function(r){"object"===$p(e[r])?t[r]=LF(e[r]):vP(r).call(r,"_")||(t[r]=e[r])})),t}function UF(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var r={seiCount:0,seis:[]},n=!1,i=2;i<t.byteLength;){var o=t.getUint16(i);if(i+=2,t.byteLength-i<o){n=!0;break}var a=new Uint8Array(e.buffer,i,o);if(i+=o,t.byteLength-i>0&&t.byteLength-i<=2){n=!0;break}r.seiCount++,r.seis.push(a)}return n&&(r.seiCount=1,r.seis=[e]),r}function VF(e){return void 0===e}function FF(e){return function(t,r,n){var i=n.value;n.value=function(){var t;console.warn(JS(t="[RTC WebSDK]: Api: ".concat(r," has been abandoned from version ")).call(t,e));for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return i.apply(this,o)}}}function BF(e){console.warn("[RTC WebSDK]: ".concat(e))}function jF(e){return"number"==typeof e?e:"number"==typeof(null==e?void 0:e.exact)?e.exact:"number"==typeof(null==e?void 0:e.ideal)?e.ideal:"number"==typeof(null==e?void 0:e.max)?e.max:"number"==typeof(null==e?void 0:e.min)?e.min:1}var HF,zF,GF,WF,KF,XF,JF,qF,YF=function(){function e(){of(this,e),af(this,"_id",void 0),this._id=Math.ceil(Math.random()*MN)}return nf(e,[{key:"getMessageId",value:function(){return++this._id>MN&&(this._id=0),this._id}}]),e}(),QF=function(e){return e.onTrackEnded="onTrackEnded",e.onTrackMute="onTrackMute",e.onTrackUnmute="onTrackUnmute",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onRemoteVideoFirstFrame="onRemoteVideoFirstFrame",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onRemoteAudioFirstFrame="onRemoteAudioFirstFrame",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onActiveSpeaker="onActiveSpeaker",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onTokenPublishPrivilegeWillExpire="onTokenPublishPrivilegeWillExpire",e.onTokenPublishPrivilegeDidExpired="onTokenPublishPrivilegeDidExpired",e.onTokenSubscribePrivilegeWillExpire="onTokenSubscribePrivilegeWillExpire",e.onTokenSubscribePrivilegeDidExpired="onTokenSubscribePrivilegeDidExpired",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onVideoStreamBanned="onVideoStreamBanned",e.onAudioStreamBanned="onAudioStreamBanned",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onSubtitleStateChanged="onSubtitleStateChanged",e.onSubtitleMessageReceived="onSubtitleMessageReceived",e.onServerParamsSetResult="onServerParamsSetResult",e.onLocalStreamTrackChangedByExtension="onLocalStreamTrackChangedByExtension",e.onVendorConnectionStateChanged="onVendorConnectionStateChanged",e.onForwardStreamError="onForwardStreamError",e.onRejoinWithTcp="onRejoinWithTcp",e.onIceConnectWithTcp="onIceConnectWithTcp",e.onPublishRetry="onPublishRetry",e.onSubscribeRetry="onSubscribeRetry",e.onPublishResult="onPublishResult",e.onSubscribeResult="onSubscribeResult",e.onSEIStreamUpdate="onSEIStreamUpdate",e}(QF||{}),ZF=function(){return"undefined"==typeof window},$F=ZF()?"":window.navigator.userAgent;function eB(){var e="none";return ZF()||(null!==$F.match("Firefox")?e="mozilla":null!==$F.match("Chrome")?(e="chrome-stable",null!==$F.match("Electron")&&(e="electron")):(null!==$F.match("Safari")||null!==$F.match("AppleWebKit"))&&(e="safari")),e}var tB,rB="mozilla"===eB(),nB="safari"===eB(),iB="chrome-stable"===eB(),oB=!ZF()&&/CriOS/i.test($F),aB=!ZF()&&/Edg\//i.test($F),sB=!ZF()&&/EdgA/i.test($F),cB=!ZF()&&/EdgiOS/i.test($F),uB=aB||sB||cB,dB=!ZF()&&/DingTalk/i.test(navigator.userAgent),lB=!ZF()&&/OPR\//.test(navigator.userAgent),hB=!ZF()&&(!!/(iPad)/i.exec($F)||/Macintosh/i.test($F)&&"ontouchend"in document),pB=!ZF()&&/Macintosh/i.test($F),fB=!ZF()&&/MicroMessenger/i.test($F),vB=!ZF()&&vE(HF=$F.toLowerCase()).call(HF,"mobile"),_B=!ZF()&&!!/(iPhone|iPad|iPod)/i.exec($F),mB=!ZF()&&/Android/i.test($F),gB=!ZF()&&/Windows/i.test($F),yB=0,SB="0",bB=!ZF()&&(null===(zF=$F.match(/version\/(\d+)/i))||void 0===zF?void 0:zF[1]);nB&&bB&&(yB=Number(bB),SB=null===(tB=navigator.userAgent.match(/version\/(\d+\.\d+)/i))||void 0===tB?void 0:tB[1]);var EB=!ZF()&&(null===(GF=$F.match(/Firefox\/(\d+)/i))||void 0===GF?void 0:GF[1]);rB&&EB&&(yB=Number(EB));var kB=yB,TB=yB,IB=SB,RB=null!==(WF=!ZF()&&(null===(KF=$F.match(/ ([\d_]+) like Mac OS X/i))||void 0===KF||null===(XF=KF[1])||void 0===XF?void 0:ob(JF=XF.split("_")).call(JF,(function(e){return Hk(e)}))))&&void 0!==WF?WF:[],CB=0,wB=!ZF()&&(null===(qF=$F.match(/Chrome\/(\d+)/i))||void 0===qF?void 0:qF[1]);wB&&(CB=Number(wB));var AB=CB,xB="VolcEngine",OB="RTC_DEVICE_ID",PB="RTC_ACCESS_NODE",NB="RTC_ACCESS_URLS",MB="ENGINE_WEB_CONFIG",DB="SERVER_CONFIG",LB=function(){function e(){of(this,e)}return nf(e,[{key:"get",value:function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(e){return null}}},{key:"set",value:function(e,t){var r={ttl:arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,ZS(r)),!0}catch(e){return!1}}},{key:"getTtl",value:function(e){var t=localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t).ttl}catch(e){return null}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}}}]),e}(),UB=function(){Hx(t,LB);var e=oO(t);function t(){return of(this,t),e.apply(this,arguments)}return nf(t,[{key:"getDeviceId",value:function(){if(ZF())return"";var e=this.get(OB);return e&&!/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(e)||(e=function(e){for(var t="",r=0;r<e;r++)t+=Math.floor(10*Math.random());return t}(16)),this.setDeviceId(e),e}},{key:"setDeviceId",value:function(e){return LV({device_id:e}),this.set(OB,e),e}},{key:"getAccessNode",value:function(e){var t;return this.get(JS(t="".concat(PB,"_").concat(e,"-")).call(t,xB))}},{key:"setAccessNode",value:function(e,t,r){var n;return this.set(JS(n="".concat(PB,"_").concat(e,"-")).call(n,xB),t,1e3*r)}},{key:"deleteAccessNode",value:function(e,t){var r,n=this.getAccessNode(e),i=this.getTtl(JS(r="".concat(PB,"_").concat(e,"-")).call(r,xB));Array.isArray(n)&&n.length>0&&((n=Wb(n).call(n,(function(e){return e.mediaID!==t.mediaID&&e.msgKey!==t.msgKey}))).length>0?this.setAccessNode(e,n,i||0):this.clearAccessNode(e))}},{key:"clearAccessNode",value:function(e){var t;if(e)this.delete(JS(t="".concat(PB,"_").concat(e,"-")).call(t,xB));else for(var r in localStorage)vP(r).call(r,PB)&&localStorage.removeItem(r)}},{key:"getAccessUrls",value:function(){return this.get("".concat(NB,"-").concat(xB))}},{key:"setAccessUrls",value:function(e){var t=ob(e).call(e,(function(e){var t,r=e.host,n=e.path;return JS(t="https://".concat(r)).call(t,n)}));return this.set("".concat(NB,"-").concat(xB),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(NB,"-").concat(xB))}},{key:"getEngineWebConfig",value:function(e,t){var r,n,i,o=JS(r=JS(n="".concat(e,"_")).call(n,t,"_")).call(r,this.getDeviceId()),a=this.get(MB);return(null==a||null===(i=DC(a).call(a,(function(e){return e.key===o})))||void 0===i?void 0:i.config)||{}}},{key:"setEngineWebConfig",value:function(e,t,r){var n,i;if(r){var o=JS(n=JS(i="".concat(e,"_")).call(i,t,"_")).call(n,this.getDeviceId()),a=this.get(MB)||[];return(a=Wb(a).call(a,(function(e){return e.key!==o}))).push({key:o,config:r}),this.set(MB,LC(a).call(a,-5))}}},{key:"getServerConfig",value:function(e){var t,r="".concat(e),n=this.get(DB);return(null==n||null===(t=DC(n).call(n,(function(e){return e.key===r})))||void 0===t?void 0:t.config)||{}}},{key:"setServerConfig",value:function(e,t){if(t){var r="".concat(e),n=this.get(DB)||[];return(n=Wb(n).call(n,(function(e){return e.key!==r}))).push({key:r,config:t}),this.set(DB,LC(n).call(n,-5))}}}]),t}(),VB=new UB,FB=new dF("JoinRoomConfig",0),BB=function(){function e(t){var r;of(this,e),af(this,"_useTcpAfterJoinTimeout",e.DEFAULT_CONF.useTcpAfterJoinTimeout),af(this,"_joinWithTcpOnly",e.DEFAULT_CONF.joinWithTcpOnly),af(this,"_joinWithTcpOnlyDelay",e.DEFAULT_CONF.joinWithTcpOnlyDelay),af(this,"_blackBrowserRegexList",[]),this._engineId=t,qC(r=location.search).call(r,"__rtc_tcp_only__")>-1&&(this._joinWithTcpOnly=!0,this._joinWithTcpOnlyDelay=0),this._report()}return nf(e,[{key:"useTcpAfterJoinTimeout",get:function(){return this._useTcpAfterJoinTimeout}},{key:"useTcpJoin",get:function(){return this._joinWithTcpOnly}},{key:"useTcpJoinDelay",get:function(){return this._joinWithTcpOnlyDelay}},{key:"isBlackBrower",value:function(){var e;return DC(e=this._blackBrowserRegexList).call(e,(function(e){return new RegExp(e).test(navigator.userAgent)}))}},{key:"setServerConfig",value:function(e){var t,r,n,i=!1;"boolean"==typeof(null==e||null===(t=e.use_tcp_after_join_timeout)||void 0===t?void 0:t.enable)&&(this._useTcpAfterJoinTimeout=e.use_tcp_after_join_timeout.enable,i=!0),"boolean"==typeof(null==e||null===(r=e.join_with_tcp_only)||void 0===r?void 0:r.enable)&&(this._joinWithTcpOnly=e.join_with_tcp_only.enable,i=!0),"number"==typeof(null==e||null===(n=e.join_with_tcp_only)||void 0===n?void 0:n.delay_ms)&&(this._joinWithTcpOnlyDelay=e.join_with_tcp_only.delay_ms,i=!0),e&&Array.isArray(e.black_browser_regex_list)&&(this._blackBrowserRegexList=e.black_browser_regex_list,i=!0),i&&this._report()}},{key:"toString",value:function(){return ZS({use_tcp_after_join_timeout:this._useTcpAfterJoinTimeout,join_with_tcp_only:this._joinWithTcpOnly,join_with_tcp_only_delay:this._joinWithTcpOnlyDelay,black_browser_regex_list:this._blackBrowserRegexList})}},{key:"_report",value:function(){FB.print("_report",this.toString()),qV(this._engineId,"web_join_room_config",this.toString())}}],[{key:"setDefaulConf",value:function(t){var r=t.useTcpAfterJoinTimeout,n=t.joinWithTcpOnly,i=t.joinWithTcpOnlyDelay;return"boolean"==typeof r&&(e.DEFAULT_CONF.useTcpAfterJoinTimeout=r),"boolean"==typeof n&&(e.DEFAULT_CONF.joinWithTcpOnly=n),"number"==typeof i&&(e.DEFAULT_CONF.joinWithTcpOnlyDelay=Math.max(0,i)),e.DEFAULT_CONF}}]),e}();af(BB,"DEFAULT_CONF",{useTcpAfterJoinTimeout:!0,joinWithTcpOnly:!1,joinWithTcpOnlyDelay:5e3});var jB="access.rtc.volcvideo.com,access2-hl.rtc.volcvideo.com,rtcg-access.volcvideos.com".split(",");function HB(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://".concat(e)),"".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var zB="https://web-log-report.rtc.volcvideo.com/video/v1/webrtc_log/",GB="common.rtc.volcvideo.com,rtcg.volcvideos.com".split(","),WB={VERSION:"4.61.2",ICE_CONFIG_REQUEST_URLS_INTERNAL:ob(jB).call(jB,HB),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:zB,CONFIG_REQUEST_DOMAINS:GB,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:"",FORCE_ENABLED_REPORT_CALLBACKS:[],SKIP_WEB_AUDIO_IN_TRACK:!1,AUDIO_STALL:!0,VIDEO_STALL:!0,VIDEO_STALL_100MS:!1,STATS_SCALLBACK_SUPPORT:!0,JOIN_ROOM_CONFIG:BB.DEFAULT_CONF,SIGNAL_COMPRESSION:!0,SIGNAL_CROP_JOINROOM:!0,VIDEO_STALL_DATA:500,AUDIO_STALL_DATA:200,IOS_SAFARI_ORIENTATION:!1,BLACK_FRAME_LIFETIME:6e4,FALLBACK_ENCODE_CODEC:"",SEI_TIME_OUT:2e3,SEI_COUNT_FPS:1,PRE_ICE:!1};function KB(e,t){var r;if(FV("setParameter",0,JS(r="key: ".concat(e,", value: ")).call(r,t)),"VERSION"!==e){if("JOIN_ROOM_CONFIG"===e)return BB.setDefaulConf(t);if("ICE_CONFIG_REQUEST_URLS"===e){var n="string"==typeof t?[t]:t;return WB.ICE_CONFIG_REQUEST_URLS=ob(n).call(n,HB),VB.clearAccessUrls(),void VB.clearAccessNode()}if("VIDEO_STALL_DATA"!==e)if("AUDIO_STALL_DATA"!==e)if("VIDEO_STALL_100MS"!==e)if("PLATFORM"!==e||"string"!=typeof t)if("PRODUCT"!==e||"string"!=typeof t)if("FORCE_ENABLED_REPORT_CALLBACKS"!==e){if("LOG_SERVER_URL"===e){var i=t===DP.overseas?"https://web-log-report.volcvideos.com/video/v1/webrtc_log/":t===DP.domestic?zB:"string"==typeof t?t:void 0;i&&(WB.LOG_SERVER_URL=i,UV(i))}else if("OVERSEA"===e)return LV({extra_is_oversea:t?"1":"0"}),void(WB.OVERSEA=t);if("CONFIG_REQUEST_DOMAINS"===e&&Array.isArray(t)&&t.length>0)WB.CONFIG_REQUEST_DOMAINS=t;else if(!("SEI_TIME_OUT"===e&&"number"!=typeof t||"SEI_COUNT_FPS"===e&&"number"!=typeof t)){"DEVICE_ID"===e&&VB.setDeviceId(t);var o=AM.getKeys();vE(o).call(o,e)?AM.setParameter(e,t):WB[e]=t}}else{var a="string"==typeof t?[t]:t;WB.FORCE_ENABLED_REPORT_CALLBACKS=a}else LV({product:t});else LV({platform:t});else WB.VIDEO_STALL_100MS=ej()&&!!t;else WB.AUDIO_STALL_DATA=Math.max(200,Number(t));else WB.VIDEO_STALL_DATA=Math.max(500,Number(t))}}function XB(e){return"DEVICE_ID"===e?VB.getDeviceId():WB[e]}function JB(e,t,r){var n,i,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(n=r.video)||void 0===n?void 0:n.fps)||15,bitrate:1e3*((null===(i=r.video)||void 0===i?void 0:i.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||VP.PREV_FRAME,canvas:{bgColor:(null===(c=r.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=r.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(d=r.layout)||void 0===d||null===(l=d.regions)||void 0===l?void 0:ob(l).call(l,(function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:!e.alpha||Number(e.alpha)>1||Number(e.alpha)<=0?1:Number(e.alpha),x:!e.x||Number(e.x)>=1||Number(e.x)<0?0:Number(e.x),y:!e.y||Number(e.y)>=1||Number(e.y)<0?0:Number(e.y),w:!e.w||Number(e.w)>1||Number(e.w)<=0?1:Number(e.w),h:!e.h||Number(e.h)>1||Number(e.h)<=0?1:Number(e.h),zorder:!e.zorder||Number(e.zorder)<0||Number(e.zorder)>100?0:Number(e.zorder),renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var qB=[];function YB(e){qB=e}var QB={width:640,height:480,frameRate:15,maxKbps:600},ZB={width:1920,height:1080,frameRate:15,maxKbps:3e3};function $B(e,t){if("boolean"!=typeof e)throw new rN(_P.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}var ej=function(){return!aM()&&"function"==typeof HTMLVideoElement.prototype.requestVideoFrameCallback};function tj(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(e<i||e>o||"number"!=typeof e)throw new rN(_P.INVALID_PARAMS,JS(r=JS(n="Invalid ".concat(t,": the value range is [")).call(n,i,", ")).call(r,o,"]. integer only"))}function rj(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new rN(_P.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.POSITIVE_INFINITY;return"string"==typeof e&&e.length<=r&&e.length>=t}(e,i,o))throw new rN(_P.INVALID_PARAMS,JS(r=JS(n="Invalid ".concat(t,": The value should be string type. Length of the string: [")).call(n,i,",")).call(r,o,"]"))}function nj(e,t,r){var n;if(!vE(r).call(r,e))throw new rN(_P.INVALID_PARAMS,JS(n="Invalid ".concat(t,": The value can only be set as ")).call(n,ZS(r)))}function ij(e){if(!(e instanceof MediaStreamTrack))throw new rN(_P.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function oj(e,t){if(cj(e))throw new rN(_P.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function aj(e,t){if(!(e instanceof ArrayBuffer))throw new rN(_P.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function sj(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=ck(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(e){}}function cj(e){return null==e}function uj(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new rN(_P.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function dj(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new rN(_P.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function lj(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new rN(_P.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function hj(e){oj(e,"userInfo"),dj(e.userId),cj(e.extraInfo)||rj(e.extraInfo,"userInfo.extraInfo",1,200)}function pj(e){oj(e,"roomConfig"),$B(e.isAutoPublish,"roomConfig.isAutoPublish"),$B(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),$B(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo"),cj(e.roomProfileType)||nj(e.roomProfileType,"roomConfig",[zP.communication,zP.chat,zP.chatRoom,zP.coHost,zP.meeting,zP.classRoom])}function fj(e){oj(e,"videoPlayerOption")}function vj(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;if(!e||0===(null==e?void 0:e.byteLength))throw new rN(_P.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:IF.str2ab(ZS(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new rN(_P.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function _j(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new rN(_P.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}function mj(e,t){if("number"!=typeof e||Number.isNaN(e)||!(e>=1)){var r=e;if(!(null!=r&&r.min||null!=r&&r.max||null!=r&&r.exact||null!=r&&r.ideal))throw new rN(_P.INVALID_PARAMS,"".concat(t," is not a valid ConstrainULong"))}}function gj(e){var t,r=Ab(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;tj(null==n?void 0:n.maxKbps,"maxKbps"),mj(null==n?void 0:n.width,"width"),mj(null==n?void 0:n.height,"height"),mj(null==n?void 0:n.frameRate,"frameRate")}}catch(e){r.e(e)}finally{r.f()}}function yj(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.NEGATIVE_INFINITY,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;return tj(e,t,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY),(e=e>r?e:r)<n?e:n}var Sj=Er(JA),bj={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?LC(n).call(n,1):n);return Sj?JS(i).call(i,Sj(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,n);break;case 4:d[u].fn.call(d[u].context,t,n,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(bj);var Ej=bj.exports,kj=Er(Ej),Tj=new dF("VERTC",0),Ij=function(){Hx(r,Ej.EventEmitter);var e,t=oO(r);function r(){return of(this,r),t.apply(this,arguments)}return nf(r,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var n,i,o=arguments.length,a=new Array(o>1?o-1:0),s=1;s<o;s++)a[s-1]=arguments[s];return(n=Bx(Fx(r.prototype),"emit",this)).call.apply(n,JS(i=[this,e]).call(i,a))}catch(n){return Tj.error("safeEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,n),console.error(n),Boolean(t)}}},{key:"asyncEmit",value:(e=HS(BS().mark((function e(t){var n,i,o,a=this,s=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=s.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=s[o];return e.next=3,qS.resolve().then((function(){try{var e,n;(e=Bx(Fx(r.prototype),"emit",a)).call.apply(e,JS(n=[a,t]).call(n,i))}catch(e){Tj.error("safeEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),console.error(e)}}));case 3:case"end":return e.stop()}}),e)}))),function(t){return e.apply(this,arguments)})}]),r}(),Rj=function(e){return e[e.BLACK=0]="BLACK",e[e.NORMAL=1]="NORMAL",e}(Rj||{}),Cj=function(e){return e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted",e}(Cj||{}),wj=function(e){return e.PushLimitWarn="PushLimitWarn",e.OTHER="OTHER",e}(wj||{}),Aj=function(e){return e.ON_ADD_STREAM="onAddStream",e.ON_ADD_STREAM_LIST="onAddStreamList",e.ON_REMOVE_STREAM="onRemoveStream",e.ON_REMOVE_STREAM_LIST="onRemoveStreamList",e.USER_DISCONNECTION="userDisconnection",e.USER_DISCONNECTION_LIST="userDisconnectionList",e.USER_CONNECTION="userConnection",e.USER_CONNECTION_LIST="userConnectionList",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_UPDATE_USER_ATTRIBUTES="onUpdateUserAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.ON_TOKEN_PUBLISH_PRIVILEGE_WILL_EXPIRE="onTokenPublishPrivilegeWillExpire",e.ON_TOKEN_PUBLISH_PRIVILEGE_DID_EXPIRED="onTokenPublishPrivilegeDidExpired",e.ON_TOKEN_SUBSCRIBE_PRIVILEGE_WILL_EXPIRE="onTokenSubscribePrivilegeWillExpire",e.ON_TOKEN_SUBSCRIBE_PRIVILEGE_DID_EXPIRED="onTokenSubscribePrivilegeDidExpired",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SPEAKER_CHANGE="onSpeakerChange",e.ON_STREAM_FAILED="streamFailed",e.ON_NOTIFY_RECONNECT="notifyReconnect",e.ON_FORWARD_DST_ROOM_USER_KICK="onForwardDstRoomUserKick",e}(Aj||{}),xj=function(e){return e.RSCP="RSCP",e.RTT="RTT",e.SSC="SSC",e}(xj||{}),Oj=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ON_VENDOR_CONNECTION_STATE_CHANGE="onVendorConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e.ON_RECONNECT_FAILED="onReconnectFailed",e.CONNECT_WITH_TCP="onIceConnectWithTcp",e}(Oj||{}),Pj=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(Pj||{}),Nj=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(Nj||{}),Mj=function(e){return e[e.NORMAL=0]="NORMAL",e[e.BLACK=1]="BLACK",e}(Mj||{}),Dj=function(e){return e[e.EXTERNAL=0]="EXTERNAL",e[e.INTERNAL=1]="INTERNAL",e}(Dj||{}),Lj=function(e){return e.AUDIO="audio",e.VIDEO="video",e}(Lj||{}),Uj=function(e){return e.MAIN="main",e.SCREEN="screen",e.PUBLIC="public",e.VIRTUAL="virtual",e}(Uj||{}),Vj=function(){Hx(t,Ij);var e=oO(t);function t(r,n){var i;return of(this,t),af(dx(i=e.call(this)),"trackId",EF()),af(dx(i),"trackInfo",void 0),af(dx(i),"_originTrack",void 0),af(dx(i),"_channelCount",void 0),i.trackInfo=n,i._originTrack=r,i._channelCount=r.getSettings().channelCount,i}return nf(t,[{key:"dummy",get:function(){return this.trackInfo.isDummy}},{key:"virtual",get:function(){return"virtual"===this.trackInfo.streamIndex}},{key:"isScreen",get:function(){return"screen"===this.trackInfo.streamIndex}},{key:"isPublic",get:function(){return"public"===this.trackInfo.streamIndex}},{key:"sourceType",get:function(){return this.trackInfo.sourceType}},{key:"mediaType",get:function(){return this.trackInfo.mediaType}},{key:"captureSessionId",get:function(){return this.trackInfo.captureSessionId}},{key:"streamIndex",get:function(){var e=this.trackInfo.streamIndex;return"main"===e?CP.STREAM_INDEX_MAIN:"screen"===e?CP.STREAM_INDEX_SCREEN:void 0}},{key:"channelCount",get:function(){var e;return null!==(e=this._channelCount)&&void 0!==e?e:0}},{key:"originTrack",get:function(){return this._originTrack},set:function(e){this._originTrack=e,this._channelCount=mediaTrack.getSettings().channelCount}},{key:"destroy",value:function(){this._originTrack.stop()}}]),t}(),Fj=function(){Hx(r,Vj);var e,t=oO(r);function r(e,n,i){var o;return of(this,r),af(dx(o=t.call(this,e,i)),"_mediaTrack",void 0),af(dx(o),"_preProcessingTrack",void 0),af(dx(o),"_extensionManager",void 0),af(dx(o),"isTrackReady",void 0),af(dx(o),"handleTrackEnded",(function(){o.emit("track-ended",dx(o)),o.destroy()})),af(dx(o),"handleMute",(function(){o.emit("track-mute",dx(o))})),af(dx(o),"handleUnmute",(function(){o.emit("track-unmute",dx(o))})),o._extensionManager=n,o._initListeners(),o.isTrackReady=o.generatePreProcessingTrack(),o}return nf(r,[{key:"mediaTrack",get:function(){var e;return null!==(e=this._mediaTrack)&&void 0!==e?e:this._originTrack},set:function(e){this.mediaTrack.id!==e.id&&(this._mediaTrack=e,this.isTrackReady=this.generatePreProcessingTrack())}},{key:"preprocessingTrack",get:function(){var e;return null!==(e=this._preProcessingTrack)&&void 0!==e?e:this.mediaTrack}},{key:"extensionManager",set:function(e){this._extensionManager=e,this.isTrackReady=this.generatePreProcessingTrack()}},{key:"generatePreProcessingTrack",value:(e=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._preProcessingTrack=void 0,e.prev=1,e.next=4,this._extensionManager.getPreProcessingTrack(this);case 4:(t=e.sent)instanceof MediaStreamTrack&&(this._preProcessingTrack=t),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),console.error(e.t0);case 11:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(){return e.apply(this,arguments)})},{key:"destroy",value:function(){var e,t;this._originTrack.removeEventListener("ended",this.handleTrackEnded),this._originTrack.removeEventListener("mute",this.handleMute),this._originTrack.removeEventListener("unmute",this.handleUnmute),null===(e=this._preProcessingTrack)||void 0===e||e.stop(),null===(t=this._mediaTrack)||void 0===t||t.stop(),Bx(Fx(r.prototype),"destroy",this).call(this)}},{key:"_initListeners",value:function(){this._originTrack instanceof MediaStreamTrack&&(this._originTrack.addEventListener("ended",this.handleTrackEnded),this._originTrack.addEventListener("mute",this.handleMute),this._originTrack.addEventListener("unmute",this.handleUnmute))}}]),r}(),Bj=function(){Hx(t,Vj);var e=oO(t);function t(r,n){var i;return of(this,t),af(dx(i=e.call(this,r,n)),"_mediaTrack",void 0),i._originTrack=r,i}return nf(t,[{key:"mediaTrack",get:function(){var e;return null!==(e=this._mediaTrack)&&void 0!==e?e:this._originTrack},set:function(e){this.mediaTrack.id!==e.id&&(this._mediaTrack=e)}},{key:"preprocessingTrack",get:function(){return this.mediaTrack}}]),t}(),jj=Ir;Zo({global:!0,forced:jj.globalThis!==jj},{globalThis:jj});var Hj=Er(Ir),zj=function(){var e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!ZF()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,Zj();case 5:if(e.t0=e.sent,!e.t0){e.next=10;break}return e.next=9,Qj();case 9:e.t0=e.sent;case 10:return e.abrupt("return",e.t0);case 13:return e.prev=13,e.t1=e.catch(0),e.abrupt("return",!1);case 16:case"end":return e.stop()}}),e,null,[[0,13]])})));return function(){return e.apply(this,arguments)}}(),Gj=function(){var e=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,Zj();case 3:if(e.t0=e.sent,!e.t0){e.next=8;break}return e.next=7,Qj();case 7:e.t0=e.sent;case 8:if(!e.t0){e.next=10;break}t.push("H264");case 10:return e.next=12,eH();case 12:if(e.t1=e.sent,!e.t1){e.next=17;break}return e.next=16,$j();case 16:e.t1=e.sent;case 17:if(!e.t1){e.next=19;break}t.push("vp8");case 19:return e.abrupt("return",t);case 20:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Wj=function(){var e=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Gj();case 2:return t=e.sent,e.abrupt("return",ob(t).call(t,(function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Kj={};function Xj(e){var t,r=!1,n=Ab(e.split("\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value;if(vE(i).call(i,"level-asymmetry-allowed=1")&&vE(i).call(i,"packetization-mode=1")&&vE(i).call(i,"profile-level-id=42e0")){r=!0;break}}}catch(e){n.e(e)}finally{n.f()}if(r){for(var o=navigator.userAgent.toLowerCase(),a=!1,s=0,c=[/miuibrowser/,/70.*HeyTapBrowser/i];s<c.length;s++)c[s].test(o)&&(a=!0);return!a}return!1}var Jj=function(){var e=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=new RTCPeerConnection({sdpSemantics:"unified-plan"})).addTransceiver("video",{direction:t}),e.next=4,r.createOffer();case 4:return n=e.sent,r.close(),e.abrupt("return",n.sdp.toLowerCase());case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),qj=function(){var e=HS(BS().mark((function e(){var t,r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Jj("sendonly");case 2:if(r=e.sent,!vE(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,Jj("sendonly");case 6:r=e.sent;case 7:return Kj.h264encode=Xj(r),Kj.vp8encode=qC(r).call(r,"vp8")>-1,e.abrupt("return",Kj);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Yj=function(){var e=HS(BS().mark((function e(){var t,r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Jj("recvonly");case 2:if(r=e.sent,!vE(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,Jj("recvonly");case 6:r=e.sent;case 7:return Kj.h264decode=Xj(r),Kj.vp8decode=qC(r).call(r,"vp8")>-1,e.abrupt("return",Kj);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Qj=function(){var e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==Kj.h264encode){e.next=9;break}return e.prev=1,e.next=4,qj();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",Kj.h264encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),Zj=function(){var e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==Kj.h264decode){e.next=9;break}return e.prev=1,e.next=4,Yj();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",Kj.h264decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),$j=function(){var e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==Kj.vp8encode){e.next=9;break}return e.prev=1,e.next=4,qj();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",Kj.vp8encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),eH=function(){var e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==Kj.vp8decode){e.next=9;break}return e.prev=1,e.next=4,Yj();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",Kj.vp8decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),tH=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},rH=function(){return pB?iB&&AB>=70||rB&&TB>=80||nB&&kB>=14:gB?iB&&AB>=70||rB&&TB>=80:_B?RB[0]>=14:!!mB&&iB&&AB>=86},nH=iB&&AB<=114,iH=!rB||TB>=96,oH=!(nB&&kB<=14),aH=mB&&iB||_B&&(17===RB[0]||16===RB[0]),sH=void 0!==Hj&&"PressureObserver"in Hj,cH="undefined"!=typeof window&&window.Worker,uH=function(e){return e[e.NONE=0]="NONE",e}(uH||{}),dH={getNalunits:function(e){if(e.length-e.position<4)return[];var t=e.position;return 1===e.getInt32(t)||0===e.getInt16(t)&&1===e.getInt8(t+2)?dH.getAnnexbNals(e):dH.getAvccNals(e)},getAnnexbNals:function(e){for(var t=[],r=dH.getHeaderPositionAnnexB(e),n=r.pos,i=n;n<e.length-4;){var o,a,s=new Uint8Array(LC(o=e.buffer).call(o,n,n+r.headerLength));r.pos===e.position&&e.skip(r.headerLength),i=(r=dH.getHeaderPositionAnnexB(e)).pos;var c={header:s,body:new Uint8Array(LC(a=e.buffer).call(a,n+s.byteLength,i)),type:-1};dH.analyseNal(c),c.type<=9&&0!==c.type&&t.push(c),e.skip(i-e.position),n=i}return t},getAvccNals:function(e){for(var t=[];e.position<e.length-4;){var r=e.getInt32(e.position);if(!(e.length-e.position>=r))break;var n,i,o=new Uint8Array(LC(n=e.buffer).call(n,e.position,e.position+4));e.skip(4);var a=new Uint8Array(LC(i=e.buffer).call(i,e.position,e.position+r));e.skip(r);var s={header:o,body:a,type:-1};dH.analyseNal(s),s.type<=9&&0!==s.type&&t.push(s)}return t},analyseNal:function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},getHeaderPositionAnnexB:function(e){for(var t=e.position,r=0,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{pos:t,headerLength:r}}},lH=function(){function e(t){of(this,e),af(this,"_position",0),af(this,"_dataview",void 0),this._dataview=new DataView(t)}return nf(e,[{key:"length",get:function(){return this.buffer.byteLength}},{key:"buffer",get:function(){return this._dataview.buffer}},{key:"position",get:function(){return this._position},set:function(e){this._position=e}},{key:"back",value:function(e){this.position-=e}},{key:"getUint8",value:function(e){return this._dataview.getUint8(e)}},{key:"getInt8",value:function(e){return this._dataview.getInt8(e)}},{key:"getInt16",value:function(e){return this._dataview.getInt16(e)}},{key:"getUint16",value:function(e){return this._dataview.getUint16(e)}},{key:"getUint32",value:function(e){return this._dataview.getUint32(e)}},{key:"getInt32",value:function(e){return this._dataview.getInt32(e)}},{key:"skip",value:function(t){for(var r=Math.floor(t/4),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)}},{key:"readUint8",value:function(){return e.readByte(this,1)}},{key:"readUint16",value:function(){return e.readByte(this,2)}},{key:"readUint24",value:function(){return e.readByte(this,3)}},{key:"readUint32",value:function(){return e.readByte(this,4)}},{key:"readUint64",value:function(){return e.readByte(this,8)}},{key:"readInt8",value:function(){return e.readByte(this,1,!0)}},{key:"readInt16",value:function(){return e.readByte(this,2,!0)}},{key:"readInt32",value:function(){return e.readByte(this,4,!0)}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}}],[{key:"readByte",value:function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n}}]),e}(),hH=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(hH||{}),pH=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),fH=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]);function vH(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function _H(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0;255===e[t]&&t<e.byteLength;)t++,r+=255;return t<e.byteLength&&(r+=e[t++]),[r,t]}var mH=function(){function e(){of(this,e)}return nf(e,null,[{key:"generateSEI",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint8Array([0,0,0,1]),i=new Uint8Array([6]),o=new Uint8Array([5]),a=r?pH:fH,s=vH(e.byteLength+a.byteLength),c=function(e){var t,r=[],n=0,i=Ab(e);try{for(i.s();!(t=i.n()).done;){var o=t.value;n>=2&&o<=3&&(r.push(3),n=0),0===o?n++:n=0,r.push(o)}}catch(e){i.e(e)}finally{i.f()}return new Uint8Array(r)}(e);return new Uint8Array(JS(t=[]).call(t,jw(n),jw(i),jw(o),jw(s),jw(a),jw(c),[128]))}},{key:"decodeSeiBody",value:function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=LC(e).call(e,0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=xb(_H(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=fH.byteLength&&i>=fH.byteLength&&LC(t).call(t,r,r+fH.byteLength).toString()===fH.toString()?(r+=fH.byteLength,o=1):t.byteLength>=fH.byteLength&&i>=fH.byteLength&&LC(t).call(t,r,r+pH.byteLength).toString()===pH.toString()&&(r+=pH.byteLength,o=0),{type:o,payload:LC(t).call(t,r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new DR,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=xb(_H(e.payload,r),2),i=n[0];r=n[1];var o,a=xb(_H(e.payload,r),2),s=a[0];if(r=a[1],t.get(i)||!(s<=e.payload.byteLength-r))break;t.set(i,LC(o=e.payload).call(o,r,r+s)),r+=s}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=Ab(e);try{for(n.s();!(t=n.n()).done;){var i=xb(t.value,2),o=i[0],a=i[1],s=vH(o),c=vH(a.byteLength);r.push(s,c,a)}}catch(e){n.e(e)}finally{n.f()}var u=wE(r).call(r,(function(e,t){return e+t.byteLength}),0),d=new Uint8Array(u);return wE(r).call(r,(function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),gH=Rr,yH=ci,SH=Di("iterator"),bH=!gH((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2&b=3"),n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),r.delete("a",2),r.delete("b",void 0),!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",void 0)||r.has("b")||!t.size&&yH||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[SH]||"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})),EH=Zo,kH=Ir,TH=$r,IH=Ur,RH=Yr,CH=bH,wH=Mc,AH=Lc,xH=PT,OH=au,PH=gh,NH=Eu,MH=A_,DH=Jr,LH=bi,UH=So,VH=Pa,FH=Ro,BH=En,jH=Ts,HH=_c,zH=sn,GH=Mv,WH=Cv,KH=B_,XH=lO,JH=Di("iterator"),qH="URLSearchParams",YH=qH+"Iterator",QH=NH.set,ZH=NH.getterFor(qH),$H=NH.getterFor(YH),ez=Object.getOwnPropertyDescriptor,tz=function(e){if(!RH)return kH[e];var t=ez(kH,e);return t&&t.value},rz=tz("fetch"),nz=tz("Request"),iz=tz("Headers"),oz=nz&&nz.prototype,az=iz&&iz.prototype,sz=kH.RegExp,cz=kH.TypeError,uz=kH.decodeURIComponent,dz=kH.encodeURIComponent,lz=IH("".charAt),hz=IH([].join),pz=IH([].push),fz=IH("".replace),vz=IH([].shift),_z=IH([].splice),mz=IH("".split),gz=IH("".slice),yz=/\+/g,Sz=Array(4),bz=function(e){return Sz[e-1]||(Sz[e-1]=sz("((?:%[\\da-f]{2}){"+e+"})","gi"))},Ez=function(e){try{return uz(e)}catch(t){return e}},kz=function(e){var t=fz(e,yz," "),r=4;try{return uz(t)}catch(e){for(;r;)t=fz(t,bz(r--),Ez);return t}},Tz=/[!'()~]|%20/g,Iz={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Rz=function(e){return Iz[e]},Cz=function(e){return fz(dz(e),Tz,Rz)},wz=PH((function(e,t){QH(this,{type:YH,iterator:GH(ZH(e).entries),kind:t})}),"Iterator",(function(){var e=$H(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),Az=function(e){this.entries=[],this.url=null,void 0!==e&&(BH(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===lz(e,0)?gz(e,1):e:jH(e)))};Az.prototype={type:qH,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=WH(e);if(c)for(r=(t=GH(e,c)).next;!(n=TH(r,t)).done;){if(o=(i=GH(FH(n.value))).next,(a=TH(o,i)).done||(s=TH(o,i)).done||!TH(o,i).done)throw cz("Expected sequence with length 2");pz(this.entries,{key:jH(a.value),value:jH(s.value)})}else for(var u in e)LH(e,u)&&pz(this.entries,{key:u,value:jH(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=mz(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=mz(t,"="),pz(this.entries,{key:kz(vz(r)),value:kz(hz(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],pz(r,Cz(e.key)+"="+Cz(e.value));return hz(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var xz=function(){MH(this,Oz);var e=QH(this,new Az(arguments.length>0?arguments[0]:void 0));RH||(this.size=e.entries.length)},Oz=xz.prototype;if(xH(Oz,{append:function(e,t){var r=ZH(this);KH(arguments.length,2),pz(r.entries,{key:jH(e),value:jH(t)}),RH||this.length++,r.updateURL()},delete:function(e){for(var t=ZH(this),r=KH(arguments.length,1),n=t.entries,i=jH(e),o=r<2?void 0:arguments[1],a=void 0===o?o:jH(o),s=0;s<n.length;){var c=n[s];if(c.key!==i||void 0!==a&&c.value!==a)s++;else if(_z(n,s,1),void 0!==a)break}RH||(this.size=n.length),t.updateURL()},get:function(e){var t=ZH(this).entries;KH(arguments.length,1);for(var r=jH(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=ZH(this).entries;KH(arguments.length,1);for(var r=jH(e),n=[],i=0;i<t.length;i++)t[i].key===r&&pz(n,t[i].value);return n},has:function(e){for(var t=ZH(this).entries,r=KH(arguments.length,1),n=jH(e),i=r<2?void 0:arguments[1],o=void 0===i?i:jH(i),a=0;a<t.length;){var s=t[a++];if(s.key===n&&(void 0===o||s.value===o))return!0}return!1},set:function(e,t){var r=ZH(this);KH(arguments.length,1);for(var n,i=r.entries,o=!1,a=jH(e),s=jH(t),c=0;c<i.length;c++)(n=i[c]).key===a&&(o?_z(i,c--,1):(o=!0,n.value=s));o||pz(i,{key:a,value:s}),RH||(this.size=i.length),r.updateURL()},sort:function(){var e=ZH(this);XH(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=ZH(this).entries,n=UH(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 wz(this,"keys")},values:function(){return new wz(this,"values")},entries:function(){return new wz(this,"entries")}},{enumerable:!0}),wH(Oz,JH,Oz.entries,{name:"entries"}),wH(Oz,"toString",(function(){return ZH(this).serialize()}),{enumerable:!0}),RH&&AH(Oz,"size",{get:function(){return ZH(this).entries.length},configurable:!0,enumerable:!0}),OH(xz,qH),EH({global:!0,constructor:!0,forced:!CH},{URLSearchParams:xz}),!CH&&DH(iz)){var Pz=IH(az.has),Nz=IH(az.set),Mz=function(e){if(BH(e)){var t,r=e.body;if(VH(r)===qH)return t=e.headers?new iz(e.headers):new iz,Pz(t,"content-type")||Nz(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),HH(e,{body:zH(0,jH(r)),headers:zH(0,t)})}return e};if(DH(rz)&&EH({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return rz(e,arguments.length>1?Mz(arguments[1]):{})}}),DH(nz)){var Dz=function(e){return MH(this,oz),new nz(e,arguments.length>1?Mz(arguments[1]):{})};oz.constructor=Dz,Dz.prototype=oz,EH({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Dz})}}var Lz,Uz={URLSearchParams:xz,getState:ZH},Vz=Ur,Fz=2147483647,Bz=/[^\0-\u007E]/,jz=/[.\u3002\uFF0E\uFF61]/g,Hz="Overflow: input needs wider integers to process",zz=RangeError,Gz=Vz(jz.exec),Wz=Math.floor,Kz=String.fromCharCode,Xz=Vz("".charCodeAt),Jz=Vz([].join),qz=Vz([].push),Yz=Vz("".replace),Qz=Vz("".split),Zz=Vz("".toLowerCase),$z=function(e){return e+22+75*(e<26)},eG=function(e,t,r){var n=0;for(e=r?Wz(e/700):e>>1,e+=Wz(e/t);e>455;)e=Wz(e/35),n+=36;return Wz(n+36*e/(e+38))},tG=function(e){var t,r,n=[],i=(e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=Xz(e,r++);if(i>=55296&&i<=56319&&r<n){var o=Xz(e,r++);56320==(64512&o)?qz(t,((1023&i)<<10)+(1023&o)+65536):(qz(t,i),r--)}else qz(t,i)}return t}(e)).length,o=128,a=0,s=72;for(t=0;t<e.length;t++)(r=e[t])<128&&qz(n,Kz(r));var c=n.length,u=c;for(c&&qz(n,"-");u<i;){var d=Fz;for(t=0;t<e.length;t++)(r=e[t])>=o&&r<d&&(d=r);var l=u+1;if(d-o>Wz((Fz-a)/l))throw zz(Hz);for(a+=(d-o)*l,o=d,t=0;t<e.length;t++){if((r=e[t])<o&&++a>Fz)throw zz(Hz);if(r===o){for(var h=a,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var v=h-f,_=36-f;qz(n,Kz($z(f+v%_))),h=Wz(v/_),p+=36}qz(n,Kz($z(h))),s=eG(a,l,u===c),a=0,u++}}a++,o++}return Jz(n,"")},rG=Zo,nG=Yr,iG=bH,oG=Ir,aG=So,sG=Ur,cG=Mc,uG=Lc,dG=A_,lG=bi,hG=qR,pG=bb,fG=Rc,vG=zp.codeAt,_G=function(e){var t,r,n=[],i=Qz(Yz(Zz(e),jz,"."),".");for(t=0;t<i.length;t++)r=i[t],qz(n,Gz(Bz,r)?"xn--"+tG(r):r);return Jz(n,".")},mG=Ts,gG=au,yG=B_,SG=Uz,bG=Eu,EG=bG.set,kG=bG.getterFor("URL"),TG=SG.URLSearchParams,IG=SG.getState,RG=oG.URL,CG=oG.TypeError,wG=oG.parseInt,AG=Math.floor,xG=Math.pow,OG=sG("".charAt),PG=sG(/./.exec),NG=sG([].join),MG=sG(1..toString),DG=sG([].pop),LG=sG([].push),UG=sG("".replace),VG=sG([].shift),FG=sG("".split),BG=sG("".slice),jG=sG("".toLowerCase),HG=sG([].unshift),zG="Invalid scheme",GG="Invalid host",WG="Invalid port",KG=/[a-z]/i,XG=/[\d+-.a-z]/i,JG=/\d/,qG=/^0x/i,YG=/^[0-7]+$/,QG=/^\d+$/,ZG=/^[\da-f]+$/i,$G=/[\0\t\n\r #%/:<>?@[\\\]^|]/,eW=/[\0\t\n\r #/:<>?@[\\\]^|]/,tW=/^[\u0000-\u0020]+/,rW=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,nW=/[\t\n\r]/g,iW=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)HG(t,e%256),e=AG(e/256);return NG(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+=MG(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},oW={},aW=hG({},oW,{" ":1,'"':1,"<":1,">":1,"`":1}),sW=hG({},aW,{"#":1,"?":1,"{":1,"}":1}),cW=hG({},sW,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),uW=function(e,t){var r=vG(e,0);return r>32&&r<127&&!lG(t,e)?e:encodeURIComponent(e)},dW={ftp:21,file:null,http:80,https:443,ws:80,wss:443},lW=function(e,t){var r;return 2===e.length&&PG(KG,OG(e,0))&&(":"===(r=OG(e,1))||!t&&"|"===r)},hW=function(e){var t;return e.length>1&&lW(BG(e,0,2))&&(2===e.length||"/"===(t=OG(e,2))||"\\"===t||"?"===t||"#"===t)},pW=function(e){return"."===e||"%2e"===jG(e)},fW=function(e){return".."===(e=jG(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},vW={},_W={},mW={},gW={},yW={},SW={},bW={},EW={},kW={},TW={},IW={},RW={},CW={},wW={},AW={},xW={},OW={},PW={},NW={},MW={},DW={},LW=function(e,t,r){var n,i,o,a=mG(e);if(t){if(i=this.parse(a))throw CG(i);this.searchParams=null}else{if(void 0!==r&&(n=new LW(r,!0)),i=this.parse(a,null,n))throw CG(i);(o=IG(new TG)).bindURL(this),this.searchParams=o}};LW.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s=this,c=t||vW,u=0,d="",l=!1,h=!1,p=!1;for(e=mG(e),t||(s.scheme="",s.username="",s.password="",s.host=null,s.port=null,s.path=[],s.query=null,s.fragment=null,s.cannotBeABaseURL=!1,e=UG(e,tW,""),e=UG(e,rW,"$1")),e=UG(e,nW,""),n=pG(e);u<=n.length;){switch(i=n[u],c){case vW:if(!i||!PG(KG,i)){if(t)return zG;c=mW;continue}d+=jG(i),c=_W;break;case _W:if(i&&(PG(XG,i)||"+"===i||"-"===i||"."===i))d+=jG(i);else{if(":"!==i){if(t)return zG;d="",c=mW,u=0;continue}if(t&&(s.isSpecial()!==lG(dW,d)||"file"===d&&(s.includesCredentials()||null!==s.port)||"file"===s.scheme&&!s.host))return;if(s.scheme=d,t)return void(s.isSpecial()&&dW[s.scheme]===s.port&&(s.port=null));d="","file"===s.scheme?c=wW:s.isSpecial()&&r&&r.scheme===s.scheme?c=gW:s.isSpecial()?c=EW:"/"===n[u+1]?(c=yW,u++):(s.cannotBeABaseURL=!0,LG(s.path,""),c=NW)}break;case mW:if(!r||r.cannotBeABaseURL&&"#"!==i)return zG;if(r.cannotBeABaseURL&&"#"===i){s.scheme=r.scheme,s.path=fG(r.path),s.query=r.query,s.fragment="",s.cannotBeABaseURL=!0,c=DW;break}c="file"===r.scheme?wW:SW;continue;case gW:if("/"!==i||"/"!==n[u+1]){c=SW;continue}c=kW,u++;break;case yW:if("/"===i){c=TW;break}c=PW;continue;case SW:if(s.scheme=r.scheme,i===Lz)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=fG(r.path),s.query=r.query;else if("/"===i||"\\"===i&&s.isSpecial())c=bW;else if("?"===i)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=fG(r.path),s.query="",c=MW;else{if("#"!==i){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=fG(r.path),s.path.length--,c=PW;continue}s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=fG(r.path),s.query=r.query,s.fragment="",c=DW}break;case bW:if(!s.isSpecial()||"/"!==i&&"\\"!==i){if("/"!==i){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,c=PW;continue}c=TW}else c=kW;break;case EW:if(c=kW,"/"!==i||"/"!==OG(d,u+1))continue;u++;break;case kW:if("/"!==i&&"\\"!==i){c=TW;continue}break;case TW:if("@"===i){l&&(d="%40"+d),l=!0,o=pG(d);for(var f=0;f<o.length;f++){var v=o[f];if(":"!==v||p){var _=uW(v,cW);p?s.password+=_:s.username+=_}else p=!0}d=""}else if(i===Lz||"/"===i||"?"===i||"#"===i||"\\"===i&&s.isSpecial()){if(l&&""===d)return"Invalid authority";u-=pG(d).length+1,d="",c=IW}else d+=i;break;case IW:case RW:if(t&&"file"===s.scheme){c=xW;continue}if(":"!==i||h){if(i===Lz||"/"===i||"?"===i||"#"===i||"\\"===i&&s.isSpecial()){if(s.isSpecial()&&""===d)return GG;if(t&&""===d&&(s.includesCredentials()||null!==s.port))return;if(a=s.parseHost(d))return a;if(d="",c=OW,t)return;continue}"["===i?h=!0:"]"===i&&(h=!1),d+=i}else{if(""===d)return GG;if(a=s.parseHost(d))return a;if(d="",c=CW,t===RW)return}break;case CW:if(!PG(JG,i)){if(i===Lz||"/"===i||"?"===i||"#"===i||"\\"===i&&s.isSpecial()||t){if(""!==d){var m=wG(d,10);if(m>65535)return WG;s.port=s.isSpecial()&&m===dW[s.scheme]?null:m,d=""}if(t)return;c=OW;continue}return WG}d+=i;break;case wW:if(s.scheme="file","/"===i||"\\"===i)c=AW;else{if(!r||"file"!==r.scheme){c=PW;continue}switch(i){case Lz:s.host=r.host,s.path=fG(r.path),s.query=r.query;break;case"?":s.host=r.host,s.path=fG(r.path),s.query="",c=MW;break;case"#":s.host=r.host,s.path=fG(r.path),s.query=r.query,s.fragment="",c=DW;break;default:hW(NG(fG(n,u),""))||(s.host=r.host,s.path=fG(r.path),s.shortenPath()),c=PW;continue}}break;case AW:if("/"===i||"\\"===i){c=xW;break}r&&"file"===r.scheme&&!hW(NG(fG(n,u),""))&&(lW(r.path[0],!0)?LG(s.path,r.path[0]):s.host=r.host),c=PW;continue;case xW:if(i===Lz||"/"===i||"\\"===i||"?"===i||"#"===i){if(!t&&lW(d))c=PW;else if(""===d){if(s.host="",t)return;c=OW}else{if(a=s.parseHost(d))return a;if("localhost"===s.host&&(s.host=""),t)return;d="",c=OW}continue}d+=i;break;case OW:if(s.isSpecial()){if(c=PW,"/"!==i&&"\\"!==i)continue}else if(t||"?"!==i)if(t||"#"!==i){if(i!==Lz&&(c=PW,"/"!==i))continue}else s.fragment="",c=DW;else s.query="",c=MW;break;case PW:if(i===Lz||"/"===i||"\\"===i&&s.isSpecial()||!t&&("?"===i||"#"===i)){if(fW(d)?(s.shortenPath(),"/"===i||"\\"===i&&s.isSpecial()||LG(s.path,"")):pW(d)?"/"===i||"\\"===i&&s.isSpecial()||LG(s.path,""):("file"===s.scheme&&!s.path.length&&lW(d)&&(s.host&&(s.host=""),d=OG(d,0)+":"),LG(s.path,d)),d="","file"===s.scheme&&(i===Lz||"?"===i||"#"===i))for(;s.path.length>1&&""===s.path[0];)VG(s.path);"?"===i?(s.query="",c=MW):"#"===i&&(s.fragment="",c=DW)}else d+=uW(i,sW);break;case NW:"?"===i?(s.query="",c=MW):"#"===i?(s.fragment="",c=DW):i!==Lz&&(s.path[0]+=uW(i,oW));break;case MW:t||"#"!==i?i!==Lz&&("'"===i&&s.isSpecial()?s.query+="%27":s.query+="#"===i?"%23":uW(i,oW)):(s.fragment="",c=DW);break;case DW:i!==Lz&&(s.fragment+=uW(i,aW))}u++}},parseHost:function(e){var t,r,n;if("["===OG(e,0)){if("]"!==OG(e,e.length-1))return GG;if(!(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return OG(e,l)};if(":"===h()){if(":"!==OG(e,1))return;l+=2,d=++u}for(;h();){if(8===u)return;if(":"!==h()){for(t=r=0;r<4&&PG(ZG,h());)t=16*t+wG(h(),16),l++,r++;if("."===h()){if(0===r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."===h()&&n<4))return;l++}if(!PG(JG,h()))return;for(;PG(JG,h());){if(o=wG(h(),10),null===i)i=o;else{if(0===i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!==n||u++}if(4!==n)return;break}if(":"===h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!==u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!==u)return;return c}(BG(e,1,-1))))return GG;this.host=t}else if(this.isSpecial()){if(e=_G(e),PG($G,e))return GG;if(null===(t=function(e){var t,r,n,i,o,a,s,c=FG(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"===OG(i,0)&&(o=PG(qG,i)?16:8,i=BG(i,8===o?1:2)),""===i)a=0;else{if(!PG(10===o?QG:8===o?YG:ZG,i))return e;a=wG(i,o)}LG(r,a)}for(n=0;n<t;n++)if(a=r[n],n===t-1){if(a>=xG(256,5-t))return null}else if(a>255)return null;for(s=DG(r),n=0;n<r.length;n++)s+=r[n]*xG(256,3-n);return s}(e)))return GG;this.host=t}else{if(PG(eW,e))return GG;for(t="",r=pG(e),n=0;n<r.length;n++)t+=uW(r[n],oW);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return lG(dW,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&lW(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=iW(i),null!==o&&(u+=":"+o)):"file"===t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+NG(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw CG(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new UW(e.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+iW(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(mG(e)+":",vW)},getUsername:function(){return this.username},setUsername:function(e){var t=pG(mG(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=uW(t[r],cW)}},getPassword:function(){return this.password},setPassword:function(e){var t=pG(mG(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=uW(t[r],cW)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?iW(e):iW(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,IW)},getHostname:function(){var e=this.host;return null===e?"":iW(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,RW)},getPort:function(){var e=this.port;return null===e?"":mG(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=mG(e))?this.port=null:this.parse(e,CW))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+NG(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,OW))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=mG(e))?this.query=null:("?"===OG(e,0)&&(e=BG(e,1)),this.query="",this.parse(e,MW)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=mG(e))?("#"===OG(e,0)&&(e=BG(e,1)),this.fragment="",this.parse(e,DW)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var UW=function(e){var t=dG(this,VW),r=yG(arguments.length,1)>1?arguments[1]:void 0,n=EG(t,new LW(e,!1,r));nG||(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())},VW=UW.prototype,FW=function(e,t){return{get:function(){return kG(this)[e]()},set:t&&function(e){return kG(this)[t](e)},configurable:!0,enumerable:!0}};if(nG&&(uG(VW,"href",FW("serialize","setHref")),uG(VW,"origin",FW("getOrigin")),uG(VW,"protocol",FW("getProtocol","setProtocol")),uG(VW,"username",FW("getUsername","setUsername")),uG(VW,"password",FW("getPassword","setPassword")),uG(VW,"host",FW("getHost","setHost")),uG(VW,"hostname",FW("getHostname","setHostname")),uG(VW,"port",FW("getPort","setPort")),uG(VW,"pathname",FW("getPathname","setPathname")),uG(VW,"search",FW("getSearch","setSearch")),uG(VW,"searchParams",FW("getSearchParams")),uG(VW,"hash",FW("getHash","setHash"))),cG(VW,"toJSON",(function(){return kG(this).serialize()}),{enumerable:!0}),cG(VW,"toString",(function(){return kG(this).serialize()}),{enumerable:!0}),RG){var BW=RG.createObjectURL,jW=RG.revokeObjectURL;BW&&cG(UW,"createObjectURL",aG(BW,RG)),jW&&cG(UW,"revokeObjectURL",aG(jW,RG))}gG(UW,"URL"),rG({global:!0,constructor:!0,forced:!iG,sham:!nG},{URL:UW});var HW=Zo,zW=Rr,GW=B_,WW=Ts,KW=bH,XW=wn("URL");HW({target:"URL",stat:!0,forced:!(KW&&zW((function(){XW.canParse()})))},{canParse:function(e){var t=GW(arguments.length,1),r=WW(e),n=t<2||void 0===arguments[1]?void 0:WW(arguments[1]);try{return!!new XW(r,n)}catch(e){return!1}}});var JW,qW,YW=Er(kn.URL),QW="undefined"!=typeof window&&(vE(JW=window.location.search).call(JW,"_rtc_debug_")||(null===(qW=window.localStorage)||void 0===qW?void 0:qW.getItem("_rtc_debug_")));function ZW(e){var t,r=PressureObserver.supportedSources;t=null!=r&&vE(r).call(r,"thermal")?"thermal":"cpu",new PressureObserver((function(r){r.forEach((function(r){r.source===t&&e(r.state)}))})).observe(t,{sampleInterval:2e3})}var $W=function(){function e(){var t=this;if(of(this,e),af(this,"_state",void 0),sH)try{if(cH){var r=new Blob(["(".concat(ZW.toString(),")(self.postMessage)")],{type:"text/javascript"});new Worker(YW.createObjectURL(r)).onmessage=function(e){t._state=e.data}}else ZW((function(e){t._state=e}))}catch(e){}}return nf(e,[{key:"state",get:function(){return QW&&!aM()&&(window.thermal_status=this._state),this._state}}]),e}(),eK=new $W,tK=function(){function e(t){of(this,e),af(this,"_timer",void 0),af(this,"handler",void 0),af(this,"_monitor",void 0),af(this,"logger",void 0),af(this,"_destroyed",!1),this._context=t,this._monitor=GV(t.id),this.logger=new dF("Stats",3,t.id)}return nf(e,[{key:"setVar",value:function(e){this.handler=e}},{key:"stopReport",value:function(e){var t;this._timer&&(this.logger.info("stopReport","invoke"),clearTimeout(this._timer),delete this._timer,qV(this._context.id,"del_media_statistics_timer",JS(t="reason: ".concat(e,", stack: ")).call(t,(new Error).stack),0,this._stream.streamId||""))}},{key:"filterIllegal",value:function(e){var t={};return ck(e).forEach((function(r){null===e[r]||void 0===e[r]||Number.isNaN(e[r])||(t[r]=e[r])})),t}},{key:"destroy",value:function(){this.logger.info("destroy","invoke"),qV(this._context.id,"media_statistics_destroy","".concat((new Error).stack),0,"".concat(this._stream.streamId)),this.stopReport("destroy"),this._destroyed=!0}}]),e}(),rK=function(){Hx(n,tK);var e,t,r=oO(n);function n(e,t){var i;return of(this,n),(i=r.call(this,e))._stream=t,i}return nf(n,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t){var r,n,i,o=this;if(!this._timer){this.logger.info("setLocalStreamStatsEvtInterval","invoke"),this.setVar(t),this._destroyed=!1;var a={audio:{},video:{}},s=this._stream,c=null===(r=s.audioTrack)||void 0===r?void 0:r.preprocessingTrack,u=null===(n=s.videoTrack)||void 0===n?void 0:n.preprocessingTrack;this.getAudioStats(c,a,null===(i=s.audioTrack)||void 0===i?void 0:i.getAudioLevel()),this.getVideoStats(u,a);var d=function(){var e=HS(BS().mark((function e(){var t,r,n,i,c,u,d;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=s.audioTrack)||void 0===t?void 0:t.preprocessingTrack,c=null===(r=s.videoTrack)||void 0===r?void 0:r.preprocessingTrack,e.next=4,o.getAudioStats(i,a,null===(n=s.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return u=e.sent,e.next=7,o.getVideoStats(c,a);case 7:return d=e.sent,e.abrupt("return",{audioStats:u,videoStats:d,isScreen:s.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),l=function(){var t=HS(BS().mark((function t(){var r;return BS().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d();case 2:r=t.sent,e(r),o._destroyed||(o._timer=setTimeout(l,2e3));case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();this._timer=setTimeout(l,2e3)}}},{key:"getAudioStats",value:(t=HS(BS().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c={},u={timestamp:Date.now()},d=this._stream,l=d.streamId,h=d.audioMid,p=d.isScreen,f=d.pubAttributes,v=d.pubAudio,_=d.audioTrack,m={media_type:"audio",is_screen:!!p,direction:"up",stream_id:l,vid:h,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:f.localaudio?"capture_state_on":"capture_state_off",mute_state:v?"mute_state_off":"mute_state_on",thermal_status:eK.state},_&&(m.playback_volume=_.getVolume()),t&&this.handler){e.next=7;break}return e.abrupt("return",c);case 7:return e.next=9,null===(i=this._context.peerConnection)||void 0===i?void 0:i.getStatsWithLowFrequency(t,!1,null===(o=this._stream.audioTransceiver)||void 0===o?void 0:o.sender);case 9:if((g=e.sent).length){e.next=12;break}return e.abrupt("return",c);case 12:if(g.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,i=e.bytesSent,o=e.clockRate,a=e.roundTripTime,s=e.channels,d=e.audioLevel,l=e.mimeType,h=e.availableIncomingBitrate,p=e.availableOutgoingBitrate,f=e.bytesReceived,v=e.nominated,_=e.id,g=e.currentRoundTripTime,y=e.state,S=e.writable,b=e.requestsReceived,E=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,R=e.jitter,C=e.candidateType,w=e.ip,A=e.address,x=e.networkType,O=e.port,P=e.protocol,N=e.nackCount,M=e.retransmittedBytesSent,D=e.retransmittedPacketsSent,L=e.audioInputLevel,U=e.ssrc,V=e.totalAudioEnergy,F=e.totalSamplesDuration,B=e.mediaType,j=e.fractionLost;"outbound-rtp"===t?(u.packetsSent=r,u.bytesSent=i,m.bytes=i,m.packetsSent=r,m.nackCount=N,m.ssrc=U,m.retransmitted_bytes_sent=M,m.retransmitted_packets_sent=D,u.retransmittedBytesSent=M,u.retransmittedPacketsSent=D):"remote-inbound-rtp"===t?(u.packetsLost=n,m.packetsLost=n,m.net_jitter=1e3*R,c.rtt=1e3*a,m.rtt=c.rtt,c._fractionLost=j||0):"codec"===t?(c.recordSampleRate=o,c.numChannels=s,m.codecName=l):"media-source"===t&&void 0!==d?(m.audio_level=d?-10*PN(Math.pow(d,2)):d,m.volume=255*d,m.total_audio_energy=V,m.totalInputDuration=F):"ssrc"===t&&"audio"===B?m.send_level=L:"candidate-pair"===t?(m.ice_available_incoming_bitrate=h,m.ice_available_outgoing_bitrate=p,m.ice_bytes_received=f,m.ice_bytes_sent=i,m.ice_nominated=Number(v),m.ice_pair_id=_,m.ice_pair_rtt=g,m.ice_pair_state=y,m.ice_pair_writable=S,m.recv_ping_requests=b,m.recv_ping_responses=E,m.sent_ping_requests_before_first_response=k,m.sent_ping_requests_total=k+(T||0),m.sent_ping_responses=I):"local-candidate"===t?(m.local_candidate_type=C,m.local_ip=w||A,m.local_network_type=x,m.local_port=O,m.protocol=P):"remote-candidate"===t&&(m.remote_candidate_type=C,m.remote_ip=w||A,m.remote_port=O);var H=XB("STATS_SCALLBACK_SUPPORT");nH&&H||"media-source"===t&&(m.send_level=d)})),void 0===m.volume&&void 0!==n&&(m.volume=n,m.audio_level=n?-10*PN(Math.pow(n/255,2)):n),(y=r.audio).timestamp){e.next=18;break}return r.audio=u,e.abrupt("return",this.filterIllegal(c));case 18:return void 0!==u.packetsLost&&(c.audioLossRate=Math.max(0,u.packetsLost-y.packetsLost)/(u.packetsSent-y.packetsSent),c.audioLossRate=Number.isNaN(c.audioLossRate)?0:c.audioLossRate,m.fraction_lost=c.audioLossRate),c.statsInterval=u.timestamp-y.timestamp,m.stats_interval=c.statsInterval,c.sendKBitrate=(u.bytesSent-y.bytesSent||0)/c.statsInterval*8,m.mediaBitratebps=Math.round(1e3*c.sendKBitrate),m.bandwidth=Math.round(m.mediaBitratebps/1024),void 0!==u.retransmittedBytesSent&&(m.retransmitBitratebps=(u.retransmittedBytesSent-y.retransmittedBytesSent||0)/c.statsInterval),r.audio=u,m.vendor_mode=this._stream.vendorCode||0,m.pc_session_id=null===(a=this.handler)||void 0===a?void 0:a.peerConnectionId,null===(s=this._monitor)||void 0===s||s.report("rtc_media_statistics",m),c._retransmittedRate=(u.retransmittedPacketsSent-y.retransmittedPacketsSent)/(u.packetsSent-y.packetsSent),void 0===c.audioLossRate&&(c.audioLossRate=c._retransmittedRate,m.fraction_lost=c.audioLossRate),c._fractionLost=Math.max(c._fractionLost,c.audioLossRate),e.abrupt("return",this.filterIllegal(c));case 33:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"getVideoStats",value:(e=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s={},c={timestamp:Date.now(),simulcast:{}},u=this._stream,d=u.streamId,l=u.videoMid,h=u.isScreen,p=u.pubAttributes,f=u.enableSimulcast,v=u.pubVideo,_={media_type:"video",is_screen:!!h,direction:"up",stream_id:d,vid:l,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:p.localvideo?"capture_state_on":"capture_state_off",mute_state:v?"mute_state_off":"mute_state_on",thermal_status:eK.state},t&&this.handler){e.next=6;break}return e.abrupt("return",s);case 6:return _.cap_frame_width=t.getSettings().width,_.cap_frame_height=t.getSettings().height,_.frameRateSent=t.getSettings().frameRate,s.isScreen=h,_.is_intersecting=ZS(null===(n=this._stream)||void 0===n||null===(i=n.videoTrack)||void 0===i?void 0:i.intersection),e.next=13,null===(o=this._context.peerConnection)||void 0===o?void 0:o.getStatsWithLowFrequency(t,!1,null===(a=this._stream.videoTransceiver)||void 0===a?void 0:a.sender);case 13:if((m=e.sent).length){e.next=16;break}return e.abrupt("return",s);case 16:if(g=0,m.forEach((function(e){var t=e.type,n=e.framesEncoded,i=e.packetsLost,o=e.bytesSent,a=e.framesSent,u=e.retransmittedBytesSent,d=e.totalPacketSendDelay,l=e.totalEncodeTime,h=e.firCount,p=e.targetBitrate,v=e.roundTripTime,m=e.mimeType,y=e.frameWidth,S=e.frameHeight,b=e.packetsSent,E=e.googActualEncBitrate,k=e.googAvailableReceiveBandwidth,T=e.googAvailableSendBandwidth,I=e.googAvgEncodeMs,R=e.googBucketDelay,C=e.googEncodeUsagePercent,w=e.googFrameRateInput,A=e.availableIncomingBitrate,x=e.availableOutgoingBitrate,O=e.bytesReceived,P=e.nominated,N=e.id,M=e.currentRoundTripTime,D=e.state,L=e.writable,U=e.candidateType,V=e.ip,F=e.address,B=e.networkType,j=e.port,H=e.nackCount,z=e.pliCount,G=e.protocol,W=e.qpSum,K=e.requestsReceived,X=e.responsesReceived,J=e.googRetransmitBitrate,q=e.requestsSent,Y=e.consentRequestsSent,Q=e.responsesSent,Z=e.ssrc,$=e.googTargetEncBitrate,ee=e.googTransmitBitrate,te=e.retransmittedPacketsSent,re=e.encoderImplementation,ne=e.jitter,ie=e.rid,oe=e.fractionLost,ae=e.googAdaptationChanges,se=e.qualityLimitationReason,ce=e.qualityLimitationDurations,ue=e.googFirsReceived,de=e.googFrameRateSent,le=e.keyFramesEncoded,he=e.scalabilityMode,pe=e.framesPerSecond,fe=e.frames;"outbound-rtp"===t?(f&&(ie?c.simulcast[ie]=e:c.simulcast[g]=e,g++),c.framesEncoded=n||c.framesEncoded||0,_.key_frames_encoded=le||0,c.bytesSent=o||c.bytesSent||0,c.framesSent=a||c.framesSent,_.bytes=o||_.bytes||0,c.packetsSent=b||c.packetsSent||0,_.packetsSent=b||_.packetsSent||0,_.nackCount=H||_.nackCount||0,_.pli_count=z||_.pli_count||0,_.qp_sum=W||_.qp_sum||0,_.ssrc=Z||_.ssrc||0,_.retransmitted_packets_sent=te,c.retransmittedPacketsSent=te,c.retransmittedBytesSent=u,_.encoder_implementation=re,_.qualityLimitationReason=se,_.qualityLimitationDurations=ce,_.scalabilityMode=he,void 0!==y&&((!s.encodedFrameWidth||y>s.encodedFrameWidth)&&(s.encodedFrameWidth=y),(!s.encodedFrameHeight||S>s.encodedFrameHeight)&&(s.encodedFrameHeight=S),_.frame_size_height=S,_.frame_size_width=y)):"track"===t?(s.encodedFrameWidth=y,s.encodedFrameHeight=S,_.frame_size_height=S,_.frame_size_width=y):"remote-inbound-rtp"===t?(c.packetsLost=i,s.rtt=1e3*v,_.rtt=s.rtt,_.jitter=1e3*ne,_.packetsLost=i,s._fractionLost=oe||0):"codec"===t?(s.codecType=m,_.codecName=m):"candidate-pair"===t?(_.ice_available_incoming_bitrate=A,_.ice_available_outgoing_bitrate=x,_.ice_bytes_received=O,_.ice_bytes_sent=o,_.ice_nominated=Number(P),_.ice_pair_id=N,_.ice_pair_rtt=M,_.ice_pair_state=D,_.ice_pair_writable=L,_.recv_ping_requests=K,_.recv_ping_responses=X,_.sent_ping_requests_before_first_response=q,_.sent_ping_requests_total=q+Y,_.sent_ping_responses=Q):"local-candidate"===t?(_.local_candidate_type=U,_.local_ip=V||F,_.local_network_type=B,_.local_port=j,_.protocol=G):"remote-candidate"===t?(_.remote_candidate_type=U,_.remote_ip=V||F,_.remote_port=j):"VideoBwe"===t?(_.encBitratebps=E,_.available_receive_bandwidth=k,_.available_send_bandwidth=T,_.bucket_delay=R,_.retransmitBitratebps=J,_.targetEncBitratebps=$,_.transmit_bitrate=ee,s._sendBandWidth=Number(T)):"ssrc"===t&&(_.avg_encode_ms=I,_.encodeUsage=C,_.frame_rate_input=w,_.orignal_input_Framerate=Number(w),_.ddaptationChanges=ae,_.firsReceived=ue,_.frameRateSent=de);var ve=XB("STATS_SCALLBACK_SUPPORT");if(!nH||!ve){var _e=r.video,me=c.timestamp-_e.timestamp;if("outbound-rtp"===t){var ge=o-_e.bytesSent,ye=u-_e.retransmittedBytesSent;_.encBitratebps=Math.round(8e3*(ge-ye)/me),_.bucket_delay=d/b,_.retransmitBitratebps=Math.round(8e3*ye/me),_.targetEncBitratebps=p,_.transmit_bitrate=Math.round(1e3*(o-_e.bytesSent)*8/me),_.avg_encode_ms=1e3*l/n,_.firsReceived=h+z}else"candidate-pair"===t?(_.available_send_bandwidth=x,s._sendBandWidth=x):"media-source"===t&&(_.frame_rate_input=pe,_.orignal_input_Framerate=Number(pe),_.frame_input=fe)}})),(y=r.video).timestamp){e.next=22;break}return r.video=c,e.abrupt("return",this.filterIllegal(s));case 22:return s.statsInterval=c.timestamp-y.timestamp,_.stats_interval=s.statsInterval,S=ck(c.simulcast),f?(_.sim_enc_width=[],_.sim_enc_height=[],_.sim_enc_bps=[],_.sim_enc_framerate=[],_.sim_enc_key_frames=[],_.sim_rids=[],_.sim_enc_bandwidth=[],_.sim_sent_framerate=[],_.sim_fraction_lost=[],_.sim_keyencoded=[],_.active_sim_streams=this._context.activeSimStreams||[],_.sim_retransmittedRate=[],k=!1,zO(S).call(S,(function(e,t){return Number(e)-Number(t)})).forEach((function(e){var t=c.simulcast[e],r=t.frameWidth,n=t.frameHeight,i=t.bytesSent,o=t.framesEncoded,a=t.framesSent,u=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,h=t.qualityLimitationDurations,p=t.qualityLimitationResolutionChanges,f=t.retransmittedPacketsSent,v=t.pliCount,m=t.keyFramesEncoded;void 0!==l&&(_.sim_qualityLimitationReason||(_.sim_qualityLimitationReason=[],_.sim_qualityLimitationDurations=[],_.sim_qualityLimitationResolutionChanges=[]),_.sim_qualityLimitationReason.push(l),_.sim_qualityLimitationDurations.push(h),_.sim_qualityLimitationResolutionChanges.push(p));var g=y.simulcast[e];if(_.sim_enc_width.push(r||0),_.sim_enc_height.push(n||0),_.sim_enc_key_frames.push(m||0),g){var S=(i-g.bytesSent||0)/s.statsInterval;_.sim_enc_bps.push(Math.round(8e3*S)),_.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var b=1e3*(o-g.framesEncoded)/s.statsInterval;_.sim_enc_framerate.push(Math.round(b)),_.sim_rids.push(e);var E=void 0!==a?a-g.framesSent:o-g.framesEncoded,T=1e3*E/s.statsInterval;_.sim_sent_framerate.push(Math.round(T));var I=(u-g.packetsLost)/(d-g.packetsSent);s._retransmittedRate=(f-g.retransmittedPacketsSent)/(d-g.packetsSent),I=Number.isNaN(I)?0:I,_.sim_fraction_lost.push(I),_.sim_keyencoded.push(v-g.pliCount>0),_.sim_retransmittedRate.push(s._retransmittedRate),r>0&&!k&&(s.rid=e,s.sentKBitrate=8*S,s.encoderOutputFrameRate=b,s.encodedFrameCount=E,s.sentFrameRate=T,s.videoLossRate=I,k=!0)}})),_.vendor_mode=this._stream.vendorCode||0,_.pc_session_id=null===(b=this.handler)||void 0===b?void 0:b.peerConnectionId,null===(E=this._monitor)||void 0===E||E.report("rtc_media_statistics",_)):(s.encodedFrameCount=void 0!==c.framesSent?c.framesSent-y.framesSent:c.framesEncoded-y.framesEncoded,s.sentKBitrate=(c.bytesSent-y.bytesSent||0)/s.statsInterval*8,_.bitrate=Math.round(1e3*s.sentKBitrate),_.bandwidth=Math.round(_.bitrate/1024),s.encoderOutputFrameRate=1e3*(c.framesEncoded-y.framesEncoded)/s.statsInterval,_.frame_rate_encoded=Math.round(s.encoderOutputFrameRate),s.sentFrameRate=1e3*s.encodedFrameCount/s.statsInterval,_.frame_rate_sent=Math.round(s.sentFrameRate),s.videoLossRate=Math.max(0,c.packetsLost-y.packetsLost)/(c.packetsSent-y.packetsSent),s.videoLossRate=Number.isNaN(s.videoLossRate)?0:s.videoLossRate,_.fraction_lost=s.videoLossRate,s._retransmittedRate=(c.retransmittedPacketsSent-y.retransmittedPacketsSent)/(c.packetsSent-y.packetsSent),_.vendor_mode=this._stream.vendorCode||0,_.pc_session_id=null===(T=this.handler)||void 0===T?void 0:T.peerConnectionId,null===(I=this._monitor)||void 0===I||I.report("rtc_media_statistics",_)),r.video=c,s._fractionLost=Math.max(s._fractionLost,s.videoLossRate),e.abrupt("return",this.filterIllegal(s));case 29:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})}]),n}(),nK=function(){Hx(i,tK);var e,t,r,n=oO(i);function i(e,t){var r;return of(this,i),(r=n.call(this,e))._stream=t,r}return nf(i,[{key:"setRemoteStreamStatsEvtInterval",value:(r=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._timer){e.next=2;break}return e.abrupt("return");case 2:return this.logger.info("setRemoteStreamStatsEvtInterval","invoke"),this.setVar(r),a={audio:{},video:{}},this._destroyed=!1,s=this._stream,c=null===(n=s.audioTrack)||void 0===n?void 0:n.originTrack,u=null===(i=s.videoTrack)||void 0===i?void 0:i.originTrack,this.getRemoteVideoStats(u,a),e.next=12,this.getRemoteAudioStats(c,a,null===(o=this._stream.audioTrack)||void 0===o?void 0:o.getAudioLevel());case 12:d=function(){var e=HS(BS().mark((function e(){var r,n,i,o,c,u,h;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=null===(r=s.audioTrack)||void 0===r?void 0:r.originTrack,c=null===(n=s.videoTrack)||void 0===n?void 0:n.originTrack,e.next=4,l.getRemoteAudioStats(o,a,null===(i=l._stream.audioTrack)||void 0===i?void 0:i.getAudioLevel());case 4:return u=e.sent,e.next=7,l.getRemoteVideoStats(c,a);case 7:h=e.sent,t({audioStats:u,videoStats:h,isScreen:s.isScreen,userId:s.userId,streamId:s.streamId}),l._destroyed||(l._timer=setTimeout(d,2e3));case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this.stopReport("start a new timer."),this._timer=setTimeout(d,2e3);case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"unsubscribe",value:function(){this.logger.info("unsubscribe","invoke"),Bx(Fx(i.prototype),"stopReport",this).call(this,"unsubscribe"),this._stream.stopAudioStallObserve()}},{key:"getRemoteAudioStats",value:(t=HS(BS().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d={},l={},h=this._stream,p=h.streamId,f=h.userId,v=h.isScreen,_=h.audioMid,m=h.subMediaType,g=h._attributes,y=h.virtual,S=h.audioTrack,b={media_type:"audio",is_screen:!!v,direction:"down",stream_id:p,stream_user_id:f,vid:_,audio_mux:y,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:MF(m)?"mute_state_off":"mute_state_on",remote_user_capture_state:g.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:g.localaudio&&g.audiostream?"mute_state_off":"mute_state_on",thermal_status:eK.state},S&&(b.playback_volume=S.getVolume()),t&&this.handler){e.next=7;break}return e.abrupt("return",d);case 7:return e.next=9,null===(i=this._context.peerConnection)||void 0===i?void 0:i.getStatsWithLowFrequency(t,!1,null===(o=this._stream.audioTransceiver)||void 0===o?void 0:o.receiver);case 9:if((E=e.sent).length){e.next=12;break}return e.abrupt("return",d);case 12:if(E.forEach((function(e){var t=e.type,r=e.packetsLost,i=e.packetsReceived,o=e.bytesReceived,a=e.jitterBufferDelay,s=e.jitterBufferEmittedCount,c=e.clockRate,u=e.channels,h=e.totalSamplesReceived,f=e.concealedSamples,v=e.silentConcealedSamples,_=e.concealmentEvents,m=e.totalRoundTripTime,g=e.packetsDiscarded,y=e.state,S=e.currentRoundTripTime,E=e.audioLevel,k=e.totalAudioEnergy,T=e.totalSamplesDuration,R=e.mimeType,C=e.googDecodingNormal,w=e.googDecodingMuted,A=e.availableIncomingBitrate,x=e.availableOutgoingBitrate,O=e.bytesSent,P=e.nominated,N=e.id,M=e.writable,D=e.jitter,L=e.candidateType,U=e.ip,V=e.address,F=e.networkType,B=e.port,j=e.protocol,H=e.audioOutputLevel,z=e.requestsReceived,G=e.responsesReceived,W=e.requestsSent,K=e.consentRequestsSent,X=e.responsesSent,J=e.ssrc,q=e.nackCount,Y=e.lastPacketReceivedTimestamp,Q=e.concealmentevents,Z=e.fecPacketsReceived;if("inbound-rtp"===t)l.packetsLost=r,l.packetsReceived=i,b.packetsLost=r,b.packetsReceived=i,b.packetsDiscarded=g,b.nackCount=q,b.lastPacketReceivedTimestamp=Y,b.concealmentevents=Q,l.bytesReceived=o,void 0!==a&&(d.jitterBufferDelay=a/s*1e3,b.average_jitter_buffer_delay_ms=d.jitterBufferDelay),void 0!==h&&(l.totalSamplesReceived=h,d.concealedSamples=f,l.concealedSamples=f,l.silentConcealedSamples=v,b.concealedSamples=f,d.concealmentEvents=_,b.totalSamplesReceived=h),void 0!==Z&&(b.fec_packets_received=Z,l.fecPacketsReceived=Z),b.jitter=1e3*D,b.ssrc=J,void 0!==E&&0!==E?(b.audio_level=E?-10*PN(Math.pow(E,2)):E,b.volume=255*E):(b.volume=null!=n?n:255*E,b.audio_level=n?-10*PN(Math.pow(n/255,2)):n),void 0!==k&&(b.total_audio_energy=k),void 0!==T&&(b.totalAudioDuration=T);else if("codec"===t)d.recordSampleRate=c,u&&(d.numChannels=u),b.codecName=R;else if("candidate-pair"===t){var $,ee;b.ice_available_incoming_bitrate=A,b.ice_available_outgoing_bitrate=x,b.ice_bytes_received=o,b.ice_bytes_sent=O,b.ice_nominated=Number(P),b.ice_pair_id=N,b.ice_pair_rtt=S,b.rtt=1e3*S,b.rtt&&null!==($=I._context.streamRTT)&&void 0!==$&&null!==(ee=$[p])&&void 0!==ee&&ee.audio&&(b.total_rtt_ms=Math.round(b.rtt+I._context.streamRTT[p].audio)),b.ice_pair_state=y,b.ice_pair_writable=M,b.recv_ping_requests=z,b.recv_ping_responses=G,b.sent_ping_requests_before_first_response=W,b.sent_ping_requests_total=W+(K||0),b.sent_ping_responses=X,"succeeded"===y&&(d.rtt=1e3*S,d.total_rtt=1e3*m)}else"track"===t&&void 0!==E?(0===E&&0!==n?(b.volume=n,b.audio_level=n?-10*PN(Math.pow(n/255,2)):n):(b.audio_level=E?-10*PN(Math.pow(E,2)):E,b.volume=255*E),b.total_audio_energy=k,b.totalAudioDuration=T):"ssrc"===t?(b.decodingNormal=C,b.recvAudioLevel=H,b.decodingMuted=w):"local-candidate"===t?(b.local_candidate_type=L,b.local_ip=U||V,b.local_network_type=F,b.local_port=B,b.protocol=j):"remote-candidate"===t&&(b.remote_candidate_type=L,b.remote_ip=U||V,b.remote_port=B)})),(k=r.audio).timestamp){e.next=18;break}return l.timestamp=Date.now(),r.audio=l,e.abrupt("return",this.filterIllegal(d));case 18:if(void 0===l.concealedSamples){e.next=25;break}return b.interval_concealed_samples=l.concealedSamples-k.concealedSamples,b.interval_samples_received=l.totalSamplesReceived-k.totalSamplesReceived,b.interval_silent_concealed_samples=l.silentConcealedSamples-k.silentConcealedSamples,e.next=24,this._stream.updateAudioStallInfo(b,d,l);case 24:T=e.sent;case 25:return l.timestamp=Date.now(),d.audioLossRate=Math.max(0,l.packetsLost-k.packetsLost)/(l.packetsReceived-k.packetsReceived+(l.packetsLost-k.packetsLost)),d.audioLossRate=Number.isNaN(d.audioLossRate)?0:d.audioLossRate,b.fraction_lost=d.audioLossRate,d.statsInterval=l.timestamp-k.timestamp,b.stats_interval=d.statsInterval,d.receivedKBitrate=(l.bytesReceived-k.bytesReceived||0)/d.statsInterval*8,b.bandwidth=Math.round(1e3*d.receivedKBitrate/1024),void 0!==l.concealedSamples&&(d.receivedSampleRate=1e3*b.interval_samples_received/d.statsInterval),void 0!==l.fecPacketsReceived&&(b.fecBitratebps=(l.fecPacketsReceived-k.fecPacketsReceived||0)/d.statsInterval),b.average_jitter_buffer_delay_ms&&b.total_rtt_ms&&(d.e2eDelay=b.average_jitter_buffer_delay_ms+b.total_rtt_ms),null!==(a=this._context.streamRTT)&&void 0!==a&&null!==(s=a[p])&&void 0!==s&&s.audio&&(d.totalRtt=(b.rtt?b.rtt:0)+this._context.streamRTT[p].audio),r.audio=l,b.vendor_mode=this._stream.vendorCode||0,b.pc_session_id=null===(c=this.handler)||void 0===c?void 0:c.peerConnectionId,null===(u=this._monitor)||void 0===u||u.report("rtc_media_statistics",b,T),e.abrupt("return",this.filterIllegal(d));case 42:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(e=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d={},l={timestamp:Date.now()},h=this._stream,p=h.streamId,f=h.userId,v=h.isScreen,_=h.subMediaType,m=h._attributes,g=ux({media_type:"video",is_screen:!!v,direction:"down",stream_id:p,stream_user_id:f,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:DF(_)?"mute_state_off":"mute_state_on",remote_user_capture_state:m.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:m.localvideo&&m.videostream?"mute_state_off":"mute_state_on",is_intersecting:ZS(null===(n=this._stream.videoTrack)||void 0===n?void 0:n.intersection()),thermal_status:eK.state},this._stream.getVideoRenderInfo()),t&&this.handler){e.next=6;break}return e.abrupt("return",d);case 6:return d.isScreen=v,e.next=9,null===(i=this._context.peerConnection)||void 0===i?void 0:i.getStatsWithLowFrequency(t,!1,null===(o=this._stream.videoTransceiver)||void 0===o?void 0:o.receiver);case 9:if((y=e.sent).length){e.next=12;break}return e.abrupt("return",d);case 12:if(y.forEach((function(e){var t=e.type,r=e.frameHeight,n=e.frameWidth,i=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.framesDecoded,c=e.jitterBufferDelay,u=e.jitterBufferEmittedCount,h=e.mimeType,f=e.firCount,v=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,m=e.bytesSent,y=e.nominated,S=e.id,b=e.currentRoundTripTime,E=e.state,k=e.writable,T=e.candidateType,R=e.ip,C=e.address,w=e.networkType,A=e.port,x=e.nackCount,O=e.pliCount,P=e.protocol,N=e.requestsReceived,M=e.responsesReceived,D=e.requestsSent,L=e.consentRequestsSent,U=e.responsesSent,V=e.ssrc,F=e.jitter,B=e.framesReceived,j=e.keyFramesDecoded,H=e.totalDecodeTime,z=e.decoderImplementation,G=e.lastPacketReceivedTimestamp,W=e.framesDropped;if("inbound-rtp"===t)l.packetsLost=i,g.packetsLost=i,l.packetsReceived=o,g.packetsReceived=o,l.bytesReceived=a,g.bytes=a,l.framesDecoded=s,l.totalDecodeTime=H,void 0!==c&&(l.jitterBufferDelay=c/u*1e3,g.average_jitter_buffer_delay_ms=l.jitterBufferDelay),g.fir_count=f,g.nackCount=x,l.nackCount=x,g.pli_count=O,g.ssrc=V,g.framesDropped=W,g.jitter=1e3*F,g.framesReceived=B,l.framesReceived=B,g.framesDecoded=s,g.key_frames_decoded=j,g.decoder_name=z,g.last_packet_received_timestamp=G,void 0!==n&&(d.width=n,g.frame_size_width=n,d.height=r,g.frame_size_height=r);else if("track"===t&&void 0!==n)d.width=n,g.frame_size_width=n,d.height=r,g.frame_size_height=r,void 0!==B&&(g.framesReceived=B,l.framesReceived=B);else if("codec"===t)g.codecName=h;else if("candidate-pair"===t){var K,X;g.ice_available_incoming_bitrate=v,g.ice_available_outgoing_bitrate=_,g.ice_bytes_received=a,g.ice_bytes_sent=m,g.ice_nominated=Number(y),g.ice_pair_id=S,g.ice_pair_rtt=b,g.rtt=1e3*b,g.rtt&&null!==(K=I._context.streamRTT)&&void 0!==K&&null!==(X=K[p])&&void 0!==X&&X.video&&(g.total_rtt_ms=Math.round(g.rtt+(I._context.streamRTT[p].video||0))),d.rtt=g.rtt,g.ice_pair_state=E,g.ice_pair_writable=k,g.recv_ping_requests=N,g.recv_ping_responses=M,g.sent_ping_requests_before_first_response=D,g.sent_ping_requests_total=D+(L||0),g.sent_ping_responses=U}else"local-candidate"===t?(g.local_candidate_type=T,g.local_ip=R||C,g.local_network_type=w,g.local_port=A,g.protocol=P):"remote-candidate"===t&&(g.remote_candidate_type=T,g.remote_ip=R||C,g.remote_port=A)})),(S=r.video).timestamp){e.next=17;break}return r.video=l,e.abrupt("return",this.filterIllegal(d));case 17:return b=Math.max(0,l.packetsLost-S.packetsLost),E=l.packetsReceived-S.packetsReceived,d.videoLossRate=b/(E+b),S.totalDecodeTime&&S.framesDecoded&&l.framesDecoded!==S.framesDecoded&&(k=l.totalDecodeTime-S.totalDecodeTime,T=l.framesDecoded-S.framesDecoded,g.decode_elapse_per_frame=Number((k/T*1e3).toFixed(2))),d._retransmittedRate=(l.nackCount-S.nackCount)/(E+b),d.videoLossRate=Number.isNaN(d.videoLossRate)?0:d.videoLossRate,g.fraction_lost=d.videoLossRate,d.statsInterval=l.timestamp-S.timestamp,g.stats_interval=d.statsInterval,d.receivedKBitrate=(l.bytesReceived-S.bytesReceived||0)/d.statsInterval*8,g.bitrate=Math.round(1e3*d.receivedKBitrate),g.bandwidth=Math.round(g.bitrate/1024),d.decoderOutputFrameRate=1e3*(l.framesDecoded-S.framesDecoded)/d.statsInterval,d.receivedFrameRate=1e3*(l.framesReceived-S.framesReceived)/d.statsInterval,g.frame_rate_decoded=Math.round(d.decoderOutputFrameRate),g.frame_rate_received=Math.round(d.receivedFrameRate),g.average_jitter_buffer_delay_ms&&g.total_rtt_ms&&(d.e2eDelay=g.average_jitter_buffer_delay_ms+g.total_rtt_ms),null!==(a=this._context.streamRTT)&&void 0!==a&&null!==(s=a[p])&&void 0!==s&&s.video&&(d.totalRtt=(g.rtt?g.rtt:0)+(this._context.streamRTT[p].video||0)),r.video=l,this._stream.updateVideoStallInfo(g,d),g.vendor_mode=this._stream.vendorCode||0,g.pc_session_id=null===(c=this.handler)||void 0===c?void 0:c.peerConnectionId,null===(u=this._monitor)||void 0===u||u.report("rtc_media_statistics",g),e.abrupt("return",this.filterIllegal(d));case 41:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})},{key:"destroy",value:function(){Bx(Fx(i.prototype),"destroy",this).call(this),Bx(Fx(i.prototype),"stopReport",this).call(this,"destroy"),this._stream.stopAudioStallObserve()}}]),i}(),iK=function(){function e(t,r){of(this,e),af(this,"_removeHandler",void 0),af(this,"_remotePauseHandler",void 0),af(this,"_prePts",void 0),af(this,"_stallList",void 0),af(this,"_videoInWaiting",!1),af(this,"_videoInWaitingCallback",!1),af(this,"_videoInWaiting100ms",!1),af(this,"_isPaused",void 0),af(this,"_pauseStart",0),af(this,"_pauseDuration",0),af(this,"_requestVideoFrameCallbackTimer",void 0),af(this,"_logger",void 0),af(this,"_player",void 0),af(this,"_recentVideoInfo",void 0),af(this,"_stallTimeThreshold",void 0),af(this,"_openVideoStall100ms",WB.VIDEO_STALL_100MS);var n=t?1500:nB||rB?550:500;this._stallTimeThreshold={report:n,callback:Math.max(WB.VIDEO_STALL_DATA,n)},this._logger=new dF("VideoStallObserver",1,r)}return nf(e,[{key:"start",value:function(e){var t=this;if(this._logger.print("start","invoke"),this._player=e,ej())e.domElement&&(this._requestVideoFrameCallbackTimer=e.domElement.requestVideoFrameCallback(this._onVideoRefresh.bind(this)),this._removeHandler=function(){var r;t._requestVideoFrameCallbackTimer&&(null===(r=e.domElement)||void 0===r||r.cancelVideoFrameCallback(t._requestVideoFrameCallbackTimer))});else{var r=function(r){return t._onVideoTimeupdate(r,e)};e.on("playback_event",r),this._removeHandler=function(){return e.off("playback_event",r)}}var n=function(e){return t._onVideoPause(e)};e.on("playback_event",n),this._remotePauseHandler=function(){return e.off("playback_event",n)}}},{key:"getRecentRenderInfo4Report",value:function(){var e=this,t={};return this._recentVideoInfo&&ck(this._recentVideoInfo).forEach((function(r){var n,i=r.replace(/[a-z]{1}[A-Z]{1}/g,(function(e){var t;return JS(t="".concat(e[0],"_")).call(t,e[1].toLowerCase())}));t["video_".concat(i)]=null===(n=e._recentVideoInfo)||void 0===n?void 0:n[r]})),t}},{key:"stop",value:function(){var e,t;this._logger.print("stop","invoke"),delete this._player,null===(e=this._removeHandler)||void 0===e||e.call(this),delete this._removeHandler,null===(t=this._remotePauseHandler)||void 0===t||t.call(this),delete this._remotePauseHandler,delete this._stallList,delete this._prePts,delete this._recentVideoInfo,this._videoInWaiting=!1,this._videoInWaitingCallback=!1,this._videoInWaiting100ms=!1}},{key:"destroy",value:function(){this.stop()}},{key:"getStallInfo",value:function(e){var t=this,r=e.interval,n=e.frameRateReceived,i=e.frameRateDecoded,o=e.bitrate,a={pts:0,report:{stallCount:0,stallDuration:0,list:[]},callback:{stallCount:0,stallDuration:0},pauseDuration:this._getPauseDuration()};return this._stallList&&((nB||rB)&&(0===o||(i||1/0)<=1||(n||1/0)<=1)||0===this._stallList.length?(a.report.stallDuration=a.callback.stallDuration=2e3,a.report.stallCount=a.callback.stallCount=this._videoInWaiting?0:1,this._openVideoStall100ms&&(a.stall100ms={count:this._videoInWaiting100ms?0:1,duration:2e3}),this._videoInWaiting=!0,this._videoInWaitingCallback=!0,this._videoInWaiting100ms=!0):this._stallList.forEach((function(e,n){var i=e.timeUpdateInterval;0===n&&t._videoInWaiting&&(i=Math.round(e.timeUpdateInterval%r));var o=e.timeUpdateInterval>t._stallTimeThreshold.report;o&&(a.report.list.push(e.timeUpdateInterval),a.report.stallDuration+=i,t._videoInWaiting||a.report.stallCount++),t._videoInWaiting=o,e.timeUpdateInterval>t._stallTimeThreshold.callback?(a.callback.stallDuration+=i,t._videoInWaitingCallback||a.callback.stallCount++,t._videoInWaitingCallback=!0):t._videoInWaitingCallback=!1,t._openVideoStall100ms&&(a.stall100ms||(a.stall100ms={count:0,duration:0}),e.timeUpdateInterval>100?(a.stall100ms.duration+=i,t._videoInWaiting100ms||a.stall100ms.count++,t._videoInWaiting100ms=!0):t._videoInWaiting100ms=!1),a.pts=e.playTime})),this._stallList=[]),a}},{key:"_getPauseDuration",value:function(){var e=this._pauseDuration;if(this._pauseDuration=0,this._isPaused){var t=kF(),r=t-(this._pauseStart||0);r>500&&(this._pauseStart=t,e+=r)}return e}},{key:"_onVideoPause",value:function(e){if("pause"===e.eventName)this._isPaused=!0,this._pauseStart=kF();else if("play"===e.eventName&&this._isPaused){this._isPaused=!1;var t=kF()-this._pauseStart;t>500&&(this._pauseDuration+=t)}}},{key:"_onVideoTimeupdate",value:function(e,t){if("timeupdate"===e.eventName){var r=t.domElement;if(!r||0===r.currentTime)return;if(void 0===this._prePts)return void(this._prePts=r.currentTime);if(this._stallList||(this._stallList=[]),r.currentTime>this._prePts){var n=r.currentTime-this._prePts;this._stallList.push({playTime:r.currentTime,timeUpdateInterval:Math.round(1e3*n)})}this._prePts=r.currentTime}}},{key:"_onVideoRefresh",value:function(e,t){var r,n;if(this._stallList||(this._stallList=[]),this._prePts){var i=t.presentationTime-this._prePts;this._stallList.push({playTime:t.presentationTime,timeUpdateInterval:Math.round(i)})}this._recentVideoInfo=t,this._prePts=t.presentationTime,null===(r=this._player)||void 0===r||null===(n=r.domElement)||void 0===n||n.requestVideoFrameCallback(this._onVideoRefresh.bind(this))}}]),e}(),oK=function(){function e(t){of(this,e),af(this,"_audioStallTimer",void 0),af(this,"_preSample",void 0),af(this,"_isStallInPreCallbackEnd",!1),af(this,"_isStallInPreReportEnd",!1),af(this,"_stallList",[]),this._stream=t}var t,r;return nf(e,[{key:"start",value:function(t,r){this.stop(),WB.AUDIO_STALL&&e.interval>0&&"number"==typeof t&&"number"==typeof r&&(this._preSample={ts:kF(),concealedSamples:t,totalSamplesReceived:r},this._startStallCountInterval())}},{key:"stop",value:function(){this._stallList=[],this._audioStallTimer&&(clearTimeout(this._audioStallTimer),delete this._audioStallTimer)}},{key:"destroy",value:function(){this.stop()}},{key:"getAudioStallInfo",value:(r=HS(BS().mark((function t(){var r,n,i,o,a;return BS().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={stats_count:Wb(r=this._stallList).call(r,(function(e){return!!e.get_stats_cost})).length,stall_list:jw(this._stallList)},t.prev=1,t.next=4,this._audioStallCount();case 4:t.next=8;break;case 6:t.prev=6,t.t0=t.catch(1);case 8:return i=aK(this._stallList,2,this._isStallInPreReportEnd),this._isStallInPreReportEnd=i.isStallInEnd,o=WB.AUDIO_STALL_DATA/e.interval,a=aK(this._stallList,o,this._isStallInPreCallbackEnd),this._isStallInPreCallbackEnd=a.isStallInEnd,this.stop(),this._startStallCountInterval(),t.abrupt("return",{report:{stall_count:i.stall_count,stall_duration:i.stall_duration,list:i.list},callback:{stall_count:a.stall_count,stall_duration:a.stall_duration,list:a.list},extra:n});case 16:case"end":return t.stop()}}),t,this,[[1,6]])}))),function(){return r.apply(this,arguments)})},{key:"_startStallCountInterval",value:function(){var t,r=this,n=(t=HS(BS().mark((function t(){return BS().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return clearTimeout(r._audioStallTimer),delete r._audioStallTimer,t.next=4,r._audioStallCount();case 4:r._audioStallTimer||(r._audioStallTimer=setTimeout(n,e.interval));case 5:case"end":return t.stop()}}),t)}))),function(){return t.apply(this,arguments)});this._audioStallTimer=setTimeout(n,e.interval)}},{key:"_audioStallCount",value:(t=HS(BS().mark((function t(){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R;return BS().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._preSample&&!(kF()-this._preSample.ts<.5*e.interval)){t.next=2;break}return t.abrupt("return");case 2:if(r=this._stream,n=r.hasAudio,i=r.subAudio,o=r.virtual,a=r.virtualOccupy,s=r.removeTrack,c=r.audioTrack,!s&&c){t.next=7;break}return clearTimeout(this._audioStallTimer),delete this._audioStallTimer,t.abrupt("return");case 7:if((u=n&&i)&&(!o||a)){t.next=13;break}this._preSample.ts=kF(),this._stallList.push({reason:u?JS(l="virtual: ".concat(o,", virtualOccupy: ")).call(l,a):JS(d="hasAudio: ".concat(n,", subAudio: ")).call(d,i)}),t.next=29;break;case 13:return h=kF(),v=0,t.prev=15,t.next=18,null===(_=this._stream.audioTransceiver)||void 0===_?void 0:_.receiver.getStats();case 18:null==(m=t.sent)||m.forEach((function(e){"inbound-rtp"===e.type&&(p=e),v++})),t.next=25;break;case 22:t.prev=22,t.t0=t.catch(15),f=t.t0.message||ZS(t.t0);case 25:g=kF(),y=kF(),S=y-this._preSample.ts,p?(E=(b=p).concealedSamples,k=b.totalSamplesReceived,T=E-this._preSample.concealedSamples,I=k-this._preSample.totalSamplesReceived,R=T>=0&&I>=0&&T>=e.ratio*I,this._stallList.push({concealed:T,received:I,diff:S,start:this._preSample.ts,end:y,get_stats_cost:g-h,get_stats_start:h,get_stats_end:g,is_stall:R}),this._preSample.concealedSamples=E,this._preSample.totalSamplesReceived=k,this._preSample.ts=y):this._stallList.push({diff:S,start:this._preSample.ts,end:y,get_stats_cost:g-h,get_stats_start:h,get_stats_end:g,reason:v?f||"no inbound-rtp":"no report"});case 29:case"end":return t.stop()}}),t,this,[[15,22]])}))),function(){return t.apply(this,arguments)})}],[{key:"setAudioStallConfig",value:function(t){e.interval=((null==t?void 0:t.audio_stall_interval)||200)/2,e.ratio=(null==t?void 0:t.audio_stall_ratio)||.6}}]),e}();af(oK,"interval",100),af(oK,"ratio",.6);var aK=function(e,t,r){for(var n,i={stall_count:0,stall_duration:0,isStallInEnd:!1,list:[]},o=0,a=0,s=0;s<e.length;s++){var c=e[s];c.is_stall&&(o++,a+=c.diff||0);var u=s===e.length-1;if(!c.is_stall||u){var d=o>=t,l=s+t-o-1;if(!d&&o>2){var h=0;LC(e).call(e,s+1,l+1).forEach((function(e){e.is_stall&&(h+=e.diff||0)})),(d=a+h>oK.interval*t*oK.ratio)&&(s=l,a+=h)}d&&(i.stall_count++,i.stall_duration+=a,i.list.push(a)),u&&(i.isStallInEnd=d),o=a=0}}return!0===(null===(n=e[0])||void 0===n?void 0:n.is_stall)&&r&&i.stall_count>0&&i.stall_count--,i},sK=function(e){return e[e.EXTERNAL=0]="EXTERNAL",e[e.INTERNAL=1]="INTERNAL",e}(sK||{}),cK=function(e){return e[e.CAPTURE=0]="CAPTURE",e[e.PRE_PROCESSING=1]="PRE_PROCESSING",e[e.ENCODE=2]="ENCODE",e[e.TRANSFER=3]="TRANSFER",e[e.POST_PROCESSING=4]="POST_PROCESSING",e[e.DECODE=5]="DECODE",e[e.RENDERING=6]="RENDERING",e}(cK||{}),uK=function(){function e(t){of(this,e),af(this,"_plugins",new DR),this.id=t}var t;return nf(e,[{key:"register",value:function(e){var t=this._plugins.get(e.type)||[];if($O(t).call(t,(function(t){return t.name===e.name}))>-1)throw new Error("Failed to register ".concat(e.name,": name is repeated."));t.push(e),this._plugins.set(e.type,t)}},{key:"getPluginsByType",value:function(e){return this._plugins.get(e)||[]}},{key:"getPluginByName",value:function(e,t){var r;return DC(r=this._plugins.get(e)||[]).call(r,(function(e){return e.name===t}))}},{key:"getPreProcessingTrack",value:(t=HS(BS().mark((function e(t){var r,n,i,o,a;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._plugins.get(1)||[],n=t.mediaTrack,i=Ab(r),e.prev=3,i.s();case 5:if((o=i.n()).done){e.next=12;break}return a=o.value,e.next=9,a.effect(t,n);case 9:n=e.sent;case 10:e.next=5;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),i.e(e.t0);case 17:return e.prev=17,i.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[3,14,17,20]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._plugins.forEach((function(e){e.forEach((function(e){return e.destroy()}))})),this._plugins.clear()}}]),e}(),dK=new dF("InternalEventBus",1),lK=function(e){return e.ON_IOS_INTERRUPTION_START="ON_IOS_INTERRUPTION_START",e.ON_IOS_INTERRUPTION_END="ON_IOS_INTERRUPTION_END",e.ON_IOS_LOCAL_TRACK_MUTE="ON_IOS_LOCAL_TRACK_MUTE",e.ON_IOS_LOCAL_TRACK_UNMUTE="ON_IOS_LOCAL_TRACK_UNMUTE",e}(lK||{}),hK=function(){Hx(t,Ej.EventEmitter);var e=oO(t);function t(){return of(this,t),e.apply(this,arguments)}return nf(t,[{key:"emit",value:function(e){var r,n;dK.info(e);for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return(r=Bx(Fx(t.prototype),"emit",this)).call.apply(r,JS(n=[this,e]).call(n,o))}}]),t}(),pK=new hK,fK=new dF("AudioContext",1),vK=function(){function e(){var t=this;of(this,e),af(this,"_audioContextInstance",void 0),af(this,"_previousState",""),af(this,"_currentState",""),af(this,"_contextStuckAt",0);var r=0;ZF()||setInterval((function(){if(t._audioContextInstance){var e=t._audioContextInstance.currentTime;t._contextStuckAt?t._contextStuckAt!==e&&(t._contextStuckAt=0,fK.info("currentTime resume"),HV("currentTime resume","")):e&&r===e&&(t._contextStuckAt=e,fK.warn("currentTime stuck",t._contextStuckAt),t._audioContextInstance.suspend(),t._audioContextInstance.resume(),HV("AudioContext currentTime stuck",t._contextStuckAt)),r=e}}),3e3)}return nf(e,[{key:"getAudioContextInstance",value:function(){var e=this;if(!this._audioContextInstance){var t=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new t,this._audioContextInstance.onstatechange=function(){var t,r,n;fK.warn("state change",null===(t=e._audioContextInstance)||void 0===t?void 0:t.state),e._previousState=e._currentState,e._currentState=(null===(r=e._audioContextInstance)||void 0===r?void 0:r.state)||"","interrupted"===(null===(n=e._audioContextInstance)||void 0===n?void 0:n.state)&&e._audioContextInstance.resume(),(_B||hB)&&("running"===e._previousState&&"interrupted"===e._currentState&&pK.emit(lK.ON_IOS_INTERRUPTION_START),"interrupted"===e._previousState&&"running"===e._currentState&&pK.emit(lK.ON_IOS_INTERRUPTION_END))}}return this._audioContextInstance}}]),e}(),_K=function(){function e(t){of(this,e),af(this,"_ctx",void 0),af(this,"_analyserNode",void 0),af(this,"_audioSource",void 0),af(this,"currentTrackId",void 0),this.currentTrackId=t.id;var r=mK.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination);var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}var t;return nf(e,[{key:"getAudioLevel",value:function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var r=0;t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))}));var n=r/128*255;return n>2?n:0}},{key:"resume",value:(t=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this._ctx)||void 0===t?void 0:t.resume();case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),mK=new vK,gK=new dF("VERTC",0),yK=function(){function e(){of(this,e),af(this,"_ac",void 0),af(this,"_sourceNode",void 0),af(this,"_gainNode",void 0),af(this,"_destNode",void 0),this._ac=mK.getAudioContextInstance(),this._gainNode=this._ac.createGain(),this._destNode=this._ac.createMediaStreamDestination(),this._gainNode.connect(this._destNode)}return nf(e,[{key:"setVolume",value:function(e){this._gainNode.gain.value=e/100}},{key:"getVolume",value:function(){return Math.round(100*this._gainNode.gain.value)}},{key:"updateInputTrack",value:function(e){this._sourceNode&&(this._sourceNode.mediaStream.getTracks().forEach((function(e){e.stop()})),delete this._sourceNode);var t=new MediaStream;t.addTrack(e),this._sourceNode=this._ac.createMediaStreamSource(t),this._sourceNode.connect(this._gainNode)}},{key:"getOutputTrack",value:function(){return this._destNode.stream.getTracks()[0]}},{key:"destroy",value:function(){var e,t;null===(e=this._sourceNode)||void 0===e||e.mediaStream.getTracks().forEach((function(e){e.stop()})),13!==kB&&this._destNode.stream.getTracks().forEach((function(e){e.stop()})),null===(t=this._sourceNode)||void 0===t||t.disconnect(),this._gainNode.disconnect(),delete this._sourceNode}}]),e}(),SK=function(){Hx(r,Fj);var e,t=oO(r);function r(e,n,i){var o;return of(this,r),af(dx(o=t.call(this,e,n,ux(ux({},i),{},{mediaType:Lj.AUDIO}))),"audioCaptureConfig",void 0),af(dx(o),"_ap",void 0),af(dx(o),"mixedAudioTrack",void 0),af(dx(o),"mixType",P1.PLAYOUT_AND_PUBLISH),af(dx(o),"_audioFetchMap",new DR),af(dx(o),"notSupportedWebAudio",!1),o}return nf(r,[{key:"withWebAudio",get:function(){return!!this._ap}},{key:"getAudioLevel",value:function(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:MP.MICROPHONE,n=r===MP.AUDIOMIXING&&this.mixType!==P1.PLAYOUT&&null!==(e=this.mixedAudioTrack)&&void 0!==e?e:this.preprocessingTrack,i=this._audioFetchMap.get(r);return i&&i.currentTrackId===n.id||(null===(t=i)||void 0===t||t.destroy(),i=new _K(n),this._audioFetchMap.set(r,i)),i.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioCaptureConfig){e.next=2;break}return e.abrupt("return");case 2:return gK.info("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),e.next=5,this.originTrack.applyConstraints(this.audioCaptureConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"setVolume",value:function(e){var t=!XB("SKIP_WEB_AUDIO_IN_TRACK")&&rH();t||(this.notSupportedWebAudio=!0);var r,n=!this.withWebAudio&&100!==e;try{t&&n&&(gK.print("Create AudioProcess"),this._ap=new yK,this._ap.updateInputTrack(this.originTrack),this.mediaTrack=this._ap.getOutputTrack())}catch(e){gK.print("WebAudio may not supported, quired return"),this.notSupportedWebAudio=!0}this.notSupportedWebAudio||null===(r=this._ap)||void 0===r||r.setVolume(e),t&&n&&this.emit("needReplaceTrack",this)}},{key:"getVolume",value:function(){return this._ap?this._ap.getVolume():100}},{key:"setUserId",value:function(e){this.trackInfo.streamUserId=e}},{key:"destroy",value:function(){this._audioFetchMap.forEach((function(e){return e.destroy()})),this._audioFetchMap.clear(),this._ap&&this._ap.destroy(),Bx(Fx(r.prototype),"destroy",this).call(this)}}]),r}(),bK=function(){Hx(t,Bj);var e=oO(t);function t(r,n){var i;return of(this,t),af(dx(i=e.call(this,r,ux(ux({},n),{},{mediaType:Lj.AUDIO}))),"_ap",void 0),af(dx(i),"_audioPlayer",void 0),af(dx(i),"_audioLevelFetcher",void 0),af(dx(i),"notSupportedWebAudio",!1),i}return nf(t,[{key:"withWebAudio",get:function(){return!!this._ap}},{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new _K(this.originTrack)),this._audioLevelFetcher.getAudioLevel()}},{key:"setVolume",value:function(e){var t=!XB("SKIP_WEB_AUDIO_IN_TRACK")&&rH();t||(this.notSupportedWebAudio=!0);var r,n,i=!this.withWebAudio&&100!==e;try{t&&i&&(gK.print("Create AudioProcess"),this._ap=new yK,this._ap.updateInputTrack(this.originTrack),this.mediaTrack=this._ap.getOutputTrack())}catch(e){gK.print("WebAudio may not supported, quite return"),this.notSupportedWebAudio=!0}this.notSupportedWebAudio||null===(r=this._ap)||void 0===r||r.setVolume(e),t&&i&&(this.emit("needReplaceTrack",this),null===(n=this._audioPlayer)||void 0===n||n.playAudio(this))}},{key:"getVolume",value:function(){return this.notSupportedWebAudio?100:this._ap?this._ap.getVolume():100}},{key:"dangerousGetPlayer",value:function(){return this._audioPlayer}},{key:"setPlaybackDevice",value:function(e){var t;return null===(t=this._audioPlayer)||void 0===t?void 0:t.setPlaybackDevice(e)}},{key:"setPlayer",value:function(e){this._audioPlayer=e}},{key:"pause",value:function(){var e;return null===(e=this._audioPlayer)||void 0===e?void 0:e.pause()}},{key:"play",value:function(){var e,t,r;return null!==(e=this._audioPlayer)&&void 0!==e&&e.played?null===(t=this._audioPlayer)||void 0===t?void 0:t.manuallyPlay():null===(r=this._audioPlayer)||void 0===r?void 0:r.playAudio(this)}},{key:"manuallyPause",value:function(){var e;return null===(e=this._audioPlayer)||void 0===e?void 0:e.manuallyPause()}},{key:"stop",value:function(){var e;return null===(e=this._audioPlayer)||void 0===e?void 0:e.stop()}},{key:"destroy",value:function(){var e,r;null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),this._ap&&this._ap.destroy(),null===(r=this._audioPlayer)||void 0===r||r.destroy(),this._audioPlayer=void 0,Bx(Fx(t.prototype),"destroy",this).call(this)}}]),t}(),EK=Er(Np),kK=new dF("VideoSnapshot",1),TK=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},IK=function(){var e=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=document.createElement("canvas"),i=n.getContext("2d")){e.next=4;break}throw new Error("canvas.getContext error");case 4:if(o=function(e,t,r){return t=t||e.width,r=r||e.height,n.width=t,n.height=r,i.setTransform(1,0,0,1,0,0),i.drawImage(e,0,0,t,r),i.getImageData(0,0,t,r)},a=Date.now(),!(s=TK(r))){e.next=16;break}return kK.info("takeSnapshot","VideoPlayer already set."),e.next=11,o(s,s.videoWidth,s.videoHeight);case 11:return c=e.sent,kK.info("takeSnapshot","success, cost ".concat(Date.now()-a,"ms")),e.abrupt("return",c);case 16:if(!window.ImageCapture){e.next=29;break}if("live"!==(u=new window.ImageCapture(t)).track.readyState||!u.track.enabled||u.track.muted){e.next=29;break}return kK.info("takeSnapshot","use ImageCapture"),e.t0=o,e.next=23,u.grabFrame();case 23:return e.t1=e.sent,e.next=26,(0,e.t0)(e.t1);case 26:return d=e.sent,kK.info("takeSnapshot","success, cost ".concat(Date.now()-a,"ms")),e.abrupt("return",d);case 29:return kK.info("takeSnapshot","use temp video"),e.abrupt("return",new qS((function(e,r){var n=new MediaStream([t]),i=document.createElement("video");i.setAttribute("playsinline",""),i.muted=!0,document.body.appendChild(i),i.onplaying=function(){var r=o(i,i.videoWidth,i.videoHeight);kK.info("takeSnapshot","success, cost ".concat(Date.now()-a,"ms")),e(r),n.removeTrack(t),i.srcObject=null,i.load()},i.onerror=r,i.srcObject=n,i.play()})));case 31:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),RK=new dF("VERTC",0),CK=EK("default"),wK=function(e){return e.START_STALL_OBSERVE="start_stall_observe",e.STOP_STALL_OBSERVE="stop_stall_observe",e}(wK||{}),AK=function(){Hx(r,Fj);var e,t=oO(r);function r(e,n,i){var o;return of(this,r),af(dx(o=t.call(this,e,n,ux(ux({},i),{},{mediaType:Lj.VIDEO}))),"resolution",void 0),af(dx(o),"videoPlayers",new DR),o.resolution={width:0,height:0},o}return nf(r,[{key:"intersection",value:function(){var e={};return this.videoPlayers.forEach((function(t,r){e[r.toString()]=t.isIntersecting})),e}},{key:"updateVideoCaptureConfig",value:(e=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return RK.info("updateVideoEncoderConfig","update localVideoTrack: ",t),delete(r=ux({},t)).contentHint,rB&&this.trackInfo.streamIndex===Uj.MAIN&&(r.frameRate={ideal:30,max:30}),e.next=6,this.originTrack.applyConstraints(r);case 6:((n=this.originTrack.getSettings()).width&&n.width!==this.resolution.width||n.height&&n.height!==this.resolution.height)&&(this.resolution={width:n.width,height:n.height},this.emit("resolution-change",this.resolution));case 8:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"setContentHint",value:function(e){var t;"contentHint"in this.originTrack&&vE(t=["text","motion","detail"]).call(t,e)&&(this.originTrack.contentHint=e)}},{key:"setTrack",value:function(e,t,r){this._originTrack=e,this.extensionManager=t,this.trackInfo=ux(ux({},this.trackInfo),r),this.isTrackReady=this.generatePreProcessingTrack()}},{key:"setPlayer",value:function(e,t,r,n,i){var o,a=null!==(o=t.playerId)&&void 0!==o?o:CK,s=this.videoPlayers.get(a);return t.player!==s&&(s=t.player,this.videoPlayers.set(a,s),i(s,this.isPublic,this.streamIndex)),this.mirror(!!r),this.dummy||n===WP.PLAY_MANUALLY||this.play(a),s.domElement}},{key:"setUserId",value:function(e){this.trackInfo.streamUserId=e,this.videoPlayers.forEach((function(t){t.userId=e}))}},{key:"snapshot",value:function(){var e,t,r,n=Ab(zN(e=this.videoPlayers).call(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;if(i.played){t=i;break}}}catch(e){n.e(e)}finally{n.f()}return IK(this.preprocessingTrack,t)}},{key:"setRenderMode",value:function(e,t){var r;return null===(r=this.videoPlayers.get(e))||void 0===r?void 0:r.setRenderMode(t)}},{key:"mirror",value:function(e){this.videoPlayers.forEach((function(t){t.mirror(e)}))}},{key:"removePlayerTrack",value:function(){var e=this;this.videoPlayers.forEach((function(t,r){var n;null===(n=e.videoPlayers.get(r))||void 0===n||n.removeTrack()}))}},{key:"play",value:function(e){var t=this.videoPlayers.get(e);return null!=t&&t.played?t.manuallyPlay():null==t?void 0:t.playVideo(this)}},{key:"playAll",value:function(){var e=this;this.videoPlayers.forEach((function(t,r){e.play(r)}))}},{key:"manuallyPlay",value:function(e){var t;return null===(t=this.videoPlayers.get(e))||void 0===t?void 0:t.manuallyPlay()}},{key:"pause",value:function(e){var t;null===(t=this.videoPlayers.get(e))||void 0===t||t.manuallyPause()}},{key:"stop",value:function(e){var t;return null===(t=this.videoPlayers.get(e))||void 0===t?void 0:t.stop()}},{key:"stopAll",value:function(){var e=this;return this.videoPlayers.forEach((function(t,r){e.stop(r)}))}},{key:"destroy",value:function(){var e=this;this.videoPlayers.forEach((function(t,r){e.stop(r),t.removeAllListeners(),e.videoPlayers.delete(r)})),Bx(Fx(r.prototype),"destroy",this).call(this)}}]),r}(),xK=function(){Hx(t,Bj);var e=oO(t);function t(r,n,i){var o;return of(this,t),af(dx(o=e.call(this,r,ux(ux({},i),{},{mediaType:Lj.VIDEO}))),"videoPlayers",new DR),af(dx(o),"_stream",void 0),af(dx(o),"_observingPlayer",void 0),o._stream=n,o}return nf(t,[{key:"observingPlayerId",get:function(){var e;return null===(e=this._observingPlayer)||void 0===e?void 0:e.playerId}},{key:"getSizeByPlayer",value:function(){var e=0,t=0;return this.videoPlayers.forEach((function(r){var n;null!==(n=r.domElement)&&void 0!==n&&n.videoWidth&&r.domElement.videoHeight&&(e=r.domElement.videoWidth,t=r.domElement.videoHeight)})),{width:e,height:t}}},{key:"intersection",value:function(){var e={};return this.videoPlayers.forEach((function(t,r){e[r.toString()]=t.isIntersecting})),e}},{key:"setPlayer",value:function(e,t,r,n){var i,o,a=null!==(i=t.playerId)&&void 0!==i?i:CK,s=this.videoPlayers.get(a);return t.player!==s&&(s=t.player,this.videoPlayers.set(a,s),this._handlePlayerStallEvent(s),n(s,this.isPublic,this.streamIndex)),this.dummy||r===WP.PLAY_MANUALLY||this.play(a),null===(o=s)||void 0===o?void 0:o.domElement}},{key:"dangerousGetPlayer",value:function(e){return this.videoPlayers.get(e)}},{key:"snapshot",value:function(){var e,t,r,n=Ab(zN(e=this.videoPlayers).call(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;if(i.played){t=i;break}}}catch(e){n.e(e)}finally{n.f()}return IK(this.preprocessingTrack,t)}},{key:"stop",value:function(e){var t;null===(t=this.videoPlayers.get(e))||void 0===t||t.stop()}},{key:"stopAll",value:function(){var e=this;this.videoPlayers.forEach((function(t,r){e.stop(r)}))}},{key:"play",value:function(e){var t=this.videoPlayers.get(e);return null!=t&&t.played?t.manuallyPlay():null==t?void 0:t.playVideo(this)}},{key:"pause",value:function(e){var t;return null===(t=this.videoPlayers.get(e))||void 0===t?void 0:t.manuallyPause()}},{key:"_handlePlayerStallEvent",value:function(e){var t=this;e.on("start_stall_observe",(function(){!t._observingPlayer&&e&&(t._observingPlayer=e,t._stream.startVideoStallObserve(t._observingPlayer))})),e.on("stop_stall_observe",(function(){t._observingPlayer===e&&(t._stream.stopVideoStallObserve(),t._observingPlayer=void 0,t.videoPlayers.forEach((function(e){!t._observingPlayer&&e.played&&(t._observingPlayer=e,t._stream.startVideoStallObserve(e))})))}))}},{key:"destroy",value:function(){var e=this;this.videoPlayers.forEach((function(t,r){e.stop(r),t.removeAllListeners(),e.videoPlayers.delete(r)})),Bx(Fx(t.prototype),"destroy",this).call(this)}}]),t}(),OK=function(){Hx(p,Ij);var e,t,r,n,i,o,a,s,c,u,d,l,h=oO(p);function p(){var e,t,r;return of(this,p),af(dx(r=h.call(this)),"deviceMap",{audioinput:new DR,audiooutput:new DR,videoinput:new DR}),af(dx(r),"checkDeviceChangeTimer",null),af(dx(r),"isSupportedPermissionsQuery",!1),af(dx(r),"isGrantedMicrophonePermission",!1),af(dx(r),"isGrantedCameraPermission",!1),r.isSupportedPermissionsQuery=!ZF()&&!(null===(e=navigator)||void 0===e||null===(t=e.permissions)||void 0===t||!t.query),r._handleDeviceChange=r._handleDeviceChange.bind(dx(r)),!ZF()&&r.initListener().then((function(){r.updateDeviceListInSilent()})),r}return nf(p,[{key:"refreshDevices",value:(l=HS(BS().mark((function e(){var t,r,n,i=this,o=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:"audio",navigator.mediaDevices){e.next=3;break}return e.abrupt("return");case 3:if(r=void 0,!rB){e.next=19;break}if(e.prev=5,"audio"!==t){e.next=12;break}return e.next=9,navigator.mediaDevices.getUserMedia({audio:!0});case 9:r=e.sent,e.next=15;break;case 12:return e.next=14,navigator.mediaDevices.getUserMedia({video:!0});case 14:r=e.sent;case 15:e.next=19;break;case 17:e.prev=17,e.t0=e.catch(5);case 19:return e.next=21,navigator.mediaDevices.enumerateDevices();case 21:n=e.sent,r&&r.getTracks().forEach((function(e){return e.stop()})),n.forEach((function(e){var t;e.deviceId&&(null===(t=i.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))}));case 24:case"end":return e.stop()}}),e,null,[[5,17]])}))),function(){return l.apply(this,arguments)})},{key:"initListener",value:(d=HS(BS().mark((function e(){var t,r,n,i,o=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.ondevicechange)&&"function"==typeof(null===(r=navigator.mediaDevices)||void 0===r?void 0:r.addEventListener)?navigator.mediaDevices.addEventListener("devicechange",(function(){o._handleDeviceChange(),setTimeout((function(){o._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){o._handleDeviceChange()}),3e3),!this.isSupportedPermissionsQuery){e.next=22;break}return e.prev=2,e.next=5,navigator.permissions.query({name:"microphone"});case 5:n=e.sent,this.isGrantedMicrophonePermission="granted"===n.state,n.addEventListener("change",(function(){o.isGrantedMicrophonePermission="granted"===n.state})),e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:return e.prev=12,e.next=15,navigator.permissions.query({name:"camera"});case 15:i=e.sent,this.isGrantedCameraPermission="granted"===i.state,i.addEventListener("change",(function(){o.isGrantedCameraPermission="granted"===i.state})),e.next=22;break;case 20:e.prev=20,e.t1=e.catch(12);case 22:case"end":return e.stop()}}),e,this,[[2,10],[12,20]])}))),function(){return d.apply(this,arguments)})},{key:"_handleDeviceChange",value:(u=HS(BS().mark((function e(){var t,r,n,i,o,a,s,c=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices){e.next=2;break}return e.abrupt("return");case 2:if(o=void 0,!rB){e.next=7;break}return e.next=6,navigator.mediaDevices.getUserMedia({audio:!0});case 6:o=e.sent;case 7:return e.next=9,navigator.mediaDevices.enumerateDevices();case 9:a=e.sent,a=Wb(a).call(a,(function(e){return!!e.deviceId})),o&&o.getTracks().forEach((function(e){return e.stop()})),s=CN(JS(t=[]).call(t,jw(zN(r=this.deviceMap.audioinput).call(r)),jw(zN(n=this.deviceMap.videoinput).call(n)),jw(zN(i=this.deviceMap.audiooutput).call(i)))),(vB||hB)&&!s.length&&a.length&&a.forEach((function(e){var t;null===(t=c.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e)})),a.forEach((function(e){var t,r,n=c.deviceMap[e.kind].get(e.deviceId);c.deviceMap[e.kind].set(e.deviceId,e),n||(vE(t=e.kind).call(t,"video")?c.emit(QF.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):vE(r=e.kind).call(r,"audio")&&c.emit(QF.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),s.forEach((function(e){var t,r;DC(a).call(a,(function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(c.deviceMap[e.kind].delete(e.deviceId),vE(t=e.kind).call(t,"video")?c.emit(QF.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):vE(r=e.kind).call(r,"audio")&&c.emit(QF.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 16:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"getUserMedia",value:(c=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.getUserMedia(t);case 2:return r=e.sent,null!=t&&t.audio&&(this.isGrantedMicrophonePermission=!0),null!=t&&t.video&&(this.isGrantedCameraPermission=!0),null!=t&&t.video?this.refreshDevices("video"):this.refreshDevices("audio"),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"checkPermissionsByDevices",value:(s=HS(BS().mark((function e(){var t,r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={audio:!1,video:!1},navigator.mediaDevices){e.next=3;break}return e.abrupt("return",t);case 3:return e.next=5,navigator.mediaDevices.enumerateDevices();case 5:return r=e.sent,t.audio=Wb(r).call(r,(function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,t.video=Wb(r).call(r,(function(e){return"videoinput"===e.kind&&e.label&&e.deviceId})).length>0,e.abrupt("return",t);case 9:case"end":return e.stop()}}),e)}))),function(){return s.apply(this,arguments)})},{key:"getPermissions",value:(a=HS(BS().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=(r=l.length>0&&void 0!==l[0]?l[0]:{}).audio,i=r.video,o=r.force,n||i||(n=!0,i=!0),a={audio:!1,video:!1,reason:void 0},o){e.next=30;break}if(!this.isSupportedPermissionsQuery){e.next=20;break}if(!n||!i){e.next=14;break}if(!this.isGrantedMicrophonePermission||!this.isGrantedCameraPermission){e.next=12;break}return a.audio=!0,a.video=!0,e.abrupt("return",a);case 12:e.next=18;break;case 14:if(!(n&&this.isGrantedMicrophonePermission||i&&this.isGrantedCameraPermission)){e.next=18;break}return a.audio=this.isGrantedMicrophonePermission,a.video=this.isGrantedCameraPermission,e.abrupt("return",a);case 18:e.next=30;break;case 20:return e.next=22,this.checkPermissionsByDevices();case 22:if(s=e.sent,!n||!i){e.next=28;break}if(!s.audio||!s.video){e.next=26;break}return e.abrupt("return",s);case 26:e.next=30;break;case 28:if(!(n&&s.audio||i&&s.video)){e.next=30;break}return e.abrupt("return",s);case 30:if(null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=70;break}return e.prev=31,e.next=34,navigator.mediaDevices.getUserMedia({audio:n,video:i});case 34:(c=e.sent)&&(c.getTracks().forEach((function(e){return e.stop()})),n&&(a.audio=!0,this.isGrantedMicrophonePermission=!0),i&&(a.video=!0,this.isGrantedCameraPermission=!0)),e.next=70;break;case 38:if(e.prev=38,e.t0=e.catch(31),a.reason=e.t0,!this.isSupportedPermissionsQuery){e.next=70;break}if(!n){e.next=56;break}return e.next=45,navigator.permissions.query({name:"microphone"}).catch((function(){}));case 45:if(e.t2=u=e.sent,e.t1=null===e.t2,e.t1){e.next=49;break}e.t1=void 0===u;case 49:if(!e.t1){e.next=53;break}e.t3=void 0,e.next=54;break;case 53:e.t3=u.state;case 54:e.t4=e.t3,a.audio="granted"===e.t4;case 56:if(!i){e.next=70;break}return e.next=59,navigator.permissions.query({name:"camera"}).catch((function(){}));case 59:if(e.t6=d=e.sent,e.t5=null===e.t6,e.t5){e.next=63;break}e.t5=void 0===d;case 63:if(!e.t5){e.next=67;break}e.t7=void 0,e.next=68;break;case 67:e.t7=d.state;case 68:e.t8=e.t7,a.video="granted"===e.t8;case 70:if(!n){e.next=75;break}return e.next=73,this.refreshDevices("audio");case 73:e.next=77;break;case 75:return e.next=77,this.refreshDevices("video");case 77:return e.abrupt("return",a);case 78:case"end":return e.stop()}}),e,this,[[31,38]])}))),function(){return a.apply(this,arguments)})},{key:"updateDeviceListInSilent",value:(o=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.isGrantedCameraPermission&&this.isGrantedMicrophonePermission&&this.refreshDevices("audio");case 1:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"enumerateDevices",value:(i=HS(BS().mark((function e(){var t,r,n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions();case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",CN(JS(t=[]).call(t,jw(zN(r=this.deviceMap.audioinput).call(r)),jw(zN(n=this.deviceMap.videoinput).call(n)),jw(zN(i=this.deviceMap.audiooutput).call(i)))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(n=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",CN(zN(t=this.deviceMap.audioinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(r=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({video:!0});case 2:return e.next=4,this.refreshDevices("video");case 4:return e.abrupt("return",CN(zN(t=this.deviceMap.videoinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(t=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices("audio");case 4:return e.abrupt("return",CN(zN(t=this.deviceMap.audiooutput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getAudioPlaybackDeviceById",value:(e=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateAudioPlaybackDevices();case 2:return r=e.sent,e.abrupt("return",DC(r).call(r,(function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})}]),p}(),PK=new OK;!ZF()&&(window.__rtc_dd__=PK);var NK=new dF("VERTC",0);function MK(e,t){return DK.apply(this,arguments)}function DK(){return DK=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new AK(t,r,{streamIndex:Uj.MAIN,sourceType:Dj.INTERNAL,isDummy:!0}),e.next=3,n.isTrackReady;case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)}))),DK.apply(this,arguments)}function LK(e,t){return UK.apply(this,arguments)}function UK(){return(UK=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new AK(t,r,{isDummy:!0,streamIndex:Uj.SCREEN,sourceType:Dj.INTERNAL}),e.next=3,n.isTrackReady;case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function VK(e,t){return FK.apply(this,arguments)}function FK(){return(FK=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",a=GV(r.id),s=sM(),e.prev=3,NK.info("createCameraVideoTrack","constraints:",t),null==a||a.report("rtc_video_capture_event",{event_type:"start",media_device_id:o,capture_session_id:s}),u=kF(),rB&&(t.frameRate={ideal:30,max:30}),e.next=10,PK.getUserMedia({video:t});case 10:i=e.sent,null==a||a.report("rtc_video_capture_event",{event_type:"start_capture_result",media_device_id:o,media_device_name:(null===(c=i.getVideoTracks()[0])||void 0===c?void 0:c.label)||"",reason:"success",elapse:kF()-u,capture_session_id:s}),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(3),null==a||a.report("rtc_video_capture_event",{event_type:"running_failed",media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message,capture_session_id:s}),new rN(_P.GET_VIDEO_TRACK_FAILED,JS(d="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(d,e.t0.message||"unknown message","."),e.t0);case 18:return l=i.getVideoTracks()[0],h=new AK(l,r,{streamIndex:Uj.MAIN,sourceType:Dj.INTERNAL,captureSessionId:s}),e.next=22,h.isTrackReady;case 22:return e.abrupt("return",h);case 23:case"end":return e.stop()}}),e,null,[[3,14]])})))).apply(this,arguments)}function BK(e,t){return jK.apply(this,arguments)}function jK(){return(jK=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return NK.info("createMicrophoneAudioTrack","constraints:",t),o=(null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",a=GV(r.id),s=sM(),e.prev=4,null==a||a.report("rtc_audio_device_event",{device_type:"audio_record",event_type:"start_begin",media_device_id:o,event_session_id:s}),u=kF(),(d=r.getPluginByName(cK.PRE_PROCESSING,"RTCAIAnsExtension"))&&(d.isOpen()?(t.autoGainControl=!0,t.noiseSuppression=!1):t.noiseSuppression=!0),e.next=11,PK.getUserMedia({audio:t});case 11:i=e.sent,null==a||a.report("rtc_audio_device_event",{device_type:"audio_record",event_type:"start_result",media_device_id:o,media_device_name:(null===(c=i.getAudioTracks()[0])||void 0===c?void 0:c.label)||"",reason:"success",elapse:kF()-u,event_session_id:s}),e.next=19;break;case 15:throw e.prev=15,e.t0=e.catch(4),null==a||a.report("rtc_audio_device_event",{device_type:"audio_record",event_type:"start_end",media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message,event_session_id:s}),new rN(_P.GET_AUDIO_TRACK_FAILED,JS(l="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(l,e.t0.message||"unknown message","."),e.t0);case 19:return h=i.getAudioTracks()[0],p=new SK(h,r,{streamIndex:Uj.MAIN,sourceType:Dj.INTERNAL,captureSessionId:s}),e.next=23,p.isTrackReady;case 23:return e.abrupt("return",p);case 24:case"end":return e.stop()}}),e,null,[[4,15]])})))).apply(this,arguments)}function HK(e,t,r){return zK.apply(this,arguments)}function zK(){return zK=HS(BS().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return NK.print("createCameraAndMicrophoneTrack","audioConstraints:",t,"videoConstraints:",r),a=GV(n.id),c=(null===(i=t.deviceId)||void 0===i?void 0:i.exact)||"default",u=(null===(o=r.deviceId)||void 0===o?void 0:o.exact)||"default",d=sM(),l=sM(),e.prev=6,null==a||a.report("rtc_video_capture_event",{event_type:"start",media_device_id:u,capture_session_id:d}),null==a||a.report("rtc_audio_device_event",{device_type:"audio_record",event_type:"start_begin",media_device_id:c,event_session_id:l}),f=kF(),rB&&(r.frameRate={ideal:30,max:30}),(v=n.getPluginByName(cK.PRE_PROCESSING,"RTCAIAnsExtension"))&&(v.isOpen()?(t.autoGainControl=!0,t.noiseSuppression=!1):t.noiseSuppression=!0),e.next=15,PK.getUserMedia({audio:t,video:r});case 15:s=e.sent,null==a||a.report("rtc_video_capture_event",{event_type:"start_capture_result",media_device_id:u,media_device_name:(null===(h=s.getVideoTracks()[0])||void 0===h?void 0:h.label)||"",reason:"success",elapse:kF()-f,capture_session_id:d}),null==a||a.report("rtc_audio_device_event",{device_type:"audio_record",event_type:"start_result",media_device_id:c,media_device_name:(null===(p=s.getAudioTracks()[0])||void 0===p?void 0:p.label)||"",reason:"success",elapse:kF()-f,event_session_id:l}),e.next=25;break;case 20:throw e.prev=20,e.t0=e.catch(6),null==a||a.report("rtc_video_capture_event",{event_type:"running_failed",media_device_id:u,error_code:e.t0.code,reason:e.t0.name+e.t0.message,capture_session_id:d}),null==a||a.report("rtc_audio_device_event",{device_type:"audio_record",event_type:"start_end",media_device_id:c,error_code:e.t0.code,reason:e.t0.name+e.t0.message,event_session_id:l}),new rN(_P.GET_VIDEO_TRACK_FAILED,JS(_="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(_,e.t0.message||"unknown message","."),e.t0);case 25:return m=s.getVideoTracks()[0],g=new AK(m,n,{streamIndex:Uj.MAIN,sourceType:Dj.INTERNAL,captureSessionId:d}),y=s.getAudioTracks()[0],S=new SK(y,n,{streamIndex:Uj.MAIN,sourceType:Dj.INTERNAL,captureSessionId:l}),e.next=31,qS.all([g.isTrackReady,S.isTrackReady]);case 31:return e.abrupt("return",{videoTrack:g,audioTrack:S});case 32:case"end":return e.stop()}}),e,null,[[6,20]])}))),zK.apply(this,arguments)}function GK(e,t,r){return WK.apply(this,arguments)}function WK(){return(WK=HS(BS().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return NK.info("createScreenTracks","screenConfig: %o, constraints: %o",t,n),u=GV(r.id),d=sM(),l=t.enableAudio,h=void 0!==l&&l,p=t.displaySurface,f=t.systemAudio,v=t.surfaceSwitching,_=t.selfBrowserSurface,m={},vE(i=["monitor","browser","window"]).call(i,p)&&(n?n.displaySurface=p:n={displaySurface:p}),vE(o=["include","exclude"]).call(o,f)&&(m.systemAudio=f),vE(a=["include","exclude"]).call(a,v)&&(m.surfaceSwitching=v),vE(s=["include","exclude"]).call(s,_)&&(m.selfBrowserSurface=_),e.prev=9,null==u||u.report("rtc_video_capture_event",{event_type:"start",media_device_id:"screen",capture_session_id:d}),b=kF(),e.next=14,navigator.mediaDevices.getDisplayMedia(ux({video:!(n&&(!nB||"16.1"!==IB))||n,audio:!!h&&{channelCount:2,noiseSuppression:!1,echoCancellation:!0,autoGainControl:!1}},m));case 14:c=e.sent,null==u||u.report("rtc_video_capture_event",{event_type:"start_capture_result",media_device_id:"screen",media_device_name:JS(g="".concat((null===(y=c.getVideoTracks()[0])||void 0===y?void 0:y.label)||"",", ")).call(g,(null===(S=c.getAudioTracks()[0])||void 0===S?void 0:S.label)||""),reason:"success",elapse:kF()-b,capture_session_id:d}),e.next=22;break;case 18:throw e.prev=18,e.t0=e.catch(9),null==u||u.report("rtc_video_capture_event",{event_type:"running_failed",media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message,capture_session_id:d}),new rN(_P.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 22:if(E=c.getVideoTracks()[0],k=new AK(E,r,{streamIndex:Uj.SCREEN,sourceType:Dj.INTERNAL,captureSessionId:d}),T=c.getAudioTracks()[0],!c.getAudioTracks().length){e.next=30;break}return I=new SK(T,r,{streamIndex:Uj.SCREEN,sourceType:Dj.INTERNAL,captureSessionId:d}),e.next=29,qS.all([k.isTrackReady,I.isTrackReady]);case 29:return e.abrupt("return",[k,I]);case 30:return e.next=32,k.isTrackReady;case 32:return e.abrupt("return",[k,void 0]);case 33:case"end":return e.stop()}}),e,null,[[9,18]])})))).apply(this,arguments)}function KK(e,t){return new bK(e,ux({},t))}function XK(e,t){return JK.apply(this,arguments)}function JK(){return(JK=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new AK(t,r,{streamIndex:Uj.MAIN,sourceType:Dj.EXTERNAL}),e.next=3,n.isTrackReady;case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qK(e,t){return YK.apply(this,arguments)}function YK(){return(YK=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new SK(t,r,{streamIndex:Uj.MAIN,sourceType:Dj.EXTERNAL}),e.next=3,n.isTrackReady;case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function QK(e,t){return ZK.apply(this,arguments)}function ZK(){return(ZK=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new AK(t,r,{sourceType:Dj.EXTERNAL,streamIndex:Uj.SCREEN}),e.next=3,n.isTrackReady;case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $K(e,t){return eX.apply(this,arguments)}function eX(){return(eX=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new SK(t,r,{sourceType:Dj.EXTERNAL,streamIndex:Uj.SCREEN}),e.next=3,n.isTrackReady;case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var tX,rX=function(){Hx(t,Ij);var e=oO(t);function t(r){var n;return of(this,t),af(dx(n=e.call(this)),"isScreen",!1),af(dx(n),"audioMid",void 0),af(dx(n),"videoMid",void 0),af(dx(n),"videoTransceiver",void 0),af(dx(n),"audioTransceiver",void 0),af(dx(n),"vendorHandler",void 0),af(dx(n),"vendorCode",0),af(dx(n),"engineId",void 0),af(dx(n),"logger",void 0),n._ctx=r,n.engineId=r.id,n.logger=new dF("Stream",0,r.id),n}return nf(t,[{key:"stopReport",value:function(e){this.statsReport.stopReport(e)}},{key:"destroy",value:function(){var e,t;delete this.audioMid,delete this.videoMid,this.statsReport.destroy(),null===(e=this.observer)||void 0===e||e.reset(),delete this.videoTransceiver,delete this.audioTransceiver,null===(t=this.vendorHandler)||void 0===t||t.destroy(),this.vendorCode=0,delete this.vendorHandler}}]),t}(),nX=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(nX||{}),iX=function(){Hx(t,rX);var e=oO(t);function t(r){var n;of(this,t),af(dx(n=e.call(this,r)),"id",void 0),af(dx(n),"stream",void 0),af(dx(n),"streamId",void 0),af(dx(n),"seiList",[]),af(dx(n),"videoTrack",void 0),af(dx(n),"audioTrack",void 0),af(dx(n),"videoEncodeConfig",[QB]),af(dx(n),"subVideoDescriptions",[]),af(dx(n),"enableSimulcast",!1),af(dx(n),"observer",void 0),af(dx(n),"statsReport",void 0),af(dx(n),"prevBitrate",0),af(dx(n),"pubAudio",!1),af(dx(n),"pubVideo",!1),af(dx(n),"blackFrameRenderInterval",void 0),af(dx(n),"blackFrameLifetimeInterval",void 0),af(dx(n),"pubAttributes",void 0),af(dx(n),"pcSessionId",void 0),af(dx(n),"maxSeiCount",1),af(dx(n),"transformer",(function(e,t){var r;if(n.seiList.length){var i,o=[],a=0,s=Ab(n.seiList);try{for(s.s();!(i=s.n()).done;){var c=i.value;if(o.length>=n.maxSeiCount)break;var u=mH.generateSEI(c.content);a+=u.byteLength,c.repeatCount--,o.push(u)}}catch(e){s.e(e)}finally{s.f()}n.seiList=Wb(r=n.seiList).call(r,(function(e){return e.repeatCount>0}));var d=new Uint8Array(a+e.data.byteLength);d.set(new Uint8Array(e.data));var l=e.data.byteLength;o.forEach((function(e){d.set(e,l),l+=e.byteLength})),e.data=d.buffer,t.enqueue(e)}else t.enqueue(e)})),n.stream=new MediaStream,n.id=sM(),n.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1,videoDescriptions:[],videoType:Mj.NORMAL},n.statsReport=new rK(r,dx(n));var i=XB("SEI_COUNT_FPS");return"number"==typeof i&&i<=10&&(n.maxSeiCount=i),n}return nf(t,[{key:"audioHasCapture",get:function(){return this.pubAttributes.localaudio}},{key:"audioHasPublish",get:function(){return this.pubAttributes.audiostream}},{key:"videoHasCapture",get:function(){return this.pubAttributes.localvideo}},{key:"videoHasPublish",get:function(){return this.pubAttributes.videostream}},{key:"hasPublished",get:function(){return!!this.audioMid&&!!this.videoMid}},{key:"isEmptyStream",get:function(){return!this.audioTrack&&!this.videoTrack}},{key:"initStreamId",get:function(){return this.stream.id}},{key:"startReport",value:function(e,t){this.statsReport.setLocalStreamStatsEvtInterval(e,t)}},{key:"initVideoEncodedTransform",value:function(){if(this.videoTransceiver&&this.videoTransceiver.sender){var e=this.videoTransceiver.sender;if(tH()){var t=e.createEncodedStreams(),r=t.readable,n=t.writable,i=new TransformStream({transform:this.transformer});r.pipeThrough(i).pipeTo(n)}}else this.logger.warn("no sender found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else this.logger.warn("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){qV(this.engineId,"localstream_clean","".concat((new Error).stack),0,this.streamId||""),Bx(Fx(t.prototype),"destroy",this).call(this),this.prevBitrate=0,this.subVideoDescriptions=[],clearTimeout(this.blackFrameLifetimeInterval),clearInterval(this.blackFrameRenderInterval)}},{key:"switchTrackEnableState",value:function(e,t){var r,n;"audio"===e?n=this.audioTrack:"video"===e&&(n=this.videoTrack);var i=null===(r=n)||void 0===r?void 0:r.mediaTrack;return!(!i||(null==i?void 0:i.enabled)===t||(i.enabled=t,0))}},{key:"resetStream",value:function(){this.stream=new MediaStream}},{key:"genBlackFrame",value:function(){var e,t;this.logger.info("genBlackFrame()");var r=null!==(e=this.videoEncodeConfig[0])&&void 0!==e&&e.frameRate?jF(null===(t=this.videoEncodeConfig[0])||void 0===t?void 0:t.frameRate):15,n=Math.ceil(1e3/r),i=document.createElement("canvas"),o=i.getContext("2d");i.width=16,i.height=16;var a=function(e){e.fillRect(0,0,16,16)};return o&&(o.fillStyle="#000",a(o),this.blackFrameRenderInterval=window.setInterval((function(){a(o)}),n),this.refreshBlackFrameLifetime()),i.captureStream(r).getVideoTracks()[0]}},{key:"stopBlackFrame",value:function(){this.logger.info("stopBlackFrame()"),clearTimeout(this.blackFrameLifetimeInterval),clearInterval(this.blackFrameRenderInterval),delete this.blackFrameRenderInterval}},{key:"refreshBlackFrameLifetime",value:function(){var e=this;this.logger.info("refreshBlackFrameLifetime()"),this.blackFrameRenderInterval&&(clearTimeout(this.blackFrameLifetimeInterval),this.blackFrameLifetimeInterval=setTimeout((function(){clearInterval(e.blackFrameRenderInterval),delete e.blackFrameRenderInterval,e.emit("black-frame-ended")}),WB.BLACK_FRAME_LIFETIME))}}]),t}(),oX=function(){Hx(r,rX);var e,t=oO(r);function r(e,n,i,o,a,s){var c;return of(this,r),af(dx(c=t.call(this,e)),"streamId",void 0),af(dx(c),"userId",void 0),af(dx(c),"isPublic",void 0),af(dx(c),"hasVideo",void 0),af(dx(c),"hasAudio",void 0),af(dx(c),"_attributes",void 0),af(dx(c),"streamState",void 0),af(dx(c),"removeTrack",!1),af(dx(c),"observer",void 0),af(dx(c),"statsReport",void 0),af(dx(c),"subVideo",void 0),af(dx(c),"subAudio",void 0),af(dx(c),"subMediaType",void 0),af(dx(c),"subLayer",void 0),af(dx(c),"_sequenceId",void 0),af(dx(c),"stream",void 0),af(dx(c),"videoTrack",void 0),af(dx(c),"audioTrack",void 0),af(dx(c),"recordedVideoFrames",void 0),af(dx(c),"stillExist",void 0),af(dx(c),"originalMediaType",void 0),af(dx(c),"priority",void 0),af(dx(c),"remoteSessionId",""),af(dx(c),"originalStreamIndex",0),af(dx(c),"virtual",void 0),af(dx(c),"pcSessionId",void 0),af(dx(c),"_virtualOccupy",void 0),af(dx(c),"_videoStallObserver",void 0),af(dx(c),"_audioStallObserver",void 0),c.virtual=!1,c._virtualOccupy=!1,c.userId=n,c.isScreen=o,c.isPublic=a,c.streamId=i,c.hasAudio=s.audiostream&&s.localaudio,c.hasVideo=s.videostream&&s.localvideo,c._attributes=s,c.vendorCode=(null==s?void 0:s.vendorCode)||0,c.subVideo=!1,c.subAudio=!1,c._sequenceId=0,c.subMediaType=uH.NONE,c.subLayer={spatialLayer:0,spatialSubLayer:-1},c.streamState=0,c.statsReport=new nK(e,dx(c)),c.enableVendorMode&&(c.pcSessionId=sM()),c}return nf(r,[{key:"vendor",get:function(){return this._attributes.vendorCode}},{key:"audioHasCapture",get:function(){return this._attributes.localaudio}},{key:"audioHasPublish",get:function(){return this._attributes.audiostream}},{key:"videoHasCapture",get:function(){return this._attributes.localvideo}},{key:"videoHasPublish",get:function(){return this._attributes.videostream}},{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"enableVendorMode",get:function(){return"number"==typeof this.attributes.vendorCode&&0!==this.attributes.vendorCode}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e,this.vendorCode=e.vendorCode||0}},{key:"virtualOccupy",get:function(){return this._virtualOccupy},set:function(e){var t;if(this._virtualOccupy&&!e)null===(t=this.observer)||void 0===t||t.setPushTrack(!1);else if(!this._virtualOccupy&&e){var r;null===(r=this.observer)||void 0===r||r.setPushTrack(!0)}this._virtualOccupy=e}},{key:"startReport",value:function(e,t){this.statsReport.setRemoteStreamStatsEvtInterval(e,t)}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){dH.getNalunits(new lH(t.data)).forEach((function(t){if(t.sei){var r=mH.decodeSeiBody(t.body);r&&r.type!==hH.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else this.logger.warn("no receiver found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){var e=this;if(this.audioTransceiver&&this.audioTransceiver.receiver){var t=this.audioTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){t.data.byteLength<=1e3?r.enqueue(t):e.logger.print("too large audio frame",t.data.byteLength)}})).pipeTo(n)}else this.logger.warn("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r,n;try{var i;qV(this.engineId,"Stream.ontrack",ZS({uid:this.userId,streamId:this.streamId,streams:wE(i=e.streams).call(i,(function(e,t){return e+lM(t)}),""),transceiver:fM(e.transceiver),track:dM(e.track)}),0,this.streamId||"")}catch(e){}if(this.enableVendorMode||null!==(t=e.streams)&&void 0!==t&&null!==(r=t[0])&&void 0!==r&&null!==(n=r.id)&&void 0!==n&&vE(n).call(n,this.streamId)){var o,a=e.track;"video"===(null==a?void 0:a.kind)?this._setVideoTrack(a):"audio"===(null===(o=e.track)||void 0===o?void 0:o.kind)&&this._setAudioTrack(a),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"startVideoStallObserve",value:function(e){this.logger.info("startVideoStallObserve","invoke",e.playerId),this._videoStallObserver||(this._videoStallObserver=new iK(this.isScreen,this.engineId)),this._videoStallObserver.start(e)}},{key:"stopVideoStallObserve",value:function(){var e;this.logger.info("stopVideoStallObserve","invoke"),null===(e=this._videoStallObserver)||void 0===e||e.stop()}},{key:"updateVideoStallInfo",value:function(e,t){var r,n=null===(r=this._videoStallObserver)||void 0===r?void 0:r.getStallInfo({interval:e.stats_interval||0,bitrate:e.bitrate,frameRateDecoded:e.frame_rate_decoded,frameRateReceived:e.frame_rate_received});if(n){var i,o=Math.min(n.report.stallDuration,e.stats_interval||0);if(e.play_time=n.pts,e.stall_count=n.report.stallCount,e.is_screen?e.stuck_length=o:e.stall_duration=o,e.pause_duration=Math.min(o,n.pauseDuration),t.stallCount=n.callback.stallCount,t.stallDuration=n.callback.stallDuration,n.stall100ms){var a=Math.min(n.stall100ms.duration,e.stats_interval||0);e.stall_duration_100ms=a,e.stall_count_100ms=n.stall100ms.count,t.stallDuration100MS=a,t.stallCount100MS=n.stall100ms.count}0===n.report.stallCount&&0===n.report.stallDuration||this.logger.print("video_stall_report",this.userId,null===(i=this.videoTrack)||void 0===i?void 0:i.observingPlayerId,ZS(n.report))}}},{key:"getVideoRenderInfo",value:function(){var e;return(null===(e=this._videoStallObserver)||void 0===e?void 0:e.getRecentRenderInfo4Report())||{}}},{key:"stopAudioStallObserve",value:function(){var e;this.logger.info("stopAudioStallObserve","invoke"),null===(e=this._audioStallObserver)||void 0===e||e.stop()}},{key:"updateAudioStallInfo",value:(e=HS(BS().mark((function e(t,r,n){var i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._audioStallObserver){e.next=6;break}this._audioStallObserver=new oK(this),this._audioStallObserver.start(n.concealedSamples,n.totalSamplesReceived),this.logger.print("startAduioObserver","start"),e.next=12;break;case 6:return e.next=8,this._audioStallObserver.getAudioStallInfo();case 8:return i=e.sent,t.concealedSamples===t.interval_concealed_samples&&t.totalSamplesReceived===t.interval_samples_received?(t.stall_count=0,t.stall_duration=0,r.stallCount=0,r.stallDuration=0):(t.stall_count=i.report.stall_count,t.stall_duration=i.report.stall_duration,r.stallCount=i.callback.stall_count,r.stallDuration=i.callback.stall_duration),0===i.report.stall_count&&0===i.report.stall_duration||this.logger.print("audio_stall_report",this.userId,ZS(ux(ux({},i.report),{},{callbackList:i.callback.list}))),e.abrupt("return",i.extra);case 12:case"end":return e.stop()}}),e,this)}))),function(t,r,n){return e.apply(this,arguments)})},{key:"clean",value:function(){var e,t,n;this.logger.info("clean",JS(e="exec stream.clean ".concat(this.streamId," ")).call(e,this.userId)),qV(this.engineId,"remotestream_clean","".concat((new Error).stack),0,this.streamId),Bx(Fx(r.prototype),"destroy",this).call(this),this.subAudio=!1,this.subVideo=!1,this.sequenceId=0,null===(t=this.videoTrack)||void 0===t||t.destroy(),this.videoTrack=void 0,null===(n=this.audioTrack)||void 0===n||n.destroy(),this.audioTrack=void 0,this.stream=void 0,this.recordedVideoFrames=void 0,delete this.priority}},{key:"destroy",value:function(){var e,t;this.clean(),null===(e=this._audioStallObserver)||void 0===e||e.destroy(),delete this._audioStallObserver,null===(t=this._videoStallObserver)||void 0===t||t.destroy(),delete this._videoStallObserver,this.attributes={audiostream:!1,localaudio:!1,localvideo:!1,videostream:!1,extvideo:!1,extaudio:!1,videoDescriptions:[]}}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{key:"_setStream",value:function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}}},{key:"_setAudioTrack",value:function(e){var t,r;(null===(t=this.audioTrack)||void 0===t||null===(r=t.preprocessingTrack)||void 0===r?void 0:r.id)!==e.id&&(this.audioTrack=KK(e,{streamIndex:this.isPublic?Uj.PUBLIC:this.virtual?Uj.VIRTUAL:this.isScreen?Uj.SCREEN:Uj.MAIN,streamUserId:this.userId}),this.emit("ontrack",this.audioTrack))}},{key:"_setVideoTrack",value:function(e){var t,r;(null===(t=this.videoTrack)||void 0===t||null===(r=t.preprocessingTrack)||void 0===r?void 0:r.id)!==e.id&&(this.videoTrack=function(e,t,r){return new xK(e,t,ux({},r))}(e,this,{streamIndex:this.isPublic?Uj.PUBLIC:this.virtual?Uj.VIRTUAL:this.isScreen?Uj.SCREEN:Uj.MAIN,streamUserId:this.userId}),this.emit("ontrack",this.videoTrack))}}]),r}(),aX=function(e){return e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_SUBSCRIBE_RESULT="ON_SUBSCRIBE_RESULT",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.ON_SUBTITLE_STATE_CHANGED="ON_SUBTITLE_STATE_CHANGED",e.ON_SUBTITLE_MESSAGE_RECEIVED="ON_SUBTITLE_MESSAGE_RECEIVED",e.ON_VIDEO_STREAM_BANNED="ON_VIDEO_STREAM_BANNED",e.ON_AUDIO_STREAM_BANNED="ON_AUDIO_STREAM_BANNED",e.ON_FORWARD_STREAM_ERROR="ON_FORWARD_STREAM_ERROR",e.ON_REJOIN_WITH_TCP="ON_REJOIN_WITH_TCP",e.PUB_RETRY="PUB_RETRY",e.SUB_RETRY="SUB_RETRY",e.VIDEO_TYPE_CHANGE="VIDEO_TYPE_CHANGE",e.JOIN_SUCCESS="JOIN_SUCCESS",e}(aX||{}),sX=function(e){return e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED",e}(sX||{}),cX=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(cX||{}),uX=function(){var e=HS(BS().mark((function e(t,r,n,i){var o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,u="",d=-1,l="video"===r?null==n||null===(o=n.videoTrack)||void 0===o?void 0:o.originTrack:null==n||null===(a=n.audioTrack)||void 0===a?void 0:a.originTrack,h="video"===r?null==n||null===(s=n.videoTransceiver)||void 0===s?void 0:s.receiver:null==n||null===(c=n.audioTransceiver)||void 0===c?void 0:c.receiver,e.prev=5,e.next=8,null===(p=t.peerConnection)||void 0===p?void 0:p.getStatsWithLowFrequency(l,!0,h);case 8:return _=e.sent,m=DC(f=_||[]).call(f,(function(e){return"inbound-rtp"===e.type})),e.next=12,null==h?void 0:h.getStats();case 12:if(g=e.sent,y=[],null==g||g.forEach((function(e){return y.push(e.type)})),0!==(null==_?void 0:_.length)||0===y.length){e.next=19;break}return e.next=18,null===(b=t.peerConnection)||void 0===b?void 0:b.getStatsWithLowFrequency(void 0,void 0,h);case 18:S=e.sent;case 19:u=ZS({type:r,reports:ob(_).call(_,(function(e){return e.type})),reports2:y,pc:(null===(v=t.peerConnection)||void 0===v?void 0:v.getOriginRTCPeerConnection())||null,track:(null==l?void 0:l.id)||null,bytes:null==m?void 0:m.bytesReceived,framesReceived:null==m?void 0:m.framesReceived,packetsReceived:null==m?void 0:m.packetsReceived,allReports:S}),e.next=26;break;case 22:e.prev=22,e.t0=e.catch(5),d=-999,u=e.t0.mseeage||ZS(e.t0);case 26:null==i||i.report("rtc_invoke_status",{sdk_api_name:"first_frame_recv_timeout",error_code:d,message:u,stream_id:(null==n?void 0:n.streamId)||"",stream_user_id:null==n?void 0:n.userId,elapse:0}),e.next=31;break;case 29:e.prev=29,e.t1=e.catch(0);case 31:case"end":return e.stop()}}),e,null,[[0,29],[5,22]])})));return function(t,r,n,i){return e.apply(this,arguments)}}(),dX=function(){var e=HS(BS().mark((function e(t,r,n,i){var o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,u="",d=-1,l="video"===r?null==n||null===(o=n.videoTrack)||void 0===o?void 0:o.preprocessingTrack:null==n||null===(a=n.audioTrack)||void 0===a?void 0:a.preprocessingTrack,h="video"===r?null==n||null===(s=n.videoTransceiver)||void 0===s?void 0:s.sender:null==n||null===(c=n.audioTransceiver)||void 0===c?void 0:c.sender,e.prev=5,e.next=8,null===(p=t.peerConnection)||void 0===p?void 0:p.getStatsWithLowFrequency(l,!0,h);case 8:return _=e.sent,m=DC(f=_||[]).call(f,(function(e){return"outbound-rtp"===e.type})),e.next=12,null==h?void 0:h.getStats();case 12:if(g=e.sent,y=[],null==g||g.forEach((function(e){return y.push(e.type)})),0!==_.length||0===y.length){e.next=19;break}return e.next=18,null===(b=t.peerConnection)||void 0===b?void 0:b.getStatsWithLowFrequency(void 0,void 0,h);case 18:S=e.sent;case 19:u=ZS({type:r,reports:ob(_).call(_,(function(e){return e.type})),reports2:y,pc:(null===(v=t.peerConnection)||void 0===v?void 0:v.getOriginRTCPeerConnection())||null,track:(null==l?void 0:l.id)||null,bytes:null==m?void 0:m.bytesSent,framesSent:null==m?void 0:m.framesSent,packetsSent:null==m?void 0:m.packetsSent,allReports:S}),e.next=26;break;case 22:e.prev=22,e.t0=e.catch(5),d=-999,u=e.t0.mseeage||ZS(e.t0);case 26:null==i||i.report("rtc_invoke_status",{sdk_api_name:"first_frame_send_timeout",error_code:d,message:u,stream_id:(null==n?void 0:n.streamId)||"",stream_user_id:null==n?void 0:n.userId,elapse:0}),e.next=31;break;case 29:e.prev=29,e.t1=e.catch(0);case 31:case"end":return e.stop()}}),e,null,[[0,29],[5,22]])})));return function(t,r,n,i){return e.apply(this,arguments)}}(),lX=function(){Hx(o,Ej.EventEmitter);var e,t,r,n,i=oO(o);function o(e,t){var r;return of(this,o),af(dx(r=i.call(this)),"_audioEventSessionId",wF()),af(dx(r),"_videoEventSessionId",wF()),af(dx(r),"_stream",void 0),af(dx(r),"_firstAudioFrameTimer",void 0),af(dx(r),"_firstVideoFrameTimer",void 0),af(dx(r),"_transportDelayInterval",void 0),af(dx(r),"_transportDelay",void 0),af(dx(r),"_firstVideoFrameInterval",void 0),af(dx(r),"_firstAudioFrameInterval",void 0),af(dx(r),"_isScreen",!1),af(dx(r),"_audioFirstFrameState",0),af(dx(r),"_videoFirstFrameState",0),af(dx(r),"_timeout",1e4),af(dx(r),"_currentAudioRecv",{startTime:0,eventSessionId:0,type:"login"}),af(dx(r),"_currentVideoRecv",{startTime:0,eventSessionId:0,type:"login"}),af(dx(r),"_login",!1),af(dx(r),"_unMuteAudio",!1),af(dx(r),"_enableAudio",!1),af(dx(r),"_unMuteVideo",!1),af(dx(r),"_enableVideo",!1),af(dx(r),"_remoteUnmuteAudio",!1),af(dx(r),"_remoteUnmuteVideo",!1),af(dx(r),"_audioExternal",!1),af(dx(r),"_pushAudio",!1),af(dx(r),"_videoExternal",!1),af(dx(r),"_pushVideo",!1),af(dx(r),"_autoSubscribeVideo",!1),af(dx(r),"_autoSubscribeAudio",!1),af(dx(r),"_autoSubscribe",!1),af(dx(r),"_publishVideo",!1),af(dx(r),"_publishAudio",!1),af(dx(r),"_subscribeAudio",!1),af(dx(r),"_subscribeVideo",!1),af(dx(r),"_subscribe",!1),af(dx(r),"_pushTrack",!1),af(dx(r),"_multiChatMode",!1),af(dx(r),"_monitor",void 0),af(dx(r),"logger",void 0),r._ctx=e,r._stream=t,r.getTransportDelay(),r._monitor=GV(t.engineId),r.logger=new dF("RecvFrameObserver",0,t.engineId),r}return nf(o,[{key:"beginRecvFrame",value:(n=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:i=this._transportDelay,o=!0,qC(n=["login","unmute","subscribe","push_track"]).call(n,r)>=0&&(i=0,o=!1),"audio"===t?(o||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},f={media_type:t,event_type:"begin_recv",type:r,is_screen:!(null===(a=this._stream)||void 0===a||!a.isScreen),start:null===(s=this._currentAudioRecv)||void 0===s?void 0:s.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(c=this._stream)||void 0===c?void 0:c.userId,transport_delay:i,vendor_mode:(null===(u=this._stream)||void 0===u?void 0:u.vendorCode)||0,pc_session_id:(null===(d=this._stream)||void 0===d?void 0:d.pcSessionId)||(null===(l=this._ctx.peerConnection)||void 0===l?void 0:l.getConnectionId()),remote_rtc_session_id:null===(h=this._stream)||void 0===h?void 0:h.remoteSessionId},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){uX(T._ctx,"audio",T._stream,T._monitor),T.stopRecvFrame("audio","timeout"),T._firstAudioFrameInterval&&window.clearInterval(T._firstAudioFrameInterval)}),this._timeout),this.logger.info("rtcFirstFrameRecv",ZS(f)),null===(p=this._monitor)||void 0===p||p.report("rtc_first_frame",f),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):"video"===t&&(o||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},k={media_type:t,event_type:"begin_recv",type:r,is_screen:!(null===(v=this._stream)||void 0===v||!v.isScreen),start:null===(_=this._currentVideoRecv)||void 0===_?void 0:_.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(m=this._stream)||void 0===m?void 0:m.userId,transport_delay:i,vendor_mode:(null===(g=this._stream)||void 0===g?void 0:g.vendorCode)||0,pc_session_id:(null===(y=this._stream)||void 0===y?void 0:y.pcSessionId)||(null===(S=this._ctx.peerConnection)||void 0===S?void 0:S.getConnectionId()),remote_rtc_session_id:null===(b=this._stream)||void 0===b?void 0:b.remoteSessionId},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){uX(T._ctx,"video",T._stream,T._monitor),T.stopRecvFrame("video","timeout"),T._firstVideoFrameInterval&&window.clearInterval(T._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),this.logger.info("rtcFirstFrameRecv",ZS(k)),null===(E=this._monitor)||void 0===E||E.report("rtc_first_frame",k),this._videoFirstFrameState=1,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"stopRecvFrame",value:function(e,t){if("audio"===e){var r,n,i,o,a,s,c,u,d;if(1!==this._audioFirstFrameState)return;var l={event_type:"recv_end",media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.startTime,reason:t,result:!1,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,event_session_id:this._audioEventSessionId,type:null===(o=this._currentAudioRecv)||void 0===o?void 0:o.type,vendor_mode:(null===(a=this._stream)||void 0===a?void 0:a.vendorCode)||0,pc_session_id:(null===(s=this._stream)||void 0===s?void 0:s.pcSessionId)||(null===(c=this._ctx.peerConnection)||void 0===c?void 0:c.getConnectionId()),remote_rtc_session_id:null===(u=this._stream)||void 0===u?void 0:u.remoteSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,this.logger.info("rtcFirstFrameRecv",ZS(l)),null===(d=this._monitor)||void 0===d||d.report("rtc_first_frame",l),this._audioFirstFrameState=2}else if("video"===e){var h,p,f,v,_,m,g,y,S;if(1!==this._videoFirstFrameState)return;var b={event_type:"recv_end",media_type:e,is_screen:!(null===(h=this._stream)||void 0===h||!h.isScreen),start:null===(p=this._currentVideoRecv)||void 0===p?void 0:p.startTime,reason:t,result:!1,stream_user_id:null===(f=this._stream)||void 0===f?void 0:f.userId,event_session_id:this._videoEventSessionId,type:null===(v=this._currentVideoRecv)||void 0===v?void 0:v.type,vendor_mode:(null===(_=this._stream)||void 0===_?void 0:_.vendorCode)||0,pc_session_id:(null===(m=this._stream)||void 0===m?void 0:m.pcSessionId)||(null===(g=this._ctx.peerConnection)||void 0===g?void 0:g.getConnectionId()),remote_rtc_session_id:null===(y=this._stream)||void 0===y?void 0:y.remoteSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,this.logger.info("rtcFirstFrameRecv",ZS(b)),null===(S=this._monitor)||void 0===S||S.report("rtc_first_frame",b),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(r=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,"audio"!==t){e.next=19;break}if(1===this._audioFirstFrameState){e.next=6;break}return e.abrupt("return");case 6:if(this._currentAudioRecv){e.next=8;break}return e.abrupt("return");case 8:l=this._currentAudioRecv,h=l.type,p=l.startTime,qC(n=["login","unmute","subscribe","push_track"]).call(n,h)>=0&&(r=0),f={event_type:"recv_end",media_type:t,start:p,result:!0,is_screen:!(null===(i=this._stream)||void 0===i||!i.isScreen),stream_user_id:null===(o=this._stream)||void 0===o?void 0:o.userId,event_session_id:this._audioEventSessionId,type:h,transport_delay:r,vendor_mode:(null===(a=this._stream)||void 0===a?void 0:a.vendorCode)||0,pc_session_id:(null===(s=this._stream)||void 0===s?void 0:s.pcSessionId)||(null===(c=this._ctx.peerConnection)||void 0===c?void 0:c.getConnectionId()),remote_rtc_session_id:null===(u=this._stream)||void 0===u?void 0:u.remoteSessionId},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this.logger.info("rtcFirstFrameRecv",ZS(f)),null===(d=this._monitor)||void 0===d||d.report("rtc_first_frame",f),this.emit("recvAudioFirstFrame"),this._audioFirstFrameState=3,e.next=33;break;case 19:if("video"!==t){e.next=33;break}if(1===this._videoFirstFrameState){e.next=22;break}return e.abrupt("return");case 22:if(this._currentVideoRecv){e.next=24;break}return e.abrupt("return");case 24:k=this._currentVideoRecv,T=k.type,I=k.startTime,qC(v=["login","unmute","subscribe","push_track"]).call(v,T)>=0&&(r=0),R={event_type:"recv_end",media_type:t,is_screen:!(null===(_=this._stream)||void 0===_||!_.isScreen),start:I,result:!0,stream_user_id:null===(m=this._stream)||void 0===m?void 0:m.userId,event_session_id:this._videoEventSessionId,type:T,transport_delay:r,vendor_mode:(null===(g=this._stream)||void 0===g?void 0:g.vendorCode)||0,pc_session_id:(null===(y=this._stream)||void 0===y?void 0:y.pcSessionId)||(null===(S=this._ctx.peerConnection)||void 0===S?void 0:S.getConnectionId()),remote_rtc_session_id:null===(b=this._stream)||void 0===b?void 0:b.remoteSessionId},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this.logger.info("rtcFirstFrameRecv",ZS(R)),null===(E=this._monitor)||void 0===E||E.report("rtc_first_frame",R),this.emit("recvVideoFirstFrame"),this._videoFirstFrameState=3;case 33:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setLogin",value:function(e){var t,r,n,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{audio:!0,video:!0};this._login!==e&&(this._login=e,e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&o.audio&&this.beginRecvFrame("audio","login"),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame("video","login"),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame("audio","leave_room"),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame("video","leave_room"))}},{key:"setUnmuteAudio",value:function(e){var t,r,n;if(this._unMuteAudio!==e){this._unMuteAudio=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasAudio);null!==(r=this._stream)&&void 0!==r&&r.audioHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.audioHasPublish&&(this._unMuteAudio&&i?this.beginRecvFrame("audio","unmute"):i&&this.stopRecvFrame("audio","mute"))}}},{key:"setRemoteUnmuteAudio",value:function(e){this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame("audio","remote_unmute"):this.stopRecvFrame("audio","remote_mute"))}},{key:"setEnableAudio",value:function(e){this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame("audio","enable"):this.stopRecvFrame("audio","disable"))}},{key:"setUnmuteVideo",value:function(e){var t,r,n;if(this._unMuteVideo!==e){this._unMuteVideo=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasVideo);null!==(r=this._stream)&&void 0!==r&&r.videoHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.videoHasPublish&&(this._unMuteVideo&&i?this.beginRecvFrame("video","unmute"):i&&this.stopRecvFrame("video","mute"))}}},{key:"setRemoteUnmuteVideo",value:function(e){this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame("video","remote_unmute"):this.stopRecvFrame("video","remote_mute"))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame("video","enable"):this.stopRecvFrame("video","disable"))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal=e}},{key:"setPushAudio",value:function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame("audio","push"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","stop_push")}},{key:"setExternalVideoSource",value:function(e){this._videoExternal=e}},{key:"setPushVideo",value:function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame("video","push"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame("video","stop_push")}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame("video","publish"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame("video","unpublish")}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame("audio","publish"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","unpublish")}},{key:"setAutoSubscribe",value:function(e){this._autoSubscribe=e}},{key:"setAutoSubscribeVideo",value:function(e){this._autoSubscribeVideo=e}},{key:"setAutoSubscribeAudio",value:function(e){this._autoSubscribeAudio=e}},{key:"setSubscribeAudio",value:function(e){var t,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasAudio&&this.beginRecvFrame("audio","subscribe")),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","unsubscribe")}},{key:"setSubscribeVideo",value:function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&this.beginRecvFrame("video","subscribe")),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame("video","unsubscribe")}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(this._pushTrack=e,e&&!this._isScreen&&this.beginRecvFrame("audio","push_track"),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame("audio","remove_track"))}},{key:"setMultiChatMode",value:function(e){this._multiChatMode=e}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"_watchForFirstVideoFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval);var n=this._ctx.peerConnection;this._firstVideoFrameInterval=window.setInterval(HS(BS().mark((function i(){var o,a,s,c,u,d,l,h;return BS().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!n||null===(o=e._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a||!a.preprocessingTrack){i.next=13;break}return d=null===(s=e._stream.videoTransceiver)||void 0===s?void 0:s.receiver,i.next=4,n.getStatsWithLowFrequency(null===(c=e._stream)||void 0===c||null===(u=c.videoTrack)||void 0===u?void 0:u.preprocessingTrack,!0,d);case 4:if(l=i.sent,!(h=DC(l).call(l,(function(e){return"inbound-rtp"===e.type})))||!(h.framesReceived>t||h.packetsReceived>r)){i.next=13;break}if(-1!==t||-1!==r){i.next=11;break}return t=h.framesReceived,r=h.packetsReceived,i.abrupt("return");case 11:e.recvFrameFinish("video"),window.clearInterval(e._firstVideoFrameInterval);case 13:case"end":return i.stop()}}),i)}))),200)}},{key:"_watchForFirstAudioFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval);var n=this._ctx.peerConnection;this._firstAudioFrameInterval=window.setInterval(HS(BS().mark((function i(){var o,a,s,c,u,d;return BS().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!n||null===(o=e._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a||!a.originTrack){i.next=12;break}return i.next=3,n.getStatsWithLowFrequency(null===(s=e._stream)||void 0===s||null===(c=s.audioTrack)||void 0===c?void 0:c.originTrack);case 3:if(u=i.sent,!(d=DC(u).call(u,(function(e){return"inbound-rtp"===e.type})))||!(d.totalSamplesReceived>t||d.packetsReceived>r)){i.next=12;break}if(-1!==t||-1!==r){i.next=10;break}return t=d.totalSamplesReceived,r=d.packetsReceived,i.abrupt("return");case 10:e.recvFrameFinish("audio"),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return i.stop()}}),i)}))),200)}},{key:"getTransportDelay",value:(t=HS(BS().mark((function e(){var t=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelayIntl();case 2:window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval(HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getTransportDelayIntl();case 2:case"end":return e.stop()}}),e)}))),2e3);case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getTransportDelayIntl",value:(e=HS(BS().mark((function e(){var t,r,n,i,o,a,s;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t=this._ctx.peerConnection)){e.next=9;break}return i=null===(r=this._stream)||void 0===r||null===(n=r.videoTransceiver)||void 0===n?void 0:n.receiver,e.next=5,t.getStatsWithLowFrequency(void 0,!0,i);case 5:o=e.sent,a=DC(o).call(o,(function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(s=DC(o).call(o,(function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==a?void 0:a.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*s.currentRoundTripTime/2));case 9:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"setDisconnect",value:function(){this.stopRecvFrame("audio","connection_lost"),this.stopRecvFrame("video","connection_lost"),this.reset()}},{key:"reset",value:function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:"login"},this._currentVideoRecv={startTime:0,eventSessionId:0,type:"login"},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)}},{key:"audioFirstFrameReceived",get:function(){return 3===this._audioFirstFrameState}},{key:"FirstFrameReceived",get:function(){return 3===this._audioFirstFrameState}}]),o}(),hX=function(){function e(t,r){of(this,e),af(this,"_audioEventSessionId",wF()),af(this,"_videoEventSessionId",wF()),af(this,"_pcSessionId",void 0),af(this,"_firstAudioFrameTimer",void 0),af(this,"_firstVideoFrameTimer",void 0),af(this,"_stream",void 0),af(this,"_firstVideoFrameInterval",void 0),af(this,"_firstAudioFrameInterval",void 0),af(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:"login"}),af(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:"login"}),af(this,"_login",!1),af(this,"_publisher",!1),af(this,"_unMuteAudio",!1),af(this,"_enableAudio",!1),af(this,"_unMuteVideo",!1),af(this,"_enableVideo",!1),af(this,"_audioExternal",!1),af(this,"_pushAudio",!1),af(this,"_videoExternal",!1),af(this,"_pushVideo",!1),af(this,"_autoPublish",!1),af(this,"_publish",!1),af(this,"_timeout",1e4),af(this,"_audioFirstFrameState",0),af(this,"_videoFirstFrameState",0),af(this,"_monitor",void 0),af(this,"logger",void 0),this._ctx=t,this._stream=r,this._monitor=GV(r.engineId),this.logger=new dF("SendFrameObserver",0,r.engineId)}var t,r;return nf(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if("audio"===e){var n,i,o,a,s,c,u;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var d={event_type:"begin_send",media_type:e,is_screen:!(null===(n=this._stream)||void 0===n||!n.isScreen),type:t,start:this._currentAudioSend.startTime,event_session_id:this._audioEventSessionId,vendor_mode:(null===(i=this._stream)||void 0===i?void 0:i.vendorCode)||0,pc_session_id:(null===(o=this._stream)||void 0===o?void 0:o.pcSessionId)||(null===(a=this._ctx.peerConnection)||void 0===a?void 0:a.getConnectionId()),capture_session_id:null===(s=this._stream)||void 0===s||null===(c=s.audioTrack)||void 0===c?void 0:c.captureSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){dX(r._ctx,"audio",r._stream,r._monitor),r.stopSendFrame("audio","timeout"),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),this.logger.info("rtcFirstFrameSend",ZS(d)),null===(u=this._monitor)||void 0===u||u.report("rtc_first_frame",d),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if("video"===e){var l,h,p,f,v,_,m;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var g={event_type:"begin_send",media_type:e,is_screen:!(null===(l=this._stream)||void 0===l||!l.isScreen),type:t,start:this._currentVideoSend.startTime,event_session_id:this._videoEventSessionId,vendor_mode:(null===(h=this._stream)||void 0===h?void 0:h.vendorCode)||0,pc_session_id:(null===(p=this._stream)||void 0===p?void 0:p.pcSessionId)||(null===(f=this._ctx.peerConnection)||void 0===f?void 0:f.getConnectionId()),capture_session_id:null===(v=this._stream)||void 0===v||null===(_=v.videoTrack)||void 0===_?void 0:_.captureSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){dX(r._ctx,"video",r._stream,r._monitor),r.stopSendFrame("video","timeout"),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),this.logger.info("rtcFirstFrameSend",ZS(g)),null===(m=this._monitor)||void 0===m||m.report("rtc_first_frame",g),this._videoFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}}},{key:"stopSendFrame",value:function(e,t){if("audio"===e){var r,n,i,o,a,s,c,u,d;if(1!==this._audioFirstFrameState)return;var l={event_type:"sent_end",media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioSend)||void 0===n?void 0:n.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioSend)||void 0===i?void 0:i.type,vendor_mode:(null===(o=this._stream)||void 0===o?void 0:o.vendorCode)||0,pc_session_id:(null===(a=this._stream)||void 0===a?void 0:a.pcSessionId)||(null===(s=this._ctx.peerConnection)||void 0===s?void 0:s.getConnectionId()),capture_session_id:null===(c=this._stream)||void 0===c||null===(u=c.audioTrack)||void 0===u?void 0:u.captureSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,this.logger.info("rtcFirstFrameSend",ZS(l)),null===(d=this._monitor)||void 0===d||d.report("rtc_first_frame",l),this._audioFirstFrameState=2}else if("video"===e){var h,p,f,v,_,m,g,y,S;if(1!==this._videoFirstFrameState)return;var b={event_type:"sent_end",media_type:e,start:null===(h=this._currentVideoSend)||void 0===h?void 0:h.startTime,is_screen:!(null===(p=this._stream)||void 0===p||!p.isScreen),reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(f=this._currentVideoSend)||void 0===f?void 0:f.type,vendor_mode:(null===(v=this._stream)||void 0===v?void 0:v.vendorCode)||0,pc_session_id:(null===(_=this._stream)||void 0===_?void 0:_.pcSessionId)||(null===(m=this._ctx.peerConnection)||void 0===m?void 0:m.getConnectionId()),capture_session_id:null===(g=this._stream)||void 0===g||null===(y=g.videoTrack)||void 0===y?void 0:y.captureSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,this.logger.info("rtcFirstFrameSend",ZS(b)),null===(S=this._monitor)||void 0===S||S.report("rtc_first_frame",b),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if("audio"===e){var t,r,n,i,o,a,s;if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var c=this._currentAudioSend,u=c.type,d=c.startTime,l={event_type:"sent_end",media_type:e,is_screen:!(null===(t=this._stream)||void 0===t||!t.isScreen),start:d,result:!0,event_session_id:this._audioEventSessionId,type:u,vendor_mode:(null===(r=this._stream)||void 0===r?void 0:r.vendorCode)||0,pc_session_id:(null===(n=this._stream)||void 0===n?void 0:n.pcSessionId)||(null===(i=this._ctx.peerConnection)||void 0===i?void 0:i.getConnectionId()),capture_session_id:null===(o=this._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a?void 0:a.captureSessionId};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this.logger.info("rtcFirstFrameSend",ZS(l)),null===(s=this._monitor)||void 0===s||s.report("rtc_first_frame",l),this._audioFirstFrameState=3}else if("video"===e){var h,p,f,v,_,m,g;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var y=this._currentVideoSend,S=y.type,b=y.startTime,E={event_type:"sent_end",media_type:e,is_screen:!(null===(h=this._stream)||void 0===h||!h.isScreen),start:b,result:!0,event_session_id:this._videoEventSessionId,type:S,vendor_mode:(null===(p=this._stream)||void 0===p?void 0:p.vendorCode)||0,pc_session_id:(null===(f=this._stream)||void 0===f?void 0:f.pcSessionId)||(null===(v=this._ctx.peerConnection)||void 0===v?void 0:v.getConnectionId()),capture_session_id:null===(_=this._stream)||void 0===_||null===(m=_.videoTrack)||void 0===m?void 0:m.captureSessionId};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this.logger.info("rtcFirstFrameSend",ZS(E)),null===(g=this._monitor)||void 0===g||g.report("rtc_first_frame",E),this._videoFirstFrameState=3}}},{key:"setLogin",value:function(e){var t,r;this._login!==e&&(this._login=e,e&&(null!==(t=this._stream)&&void 0!==t&&t.videoTrack&&this._stream.pubVideo&&this.beginSendFrame("video","login"),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this._stream.pubAudio&&this.beginSendFrame("audio","login")),!e&&this._audioSending&&this.stopSendFrame("audio","leave_room"),!e&&this._videoSending&&this.stopSendFrame("video","leave_room"))}},{key:"setPublish",value:function(e){var t,r;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this._stream.pubVideo&&this.beginSendFrame("video","publish"),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this._stream.pubAudio&&this.beginSendFrame("audio","publish")),!e&&this._audioSending&&this.stopSendFrame("audio","unpublish"),!e&&this._videoSending&&this.stopSendFrame("video","unpublish"))}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,null!==(t=this._stream)&&void 0!==t&&t.audioHasCapture&&(e&&this.beginSendFrame("audio","unmute"),!e&&this._audioSending&&this.stopSendFrame("audio","mute")))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubAudio&&(this._enableAudio=e,e&&this.beginSendFrame("audio","enable"),!e&&this._audioSending&&this.stopSendFrame("audio","disable"))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,null!==(t=this._stream)&&void 0!==t&&t.videoHasCapture&&(e&&this.beginSendFrame("video","unmute"),!e&&this._videoSending&&this.stopSendFrame("video","mute")))}},{key:"setEnableVideo",value:function(e){var t;this._enableVideo!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubVideo&&(this._enableVideo=e,e&&this.beginSendFrame("video","enable"),!e&&this._videoSending&&this.stopSendFrame("video","disable"))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame("audio","push"),!e&&this._audioSending&&this.stopSendFrame("audio","stop_push"))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame("video","push"),!e&&this._videoSending&&this.stopSendFrame("video","stop_push"))}},{key:"setAutoPublish",value:function(e){this._autoPublish=e}},{key:"setPublisher",value:function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame("audio","audience"),!e&&this._videoSending&&this.stopSendFrame("video","audience"))}},{key:"setDisconnect",value:function(){this._audioSending&&this.stopSendFrame("audio","connection_lost"),this._videoSending&&this.stopSendFrame("video","connection_lost"),this.reset()}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"setPCSessionId",value:function(e){this._pcSessionId=e}},{key:"_getFirstVideoFrameStats",value:(r=HS(BS().mark((function e(){var t,r,n,i,o,a,s,c;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null===(t=this._stream)||void 0===t||null===(r=t.videoTrack)||void 0===r?void 0:r.preprocessingTrack,a=null===(n=this._stream)||void 0===n||null===(i=n.videoTransceiver)||void 0===i?void 0:i.sender,!this._ctx.peerConnection||!o){e.next=8;break}return e.next=5,this._ctx.peerConnection.getStatsWithLowFrequency(o,!0,a);case 5:return s=e.sent,c=Wb(s).call(s,(function(e){return"outbound-rtp"===e.type})),e.abrupt("return",c);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=HS(BS().mark((function e(){var t,r,n,i,o,a,s;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null===(t=this._stream)||void 0===t||null===(r=t.audioTrack)||void 0===r?void 0:r.preprocessingTrack,a=null===(n=this._stream)||void 0===n||null===(i=n.audioTransceiver)||void 0===i?void 0:i.sender,!this._ctx.peerConnection||!o){e.next=7;break}return e.next=5,this._ctx.peerConnection.getStatsWithLowFrequency(o,!0,a);case 5:return s=e.sent,e.abrupt("return",DC(s).call(s,(function(e){return"outbound-rtp"===e.type})));case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(HS(BS().mark((function n(){var i,o,a;return BS().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e._getFirstVideoFrameStats();case 2:if(i=n.sent,o=0,a=0,null==i||ob(i).call(i,(function(e){o+=e.framesSent,a+=e.packetsSent})),!(i&&i.length>0&&(o>t||a>r))){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=o,r=a,n.abrupt("return");case 10:e.sendFrameFinish("video"),window.clearInterval(e._firstVideoFrameInterval);case 12:case"end":return n.stop()}}),n)}))),100)}},{key:"_watchForFirstAudioFrameSend",value:function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(HS(BS().mark((function r(){var n;return BS().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e._getFirstAudioFrameStats();case 2:if(!((n=r.sent)&&n.packetsSent>t)){r.next=9;break}if(-1!==t){r.next=7;break}return t=n.packetsSent,r.abrupt("return");case 7:e.sendFrameFinish("audio"),window.clearInterval(e._firstAudioFrameInterval);case 9:case"end":return r.stop()}}),r)}))),100)}},{key:"reset",value:function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=0,this._videoFirstFrameState=0,this._currentAudioSend={startTime:0,eventSessionId:0,type:"login"},this._currentVideoSend={startTime:0,eventSessionId:0,type:"login"},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)}},{key:"destroy",value:function(){this.reset(),delete this._stream}},{key:"_audioSending",get:function(){return 1===this._audioFirstFrameState}},{key:"_videoSending",get:function(){return 1===this._videoFirstFrameState}}]),e}(),pX=(af(tX={},"audio",{delay:1200,stallRadio:.3}),af(tX,"video",{delay:1200,stallRadio:.6}),af(tX,"screen_audio",{delay:1600,stallRadio:.8}),af(tX,"screen_video",{delay:1600,stallRadio:.8}),tX),fX=function(){function e(t){of(this,e),af(this,"_preUplinkStats",new DR),af(this,"_preDownlinkStats",new DR),af(this,"_timer",void 0),af(this,"_delayTimer",void 0),af(this,"reportor",void 0),this._ctx=t}return nf(e,[{key:"updateUplinkStats",value:function(e,t){var r=e.audioStats,n=e.videoStats,i=e.isScreen;if(r.sendKBitrate>0&&r.rtt){var o,a,s=i?"screen_audio":"audio",c=r.rtt,u=r._fractionLost,d=r._retransmittedRate,l=this._getQosLevel(c,u||0,d||0),h=this._preUplinkStats.get(s)||[l];this._preUplinkStats.set(s,LC(o=JS(a=[]).call(a,jw(h),[l])).call(o,-2))}if(n.sentKBitrate>0&&n.rtt){var p,f,v=i?"screen_video":"video",_=n._fractionLost,m=n.rtt,g=n._sendBandWidth,y=n._retransmittedRate;0===g&&(_=Math.max(.65,_));var S=this._getQosLevel(m,_||0,y||0),b=this._getUplinkVideoQoE(e,t),E=this._getVideoUplinkNetworkQuality(S,b),k=this._preUplinkStats.get(v)||[E];this._preUplinkStats.set(v,LC(p=JS(f=[]).call(f,jw(k),[E])).call(p,-2))}this._startNetworkQualityReport()}},{key:"updateDownlinkStats",value:function(e,t){var r;if(t){var n,i,o=this._getStreamActiveState(t),a=o.audioActive,s=o.videoActive,c=e.audioStats,u=e.videoStats,d=e.isScreen,l=e.userId,h=!0,p=!0;if(a)if(0===c.receivedKBitrate)h=!1;else{var f=c.rtt,v=c.audioLossRate,_=c.stallDuration,m=c.statsInterval,g=c.e2eDelay,y=_/m,S=d?"screen_audio":"audio",b=this._getQosLevel(f,v||0,u._retransmittedRate||0),E=this._getDownlinkQoE(S,y,g);n=this._getNetworkQuality(b,E)}if(s)if(0===u.receivedKBitrate||0===u.rtt)p=!1;else{var k=u.rtt,T=u.videoLossRate,I=u.stallDuration,R=u.statsInterval,C=u.e2eDelay,w=u._retransmittedRate,A=I/R,x=d?"screen_video":"video",O=this._getQosLevel(k,T||0,w||0),P=this._getDownlinkQoE(x,A,C);i=this._getNetworkQuality(O,P)}var N=JS(r="".concat(l)).call(r,d?"_screen":"");if(h||p){var M=n&&i?Math.ceil((n+i)/2):n||i;if(M){var D,L,U=this._preDownlinkStats.get(N)||[M];this._preDownlinkStats.set(N,LC(D=JS(L=[]).call(L,jw(U),[M])).call(D,-2)),this._startNetworkQualityReport()}}else this._preDownlinkStats.delete(N)}}},{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()}},{key:"_startNetworkQualityReport",value:function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))}},{key:"_reportNetworkQuality",value:function(){var e,t,r,n,i=this;if(vE(e=["connected","connecting"]).call(e,null===(t=this._ctx.handler)||void 0===t?void 0:t.getConnectionState())){var o,a,s,c=this._getBetterQualityAndRemoveOldest("audio","up"),u=this._getBetterQualityAndRemoveOldest("video","up");r=c&&u?Math.ceil((c+u)/2):c||u||this._getBetterQualityAndRemoveOldest("screen_video","up")||this._getBetterQualityAndRemoveOldest("screen_audio","up")||jP.EXCELLENT;var d=Wb(o=ob(a=CN(ZN(s=this._preDownlinkStats).call(s))).call(a,(function(e){return i._getBetterQualityAndRemoveOldest(e,"down")}))).call(o,(function(e){return e}));n=Math.ceil(wE(d).call(d,(function(e,t){return t+e}),0)/d.length)||jP.UNKNOWN}else r=n=jP.DOWN;navigator.onLine||(r=jP.DOWN,n=jP.DOWN),"function"==typeof this.reportor&&this.reportor(r,n)}},{key:"_getNetworkQuality",value:function(e,t){return 1===t?Math.max(e-2,1):2===t?e:Math.min(e+1,5)}},{key:"_getVideoUplinkNetworkQuality",value:function(e,t){return 1===t||0===t?e:2===t?Math.min(e+1,5):Math.min(e+2,5)}},{key:"_getQosLevel",value:function(e,t,r){var n;return n=(!e||e<=250)&&t<=.15?1:(!e||e<=500)&&t<=.3?2:(!e||e<=750)&&t<=.45?3:(!e||e<=1e3)&&t<=.6?4:5,r>.5?n=Math.max(n,4):r>.35?n=Math.max(n,3):r>.15&&(n=Math.max(n,2)),n}},{key:"_getUplinkQoE",value:function(e,t){var r=0;switch(e){case"audio":case"video":r=t<.05?1:t<.1?2:3;break;case"screen_video":case"screen_audio":r=t<.04?1:t<.08?2:3}return r}},{key:"_getUplinkVideoQoE",value:function(e,t){var r,n=(null==e||null===(r=e.videoStats)||void 0===r?void 0:r.rid)||"0";if(!t)return 0;var i=t.pubAttributes.videoDescriptions[n],o=e.videoStats,a=o.encodedFrameWidth*o.encodedFrameHeight/(i.width*i.height),s=o.sentFrameRate/i.framerate,c=0,u=0;return"number"!=typeof a||Number.isNaN(a)||(c=a>=.9?1:a<.9&&a>=.8?2:3),"number"!=typeof s||Number.isNaN(s)||(u=s>=.8?1:s<.8&&s>=.6?2:3),Math.max(0,c,u)}},{key:"_getDownlinkQoE",value:function(e,t,r){var n=pX[e];return t>n.stallRadio||r>n.delay||t>n.stallRadio/2&&r>n.delay/2?3:(t>n.stallRadio/2||n.delay,2)}},{key:"_getBetterQualityAndRemoveOldest",value:function(e,t){var r=jP.UNKNOWN,n="up"===t?this._preUplinkStats:this._preDownlinkStats,i=n.get(e);if(i){var o=Wb(i).call(i,(function(e){return e}));o.length>0&&(r=Math.min.apply(Math,jw(o))),i.shift(),0===i.length&&n.delete(e)}return r}},{key:"_getStreamActiveState",value:function(e){var t=e.subMediaType,r=e._attributes,n=e.subVideo;return{audioActive:e.subAudio&&MF(t)&&r.localaudio&&r.audiostream,videoActive:n&&DF(t)&&r.localvideo&&r.videostream}}}]),e}(),vX=function(){function e(t){of(this,e),af(this,"_timer",void 0),af(this,"_remoteVideoSizeCache",{}),af(this,"_remoteScreenSizeCache",{}),af(this,"onchange",void 0),this._room=t,this._start()}return nf(e,[{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}}},{key:"_start",value:function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},r={};e._room.remoteStreams.forEach((function(n,i){n.forEach((function(n){var o,a=null===(o=n.videoTrack)||void 0===o?void 0:o.preprocessingTrack;if(a){var s=n.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[i]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,p=0,f=0;if(rB){var v,_,m=null!==(v=null==n||null===(_=n.videoTrack)||void 0===_?void 0:_.getSizeByPlayer())&&void 0!==v?v:{width:0,height:0};p=m.width,f=m.height}else{var g=a.getSettings();p=g.width||0,f=g.height||0}h===f&&d===p||"function"==typeof e.onchange&&e.onchange(i,n.isScreen,p,f),delete s[i],(n.isScreen?r:t)[i]={width:p,height:f}}}))})),ck(e._remoteVideoSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!1,0,0)})),ck(e._remoteScreenSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))}}]),e}(),_X=CN((new TextEncoder).encode("subt")),mX={1:_P.SUBTITLE_ERR_POSTPROCESS,2:_P.SUBTITLE_ERR_CONNECTION_ERROR,3:_P.SUBTITLE_ERR_PROCESS_ERROR},gX=new dF("SubtitleTool",1),yX=function(e){if(e.extraInfo)try{var t,r=JSON.parse(e.extraInfo);r.source_language&&qC(t=["zh","en","ja"]).call(t,r.source_language)}catch(e){}else{var n,i,o=(null===(n=navigator.language)||void 0===n?void 0:n.substring(0,2))||"";qC(i=["zh","en","ja"]).call(i,o)>-1&&(e.extraInfo=ZS({source_language:o}))}},SX=function(){function e(t,r){of(this,e),af(this,"_taskId",void 0),af(this,"_sourceLanguage","zh"),af(this,"_updating",!1),af(this,"onEvent",void 0),af(this,"onMessage",void 0),af(this,"_preConfig",void 0),af(this,"_timer",void 0),this._ctx=t,this._roomConf=r;var n=r.userInfo.extraInfo;if(n)try{var i=JSON.parse(n);i.source_language&&(this._sourceLanguage=i.source_language)}catch(e){}}var t,r,n,i;return nf(e,[{key:"start",value:(i=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(gX.info("start","Invoke config: %o",t),nj(t.mode,"mode",[JP.ASR_ONLY,JP.ASR_AND_TRANSLATION]),r=Array.isArray(t.targetLanguage)?t.targetLanguage:[t.targetLanguage||""],!(t.mode===JP.ASR_AND_TRANSLATION&&$O(r).call(r,(function(e){return-1===qC(EX).call(EX,e)}))>-1)){e.next=5;break}throw new rN(_P.INVALID_PARAMS,"Invalid targetLanguage.");case 5:if(!this._taskId){e.next=7;break}throw new rN(_P.SUBTITLE_ALREADY_ON,"Already turned on subtitle");case 7:return this._preConfig={targetLanguage:r,mode:t.mode},this._taskId=(Date.now().toString()+this._roomConf.roomId+this._roomConf.userId).substring(0,20),e.next=11,this._sendSubtitleSignalingWithRetry(t,this._taskId);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"update",value:(n=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(gX.info("update","Invoke config: %o",t),this._taskId){e.next=3;break}throw new rN(_P.SUBTITLE_NOT_TURNED_ON,"Start subtitle first.");case 3:return this._sourceLanguage=t.sourceLanguage,this._updating=!0,e.prev=5,e.next=8,this._ctx.signalingManager.sendSignaling("controlMessage",this._genChangeSubtitleLanguageSignaling(t,this._taskId));case 8:e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(5),this._updating=!1,e.t0;case 14:case"end":return e.stop()}}),e,this,[[5,10]])}))),function(e){return n.apply(this,arguments)})},{key:"stop",value:function(){var e=this;gX.info("stop","Invoke"),this._taskId&&this._ctx.signalingManager.sendSignaling("controlMessage",{type:"subtitle",action:"stopped",appId:this._ctx.appId,roomId:this._roomConf.roomId,userId:this._roomConf.userId,taskId:this._taskId}).finally((function(){var t;delete e._taskId,null===(t=e.onEvent)||void 0===t||t.call(e,{event:qP.STOPPED}),e._clearTimer()}))}},{key:"reconnect",value:(r=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._taskId||!this._preConfig){e.next=5;break}return e.next=3,this._ctx.signalingManager.sendSignaling("controlMessage",{type:"subtitle",action:"stopped",appId:this._ctx.appId,roomId:this._roomConf.roomId,userId:this._roomConf.userId,taskId:this._taskId});case 3:delete this._taskId,this.start(this._preConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getConfig",value:function(){return this._preConfig}},{key:"destroy",value:function(){gX.info("destroy","Invoke"),this.stop(),delete this._preConfig,delete this._taskId}},{key:"onResult",value:function(e){var t=e.body,r=t.error,n=t.errorMessage,i=t.eventType;if(0!==r){var o,a=new rN(mX[r]||_P.SUBTITLE_ERR_UNKNOWN,n||"");null===(o=this.onEvent)||void 0===o||o.call(this,{event:qP.ERROR,errorCode:a.code,errorMessage:a.message}),this._clearTimer()}else if("SubtitleStarted"===i){var s;null===(s=this.onEvent)||void 0===s||s.call(this,{event:qP.STARTED}),this._clearTimer()}else if(this._updating&&"LanguageChanged"===i){var c;this._updating=!1,null===(c=this.onEvent)||void 0===c||c.call(this,{event:qP.UPDATED})}}},{key:"onMessageRecv",value:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]||this._taskId&&this._preConfig){var t=bX(e);if(!t||0===t.length)return!1;if(this._taskId&&this._preConfig){var r,n=this._preConfig,i=n.mode,o=n.targetLanguage,a=[];t.forEach((function(e){if(i===JP.ASR_ONLY)e.mode===i&&a.push(e);else{var t=vE(o).call(o,e.language);(t||e.mode===JP.ASR_ONLY)&&a.push(e),e.mode===JP.ASR_ONLY&&t&&a.push(ux(ux({},e),{},{mode:JP.ASR_AND_TRANSLATION}))}})),a.length>0&&(null===(r=this.onMessage)||void 0===r||r.call(this,a))}return!0}return!1}},{key:"_sendSubtitleSignalingWithRetry",value:(t=HS(BS().mark((function t(r,n){var i,o=this,a=arguments;return BS().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=a.length>2&&void 0!==a[2]?a[2]:0,t.next=3,this._ctx.signalingManager.sendSignaling("controlMessage",this._genSubtitleSignaling(r,n));case 3:this._timer=self.setTimeout((function(){var e;2===i?(null===(e=o.onEvent)||void 0===e||e.call(o,{event:qP.ERROR,errorCode:_P.TIME_OUT,errorMessage:"start subtitle timeout."}),delete o._timer,o.stop()):o._sendSubtitleSignalingWithRetry(r,n,i+1)}),e.retryIntervel);case 4:case"end":return t.stop()}}),t,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"_genSubtitleSignaling",value:function(e,t){return{taskId:t,type:"subtitle",action:"started",roomId:this._roomConf.roomId,appId:this._ctx.appId,userId:this._roomConf.userId,subtitleMeta:{subtitleConfig:{mode:e.mode,usersConfig:[{userId:this._roomConf.userId,targetLanguages:Array.isArray(e.targetLanguage)?e.targetLanguage:[e.targetLanguage||""]}]},vendorConfig:{type:0}}}}},{key:"_genChangeSubtitleLanguageSignaling",value:function(e,t){return{taskId:t,type:"subtitle",action:"subtitleUpdated",roomId:this._roomConf.roomId,appId:this._ctx.appId,userId:this._roomConf.userId,subtitleMeta:{protocol:1,languageConfig:{sourceLanguages:[{userId:this._roomConf.userId,languageCode:[e.sourceLanguage]}]}}}}},{key:"_clearTimer",value:function(){this._timer&&(self.clearTimeout(this._timer),delete this._timer)}}]),e}();af(SX,"retryIntervel",3e4);var bX=function(e){var t=e.message;if(t instanceof ArrayBuffer&&t.byteLength>8)try{var r=new DataView(t,0),n=0;if(_X.every((function(e){return r.getUint8(n++)===e}))){var i=r.getUint32(n);if(n+=4,i===r.byteLength-8){var o=IF.ab2str(LC(t).call(t,8)),a=JSON.parse(o),s=a.data;if("subtitle"===a.type)return s}}}catch(e){}return!1},EX=["zh","zh-Hant","tn","vi","iu","it","id","hi","en","ho","he","es","el","uk","ur","tk","tr","ti","ty","tl","to","th","ta","te","sl","sk","ss","eo","sm","sg","st","sv","ja","tw","qu","pt","pa","no","nb","nr","my","bn","mn","mh","mk","ml","mr","ms","lu","ro","lt","lv","lo","kj","hr","kn","ki","cs","ca","nl","ko","ht","gu","ka","kl","km","lg","kg","fi","fj","fr","ru","ng","de","tt","da","ts","cv","fa","bs","pl","bi","nd","ba","bg","az","ar","af","sq","ab","os","ee","et","ay","lzh","am","ckb","cy","gl","ha","hy","ig","kmr","ln","nso","ny","om","sn","so","sr","sw","xh","yo","zu"],kX=function(e){return e[e.AUTOPLAY_FAILED=-1e3]="AUTOPLAY_FAILED",e[e.TRACK_ERROR=-1001]="TRACK_ERROR",e[e.Fetch_MODIFY=-1002]="Fetch_MODIFY",e[e.BLACK_BROWSER=-1003]="BLACK_BROWSER",e[e.DC_SEND_ERROR=-1004]="DC_SEND_ERROR",e[e.DUPLICATE_DOM=-1005]="DUPLICATE_DOM",e}(kX||{}),TX="object"==typeof global&&global&&global.Object===Object&&global,IX="object"==typeof self&&self&&self.Object===Object&&self,RX=TX||IX||Function("return this")(),CX=RX.Symbol,wX=Object.prototype,AX=wX.hasOwnProperty,xX=wX.toString,OX=CX?CX.toStringTag:void 0;var PX=Object.prototype.toString;var NX="[object Null]",MX="[object Undefined]",DX=CX?CX.toStringTag:void 0;function LX(e){return null==e?void 0===e?MX:NX:DX&&DX in Object(e)?function(e){var t=AX.call(e,OX),r=e[OX];try{e[OX]=void 0;var n=!0}catch(e){}var i=xX.call(e);return n&&(t?e[OX]=r:delete e[OX]),i}(e):function(e){return PX.call(e)}(e)}function UX(e){return null!=e&&"object"==typeof e}var VX="[object Symbol]";function FX(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var BX=Array.isArray,jX=1/0,HX=CX?CX.prototype:void 0,zX=HX?HX.toString:void 0;function GX(e){if("string"==typeof e)return e;if(BX(e))return FX(e,GX)+"";if(function(e){return"symbol"==typeof e||UX(e)&&LX(e)==VX}(e))return zX?zX.call(e):"";var t=e+"";return"0"==t&&1/e==-jX?"-0":t}function WX(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function KX(e){return e}var XX="[object AsyncFunction]",JX="[object Function]",qX="[object GeneratorFunction]",YX="[object Proxy]";function QX(e){if(!WX(e))return!1;var t=LX(e);return t==JX||t==qX||t==XX||t==YX}var ZX=RX["__core-js_shared__"],$X=function(){var e=/[^.]+$/.exec(ZX&&ZX.keys&&ZX.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var eJ=Function.prototype.toString;function tJ(e){if(null!=e){try{return eJ.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var rJ=/^\[object .+?Constructor\]$/,nJ=Function.prototype,iJ=Object.prototype,oJ=nJ.toString,aJ=iJ.hasOwnProperty,sJ=RegExp("^"+oJ.call(aJ).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function cJ(e){return!(!WX(e)||function(e){return!!$X&&$X in e}(e))&&(QX(e)?sJ:rJ).test(tJ(e))}function uJ(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return cJ(r)?r:void 0}var dJ=uJ(RX,"WeakMap"),lJ=Object.create,hJ=function(){function e(){}return function(t){if(!WX(t))return{};if(lJ)return lJ(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),pJ=hJ;var fJ=Date.now;function vJ(e){return function(){return e}}var _J=function(){try{var e=uJ(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),mJ=_J,gJ=mJ?function(e,t){return mJ(e,"toString",{configurable:!0,enumerable:!1,value:vJ(t),writable:!0})}:KX,yJ=function(e){var t=0,r=0;return function(){var n=fJ(),i=16-(n-r);if(r=n,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(gJ),SJ=yJ;var bJ=9007199254740991,EJ=/^(?:0|[1-9]\d*)$/;function kJ(e,t){var r=typeof e;return!!(t=null==t?bJ:t)&&("number"==r||"symbol"!=r&&EJ.test(e))&&e>-1&&e%1==0&&e<t}function TJ(e,t,r){"__proto__"==t&&mJ?mJ(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function IJ(e,t){return e===t||e!=e&&t!=t}var RJ=Object.prototype.hasOwnProperty;function CJ(e,t,r){var n=e[t];RJ.call(e,t)&&IJ(n,r)&&(void 0!==r||t in e)||TJ(e,t,r)}var wJ=Math.max;function AJ(e,t){return SJ(function(e,t,r){return t=wJ(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=wJ(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}(e,this,s)}}(e,t,KX),e+"")}var xJ=9007199254740991;function OJ(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=xJ}function PJ(e){return null!=e&&OJ(e.length)&&!QX(e)}var NJ=Object.prototype;function MJ(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||NJ)}function DJ(e){return UX(e)&&"[object Arguments]"==LX(e)}var LJ=Object.prototype,UJ=LJ.hasOwnProperty,VJ=LJ.propertyIsEnumerable,FJ=DJ(function(){return arguments}())?DJ:function(e){return UX(e)&&UJ.call(e,"callee")&&!VJ.call(e,"callee")},BJ=FJ;var jJ="object"==typeof exports&&exports&&!exports.nodeType&&exports,HJ=jJ&&"object"==typeof module&&module&&!module.nodeType&&module,zJ=HJ&&HJ.exports===jJ?RX.Buffer:void 0,GJ=(zJ?zJ.isBuffer:void 0)||function(){return!1},WJ={};function KJ(e){return function(t){return e(t)}}WJ["[object Float32Array]"]=WJ["[object Float64Array]"]=WJ["[object Int8Array]"]=WJ["[object Int16Array]"]=WJ["[object Int32Array]"]=WJ["[object Uint8Array]"]=WJ["[object Uint8ClampedArray]"]=WJ["[object Uint16Array]"]=WJ["[object Uint32Array]"]=!0,WJ["[object Arguments]"]=WJ["[object Array]"]=WJ["[object ArrayBuffer]"]=WJ["[object Boolean]"]=WJ["[object DataView]"]=WJ["[object Date]"]=WJ["[object Error]"]=WJ["[object Function]"]=WJ["[object Map]"]=WJ["[object Number]"]=WJ["[object Object]"]=WJ["[object RegExp]"]=WJ["[object Set]"]=WJ["[object String]"]=WJ["[object WeakMap]"]=!1;var XJ="object"==typeof exports&&exports&&!exports.nodeType&&exports,JJ=XJ&&"object"==typeof module&&module&&!module.nodeType&&module,qJ=JJ&&JJ.exports===XJ&&TX.process,YJ=function(){try{return JJ&&JJ.require&&JJ.require("util").types||qJ&&qJ.binding&&qJ.binding("util")}catch(e){}}(),QJ=YJ&&YJ.isTypedArray,ZJ=QJ?KJ(QJ):function(e){return UX(e)&&OJ(e.length)&&!!WJ[LX(e)]},$J=ZJ,eq=Object.prototype.hasOwnProperty;function tq(e,t){var r=BX(e),n=!r&&BJ(e),i=!r&&!n&&GJ(e),o=!r&&!n&&!i&&$J(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!eq.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||kJ(u,c))||s.push(u);return s}function rq(e,t){return function(r){return e(t(r))}}var nq=rq(Object.keys,Object),iq=Object.prototype.hasOwnProperty;function oq(e){return PJ(e)?tq(e):function(e){if(!MJ(e))return nq(e);var t=[];for(var r in Object(e))iq.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var aq=Object.prototype.hasOwnProperty;function sq(e){if(!WX(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=MJ(e),r=[];for(var n in e)("constructor"!=n||!t&&aq.call(e,n))&&r.push(n);return r}var cq=function(e){return AJ((function(t,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,a&&function(e,t,r){if(!WX(r))return!1;var n=typeof t;return!!("number"==n?PJ(r)&&kJ(t,r.length):"string"==n&&t in r)&&IJ(r[t],e)}(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var s=r[n];s&&e(t,s,n,o)}return t}))}((function(e,t){!function(e,t,r){var n=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var a=t[i],s=void 0;void 0===s&&(s=e[a]),n?TJ(r,a,s):CJ(r,a,s)}}(t,function(e){return PJ(e)?tq(e,!0):sq(e)}(t),e)})),uq=cq,dq=uJ(Object,"create");var lq=Object.prototype.hasOwnProperty;var hq=Object.prototype.hasOwnProperty;function pq(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function fq(e,t){for(var r=e.length;r--;)if(IJ(e[r][0],t))return r;return-1}pq.prototype.clear=function(){this.__data__=dq?dq(null):{},this.size=0},pq.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},pq.prototype.get=function(e){var t=this.__data__;if(dq){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return lq.call(t,e)?t[e]:void 0},pq.prototype.has=function(e){var t=this.__data__;return dq?void 0!==t[e]:hq.call(t,e)},pq.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=dq&&void 0===t?"__lodash_hash_undefined__":t,this};var vq=Array.prototype.splice;function _q(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}_q.prototype.clear=function(){this.__data__=[],this.size=0},_q.prototype.delete=function(e){var t=this.__data__,r=fq(t,e);return!(r<0||(r==t.length-1?t.pop():vq.call(t,r,1),--this.size,0))},_q.prototype.get=function(e){var t=this.__data__,r=fq(t,e);return r<0?void 0:t[r][1]},_q.prototype.has=function(e){return fq(this.__data__,e)>-1},_q.prototype.set=function(e,t){var r=this.__data__,n=fq(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var mq=uJ(RX,"Map");function gq(e,t){var r=e.__data__;return function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?r["string"==typeof t?"string":"hash"]:r.map}function yq(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Sq(e){return null==e?"":GX(e)}yq.prototype.clear=function(){this.size=0,this.__data__={hash:new pq,map:new(mq||_q),string:new pq}},yq.prototype.delete=function(e){var t=gq(this,e).delete(e);return this.size-=t?1:0,t},yq.prototype.get=function(e){return gq(this,e).get(e)},yq.prototype.has=function(e){return gq(this,e).has(e)},yq.prototype.set=function(e,t){var r=gq(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};var bq=rq(Object.getPrototypeOf,Object);var Eq=function(e){return function(t){return null==e?void 0:e[t]}}({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),kq=Eq,Tq=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Iq=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var Rq=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var Cq=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var wq="\\ud800-\\udfff",Aq="\\u2700-\\u27bf",xq="a-z\\xdf-\\xf6\\xf8-\\xff",Oq="A-Z\\xc0-\\xd6\\xd8-\\xde",Pq="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Nq="["+Pq+"]",Mq="\\d+",Dq="["+Aq+"]",Lq="["+xq+"]",Uq="[^"+wq+Pq+Mq+Aq+xq+Oq+"]",Vq="(?:\\ud83c[\\udde6-\\uddff]){2}",Fq="[\\ud800-\\udbff][\\udc00-\\udfff]",Bq="["+Oq+"]",jq="(?:"+Lq+"|"+Uq+")",Hq="(?:"+Bq+"|"+Uq+")",zq="(?:['’](?:d|ll|m|re|s|t|ve))?",Gq="(?:['’](?:D|LL|M|RE|S|T|VE))?",Wq="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",Kq="[\\ufe0e\\ufe0f]?",Xq=Kq+Wq+("(?:\\u200d(?:"+["[^"+wq+"]",Vq,Fq].join("|")+")"+Kq+Wq+")*"),Jq="(?:"+[Dq,Vq,Fq].join("|")+")"+Xq,qq=RegExp([Bq+"?"+Lq+"+"+zq+"(?="+[Nq,Bq,"$"].join("|")+")",Hq+"+"+Gq+"(?="+[Nq,Bq+jq,"$"].join("|")+")",Bq+"?"+jq+"+"+zq,Bq+"+"+Gq,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Mq,Jq].join("|"),"g");function Yq(e,t,r){return e=Sq(e),void 0===t?function(e){return Cq.test(e)}(e)?function(e){return e.match(qq)||[]}(e):function(e){return e.match(Rq)||[]}(e):e.match(t)||[]}var Qq=RegExp("['’]","g");function Zq(e){var t=this.__data__=new _q(e);this.size=t.size}Zq.prototype.clear=function(){this.__data__=new _q,this.size=0},Zq.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Zq.prototype.get=function(e){return this.__data__.get(e)},Zq.prototype.has=function(e){return this.__data__.has(e)},Zq.prototype.set=function(e,t){var r=this.__data__;if(r instanceof _q){var n=r.__data__;if(!mq||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new yq(n)}return r.set(e,t),this.size=r.size,this};var $q="object"==typeof exports&&exports&&!exports.nodeType&&exports,eY=$q&&"object"==typeof module&&module&&!module.nodeType&&module,tY=eY&&eY.exports===$q?RX.Buffer:void 0;tY&&tY.allocUnsafe;var rY=Object.prototype.propertyIsEnumerable,nY=Object.getOwnPropertySymbols,iY=nY?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}(nY(e),(function(t){return rY.call(e,t)})))}:function(){return[]},oY=iY;function aY(e){return function(e,t,r){var n=t(e);return BX(e)?n:function(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}(n,r(e))}(e,oq,oY)}var sY=uJ(RX,"DataView"),cY=uJ(RX,"Promise"),uY=uJ(RX,"Set"),dY="[object Map]",lY="[object Promise]",hY="[object Set]",pY="[object WeakMap]",fY="[object DataView]",vY=tJ(sY),_Y=tJ(mq),mY=tJ(cY),gY=tJ(uY),yY=tJ(dJ),SY=LX;(sY&&SY(new sY(new ArrayBuffer(1)))!=fY||mq&&SY(new mq)!=dY||cY&&SY(cY.resolve())!=lY||uY&&SY(new uY)!=hY||dJ&&SY(new dJ)!=pY)&&(SY=function(e){var t=LX(e),r="[object Object]"==t?e.constructor:void 0,n=r?tJ(r):"";if(n)switch(n){case vY:return fY;case _Y:return dY;case mY:return lY;case gY:return hY;case yY:return pY}return t});var bY=SY,EY=Object.prototype.hasOwnProperty;var kY=RX.Uint8Array;function TY(e){var t=new e.constructor(e.byteLength);return new kY(t).set(new kY(e)),t}var IY=/\w*$/;var RY=CX?CX.prototype:void 0,CY=RY?RY.valueOf:void 0;var wY="[object Boolean]",AY="[object Date]",xY="[object Map]",OY="[object Number]",PY="[object RegExp]",NY="[object Set]",MY="[object String]",DY="[object Symbol]",LY="[object ArrayBuffer]",UY="[object DataView]",VY="[object Float32Array]",FY="[object Float64Array]",BY="[object Int8Array]",jY="[object Int16Array]",HY="[object Int32Array]",zY="[object Uint8Array]",GY="[object Uint8ClampedArray]",WY="[object Uint16Array]",KY="[object Uint32Array]";function XY(e,t,r){var n=e.constructor;switch(t){case LY:return TY(e);case wY:case AY:return new n(+e);case UY:return function(e){var t=TY(e.buffer);return new e.constructor(t,e.byteOffset,e.byteLength)}(e);case VY:case FY:case BY:case jY:case HY:case zY:case GY:case WY:case KY:return function(e){var t=TY(e.buffer);return new e.constructor(t,e.byteOffset,e.length)}(e);case xY:return new n;case OY:case MY:return new n(e);case PY:return function(e){var t=new e.constructor(e.source,IY.exec(e));return t.lastIndex=e.lastIndex,t}(e);case NY:return new n;case DY:return function(e){return CY?Object(CY.call(e)):{}}(e)}}var JY=YJ&&YJ.isMap,qY=JY?KJ(JY):function(e){return UX(e)&&"[object Map]"==bY(e)},YY=qY;var QY=YJ&&YJ.isSet,ZY=QY?KJ(QY):function(e){return UX(e)&&"[object Set]"==bY(e)},$Y=ZY,eQ="[object Arguments]",tQ="[object Function]",rQ="[object GeneratorFunction]",nQ="[object Object]",iQ={};function oQ(e,t,r,n,i,o){var a;if(void 0!==a)return a;if(!WX(e))return e;var s=BX(e);if(s)a=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&EY.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e);else{var c=bY(e),u=c==tQ||c==rQ;if(GJ(e))return function(e){return e.slice()}(e);if(c==nQ||c==eQ||u&&!i)a=u?{}:function(e){return"function"!=typeof e.constructor||MJ(e)?{}:pJ(bq(e))}(e);else{if(!iQ[c])return i?e:{};a=XY(e,c)}}o||(o=new Zq);var d=o.get(e);if(d)return d;o.set(e,a),$Y(e)?e.forEach((function(n){a.add(oQ(n,t,r,n,e,o))})):YY(e)&&e.forEach((function(n,i){a.set(i,oQ(n,t,r,i,e,o))}));var l=s?void 0:aY(e);return function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););}(l||e,(function(n,i){l&&(n=e[i=n]),CJ(a,i,oQ(n,t,r,i,e,o))})),a}iQ[eQ]=iQ["[object Array]"]=iQ["[object ArrayBuffer]"]=iQ["[object DataView]"]=iQ["[object Boolean]"]=iQ["[object Date]"]=iQ["[object Float32Array]"]=iQ["[object Float64Array]"]=iQ["[object Int8Array]"]=iQ["[object Int16Array]"]=iQ["[object Int32Array]"]=iQ["[object Map]"]=iQ["[object Number]"]=iQ[nQ]=iQ["[object RegExp]"]=iQ["[object Set]"]=iQ["[object String]"]=iQ["[object Symbol]"]=iQ["[object Uint8Array]"]=iQ["[object Uint8ClampedArray]"]=iQ["[object Uint16Array]"]=iQ["[object Uint32Array]"]=!0,iQ["[object Error]"]=iQ[tQ]=iQ["[object WeakMap]"]=!1;function aQ(e){return oQ(e,5)}function sQ(e){return null==e?[]:function(e,t){return FX(t,(function(t){return e[t]}))}(e,oq(e))}var cQ=function(e){return function(t){return function(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)r=t(r,e[n],n,e);return r}(Yq(function(e){return(e=Sq(e))&&e.replace(Tq,kq).replace(Iq,"")}(t).replace(Qq,"")),e,"")}}((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()})),uQ=cQ,dQ=function(){function e(t,r){of(this,e),af(this,"roomId",void 0),af(this,"userInfo",void 0),af(this,"userId",void 0),af(this,"sessionId",sM()),af(this,"token",void 0),af(this,"rtcVid",void 0),af(this,"joinPromise",void 0),af(this,"startJoinTimestamp",void 0),af(this,"_liveControlMessage",void 0),af(this,"_userStreamMap",new DR),af(this,"_roomConfig",{isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:zP.communication}),af(this,"_vendorConfig",{enableMultiVendor:!1,vendorCode:0}),af(this,"_roomAttr",{multiChatMode:!1,bigRoomMode:!1}),af(this,"_tokenPublishPrivilegeExpired",!1),af(this,"_tokenSubscribePrivilegeExpired",!1),af(this,"_monitor",void 0),this._ctx=r,this.roomId=t.roomId,this.userInfo=t.userInfo,this.userId=t.userInfo.userId,this.token=t.token,this._monitor=GV(r.id)}var t;return nf(e,[{key:"checkJoinRoom",value:(t=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.joinPromise;case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"vendorConfig",get:function(){return this._vendorConfig}},{key:"setVendorConfig",value:function(e){this._vendorConfig=e}},{key:"updateRoomAttributes",value:function(e){this._roomAttr=ux(ux({},this._roomAttr),e)}},{key:"setLiveControlMessage",value:function(e){this._liveControlMessage=e}},{key:"getLiveControlMessage",value:function(){return this._liveControlMessage}},{key:"isMultiChatMode",value:function(){return this._roomAttr.multiChatMode}},{key:"updateRoomConfig",value:function(e){return this._roomConfig=uq(this._roomConfig,e),this._roomConfig}},{key:"isAutoPublish",get:function(){return this._roomConfig.isAutoPublish}},{key:"isAutoSubscribeAudio",get:function(){return this._roomConfig.isAutoSubscribeAudio}},{key:"isAutoSubscribeVideo",get:function(){return this._roomConfig.isAutoSubscribeVideo}},{key:"remoteVideoConfig",get:function(){return this._roomConfig.remoteVideoConfig}},{key:"roomProfileType",get:function(){return this._roomConfig.roomProfileType||zP.communication}},{key:"updateUserPubInfo",value:function(e){var t=this._userStreamMap.get(e.clientId)||{};e.screen?(t.screenAudio=e.attributes.audiostream,t.screenVideo=e.attributes.videostream):(t.audio=e.attributes.audiostream,t.video=e.attributes.videostream),this._userStreamMap.set(e.clientId,t)}},{key:"getUserPubInfo",value:function(e){return ux({audio:!1,video:!1,screenAudio:!1,screenVideo:!1},this._userStreamMap.get(e)||{})}},{key:"resetUserPubInfo",value:function(){this._userStreamMap.clear()}},{key:"tokenPublishPrivilegeExpired",get:function(){return this._tokenPublishPrivilegeExpired}},{key:"tokenSubscribePrivilegeExpired",get:function(){return this._tokenSubscribePrivilegeExpired}},{key:"setTokenPublishPrivilegeExpired",value:function(e){this._tokenPublishPrivilegeExpired=e}},{key:"setTokenSubscribePrivilegeExpired",value:function(e){this._tokenSubscribePrivilegeExpired=e}},{key:"getStayRoomDuration",value:function(){return this.startJoinTimestamp?kF()-this.startJoinTimestamp:0}},{key:"report",value:function(e,t,r){var n;null===(n=this._monitor)||void 0===n||n.report(e,ux({room_id:this.roomId,user_id:this.userId,rtc_session_id:this.sessionId,rtc_vid:this.rtcVid},t),r)}}]),e}(),lQ=6e4,hQ=function(e,t,r){r.info(e,"userId: %o, subAudio: %o, subVideo: %o, audioMid: %o, videoMid: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.audioMid,t.videoMid,t.sequenceId)};function pQ(e,t,r){var n=r.value;return r.value=HS(BS().mark((function e(){var r,i,o,a=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._ctx.signalingManager.isConnected()){e.next=2;break}throw new rN(_P.NOT_CONNECTED_YET,"error in ".concat(t,": try again after connect"));case 2:return e.prev=2,e.next=5,(this._roomConf||this.config).checkJoinRoom();case 5:e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(2),new rN(_P.JOIN_ROOM_FAILED,"error in ".concat(t,": try again after joined"));case 10:for(r=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];return e.abrupt("return",n.apply(this,i));case 12:case"end":return e.stop()}}),e,this,[[2,7]])}))),r}var fQ=LR,vQ=ww,_Q=function(e,t,r,n){for(var i,o=vQ(t,r),a=e.length-1;a>=0;a--)(i=e[a])&&(o=i(t,r,o)||o);return o&&fQ(t,r,o),o},mQ=function(){Hx(s,Ij);var e,t,r,n,i,o,a=oO(s);function s(e,t){var r;return of(this,s),af(dx(r=a.call(this)),"_forwardDstRooms",new DR),af(dx(r),"forwardStreamState","stopped"),r._ctx=e,r._roomConf=t,r}return nf(s,[{key:"startForwardStream2Rooms",value:(o=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("running"!==this.forwardStreamState&&"paused"!==this.forwardStreamState){e.next=2;break}throw new rN(_P.UNEXPECTED_INVOKE_FORWARD_STREAM,"should not invoke startForwardStreamToRooms in state: ".concat(this.forwardStreamState));case 2:return e.next=4,this._sendForwardStreamSignaling("start",this._roomConf.roomId,t);case 4:return r=e.sent,this._updateDstRooms(t,r),n=this._transformForwardStreamResult(r),this.forwardStreamState="running",e.abrupt("return",n);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateForwardStream2Rooms",value:(i=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("stopped"!==this.forwardStreamState){e.next=2;break}throw new rN(_P.UNEXPECTED_INVOKE_FORWARD_STREAM,"should not invoke updateForwardStreamToRooms in state: ".concat(this.forwardStreamState));case 2:if(r=this._mockForwardStreamResult(t),"running"!==this.forwardStreamState){e.next=7;break}return e.next=6,this._sendForwardStreamSignaling("update",this._roomConf.roomId,t);case 6:r=e.sent;case 7:return this._updateDstRooms(t,r),n=this._transformForwardStreamResult(r),e.abrupt("return",n);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"stopForwardStream2Rooms",value:(n=HS(BS().mark((function e(){var t,r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("stopped"!==this.forwardStreamState){e.next=2;break}throw new rN(_P.UNEXPECTED_INVOKE_FORWARD_STREAM,"should not invoke stopForwardStreamToRooms in state: ".concat(this.forwardStreamState));case 2:if(r=this._mockForwardStreamResult([]),"running"!==this.forwardStreamState){e.next=7;break}return e.next=6,this._sendForwardStreamSignaling("stop",this._roomConf.roomId);case 6:r=e.sent;case 7:if(this._updateDstRooms([],r),!(jw(ZN(t=this._forwardDstRooms).call(t)).length>0)){e.next=10;break}throw new rN(_P.UNEXPECTED_ERROR,"stopforwardstream failed: ".concat(ZS(r)));case 10:return n=this._transformForwardStreamResult(r),this.forwardStreamState="stopped",e.abrupt("return",n);case 13:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"pauseForwardStream2AllRooms",value:(r=HS(BS().mark((function e(){var t,r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("paused"!==this.forwardStreamState&&"stopped"!==this.forwardStreamState){e.next=2;break}throw new rN(_P.UNEXPECTED_INVOKE_FORWARD_STREAM,"should not invoke pauseForwardStreamToAllRooms in state: ".concat(this.forwardStreamState));case 2:return e.next=4,this._sendForwardStreamSignaling("stop",this._roomConf.roomId);case 4:return t=e.sent,r=this._transformForwardStreamResult(t),this.forwardStreamState="paused",e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"resumeForwardStream2AllRooms",value:(t=HS(BS().mark((function e(){var t,r,n,i,o=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o.length>0&&void 0!==o[0]&&o[0]||!vE(t=["running","stopped"]).call(t,this.forwardStreamState)){e.next=3;break}throw new rN(_P.UNEXPECTED_INVOKE_FORWARD_STREAM,"should not invoke resumeForwardStreamToAllRooms in state: ".concat(this.forwardStreamState));case 3:return r=this._getDstRooms(),e.next=6,this._sendForwardStreamSignaling("start",this._roomConf.roomId,r);case 6:return n=e.sent,this._updateDstRooms(r,n),i=this._transformForwardStreamResult(n),this.forwardStreamState="running",e.abrupt("return",i);case 11:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"resumeFromReconnect",value:function(){var e=this;"running"===this.forwardStreamState&&this.resumeForwardStream2AllRooms(!0).then((function(t){t.forEach((function(t){t.state===YP.FORWARD_STREAM_STATE_FAILURE&&e.safeEmit(aX.ON_FORWARD_STREAM_ERROR,t)}))}))}},{key:"onForwardDstRoomUserKick",value:function(e){var t=[{dstRoomId:e.dstRoomId,code:200,forwardStreamType:"stop"}];this._updateDstRooms([],t),this.safeEmit(aX.ON_FORWARD_STREAM_ERROR,{roomId:e.dstRoomId,state:YP.FORWARD_STREAM_STATE_FAILURE,error:QP.FORWARD_STREAM_ERROR_REMOTE_KICKED})}},{key:"destoy",value:function(){Bx(Fx(s.prototype),"removeAllListeners",this).call(this),this._forwardDstRooms.clear(),this.forwardStreamState="stopped"}},{key:"_mockForwardStreamResult",value:function(e){var t=this,r=[];return this._forwardDstRooms.forEach((function(e,t){r.push({dstRoomId:t,forwardStreamType:"stop",code:200})})),e.forEach((function(e){var n=$O(r).call(r,(function(t){return t.dstRoomId===e.roomId}));-1===n?r.push({dstRoomId:e.roomId,forwardStreamType:"start",code:e.roomId===t._roomConf.roomId?400:200}):r[n].forwardStreamType="update"})),r}},{key:"_transformForwardStreamResult",value:function(e){e||(e=[]);var t,r=[],n=Ab(e);try{for(n.s();!(t=n.n()).done;){var i=t.value,o=i.dstRoomId,a=i.code,s={roomId:o,state:YP.FORWARD_STREAM_STATE_SUCCESS,error:QP.FORWARD_STREAM_ERROR_OK};200===a||(400===a?(s.state=YP.FORWARD_STREAM_STATE_FAILURE,s.error=QP.FORWARD_STREAM_ERROR_REMOTE_KICKED):a>=700&&a<800?(s.state=YP.FORWARD_STREAM_STATE_FAILURE,s.error=QP.FORWARD_STREAM_ERROR_INVALID_TOKEN):(s.state=YP.FORWARD_STREAM_STATE_FAILURE,s.error=QP.FORWARD_STREAM_ERROR_RESPONSE)),r.push(s)}}catch(e){n.e(e)}finally{n.f()}return r}},{key:"_updateDstRooms",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];0===r.length&&this._forwardDstRooms.clear(),r.forEach((function(r){var n=r.dstRoomId,i=r.code,o=r.forwardStreamType;if(200===i)if("stop"===o)t._forwardDstRooms.delete(n);else{var a,s=DC(e).call(e,(function(e){return e.roomId===n}));if(!s&&!t._forwardDstRooms.has(n))throw new rN(_P.UNEXPECTED_ERROR,"unknow roomid ".concat(n," in signaling return"));var c=null!==(a=t._forwardDstRooms.get(n))&&void 0!==a?a:{token:void 0};c=QR(c,s),t._forwardDstRooms.set(n,c)}else t._forwardDstRooms.has(n)&&t._forwardDstRooms.delete(n)}))}},{key:"_getDstRooms",value:function(){var e=[];return this._forwardDstRooms.forEach((function(t,r){e.push({roomId:r,token:t.token})})),e}},{key:"_sendForwardStreamSignaling",value:(e=HS(BS().mark((function e(t,r,n){var i,o,a,s,c,u,d,l=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i="".concat(wF()),"stop"!==t&&(o=ob(n).call(n,(function(e){return e.roomId})),this._roomConf.report("rtc_forward_stream",{type:"begin",dst_rooms:"{ ".concat(ob(o).call(o,(function(e){return'"'.concat(e,'"')})).join(",")," }"),event_session_id:i})),a={forwardStreamType:t,roomId:r},("start"===t||"update"===t)&&(a.dstRoomInfos=null==n?void 0:ob(n).call(n,(function(e){return{dstRoomId:e.roomId,dstToken:IF.token2auth(l._ctx.appId,e.roomId,l._roomConf.userId,e.token)}}))),e.next=7,this._ctx.signalingManager.sendSignaling("forwardStream",a);case 7:if(s=e.sent,c=[],200===(null==s?void 0:s.code)){e.next=12;break}throw"stop"!==t&&(null==n||n.forEach((function(e){c.push({dst_room_id:e.roomId,result:"server error ".concat(null==s?void 0:s.code)})})),this._roomConf.report("rtc_forward_stream",{type:"end",dst_rooms:ZS(c),event_session_id:i})),new rN(_P.UNEXPECTED_ERROR,"server side internal error, error code: ".concat(s));case 12:return"stop"!==t&&(null===(u=s.forwardStreamResults)||void 0===u||u.forEach((function(e){c.push({dst_room_id:e.dstRoomId,result:"dst room lost"})})),null===(d=s.forwardStreamResults)||void 0===d||d.forEach((function(e){var t=DC(c).call(c,(function(t){return t.dst_room_id===e.dstRoomId}));t&&(200===e.code?"update"===e.forwardStreamType?t.result="update":t.result="success":t.result="server error ".concat(e.code))})),this._roomConf.report("rtc_forward_stream",{type:"end",dst_rooms:ZS(c),event_session_id:i})),e.abrupt("return",s.forwardStreamResults);case 14:case"end":return e.stop()}}),e,this)}))),function(t,r,n){return e.apply(this,arguments)})}]),s}();_Q([pQ],mQ.prototype,"startForwardStream2Rooms"),_Q([pQ],mQ.prototype,"updateForwardStream2Rooms"),_Q([pQ],mQ.prototype,"stopForwardStream2Rooms"),_Q([pQ],mQ.prototype,"pauseForwardStream2AllRooms"),_Q([pQ],mQ.prototype,"resumeForwardStream2AllRooms");var gQ=[{maxLayers:3,totalPixels:2073600},{maxLayers:3,totalPixels:921600},{maxLayers:3,totalPixels:518400},{maxLayers:2,totalPixels:230400},{maxLayers:2,totalPixels:129600},{maxLayers:1,totalPixels:57600},{maxLayers:1,totalPixels:0}];function yQ(e,t,r){var n,i=e?null===(n=DC(r).call(r,(function(t){return t.rid===e})))||void 0===n?void 0:n.maxkbps:r[0].maxkbps;return Math.min(null!=i?i:Number.POSITIVE_INFINITY,t)}var SQ=Er(yx),bQ=Zo,EQ=$r,kQ=Ro,TQ=En,IQ=hx,RQ=bo,CQ=qr,wQ=th,AQ=sn;var xQ=Rr((function(){var e=function(){},t=RQ.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));bQ({target:"Reflect",stat:!0,forced:xQ},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=CQ.f(kQ(t),r);if(!c){if(TQ(o=wQ(t)))return e(o,r,n,s);c=AQ(0)}if(IQ(c)){if(!1===c.writable||!TQ(s))return!1;if(i=CQ.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,RQ.f(s,r,i)}else RQ.f(s,r,AQ(0,n))}else{if(void 0===(a=c.set))return!1;EQ(a,s,n)}return!0}});var OQ=Er(kn.Reflect.set),PQ=function(){function e(t){of(this,e),af(this,"_roomId",void 0),af(this,"_constraints",{}),af(this,"_profile",void 0),af(this,"_customMaxBitrate",0),this._appId=t}return nf(e,[{key:"setRoomId",value:function(e){this._roomId=e}},{key:"setAudioProfile",value:function(e){this._profile=e,this._customMaxBitrate=0}},{key:"customMaxBitrate",get:function(){return this._customMaxBitrate}},{key:"setCustomMaxBitrate",value:function(e){var t=VB.getEngineWebConfig(this._appId,this._roomId||"").audio_encode;this._customMaxBitrate=null!=t&&t.bitrate?0:1e3*e}},{key:"getOpusConfigStr",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=VB.getEngineWebConfig(this._appId,this._roomId||"").audio_encode,n=this.getConstraints(),i=n.sampleRate,o=n.channelCount,a="number"==typeof i?i:null==i?void 0:i.exact,s="number"==typeof o?o:null==o?void 0:o.exact,c={};t.split(";").forEach((function(e){var t=xb(e.split("="),2),r=t[0],n=t[1];r&&n&&(c[r]=n)}));var u=(null==r?void 0:r.bitrate)||this._customMaxBitrate||this._getConfigByAudioProfile().bitrate;u&&(c.maxaveragebitrate=u);var d=(null==r?void 0:r.enc_sample_rate)||a;d&&(c["sprop-maxcapturerate"]=d);var l=(null==r?void 0:r.playback_rate)||a;return l&&(c.maxplaybackrate=l),(s&&s>1||null!=r&&r.stereo)&&(c["sprop-stereo"]=1,c.stereo=1),null!=r&&r.dtx&&(c.usedtx=1),ob(e=ck(c)).call(e,(function(e){var t;return JS(t="".concat(e,"=")).call(t,c[e])})).join(";")}},{key:"updateConstraints",value:function(e){this._constraints=ux(ux({},this._constraints),e)}},{key:"getConstraints",value:function(){var e=ux({},this._constraints),t=VB.getEngineWebConfig(this._appId,this._roomId||"").audio_capture;VF(null==t?void 0:t.sample_rate)||(e.sampleRate=t.sample_rate),VF(null==t?void 0:t.channel)||(e.channelCount=t.channel),VF(null==t?void 0:t.agc)||(e.autoGainControl=t.agc),VF(null==t?void 0:t.ans)||(e.noiseSuppression=t.ans),VF(null==t?void 0:t.aec)||(e.echoCancellation=t.aec);var r=this._getConfigByAudioProfile(),n=r.sampleRate,i=r.channel;return VF(e.sampleRate)&&!VF(n)&&(e.sampleRate=n),VF(e.channelCount)&&!VF(i)&&(e.channelCount=i),e}},{key:"_getConfigByAudioProfile",value:function(){var e={};switch(this._profile){case GP.fluent:e.sampleRate=16e3,e.bitrate=24e3;break;case GP.standard:e.sampleRate=48e3,e.bitrate=48e3;break;case GP.hd:e.sampleRate=48e3,e.bitrate=128e3,e.channel=2;break;case GP.standardStereo:e.sampleRate=48e3,e.bitrate=8e4,e.channel=2;break;case GP.hdMono:e.sampleRate=48e3,e.bitrate=128e3}return e}}]),e}(),NQ={start_interval:100,multiplier:2,max_interval:3e4},MQ=function(){function e(){of(this,e),af(this,"_times",0),af(this,"_config",NQ),af(this,"initTs",kF())}return nf(e,[{key:"getRetryDelay",value:function(){return Math.min(this._config.max_interval,Math.pow(this._config.multiplier,this._times++)*this._config.start_interval)}},{key:"setConfig",value:function(e){this._config=e}},{key:"reset",value:function(){this._times=0}}]),e}(),DQ=function(){function e(t){var r=this;of(this,e),af(this,"_reconnectTimer",void 0),af(this,"_retryFunc",void 0),af(this,"_abortControllers",[]),af(this,"_monitor",void 0),af(this,"logger",void 0),af(this,"_groupConfigId",EF()),af(this,"_retryLimiter",new MQ),af(this,"_timer",void 0),af(this,"_destroyed",!1),af(this,"_onlineListener",(function(){r._reconnectTimer&&r._retryFunc&&(clearTimeout(r._reconnectTimer),r._retryFunc())})),this._ctx=t,this._monitor=GV(t.id),this.logger=new dF("ICERequest",4,t.id),window.addEventListener("online",this._onlineListener)}var t,r,n,i,o;return nf(e,[{key:"getICENode",value:(o=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("getICENode","invoke"),e.prev=1,e.next=4,this._getAccessWithRetry(t);case 4:if(0!==(r=e.sent).length){e.next=7;break}throw new Error("server return empty nodes.");case 7:e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(1),this._reportRtcInvokeStatus("es.join.getNodeFailed",e.t0),new rN(_P.ICE_SERVER_WRONG,"get ICE config failed: ".concat(e.t0.message),e.t0);case 13:return this.logger.success("getICENode","success"),this._reportRtcInvokeStatus("es.join.getNodeSuccess",r),e.abrupt("return",r);case 16:case"end":return e.stop()}}),e,this,[[1,9]])}))),function(e){return o.apply(this,arguments)})},{key:"_getAccessWithRetry",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return 0!==r&&this.logger.info("_getAccessWithRetry()","invoke feedbackInfo: %o, 201count: %o",e,r),new qS((function(n,i){t._getAccessNode(e).then((function(e){t._retryLimiter.reset(),n(e)})).catch((function(o){if(!t._destroyed){if(Array.isArray(o)&&o.length>0){if($O(o).call(o,(function(e){return 400<=e.code&&e.code<500}))>-1)return t._retryLimiter.reset(),i(new Error("HTTP request failed(4xx)"));if(o.every((function(e){var t;return 201===e.code||201===(null===(t=e.error)||void 0===t?void 0:t.code)}))&&r++,3===r)return t._retryLimiter.reset(),i(new Error("HTTP request failed(201)"))}var a=t._retryLimiter.getRetryDelay();t.logger.warn("_getAccessWithRetry()","_getAccessWithRetry error, will retry after ".concat(a,"ms"),o),t._retryFunc=function(){t._getAccessWithRetry(e,r).then(n).catch(i)},t._reconnectTimer=self.setTimeout(t._retryFunc,a)}}))}))}},{key:"_getAccessNode",value:(i=HS(BS().mark((function e(t){var r=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new qS((function(e,n){var i=VB.getAccessNode(r._ctx.appId);if(i){var o,a=ob(o=Array.isArray(i)?i:[i]).call(o,(function(e){return e.cache_status=!0,e}));r.logger.info("getAccessNode","use cache node."),e(a),r._timer=window.setTimeout((function(){r._getAccessNodeFromServer(t),r._reportRtcInvokeStatus("es.R.node.cache",i),delete r._timer}),0)}else r._getAccessNodeFromServer(t).then(e).catch(n)})));case 1:case"end":return e.stop()}}),e)}))),function(e){return i.apply(this,arguments)})},{key:"_getAccessNodeFromServer",value:(n=HS(BS().mark((function e(t){var r,n,i,o=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._getAccessUrls(),n=r.urls,i=r.needFallback,e.abrupt("return",this.getICEConfigFromServer(n,t).then((function(e){var t=e.nodes;return!o._ctx.useCloudProxy&&(null==t?void 0:t.length)>0&&VB.setAccessNode(o._ctx.appId,t,e.ttl||11200),e.dispatchDomains&&!o._ctx.useCloudProxy&&VB.setAccessUrls(e.dispatchDomains),t})).catch((function(e){if(i)return o._reportRtcInvokeStatus("es.R.req.fallback",""),VB.clearAccessUrls(),o._getAccessNodeFromServer(t);throw e})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_getAccessUrls",value:function(){var e=VB.getAccessUrls()||[],t=!0;return this._reportRtcInvokeStatus("es.R.req.cache.urls",e),0===e.length&&(e=WB.ICE_CONFIG_REQUEST_URLS,t=!1,this._reportRtcInvokeStatus("es.R.req.external.urls",e)),0===e.length&&(e=WB.ICE_CONFIG_REQUEST_URLS_INTERNAL,t=!1,this._reportRtcInvokeStatus("es.R.req.internal.urls",e)),{urls:e,needFallback:t}}},{key:"getICEConfigFromServer",value:(r=HS(BS().mark((function e(t,r){var n,i,o,a,s=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={appID:this._ctx.appId,deviceID:VB.getDeviceId(),os:"web",sdkVersion:WB.VERSION,isOversea:WB.OVERSEA,expectedAddr:XB("EXPECTED_ADDR"),productPlatform:"VolcEngine",enableCloudProxy:this._ctx.useCloudProxy,expectedIDC:this._ctx.expectedIDC},r&&(n.feedbackInfo=r,"ICE_FAILED"!==(null===(i=r[0])||void 0===i||null===(o=i.feedbackReason)||void 0===o?void 0:o.type)&&delete n.expectedAddr),a=ob(t).call(t,(function(e){return s._httpRequest(e,n)})),e.abrupt("return",PF(a));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_httpRequest",value:(t=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=EF(),r.connectSessionID=i,o=Date.now(),null===(n=this._monitor)||void 0===n||n.report("rtc_get_access",{error_code:0,message:ZS(r),elapse:0,type:"request",host:t,config_id:i,group_config_id:this._groupConfigId}),a=new AbortController,this._abortControllers.push(a),e.prev=6,e.prev=7,e.next=10,fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},mode:"cors",body:ZS(r),signal:a.signal});case 10:s=e.sent,e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(7),uM(fetch)||null===(d=this._monitor)||void 0===d||d.report("rtc_error",{error_code:kX.Fetch_MODIFY,message:"get access failed, possibly due to modifying the browser's Fetch API."},{origin_error:e.t0}),e.t0;case 17:if(this._abortControllers=Wb(c=this._abortControllers).call(c,(function(e){return e!==a})),200===s.status){e.next=20;break}throw{message:s.statusText,code:s.status};case 20:return e.next=22,s.json();case 22:if(200===(l=e.sent).code){e.next=25;break}throw l;case 25:return null===(u=this._monitor)||void 0===u||u.report("rtc_get_access",{error_code:200,message:ZS(l),elapse:Date.now()-o,type:"response",host:t,config_id:i,group_config_id:this._groupConfigId}),e.abrupt("return",l);case 29:throw e.prev=29,e.t1=e.catch(6),null===(h=this._monitor)||void 0===h||h.report("rtc_get_access",{error_code:Number((null===e.t1||void 0===e.t1?void 0:e.t1.code)||(null===e.t1||void 0===e.t1?void 0:e.t1.server_code)),message:null===e.t1||void 0===e.t1?void 0:e.t1.message,elapse:Date.now()-o,type:"response",host:t,config_id:i,group_config_id:this._groupConfigId},{error:ZS(e.t1)}),e.t1;case 33:case"end":return e.stop()}}),e,this,[[6,29],[7,13]])}))),function(e,r){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._destroyed=!0,window.removeEventListener("online",this._onlineListener),this._abortControllers.forEach((function(e){return e.abort()})),this._reconnectTimer&&(window.clearTimeout(this._reconnectTimer),delete this._reconnectTimer),this._timer&&(window.clearTimeout(this._timer),delete this._timer)}},{key:"_reportRtcInvokeStatus",value:function(e,t){var r;null===(r=this._monitor)||void 0===r||r.report("rtc_invoke_status",{sdk_api_name:e,message:t,error_code:0,stream_id:"",elapse:0,group_config_id:this._groupConfigId})}}]),e}(),LQ={},UQ={},VQ={exports:{}},FQ=VQ.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),(t+=null!=e["network-id"]?" network-id %d":"%v")+(null!=e["network-cost"]?" network-cost %d":"%v")}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",(t+=null!=e.rateNumerator?" rate=%s":"")+(null!=e.rateDenominator?"/%s":"")}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};ck(FQ).forEach((function(e){FQ[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}));var BQ=VQ.exports;!function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=BQ,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t,o={},a=[],s=o;return Wb(t=e.split(/(\r\n|\r|\n)/)).call(t,i).forEach((function(e){var t=e[0],i=LC(e).call(e,2);"m"===t&&(a.push({rtp:[],fmtp:[]}),s=a[a.length-1]);for(var o=0;o<(n[t]||[]).length;o+=1){var c=n[t][o];if(c.reg.test(i))return r(c,s,i)}})),o.media=a,o};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){var t;return wE(t=e.split(/;\s?/)).call(t,o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){var t;return ob(t=e.toString().split(" ")).call(t,Number)},e.parseRemoteCandidates=function(e){for(var r,n=[],i=ob(r=e.split(" ")).call(r,t),o=0;o<i.length;o+=3)n.push({component:i[o],ip:i[o+1],port:i[o+2]});return n},e.parseImageAttributes=function(e){var t;return ob(t=e.split(" ")).call(t,(function(e){var t;return wE(t=e.substring(1,e.length-1).split(",")).call(t,o,{})}))},e.parseSimulcastStreamList=function(e){var r;return ob(r=e.split(";")).call(r,(function(e){var r;return ob(r=e.split(",")).call(r,(function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(UQ);var jQ=BQ,HQ=/%[sdv%]/g,zQ=function(e){var t=1,r=arguments,n=r.length;return e.replace(HQ,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},GQ=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return zQ.apply(null,n)},WQ=["v","o","s","i","u","e","p","c","b","t","r","z","a"],KQ=["i","c","b","a"],XQ=UQ,JQ=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var r=t.outerOrder||WQ,n=t.innerOrder||KQ,i=[];return r.forEach((function(t){jQ[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(GQ(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(GQ(t,r,e))}))}))})),e.media.forEach((function(e){i.push(GQ("m",jQ.m[0],e)),n.forEach((function(t){jQ[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(GQ(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(GQ(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};LQ.write=JQ,LQ.parse=XQ.parse,LQ.parseParams=XQ.parseParams,LQ.parseFmtpConfig=XQ.parseFmtpConfig,LQ.parsePayloads=XQ.parsePayloads,LQ.parseRemoteCandidates=XQ.parseRemoteCandidates,LQ.parseImageAttributes=XQ.parseImageAttributes,LQ.parseSimulcastStreamList=XQ.parseSimulcastStreamList;var qQ=new dF("FirefoxHandler",3),YQ=Math.pow(2,32),QQ="kp34Za0H+aVf862l";function ZQ(e){return e>YQ-18?(qQ.warn("generateAllSsrc","reset start id",e),ZQ(e=e-YQ+1e4+18)):{audio:e,audioFec:e+1,audioRtx:e+2,video:e+3,videoFec:e+4,videoRtx:e+5,next:e+18}}var $Q=function(e,t,r){var n,i,o;return[{id:r,attribute:"cname",value:arguments.length>3&&void 0!==arguments[3]?arguments[3]:"o/i14u9pJrxRKAsu"},{id:r,attribute:"msid",value:JS(n=JS(i="".concat(e," ")).call(i,e,"-")).call(n,t)},{id:r,attribute:"mslabel",value:"".concat(e)},{id:r,attribute:"label",value:JS(o="".concat(e,"-")).call(o,t)}]},eZ=function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.video,o=t.videoRtx,a=t.videoFec,s=[i,o],c=n.cname,u=n.flexfec;u&&s.push(a);var d,l=wE(s).call(s,(function(t,r){return JS(t).call(t,$Q(e,"video",r,c))}),[]),h=[{semantics:"FID",ssrcs:JS(r="".concat(i," ")).call(r,o)}];return u&&h.push({semantics:"FEC-FR",ssrcs:JS(d="".concat(i," ")).call(d,a)}),{ssrcs:l,ssrcGroups:h}};function tZ(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.msid,delete e.bundleOnly,e}var rZ=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=ux(ux({},e),{},{media:[]});return n&&(i.invalid=[{value:"realx-exts:rscp"}]),t&&i.media.push(t),r&&i.media.push(r),delete i.groups,delete i.msidSemantic,LQ.write(i)};function nZ(e){return iZ.apply(this,arguments)}function iZ(){return(iZ=HS(BS().mark((function e(t){var r,n,i,o,a;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,o=t.iceParams,a=t.iceConfig,r.fingerprint={type:"sha-256",hash:i},r.icePwd=o.serverIcePwd,e.next=6,aZ(o.serverIceUfrag);case 6:return r.iceUfrag=e.sent,r.candidates=oZ(n,a),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oZ(e,t){if(!Array.isArray(e))return[];var r=0,n=[];return e.forEach((function(e){var i={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&!t.tcpOnly&&e.udpPorts.forEach((function(e){n.push(ux(ux({},i),{},{foundation:r++,transport:"udp",port:e,priority:2130706431}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(ux(ux({},i),{},{foundation:r++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n}var aZ=function(){var e=HS(BS().mark((function e(t){var r,n,i,o,a,s,c;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new TextEncoder,n=r.encode("PREC"),e.t0=Uint8Array,e.next=5,IF.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),o=new Uint8Array(4),crypto.getRandomValues(o),(a=new Uint8Array(2))[0]=0,a[1]=1,s=TF(Uint8Array,n,i,o,a),e.next=15,IF.ab2b64str(s.buffer);case 15:return c=e.sent,e.abrupt("return",c);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),sZ=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=Ab(e.fmtp);try{for(i.s();!(n=i.n()).done;){var o,a,s,c=n.value;if(vE(o=c.config).call(o,"level-asymmetry-allowed=1")&&vE(a=c.config).call(a,"packetization-mode=1")&&vE(s=c.config).call(s,"profile-level-id=42e0")){r=c.payload;break}}}catch(e){i.e(e)}finally{i.f()}for(var u=0;u<e.rtp.length;u++){var d=e.rtp[u];if("H264"===t){if(d.payload===r){var l;e.rtp.unshift(mw(l=e.rtp).call(l,u,1)[0]);break}}else if(d.codec===t){var h;e.rtp.unshift(mw(h=e.rtp).call(h,u,1)[0]);break}}var p=[];e.rtp.forEach((function(e){return p.push(e.payload)})),e.payloads=p.join(" ")}},cZ=function(e){var t,r=LQ.parse(e);return r.media=ob(t=r.media).call(t,(function(e){return"audio"===e.type?lZ(e,r):dZ(e,["H264","VP8"],r)})),LQ.write(r)},uZ=function(e){e.media.forEach((function(e){"audio"!==e.type&&"video"!==e.type||e.rtp.forEach((function(t){var r;e.rtcpFb||(e.rtcpFb=[]),DC(r=e.rtcpFb).call(r,(function(e){return e.payload===t.payload&&"rrtr"===e.type}))||e.rtcpFb.push({payload:t.payload,type:"rrtr"})}))}))},dZ=function(e,t,r){var n,i,o,a,s,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{rrtr:!1},u={},d={},l=-1,h=[];return Array.isArray(e.fmtp)&&e.fmtp.forEach((function(e){var t=e.payload,r=e.config;if(vP(r).call(r,"apt=")){var n=LC(r).call(r,4);u[t]=n}else vE(r).call(r,"42e0")&&vE(r).call(r,"packetization-mode=1")&&(l=t)})),Array.isArray(e.rtp)&&(e.rtp=Wb(n=e.rtp).call(n,(function(e){var r,n=e.codec,i=e.payload;switch(n){case"H264":return r=!1,ob(t).call(t,(function(e){"H264"===e&&i===l&&(d[i]=i,h.push(i),r=!0)})),r;case"rtx":return!!d[u[i]]&&(d[i]=i,!0);case"red":case"ulpfec":case"flexfec-03":return d[i]=i,!0;default:return r=!1,ob(t).call(t,(function(e){e===n&&(d[i]=i,h.push(i),r=!0)})),r}}))),Array.isArray(e.fmtp)&&(e.fmtp=Wb(i=e.fmtp).call(i,(function(e){return d[e.payload]}))),Array.isArray(e.rtcpFb)?e.rtcpFb=Wb(o=e.rtcpFb).call(o,(function(e){return d[e.payload]})):e.rtcpFb=[],c.rrtr&&h.forEach((function(t){var r;null===(r=e.rtcpFb)||void 0===r||r.push({payload:t,type:"rrtr"})})),hZ(e,r),Array.isArray(e.ext)&&(e.ext=Wb(a=e.ext).call(a,(function(e){if("http://www.webrtc.org/experiments/rtp-hdrext/video-content-type"!==e.uri&&"http://www.webrtc.org/experiments/rtp-hdrext/video-timing"!==e.uri&&"http://www.webrtc.org/experiments/rtp-hdrext/color-space"!==e.uri)return e}))),"string"==typeof e.payloads&&(e.payloads=Wb(s=e.payloads.split(" ")).call(s,(function(e){return d[e]})).join(" ")),e},lZ=function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{rrtr:!1},i={};if(Array.isArray(e.rtp)&&(e.rtp=Wb(r=e.rtp).call(r,(function(e){var t=e.codec,r=e.payload;return("opus"===t||"red"===t)&&(i[r]=r,!0)}))),Array.isArray(e.rtcpFb)||(e.rtcpFb=[]),n.rrtr&&ck(i).forEach((function(t){var r;null===(r=e.rtcpFb)||void 0===r||r.push({payload:Number(t),type:"rrtr"})})),hZ(e,t),"string"==typeof e.payloads){var o=[];e.payloads.split(" ").forEach((function(e){i[e]&&o.push(e)})),e.payloads=o.join(" ")}return e},hZ=function(e,t){e.iceOptions&&delete e.iceOptions,e.icePwd&&(t.icePwd=e.icePwd,delete e.icePwd),e.iceUfrag&&(t.iceUfrag=e.iceUfrag,delete e.iceUfrag),e.fingerprint&&(t.fingerprint=e.fingerprint,delete e.fingerprint)};xT("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),XT);var pZ=kn.Set,fZ=qn,vZ=function(e){if("object"==typeof e&&"size"in e&&"has"in e&&"add"in e&&"delete"in e&&"keys"in e)return e;throw TypeError(fZ(e)+" is not a set")},_Z=qT,mZ=wn("Set"),gZ=mZ.prototype,yZ={Set:mZ,add:_Z("add",1),has:_Z("has",1),remove:_Z("delete",1),proto:gZ},SZ=wI,bZ=function(e,t,r){return r?SZ(e.keys(),t,!0):e.forEach(t)},EZ=bZ,kZ=yZ.Set,TZ=yZ.add,IZ=function(e){var t=new kZ;return EZ(e,(function(e){TZ(t,e)})),t},RZ=function(e){return e.size},CZ=$n,wZ=Ro,AZ=$r,xZ=ha,OZ=function(e){return{iterator:e,next:e.next,done:!1}},PZ="Invalid size",NZ=RangeError,MZ=TypeError,DZ=Math.max,LZ=function(e,t,r,n){this.set=e,this.size=t,this.has=r,this.keys=n};LZ.prototype={getIterator:function(){return OZ(wZ(AZ(this.keys,this.set)))},includes:function(e){return AZ(this.has,this.set,e)}};var UZ=function(e){wZ(e);var t=+e.size;if(t!=t)throw MZ(PZ);var r=xZ(t);if(r<0)throw NZ(PZ);return new LZ(e,DZ(r,0),CZ(e.has),CZ(e.keys))},VZ=vZ,FZ=IZ,BZ=RZ,jZ=UZ,HZ=bZ,zZ=wI,GZ=yZ.has,WZ=yZ.remove,KZ=function(e){var t=VZ(this),r=jZ(e),n=FZ(t);return BZ(t)<=r.size?HZ(t,(function(e){r.includes(e)&&WZ(n,e)})):zZ(r.getIterator(),(function(e){GZ(t,e)&&WZ(n,e)})),n},XZ=function(){return!1},JZ=KZ;Zo({target:"Set",proto:!0,real:!0,forced:!XZ()},{difference:JZ});var qZ=vZ,YZ=RZ,QZ=UZ,ZZ=bZ,$Z=wI,e$=yZ.Set,t$=yZ.add,r$=yZ.has,n$=function(e){var t=qZ(this),r=QZ(e),n=new e$;return YZ(t)>r.size?$Z(r.getIterator(),(function(e){r$(t,e)&&t$(n,e)})):ZZ(t,(function(e){r.includes(e)&&t$(n,e)})),n},i$=n$;Zo({target:"Set",proto:!0,real:!0,forced:!XZ()},{intersection:i$});var o$=vZ,a$=yZ.has,s$=RZ,c$=UZ,u$=bZ,d$=wI,l$=Vv,h$=function(e){var t=o$(this),r=c$(e);if(s$(t)<=r.size)return!1!==u$(t,(function(e){if(r.includes(e))return!1}),!0);var n=r.getIterator();return!1!==d$(n,(function(e){if(a$(t,e))return l$(n,"normal",!1)}))},p$=h$;Zo({target:"Set",proto:!0,real:!0,forced:!XZ()},{isDisjointFrom:p$});var f$=vZ,v$=RZ,_$=bZ,m$=UZ,g$=function(e){var t=f$(this),r=m$(e);return!(v$(t)>r.size)&&!1!==_$(t,(function(e){if(!r.includes(e))return!1}),!0)},y$=g$;Zo({target:"Set",proto:!0,real:!0,forced:!XZ()},{isSubsetOf:y$});var S$=vZ,b$=yZ.has,E$=RZ,k$=UZ,T$=wI,I$=Vv,R$=function(e){var t=S$(this),r=k$(e);if(E$(t)<r.size)return!1;var n=r.getIterator();return!1!==T$(n,(function(e){if(!b$(t,e))return I$(n,"normal",!1)}))},C$=R$;Zo({target:"Set",proto:!0,real:!0,forced:!XZ()},{isSupersetOf:C$});var w$=vZ,A$=IZ,x$=UZ,O$=wI,P$=yZ.add,N$=yZ.has,M$=yZ.remove,D$=function(e){var t=w$(this),r=x$(e).getIterator(),n=A$(t);return O$(r,(function(e){N$(t,e)?M$(n,e):P$(n,e)})),n},L$=D$;Zo({target:"Set",proto:!0,real:!0,forced:!XZ()},{symmetricDifference:L$});var U$=vZ,V$=yZ.add,F$=IZ,B$=UZ,j$=wI,H$=function(e){var t=U$(this),r=B$(e).getIterator(),n=F$(t);return j$(r,(function(e){V$(n,e)})),n},z$=H$;Zo({target:"Set",proto:!0,real:!0,forced:!XZ()},{union:z$});var G$=pZ;Zo({target:"Set",stat:!0,forced:!0},{from:_I}),Zo({target:"Set",stat:!0,forced:!0},{of:gI});var W$=vZ,K$=yZ.add;Zo({target:"Set",proto:!0,real:!0,forced:!0},{addAll:function(){for(var e=W$(this),t=0,r=arguments.length;t<r;t++)K$(e,arguments[t]);return e}});var X$=vZ,J$=yZ.remove;Zo({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=X$(this),r=!0,n=0,i=arguments.length;n<i;n++)e=J$(t,arguments[n]),r=r&&e;return!!r}});var q$=So,Y$=vZ,Q$=bZ;Zo({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=Y$(this),r=q$(e,arguments.length>1?arguments[1]:void 0);return!1!==Q$(t,(function(e){if(!r(e,e,t))return!1}),!0)}});var Z$=Pa,$$=bi,e0=pn,t0=Bl,r0=Di("iterator"),n0=Object,i0=Jr,o0=function(e){if(e0(e))return!1;var t=n0(e);return void 0!==t[r0]||"@@iterator"in t||$$(t0,Z$(t))},a0=En,s0=wn("Set"),c0=function(e){return function(e){return a0(e)&&"number"==typeof e.size&&i0(e.has)&&i0(e.keys)}(e)?e:o0(e)?new s0(e):e},u0=$r,d0=c0,l0=KZ;Zo({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){return u0(l0,this,d0(e))}});var h0=So,p0=vZ,f0=bZ,v0=yZ.Set,_0=yZ.add;Zo({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=p0(this),r=h0(e,arguments.length>1?arguments[1]:void 0),n=new v0;return f0(t,(function(e){r(e,e,t)&&_0(n,e)})),n}});var m0=So,g0=vZ,y0=bZ;Zo({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=g0(this),r=m0(e,arguments.length>1?arguments[1]:void 0),n=y0(t,(function(e){if(r(e,e,t))return{value:e}}),!0);return n&&n.value}});var S0=$r,b0=c0,E0=n$;Zo({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){return S0(E0,this,b0(e))}});var k0=$r,T0=c0,I0=h$;Zo({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){return k0(I0,this,T0(e))}});var R0=$r,C0=c0,w0=g$;Zo({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){return R0(w0,this,C0(e))}});var A0=$r,x0=c0,O0=R$;Zo({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){return A0(O0,this,x0(e))}});var P0=Zo,N0=Ur,M0=vZ,D0=bZ,L0=Ts,U0=N0([].join),V0=N0([].push);P0({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=M0(this),r=void 0===e?",":L0(e),n=[];return D0(t,(function(e){V0(n,e)})),U0(n,r)}});var F0=So,B0=vZ,j0=bZ,H0=yZ.Set,z0=yZ.add;Zo({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=B0(this),r=F0(e,arguments.length>1?arguments[1]:void 0),n=new H0;return j0(t,(function(e){z0(n,r(e,e,t))})),n}});var G0=$n,W0=vZ,K0=bZ,X0=TypeError;Zo({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=W0(this),r=arguments.length<2,n=r?void 0:arguments[1];if(G0(e),K0(t,(function(i){r?(r=!1,n=i):n=e(n,i,i,t)})),r)throw X0("Reduce of empty set with no initial value");return n}});var J0=So,q0=vZ,Y0=bZ;Zo({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=q0(this),r=J0(e,arguments.length>1?arguments[1]:void 0);return!0===Y0(t,(function(e){if(r(e,e,t))return!0}),!0)}});var Q0=$r,Z0=c0,$0=D$;Zo({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){return Q0($0,this,Z0(e))}});var e1=$r,t1=c0,r1=H$;Zo({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){return e1(r1,this,t1(e))}});var n1,i1=Er(G$),o1=["codec","inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","media-source","csrc","peer-connection","data-channel","stream","track","transceiver","sender","receiver","transport","sctp-transport","candidate-pair","local-candidate","remote-candidate","certificate","ice-server"],a1=new DR,s1=!0,c1=function(){var e=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new qS((function(e){var r={all:[],getTrackStats:function(){return[]}},n=XB("STATS_SCALLBACK_SUPPORT");if(s1&&iB&&void 0===window.InstallTrigger&&nH&&n)try{var i,o,a,s;null===(i=t.getStats((function(t){var r=[];t.result().forEach((function(e){if(!vE(o1).call(o1,e.type)){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),r.push(ux(ux({},t),{},{id:e.id,type:e.type,timestamp:e.timestamp}))}})),e({all:r,getTrackStats:function(e){return Wb(r).call(r,(function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})})))||void 0===i||null===(o=i.then)||void 0===o||null===(a=o.call(i,(function(){e(r)})))||void 0===a||null===(s=a.catch)||void 0===s||s.call(a,(function(){s1=!1,e(r)}))}catch(t){s1=!1,e(r)}else e(r)})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u1=function(){var e=HS(BS().mark((function e(t){var r,n,i,o,a,s,c;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getStats();case 2:return n=e.sent,i={all:[]},o=new DR,n.forEach((function(e){var t=o.get(e.type)||new DR;t.set(e.id,e),o.set(e.type,t),i.all.push(e)})),a=function(e,t){e.forEach((function(e){var r,n,i,a,s,c,u=e.codecId,d=e.transportId,l=e.trackId,h=e.playoutId;if(null===(r=o.get("codec"))||void 0===r||r.forEach((function(e){e.id===u&&t.add(e)})),null===(n=o.get("transport"))||void 0===n||n.forEach((function(e){e.id===d&&(s=e,t.add(e))})),null===(i=o.get("track"))||void 0===i||i.forEach((function(e){e.id===l&&t.add(e)})),null===(a=o.get("media-playout"))||void 0===a||a.forEach((function(e){e.id===h&&t.add(e)})),s){var p,f,v=s,_=v.localCertificateId,m=v.remoteCertificateId,g=v.selectedCandidatePairId;null===(p=o.get("certificate"))||void 0===p||p.forEach((function(e){(e.id===_||e.id===m)&&t.add(e)})),null===(f=o.get("candidate-pair"))||void 0===f||f.forEach((function(e){e.id===g&&(c=e,t.add(e))}))}if(c){var y,S,b=c,E=b.localCandidateId,k=b.remoteCandidateId;null===(y=o.get("local-candidate"))||void 0===y||y.forEach((function(e){e.id===E&&t.add(e)})),null===(S=o.get("remote-candidate"))||void 0===S||S.forEach((function(e){e.id===k&&t.add(e)}))}}))},o.get("media-source")?null===(s=o.get("media-source"))||void 0===s||s.forEach((function(e){var t,r=new i1;r.add(e);var n=[];null===(t=o.get("outbound-rtp"))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(r.add(t),n.push(t),null===(i=o.get("remote-inbound-rtp"))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),a(n,r),i[e.trackIdentifier]=CN(r)})):o.get("track")&&(null===(c=o.get("track"))||void 0===c||c.forEach((function(e){var t,r=new i1;r.add(e);var n=[];null===(t=o.get("outbound-rtp"))||void 0===t||t.forEach((function(t){var i;t.trackId===e.id&&(r.add(t),n.push(t),null===(i=o.get("remote-inbound-rtp"))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),a(n,r),i[e.trackIdentifier]=CN(r)}))),null===(r=o.get("inbound-rtp"))||void 0===r||r.forEach((function(e){var t,r=new i1;r.add(e),null===(t=o.get("remote-outbound-rtp"))||void 0===t||t.forEach((function(t){t.localId===e.id&&r.add(t)})),a([e],r);var n,s=e.trackIdentifier;s||null===(n=o.get("track"))||void 0===n||n.forEach((function(t){t.id===e.trackId&&(s=t.trackIdentifier)})),i[s]=CN(r)})),e.abrupt("return",i);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),d1=function(){var e=HS(BS().mark((function e(t,r,n,i){var o,a,s,c,u,d;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null==r?void 0:r.id,t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",[]);case 3:if(!rB&&!nB){e.next=22;break}if(a=[],e.prev=5,!i){e.next=12;break}return e.next=9,i.getStats();case 9:e.t0=e.sent,e.next=15;break;case 12:return e.next=14,t.getStats(r);case 14:e.t0=e.sent;case 15:e.t0.forEach((function(e){a.push(e)})),e.next=21;break;case 19:e.prev=19,e.t1=e.catch(5);case 21:return e.abrupt("return",a);case 22:return(!(s=a1.get(t))||Date.now()-s.timestamp>150)&&(s={timestamp:Date.now(),statsPromise:u1(t),extraStatsPromise:c1(t)},a1.set(t,s)),e.next=26,s.statsPromise;case 26:if(c=e.sent,u=(o?c[o]:c.all)||[],n){e.next=33;break}return e.next=31,s.extraStatsPromise;case 31:d=e.sent,u=JS(u).call(u,(o?d.getTrackStats(o):d.all)||[]);case 33:return e.abrupt("return",u);case 34:case"end":return e.stop()}}),e,null,[[5,19]])})));return function(t,r,n,i){return e.apply(this,arguments)}}(),l1={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!tH()||void 0},h1=function(e){return e[e.DC_ERROR=0]="DC_ERROR",e[e.DC_CLOSE=1]="DC_CLOSE",e[e.ICE_FAILED=2]="ICE_FAILED",e[e.DESTROY=3]="DESTROY",e[e.TIMEOUT=4]="TIMEOUT",e}(h1||{}),p1=0,f1=function(){Hx(s,Ij);var e,t,r,n,i,o,a=oO(s);function s(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return of(this,s),af(dx(r=a.call(this)),"uuid",(p1++).toString()),af(dx(r),"_peerConnectionId",""),af(dx(r),"audioTrack4ff",void 0),af(dx(r),"_pc",void 0),af(dx(r),"_dc",void 0),af(dx(r),"_iceNode",void 0),af(dx(r),"_initSctpEvents",!1),af(dx(r),"_monitor",void 0),af(dx(r),"_offerIce",{}),af(dx(r),"_answerIce",{}),af(dx(r),"_offerSession",void 0),af(dx(r),"_answerSession",void 0),af(dx(r),"_offerMlines",[]),af(dx(r),"_answerMlines",[]),af(dx(r),"_connectReject",void 0),af(dx(r),"_logger",void 0),af(dx(r),"_destroyed",!1),af(dx(r),"_reportTimer",void 0),af(dx(r),"_clearPeerListeners",void 0),af(dx(r),"_iceStartTs",0),af(dx(r),"_icePreStepTs",0),r._ctx=e,r._groupConnectionId=t,r._isReconnect=n,r._monitor=GV(e.id),r._logger=new dF("PeerConnection_".concat(r.uuid),4,e.id),r._pc=new RTCPeerConnection(l1),r._pc.ontrack=function(e){var t,n,i,o,a=null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id;r._print("pc.ontrack",JS(i=JS(o="".concat(e.track.kind," ")).call(o,e.track.id," ")).call(i,a)),"ff-stream"===a&&(r.audioTrack4ff=e.track),r.emit("ontrack",e)},r._pc.onconnectionstatechange=function(){var e;r._print("onconnectionstatechange",JS(e="".concat(r._pc.connectionState,". ice -> ")).call(e,r._pc.iceConnectionState)),"failed"!==r._pc.iceConnectionState&&"closed"!==r._pc.iceConnectionState&&"failed"!==r._pc.connectionState||r.emit("disconnect",k1.ICE_FAILED)},r._pc.oniceconnectionstatechange=function(){var e=r._pc.iceConnectionState;r._report("rtc_pre_ice_state",{message:e,ice_state:e.toUpperCase()}),r.emit("ice_state",e)},r}return nf(s,[{key:"getOriginRTCPeerConnection",value:function(){return this._pc}},{key:"getConnectionId",value:function(){return this._peerConnectionId}},{key:"getGroupConnectionId",value:function(){return this._groupConnectionId}},{key:"getIceConnectionState",value:function(){return this._pc.iceConnectionState}},{key:"startIceConnect",value:(o=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._print("connect","invoke. %o",t),this._iceNode=t,(r=this._pc.createDataChannel("signaling",{negotiated:!0,id:100})).binaryType="arraybuffer",this._dc=r,e.next=7,this._genIceInfo(t);case 7:return n=e.sent,i=n.offerIce,o=n.answerIce,this._offerIce=i,this._answerIce=o,this._peerConnectionId=o.iceUfrag||"",this.reportRtcPreIce("ice_start"),rB&&(this._pc.addTransceiver("audio",{direction:"recvonly"}),this._pc.addTransceiver("video",{direction:"recvonly"})),e.next=17,this._pc.createOffer();case 17:if((a=e.sent).sdp){e.next=20;break}throw new rN(_P.NOT_SUPPORTED,"create offer sdp failed.");case 20:if(s=LQ.parse(a.sdp),c=xb(s.media,1),u=c[0],this._offerIce.fingerprint=s.fingerprint||u.fingerprint,!rB){e.next=36;break}return s.media=ob(d=s.media).call(d,(function(e){var t,r,n,i,o=ux(ux({},e),p._offerIce);return"video"===o.type&&(iH?(o.ext=null===(t=o.ext)||void 0===t?void 0:Wb(t).call(t,(function(e){var t;return-1===qC(t=e.uri).call(t,"abs-send-time")})),o.rtcpFb=null===(r=o.rtcpFb)||void 0===r?void 0:Wb(r).call(r,(function(e){return"goog-remb"!==e.type}))):(o.rtcpFb=null===(n=o.rtcpFb)||void 0===n?void 0:Wb(n).call(n,(function(e){return"transport-cc"!==e.type})),o.ext=null===(i=o.ext)||void 0===i?void 0:Wb(i).call(i,(function(e){var t;return-1===qC(t=e.uri).call(t,"transport")})))),o})),oH&&uZ(s),(h=ux({},s)).fingerprint=this._answerIce.fingerprint,h.media=ob(l=h.media).call(l,(function(e){return delete(e=ux(ux({},e),p._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:("audio"===e.type&&(e.msid="ff-stream ff-stream-audio"),e.direction="sendonly"),e})),oH&&uZ(h),e.next=32,this.setLocalDescription(LQ.write(s));case 32:return e.next=34,this.setRemoteDescription(LQ.write(h));case 34:e.next=44;break;case 36:delete s.media,this._offerSession=ux({},s),this._answerSession=ux({},s),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),this._offerMlines=[ux(ux(ux({},u),this._offerIce),{},{mid:"".concat(0)})],this._answerMlines=[ux(ux(ux({},u),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(0)})],this.setDescription();case 44:return this._reportTransportStats(),e.next=47,new qS((function(e,t){p._connectReject=t;var n=setTimeout((function(){var e;p.reportRtcPreIce("timeout"),null===(e=p._connectReject)||void 0===e||e.call(p,{code:4,message:"connect timeout"}),delete p._connectReject}),8e3),i=function(){p._print("connect","dataChannel open"),p._reportRtcInvokeStatus("es.dc.open",""),p.reportRtcPreIce("datachannel_opened"),clearTimeout(n),e(""),delete p._connectReject},o=function(e){var t,r,i,o;p._report("rtc_signaling_msg_error",{error_code:null==e||null===(t=e.error)||void 0===t?void 0:t.sdpLineNumber,message:null==e||null===(r=e.error)||void 0===r?void 0:r.errorDetail,reason:"invalid data"}),p._reportRtcInvokeStatus("es.dc.error",""),null===(i=p._connectReject)||void 0===i||i.call(p,{message:"dc.onerror, ".concat(null===(o=e.error)||void 0===o?void 0:o.errorDetail),code:0}),p.emit("disconnect",k1.DC_ERROR),delete p._connectReject,clearTimeout(n)},a=function(){var e;p._reportRtcInvokeStatus("es.dc.close",""),null===(e=p._connectReject)||void 0===e||e.call(p,{message:"dc.onclose",code:1}),p.reportRtcPreIce("datachannel_closed"),p.emit("disconnect",k1.DC_CLOSE),delete p._connectReject,clearTimeout(n)},s=function(){"connected"===p._pc.iceConnectionState?p.reportRtcPreIce("ice_connected"):"failed"!==p._pc.iceConnectionState&&"closed"!==p._pc.iceConnectionState||p.reportRtcPreIce("ice_failed")},c=function(){var e,t;"failed"!==p._pc.iceConnectionState&&"closed"!==p._pc.iceConnectionState&&"failed"!==p._pc.connectionState||(null===(e=p._connectReject)||void 0===e||e.call(p,{message:JS(t="pc.connectionstatechange -> ".concat(p._pc.connectionState,", ice -> ")).call(t,p._pc.iceConnectionState),code:2}),delete p._connectReject,clearTimeout(n))};r.addEventListener("open",i),r.addEventListener("error",o),r.addEventListener("close",a),p._pc.addEventListener("iceconnectionstatechange",s),p._pc.addEventListener("connectionstatechange",c),p._clearPeerListeners=function(){r.removeEventListener("open",i),r.removeEventListener("error",o),r.removeEventListener("close",a),p._pc.removeEventListener("iceconnectionstatechange",s),p._pc.removeEventListener("connectionstatechange",c)}}));case 47:return this._print("connect","dataChannel establish success"),e.abrupt("return",r);case 49:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"setDescription",value:(i=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._print("setDescription","invoke."),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,r=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&e.mid&&r.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=r.join(" "),this._answerSession.groups[0].mids=r.join(" ")),n=kF(),t&&this._report("rtc_begin_create_offer",{direction:"local"===t.streamUserId?"up":"down",stream_id:t.streamId,stream_user_id:t.streamUserId,pc_session_id:this._peerConnectionId,vendor_mode:0}),e.next=10,this._pc.createOffer();case 10:return t&&this._report("rtc_create_offer",{error_code:0,direction:"local"===t.streamUserId?"up":"down",stream_id:t.streamId,stream_user_id:t.streamUserId,elapse:kF()-n}),e.next=13,this.setLocalDescription(LQ.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(LQ.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"setLocalDescription",value:(n=HS(BS().mark((function e(t,r){var n,i,o,a=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=kF(),e.prev=1,e.next=4,this._pc.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this._report("rtc_set_description",{error_code:0,message:t,is_local:"1",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:(null==r?void 0:r.streamId)||"",stream_user_id:(null==r?void 0:r.streamUserId)||"",elapse:kF()-n},{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(o=null===(i=this._pc)||void 0===i?void 0:i.sctp)&&(o.onstatechange=function(){a._reportRtcInvokeStatus("sctp","sctp state change TO: ".concat(o.state))},o.transport&&(o.transport.onstatechange=function(){var e;a._reportRtcInvokeStatus("dtls","dtls state change TO: ".concat(null==o||null===(e=o.transport)||void 0===e?void 0:e.state))}))),e.next=13;break;case 8:throw e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+t,is_local:"1",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:"",stream_user_id:"",elapse:kF()-n},{type:"offer"}),e.t0;case 13:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=kF(),e.prev=1,e.next=4,this._pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this._report("rtc_set_description",{error_code:0,message:t,is_local:"0",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:(null==r?void 0:r.streamId)||"",stream_user_id:(null==r?void 0:r.streamUserId)||"",elapse:kF()-n},{type:"answer"}),e.next=12;break;case 7:throw e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+t,is_local:"0",direction:"local"===(null==r?void 0:r.streamUserId)?"up":"down",stream_id:(null==r?void 0:r.streamId)||"",stream_user_id:(null==r?void 0:r.streamUserId)||"",elapse:kF()-n},{type:"answer"}),e.t0;case 12:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"closeIceConnect",value:function(){var e,t,r;null===(e=this._connectReject)||void 0===e||e.call(this,{code:3,message:"invoke destroy()"}),delete this._connectReject,this._pc.close(),null===(t=this._dc)||void 0===t||t.close(),delete this._dc,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,function(e){a1.has(e)&&a1.delete(e)}(this._pc),null===(r=this._clearPeerListeners)||void 0===r||r.call(this),delete this._clearPeerListeners}},{key:"reportRtcPreIce",value:function(e){var t,r=kF();"ice_start"===e&&(this._iceStartTs=r,this._icePreStepTs=r),this._report("rtc_pre_ice",{connect_event:e,message:e,elapse:r-this._icePreStepTs,total_elapse:r-this._iceStartTs,cache_status:!(null===(t=this._iceNode)||void 0===t||!t.cache_status),is_reconnect:this._isReconnect}),this._icePreStepTs=r}},{key:"getStatsWithLowFrequency",value:function(e,t,r){return d1(this._pc,e,t,r)}},{key:"destroy",value:function(){this._print("destroy",this._peerConnectionId),Bx(Fx(s.prototype),"removeAllListeners",this).call(this),this.closeIceConnect(),this._destroyed=!0,this._reportTimer&&(clearTimeout(this._reportTimer),delete this._reportTimer),delete this._pc}},{key:"_genIceInfo",value:(t=HS(BS().mark((function e(t){var r,n,i,o;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=3,nZ(t);case 3:return o=e.sent,e.abrupt("return",{offerIce:i,answerIce:o});case 5:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"_reportTransportStats",value:(e=HS(BS().mark((function e(){var t,r,n,i,o=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getStatsWithLowFrequency();case 2:t=e.sent,r={},t.forEach((function(e){if("transport"===e.type)r.dtls_state=e.dtlsState,r.bytes_received=e.bytesReceived,r.bytes_sent=e.bytesSent,r.ice_state=e.iceState,r.packets_received=e.packetsReceived,r.packets_sent=e.packetsSent,r.selected_candidate_pair_changes=e.selectedCandidatePairChanges;else if("local-candidate"===e.type||"remote-candidate"===e.type){var t;r.candidates_info=JS(t=[]).call(t,jw(r.candidates_info||[]),[{id:e.id,is_remote:e.isRemote,port:e.port,protocol:e.protocol,candidate_type:e.candidateType,priority:e.priority,network_type:e.networkType,candidate_ip:e.ip}])}else"candidate-pair"===e.type&&(r.candidatePairsInfo={},r.candidatePairsInfo.candidate_state=e.state,r.candidatePairsInfo.writable_state=e.writable,r.candidatePairsInfo.sent_ping_requests_total=e.requestsSent,r.candidatePairsInfo.recv_ping_requests=e.requestsReceived,r.candidatePairsInfo.sent_ping_responses=e.responsesSent,r.candidatePairsInfo.recv_ping_responses=e.responsesReceived,r.candidatePairsInfo.current_rtt=e.currentRoundTripTime,r.candidatePairsInfo.total_rtt=e.totalRoundTripTime,["localCandidateId","remoteCandidateId","bytesSent","bytesReceived","availableOutgoingBitrate","availableIncomingBitrate","bytesDiscardedOnSend","consentRequestsSent","packetsDiscardedOnSend","lastPacketReceivedTimestamp","lastPacketSentTimestamp"].forEach((function(t){void 0!==e[t]&&(r.candidatePairsInfo[uQ(t)]=e[t])})))})),ck(r).length>0&&(null===(n=this._monitor)||void 0===n||n.report("rtc_transport_statistics",r)),this._destroyed||(i="connected"===this._pc.iceConnectionState&&"connected"===this._pc.connectionState,this._reportTimer=setTimeout((function(){o._reportTransportStats()}),i?5e3:1e3));case 7:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"_print",value:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];(t=this._logger).info.apply(t,JS(r=["".concat(e)]).call(r,i))}},{key:"_report",value:function(e,t,r){var n,i,o,a;null===(n=this._monitor)||void 0===n||n.report(e,ux(ux({},t),{},{connection_id:this._peerConnectionId,group_connection_id:this._groupConnectionId}),ux(ux({},r),{},{tcp_only:null===(i=this._iceNode)||void 0===i?void 0:i.iceConfig.tcpOnly,ms_addr:ZS((null===(o=this._iceNode)||void 0===o?void 0:ob(a=o.publicIPs).call(a,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[])}))}},{key:"_reportRtcInvokeStatus",value:function(e,t){this._report("rtc_invoke_status",{sdk_api_name:e,message:t,error_code:0,stream_id:"",elapse:0})}}],[{key:"checkSupported",value:function(){if(!RTCPeerConnection)throw new rN(_P.NOT_SUPPORTED,"missing RTCPeerConnection API.");["addTransceiver","createDataChannel","createOffer","setLocalDescription","setRemoteDescription"].forEach((function(e){var t,r;if(null===(t=RTCPeerConnection)||void 0===t||null===(r=t.prototype)||void 0===r||!r[e])throw new rN(_P.NOT_SUPPORTED,"missing peer.".concat(e," API."))}))}}]),s}(),v1=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(v1||{}),_1=function(e){return e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER",e}(_1||{}),m1=function(e){return e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.EXCEED_QPS=5]="EXCEED_QPS",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN",e}(m1||{}),g1=(af(n1={},0,[0,"success"]),af(n1,1,[_P.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),af(n1,2,[_P.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),af(n1,3,[_P.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),af(n1,4,[_P.USER_MESSAGE_NO_RECEIVER,"cannot find relay path."]),af(n1,5,[_P.USER_MESSAGE_EXCEED_QPS,"cannot find relay path."]),af(n1,17,[_P.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),af(n1,18,[_P.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),af(n1,100,[_P.USER_MESSAGE_NOT_JOIN,"not join room"]),af(n1,105,[_P.USER_MESSAGE_NOT_LOGIN,"not login."]),af(n1,106,[_P.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),af(n1,1e3,[_P.USER_MESSAGE_UNKNOWN,"unknown."]),n1),y1=["msg"],S1=[],b1=function(e){return e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM",e}(b1||{}),E1=function(){Hx(o,Ej.EventEmitter);var e,t,r,n,i=oO(o);function o(e,t,r){var n;return of(this,o),af(dx(n=i.call(this)),"_singlingCache",new DR),af(dx(n),"_p2pCache",new DR),af(dx(n),"_rttIds",{}),af(dx(n),"_p2pMessageId",new YF),af(dx(n),"_clearDataChannelListener",void 0),af(dx(n),"_monitor",void 0),af(dx(n),"logger",void 0),n.id=e,n._dataChannel=t,n.connectionIds=r,n._clearDataChannelListener=n._handleHandler(),n._monitor=GV(e),n.logger=new dF("DataChannelSignaling",3,e),n}return nf(o,[{key:"destroy",value:function(){var e=this;this._clearDataChannelListener(),delete this._dataChannel,this._singlingCache.forEach((function(t,r){t.error(new rN(_P.OPERATION_CANCEL,"disconnect")),e._singlingCache.delete(r)})),this._singlingCache.clear(),this._p2pCache.clear(),this._rttIds={}}},{key:"sendSignaling",value:function(e,t,r){var n,i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6e4;return null===(n=this._monitor)||void 0===n||n.report("rtc_signaling",ux({error_code:0,message:ZS(t),signaling_event:"call-".concat(e),signaling_type:"Send",stream_id:t.streamId,stream_user_id:t.streamUserId,direction:"up"},this.connectionIds)),new qS((function(n,a){var s,c=i._genHeader(r);c.id=RF();var u=c.id.join("-"),d="customMessage"===e;d&&MV.samplingOne2ManyMsg(i.id,Number(c.id.join("")),t);var l=setTimeout((function(){i._singlingCache.delete(u),a(new rN(_P.TIME_OUT,"".concat(e," message time out"))),d&&MV.updateOne2ManyMsgAck(i.id,t,999)}),o);i._singlingCache.set(u,{start:kF(),signalingType:e,success:function(e){clearTimeout(l),n(e),d&&MV.updateOne2ManyMsgAck(i.id,t,0)},error:function(e){clearTimeout(l),a(e),d&&MV.updateOne2ManyMsgAck(i.id,t,e.code)}}),i.logger.info("Signal",JS(s=">>>>>> [".concat(e,"][")).call(s,u,"]"),t),i._sendMessage(e,c,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(n=HS(BS().mark((function e(t,r){var n,i,o;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,i=gV(t,y1),o=n instanceof ArrayBuffer,e.t0=this,e.t1=MV,e.t2=this.id,e.t3=ux,e.t4=ux({ver:1,id:this._p2pMessageId.getMessageId(),time:Date.now(),dir:v1.SEND,type:_1.P2P,err:m1.SUCCESS},i),e.t5={},e.t6=o,!o){e.next=15;break}return e.next=12,IF.ab2b64str(n);case 12:e.t7=e.sent,e.next=16;break;case 15:e.t7=n;case 16:return e.t8=e.t7,e.t9={binary:e.t6,msg:e.t8},e.t10=(0,e.t3)(e.t4,e.t5,e.t9),e.t11=e.t1.samplingP2PMsg.call(e.t1,e.t2,e.t10),e.t12=r,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t11,e.t12));case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return xF(e.msg)?this._rttIds[e.id]=e.id:e.dir===v1.SEND&&this.logger.info("_sendP2PMessage [DC Signaling p2p >>]",ZS(e)),new qS((function(n,i){var o=t._genHeader(ux(ux({needAck:!0,functionType:1},r),{},{id:RF()}));if(e.dir===v1.SEND){var a=setTimeout((function(){t._p2pCache.delete(e.id),i(new rN(_P.USER_MESSAGE_TIMEOUT,"P2P message timeout")),MV.updateP2PMsgAck(t.id,e,999)}),12e3);t._p2pCache.set(e.id,{success:function(r,i){clearTimeout(a),n(i),MV.updateP2PMsgAck(t.id,e,0)},error:function(r){var n;clearTimeout(a),MV.updateP2PMsgAck(t.id,e,r.err);var o=xb(g1[r.err]||[_P.USER_MESSAGE_UNKNOWN,JS(n="err: ".concat(r.err,", msg: ")).call(n,r.msg)],2),s=o[0],c=o[1];i({err:r.err,code:s,message:r.msg||c})}})}try{t._sendMessage("p2p",o,e)}catch(e){throw e.code===_P.NOT_CONNECTED_YET&&(e.code=_P.USER_MESSAGE_BROKEN),e}}))}},{key:"_sendMessage",value:function(e,t,r){var n;if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new rN(_P.NOT_CONNECTED_YET,"DataChannel not open");var i=XB("SIGNAL_COMPRESSION")||t.zip,o=t.version+(Number(i)<<4)+(Number(t.encrypt)<<5),a=Number(t.needAck)+(Number(t.direction)<<1)+(Number(t.functionType)<<2)+(Number(t.binary)<<6),s=IF.str2ab(ZS([e,r])),c=TF(Uint8Array,JS(n=[o,a]).call(n,jw(t.id||[])),i||t.zip?hV.deflate(new Uint8Array(s)):new Uint8Array(s));try{this._dataChannel.send(c.buffer)}catch(e){var u;throw null===(u=this._monitor)||void 0===u||u.report("rtc_error",{message:"datachannel send error: ".concat(e.message),error_code:kX.DC_SEND_ERROR}),e}"p2p"===e?MV.updateP2PMsgReq(this.id,r,c.buffer.byteLength):"customMessage"===e&&MV.updateOne2ManyMsgReq(this.id,r,c.buffer.byteLength)}},{key:"_dispartData",value:function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],o={version:15&n,zip:!(16&~n),encrypt:!(32&~n),needAck:!(1&~i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:!(64&~i)};if(o.needAck||1===o.direction){for(;r<=6;r++)if(!AF(t[r])){r++;break}o.id=CN(LC(t).call(t,2,r))}return{header:o,data:LC(t).call(t,r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n,i,o=this._genHeader({needAck:!0,direction:1,id:ob(n=e.split("-")).call(n,(function(e){return Number(e)}))});vE(S1).call(S1,t)||this.logger.info("Signal",JS(i=">>>>>> [".concat(t,"-res][")).call(i,e,"]")),this._sendMessage("".concat(t,"-res"),o,r)}},{key:"_handleMessage",value:(r=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,u,d;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=Date.now(),n=t.byteLength,i=this._dispartData(t),o=i.data,(a=i.header).zip&&((s=new hV.Inflate).push(o,!0),o=s.result),c=IF.ab2str(o),u=[],e.prev=8,u=JSON.parse(c),e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(8),e.t0 instanceof Error&&(null===(d=this._monitor)||void 0===d||d.report("rtc_signaling_msg_error",ux({error_code:-1,message:e.t0.message,reason:"message parse failed"},this.connectionIds))),e.abrupt("return");case 16:e.t1=a.functionType,e.next=0===e.t1?19:1===e.t1?21:2===e.t1?23:25;break;case 19:return this.C2S(a,u,c,n,r),e.abrupt("break",26);case 21:return this.C2C(u,n,r),e.abrupt("break",26);case 23:return this.C2GW(a,u,c),e.abrupt("break",26);case 25:return e.abrupt("break",26);case 26:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e){return r.apply(this,arguments)})},{key:"C2S",value:(t=HS(BS().mark((function e(t,r,n,i,o){var a,s,c,u,d;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=(null===(a=t.id)||void 0===a?void 0:a.join("-"))||"",1!==t.direction){e.next=5;break}this._handleAckMessage(s,r[0]||{},n),e.next=18;break;case 5:if(!Array.isArray(r)){e.next=18;break}if(u=r[0],r=r[1],vE(S1).call(S1,u)||this.logger.info("Signal","<<<<<< ".concat(u),r,s),this._feedbackSignaling(s,u,u===Aj.ON_CUSTOM_MESSAGE?ux(ux({},r),{},{message:""}):""),!r.binary||"string"!=typeof r.message){e.next=14;break}return e.next=13,IF.b64str2ab(r.message,this._monitor);case 13:r.message=e.sent;case 14:d=Date.now(),this.emit(u,ux({},r)),u===Aj.ON_CUSTOM_MESSAGE&&MV.reportOne2ManyMsgRecv(this.id,r,{msg_size:i,recv_msg_ts:o,fwd_msg_ts:d}),null===(c=this._monitor)||void 0===c||c.report("rtc_signaling",ux({error_code:0,message:n,signaling_event:"on-".concat(u),signaling_type:"Recv",stream_id:r.streamId,stream_user_id:r.clientId,direction:"down"},this.connectionIds));case 18:case"end":return e.stop()}}),e,this)}))),function(e,r,n,i,o){return t.apply(this,arguments)})},{key:"C2C",value:(e=HS(BS().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f,v,_;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Array.isArray(t)&&(t=t[1]),c=null===(i=t)||void 0===i?void 0:i.id,this._rttIds[c]||(null===(o=t)||void 0===o?void 0:o.dir)===v1.FEEDBACK||xF(null===(a=t)||void 0===a?void 0:a.msg)?delete this._rttIds[c]:this.logger.info("Signal","<<<<<< p2p response",t),e.t0=t.dir,e.next=e.t0===v1.SEND?6:e.t0===v1.FEEDBACK?46:48;break;case 6:if(u=Date.now(),xF(null===(s=t)||void 0===s?void 0:s.msg)){e.next=43;break}if(l=(d=t).binary,h=d.msg,p=d.room,f=d.to,v=d.from,_=""===p?l?Aj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:Aj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:l?Aj.USER_BINARY_MESSAGE_RECEIVED:Aj.USER_MESSAGE_RECEIVED,f){e.next=27;break}if(e.t1=this,e.t2=Aj.ON_CUSTOM_MESSAGE,e.t3=v,e.t4=l,!l){e.next=21;break}return e.next=18,IF.b64str2ab(h,this._monitor);case 18:e.t5=e.sent,e.next=22;break;case 21:e.t5=h;case 22:e.t6=e.t5,e.t7={clientId:e.t3,binary:e.t4,message:e.t6},e.t1.emit.call(e.t1,e.t2,e.t7),e.next=43;break;case 27:if(e.t8=this,e.t9=_,e.t10=ux,e.t11=ux({},t),e.t12={},!l){e.next=38;break}return e.next=35,IF.b64str2ab(h,this._monitor);case 35:e.t13=e.sent,e.next=39;break;case 38:e.t13=h;case 39:e.t14=e.t13,e.t15={msg:e.t14},e.t16=(0,e.t10)(e.t11,e.t12,e.t15),e.t8.emit.call(e.t8,e.t9,e.t16);case 43:return this._sendP2PMessage(ux(ux({},t),{},{dir:v1.FEEDBACK,msg:""})),MV.reportP2PMsgRecv(this.id,t,{msg_size:r,recv_msg_ts:n,fwd_msg_ts:u}),e.abrupt("break",49);case 46:return this._handleP2PMsgFeedback(t),e.abrupt("break",49);case 48:return e.abrupt("break",49);case 49:case"end":return e.stop()}}),e,this)}))),function(t,r,n){return e.apply(this,arguments)})},{key:"C2GW",value:function(e,t,r){if(1===e.direction){var n,i=(null===(n=e.id)||void 0===n?void 0:n.join("-"))||"";this._handleAckMessage(i,t[0]||{},r)}else{var o=xb(t,2),a=o[0],s=o[1],c=void 0===s?{}:s;if("RXMediaMsg"===a){var u,d=c.type,l=c.data;switch(null===(u=this._monitor)||void 0===u||u.report("rtc_signaling",ux({error_code:0,message:r,signaling_event:"on-".concat(d),signaling_type:"Recv",stream_id:"",stream_user_id:"",direction:"down"},this.connectionIds)),d){case"RSCP":try{var h=JSON.parse(l);Array.isArray(h)&&this.emit(d,h)}catch(e){}break;case"RTT":try{var p=JSON.parse(l);p.length&&this.emit(d,p[0])}catch(e){}break;case"SSC":try{var f=JSON.parse(l);f.length&&this.emit(d,f[0])}catch(e){}}}}}},{key:"_handleHandler",value:function(){var e=this,t=function(t){e.logger.warn("_handleHandler","dataChannel close",t)},r=function(t){e.logger.error("_handleHandler","dataChannel error",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){var i=e._dataChannel;null==i||i.removeEventListener("close",t),null==i||i.removeEventListener("error",r),null==i||i.removeEventListener("message",n)}}},{key:"_genHeader",value:function(){return ux({version:2,zip:!1,encrypt:!1,needAck:!0,direction:0,functionType:0,binary:!1},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})}},{key:"_handleAckMessage",value:function(e,t,r){var n,i,o=this._singlingCache.get(e);o&&(this._singlingCache.delete(e),200===t.code?o.success(t):o.error(t),this.logger.info("Signal",JS(i="<<<<<< [".concat(o.signalingType,"-ack] ")).call(i,e),t)),null===(n=this._monitor)||void 0===n||n.report("rtc_signaling",ux({error_code:0,message:r,signaling_event:null==o?void 0:o.signalingType,signaling_type:"Ack",stream_id:"",stream_user_id:"",direction:"down",elapse:o?kF()-o.start:0},this.connectionIds))}},{key:"_handleP2PMsgFeedback",value:function(e){var t=this._p2pCache.get(e.id);t&&(this._p2pCache.delete(e.id),e.err===m1.SUCCESS?t.success(e.id,e):t.error(e))}}]),o}(),k1=function(e){return e.ICE_FAILED="ice failed",e.DC_ERROR="datachannel onerror",e.DC_CLOSE="datachannel onclose",e.NODE_CHANGE="recv nodeChange signaling",e.NOTIFY_RECONNECT="recv notifyReconnect signaling",e.JOIN_TIMEOUT="joinRoom timeout, retry with tcp only",e}(k1||{}),T1=function(){Hx(i,Ij);var e,t,r,n=oO(i);function i(e){var t;return of(this,i),af(dx(t=n.call(this)),"id",void 0),af(dx(t),"_monitor",void 0),af(dx(t),"logger",void 0),af(dx(t),"_getAccessManager",void 0),af(dx(t),"_connectionPool",new DR),af(dx(t),"_curConnection",void 0),af(dx(t),"_hasReportBrowerWarning",!1),af(dx(t),"_reconnectTimer",void 0),af(dx(t),"_connecting",!1),af(dx(t),"_isFirstTimeConnected",!0),af(dx(t),"_feedbackNodes",[]),af(dx(t),"_preIceStartTime",-1),af(dx(t),"_tcpOnlyTimer",void 0),af(dx(t),"_destroyed",!1),t._ctx=e,t.id=e.id,t._monitor=GV(t.id),t.logger=new dF("ConnectionManager",3,t.id),t.logger.info("constructor","invoke"),t._getAccessManager=new DQ(e),t}return nf(i,[{key:"startup",value:function(){var e=this;this.logger.info("connect","invoke");try{f1.checkSupported()}catch(e){this.asyncEmit("disconnected",e)}this._connecting||(this._onConnectStart(),qS.resolve().then((function(){return e.emit("__onGetIceConfigHook")})),this._getAccess())}},{key:"reconnectByNodeChange",value:(r=HS(BS().mark((function e(t){var r,n,i,o,a,s,c;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.logger.info("reconnectByNodeChange","invoke %o",t),a=t.nodes,s=t.reason,null===(r=this._monitor)||void 0===r||r.report("rtc_node_change",{error_code:0,message:ZS(t),reason:ZS(s)}),VB.clearAccessNode(this._ctx.appId),null===(n=this._curConnection)||void 0===n||n.pc.reportRtcPreIce("node_change"),c=(null===(i=this._curConnection)||void 0===i||null===(o=i.node.publicIPs[0])||void 0===o?void 0:o.ip)||"",this._closeCurrentConnection(),this._clearConnectionPool(),this._clearReconnectTimer(),this._onConnectStart("recv nodeChange signaling"),Array.isArray(a)&&a.length>0?this._startIceConnect(a):this._getAccess([{feedbackIP:c,feedbackReason:{type:"NODE_CHANGED",reason:s}}]);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"reconnect",value:(t=HS(BS().mark((function e(t){var r,n=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.logger.info("reconnect","invoke. ".concat(r?"ICE over TCP":"")),this._closeCurrentConnection(),this._clearConnectionPool(),this._clearReconnectTimer(),this._onConnectStart(t),this._getAccess(void 0,r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"shotdown",value:function(){var e=this;this.logger.info("destroy","invoke"),this._destroyed=!0,this.asyncEmit("disconnected",new rN(_P.OPERATION_CANCEL,"destroy")).then((function(){Bx(Fx(i.prototype),"removeAllListeners",e).call(e)})),this._clearReconnectTimer(),this._clearConnectionPool(),this._getAccessManager.destroy(),this._closeCurrentConnection()}},{key:"_getAccess",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._getAccessManager.getICENode(e).then((function(e){t.emit("__onGetIceSuccessHook",e),t._startIceConnect(e,r)})).catch((function(e){t.asyncEmit("disconnected",e)})).finally((function(){t._feedbackNodes=[]}))}},{key:"_startIceConnect",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this._destroyed){this.logger.info("_startIceConnect","invoke");var n=sM();this._preIceStartTime=kF();var i=this._ctx.joinRoomConfig.useTcpJoin,o=this._ctx.joinRoomConfig.useTcpJoinDelay,a=function(){var i=HS(BS().mark((function i(o){var a,s,c,u;return BS().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return r&&((o=aQ(o)).iceConfig.tcpOnly=!0),a={node:o},i.prev=2,s=new f1(t._ctx,n,!t._isFirstTimeConnected),a.pc=s,t._connectionPool.set(s.uuid,a),i.next=8,s.startIceConnect(o);case 8:return c=i.sent,u=new E1(t.id,c,{connection_id:s.getConnectionId(),group_connection_id:n}),a.signaling=u,s.reportRtcPreIce("datachannel_send_ping"),i.next=14,u.sendPingSignaling();case 14:s.reportRtcPreIce("datachannel_recv_pong"),t._onConnectSuccess({node:o,pc:s,signaling:u,dc:c}),t.safeEmit("__onConnectSuccessHook",e.length),i.next=22;break;case 19:i.prev=19,i.t0=i.catch(2),t._onConnectionFailed(a,i.t0);case 22:case"end":return i.stop()}}),i,null,[[2,19]])})));return function(e){return i.apply(this,arguments)}}();this.emit("__onIceConnectStartHook"),e.forEach(a),i&&!r&&(this.logger.info("_startIceConnect","tcp-only will try after ".concat(o,"ms")),this._tcpOnlyTimer=window.setTimeout((function(){t.emit("connectWidthTcp"),e.forEach((function(e){(e=aQ(e)).iceConfig.tcpOnly=!0,a(e)})),delete t._tcpOnlyTimer}),o))}}},{key:"_onConnectSuccess",value:function(e){var t,r=this;this.logger.info("connect","peer_%s connect success.",e.pc.uuid),this.emit("__onIceConnectSuccessHook",e),this._curConnection?(e.pc.destroy(),e.signaling.destroy(),this._connectionPool.delete(e.pc.uuid)):(this._curConnection=e,this._addConnectionHandler(e.pc),null===(t=this._monitor)||void 0===t||t.set({connection_id:e.pc.getConnectionId()}),this._connectionPool.delete(e.pc.uuid),this._feedbackNodes.forEach((function(e){return r._feedbackBySignaling(e)})),this._feedbackNodes=[],this._onConnectEnded(e))}},{key:"_onConnectionFailed",value:function(e,t){var r,n,i=this;this.logger.info("connect","peer_%s connect failed. %s",(null===(r=e.pc)||void 0===r?void 0:r.uuid)||"",t.message),this.emit("__onIceConnectFailedHook",e),t.code!==h1.DESTROY&&t.code!==_P.OPERATION_CANCEL&&(this._curConnection?this._feedbackBySignaling(e.node):this._feedbackNodes.push(e.node),this.logger.info("connect","remove cache node"),VB.deleteAccessNode(this._ctx.appId,e.node),e.pc&&(this._connectionPool.delete(e.pc.uuid),e.pc.destroy()),null===(n=e.signaling)||void 0===n||n.destroy(),0!==this._connectionPool.size||this._curConnection||this._destroyed||(this.logger.error("connect","establish peerConnection failed"),this._checkBrowserUA(),kF()-this._preIceStartTime<1e3?(this._clearReconnectTimer(),this._reconnectTimer=window.setTimeout((function(){delete i._reconnectTimer,i._reconnectWithIceFailed(i._feedbackNodes)}),1e3)):this._reconnectWithIceFailed(this._feedbackNodes)))}},{key:"_feedbackBySignaling",value:function(e){var t;null===(t=this._curConnection)||void 0===t||t.signaling.sendSignaling("scheduleMessage",{type:"feedback",body:{feedbackIP:e.publicIPs[0].ip,feedbackReason:{type:"ICE_FAILED",reason:{}}}})}},{key:"_reconnectWithIceFailed",value:(e=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._onConnectStart("ice failed"),this.logger.warn("reconnect","because of ice failed"),this._getAccess(ob(t).call(t,(function(e){return{feedbackIP:e.publicIPs[0].ip,feedbackReason:{type:"ICE_FAILED",reason:{}}}})));case 3:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"_checkBrowserUA",value:function(){var e;!this._hasReportBrowerWarning&&this._ctx.joinRoomConfig.isBlackBrower()&&(this._hasReportBrowerWarning=!0,null===(e=this._monitor)||void 0===e||e.report("rtc_error",{error_code:kX.BLACK_BROWSER,message:"failed to establish data-channel, and the current browser is on the browser blacklist."}))}},{key:"_onConnectStart",value:function(e){var t;this.logger.info("_onConnectStart","invoke, reason: ".concat(e||"init")),this._connecting=!0,e?this.asyncEmit("reconnecting",e):this.asyncEmit("connecting");var r,n=sM();null===(t=this._monitor)||void 0===t||t.set({connect_session_id:n}),this._isFirstTimeConnected||null===(r=this._monitor)||void 0===r||r.report("rtc_reconnect",{error_code:1002,message:"peerconnection reconnecting",reconnect_id:n,reconnect_type:"peerconnection"},{reason:e})}},{key:"_onConnectEnded",value:function(e){var t;this.logger.info("_onConnectEnded","invoke"),this._connecting=!1,this._isFirstTimeConnected||null===(t=this._monitor)||void 0===t||t.report("rtc_reconnected",{message:"peerconnection reconnected",reconnect_type:"peerconnection"}),this._isFirstTimeConnected=!1,this.asyncEmit("connected",e),e.node.iceConfig.tcpOnly&&(this.logger.info("_onConnectEnded","use tcp only"),qV(this._ctx.id,"connected_with_tcp_only",ZS(e.node))),this._tcpOnlyTimer&&(window.clearTimeout(this._tcpOnlyTimer),delete this._tcpOnlyTimer),this._clearConnectionPool()}},{key:"_addConnectionHandler",value:function(e){var t=this;e.on("disconnect",(function(e){t._closeCurrentConnection(),t._clearReconnectTimer(),navigator.onLine?t.reconnect(e):t._reconnectTimer=window.setTimeout((function(){return t.reconnect(e)}),3e3)}))}},{key:"_closeCurrentConnection",value:function(){var e,t;null===(e=this._curConnection)||void 0===e||e.pc.destroy(),null===(t=this._curConnection)||void 0===t||t.signaling.destroy(),delete this._curConnection}},{key:"_clearConnectionPool",value:function(){var e=this;this._connectionPool.forEach((function(t,r){var n,i;null===(n=t.signaling)||void 0===n||n.destroy(),null===(i=t.pc)||void 0===i||i.destroy(),e._connectionPool.delete(r)}))}},{key:"_clearReconnectTimer",value:function(){this._reconnectTimer&&(window.clearTimeout(this._reconnectTimer),delete this._reconnectTimer)}}]),i}(),I1=Er(Uc.f("asyncIterator"));function R1(e){var t,r,n,i=2;for(void 0!==Mp&&(r=I1,n=Zp);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new C1(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function C1(e){function t(e){if(Object(e)!==e)return sS.reject(new TypeError(e+" is not an object."));var t=e.done;return sS.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(C1=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?sS.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?sS.reject(e):t(r.apply(this.s,arguments))}},new C1(e)}var w1,A1,x1,O1=function(e){return e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX",e}(O1||{}),P1=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(P1||{}),N1=function(e){return e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED",e}(N1||{}),M1=function(){Hx(r,Ej.EventEmitter);var e,t=oO(r);function r(e,n){var i;return of(this,r),af(dx(i=t.call(this)),"_context",void 0),af(dx(i),"peerConnectionMode",0),af(dx(i),"id",void 0),af(dx(i),"_monitor",void 0),af(dx(i),"logger",void 0),af(dx(i),"_nextSsrc",Math.floor(Math.random()*YQ+1e4)),af(dx(i),"_aSendonlyAnswerTpl",void 0),af(dx(i),"_vSendonlyAnswerTpl",void 0),af(dx(i),"_enableSubFlexfec",!1),af(dx(i),"audioTrack4ff",void 0),af(dx(i),"setLocalDescription",void 0),af(dx(i),"setRemoteDescription",void 0),i.peer=n,i.id=e.id,i._monitor=GV(i.id),i.logger=new dF("BasicHandler",3,e.id),i.setLocalDescription=n.setLocalDescription.bind(n),i.setRemoteDescription=n.setRemoteDescription.bind(n),i._context=e,i.peer.on("ontrack",(function(e){i.emit("ontrack",e)})),i}return nf(r,[{key:"destroy",value:function(){this.logger.info("destroy",this.peerConnectionId||""),Bx(Fx(r.prototype),"removeAllListeners",this).call(this)}},{key:"_peerConnection",get:function(){return this.peer.getOriginRTCPeerConnection()}},{key:"getTransceivers",value:function(){return this._peerConnection.getTransceivers()}},{key:"getConnectionState",value:function(){return this._peerConnection.connectionState}},{key:"_simulcast",value:function(e,t,r,n,i){var o,a,s,c=[];1===e.videoEncodeConfig.length?(c=function(e,t){var r=[];if(t<=1)return r;var n=Math.min(e.width,e.height)/90;return r.push({scaleResolutionDownBy:n,width:Math.floor(e.width/n),height:Math.floor(e.height/n),maxkbps:100,frameRate:10}),t<=2||r.unshift({scaleResolutionDownBy:2,width:Math.floor(e.width/2),height:Math.floor(e.height/2),maxkbps:Math.floor(e.maxKbps/2),frameRate:e.frameRate>=30?Math.floor(e.frameRate/2):e.frameRate}),r}(t,i),this.logger.info("simulcast() ","simulcastLayers: %o",c)):(c=ob(o=LC(a=LC(s=e.videoEncodeConfig).call(s,1)).call(a,1-i)).call(o,(function(e){if(e.width>e.height&&t.width<t.height||e.width<e.height&&t.width>t.height){var r=e.width;e.width=e.height,e.height=r}var n=jF(e.width),i=t.width/n;return{width:n,height:Math.floor(t.height/i),scaleResolutionDownBy:i,frameRate:jF(e.frameRate)||15,maxkbps:e.maxKbps||600}})),this.logger.info("simulcast() ","simulcastLayers2: %o",c));var u=[!0];c.forEach((function(e,t){var i,o={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};null===(i=r.sendEncodings)||void 0===i||i.unshift(o),n.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)}),u.push(!0)})),this._context&&(this._context.activeSimStreams=u)}},{key:"internalPublish",value:function(e){var t,r,n=e.stream,i=e.videoTrack,o=e.audioTrack,a=e.enableSimulcast,s=e.pubAudio,c=e.pubVideo,u={direction:"sendonly",streams:[n]},d={direction:"sendonly",streams:[n]},l=[],h=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var p,f,v=null==i?void 0:i.preprocessingTrack,_=ux({},QB);if(v){var m=null==v?void 0:v.getSettings();_={width:Math.floor(m.width),height:Math.floor(m.height),frameRate:Math.floor(m.frameRate)}}"number"!=typeof _.frameRate&&(_.frameRate=30);var g=null==e?void 0:e.videoEncodeConfig[0],y={maxBitrate:1e3*g.maxKbps,rid:"0"};if(e.prevBitrate=g.maxKbps,d.sendEncodings=[y],l.push({width:_.width,height:_.height,framerate:_.frameRate,maxkbps:g.maxKbps,rid:"0"}),a&&(!rB||"VP8"===(null===(p=this._context)||void 0===p||null===(f=p.serverConfig)||void 0===f?void 0:f.videoCodec))){var S,b,E=function(e){for(var t=0,r=e.width*e.height,n=0;n<gQ.length;n++)if(r>=gQ[n].totalPixels){t=n;break}if(0===t)return gQ[t].maxLayers;var i=gQ[t-1].totalPixels;return(i-r)/(i-gQ[t].totalPixels)<.1?gQ[t-1].maxLayers:gQ[t].maxLayers}(_);this.logger.info("simulcast() ","maxLayers: %o",E),E>1&&(this._simulcast(e,ux(ux({},_),{},{maxKbps:g.maxKbps}),d,l,E),null!==(S=this._context)&&void 0!==S&&null!==(b=S.serverConfig)&&void 0!==b&&b.simulcastOnDemand&&(h=ob(l).call(l,(function(e,t){return ux(ux({},e),{},{video_index:t,sub_index:t})}))))}}null!==(t=this._context)&&void 0!==t&&null!==(r=t.serverConfig)&&void 0!==r&&r.e2eFeedback&&(h=ob(l).call(l,(function(e,t){return ux(ux({},e),{},{video_index:t,sub_index:t})}))),this.logger.info("publish videoTransceiverInit videoDescriptions","",d,l);var k=null==o?void 0:o.preprocessingTrack;(null==o?void 0:o.mixType)!==P1.PLAYOUT&&null!=o&&o.mixedAudioTrack&&(k=null==o?void 0:o.mixedAudioTrack),k=s&&k?k:"audio";var T=null==i?void 0:i.preprocessingTrack;T=c&&T?T:"video";try{this._reportRtcInvokeStatus("Handler.internalPublish",ZS({aTrack:dM(k),vTrack:dM(T),audioTransceiverInit:u,videoTransceiverInit:d}))}catch(e){}return{semantics:"unified-plan",videoDescriptions:l,subVideoDescriptions:h,audioTransceiverInit:{track:k,init:u},videoTransceiverInit:{track:T,init:d}}}},{key:"updateMaxBitrate",value:function(e){var t,r,n,i;this.logger.info("updateMaxBitrate()");var o=null===(t=e.videoTrack)||void 0===t?void 0:t.preprocessingTrack,a=e.videoTransceiver;if(o&&e.pubVideo&&a){var s=null===(r=e.videoEncodeConfig)||void 0===r||null===(n=r[0])||void 0===n?void 0:n.maxKbps;if(s){if(s===e.prevBitrate)return void this.logger.warn("updateMaxBitrate()","no change");e.prevBitrate=s}var c=null===(i=a.sender)||void 0===i?void 0:i.getParameters();if(c){var u;c.encodings=null==c||null===(u=c.encodings)||void 0===u?void 0:ob(u).call(u,(function(t){var r,n=Number(t.rid)||0,i=null===(r=e.videoEncodeConfig[n])||void 0===r?void 0:r.maxKbps;return"number"==typeof i&&(t.maxBitrate=1e3*i),t})),null==a||a.sender.setParameters(c);try{this._reportRtcInvokeStatus("Handler.updateScaleResolutionDownBy",ZS(c.encodings))}catch(e){}}}else this.logger.warn("updateMaxBitrate()","no pub")}},{key:"setCurrentDescription",value:(e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})},{key:"createAVMlineAnswerTpl",value:function(e){var t=this,r=LQ.parse(e);r.media.forEach((function(e){if("audio"===e.type){if("sendonly"===e.direction){var r,n=null==e?void 0:DC(r=e.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&null!=e&&e.fmtp){var i,o=null==e?void 0:DC(i=e.fmtp).call(i,(function(e){return e.payload===n.payload}));o&&t._context&&(o.config+=";stereo=1;sprop-stereo=1")}t._aSendonlyAnswerTpl=e}}else"video"===e.type&&("sendonly"===e.direction&&(t._vSendonlyAnswerTpl=e),Array.isArray(e.rtp)&&e.rtp.forEach((function(e){var r;null!==(r=e.codec)&&void 0!==r&&vE(r).call(r,"flexfec")&&(t._enableSubFlexfec=!0)})))})),oH&&uZ(r)}},{key:"peerConnectionId",get:function(){return this.peer.getConnectionId()||""}},{key:"addBitrateLimit",value:function(e,t){null==e||e.rtp.forEach((function(r){var n,i=r.codec,o=r.payload;if(vE(n=["vp8","h264"]).call(n,i.toLocaleLowerCase())){var a,s,c=DC(a=e.fmtp).call(a,(function(e){return e.payload===o}));c?c.config=JS(s=[]).call(s,jw(c.config.split(";")),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)]).join(";"):e.fmtp.push({payload:o,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))}},{key:"_report",value:function(e,t,r){var n;null===(n=this._monitor)||void 0===n||n.report(e,ux(ux({},t),{},{connection_id:this.peer.getConnectionId(),group_connection_id:this.peer.getGroupConnectionId()}),r)}},{key:"_reportRtcInvokeStatus",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4?arguments[4]:void 0;this._report("rtc_invoke_status",{sdk_api_name:e,message:t,error_code:r,stream_id:n,elapse:0},i)}}]),r}(),D1=new dF("queue",4),L1=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(L1||{}),U1=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(U1||{}),V1=(af(w1={},"publish","unpublish"),af(w1,"subscribe","unsubscribe"),af(w1,"pushtrack","removetrack"),w1),F1=(af(A1={},"publish",0),af(A1,"subscribe",0),af(A1,"pushtrack",0),af(A1,"unpublish",1),af(A1,"unsubscribe",1),af(A1,"removetrack",1),A1),B1=function(){Hx(t,kj);var e=oO(t);function t(){var r;return of(this,t),af(dx(r=e.call(this)),"_queue",void 0),r._queue=[],r}return nf(t,[{key:"queue",get:function(){return this._queue}},{key:"enqueue",value:function(e){var t,r=this._queue.length,n="";return this._queue=Wb(t=this._queue).call(t,(function(t){return t.streamId!==e.streamId||e.action!==V1[t.action]||(n=t.streamId,D1.info("offsetStreamId",n),!1)})),this._queue.length===r&&this._queue.push(e),this.emit("start"),n}},{key:"dequeue",value:function(){var e;if(!this._queue.length)return null;var t=this._queue.length;iB&&AB>=86&&AB<=92&&(t=Math.min(this._queue.length,5));for(var r=F1[this._queue[0].action],n=1;n<t;n++){var i;if(F1[this._queue[n].action]!==r)return{sdpStrategy:r,items:mw(i=this._queue).call(i,0,n)}}return{sdpStrategy:r,items:mw(e=this._queue).call(e,0,t)}}}]),t}(),j1=tH(),H1=function(){Hx(s,M1);var e,t,r,n,i,o,a=oO(s);function s(e,t){var r;return of(this,s),af(dx(r=a.call(this,e,t)),"name","chrome"),af(dx(r),"_queueBusy",!1),af(dx(r),"_sdpQueue",void 0),af(dx(r),"_aSendonlyOfferTpl",void 0),af(dx(r),"_vSendonlyOfferTpl",void 0),af(dx(r),"_aRecvonlyOfferTpl",void 0),af(dx(r),"_vRecvonlyOfferTpl",void 0),af(dx(r),"_mid",10),af(dx(r),"_inactiveMlineIndex",[]),af(dx(r),"_mlinesCache",{}),af(dx(r),"setDescription",void 0),r.logger=new dF("ChromeHandler",3,e.id),r.setDescription=t.setDescription.bind(t),r._sdpQueue=new B1,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(r.logger.info("dequeue start"),r.dequeue())})),r}return nf(s,[{key:"destroy",value:function(){Bx(Fx(s.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(o=HS(BS().mark((function e(t){var r,n,i,o,a,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R,C,w,A,x,O,P,N,M,D,L,U,V,F,B;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d=t.stream,l=t.enableSimulcast,h=Bx(Fx(s.prototype),"internalPublish",this).call(this,t),p=h.videoDescriptions,f=h.subVideoDescriptions,v=h.audioTransceiverInit,_=h.videoTransceiverInit,m=ZQ(this._nextSsrc),this._nextSsrc=m.next,g="".concat(this._mid++),y="".concat(this._mid++),S=ux(ux(ux({},this._aSendonlyOfferTpl),this.peer._offerIce),{},{mid:g,msid:JS(r="".concat(d.id," ")).call(r,d.id,"-audio"),ssrcs:$Q(d.id,"audio",m.audio,QQ)}),b=ux(ux(ux({},this._vSendonlyOfferTpl),this.peer._offerIce),{},{mid:y,msid:JS(n="".concat(d.id," ")).call(n,d.id,"-video")}),l?(this.logger.info("subVideoDesc","desc: %o ",f),delete b.ssrcGroups,delete b.ssrcs,E=[],b.rids=ob(p).call(p,(function(e){var t=e.rid;return E.unshift(t),{id:t,direction:"send"}})),b.simulcast={dir1:"send",list1:E.join(";")}):(k=eZ(d.id,m,{cname:QQ}),T=k.ssrcs,I=k.ssrcGroups,b.ssrcs=T,b.ssrcGroups=I),null!==(i=this._context)&&void 0!==i&&null!==(o=i.serverConfig)&&void 0!==o&&o.audioRed&&Array.isArray(S.rtp)&&(-1!==(C=$O(R=S.rtp).call(R,(function(e){return"red"===e.codec})))&&(A=mw(w=S.rtp).call(w,C,1),x=xb(A,1),O=x[0],S.rtp.unshift(O)),P=[],S.rtp.forEach((function(e){return P.push(e.payload)})),S.payloads=P.join(" ")),null!==(a=this._context)&&void 0!==a&&null!==(c=a.serverConfig)&&void 0!==c&&c.videoCodec&&sZ(b,null===(N=this._context)||void 0===N||null===(M=N.serverConfig)||void 0===M?void 0:M.videoCodec),Array.isArray(b.ext)&&(XB("IOS_SAFARI_ORIENTATION")||!nB&&!_B||(b.ext=Wb(L=b.ext).call(L,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&vE(t).call(t,"video-orientation"))}))),b.ext=Wb(D=b.ext).call(D,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&vE(t).call(t,"framemarking"))}))),(U=null==S?void 0:DC(u=S.rtp).call(u,(function(e){return"opus"===e.codec})))&&S.fmtp&&(B=DC(V=S.fmtp).call(V,(function(e){return e.payload===U.payload})))&&null!==(F=this._context)&&void 0!==F&&F.audioProfileManager&&(B.config=this._context.audioProfileManager.getOpusConfigStr(B.config)),l||nB||this.addBitrateLimit(b,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[S,b],e.abrupt("return",{partialSdp:rZ(this.peer._offerSession,S,b),audioMid:g,videoMid:y,type:"incroffer",semantics:"unified-plan",videoDescriptions:p,subVideoDescriptions:f,audioTransceiverInit:v,videoTransceiverInit:_,peerConnectionMode:this.peerConnectionMode});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"subscribe",value:(i=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R,C,w,A,x,O,P,N,M,D,L,U;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("subscribe"),a="incroffer",s="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=9;break}return e.next=6,z1();case 6:return c=e.sent,e.next=9,this.createAVMlineOfferTpl(c);case 9:return u="",d="",l=!1,h=!1,p=void 0,f=void 0,this._mlinesCache[t.streamId]=[p,f],t.virtual?(u="".concat(this._mid++),l=!0):r.multiChatMode?(u="".concat(this._mid++),d="".concat(this._mid++),h=!0):(l=!0,h=!0,u="".concat(this._mid++),d="".concat(this._mid++)),u&&(p=ux(ux({},aQ(this._aRecvonlyOfferTpl)),{},{mid:u})),l&&(this._mlinesCache[t.streamId][0]=p,v={track:"audio",init:{direction:"recvonly"}}),d&&(f=ux(ux({},aQ(this._vRecvonlyOfferTpl)),{},{mid:d})),h&&(this._mlinesCache[t.streamId][1]=f,_={track:"video",init:{direction:"recvonly"}}),m=rZ(this.peer._offerSession,p,f),g=void 0,y=void 0,t.enableVendorMode||r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._vSendonlyAnswerTpl||(g=ZQ(this._nextSsrc),this._nextSsrc=g.next,C=ux(ux(ux({},this._aSendonlyAnswerTpl),this.peer._answerIce),{},{mid:u,msid:JS(S=JS(b="".concat(t.streamId)).call(b,null!==(E=this._context)&&void 0!==E&&E.avSync?"":"-audio"," ")).call(S,t.streamId,"-audio"),ssrcs:$Q(t.streamId,"audio",g.audio)}),w=ux(ux(ux({},this._vSendonlyAnswerTpl),this.peer._answerIce),{},{mid:d,msid:JS(k=JS(T="".concat(t.streamId)).call(T,null!==(I=this._context)&&void 0!==I&&I.avSync?"":"-video"," ")).call(k,t.streamId,"-video")},eZ(t.streamId,g,{flexfec:this._enableSubFlexfec})),y={sdp:LQ.write(ux(ux({},this.peer._answerSession),{},{media:[C,w]})),sequenceId:t.sequenceId?++t.sequenceId:0},null===(R=g)||void 0===R||delete R.next),(A=null===(n=p)||void 0===n?void 0:DC(i=n.rtp).call(i,(function(e){return"opus"===e.codec})))&&null!==(o=p)&&void 0!==o&&o.fmtp&&(P=null===(x=p)||void 0===x?void 0:DC(O=x.fmtp).call(O,(function(e){return e.payload===A.payload})))&&this._context&&(P.config+=";stereo=1;sprop-stereo=1"),t.isPublic&&AB>=86&&null!=(L=null===(N=f)||void 0===N?void 0:Wb(M=N.rtp).call(M,(function(e){return"H264"===e.codec})))&&L.length&&null!==(D=f)&&void 0!==D&&D.fmtp&&(null===(U=f)||void 0===U||U.fmtp.forEach((function(e){DC(L).call(L,(function(t){return t.payload===e.payload}))&&(e.config+=";sps-pps-idr-in-keyframe=1")}))),e.abrupt("return",{partialSdp:m,audioMid:u,videoMid:d,type:a,semantics:s,audioTransceiverInit:v,videoTransceiverInit:_,allSsrc:g,peerConnectionMode:this.peerConnectionMode,signalingAck:y});case 29:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"handleAck",value:(n=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("handleAck()","item: %o",t),e.abrupt("return",this._sdpQueue.enqueue(t));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"dequeue",value:(r=HS(BS().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,t=this._sdpQueue.dequeue(),this.logger.info("dequeue()","ret: %o",t),t){e.next=6;break}return this._queueBusy=!1,e.abrupt("return");case 6:if(r=[],e.prev=7,n=t.items,i=t.sdpStrategy,o=[],a=[],s=[],i!==L1.ADD){e.next=16;break}return e.delegateYield(BS().mark((function e(){var t,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(t=ux({},m.peer._answerIce)).candidates,c=!1,u=!1,e.prev=4,l=R1(n);case 6:return e.next=8,l.next();case 8:if(!(c=!(h=e.sent).done)){e.next=16;break}if(i=h.value,"break"!==function(){var e=i.audioMid,n=i.videoMid,c=i.action,u=i.audioTransceiverInit,d=i.videoTransceiverInit,l=i.signalingAck,h=i.stream,p=h instanceof oX;if(i.onSuccess&&s.push(i.onSuccess),i.onFail&&r.push(i.onFail),p&&(null==l?void 0:l.sequenceId)<h.sequenceId)return"break";var f,v={},_={},g=LQ.parse(l.sdp);Array.isArray(g.media)&&zO(f=g.media).call(f,(function(e,t){var r;return null==e||null===(r=e.type)||void 0===r?void 0:r.localeCompare(null==t?void 0:t.type)})).forEach((function(r){"audio"===(r=ux(ux({},r),t)).type?(v=r).mid=e:(_=r).mid=n}));var y,S=h.streamId;if(c===U1.publish&&(S=null===(y=h.stream)||void 0===y?void 0:y.id),!m._mlinesCache[S])return"break";var b=xb(m._mlinesCache[S],2),E=b[0],k=b[1];if(u&&E){h.audioTransceiver=m._peerConnection.addTransceiver(u.track,u.init),m._reportRtcInvokeStatus("chromeHandler.addTrack",ZS({audioStreamTrack:dM(u.track)}));var T=m._inactiveMlineIndex.shift();T||(T=m.peer._offerMlines.length),m.peer._offerMlines[T]=ux({},E),m.peer._answerMlines[T]=v,j1&&h.initAudioEncodedTransform()}if(d&&k){var I,R;h.videoTransceiver=m._peerConnection.addTransceiver(d.track,d.init),m._reportRtcInvokeStatus("chromeHandler.addTrack",ZS({videoStreamTrack:dM(d.track)}));var C,w,A=m._inactiveMlineIndex.shift();A||(A=m.peer._offerMlines.length),m.peer._offerMlines[A]=ux({},k),c===U1.publish&&null!==(I=m._context)&&void 0!==I&&null!==(R=I.serverConfig)&&void 0!==R&&R.videoCodec&&sZ(_,null===(C=m._context)||void 0===C||null===(w=C.serverConfig)||void 0===w?void 0:w.videoCodec),m.peer._answerMlines[A]=_,j1&&h.initVideoEncodedTransform()}o.push(h.streamId||""),a.push(p?h.userId:"local"),p&&(h.sequenceId=null==l?void 0:l.sequenceId),delete m._mlinesCache[S]}()){e.next=13;break}return e.abrupt("break",16);case 13:c=!1,e.next=6;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(4),u=!0,d=e.t0;case 22:if(e.prev=22,e.prev=23,!c||null==l.return){e.next=27;break}return e.next=27,l.return();case 27:if(e.prev=27,!u){e.next=30;break}throw d;case 30:return e.finish(27);case 31:return e.finish(22);case 32:case"end":return e.stop()}}),e,null,[[4,18,22,32],[23,,27,31]])}))(),"t0",14);case 14:e.next=21;break;case 16:_={},n.forEach((function(e){var t=e.audioMid,r=e.videoMid,n=e.action;_[t]=t,n!==U1.removetrack&&(_[r]=r),_[t]=t})),this.peer._offerMlines=ob(p=this.peer._offerMlines).call(p,(function(e,t){return _[e.mid]&&(e=tZ(e),m._inactiveMlineIndex.push(t)),e})),zO(f=this._inactiveMlineIndex).call(f,(function(e,t){return e-t})),this.peer._answerMlines=ob(v=this.peer._answerMlines).call(v,(function(e){return _[e.mid]&&(e=tZ(e)),e}));case 21:return e.prev=21,e.next=24,this.setDescription(o.length?{streamId:o.join(","),streamUserId:a.join(",")}:void 0);case 24:e.next=32;break;case 26:if(e.prev=26,e.t1=e.catch(21),"have-local-offer"!==this._peerConnection.signalingState){e.next=31;break}return e.next=31,this._peerConnection.setLocalDescription({type:"rollback"});case 31:throw e.t1;case 32:try{s.forEach((function(e){return e()}))}catch(e){}this.logger.info("dequeue","loop"),e.next=40;break;case 36:e.prev=36,e.t2=e.catch(7),this.logger.error("dequeue","unknown error: %o",e.t2),r.forEach((function(t){return t(e.t2)}));case 40:return e.prev=40,this.dequeue(),e.finish(40);case 43:case"end":return e.stop()}}),e,this,[[7,36,40,43],[21,26]])}))),function(){return r.apply(this,arguments)})},{key:"getDefaultSdp",value:(t=HS(BS().mark((function e(){var t,r,n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,z1();case 2:return r=e.sent,this.createAVMlineOfferTpl(r),n=LQ.parse(r),i=[],n.media=Wb(t=n.media).call(t,(function(e){var t;return"recvonly"===e.direction&&(Array.isArray(e.ext)&&(e.ext=Wb(t=e.ext).call(t,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),i.push("".concat(e.mid)),!0)})),n.groups=[{mids:i.join(" "),type:"BUNDLE"}],oH&&uZ(n),e.abrupt("return",{sdp:LQ.write(n),semantics:"unified-plan",type:"incroffer"});case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"rollback",value:(e=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.msid,delete this._mlinesCache[r];case 2:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this,r=LQ.parse(e);r.media.forEach((function(e){if("audio"===e.type)if("sendonly"===e.direction)t._aSendonlyOfferTpl=e;else{var r;Array.isArray(e.ext)&&(e.ext=Wb(r=e.ext).call(r,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),t._aRecvonlyOfferTpl=e}else if("video"===e.type)if("sendonly"===e.direction)t._vSendonlyOfferTpl=e;else{var n;Array.isArray(e.ext)&&(e.ext=Wb(n=e.ext).call(n,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),t._vRecvonlyOfferTpl=e}})),oH&&uZ(r)}}]),s}(),z1=function(){var e=HS(BS().mark((function e(){var t,r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,OF(!0);case 3:if(t=e.sent){e.next=6;break}throw"pc.createOffer() return empty.";case 6:e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),r="Get offer Error. ".concat(e.t0.message|e.t0),new rN(_P.NOT_SUPPORTED,r);case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}(),G1=function(){Hx(u,M1);var e,t,r,n,i,o,a,s,c=oO(u);function u(e,t){var r;return of(this,u),af(dx(r=c.call(this,e,t)),"name","firefox"),af(dx(r),"_aRecvonlyOfferTpl",void 0),r.logger=new dF("FirefoxHandler",3,e.id),r}return nf(u,[{key:"publish",value:(s=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,d,l,h,p,f,v,_,m,g=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Bx(Fx(u.prototype),"internalPublish",this).call(this,t),o=i.videoDescriptions,a=i.subVideoDescriptions,s=i.audioTransceiverInit,c=i.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(s.track,s.init),Array.isArray(c.init.sendEncodings)&&1===c.init.sendEncodings.length&&(c.init.sendEncodings=ob(d=c.init.sendEncodings).call(d,(function(e){return delete e.rid,e}))),t.videoTransceiver=this._peerConnection.addTransceiver(c.track,c.init),l=kF(),this._report("rtc_begin_create_offer",{direction:"up",stream_id:"",stream_user_id:"",pc_session_id:this.peerConnectionId,vendor_mode:0}),e.next=8,this._peerConnection.createOffer();case 8:return h=e.sent,this._report("rtc_create_offer",{direction:"up",error_code:0,stream_id:"",stream_user_id:"",elapse:kF()-l}),(p=LQ.parse(h.sdp)).media=null===(r=p.media)||void 0===r?void 0:ob(r).call(r,(function(e){return ux(ux({},e),g.peer._offerIce)})),uZ(p),e.next=15,this.setLocalDescription(LQ.write(p));case 15:return f=t.audioTransceiver.mid,v=t.videoTransceiver.mid,_=null,m=null,p.media=null===(n=p.media)||void 0===n?void 0:ob(n).call(n,(function(e){if("".concat(e.mid)===f){var t,r,n=null===(t=_=e)||void 0===t?void 0:DC(r=t.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&_.fmtp){var i,o,a=DC(i=_.fmtp).call(i,(function(e){return e.payload===n.payload}));a&&null!==(o=g._context)&&void 0!==o&&o.audioProfileManager&&(a.config=g._context.audioProfileManager.getOpusConfigStr(a.config))}}else if("".concat(e.mid)===v){var s,c,u,d;null!==(s=g._context)&&void 0!==s&&null!==(c=s.serverConfig)&&void 0!==c&&c.videoCodec&&sZ(e,null===(u=g._context)||void 0===u||null===(d=u.serverConfig)||void 0===d?void 0:d.videoCodec),m=e}return e})),this.addBitrateLimit(m,t.videoEncodeConfig[0].maxKbps),e.next=23,this.setLocalDescription(LQ.write(p));case 23:return e.abrupt("return",{partialSdp:rZ(p,_,m),audioMid:f,videoMid:v,type:"incroffer",semantics:"unified-plan",videoDescriptions:o,subVideoDescriptions:a,audioTransceiverInit:s,videoTransceiverInit:c,peerConnectionMode:this.peerConnectionMode});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"subscribe",value:(a=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R,C,w=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("subscribe()"),c="",u="",d=!1,l=!1,h=void 0,p=void 0,t.virtual?d=!0:(r.multiChatMode||(d=!0),l=!0),d&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),l&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),f=kF(),this._report("rtc_begin_create_offer",{direction:"up",stream_id:t.streamId,stream_user_id:t.userId,pc_session_id:this.peerConnectionId,vendor_mode:0}),e.next=14,this._peerConnection.createOffer();case 14:return v=e.sent,this._report("rtc_create_offer",{error_code:0,direction:"up",stream_id:t.streamId,stream_user_id:t.userId,elapse:kF()-f}),(_=LQ.parse(v.sdp)).media=null===(n=_.media)||void 0===n?void 0:ob(n).call(n,(function(e){return ux(ux({},e),w.peer._offerIce)})),ob(i=_.media).call(i,(function(e){var t,r,n,i;"video"===e.type&&(iH?(e.ext=null===(t=e.ext)||void 0===t?void 0:Wb(t).call(t,(function(e){var t;return-1===qC(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Wb(r).call(r,(function(e){return"goog-remb"!==e.type}))):(e.rtcpFb=null===(n=e.rtcpFb)||void 0===n?void 0:Wb(n).call(n,(function(e){return"transport-cc"!==e.type})),e.ext=null===(i=e.ext)||void 0===i?void 0:Wb(i).call(i,(function(e){var t;return-1===qC(t=e.uri).call(t,"transport")}))))})),oH&&uZ(_),e.next=22,this.setLocalDescription(LQ.write(_),{streamId:t.streamId||"",streamUserId:t.userId});case 22:return c=null===(o=t.audioTransceiver)||void 0===o?void 0:o.mid,u=null===(a=t.videoTransceiver)||void 0===a?void 0:a.mid,null===(s=_.media)||void 0===s||s.forEach((function(e){"".concat(e.mid)===c?h=e:"".concat(e.mid)===u&&(p=e)})),c&&h||(c="audio_".concat(u),h=ux(ux({},this._aRecvonlyOfferTpl),{},{mid:c})),t.audioMid=c,t.videoMid=u,m=void 0,g=void 0,!r.multiChatMode&&!t.virtual&&this._aSendonlyAnswerTpl&&this._aSendonlyAnswerTpl&&(m=ZQ(this._nextSsrc),this._nextSsrc=m.next,R=ux(ux(ux({},this._aSendonlyAnswerTpl),this.peer._answerIce),{},{mid:c,msid:JS(y=JS(S="".concat(t.streamId)).call(S,null!==(b=this._context)&&void 0!==b&&b.avSync?"":"-audio"," ")).call(y,t.streamId,"-audio"),ssrcs:$Q(t.streamId,"audio",m.audio)}),C=ux(ux(ux({},this._vSendonlyAnswerTpl),this.peer._answerIce),{},{mid:u,msid:JS(E=JS(k="".concat(t.streamId)).call(k,null!==(T=this._context)&&void 0!==T&&T.avSync?"":"-video"," ")).call(E,t.streamId,"-video")},eZ(t.streamId,m,{flexfec:this._enableSubFlexfec})),g={sdp:LQ.write(ux(ux({},this.peer._answerSession),{},{media:[R,C]})),sequenceId:t.sequenceId?++t.sequenceId:0},null===(I=m)||void 0===I||delete I.next),e.abrupt("return",{partialSdp:rZ(_,h,p,!1),audioMid:c,videoMid:u,type:"incroffer",semantics:"unified-plan",audioTransceiverInit:t.audioTransceiver?{track:"audio",init:{direction:"recvonly"}}:void 0,videoTransceiverInit:t.videoTransceiver?{track:"video",init:{direction:"recvonly"}}:void 0,allSsrc:m,peerConnectionMode:this.peerConnectionMode,signalingAck:g});case 32:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"handleAck",value:(o=HS(BS().mark((function e(t){var r,n,i,o;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.signalingAck,n=t.stream,(i=t.action)!==U1.removetrack){e.next=3;break}return e.abrupt("return","");case 3:if(i!==U1.unpublish&&i!==U1.unsubscribe){e.next=14;break}return e.prev=4,e.next=7,this.close(n);case 7:"function"==typeof t.onSuccess&&t.onSuccess(),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),"function"==typeof t.onFail&&t.onFail(e.t0);case 13:return e.abrupt("return",n.streamId||"");case 14:return o=LQ.parse(null==r?void 0:r.sdp),e.prev=15,e.next=18,this._internalSetRemoteDescription(o.media,n);case 18:"function"==typeof t.onSuccess&&t.onSuccess(),e.next=24;break;case 21:e.prev=21,e.t1=e.catch(15),"function"==typeof t.onFail&&t.onFail(e.t1);case 24:return e.abrupt("return","");case 25:case"end":return e.stop()}}),e,this,[[4,10],[15,21]])}))),function(e){return o.apply(this,arguments)})},{key:"_internalSetRemoteDescription",value:(i=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={},(c=LQ.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp)).media.forEach((function(e){void 0!==e.mid&&(s[e.mid]=e)})),t.forEach((function(e){if("audio"===(e=ux(ux({},e),l.peer._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type){if(r instanceof iX&&TB<=87){var t,n,i,o,a={};Array.isArray(e.rtp)&&(e.rtp=Wb(t=e.rtp).call(t,(function(e){return"rtx"!==e.codec||(a[e.payload]=e.payload,!1)}))),"string"==typeof e.payloads&&(e.payloads=Wb(n=e.payloads.split(" ")).call(n,(function(e){return!a[e]})).join(" ")),Array.isArray(e.fmtp)&&(e.fmtp=Wb(i=e.fmtp).call(i,(function(e){return!a[e.payload]}))),Array.isArray(e.rtcpFb)&&(e.fmtp=Wb(o=e.fmtp).call(o,(function(e){return!a[e.payload]})))}r.videoMid?(e.mid=r.videoMid,s[r.videoMid]=e):s[e.mid]=e}})),u=LQ.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp),d=ob(o=u.media).call(o,(function(e){var t=s[e.mid];return"inactive"===e.direction?e:t})),c.groups=u.groups,c.media=d,ob(a=c.media).call(a,(function(e){var t,r,n,i;"video"===e.type&&(iH?(e.ext=null===(t=e.ext)||void 0===t?void 0:Wb(t).call(t,(function(e){var t;return-1===qC(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Wb(r).call(r,(function(e){return"goog-remb"!==e.type}))):(e.rtcpFb=null===(n=e.rtcpFb)||void 0===n?void 0:Wb(n).call(n,(function(e){return"transport-cc"!==e.type})),e.ext=null===(i=e.ext)||void 0===i?void 0:Wb(i).call(i,(function(e){var t;return-1===qC(t=e.uri).call(t,"transport")}))))})),oH&&uZ(c),e.next=12,this.setRemoteDescription(LQ.write(c));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=HS(BS().mark((function e(){var t,r,n,i,o;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=LQ.parse(null===(t=this._peerConnection.localDescription)||void 0===t?void 0:t.sdp),this.createAVMlineOfferTpl(null===(r=this._peerConnection.localDescription)||void 0===r?void 0:r.sdp),o=[],i.media=Wb(n=i.media).call(n,(function(e){return"recvonly"===e.direction&&(e.mid=e.mid+1,o.push("".concat(e.mid)),!0)})),oH&&uZ(i),i.groups=[{mids:o.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:LQ.write(i),semantics:"unified-plan",type:"incroffer"});case 7:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(r=HS(BS().mark((function e(t){var r,n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.msid,r=t.stream,n=t.audioMid,i=t.videoMid,this.logger.warn("rollback()"),e.abrupt("return",this.close(r,n,i));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"close",value:(t=HS(BS().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f,v=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("close()"),s=t.audioMid||r,c=t.videoMid||n,u={},t.audioTransceiver&&s&&(t.audioTransceiver.stop(),u[s]=s),t.videoTransceiver&&c&&(t.videoTransceiver.stop(),u[c]=c),d=[],e.next=9,this._peerConnection.createOffer();case 9:return l=e.sent,(h=LQ.parse(null==l?void 0:l.sdp)).media=ob(i=h.media).call(i,(function(e){return u[e.mid]&&(e=tZ(e)),"inactive"!==e.direction&&d.push(e.mid),ux(ux({},e),v.peer._offerIce)})),p=LQ.parse(null===(o=this._peerConnection.remoteDescription)||void 0===o?void 0:o.sdp),f={},p.media.forEach((function(e){void 0!==e.mid&&(f[e.mid]=e)})),p.media=ob(a=h.media).call(a,(function(e){return"inactive"===e.direction?e:f[e.mid]})),h.groups&&p.groups&&(h.groups[0].mids=d.join(" "),p.groups[0].mids=d.join(" ")),e.next=19,this.setLocalDescription(LQ.write(h));case 19:return e.next=21,this.setRemoteDescription(LQ.write(p));case 21:case"end":return e.stop()}}),e,this)}))),function(e,r,n){return t.apply(this,arguments)})},{key:"setCurrentDescription",value:(e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._peerConnection.createOffer();case 2:if(!this._peerConnection.localDescription||!this._peerConnection.remoteDescription){e.next=7;break}return e.next=5,this._peerConnection.setLocalDescription(this._peerConnection.localDescription);case 5:return e.next=7,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription);case 7:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this,r=LQ.parse(e);r.media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)})),oH&&uZ(r)}}]),u}(),W1=(af(x1={},k1.ICE_FAILED,OP.ICE_FAILED),af(x1,k1.DC_ERROR,OP.ICE_FAILED),af(x1,k1.DC_CLOSE,OP.ICE_FAILED),af(x1,k1.NODE_CHANGE,OP.NODE_CHANGE),af(x1,k1.NOTIFY_RECONNECT,OP.NOTIFY_RECONNECT),af(x1,k1.JOIN_TIMEOUT,OP.JOIN_TIMEOUT),x1),K1=function(){Hx(t,Ij);var e=oO(t);function t(r){var n;return of(this,t),af(dx(n=e.call(this)),"_connectionManager",void 0),af(dx(n),"_dataChannelSignal",void 0),af(dx(n),"_state",void 0),af(dx(n),"_connectionLostTimer",void 0),af(dx(n),"_isReconnecting",!1),af(dx(n),"logger",void 0),n._ctx=r,n.logger=new dF("SignalingManager",1,r.id),n.logger.info("constructor","invoke"),n._connectionManager=new T1(r),n._addConnectorHandler(),n}return nf(t,[{key:"connect",value:function(){var e=this;return this.isConnected()?qS.resolve():new qS((function(t,r){e._connectionManager.once("connected",(function(){return t()})),e._connectionManager.once("disconnected",r),e._connectionManager.startup()}))}},{key:"reconnect",value:function(e,t){this._connectionManager.reconnect(e,t)}},{key:"sendSignaling",value:function(e,t,r,n){if(!this._dataChannelSignal)throw new rN(_P.NOT_CONNECTED_YET,"signaling channel is not connected");return this._dataChannelSignal.sendSignaling(e,t,r,n)}},{key:"sendP2PMessage",value:function(e){if(!this._dataChannelSignal)throw new rN(_P.NOT_CONNECTED_YET,"signaling channel is not connected");return this._dataChannelSignal.sendP2PMessage(e)}},{key:"destroy",value:function(){var e;this.logger.info("destroy()"),this._clearConnectionLostTimer(),this._connectionManager.shotdown(),this._ctx.handler=void 0,null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._setState(xP.CONNECTION_STATE_DISCONNECTED),this.removeAllListeners()}},{key:"isConnected",value:function(){return this._state===xP.CONNECTION_STATE_CONNECTED||this._state===xP.CONNECTION_STATE_RECONNECTED}},{key:"isReconnecting",value:function(){return this._state===xP.CONNECTION_STATE_CONNECTING||this._state===xP.CONNECTION_STATE_RECONNECTING}},{key:"_setState",value:function(e,t){if(this._state!==e){this._state=e;var r={state:e};t&&(r.reason=W1[t]||OP.ICE_FAILED),this.safeEmit(Oj.ON_CONNECTION_STATE_CHANGE,r)}}},{key:"_addConnectorHandler",value:function(){var e=this;this._connectionManager.on("connected",(function(t){var r;e.logger.info("connectStateChange","connected"),e._clearConnectionLostTimer(),null===(r=e._dataChannelSignal)||void 0===r||r.destroy(),e._ctx.peerConnection=t.pc,e._ctx.handler=function(e,t){return rB?new G1(e,t):new H1(e,t)}(e._ctx,t.pc),e._dataChannelSignal=t.signaling,e._addSignalEventHandler(),e._setState(e._isReconnecting?xP.CONNECTION_STATE_RECONNECTED:xP.CONNECTION_STATE_CONNECTED)})),this._connectionManager.on("disconnected",(function(t){e._clearConnectionLostTimer(),e._setState(xP.CONNECTION_STATE_DISCONNECTED),e.logger.error("connectStateChange","disconnected. %o",t.message),e._isReconnecting&&e.safeEmit(Oj.ON_RECONNECT_FAILED)})),this._connectionManager.on("connecting",(function(){e._isReconnecting=!1,e._ctx.handler=void 0,e._setState(xP.CONNECTION_STATE_CONNECTING),e.logger.info("connectStateChange","connecting")})),this._connectionManager.on("reconnecting",(function(t){e._setState(xP.CONNECTION_STATE_DISCONNECTED,t),e._connectionLostTimer||(e._connectionLostTimer=window.setTimeout((function(){e.safeEmit(Oj.ON_CONNECTION_STATE_CHANGE,{state:xP.CONNECTION_STATE_LOST})}),1e4)),e._isReconnecting=!0,e._ctx.handler=void 0,e._setState(xP.CONNECTION_STATE_RECONNECTING,t),e.logger.warn("connectStateChange","reconnecting")})),this._connectionManager.on("connectWidthTcp",(function(){e.safeEmit(Oj.CONNECT_WITH_TCP)})),["__onGetIceConfigHook","__onIceConnectSuccessHook","__onConnectSuccessHook"].forEach((function(t){e._connectionManager.on(t,(function(){for(var r,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return e.emit.apply(e,JS(r=[t]).call(r,i))}))}))}},{key:"_clearConnectionLostTimer",value:function(){this._connectionLostTimer&&(clearTimeout(this._connectionLostTimer),delete this._connectionLostTimer)}},{key:"_addSignalEventHandler",value:function(){var e,t,r=this;[Aj.ON_ADD_STREAM,Aj.ON_ADD_STREAM_LIST,Aj.ON_REMOVE_STREAM,Aj.ON_REMOVE_STREAM_LIST,Aj.USER_CONNECTION,Aj.USER_CONNECTION_LIST,Aj.USER_DISCONNECTION,Aj.USER_DISCONNECTION_LIST,Aj.ON_UPDATE_STREAM_ATTRIBUTES,Aj.ON_UPDATE_ROOM_ATTRIBUTES,Aj.ON_PUSH_TRACK,Aj.ON_REMOVE_TRACK,Aj.ON_CUSTOM_MESSAGE,Aj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,Aj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,Aj.USER_MESSAGE_RECEIVED,Aj.USER_BINARY_MESSAGE_RECEIVED,Aj.POST_PROCESSING_MESSAGE,Aj.ON_USER_TOKEN_WILL_EXPIRE,Aj.ON_TOKEN_PUBLISH_PRIVILEGE_WILL_EXPIRE,Aj.ON_TOKEN_PUBLISH_PRIVILEGE_DID_EXPIRED,Aj.ON_TOKEN_SUBSCRIBE_PRIVILEGE_WILL_EXPIRE,Aj.ON_TOKEN_SUBSCRIBE_PRIVILEGE_DID_EXPIRED,Aj.STREAM_CONTROL_MESSAGE,Aj.ON_UPDATE_USER_ATTRIBUTES,Aj.ON_SPEAKER_CHANGE,Aj.ON_STREAM_FAILED,Aj.ON_FORWARD_DST_ROOM_USER_KICK,xj.RSCP,xj.RTT,xj.SSC].forEach((function(e){var t;null===(t=r._dataChannelSignal)||void 0===t||t.on(e,(function(t){r.safeEmit(e,t)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.on(Aj.NODE_CHANGE,(function(e){r._connectionManager.reconnectByNodeChange(e)})),null===(t=this._dataChannelSignal)||void 0===t||t.on(Aj.ON_NOTIFY_RECONNECT,(function(){r._connectionManager.reconnect(k1.NOTIFY_RECONNECT)}))}}]),t}(),X1=new dF("Locker",2),J1=1,q1=function(){function e(t){var r;of(this,e),af(this,"lockingPromise",qS.resolve()),af(this,"locks",0),af(this,"name",""),af(this,"lockId",void 0),af(this,"closeReason",void 0),this.lockId=J1++,t&&(this.name=t),X1.info(JS(r="lock-".concat(this.name,"-")).call(r,this.lockId),"is created.")}return nf(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t,r=this;this.locks+=1,X1.info(JS(e="lock-".concat(this.name,"-")).call(e,this.lockId),"locked, current queue ".concat(this.locks,"."));var n=new qS((function(e){t=function(){var t;r.locks-=1,X1.info(JS(t="lock-".concat(r.name,"-")).call(t,r.lockId),"unlocked, current queue ".concat(r.locks,".")),e()}})),i=this.lockingPromise.then((function(){return t}));return this.lockingPromise=this.lockingPromise.then((function(){return n})),i}}]),e}(),Y1=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(Y1||{}),Q1=function(e){return e.RECONNECT="ice-reconnect",e.LEAVE="leave_room",e}(Q1||{}),Z1=function(){function e(t,r,n){of(this,e),af(this,"avSync",!0),af(this,"streamRTT",{}),af(this,"useCloudProxy",!1),af(this,"audioProfileManager",void 0),af(this,"userPriority",new DR),af(this,"expectedIDC",void 0),af(this,"joinRoomConfig",void 0),af(this,"signalingManager",void 0),af(this,"peerConnection",void 0),af(this,"pubSubLock",new q1("pubSubLock")),af(this,"visibility",!0),af(this,"serverConfig",void 0),af(this,"mediaParams",void 0),af(this,"activeSimStreams",void 0),af(this,"subscribeFallbackOption",void 0),af(this,"joinRoomParams",void 0),af(this,"isPreConnection",!1),af(this,"_handler",void 0),af(this,"_monitor",void 0),af(this,"_businessId",void 0),this.id=t,this.appId=r,this._monitor=GV(t),this.expectedIDC=null==n?void 0:n.expectedIDC,this.audioProfileManager=new PQ(r),this.joinRoomConfig=new BB(t),this.signalingManager=new K1(this)}return nf(e,[{key:"businessId",get:function(){return this._businessId},set:function(e){var t;this._businessId=e,null===(t=this._monitor)||void 0===t||t.set({rtc_business_id:e})}},{key:"handler",get:function(){return this._handler},set:function(e){var t;e&&this.resetPubSubLock("ice-reconnect"),null===(t=this._handler)||void 0===t||t.destroy(),this._handler=e}},{key:"role",get:function(){return this.visibility?Y1.NORMAL_USER:Y1.SILENT_USER}},{key:"resetPubSubLock",value:function(e){this.pubSubLock.closeReason=e,this.pubSubLock=new q1("pubSubLock")}},{key:"destroy",value:function(){var e;this.signalingManager.destroy(),null===(e=this.handler)||void 0===e||e.destroy(),this.userPriority.clear(),this.avSync=!0}}]),e}();function $1(e,t,r){var n=r.value;return r.value=HS(BS().mark((function e(){var t,r,i,o,a,s,c,u=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ctx.pubSubLock.lock();case 2:if(r=e.sent,"chrome"===(null===(t=this._ctx.handler)||void 0===t?void 0:t.name)&&r(),e.prev=4,!(i=this._ctx.pubSubLock.closeReason)){e.next=8;break}throw new rN(_P.UNEXPECTED_ERROR,i);case 8:for(o=u.length,a=new Array(o),s=0;s<o;s++)a[s]=u[s];return e.next=11,n.apply(this,a);case 11:return e.abrupt("return",e.sent);case 12:return e.prev=12,"chrome"!==(null===(c=this._ctx.handler)||void 0===c?void 0:c.name)&&r(),e.finish(12);case 15:case"end":return e.stop()}}),e,this,[[4,,12,15]])}))),r}var e2=tH(),t2=function(){Hx(a,M1);var e,t,r,n,i,o=oO(a);function a(e,t){var r;return of(this,a),af(dx(r=o.call(this,e,t)),"_peerConnectionId",EF()),af(dx(r),"peerConnectionMode",1),af(dx(r),"name","vendor"),af(dx(r),"direction","up"),af(dx(r),"stream",void 0),t.on("ice_state",(function(e){r._report("rtc_ice_state",{pc_session_id:r.peerConnectionId,direction:r.direction,error_code:0,ice_state:e.toUpperCase(),message:"",peer_connection_id:r.peerConnectionId,stream_id:"",stream_user_id:""})})),t.on("disconnect",(function(){r.emit("disconnect")})),r}return nf(a,[{key:"publish",value:(i=HS(BS().mark((function e(t){var r,n,i,o,s,c,u,d,l,h,p=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.enableSimulcast=!1,this.stream=t,r=Bx(Fx(a.prototype),"internalPublish",this).call(this,t),n=r.videoDescriptions,i=r.subVideoDescriptions,o=r.audioTransceiverInit,s=r.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(o.track,o.init),t.videoTransceiver=this._peerConnection.addTransceiver(s.track,s.init),e2&&(t.initAudioEncodedTransform(),t.initVideoEncodedTransform()),this._report("rtc_begin_create_offer",{direction:"up",stream_id:"",stream_user_id:"",pc_session_id:this.peerConnectionId,vendor_mode:(null==t?void 0:t.vendorCode)||0}),e.next=9,this._peerConnection.createOffer();case 9:return c=e.sent,u=kF(),d=LQ.parse(c.sdp),Array.isArray(d.media)&&(d.media=ob(l=d.media).call(l,(function(e){var r,n,i,o,a;if("video"===e.type)null!==(r=p._context)&&void 0!==r&&null!==(n=r.serverConfig)&&void 0!==n&&n.videoCodec&&sZ(e,null===(i=p._context)||void 0===i||null===(o=i.serverConfig)||void 0===o?void 0:o.videoCodec),(nB||_B)&&Array.isArray(e.ext)&&(e.ext=Wb(a=e.ext).call(a,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&vE(t).call(t,"video-orientation"))}))),nB||p.addBitrateLimit(e,t.videoEncodeConfig[0].maxKbps);else if("audio"===e.type){var s,c=null==e?void 0:DC(s=e.rtp).call(s,(function(e){return"opus"===e.codec}));if(c&&e.fmtp){var u,d,l=DC(u=e.fmtp).call(u,(function(e){return e.payload===c.payload}));l&&null!==(d=p._context)&&void 0!==d&&d.audioProfileManager&&(l.config=p._context.audioProfileManager.getOpusConfigStr(l.config))}}return e}))),h=new RTCSessionDescription({type:"offer",sdp:LQ.write(d)}),e.prev=14,e.next=17,this._peerConnection.setLocalDescription(h);case 17:this._report("rtc_set_description",{error_code:0,message:h.sdp||"",is_local:"1",direction:"up",stream_id:"",stream_user_id:"",elapse:kF()-u},{type:"offer"}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(14),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+h.sdp,is_local:"1",direction:"up",stream_id:"",stream_user_id:"",elapse:kF()-u},{type:"offer"}),e.t0;case 24:return e.abrupt("return",{partialSdp:h.sdp||"",audioMid:"0",videoMid:"1",type:"offer",semantics:"unified-plan",videoDescriptions:n,subVideoDescriptions:i,audioTransceiverInit:o,videoTransceiverInit:s,peerConnectionMode:this.peerConnectionMode,peerConnectionId:this.peerConnectionId});case 25:case"end":return e.stop()}}),e,this,[[14,20]])}))),function(e){return i.apply(this,arguments)})},{key:"subscribe",value:(n=HS(BS().mark((function e(t){var r,n,i,o,a,s=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.stream=t,this.direction="down",t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e2&&(t.initAudioEncodedTransform(),t.initVideoEncodedTransform()),this._report("rtc_begin_create_offer",{direction:"down",stream_id:t.streamId,stream_user_id:t.userId,pc_session_id:this.peerConnectionId,vendor_mode:t.vendorCode||0}),e.next=8,this._peerConnection.createOffer();case 8:return r=e.sent,n=kF(),i=LQ.parse(r.sdp),Array.isArray(i.media)&&(i.media=ob(o=i.media).call(o,(function(e){if("audio"===e.type){var t,r=null==e?void 0:DC(t=e.rtp).call(t,(function(e){return"opus"===e.codec}));if(r&&null!=e&&e.fmtp){var n,i=null==e?void 0:DC(n=e.fmtp).call(n,(function(e){return e.payload===r.payload}));i&&s._context&&(i.config+=";stereo=1;sprop-stereo=1")}}return e}))),a=new RTCSessionDescription({type:"offer",sdp:LQ.write(i)}),e.prev=13,e.next=16,this._peerConnection.setLocalDescription(a);case 16:this._report("rtc_set_description",{error_code:0,message:a.sdp||"",is_local:"1",direction:"down",stream_id:t.streamId,stream_user_id:t.userId,elapse:kF()-n},{type:"offer"}),e.next=23;break;case 19:throw e.prev=19,e.t0=e.catch(13),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+a.sdp,is_local:"1",direction:"down",stream_id:t.streamId,stream_user_id:t.userId,elapse:kF()-n},{type:"offer"}),e.t0;case 23:return e.abrupt("return",{partialSdp:a.sdp||"",audioMid:"0",videoMid:"1",type:"offer",semantics:"unified-plan",peerConnectionMode:this.peerConnectionMode,peerConnectionId:this.peerConnectionId});case 24:case"end":return e.stop()}}),e,this,[[13,19]])}))),function(e){return n.apply(this,arguments)})},{key:"handleAck",value:(r=HS(BS().mark((function e(t){var r,n,i,o,a,s,c;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.action!==U1.publish&&t.action!==U1.subscribe){e.next=16;break}return n=new RTCSessionDescription({sdp:null===(r=t.signalingAck)||void 0===r?void 0:r.sdp,type:"answer"}),i=kF(),e.prev=3,e.next=6,this._peerConnection.setRemoteDescription(n);case 6:this._report("rtc_set_description",{error_code:0,message:n.sdp||"",is_local:"1",direction:"down",stream_id:null===(o=t.stream)||void 0===o?void 0:o.userId,stream_user_id:(null===(a=t.stream)||void 0===a?void 0:a.streamId)||"",elapse:kF()-i},{type:"answer"}),e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(3),this._report("rtc_set_description",{error_code:-1,message:e.t0.message+n.sdp,is_local:"1",direction:"down",stream_id:null===(s=t.stream)||void 0===s?void 0:s.userId,stream_user_id:(null===(c=t.stream)||void 0===c?void 0:c.streamId)||"",elapse:kF()-i},{type:"offer"}),e.t0;case 13:"function"==typeof t.onSuccess&&t.onSuccess(),e.next=17;break;case 16:t.action!==U1.unpublish&&t.action!==U1.unsubscribe||this.destroy();case 17:return e.abrupt("return","");case 18:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this.peer.destroy(),Bx(Fx(a.prototype),"destroy",this).call(this)}},{key:"getDefaultSdp",value:(t=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{sdp:"",type:"offer",semantics:""});case 1:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"connect",value:function(){throw new Error("Method not implemented.")}},{key:"rollback",value:(e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{this._peerConnection.close()}catch(e){}case 1:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"peerConnectionId",get:function(){return this._peerConnectionId},set:function(e){this._peerConnectionId=e}}]),a}(),r2=LR,n2=ww,i2=function(e,t,r,n){for(var i,o=n2(t,r),a=e.length-1;a>=0;a--)(i=e[a])&&(o=i(t,r,o)||o);return o&&r2(t,r,o),o},o2=function(){Hx(s,Ij);var e,t,r,n,i,o,a=oO(s);function s(e,t){var r;return of(this,s),af(dx(r=a.call(this)),"_logger",void 0),af(dx(r),"_pubBackOff",new DR),r._ctx=e,r._roomConf=t,r._logger=new dF("RoomPublisher",2,e.id),r}return nf(s,[{key:"publish",value:(o=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R,C,w,A,x,O,P=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._logger.info("publish()","localStream: %o",t),v=t.videoTrack,_=t.audioTrack,m=kF(),g="",y="",S=this._ctx.handler,"H264"!==(null===(r=this._ctx.serverConfig)||void 0===r?void 0:r.videoCodec)){e.next=17;break}return e.next=10,Qj();case 10:if(e.sent){e.next=17;break}if("VP8"!==XB("FALLBACK_ENCODE_CODEC")){e.next=16;break}this._ctx.serverConfig.videoCodec="VP8",e.next=17;break;case 16:throw new rN(_P.PUBLISH_FAILED,"h264 is not supported");case 17:if(!this._roomConf.vendorConfig.enableMultiVendor){e.next=26;break}return e.next=20,this._getVendorPubSdpInfo(t);case 20:E=e.sent,k=xb(E,2),S=k[0],b=k[1],e.next=29;break;case 26:return e.next=28,this._ctx.handler.publish(t);case 28:b=e.sent;case 29:return this.emit("_test_pub_sdpInfo_",b),g=b.audioMid,y=b.videoMid,t.pubAttributes={localaudio:!!_,localvideo:!!v,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:(null==v?void 0:v.sourceType)===sK.EXTERNAL,extaudio:(null==_?void 0:_.sourceType)===sK.EXTERNAL,videoDescriptions:b.videoDescriptions,videoType:Mj.NORMAL},T={attributes:ux({},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:g,videoMid:y,sdpInfo:{msid:t.stream.id,type:b.type,sdp:b.partialSdp,semantics:b.semantics},peerConnectionMode:null===(n=b)||void 0===n?void 0:n.peerConnectionMode,supportMultiVendor:!0},((I=!this._roomConf.vendorConfig.enableMultiVendor&&t.enableSimulcast&&(null===(i=this._ctx.serverConfig)||void 0===i?void 0:i.simulcastOnDemand)&&(null===(o=b.subVideoDescriptions)||void 0===o?void 0:o.length))||null!==(a=this._ctx.serverConfig)&&void 0!==a&&a.e2eFeedback)&&(T.attributes.subVideoDescriptions=b.subVideoDescriptions),null!==(s=b)&&void 0!==s&&s.peerConnectionId&&(T.peerConnectionId=b.peerConnectionId),e.prev=37,this.emit("_test_pub_body_",T),e.next=41,this._ctx.signalingManager.sendSignaling("publish",T);case 41:R=e.sent,e.next=70;break;case 44:return e.prev=44,e.t0=e.catch(37),e.t0 instanceof Error?this._roomConf.report("rtc_publish_stat",{result:"fail",is_screen:"0",start:m,message:JS(w="".concat(e.t0.name,": ")).call(w,e.t0.message)}):e.t0 instanceof rN&&this._roomConf.report("rtc_publish_stat",{result:"fail",is_screen:"0",start:m,message:JS(A="".concat(e.t0.code,": ")).call(A,e.t0.message)}),e.next=49,null===(C=S)||void 0===C?void 0:C.rollback({msid:t.stream.id,stream:t,audioMid:g,videoMid:y});case 49:if(!(e.t0.code>=500&&e.t0.code<600)){e.next=67;break}if(this.emit("_test_pub_5xx_"),!((x=this._getPubBackOff(t.id)).retryDuration<6e4)){e.next=63;break}return this._logger.info("pubRetry",t.id,x.retryDuration),e.next=56,new qS((function(e){return setTimeout(e,x.interval)}));case 56:return x.retryDuration+=x.interval,x.interval=x.interval>4e3?8e3:2*x.interval,t.resetStream(),this.emit(aX.PUB_RETRY,{screen:t.isScreen}),e.abrupt("return",this.publish(t));case 63:this._logger.info("pubRetry","end"),this._pubBackOff.delete(t.id);case 65:e.next=69;break;case 67:if(403!==e.t0.code){e.next=69;break}throw new rN(_P.TOKEN_NO_PUBLISH_PERMISSION,e.t0.message||"token no publish permission");case 69:throw e.t0;case 70:if(this._roomConf.report("rtc_recv_answer",{error_code:0,answer_type:null===(c=R)||void 0===c?void 0:c.relayMessage.type,sequence_id:(null===(u=R)||void 0===u||null===(d=u.relayMessage)||void 0===d?void 0:d.sequenceId)||0,message:null===(l=R)||void 0===l||null===(h=l.relayMessage)||void 0===h?void 0:h.sdp,direction:"up",stream_id:"",stream_user_id:"",pc_session_id:(null===(p=S)||void 0===p?void 0:p.peerConnectionId)||""}),O=new qS((function(e,r){var n,i,o,a,s,c,u,d;null===(n=S)||void 0===n||n.handleAck({action:U1.publish,streamId:R.streamId,audioMid:g,videoMid:y,audioTransceiverInit:null===(i=b)||void 0===i?void 0:i.audioTransceiverInit,videoTransceiverInit:null===(o=b)||void 0===o?void 0:o.videoTransceiverInit,signalingAck:{sdp:null===(a=R)||void 0===a||null===(s=a.relayMessage)||void 0===s?void 0:s.sdp,sequenceId:null===(c=R)||void 0===c||null===(u=c.relayMessage)||void 0===u?void 0:u.sequenceId},sdp:null===(d=b)||void 0===d?void 0:d.sdp,stream:t,onSuccess:function(){P._logger.info("publish()","publish success"),e(0)},onFail:function(e){P._logger.info("publish()","publish fail"),r(e)}})})),e.t1=!rB,!e.t1){e.next=76;break}return e.next=76,O;case 76:this.emit("___afterHandleAckInPub"),(I||null!==(f=this._ctx.serverConfig)&&void 0!==f&&f.e2eFeedback)&&this.emit(xj.RSCP,[{StreamIds:[t.stream.id],Metadata:{VideoIndex:0}}],!0),t.streamId=R.streamId,t.videoMid=y,t.audioMid=g,t.subVideoDescriptions=b.subVideoDescriptions,this._roomConf.report("rtc_publish_stat",{result:"success",is_screen:"0",start:m,message:"unknown"});case 83:case"end":return e.stop()}}),e,this,[[37,44]])}))),function(e){return o.apply(this,arguments)})},{key:"updatePubTrack",value:(i=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R,C,w,A;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._logger.info("updatePubTrack()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,i=t.pubAudio,o=t.pubVideo,a=t.vendorHandler||this._ctx.handler,s=null==n?void 0:n.preprocessingTrack,c=null==r?void 0:r.preprocessingTrack,!o||!c){e.next=12;break}return t.stopBlackFrame(),e.next=9,null===(u=t.videoTransceiver)||void 0===u?void 0:u.sender.replaceTrack(c);case 9:this._updateVideoDescriptions(t),e.next=14;break;case 12:return e.next=14,null===(d=t.videoTransceiver)||void 0===d?void 0:d.sender.replaceTrack(null);case 14:if(null==a||a.updateMaxBitrate(t),!i||!s){e.next=22;break}return h=n.mixType,(p=n.mixedAudioTrack)&&h!==P1.PLAYOUT&&s.enabled&&(s=p),e.next=20,null===(l=t.audioTransceiver)||void 0===l?void 0:l.sender.replaceTrack(s);case 20:e.next=25;break;case 22:return e.next=24,null===(f=t.audioTransceiver)||void 0===f?void 0:f.sender.replaceTrack(null);case 24:qV(this._ctx.id,"MediaClient.updatePubTrack(audio)","null");case 25:this.emit("___onAfterReplaceTrack");try{qV(this._ctx.id,"MediaClient.updatePubTrack",ZS({audioStreamTrack:dM(s),videoStreamTrack:dM(c)}))}catch(e){}for(v={localaudio:!!n,localvideo:!!r,videostream:o,audiostream:i,extvideo:(null==r?void 0:r.sourceType)===sK.EXTERNAL,extaudio:(null==n?void 0:n.sourceType)===sK.EXTERNAL,videoType:r?Mj.NORMAL:t.pubAttributes.videoType},_={},m=0,g=BE(v);m<g.length;m++)y=xb(g[m],2),S=y[0],(b=y[1])!==SQ(t.pubAttributes,S)&&OQ(_,S,b);if(ck(_).length){e.next=32;break}return e.abrupt("return");case 32:return t.observer&&(E=t.observer,k=_.audiostream,T=_.videostream,I=_.localaudio,R=_.localvideo,C=_.extaudio,w=_.extvideo,void 0!==R?void 0!==w?E.setPushVideo(w):E.setEnableVideo(R):void 0!==T&&E.setUnmuteVideo(T),void 0!==I?void 0!==C?E.setPushAudio(C):E.setEnableAudio(I):void 0!==k&&E.setUnmuteAudio(k)),t.pubAttributes=ux(ux({},t.pubAttributes),v),t.pubAttributes.videostream||t.stopBlackFrame(),A={roomId:this._roomConf.roomId,streamId:t.streamId,attributes:_},e.next=38,this._ctx.signalingManager.sendSignaling("updateStreamAttributes",A);case 38:if(this.emit("___onAfterUpdateSignaling"),!rB){e.next=42;break}return e.next=42,null==a?void 0:a.setCurrentDescription();case 42:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"unpublish",value:(n=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.info("unpublish()","localStream: %o",t),r={roomId:this._roomConf.roomId,initStreamId:t.initStreamId,streamId:t.streamId},this._ctx.signalingManager.sendSignaling("unpublish",r),n=t.vendorHandler||this._ctx.handler,t.stopBlackFrame(),e.next=7,null==n?void 0:n.handleAck({action:U1.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"updatePubBlackFrame",value:(r=HS(BS().mark((function e(t){var r,n,i,o=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.genBlackFrame()){e.next=3;break}return e.abrupt("return");case 3:null===(r=t.videoTransceiver)||void 0===r||null===(n=r.sender)||void 0===n||n.replaceTrack(i),t.pubAttributes.videoType=Mj.BLACK,this._ctx.signalingManager.sendSignaling("updateStreamAttributes",{roomId:this._roomConf.roomId,streamId:t.streamId,attributes:{videoType:Mj.BLACK}}),t.on("black-frame-ended",(function(){var e,r;null===(e=t.videoTransceiver)||void 0===e||null===(r=e.sender)||void 0===r||r.replaceTrack(null),t.pubAttributes.videoType=Mj.NORMAL,o._ctx.signalingManager.sendSignaling("updateStreamAttributes",{roomId:o._roomConf.roomId,streamId:t.streamId,attributes:{videoType:Mj.NORMAL}})}));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(e){var t=this;e.forEach((function(e){var r;e&&e.hasPublished&&(null===(r=t._ctx.handler)||void 0===r||r.handleAck({action:U1.unpublish,audioMid:e.audioMid,videoMid:e.videoMid,stream:e,streamId:e.streamId}))})),this._pubBackOff.clear(),Bx(Fx(s.prototype),"removeAllListeners",this).call(this)}},{key:"_updateVideoDescriptions",value:(t=HS(BS().mark((function e(t){var r,n,i,o;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(1===t.pubAttributes.videoDescriptions.length){e.next=2;break}return e.abrupt("return");case 2:if(null!=(i=null===(r=t.videoTrack)||void 0===r||null===(n=r.preprocessingTrack)||void 0===n?void 0:n.getSettings())&&i.width&&null!=i&&i.height&&null!=i&&i.frameRate){e.next=5;break}return e.abrupt("return");case 5:if(o=t.pubAttributes.videoDescriptions[0],i.width!==o.width||i.height!==o.height||i.frameRate!==o.framerate){e.next=8;break}return e.abrupt("return");case 8:o.width=i.width,o.height=i.height,o.framerate=i.frameRate,o.maxkbps=t.videoEncodeConfig[0].maxKbps||o.maxkbps,this._ctx.signalingManager.sendSignaling("updateStreamAttributes",{roomId:this._roomConf.roomId,streamId:t.streamId,attributes:{videoDescriptions:[o]}});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_getVendorPubSdpInfo",value:(e=HS(BS().mark((function e(t){var r,n,i,o=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new f1(this._ctx,""),t.vendorHandler=new t2(this._ctx,r),t.pcSessionId&&(t.vendorHandler.peerConnectionId=t.pcSessionId),e.next=5,t.vendorHandler.publish(t);case 5:return n=e.sent,(i=t.vendorHandler).on("ice_state",(function(e){o.emit(Oj.ON_VENDOR_CONNECTION_STATE_CHANGE,{state:{checking:xP.CONNECTION_STATE_CONNECTING,connected:xP.CONNECTION_STATE_CONNECTED,disconnected:xP.CONNECTION_STATE_RECONNECTING}[e],userId:o._roomConf.userId})})),i.once("disconnect",HS(BS().mark((function e(){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i.removeAllListeners(),"connected"===(null===(r=o._ctx.peerConnection)||void 0===r?void 0:r.getIceConnectionState())){e.next=4;break}return o._logger.info("vendor ice failed",t.streamId),e.abrupt("return");case 4:return e.next=6,o.unpublish(t);case 6:return e.next=8,o.publish(t);case 8:t.vendorHandler&&t.statsReport.setVar(t.vendorHandler);case 9:case"end":return e.stop()}}),e)})))),e.abrupt("return",[i,n]);case 10:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"_getPubBackOff",value:function(e){return this._pubBackOff.has(e)||this._pubBackOff.set(e,{interval:1e3,retryDuration:0}),this._pubBackOff.get(e)}}]),s}();i2([$1,pQ],o2.prototype,"publish"),i2([$1,pQ],o2.prototype,"updatePubTrack"),i2([$1,pQ],o2.prototype,"unpublish"),i2([pQ],o2.prototype,"updatePubBlackFrame"),i2([pQ],o2.prototype,"_updateVideoDescriptions");var a2,s2=LR,c2=ww,u2=function(e,t,r,n){for(var i,o=c2(t,r),a=e.length-1;a>=0;a--)(i=e[a])&&(o=i(t,r,o)||o);return o&&s2(t,r,o),o},d2=function(){Hx(l,Ij);var e,t,r,n,i,o,a,s,c,u,d=oO(l);function l(e,t){var r;return of(this,l),af(dx(r=d.call(this)),"_logger",void 0),af(dx(r),"_subBackOff",new DR),af(dx(r),"_subResolves",{}),af(dx(r),"_ontrackCallbackMap",new DR),r._ctx=e,r._roomConf=t,r._logger=new dF("RoomSubscriber",2,e.id),r}return nf(l,[{key:"subscribe",value:(u=HS(BS().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R,C,w,A,x,O,P,N,M,D,L,U,V,F,B,j,H,z,G,W,K,X,J,q,Y=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._logger.info("subscribe()","mediaType: %o",r),hQ("subscribe()",t,this._logger),t.streamState=nX.SUB_ING,k=!1,T=!1,MF(r)&&(T=!0),DF(r)&&(k=!0),k||!this._roomConf.isMultiChatMode()){e.next=9;break}return t.streamState=nX.INIT,e.abrupt("return");case 9:if(I=kF(),R=t.subVideo,C=[],this._subResolves[t.streamId]||(this._subResolves[t.streamId]=[]),C.push(new qS((function(e,r){Y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new rN(_P.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),lQ);t.on("ontrack",(function r(i){"video"===i.mediaType&&(Y._logger.info("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),this._roomConf.isMultiChatMode()||C.push(new qS((function(e,r){Y._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new rN(_P.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),lQ);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Y._logger.info("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),w=function(e){t.ontrack(e)},null===(i=this._ctx.handler)||void 0===i||i.on("ontrack",w),this._ontrackCallbackMap.set(t,w),A=this._ctx.handler,null!==(o=this._ctx.serverConfig)&&void 0!==o&&o.forceUniHandler||!t.enableVendorMode){e.next=28;break}return e.next=22,this._getVendorSubSdpInfo(t,w);case 22:O=e.sent,P=xb(O,2),A=P[0],x=P[1],e.next=31;break;case 28:return e.next=30,this._ctx.handler.subscribe(t,{multiChatMode:this._roomConf.isMultiChatMode()});case 30:x=e.sent;case 31:if(M=(N=x).audioMid,D=N.videoMid,t.subVideo=k,L={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},U={audio:!this._roomConf.isMultiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:D,audioMid:M,sdpInfo:{sdp:null===(a=x)||void 0===a?void 0:a.partialSdp,semantics:null===(s=x)||void 0===s?void 0:s.semantics,type:null===(c=x)||void 0===c?void 0:c.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!this._roomConf.isMultiChatMode()||T,video:k},qualityLayer:L},extra:{enableSendRTT:!0},peerConnectionMode:null===(u=x)||void 0===u?void 0:u.peerConnectionMode,supportMultiVendor:!0},null!==(d=x)&&void 0!==d&&d.peerConnectionId&&(U.peerConnectionId=x.peerConnectionId),V=this._ctx,F=V.subscribeFallbackOption,B=V.userPriority,"number"==typeof F&&(U.config.fallbackOption=F),B.has(t.userId)&&(U.config.priority=B.get(t.userId)),null!==(l=x)&&void 0!==l&&l.allSsrc&&(U.extra.subscribeSSRC=x.allSsrc),null===(h=x)||void 0===h||!h.signalingAck){e.next=43;break}return e.next=43,new qS((function(e,r){var n,i,o,a;null===(n=A)||void 0===n||n.handleAck({action:U1.subscribe,streamId:t.streamId,audioMid:M,videoMid:D,audioTransceiverInit:null===(i=x)||void 0===i?void 0:i.audioTransceiverInit,videoTransceiverInit:null===(o=x)||void 0===o?void 0:o.videoTransceiverInit,signalingAck:null===(a=x)||void 0===a?void 0:a.signalingAck,stream:t,sdp:x.sdp,onSuccess:function(){Y._logger.info("ssrc","success"),e(0)},onFail:function(e){Y._logger.info("ssrc","fail",e),r(e)}})}));case 43:return e.prev=43,this.emit("_test_sub_body_",U),e.next=47,this._ctx.signalingManager.sendSignaling("subscribe",U);case 47:j=e.sent,e.next=79;break;case 50:if(e.prev=50,e.t0=e.catch(43),t.streamState=nX.INIT,e.t0 instanceof Error&&this._roomConf.report("rtc_subscribe_stat",{result:"fail",start:I,message:e.t0.message,stream_user_id:t.userId}),!(e.t0.code>=500&&e.t0.code<600)){e.next=69;break}if(this.emit("_test_sub_5xx_"),!((z=this._getSubBackOff(t.streamId)).retryDuration<6e4)){e.next=67;break}return this._logger.info("subRetry",t.streamId,z.retryDuration),e.next=61,new qS((function(e){return setTimeout(e,z.interval)}));case 61:return z.retryDuration+=z.interval,z.interval=z.interval>4e3?8e3:2*z.interval,this.emit(aX.SUB_RETRY,{screen:t.isScreen,userId:t.userId}),e.abrupt("return",this.subscribe(t,r,n));case 67:this._logger.info("subRetry","end",t.streamId),this._subBackOff.delete(t.streamId);case 69:return t.subVideo=R,e.next=72,null===(H=A)||void 0===H?void 0:H.rollback({msid:t.streamId,stream:t});case 72:return G={roomId:this._roomConf.roomId,streamId:t.streamId,userId:t.userId},e.next=75,this._ctx.signalingManager.sendSignaling("unsubscribe",G).catch((function(){}));case 75:if(t.streamState=nX.INIT,403!==e.t0.code){e.next=78;break}throw new rN(_P.TOKEN_NO_SUBSCRIBE_PERMISSION,e.t0.message||"token no subscribe permission");case 78:throw e.t0;case 79:if(j.relayMessage){e.next=82;break}throw this._roomConf.report("rtc_error",{error_code:-1009,message:"relayMessage is null"}),new rN(_P.UNEXPECTED_ERROR,"unable to subscribe");case 82:if(W=null!==(p=null===(f=j)||void 0===f?void 0:f.relayMessage)&&void 0!==p?p:{},K=W.audioMid,X=W.videoMid,af(v={},M,K),af(v,D,X),J=v,this._logger.info("sub midmap",t.userId,J),t.videoMid=D,t.audioMid=M,t.subMediaType=r,t.streamState=nX.SUB_ED,t.subLayer=L,this._roomConf.report("rtc_recv_answer",{error_code:0,answer_type:null===(_=j)||void 0===_||null===(m=_.relayMessage)||void 0===m?void 0:m.type,sequence_id:(null===(g=j)||void 0===g||null===(y=g.relayMessage)||void 0===y?void 0:y.sequenceId)||0,message:null===(S=j)||void 0===S||null===(b=S.relayMessage)||void 0===b?void 0:b.sdp,direction:"down",stream_id:t.streamId,stream_user_id:t.userId,pc_session_id:(null===(E=A)||void 0===E?void 0:E.peerConnectionId)||""}),e.prev=91,null!==(q=x)&&void 0!==q&&q.signalingAck){e.next=95;break}return e.next=95,new qS((function(e,r){var n,i,o,a,s,c,u;null===(n=A)||void 0===n||n.handleAck({action:U1.subscribe,streamId:t.streamId,audioMid:M,videoMid:D,audioTransceiverInit:null===(i=x)||void 0===i?void 0:i.audioTransceiverInit,videoTransceiverInit:null===(o=x)||void 0===o?void 0:o.videoTransceiverInit,signalingAck:{sdp:null===(a=j)||void 0===a||null===(s=a.relayMessage)||void 0===s?void 0:s.sdp,sequenceId:null===(c=j)||void 0===c||null===(u=c.relayMessage)||void 0===u?void 0:u.sequenceId},stream:t,sdp:x.sdp,onSuccess:function(){Y._logger.info("sub ack","success"),e(0)},onFail:function(e){Y._logger.info("sub ack","fail",e),r(e)}})}));case 95:return e.next=97,qS.all(C);case 97:e.next=107;break;case 99:return e.prev=99,e.t1=e.catch(91),e.t1 instanceof Error&&this._roomConf.report("rtc_subscribe_stat",{result:"fail",start:I,message:e.t1.message,stream_user_id:t.userId}),G={roomId:this._roomConf.roomId,streamId:t.streamId,userId:t.userId},e.next=105,this._ctx.signalingManager.sendSignaling("unsubscribe",G).catch((function(){}));case 105:throw t.streamState=nX.INIT,e.t1;case 107:this._roomConf.isMultiChatMode()||(t.subAudio=T),this._roomConf.report("rtc_subscribe_stat",{result:"success",start:I,message:"unknown",stream_user_id:t.userId}),t.startReport((function(e){return Y.emit("onRemoteStreamStats",e)}),A);case 110:case"end":return e.stop()}}),e,this,[[43,50],[91,99]])}))),function(e,t,r){return u.apply(this,arguments)})},{key:"unsubscribe",value:(c=HS(BS().mark((function e(t){var r,n,i,o,a;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return hQ("unsubscribe()",t,this._logger),i={roomId:this._roomConf.roomId,streamId:t.streamId,userId:t.userId},o=t.vendorHandler||this._ctx.handler,this._ctx.signalingManager.sendSignaling("unsubscribe",i).catch((function(){})),t.streamState=nX.INIT,t.subVideo=!1,null===(r=t.observer)||void 0===r||r.setSubscribeVideo(!1),!this._roomConf.isMultiChatMode()&&(null===(n=t.observer)||void 0===n||n.setSubscribeAudio(!1)),e.next=10,null==o?void 0:o.handleAck({action:U1.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 10:a=e.sent,this._subResolves[a]&&this._subResolves[a].forEach((function(e){return e(0)})),this._logger.info("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),t.subMediaType=uH.NONE,this._removeOnTrackListener(t),t.statsReport.unsubscribe();case 17:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(s=HS(BS().mark((function e(t,r,n){var i,o,a,s,c,u,d;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(hQ("unsubscribe4removeTrack()",t,this._logger),this._logger.info("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId,"trackType: ",n),!(r.sequenceId<t.sequenceId)){e.next=5;break}return this._logger.warn("unsubscribe4removeTrack()","sequenceId return"),e.abrupt("return");case 5:return u=!!((c=n+1)&wP.AUDIO),d=!!(c&wP.VIDEO),e.next=10,null===(i=this._ctx.handler)||void 0===i?void 0:i.handleAck({action:U1.removetrack,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 10:null===(o=t.observer)||void 0===o||o.setPushTrack(!1),null===(a=t.observer)||void 0===a||a.setUnmuteAudio(!u),t.subAudio=!u,null===(s=t.observer)||void 0===s||s.setUnmuteVideo(!d),t.subVideo=!d,t.subMediaType=t.subMediaType-(t.subMediaType&c),t.virtual&&(t.clean(),t.resetHasSubscribed(),t.statsReport.unsubscribe());case 17:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return s.apply(this,arguments)})},{key:"handleRemoveStream",value:(a=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(hQ("handleRemoveStream()",t,this._logger),t.subVideo=!1,t.streamState!==nX.INIT){e.next=4;break}return e.abrupt("return");case 4:return e.abrupt("return",this.unsubscribe(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"_removeOnTrackListener",value:function(e){var t=this._ontrackCallbackMap.get(e);if(t){var r=e.vendorHandler||this._ctx.handler;null==r||r.off("ontrack",t),this._ontrackCallbackMap.delete(e)}}},{key:"_getVendorSubSdpInfo",value:(o=HS(BS().mark((function e(t,r){var n,i,o,a=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new f1(this._ctx,""),t.vendorHandler=new t2(this._ctx,n),t.pcSessionId&&(t.vendorHandler.peerConnectionId=t.pcSessionId),(i=t.vendorHandler).on("ontrack",r),e.next=7,t.vendorHandler.subscribe(t);case 7:return o=e.sent,i.on("ice_state",(function(e){a.emit(Oj.ON_VENDOR_CONNECTION_STATE_CHANGE,{state:{checking:xP.CONNECTION_STATE_CONNECTING,connected:xP.CONNECTION_STATE_CONNECTED,disconnected:xP.CONNECTION_STATE_RECONNECTING}[e],userId:t.userId})})),i.once("disconnect",HS(BS().mark((function e(){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==i||i.removeAllListeners(),"connected"===(null===(r=a._ctx.peerConnection)||void 0===r?void 0:r.getIceConnectionState())){e.next=4;break}return a._logger.info("vendor ice failed",t.streamId),e.abrupt("return");case 4:return n=t.subMediaType,e.next=7,a.unsubscribe(t);case 7:return e.next=9,a.subscribe(t,n);case 9:t.vendorHandler&&t.statsReport.setVar(t.vendorHandler),a.emit(aX.RESUBSCRIBE,{stream:t});case 11:case"end":return e.stop()}}),e)})))),e.abrupt("return",[i,o]);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(i=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.info("subscribe4pushTrack()","streamInfo: %o",r),hQ("subscribe4pushTrack()",t,this._logger),t.subAudio=!0,e.next=5,null===(n=this._ctx.handler)||void 0===n?void 0:n.subscribe(t,{multiChatMode:this._roomConf.isMultiChatMode()});case 5:if(a=e.sent){e.next=8;break}throw new rN(_P.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 8:return s=a.audioMid,c=a.videoMid,(u=[]).push(new qS((function(e,r){var n=setTimeout((function(){return r(new rN(_P.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),lQ);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(l._logger.success("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),d=function(e){t.ontrack(e)},null===(i=this._ctx.handler)||void 0===i||i.on("ontrack",d),this._ontrackCallbackMap.set(t,d),e.next=17,null===(o=this._ctx.handler)||void 0===o?void 0:o.handleAck({action:U1.pushtrack,streamId:t.streamId,audioMid:s,videoMid:c,stream:t,audioTransceiverInit:null==a?void 0:a.audioTransceiverInit,videoTransceiverInit:null==a?void 0:a.videoTransceiverInit,signalingAck:null==r?void 0:r.message,sdp:a.sdp});case 17:return e.next=19,qS.all(u);case 19:t.startReport((function(e){return l.emit("onRemoteStreamStats",e)}),this._ctx.handler);case 20:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"updateUserAttributes",value:(n=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.info("updateUserAttributes()","attributes: %o",t),e.next=3,this._ctx.signalingManager.sendSignaling("updateUserAttributes",{roomId:this._roomConf.roomId,sessionId:this._roomConf.sessionId,attributes:t});case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"updateSubTrackLayer",value:(r=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._logger.info("updateSubTrack()","subLayer: %o",r),t.subLayer.spatialLayer!==r.spatialLayer||t.subLayer.spatialSubLayer!==r.spatialSubLayer){e.next=4;break}return this._logger.warn("updateSubTrack()","subLayer no change"),e.abrupt("return");case 4:return n={roomId:this._roomConf.roomId,streamList:[t.streamId],streamId:t.streamId,streamUserId:t.userId,config:{qualityLayer:r}},e.next=7,this._ctx.signalingManager.sendSignaling("updateSubscribe",n);case 7:return this.emit("___afterUpdateSubscribeSend"),t.subLayer=r,e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"updateSubPriority",value:(t=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._logger.info("updateSubPriority()","priority: %o",r),t.priority!==r){e.next=4;break}return this._logger.warn("updateSubPriority()","priority no change"),e.abrupt("return",t);case 4:return n={roomId:this._roomConf.roomId,streamList:[t.streamId],streamId:t.streamId,streamUserId:t.userId,config:{priority:r}},e.next=7,this._ctx.signalingManager.sendSignaling("updateSubscribe",n);case 7:return t.priority=r,e.abrupt("return",t);case 9:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"getSubLayer",value:function(e,t){for(var r,n,i,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,p=0;p<(null==d?void 0:d.length);p++){var f,v;if(h>=(null===(f=d[p])||void 0===f?void 0:f.width)*(null===(v=d[p])||void 0===v?void 0:v.height)){l=p;break}}var _=d[0];if(-1===l)_=d[l=d.length-1];else if(0!==l){var m=d[l-1].width*d[l-1].height,g=(m-h)/(m-d[l].width*d[l].height);_=g<.1?d[l-1]:d[l],l=g<.1?l-1:l}return a=null!==(r=null===(n=_)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=_)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"updateSubMediaType",value:(e=HS(BS().mark((function e(t,r){var n,i,o,a,s;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=!1,o=!1,MF(r)&&(o=!0),DF(r)&&(i=!0),a={roomId:this._roomConf.roomId,streamList:[t.streamId],config:{enableMediaType:{video:i,audio:!!this._roomConf.isMultiChatMode()||o}}},e.next=6,this._ctx.signalingManager.sendSignaling("updateSubscribe",a);case 6:return this._roomConf.isMultiChatMode()||(null===(s=t.observer)||void 0===s||s.setUnmuteAudio(o),t.subAudio=o),null===(n=t.observer)||void 0===n||n.setUnmuteVideo(i),t.subVideo=i,t.subMediaType=r,e.abrupt("return",t);case 11:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})},{key:"destroy",value:function(e){var t=this;e.forEach((function(e){e.forEach((function(e){if(e.hasSubscribed){var r=e.vendorHandler||t._ctx.handler;null==r||r.handleAck({action:U1.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})}}))})),this._subBackOff.clear(),this._ontrackCallbackMap.forEach((function(e,r){t._removeOnTrackListener(r),t._ontrackCallbackMap.delete(r)})),this._subResolves={},Bx(Fx(l.prototype),"removeAllListeners",this).call(this)}},{key:"_getSubBackOff",value:function(e){return this._subBackOff.has(e)||this._subBackOff.set(e,{interval:1e3,retryDuration:0}),this._subBackOff.get(e)}}]),l}();u2([$1,pQ],d2.prototype,"subscribe"),u2([$1,pQ],d2.prototype,"unsubscribe"),u2([$1,pQ],d2.prototype,"unsubscribe4removeTrack"),u2([pQ],d2.prototype,"handleRemoveStream"),u2([$1,pQ],d2.prototype,"subscribe4pushTrack"),u2([pQ],d2.prototype,"updateUserAttributes"),u2([pQ],d2.prototype,"updateSubTrackLayer"),u2([pQ],d2.prototype,"updateSubPriority");var l2=(af(a2={},zP.communication,[0]),af(a2,zP.chat,[0]),af(a2,zP.chatRoom,[1,"IES_chatroom"]),af(a2,zP.coHost,[1,"IES_PK"]),af(a2,zP.meeting,[16]),af(a2,zP.classRoom,[0]),a2),h2=function(){Hx(o,Ij);var e,t,r,n,i=oO(o);function o(e,t){var r;return of(this,o),af(dx(r=i.call(this)),"_logger",void 0),af(dx(r),"_authorization",void 0),af(dx(r),"_joinRoom5xxTimer",void 0),af(dx(r),"_joinTask",void 0),af(dx(r),"_sdpInfo",void 0),r._ctx=e,r._roomConf=t,r._logger=new dF("RoomJoin",2,e.id),r._logger.info("constructor","invoke"),r}return nf(o,[{key:"join",value:function(){var e,t,r=this,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._logger.info("join()");var i=new qS((function(i,o){e=i,t=o,r._callJoinRoom(n).catch((function(e){var t=Array.isArray(e)&&e.length>0?e[0]:e;r._joinRoomFailed(t.message)}))}));return this._joinTask&&n?this._joinTask.startTime=kF():(this._joinTask={startTime:kF(),success:e,fail:t},this._roomConf.joinPromise=i),this._reportJoinRoomStart(),i}},{key:"updateToken",value:(n=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._logger.info("updateToken()","newToken: %o",t),this._ctx.appId&&this._roomConf.userId&&this._roomConf.roomId){e.next=3;break}return e.abrupt("return");case 3:return r={roomId:this._roomConf.roomId,userId:this._roomConf.userId,appId:this._ctx.appId,token:"Bearer ".concat(t)},e.prev=4,e.next=7,this._ctx.signalingManager.sendSignaling("updateToken",r);case 7:e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(4),new rN(_P.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 12:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e){return n.apply(this,arguments)})},{key:"leave",value:(r=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.info("leave()"),this._stopJoinRoom5xxRetry(),this._joinRoomFailed("leave_room"),e.next=5,this._ready2join();case 5:if(!this._ctx.signalingManager.isConnected()){e.next=11;break}return t={Authorization:this._authorization,roomId:this._roomConf.roomId,sessionId:this._roomConf.sessionId},e.next=9,this._ctx.signalingManager.sendSignaling("leaveRoom",t);case 9:e.next=12;break;case 11:return e.abrupt("return",qS.reject(new rN(_P.NOT_CONNECTED_YET,"server not connected")));case 12:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"destroy",value:function(){this._logger.info("destroy()"),this._joinRoomFailed("leave_room"),this._authorization=void 0,this._stopJoinRoom5xxRetry(),this.removeAllListeners()}},{key:"_ready2join",value:(t=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ctx.signalingManager.connect();case 2:if(this._sdpInfo){e.next=6;break}return e.next=5,null===(t=this._ctx.handler)||void 0===t?void 0:t.getDefaultSdp();case 5:this._sdpInfo=e.sent;case 6:if(o.supportedCodecs){e.next=10;break}return e.next=9,Gj();case 9:o.supportedCodecs=e.sent;case 10:return e.abrupt("return",{sdpInfo:this._sdpInfo,supportedCodecs:o.supportedCodecs});case 11:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_callJoinRoom",value:(e=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R,C,w,A,x,O,P,N=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.info("_callJoinRoom","invoke"),delete this._sdpInfo,n=this._ctx,i=n.appId,o=n.role,a=n.businessId,s=n.useCloudProxy,c=n.joinRoomParams,u=n.mediaParams,e.next=5,this._ready2join();case 5:if(d=e.sent,l=d.sdpInfo,h=d.supportedCodecs,p={Authorization:IF.token2auth(i,this._roomConf.roomId,this._roomConf.userId,this._roomConf.token),sessionId:this._roomConf.sessionId,timestamp:Date.now(),controlMessage:this._roomConf.getLiveControlMessage(),userAttributes:{extra_info:this._roomConf.userInfo.extraInfo,role:o},sdpInfo:l,params:{supportedCodecs:h,deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:WB.VERSION,deviceId:VB.getDeviceId(),appId:i,roomId:this._roomConf.roomId,userId:this._roomConf.userId,businessId:a,enableCloudProxy:s,channelProfile:l2[this._roomConf.roomProfileType]?"".concat(l2[this._roomConf.roomProfileType][0]):"0"},options:{supportCheckTokenPrivilege:!0,supportTokenExpireCallBack:!0,enableSceneConfigV2:!0,enableUnBundleMode:!0,enableAudioMux:!0,enableBigRoomMode:!0,needNegotiateSDP:!0,supportMultiVendor:!0}},c)for(f=0,v=BE(c);f<v.length;f++)_=xb(v[f],2),m=_[0],g=_[1],p.params[m]=g;return u&&(p.mediaParams=u),XB("SIGNAL_CROP_JOINROOM")&&null!==(r=p.sdpInfo)&&void 0!==r&&r.sdp&&(p.sdpInfo.sdp=cZ(p.sdpInfo.sdp)),qS.resolve().then((function(){return N.emit("onSendingJoinMessageHook")})),e.prev=14,R=t?"reconnected":"joinRoom",e.next=18,this._joinRoomWithRetry(R,p);case 18:C=e.sent,this._logger.success("join","send join message success"),w=C.config||{},A=w.engine_WEB,x=w._abtest_vid,this._authorization=p.Authorization,VB.setEngineWebConfig(this._ctx.appId,this._roomConf.roomId,A),this._ctx.serverConfig={videoCodec:(null==A?void 0:A.video_codec)||"H264",audioRed:!(null==A||!A.pub_audio_red),muteReplaceUnsub:!(null===(y=C.config)||void 0===y||!y.mute_replace_unsub),simulcastOnDemand:!(!1===(null===(S=C.config)||void 0===S||null===(b=S.engine_VPM)||void 0===b||null===(E=b.ondemand)||void 0===E?void 0:E.enable)),forceUniHandler:1===(null===(k=C.config)||void 0===k||null===(T=k.vendor_param)||void 0===T?void 0:T.vendor_stream_sub_mode),e2eFeedback:null==A?void 0:A.e2e_feedback},"boolean"==typeof(null==A?void 0:A.av_sync)&&(this._ctx.avSync=A.av_sync),this._roomConf.rtcVid=x,C.vendorConfig&&this._roomConf.setVendorConfig(C.vendorConfig),oK.setAudioStallConfig(A),null!==(I=C.relayMessage)&&void 0!==I&&I.sdp&&(null===(O=this._ctx.handler)||void 0===O||O.createAVMlineAnswerTpl(C.relayMessage.sdp)),this.emit(aX.JOIN_SUCCESS,{joinRes:C,reconnect:t}),this._joinRoomSuccess(C),e.next=37;break;case 33:e.prev=33,e.t0=e.catch(14),P={461:_P.ROOM_FORBIDDEN,462:_P.USER_FORBIDDEN},(null===e.t0||void 0===e.t0?void 0:e.t0.code)>=700&&(null===e.t0||void 0===e.t0?void 0:e.t0.code)<800?this._joinRoomFailed("token_error",_P.INVALID_TOKEN):P[null===e.t0||void 0===e.t0?void 0:e.t0.code]?this._joinRoomFailed((null===e.t0||void 0===e.t0?void 0:e.t0.message)||P[null===e.t0||void 0===e.t0?void 0:e.t0.code],P[null===e.t0||void 0===e.t0?void 0:e.t0.code]):(null===e.t0||void 0===e.t0?void 0:e.t0.code)===_P.TIME_OUT&&this._ctx.joinRoomConfig.useTcpAfterJoinTimeout?(this._logger.error("join",k1.JOIN_TIMEOUT),this.safeEmit(aX.ON_REJOIN_WITH_TCP),this._ctx.signalingManager.reconnect(k1.JOIN_TIMEOUT,!0)):e.t0.code===_P.OPERATION_CANCEL&&this._ctx.signalingManager.isReconnecting()||this._joinRoomFailed((null===e.t0||void 0===e.t0?void 0:e.t0.message)||"signaling_error");case 37:case"end":return e.stop()}}),e,this,[[14,33]])}))),function(t){return e.apply(this,arguments)})},{key:"_joinRoomWithRetry",value:function(e,t,r){var n=this;return new qS((function(i,o){n._ctx.signalingManager.sendSignaling(e,t,void 0,1e4).then((function(e){n.emit("onJoinRoomAck",e),i(e)})).catch((function(a){if(r=r||new MQ,a.code>=500&&a.code<600&&kF()-r.initTs<6e4){var s,c=r.getRetryDelay();return n._logger.warn("_joinRoomWithRetry",JS(s="joinRoom failed(code: ".concat(a.code,"), will retry after ")).call(s,c,"ms")),void(n._joinRoom5xxTimer=window.setTimeout((function(){delete n._joinRoom5xxTimer,n._joinRoomWithRetry(e,t,r).then(i).catch(o)}),c))}o(a)}))}))}},{key:"_stopJoinRoom5xxRetry",value:function(){this._joinRoom5xxTimer&&(clearTimeout(this._joinRoom5xxTimer),delete this._joinRoom5xxTimer)}},{key:"_reportJoinRoomStart",value:function(){this._joinTask&&(this.emit("__joinRoomStartReport"),this._roomConf.report("join_room",{type:"begin",start:this._joinTask.startTime,result:!1,reason:""},{enable_cloud_proxy:this._ctx.useCloudProxy,expectedIDC:this._ctx.expectedIDC}))}},{key:"_joinRoomSuccess",value:function(e){this._joinTask&&(this._joinTask.success(e),this.emit("__joinRoomSuccessReport"),this._roomConf.report("join_room",{type:"end",start:this._joinTask.startTime,result:!0,reason:""},{enable_cloud_proxy:this._ctx.useCloudProxy,expectedIDC:this._ctx.expectedIDC}),this._roomConf.report("rtc_join_room",{error_code:0,deviceModel:"web",deviceManufacturer:"web",elapse:kF()-this._joinTask.startTime}),delete this._joinTask,delete this._roomConf.joinPromise)}},{key:"_joinRoomFailed",value:function(e,t){this._joinTask&&(this._joinTask.fail(new rN(t||_P.JOIN_ROOM_FAILED,e)),this.emit("__joinRoomFailedReport"),this._roomConf.report("join_room",{type:"end",start:this._joinTask.startTime,result:!1,reason:e},{enable_cloud_proxy:this._ctx.useCloudProxy,expectedIDC:this._ctx.expectedIDC}),delete this._joinTask,delete this._roomConf.joinPromise)}}]),o}();af(h2,"supportedCodecs",void 0);var p2=LR,f2=ww,v2=function(e,t,r,n){for(var i,o=f2(t,r),a=e.length-1;a>=0;a--)(i=e[a])&&(o=i(t,r,o)||o);return o&&p2(t,r,o),o},_2=function(){function e(t,r){of(this,e),af(this,"_logger",void 0),this._ctx=t,this._roomConf=r,this._logger=new dF("RoomMessage",2,t.id)}var t,r;return nf(e,[{key:"sendUserMessage",value:function(e,t){return this._ctx.signalingManager.sendP2PMessage({to:e,from:this._roomConf.userId,room:this._roomConf.roomId,app:this._ctx.appId,msg:t})}},{key:"sendRoomMessage",value:(r=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={clientId:this._roomConf.userId,binary:r,message:"",roomId:this._roomConf.roomId},!r){e.next=7;break}return e.next=4,IF.ab2b64str(t);case 4:n.message=e.sent,e.next=8;break;case 7:n.message=t;case 8:return e.abrupt("return",this._ctx.signalingManager.sendSignaling("customMessage",n));case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"controlMessage",value:(t=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._logger.info("controlMessage()","params: %o",t),r=t,"transcode"===t.type&&(r.roomId=this._roomConf.roomId),e.next=5,this._ctx.signalingManager.sendSignaling("controlMessage",r);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();v2([pQ],_2.prototype,"sendUserMessage"),v2([pQ],_2.prototype,"sendRoomMessage"),v2([pQ],_2.prototype,"controlMessage");var m2=LR,g2=ww,y2=function(e,t,r,n){for(var i,o=g2(t,r),a=e.length-1;a>=0;a--)(i=e[a])&&(o=i(t,r,o)||o);return o&&m2(t,r,o),o},S2={audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1,publishTime:0},b2=function(){Hx(x,Ij);var e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R,C,w,A=oO(x);function x(e,t){var r;return of(this,x),af(dx(r=A.call(this)),"_localStream",void 0),af(dx(r),"_localScreenStream",void 0),af(dx(r),"_remoteUsers",new DR),af(dx(r),"_remoteStreams",new DR),af(dx(r),"_remoteStreamStreamIdUserIdMap",{}),af(dx(r),"_virtualStreams",[]),af(dx(r),"_serverConfig",void 0),af(dx(r),"_userDuplicateLoginTimerMap",new DR),af(dx(r),"_networkQualityManager",void 0),af(dx(r),"_videoSizeObserver",void 0),af(dx(r),"_hasPublished",!1),af(dx(r),"_subtitleTool",void 0),af(dx(r),"_csrcUserIdMap",{}),af(dx(r),"_publishOnDemandItem",void 0),af(dx(r),"_onceTriggerBySignal",!1),af(dx(r),"_pubTransceiverReady",!1),af(dx(r),"_publishOnDemandBusy",!1),af(dx(r),"logger",void 0),af(dx(r),"_forwardStreamManager",void 0),af(dx(r),"_publisher",void 0),af(dx(r),"_subscriber",void 0),af(dx(r),"_roomJoin",void 0),af(dx(r),"_roomMessage",void 0),af(dx(r),"_clearSignalListeners",void 0),r.config=e,r._ctx=t,r.logger=new dF("Room",1,t.id),r.logger.info("constructor","invoke"),r._publisher=new o2(t,e),r._addPublisherListeners(),r._subscriber=new d2(t,e),r._addSubscriberListeners(),r._roomJoin=new h2(t,e),r._addJoinRoomHandler(),r._forwardStreamManager=new mQ(t,e),r._addForwardStreamListeners(),r._roomMessage=new _2(t,e),r._networkQualityManager=new fX(t),r._networkQualityManager.reportor=r._reportNetworkQuality.bind(dx(r)),r._videoSizeObserver=new vX(dx(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(dx(r)),r._addSignalListeners(),r}return nf(x,[{key:"hasScreenPublished",get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished}},{key:"hasPublished",get:function(){var e;return!(null===(e=this._localStream)||void 0===e||!e.hasPublished)}},{key:"remoteUsers",get:function(){return this._remoteUsers}},{key:"remoteStreams",get:function(){return this._remoteStreams}},{key:"localStream",get:function(){return this._localStream}},{key:"localScreenStream",get:function(){return this._localScreenStream}},{key:"virtualStreams",get:function(){return this._virtualStreams}},{key:"_addSignalListeners",value:function(){var e,t=this,r=(af(e={},Aj.ON_ADD_STREAM,this._onAddStream.bind(this)),af(e,Aj.ON_ADD_STREAM_LIST,(function(e){e&&Array.isArray(e.streamList)&&e.streamList.forEach((function(e){return t._onAddStream(e)}))})),af(e,Aj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),af(e,Aj.ON_REMOVE_STREAM_LIST,(function(e){e&&Array.isArray(e.streamList)&&e.streamList.forEach((function(e){return t._onRemoveStream(e)}))})),af(e,Aj.USER_CONNECTION,this._onUserConnection.bind(this)),af(e,Aj.USER_CONNECTION_LIST,(function(e){e&&Array.isArray(e.userList)&&e.userList.forEach((function(e){return t._onUserConnection(e)}))})),af(e,Aj.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),af(e,Aj.USER_DISCONNECTION_LIST,(function(e){e&&Array.isArray(e.userList)&&e.userList.forEach((function(e){return t._onUserDisconnection(e)}))})),af(e,Aj.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),af(e,Aj.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),af(e,Aj.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),af(e,Aj.ON_PUSH_TRACK,this._onPushTrack.bind(this)),af(e,Aj.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),af(e,Aj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),af(e,Aj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),af(e,Aj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),af(e,Aj.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),af(e,Aj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),af(e,Aj.ON_TOKEN_PUBLISH_PRIVILEGE_WILL_EXPIRE,this._onUserTokePublishPrivilegeWillExpire.bind(this)),af(e,Aj.ON_TOKEN_PUBLISH_PRIVILEGE_DID_EXPIRED,this._onUserTokenPublishPrivilegeDidExpire.bind(this)),af(e,Aj.ON_TOKEN_SUBSCRIBE_PRIVILEGE_WILL_EXPIRE,this._onUserTokeSubscribePrivilegeWillExpire.bind(this)),af(e,Aj.ON_TOKEN_SUBSCRIBE_PRIVILEGE_DID_EXPIRED,this._onUserTokenSubscribePrivilegeDidExpire.bind(this)),af(e,Aj.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),af(e,Aj.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),af(e,xj.RTT,this._onRTT.bind(this)),af(e,xj.SSC,this._onSSC.bind(this)),af(e,Oj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),af(e,Aj.ON_SPEAKER_CHANGE,this._onMeetingSpeakerChange.bind(this)),af(e,Aj.ON_FORWARD_DST_ROOM_USER_KICK,this._forwardStreamManager.onForwardDstRoomUserKick.bind(this._forwardStreamManager)),af(e,xj.RSCP,this._onRSCP.bind(this)),e);ck(r).forEach((function(e){t._ctx.signalingManager.on(e,r[e])})),this._clearSignalListeners=function(){ck(r).forEach((function(e){t._ctx.signalingManager.off(e,r[e])}))}}},{key:"_addPublisherListeners",value:function(){var e=this;this._publisher.on(aX.PUB_RETRY,(function(t){e.emit(aX.PUB_RETRY,t)})),this._publisher.on(xj.RSCP,this._onRSCP.bind(this)),this._publisher.on(Oj.ON_VENDOR_CONNECTION_STATE_CHANGE,(function(t){return e.emit(Oj.ON_VENDOR_CONNECTION_STATE_CHANGE,t)}))}},{key:"_addSubscriberListeners",value:function(){var e=this;this._subscriber.on(Oj.ON_VENDOR_CONNECTION_STATE_CHANGE,(function(t){return e.emit(Oj.ON_VENDOR_CONNECTION_STATE_CHANGE,t)})),this._subscriber.on("onRemoteStreamStats",(function(t){e._networkQualityManager.updateDownlinkStats(t,e._findRemoteStreamByScreen(t.userId,t.isScreen)),e.emit(aX.ON_REMOTE_STREAM_STATS,LF(t))})),this._subscriber.on(aX.RESUBSCRIBE,(function(t){e.emit(aX.RESUBSCRIBE,t)})),this._subscriber.on(aX.SUB_RETRY,(function(t){e.emit(aX.SUB_RETRY,t)}))}},{key:"_addJoinRoomHandler",value:function(){var e=this;this._roomJoin.on(aX.JOIN_SUCCESS,this._onJoinSucc.bind(this)),this._roomJoin.on(aX.ON_REJOIN_WITH_TCP,(function(){e.emit(aX.ON_REJOIN_WITH_TCP)}))}},{key:"_addForwardStreamListeners",value:function(){var e=this;this._forwardStreamManager.on(aX.ON_FORWARD_STREAM_ERROR,(function(t){e.safeEmit(aX.ON_FORWARD_STREAM_ERROR,t)}))}},{key:"_onLocalStreamStats",value:function(e){var t=e.isScreen?this._localScreenStream:this.localStream;this._networkQualityManager.updateUplinkStats(e,t),this.emit(aX.ON_LOCAL_STREAM_STATS,LF(e))}},{key:"join",value:(w=HS(BS().mark((function e(){var t,r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("join()"),this.config.startJoinTimestamp=kF(),e.prev=2,e.next=5,this._roomJoin.join();case 5:return r=e.sent,null!==(t=r.roomAttributes)&&void 0!==t&&t.multiChatMode&&this._handleFFAudioTrack(),this._initSubtitleTool(),e.abrupt("return",{users:r.clients,streams:r.streams});case 11:if(e.prev=11,e.t0=e.catch(2),e.t0.code===_P.OPERATION_CANCEL){e.next=15;break}throw e.t0;case 15:case"end":return e.stop()}}),e,this,[[2,11]])}))),function(){return w.apply(this,arguments)})},{key:"publishScreen",value:(C=HS(BS().mark((function e(t,r,n,i,o){var a,s,c,u,d,l,h,p,f;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("publishScreen()"),this._localScreenStream||(this._localScreenStream=new iX(this._ctx),this.config.vendorConfig.enableMultiVendor&&(this._localScreenStream.pcSessionId=sM()),this._localScreenStream.isScreen=!0,this._localScreenStream.observer=new hX(this._ctx,this._localScreenStream)),a=!1,s=!1,c=!1,u=!1,!this._localScreenStream.videoTrack&&r?(r.sourceType===Dj.EXTERNAL&&(s=!0),a=!0):this._localScreenStream.videoTrack&&!r&&(a=!1),!this._localScreenStream.audioTrack&&n?(n.sourceType===Dj.EXTERNAL&&(u=!0),c=!0):this._localScreenStream.audioTrack&&!n&&(c=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(MF(i)&&(this._localScreenStream.pubAudio=o===cX.PUB),DF(i)&&(this._localScreenStream.pubVideo=o===cX.PUB),this.logger.info("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo){e.next=18;break}if(!this._localScreenStream.hasPublished){e.next=17;break}return e.abrupt("return",this.unpublishScreen());case 17:return e.abrupt("return");case 18:if(this._localScreenStream.hasPublished){e.next=24;break}return null===(d=this._localScreenStream.observer)||void 0===d||d.setPublish(!0),e.next=22,this._publisher.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return s?null===(l=this._localScreenStream.observer)||void 0===l||l.setPushVideo(a):null===(h=this._localScreenStream.observer)||void 0===h||h.setEnableVideo(a),u?null===(p=this._localScreenStream.observer)||void 0===p||p.setPushAudio(c):null===(f=this._localScreenStream.observer)||void 0===f||f.setEnableAudio(c),e.next=28,this.updatePubScreenTrack();case 28:this._localScreenStream.pubAudio||this._localScreenStream.pubVideo?this._ctx.handler&&this._localScreenStream.startReport(this._onLocalStreamStats.bind(this),this._localScreenStream.vendorHandler||this._ctx.handler):this._localScreenStream.stopReport("unpublish screen");case 29:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return C.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(R=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("updatePubScreenTrack","Invoke updatePubScreenTrack"),!this._localScreenStream){e.next=4;break}return e.next=4,this._publisher.updatePubTrack(this._localScreenStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return R.apply(this,arguments)})},{key:"unpublishScreen",value:(I=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("unpublish","Invoke unpublishScreen"),!this._localScreenStream){e.next=8;break}return null===(t=this._localScreenStream.observer)||void 0===t||t.setPublish(!1),e.next=5,this._publisher.unpublish(this._localScreenStream);case 5:this._localScreenStream.stopReport("unpublish screen"),this._localScreenStream.clean(),this._localScreenStream=void 0;case 8:case"end":return e.stop()}}),e,this)}))),function(){return I.apply(this,arguments)})},{key:"liveControlMessage",value:(T=HS(BS().mark((function e(t){var r,n=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("controlMessage","Invoke controlMessage"),null===(r=t.transcodeMeta)||void 0===r||r.layout.regions.forEach((function(e){e.roomID=n.config.roomId})),e.next=4,this._roomMessage.controlMessage(t);case 4:this.config.setLiveControlMessage("stopped"===t.action?void 0:t);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(k=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"stopped"===t.action&&delete t.publicStreamMeta,e.next=3,this._roomMessage.controlMessage(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"updateUserAttributes",value:(E=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("updateUserAttributes","Invoke updateUserAttributes"),e.next=3,this._subscriber.updateUserAttributes({role:this._ctx.role});case 3:case"end":return e.stop()}}),e,this)}))),function(){return E.apply(this,arguments)})},{key:"publish",value:(b=HS(BS().mark((function e(t,r,n,i,o,a){var s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=T.length>6&&void 0!==T[6]&&T[6],this.logger.info("publish","Invoke publish"),c=!1,this._localStream||(this._localStream=new iX(this._ctx),this.config.vendorConfig.enableMultiVendor&&(this._localStream.pcSessionId=sM()),this._localStream.observer=new hX(this._ctx,this._localStream),c=!0,this._localStream.vendorCode=this.config.vendorConfig.vendorCode||0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,u=this._localStream,d=u.pubAudio,l=u.pubVideo,o&&(MF(o)&&(this._localStream.pubAudio=a===cX.PUB),DF(o)&&(this._localStream.pubVideo=a===cX.PUB),this.logger.info("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished){e.next=29;break}if(this._localStream.pubAudio||this._localStream.pubVideo){e.next=13;break}return e.abrupt("return");case 13:return e.prev=13,s?null===(h=this._localStream.observer)||void 0===h||h.setLogin(!0):c&&(v=!!this._localStream.videoTrack,_=!!this._localStream.audioTrack,m=(null===(p=this._localStream.videoTrack)||void 0===p?void 0:p.sourceType)===Dj.EXTERNAL,g=(null===(f=this._localStream.audioTrack)||void 0===f?void 0:f.sourceType)===Dj.EXTERNAL,this.config.isAutoPublish&&!this._hasPublished?(v&&(m?null===(y=this._localStream.observer)||void 0===y||y.setPushVideo(!0):null===(S=this._localStream.observer)||void 0===S||S.setEnableVideo(!0)),_&&(g?null===(b=this._localStream.observer)||void 0===b||b.setPushAudio(!0):null===(E=this._localStream.observer)||void 0===E||E.setEnableAudio(!0))):null===(k=this._localStream.observer)||void 0===k||k.setPublish(!0)),this.emit("___onMediaServerClientPublish"),e.next=18,this._publisher.publish(this._localStream);case 18:this._hasPublished=!0,this.emit(aX.ON_PUBLISH_RESULT,{isScreen:!1,state:TP.PUBLISH_SUCC}),e.next=27;break;case 22:throw e.prev=22,e.t0=e.catch(13),this.emit(aX.ON_PUBLISH_RESULT,{isScreen:!1,state:TP.PUBLISH_FAIL,errorCode:e.t0.code}),delete this._localStream,e.t0;case 27:e.next=40;break;case 29:return e.prev=29,this.emit("___onMediaServerClientPublish"),e.next=33,this.updatePubTrack();case 33:e.next=40;break;case 35:throw e.prev=35,e.t1=e.catch(29),this._localStream.pubAudio=d,this._localStream.pubVideo=l,e.t1;case 40:this._localStream.pubAudio||this._localStream.pubVideo?this._ctx.handler&&this._localStream.startReport(this._onLocalStreamStats.bind(this),this._localStream.vendorHandler||this._ctx.handler):this._localStream.stopReport("unpublish");case 41:case"end":return e.stop()}}),e,this,[[13,22],[29,35]])}))),function(e,t,r,n,i,o){return b.apply(this,arguments)})},{key:"updatePubTrack",value:(S=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("updatePubTrack","Invoke updatePubTrack"),!this._localStream){e.next=4;break}return e.next=4,this._publisher.updatePubTrack(this._localStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return S.apply(this,arguments)})},{key:"unpublish",value:(y=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("unpublish","Invoke unpublish"),!this._localStream){e.next=7;break}return e.next=4,this._publisher.unpublish(this._localStream);case 4:this._localStream.stopReport("unpublish"),this._localStream.clean(),this._localStream=void 0;case 7:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"subscribe",value:(g=HS(BS().mark((function e(t,r,n){var i,o;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("subscribe","remoteStream %o",t),t.streamState===nX.INIT){e.next=8;break}if((i=t.subMediaType|r)===t.subMediaType){e.next=7;break}return e.next=6,this._subscriber.updateSubMediaType(t,i);case 6:return e.abrupt("return",e.sent);case 7:return e.abrupt("return");case 8:return o=void 0,n&&(o=this._subscriber.getSubLayer(n,t)),e.next=12,this._subscriber.subscribe(t,r,o);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return g.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(m=HS(BS().mark((function e(t,r){var n,i,o,a;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(o=this._findRemoteStreamByScreen(t,!1))&&o.hasSubscribed&&!((null===(n=o.attributes)||void 0===n||null===(i=n.videoDescriptions)||void 0===i?void 0:i.length)<=1)){e.next=3;break}return e.abrupt("return");case 3:return a=this._subscriber.getSubLayer(r,o),o.originalStreamIndex=a.spatialLayer,e.abrupt("return",this._subscriber.updateSubTrackLayer(o,a));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return m.apply(this,arguments)})},{key:"unsubscribe",value:(_=HS(BS().mark((function e(t,r){var n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("unsubscribe","Invoke unsubscribe"),t.hasSubscribed){e.next=3;break}return e.abrupt("return");case 3:if(i=t.subMediaType-(t.subMediaType&r),null!==(n=this._ctx.serverConfig)&&void 0!==n&&n.muteReplaceUnsub||!(i===uH.NONE||this.config.isMultiChatMode()&&i===wP.AUDIO)){e.next=8;break}return e.next=7,this._subscriber.unsubscribe(t);case 7:return e.abrupt("return",e.sent);case 8:return e.next=10,this._subscriber.updateSubMediaType(t,i);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"startSubtitle",value:(v=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._subtitleTool){e.next=5;break}return e.next=3,this._subtitleTool.start(t);case 3:e.next=6;break;case 5:throw new rN(_P.INVOKED_BEFORE_JOIN_ROOM,"join first");case 6:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"updateSubtitleConfig",value:(f=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._subtitleTool){e.next=5;break}return e.next=3,this._subtitleTool.update(t);case 3:e.next=6;break;case 5:throw new rN(_P.INVOKED_BEFORE_JOIN_ROOM,"join first");case 6:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"stopSubtitle",value:(p=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null===(t=this._subtitleTool)||void 0===t||t.stop();case 1:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"startForwardStream2Rooms",value:(h=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._forwardStreamManager.startForwardStream2Rooms(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"updateForwardStream2Rooms",value:(l=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._forwardStreamManager.updateForwardStream2Rooms(t));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"stopForwardStream2Rooms",value:(d=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._forwardStreamManager.stopForwardStream2Rooms());case 1:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"pauseForwardStream2AllRooms",value:(u=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._forwardStreamManager.pauseForwardStream2AllRooms());case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"resumeForwardStream2AllRooms",value:(c=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._forwardStreamManager.resumeForwardStream2AllRooms());case 1:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"updateMediaParams",value:(s=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._ctx.signalingManager.sendSignaling("updateMediaParams",{roomId:this.config.roomId,mediaParams:t}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"leave",value:(a=HS(BS().mark((function e(){var t,r,n,i,o,a,s,c=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=c.length>0&&void 0!==c[0]&&c[0],this.logger.info("leave","Invoke leave"),null===(t=this._subtitleTool)||void 0===t||t.destroy(),delete this._subtitleTool,e.prev=4,i=Ab(zN(n=this._remoteStreams).call(n));try{for(i.s();!(o=i.n()).done;)a=o.value,Array.isArray(a)&&a.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(e){i.e(e)}finally{i.f()}return this._localStream&&(null===(s=this._localStream.observer)||void 0===s||s.setLogin(!1)),e.next=10,this._roomJoin.leave().catch((function(){}));case 10:this.destroy(),this.config.report("rtc_leave_room",{error_code:0,message:"",elapse:this.config.getStayRoomDuration()}),e.next=22;break;case 14:if(e.prev=14,e.t0=e.catch(4),e.t0 instanceof Error&&this.config.report("rtc_leave_room",{error_code:-1,message:e.t0.message,elapse:this.config.getStayRoomDuration()}),!r){e.next=21;break}throw e.t0;case 21:this.destroy();case 22:case"end":return e.stop()}}),e,this,[[4,14]])}))),function(){return a.apply(this,arguments)})},{key:"updateRemoteUserPriority",value:function(e){var t,r=this;null===(t=this.remoteStreams.get(e))||void 0===t||t.forEach((function(t){var n=r._ctx.userPriority;t.hasSubscribed&&n.has(e)&&r._subscriber.updateSubPriority(t,n.get(e))}))}},{key:"destroy",value:function(){var e,t;this.logger.info("destroy","Invoke destroy"),qV(this._ctx.id,"room_destroy","".concat((new Error).stack)),null===(e=this._subtitleTool)||void 0===e||e.destroy(),delete this._subtitleTool,this._subscriber.destroy(this._remoteStreams),this._publisher.destroy([this.localStream,this.localScreenStream]),this._roomJoin.destroy(),null===(t=this._clearSignalListeners)||void 0===t||t.call(this),this._remoteUsers=new DR;var r,n=Ab(this._remoteStreams);try{for(n.s();!(r=n.n()).done;){var i=xb(r.value,2)[1];Array.isArray(i)&&i.forEach((function(e){null==e||e.destroy()}))}}catch(e){n.e(e)}finally{n.f()}this._virtualStreams.forEach((function(e){null==e||e.clean()})),this._remoteStreams=new DR,this._localStream&&(this._localStream.clean(),this._localStream=void 0),this._localScreenStream&&(this._localScreenStream.clean(),this._localScreenStream=void 0),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._csrcUserIdMap={},this._virtualStreams=[],this._remoteStreamStreamIdUserIdMap={},this._forwardStreamManager.destoy()}},{key:"updateToken",value:(o=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("updateToken","Invoke updateToken"),this.config.token=t,e.prev=2,e.next=5,this._roomJoin.updateToken(t);case 5:e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(2),this.safeEmit(aX.ON_ROOM_ERROR,{errorCode:_P.UPDATE_TOKEN_WITH_INVALID_TOKEN}),e.t0;case 11:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(e){return o.apply(this,arguments)})},{key:"sendUserMessage",value:function(e,t){return this._roomMessage.sendUserMessage(e,t)}},{key:"sendRoomMessage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._roomMessage.sendRoomMessage(e,t)}},{key:"maybeFillBackFrame2Stream",value:(i=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.refreshBlackFrameLifetime(),null!==(r=t.videoTransceiver)&&void 0!==r&&r.sender.track||this._publisher.updatePubBlackFrame(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_onJoinSucc",value:function(e){var t,r,n,i=this,o=e.joinRes,a=e.reconnect;this.logger.info("_onJoinSucc()","invoke. ".concat(a?"[reconnect]":"")),this.emit(aX.JOIN_SUCCESS,a),this._serverConfig=o.config,this.config.updateRoomAttributes(o.roomAttributes);var s=[],c=[],u=[],d=[],l=[];null===(t=o.clientsDetail)||void 0===t||t.forEach((function(e){if(e.attributes&&(e.attributes.serverMuteVideo&&i.safeEmit(aX.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&i.safeEmit(aX.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio})),e.clientId!==o.clientId){var t=i._remoteUsers.get(e.clientId);t?t._stillExist=!0:s.push(e)}}));var h,p=Ab(zN(r=this._remoteUsers).call(r));try{for(p.s();!(h=p.n()).done;){var f=h.value;f._stillExist||c.push({clientId:f.userId}),delete f._stillExist}}catch(e){p.e(e)}finally{p.f()}o.streams.forEach((function(e){var t=i._findRemoteStreamByScreen(e.clientId,e.screen);i.config.updateUserPubInfo(e),t?(t.stillExist=!0,t.streamId=e.streamId,l.push(e)):d.push(e)}));var v,_=Ab(zN(n=this._remoteStreams).call(n));try{for(_.s();!(v=_.n()).done;){var m=v.value;Array.isArray(m)&&m.forEach((function(e){e.stillExist?delete e.stillExist:u.push({clientId:e.userId,streamId:e.streamId,message:Cj.clientDisconnected})}))}}catch(e){_.e(e)}finally{_.f()}c.forEach((function(e){return i._onUserDisconnection(e)})),s.forEach((function(e){return i._onUserConnection(e)})),u.forEach((function(e){return i._onRemoveStream(e)})),d.forEach((function(e){return i._onAddStream(e,{fromSignal:!1})})),l.forEach((function(e){return i._onUpdateStreamAttributes(e)})),this.config.resetUserPubInfo(),a&&this._handleSendOrRecvStreamAfterReconnect(),this.emit("__joinSuccess")}},{key:"_handleSendOrRecvStreamAfterReconnect",value:function(){var e,t,r,n,i=this;this._localStream&&(this._localStream.clean(),this._localStream.vendorCode=this.config.vendorConfig.vendorCode||0,null===(r=this._localStream.observer)||void 0===r||r.setLogin(!0),this._publisher.publish(this._localStream).then((function(){var e;i._ctx.handler&&(null===(e=i._localStream)||void 0===e||e.startReport(i._onLocalStreamStats.bind(i),i._localStream.vendorHandler||i._ctx.handler)),i.emit(aX.ON_PUBLISH_RESULT,{isScreen:!1,state:TP.PUBLISH_SUCC,retry:!0})})).catch((function(e){i.logger.error("failed repub error:".concat(e)),i.emit(aX.ON_PUBLISH_RESULT,{isScreen:!1,state:TP.PUBLISH_FAIL,errorCode:e.code,retry:!0})}))),this._localScreenStream&&(this._localScreenStream.clean(),null===(n=this._localScreenStream.observer)||void 0===n||n.setLogin(!0),this._publisher.publish(this._localScreenStream).then((function(){var e;i._ctx.handler&&(null===(e=i._localScreenStream)||void 0===e||e.startReport(i._onLocalStreamStats.bind(i),i._localScreenStream.vendorHandler||i._ctx.handler)),i.emit(aX.ON_PUBLISH_RESULT,{isScreen:!0,state:TP.PUBLISH_SUCC,retry:!0})})).catch((function(e){i.logger.error("failed repub screen stream error:".concat(e)),i.emit(aX.ON_PUBLISH_RESULT,{isScreen:!0,state:TP.PUBLISH_FAIL,errorCode:e.code,retry:!0})})));var o,a=Ab(zN(t=this._remoteStreams).call(t));try{for(a.s();!(o=a.n()).done;){var s=o.value;Array.isArray(s)&&s.forEach(function(){var e=HS(BS().mark((function e(t){var r,n,o,a,s,c;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.hasSubscribed){e.next=22;break}return t.resetHasSubscribed(),e.prev=2,i.logger.info(JS(r="start resubscribe ".concat(t.userId," with ")).call(r,t.subMediaType)),DF(t.subMediaType)&&(null===(n=t.observer)||void 0===n||n.setSubscribeVideo(!0)),MF(t.subMediaType)&&(null===(o=t.observer)||void 0===o||o.setSubscribeAudio(!0)),e.next=8,i._subscriber.subscribe(t,t.subMediaType);case 8:i.logger.info(JS(a="success resubscribe ".concat(t.userId," with ")).call(a,t.subMediaType)),i.safeEmit(aX.RESUBSCRIBE,{stream:t}),i.emit(aX.ON_SUBSCRIBE_RESULT,{state:kP.SUBSCRIBE_SUCC,userId:t.userId,isScreen:t.isScreen,retry:!0}),e.next=22;break;case 13:if(e.prev=13,e.t0=e.catch(2),i.emit(aX.ON_SUBSCRIBE_RESULT,{state:kP.SUBSCRIBE_FAIL,userId:t.userId,isScreen:t.isScreen,errorCode:e.t0.code,retry:!0}),i.logger.error(JS(s=JS(c="failed resubscribe ".concat(t.userId," with ")).call(c,t.subMediaType,", error:")).call(s,e.t0)),e.t0.code!==_P.NOT_CONNECTED_YET){e.next=20;break}return t.streamState=nX.SUB_ED,e.abrupt("return");case 20:t.clean(),t.resetHasSubscribed();case 22:case"end":return e.stop()}}),e,null,[[2,13]])})));return function(t){return e.apply(this,arguments)}}())}}catch(e){a.e(e)}finally{a.f()}null===(e=this._subtitleTool)||void 0===e||e.reconnect(),this._forwardStreamManager.resumeFromReconnect()}},{key:"_handleFFAudioTrack",value:function(){var e,t,r=null===(e=this._ctx.handler)||void 0===e?void 0:e.audioTrack4ff,n=null===(t=this._ctx.handler)||void 0===t?void 0:t.getTransceivers();if(r&&Array.isArray(n)){var i=DC(n).call(n,(function(e){var t;return(null==e||null===(t=e.receiver)||void 0===t?void 0:t.track)===r}));if(i){var o=new oX(this._ctx,"ff-stream","ff-stream",!1,!1,S2);o.virtual=!0,o.audioTransceiver=i,o.audioMid="0",o.audioTrack=KK(r,{streamIndex:Uj.VIRTUAL}),this._virtualStreams.push(o),this.safeEmit(aX.SUBSCRIBE_PUSH_TRACK,{stream:o})}}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?DC(r).call(r,(function(e){return e.streamId===t})):null}},{key:"_findRemoteStreamByScreen",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?DC(r).call(r,(function(e){return e.isScreen===t})):null}},{key:"_onAddStream",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.needEmit,n=void 0===r||r,i=t.fromSignal,o=void 0===i||i,a=t.virtual,s=void 0!==a&&a;if(e.clientId!==this.config.userId){var c=this.config,u=c.isAutoSubscribeAudio,d=c.isAutoSubscribeVideo,l=this._findRemoteStreamByScreen(e.clientId,e.screen);if(l&&l.streamId!==e.streamId){var h,p=null===(h=this._remoteStreams.get(e.clientId))||void 0===h?void 0:Wb(h).call(h,(function(e){return e.streamId!==l.streamId}));l.clean(),this._remoteStreams.set(e.clientId,p||[])}var f=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,f)f.attributes=e.attributes;else if((f=new oX(this._ctx,e.clientId,e.streamId,e.screen,!1,e.attributes)).virtual=s,this._initStreamListeners(f),!s){var v=this._remoteStreams.get(e.clientId);v?v.push(f):this._remoteStreams.set(e.clientId,[f])}if(f.remoteSessionId=e.remoteSessionId||"",f.observer=new lX(this._ctx,f),!f.isScreen&&d&&(o&&f.hasVideo&&(f.attributes.extvideo?(f.observer.setExternalVideoSource(!0),f.observer.setPushVideo(!0)):(f.observer.setExternalVideoSource(!1),f.observer.setPublishVideo(!0))),o&&f.hasAudio&&u&&!this.config.isMultiChatMode()&&(f.attributes.extaudio?(f.observer.setExternalAudioSource(!0),f.observer.setPushAudio(!0)):(f.observer.setExternalAudioSource(!1),f.observer.setPublishAudio(!0))),n&&!o)){var _=this.config,m=_.isAutoSubscribeAudio,g=_.isAutoSubscribeVideo;f.observer.setLogin(!0,{audio:!!m&&!this.config.isMultiChatMode(),video:!!g})}return n&&this.safeEmit(Aj.ON_ADD_STREAM,{stream:f}),f}}},{key:"_onUserConnection",value:function(e){if(e.clientId!==this.config.userId){var t=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof t)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(t);var r={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,ux({},r)),this.safeEmit(Aj.USER_CONNECTION,{userInfo:r,publishState:this.config.getUserPubInfo(r.userId)}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(aX.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(aX.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}}},{key:"_onUserDisconnection",value:function(e){var t=this,r=e.clientId,n=e.tag,i=e.code,o=e.forbiddenTime;if(r)if(r===this.config.userInfo.userId){var a=null;n===Pj.kickedByAdmin?a=_P.KICKED_OUT:n===Pj.onUserTokenDidExpire?a=_P.TOKEN_EXPIRED:n===Pj.userDuplicateLogin&&(a=_P.DUPLICATE_LOGIN),i===Nj.roomDismissByAdmin&&(a=_P.ROOM_DISMISS),a&&this.safeEmit(aX.ON_ROOM_ERROR,{errorCode:a,forbiddenTime:o})}else{var s=SP.DROPPED;n===Pj.userLeave?s=SP.QUIT:n===Pj.kickedByAdmin?s=SP.KICKED_BY_ADMIN:n===Pj.roleChanged&&(s=SP.SWITCH_TO_INVISIBLE);var c=function(){var e;t._remoteUsers.delete(r);var n=[];null===(e=t._remoteStreams.get(r))||void 0===e||e.forEach((function(e){n.push(t._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:Cj.clientDisconnected}))})),t._remoteStreams.delete(r),qS.all(n).finally((function(){t.safeEmit(aX.ON_USER_LEAVE,{userInfo:{userId:r},reason:s})}))};if(n===Pj.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(r);u&&self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(r,d)}else c()}}},{key:"_onRemoveStream",value:(n=HS(BS().mark((function e(t){var r,n,i,o,a=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.clientId!==this.config.userId){e.next=2;break}return e.abrupt("return");case 2:if(r=this._remoteStreams.get(t.clientId)){e.next=5;break}return e.abrupt("return");case 5:if(n=DC(r).call(r,(function(e){return e.streamId===t.streamId}))){e.next=8;break}return e.abrupt("return");case 8:return n.hasVideo&&(null===(i=n.observer)||void 0===i||i.setPublishVideo(!1)),n.hasAudio&&!this.config.isMultiChatMode()&&(null===(o=n.observer)||void 0===o||o.setPublishAudio(!1)),e.prev=10,e.next=13,this._subscriber.handleRemoveStream(n).then((function(){var e=a._remoteStreams.get(t.clientId);e&&(e=Wb(e).call(e,(function(e){return e.streamId!==t.streamId||(e.clean(),!1)})),a._remoteStreams.set(t.clientId,e))})).finally((function(){a.safeEmit(Aj.ON_REMOVE_STREAM,{stream:n,reason:t.message,callback:function(){return n.destroy()}})}));case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(10),console.error(e.t0);case 18:case"end":return e.stop()}}),e,this,[[10,15]])}))),function(e){return n.apply(this,arguments)})},{key:"_onUpdateUserAttributes",value:function(e){e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(aX.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(aX.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){var t;e.roomAttributes&&this.config.updateRoomAttributes(e.roomAttributes),null!==(t=e.roomAttributes)&&void 0!==t&&t.multiChatMode&&this._handleFFAudioTrack()}},{key:"_onUpdateStreamAttributes",value:function(e){var t=this.config,r=t.isAutoSubscribeAudio,n=t.isAutoSubscribeVideo,i=e.clientId,o=e.streamId,a=e.attributes,s=this._findRemoteStream(i,o);if(s){var c,u,d=s.attributes,l=ux(ux({},d),a),h=!1,p=l.localaudio!==d.localaudio,f=!1,v=!1,_=l.localvideo!==d.localvideo,m=!1,g=uH.NONE,y=uH.NONE;if(l.audiostream!==d.audiostream&&(h=l.localaudio,f=!!l.audiostream,l.audiostream?g|=wP.AUDIO:y|=wP.AUDIO),l.videostream!==d.videostream&&(v=l.localvideo,m=!!l.videostream,l.videostream?g|=wP.VIDEO:y|=wP.VIDEO),g&&this.safeEmit(aX.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:g,isScreen:s.isScreen,pubState:cX.PUB,remoteStream:s}),y&&this.safeEmit(aX.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:y,isScreen:s.isScreen,pubState:cX.UNPUB,remoteStream:s}),s.remoteSessionId=e.remoteSessionId||"",s.attributes=l,l.localaudio!==d.localaudio)if(l.localaudio){var S,b,E,k;(r||s.subAudio)&&l.audiostream&&(l.extaudio?(null===(S=s.observer)||void 0===S||S.setExternalAudioSource(!0),null===(b=s.observer)||void 0===b||b.setPushAudio(!0)):(null===(E=s.observer)||void 0===E||E.setExternalAudioSource(!1),null===(k=s.observer)||void 0===k||k.setEnableAudio(!0))),this.safeEmit(aX.ON_USER_START_AUDIO_CAPTURE,{userId:i},s)}else{var T,I,R,C;l.extaudio?(null===(T=s.observer)||void 0===T||T.setExternalAudioSource(!0),null===(I=s.observer)||void 0===I||I.setPushAudio(!1)):(null===(R=s.observer)||void 0===R||R.setExternalAudioSource(!1),null===(C=s.observer)||void 0===C||C.setEnableAudio(!1)),!s.isScreen&&this.safeEmit(aX.ON_USER_STOP_AUDIO_CAPTURE,{userId:i})}if(l.localvideo!==d.localvideo)if(l.localvideo){var w,A,x,O;(n||s.subVideo)&&l.videostream&&(l.extvideo?(null===(w=s.observer)||void 0===w||w.setExternalVideoSource(!0),null===(A=s.observer)||void 0===A||A.setPushVideo(!0)):(null===(x=s.observer)||void 0===x||x.setExternalVideoSource(!1),null===(O=s.observer)||void 0===O||O.setEnableVideo(!0))),this.safeEmit(aX.ON_USER_START_VIDEO_CAPTURE,{userId:i})}else{var P,N,M,D;l.extvideo?(null===(P=s.observer)||void 0===P||P.setExternalVideoSource(!0),null===(N=s.observer)||void 0===N||N.setPushVideo(!1)):(null===(M=s.observer)||void 0===M||M.setExternalVideoSource(!1),null===(D=s.observer)||void 0===D||D.setEnableVideo(!1)),!s.isScreen&&this.safeEmit(aX.ON_USER_STOP_VIDEO_CAPTURE,{userId:i})}h&&!p&&r&&(null===(c=s.observer)||void 0===c||c.setRemoteUnmuteAudio(f)),v&&!_&&n&&(null===(u=s.observer)||void 0===u||u.setRemoteUnmuteVideo(m)),"number"==typeof l.videoType&&l.videoType!==d.videoType&&this.safeEmit(aX.VIDEO_TYPE_CHANGE,{userId:s.userId,isScreen:s.isScreen,type:l.videoType===Mj.BLACK?Rj.BLACK:Rj.NORMAL})}}},{key:"_onPushTrack",value:function(e){var t,r=this;if(null!==(t=e.streamId)&&void 0!==t&&vP(t).call(t,"audio_mux")){var n=this._onAddStream(ux(ux({},e),{},{attributes:S2}),{needEmit:!1,fromSignal:!1,virtual:!0});n&&this._subscriber.subscribe4pushTrack(n,e).then((function(){r.safeEmit(aX.SUBSCRIBE_PUSH_TRACK,{stream:n}),r._virtualStreams.push(n)})).catch((function(e){r.logger.error("subscribe","push track failed %o",e)}))}else{var i;this.config.report("rtc_error",{message:JS(i="onPushTrack, userId: ".concat(e.clientId,", ")).call(i,e.streamId),error_code:kX.TRACK_ERROR})}}},{key:"_onRemoveTrack",value:function(e){var t=e.clientId,r=e.streamId,n=e.message,i=e.trackType;this.logger.info("_onRemoveTrack","remove track: %o",t);var o=this._findRemoteStream(t,r);o&&(o.removeTrack=!0,this._subscriber.unsubscribe4removeTrack(o,n,i),this.emit(aX.REMOVE_PUSH_TRACK,{stream:o,mediaType:i+1}))}},{key:"_onMeetingSpeakerChange",value:function(e){if(Array.isArray(null==e?void 0:e.speakerCsrcInfo)){var t={};null==e||e.speakerCsrcInfo.forEach((function(e){var r=e.csrc,n=e.userId;e.isScreen||(t[r]=n)})),this._csrcUserIdMap=t}Array.isArray(e.muxStreamInUse)&&this._virtualStreams.forEach((function(t){var r;null!==(r=e.muxStreamInUse)&&void 0!==r&&vE(r).call(r,t.streamId)?t.virtualOccupy=!0:t.virtualOccupy=!1}))}},{key:"getActiveSpeakerInMultiChatMode",value:function(){var e=this,t=[];return this._virtualStreams.forEach((function(r){var n,i=null===(n=r.audioTransceiver)||void 0===n?void 0:n.receiver;if(i){var o=xb(i.getContributingSources()||[],1)[0];if(o){var a=o.audioLevel,s=o.source;e._csrcUserIdMap[s]&&t.push({userId:e._csrcUserIdMap[s],audioLevel:a})}}})),t.length&&zO(t).call(t,(function(e,t){return e.audioLevel-t.audioLevel})),t}},{key:"_onReconnecting",value:function(){var e,t,r,n,i,o,a,s,c=this,u=Ab(zN(a=this._remoteStreams).call(a));try{for(u.s();!(s=u.n()).done;){var d=s.value;Array.isArray(d)&&d.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setDisconnect(),e.clean()}))}}catch(e){u.e(e)}finally{u.f()}this._virtualStreams.forEach((function(e){var t;c.emit(aX.REMOVE_PUSH_TRACK,{stream:e,mediaType:wP.AUDIO}),null===(t=e.observer)||void 0===t||t.setDisconnect(),e.clean()})),this._virtualStreams=[],null===(e=this.localStream)||void 0===e||null===(t=e.observer)||void 0===t||t.setDisconnect(),null===(r=this.localStream)||void 0===r||r.clean(),null===(n=this.localScreenStream)||void 0===n||null===(i=n.observer)||void 0===i||i.setDisconnect(),null===(o=this.localScreenStream)||void 0===o||o.clean()}},{key:"_onConnectionStateChange",value:function(e){e.state===xP.CONNECTION_STATE_RECONNECTING?this._onReconnecting():e.state===xP.CONNECTION_STATE_RECONNECTED&&this._roomJoin.join(!0)}},{key:"_initStreamListeners",value:function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){t.emit(aX.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:t.config.roomId,streamIndex:e.isScreen?CP.STREAM_INDEX_SCREEN:CP.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){var t;null!==(t=this._subtitleTool)&&void 0!==t&&t.onMessageRecv(e)||this.safeEmit(Aj.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(Aj.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){var t,r={userId:e.from,message:e.msg};null!==(t=this._subtitleTool)&&void 0!==t&&t.onMessageRecv(r)||this.safeEmit(Aj.USER_BINARY_MESSAGE_RECEIVED,r)}},{key:"_initSubtitleTool",value:function(){var e=this;this._subtitleTool=new SX(this._ctx,this.config),this._subtitleTool.onEvent=function(t){e.emit(aX.ON_SUBTITLE_STATE_CHANGED,t)},this._subtitleTool.onMessage=function(t){e.emit(aX.ON_SUBTITLE_MESSAGE_RECEIVED,t)}}},{key:"_onPostProcessingMessage",value:function(e){if(e.body)if("subtitleCallback"!==e.type){var t=e.body,r=t.error||0,n=sX.START,i=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(n=sX.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?sX.START_FAILED:sX.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?sX.STOP_FAILED:sX.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?sX.UPDATE_FAILED:sX.UPDATE_SUCCESS}this.safeEmit(Aj.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(Aj.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}else{var o;null===(o=this._subtitleTool)||void 0===o||o.onResult(e)}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(Aj.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onUserTokePublishPrivilegeWillExpire",value:function(){this.safeEmit(Aj.ON_TOKEN_PUBLISH_PRIVILEGE_WILL_EXPIRE,null)}},{key:"_onUserTokenPublishPrivilegeDidExpire",value:function(){this.safeEmit(Aj.ON_TOKEN_PUBLISH_PRIVILEGE_DID_EXPIRED,null)}},{key:"_onUserTokeSubscribePrivilegeWillExpire",value:function(){this.safeEmit(Aj.ON_TOKEN_SUBSCRIBE_PRIVILEGE_WILL_EXPIRE,null)}},{key:"_onUserTokenSubscribePrivilegeDidExpire",value:function(){this.safeEmit(Aj.ON_TOKEN_SUBSCRIBE_PRIVILEGE_DID_EXPIRED,null)}},{key:"_onStreamFailed",value:(r=HS(BS().mark((function e(t){var r,n,i,o,a,s,c;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("publish"!==t.type){e.next=11;break}if(i=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?i=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(i=this.localScreenStream),i){e.next=5;break}return e.abrupt("return");case 5:return e.next=7,this._publisher.unpublish(i).catch((function(){}));case 7:i.clean(),this._publisher.publish(i).catch((function(){})),e.next=22;break;case 11:if("subscribe"!==t.type){e.next=22;break}if(o=this._remoteStreamStreamIdUserIdMap[t.streamId],!(a=this._findRemoteStream(o,t.streamId))){e.next=22;break}return s=a.subMediaType,c=a.subLayer,e.next=19,this._subscriber.unsubscribe(a);case 19:return e.next=21,this._subscriber.subscribe(a,s,c);case 21:this.safeEmit(aX.RESUBSCRIBE,{stream:a});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===wj.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:(t=HS(BS().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,p,f=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._publishOnDemandItem&&!this._publishOnDemandBusy&&!1!==(null===(t=this._serverConfig)||void 0===t||null===(r=t.engine_VPM)||void 0===r||null===(n=r.ondemand)||void 0===n?void 0:n.enable)){e.next=2;break}return e.abrupt("return");case 2:if(null===(i=this._localStream)||void 0===i||!i.videoTransceiver){e.next=16;break}return this._publishOnDemandBusy=!0,a=this._publishOnDemandItem,this._publishOnDemandItem=void 0,s=[],c=this._localStream.stream.id,u=this._localStream.videoTransceiver.sender,d=u.getParameters(),Array.isArray(d.encodings)&&Array.isArray(a)&&(h={},this.logger.info("_onPublishOnDemand exec","usedDescriptions: %o",a),a.forEach((function(e){var t;if(null!==(t=e.StreamIds)&&void 0!==t&&vE(t).call(t,c)){var r,n,i,o,a,s,u,d=null!==(r=null===(n=e.Metadata)||void 0===n?void 0:n.VideoIndex)&&void 0!==r?r:0,l=0;null!==(i=f._ctx.serverConfig)&&void 0!==i&&i.e2eFeedback&&(l=Math.max.apply(Math,JS(o=jw(ob(a=ck(null!==(s=null===(u=e.Metadata)||void 0===u?void 0:u.VideoKbpsHist)&&void 0!==s?s:{})).call(a,(function(e){return Number(e)})))).call(o,[0]))),h[d]={kbps:l}}})),p=jw(this._localStream.pubAttributes.videoDescriptions),d.encodings=ob(l=d.encodings).call(l,(function(e){if(e.rid){if(h[e.rid]){var t;e.active=!0;var r=null===(t=h[e.rid])||void 0===t?void 0:t.kbps;r&&(e.maxBitrate=1e3*yQ(e.rid,r,p))}else e.active=!1;var n=Number(e.rid);s[n]=e.active}else{var i,o=null===(i=h[0])||void 0===i?void 0:i.kbps;o&&(e.maxBitrate=1e3*yQ(void 0,o,p))}return e})),this.config.report("rtc_invoke_status",{sdk_api_name:"onPublishOnDemand",message:ZS(d.encodings),error_code:0,stream_id:c,elapse:0}),this._ctx.activeSimStreams=s),e.next=13,u.setParameters(d);case 13:this._publishOnDemandBusy=!1,e.next=18;break;case 16:if(null!==(o=this._localStream)&&void 0!==o&&o.videoTransceiver){e.next=18;break}return e.abrupt("return");case 18:this._onPublishOnDemand();case 19:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_onRTT",value:function(e){var t=e.StreamIds,r=e.Metadata;if(null!=t&&t.length&&r){var n=t[0];this._ctx.streamRTT[n]={audio:r.audio_rtt,video:r.video_rtt}}}},{key:"_onRSCP",value:function(e,t){var r=this;DC(e).call(e,(function(e){var t,n,i;return null==e||null===(t=e.StreamIds)||void 0===t?void 0:vE(t).call(t,null===(n=r._localStream)||void 0===n||null===(i=n.stream)||void 0===i?void 0:i.id)}))&&(t?this._pubTransceiverReady=!0:this._onceTriggerBySignal=!0,t&&this._onceTriggerBySignal||(this._publishOnDemandItem=e),this._pubTransceiverReady&&this._onPublishOnDemand())}},{key:"_onSSC",value:function(e){var t=e.StreamIds,r=e.Metadata,n=t[0],i=this._remoteStreamStreamIdUserIdMap[n],o=this._findRemoteStream(i,n),a={userId:i,isScreen:!!o&&o.isScreen,beforeVideoIndex:r.ssc_items[0].prev_layer_id,afterVideoIndex:r.ssc_items[0].cur_layer_id,beforeEnable:0!==r.ssc_items[0].prev_video_open,afterEnable:0!==r.ssc_items[0].cur_video_open,reason:r.ssc_items[0].change_reason};this.emit(aX.ON_SIMULCAST_SUBSCRIBE_FALLBACK,a)}},{key:"_reportNetworkQuality",value:function(e,t){this.emit(aX.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){this.emit(aX.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:this.config.roomId,userId:e,streamIndex:t?CP.STREAM_INDEX_SCREEN:CP.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"setAudioEncodeMaxBitrate",value:(e=HS(BS().mark((function e(t,r){var n,i,o,a;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==(n=t===CP.STREAM_INDEX_MAIN?this.localStream:this.localScreenStream)||!n.pubAudio){e.next=7;break}if(null==(o=null===(i=n.audioTransceiver)||void 0===i?void 0:i.sender.getParameters())||!o.encodings.length){e.next=7;break}return o.encodings[0].maxBitrate=1e3*r,e.next=7,null===(a=n.audioTransceiver)||void 0===a?void 0:a.sender.setParameters(o);case 7:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})}]),x}();y2([pQ],b2.prototype,"publishScreen"),y2([pQ],b2.prototype,"updatePubScreenTrack"),y2([pQ],b2.prototype,"unpublishScreen"),y2([pQ],b2.prototype,"liveControlMessage"),y2([pQ],b2.prototype,"publicStreamControlMessage"),y2([pQ],b2.prototype,"updateUserAttributes"),y2([pQ],b2.prototype,"publish"),y2([pQ],b2.prototype,"updatePubTrack"),y2([pQ],b2.prototype,"unpublish"),y2([pQ],b2.prototype,"subscribe"),y2([pQ],b2.prototype,"updateSubVideoConfig"),y2([pQ],b2.prototype,"unsubscribe"),y2([pQ],b2.prototype,"startSubtitle"),y2([pQ],b2.prototype,"stopSubtitle"),y2([pQ],b2.prototype,"startForwardStream2Rooms"),y2([pQ],b2.prototype,"updateForwardStream2Rooms"),y2([pQ],b2.prototype,"stopForwardStream2Rooms"),y2([pQ],b2.prototype,"pauseForwardStream2AllRooms"),y2([pQ],b2.prototype,"resumeForwardStream2AllRooms"),y2([pQ],b2.prototype,"updateMediaParams"),y2([pQ],b2.prototype,"updateRemoteUserPriority"),y2([pQ],b2.prototype,"updateToken"),y2([pQ],b2.prototype,"sendUserMessage"),y2([pQ],b2.prototype,"sendRoomMessage"),y2([pQ],b2.prototype,"maybeFillBackFrame2Stream");var E2=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&QR(r.style,t.style),t.attributes&&BE(t.attributes).forEach((function(e){var t=xb(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},k2=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],T2={playsinline:"","webkit-playsinline":""},I2={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},R2=function(){Hx(r,Ej.EventEmitter);var e,t=oO(r);function r(e,n,i){var o;of(this,r),af(dx(o=t.call(this)),"_containerDom",void 0),af(dx(o),"_videoDom",void 0),af(dx(o),"userId",void 0),af(dx(o),"renderMode",void 0),af(dx(o),"mirrorType",PP.MIRROR_TYPE_NONE),af(dx(o),"isScreen",void 0),af(dx(o),"isLocal",void 0),af(dx(o),"played",!1),af(dx(o),"_needLoad",!1),af(dx(o),"_emitPlayFailed",!1),af(dx(o),"_videoContainer",void 0),af(dx(o),"_safari15VideoTimer",void 0),af(dx(o),"_monitor",void 0),af(dx(o),"logger",void 0),af(dx(o),"_onLocalTrackMute",void 0),af(dx(o),"_onInterruptionEnd",void 0),af(dx(o),"_needResume",!1),af(dx(o),"_rotate",0),af(dx(o),"_rotateDom",void 0),af(dx(o),"_resizeObserver",void 0),af(dx(o),"_hasManuallyPaused",!1),af(dx(o),"isIntersecting",void 0),af(dx(o),"intersectionObserver",void 0),af(dx(o),"emitVideoEvent",(function(e){var t,r,n={type:"video",rawEvent:e,readyState:(null===(t=o._videoDom)||void 0===t?void 0:t.readyState)||0,userId:o.userId,eventName:e.type,currentTime:(null===(r=o._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:o.isScreen};switch(o.emit("playback_event",n),e.type){case"canplay":o.refreshRenderSize("the video started playing."),o._internalPlay();break;case"loadeddata":o._internalPlay();break;case"playing":o.logger.info("VideoPlayerPlaying","[userId-".concat(o.userId,"] video element playing"));break;case"pause":o.logger.info("VideoPlayerPause","[userId-".concat(o.userId,"] video element pause")),o._needResume&&(o.logger.info("VideoPlayerPause","[userId-".concat(o.userId,"] video element resume")),o._internalPlay(),o._needResume=!1)}})),af(dx(o),"_internalPlay",(function(){var e,t;if(qV(o.engineId,"video _internalPlay",{paused:null===(e=o._videoDom)||void 0===e?void 0:e.paused,hasManuallyPaused:o._hasManuallyPaused}),!o._hasManuallyPaused&&null!==(t=o._videoDom)&&void 0!==t&&t.paused){var r=o._videoDom.play();null!=r&&r.then&&r.then((function(){var e;o.isLocal&&oB&&!o._needLoad&&(null===(e=o._videoDom)||void 0===e||e.load(),o._needLoad=!0)})).catch((function(e){var t,r,n,i,a,s;o._emitPlayFailed||("AbortError"!==e.name?(o._emitPlayFailed=!0,null===(t=o._monitor)||void 0===t||t.report("rtc_error",{message:JS(r="video autoplay failed, userId: ".concat(o.userId,", ")).call(r,e.name),error_code:kX.AUTOPLAY_FAILED}),o.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=o._videoDom)||void 0===n?void 0:n.readyState)||0,userId:o.userId,eventName:"autoplay-error",currentTime:(null===(i=o._videoDom)||void 0===i?void 0:i.currentTime)||0,isScreen:o.isScreen})):null===(a=o._monitor)||void 0===a||a.report("rtc_error",{message:JS(s="video autoplay failed, userId: ".concat(o.userId,", ")).call(s,e.name),error_code:kX.AUTOPLAY_FAILED}))}))}})),o.engineId=e,o.playerId=n;var a=i.renderDom;o._monitor=GV(e),o.logger=new dF("Player",0,e);var s=i.userId,c=i.isScreen?RP.RENDER_MODE_FIT:RP.RENDER_MODE_HIDDEN;o.renderMode=void 0!==i.renderMode?i.renderMode:c,o._rotate=Number(i.rotation||0);var u="string"==typeof a?document.getElementById(a):a;if(!u)throw new rN(_P.CANT_FIND_DOM,"can't find dom");return o._videoContainer=document.createElement("div"),o._videoContainer.style.width="100%",o._videoContainer.style.height="100%",o._videoContainer.style.position="relative",o._videoContainer.style.overflow="hidden",o._containerDom=u,o.userId=s,o.isLocal=!!i.isLocal,o.isScreen=!!i.isScreen,o._initVideo(),!o.isLocal||15!==(null==RB?void 0:RB[0])&&15!==kB||(o._safari15VideoTimer=window.setTimeout((function(){try{o._videoContainer.style.display="block",setTimeout((function(){o._videoContainer.style.display="flex"}),500)}catch(e){}}),1e3)),o}return nf(r,[{key:"_initVideo",value:function(){var e,t,r=this;this._videoDom||(this._videoDom=E2("video",{style:{width:"100%",height:"100%"},attributes:I2}),this._videoDom.id=JS(t="".concat(this.userId,"_")).call(t,EF()),this.setRenderMode(this.renderMode),this.mirror(this.mirrorType===PP.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoContainer),qC(e=[90,270]).call(e,this._rotate)>-1?(this._rotateDom=this._createRotationDiv(),this._rotateDom.appendChild(this._videoDom),this._videoContainer.appendChild(this._rotateDom)):(180===this._rotate&&(this._videoContainer.style.transform="rotate(180deg)"),this._videoContainer.appendChild(this._videoDom)),this._initInterSectionObserver(),this._initListeners(),this._onLocalTrackMute=function(){r._needResume=!0},this._onInterruptionEnd=function(){r.logger.warn("resume player after iOS interruption"),r._internalPlay()},pK.on(lK.ON_IOS_LOCAL_TRACK_MUTE,this._onLocalTrackMute),pK.on(lK.ON_IOS_LOCAL_TRACK_UNMUTE,this._onInterruptionEnd),pK.on(lK.ON_IOS_INTERRUPTION_END,this._onInterruptionEnd)}},{key:"_initInterSectionObserver",value:function(){var e=this;!this.intersectionObserver&&"undefined"!=typeof IntersectionObserver&&this._videoDom&&(this.intersectionObserver=new IntersectionObserver((function(t){t[0]&&(e.isIntersecting=t[0].isIntersecting)}),{}),this.intersectionObserver.observe(this._videoDom))}},{key:"_closeIntersectionObserver",value:function(){this.intersectionObserver&&this._videoDom&&(this.intersectionObserver.disconnect(),this.intersectionObserver.unobserve(this._videoDom),delete this.intersectionObserver)}},{key:"_createRotationDiv",value:function(){var e=this,t=document.createElement("div");return t.style.transform="rotate(".concat(this._rotate,"deg)"),180!==this._rotate&&(t.style.position="absolute",this.refreshRenderSize("init"),window.ResizeObserver&&(this._resizeObserver=new ResizeObserver((function(){e.refreshRenderSize("the container size has changed.")})),this._resizeObserver.observe(this._containerDom))),t}},{key:"refreshRenderSize",value:function(e){if(this._rotateDom){var t,r;this.logger.print("refreshRenderSize","Because ".concat(e));var n=Number(window.getComputedStyle(this._containerDom).width.replace("px","")),i=Number(window.getComputedStyle(this._containerDom).height.replace("px","")),o=null===(t=this._videoDom)||void 0===t?void 0:t.videoWidth,a=null===(r=this._videoDom)||void 0===r?void 0:r.videoHeight;if(n&&i&&a&&o){var s,c;if(this.renderMode===RP.RENDER_MODE_FILL)s=i,c=n;else{var u=this.renderMode===RP.RENDER_MODE_HIDDEN?Math.max(n/a,i/o):Math.min(n/a,i/o);s=o*u,c=a*u}this._rotateDom.style.width="".concat(s,"px"),this._rotateDom.style.height="".concat(c,"px"),this._rotateDom.style.left="".concat((n-s)/2,"px"),this._rotateDom.style.top="".concat((i-c)/2,"px")}}}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&k2.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._videoDom&&k2.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)}))}},{key:"setRenderMode",value:function(e){this.renderMode=e,this._videoDom&&(this.renderMode===RP.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this.renderMode===RP.RENDER_MODE_FILL?this._videoDom.style.objectFit="fill":this._videoDom.style.objectFit="cover")}},{key:"playVideo",value:(e=HS(BS().mark((function e(t){var r,n,i,o,a=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this._videoDom,this.logger.info("playVideo","play video track: ".concat(this.userId)),!(i&&i.srcObject instanceof MediaStream&&i.srcObject.getTrackById(null===(r=t.preprocessingTrack)||void 0===r?void 0:r.id))){e.next=5;break}try{qV(this.engineId,"playVideo","play video repeatedly",0,this.userId)}catch(e){}return e.abrupt("return");case 5:i||(this._initVideo(),i=this._videoDom),this.logger.info("playVideo","play video by dom: ".concat(null===(n=i)||void 0===n?void 0:n.id)),(o=new MediaStream).addTrack(t.preprocessingTrack),i.srcObject=o,i&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),i&&!this._videoContainer.contains(i)&&this._videoContainer.appendChild(i),setTimeout((function(){return a._internalPlay()})),WB.VIDEO_STALL&&this.emit(wK.START_STALL_OBSERVE),this.played=!0;case 15:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"updateSrcObject",value:function(e){var t=e.preprocessingTrack;if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}}},{key:"removeTrack",value:function(){var e,t=null===(e=this._videoDom)||void 0===e?void 0:e.srcObject;if(t){var r=t.getVideoTracks();null!=r&&r.length&&r.forEach((function(e){t.removeTrack(e)}))}}},{key:"manuallyPlay",value:function(){if(this.logger.info("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,this._hasManuallyPaused=!1,!this._videoDom)throw new rN(_P.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||fB?this._videoDom.play():qS.resolve()}},{key:"manuallyPause",value:function(){if(this.logger.print("Invoke VideoPlayer.manuallyPause",this.userId,this.isScreen),this.played){if(this._hasManuallyPaused=!0,!this._videoDom)throw new rN(_P.INVALID_PARAMS,"Player not found");return this._videoDom.pause()}}},{key:"mirror",value:function(e){var t;this.logger.info("mirror",JS(t="".concat(this.userId," set mirror: ")).call(t,e)),this.mirrorType=e?PP.MIRROR_TYPE_RENDER:PP.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e,t,r,n=this,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=this._containerDom;this.logger.info("stop",JS(e="stop video track: ".concat(this.userId," ")).call(e,this.playerId.toString())),this._videoDom&&(i||(this._videoDom.srcObject=null),null!=o&&o.contains(this._videoContainer)&&o.removeChild(this._videoContainer),null===(t=this._videoContainer)||void 0===t||t.childNodes.forEach((function(e){e!==n._videoDom&&e!==n._rotateDom||n._videoContainer.removeChild(e)})),null!==(r=this._rotateDom)&&void 0!==r&&r.contains(this._videoDom)&&this._rotateDom.removeChild(this._videoDom)),this._hasManuallyPaused=!1,this.played=!1,WB.VIDEO_STALL&&this.emit(wK.STOP_STALL_OBSERVE),this._closeIntersectionObserver()}},{key:"destroy",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.logger.info("destroy","video player: ".concat(this.userId)),this.stop(t),null===(e=this._resizeObserver)||void 0===e||e.disconnect(),Bx(Fx(r.prototype),"removeAllListeners",this).call(this),this._removeListeners(),pK.off(lK.ON_IOS_LOCAL_TRACK_MUTE,this._onLocalTrackMute),pK.off(lK.ON_IOS_LOCAL_TRACK_UNMUTE,this._onInterruptionEnd),pK.off(lK.ON_IOS_INTERRUPTION_END,this._onInterruptionEnd),this._videoDom&&delete this._videoDom,this._safari15VideoTimer&&(window.clearInterval(this._safari15VideoTimer),this._safari15VideoTimer=void 0)}},{key:"domElement",get:function(){return this._videoDom}}]),r}(),C2=function(){Hx(n,Ej.EventEmitter);var e,t,r=oO(n);function n(e,t){var i,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{divId:void 0,muted:!1,isScreen:!1},a=o.divId,s=o.muted,c=o.isScreen;if(of(this,n),af(dx(i=r.call(this)),"_containerDom",void 0),af(dx(i),"_audioDom",void 0),af(dx(i),"_fakeAudioDom",void 0),af(dx(i),"userId",void 0),af(dx(i),"muted",!1),af(dx(i),"_emitPlayFailed",!1),af(dx(i),"played",!1),af(dx(i),"isScreen",void 0),af(dx(i),"_wechatTimer",void 0),af(dx(i),"_edgeTimer",void 0),af(dx(i),"_monitor",void 0),af(dx(i),"logger",void 0),af(dx(i),"_pasued",!0),af(dx(i),"emitAudioEvent",(function(e){var t,r,n,o,a={type:"audio",rawEvent:e,readyState:(null===(t=i._audioDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._audioDom)||void 0===r?void 0:r.currentTime)||0};"playing"===e.type&&i.logger.info("AudioPlayerPlaying","[userId-".concat(i.userId,"] audio element playing")),"pause"===e.type&&(i.logger.info("AudioPlayerPause","[userId-".concat(i.userId,"] audio element pause")),!i._pasued&&null!==(n=i._audioDom)&&void 0!==n&&null!==(o=n.srcObject)&&void 0!==o&&o.active&&i._internalPlay()),mB&&fB&&("canplay"===e.type?(clearTimeout(i._wechatTimer),i._wechatTimer=window.setTimeout((function(){i._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(i._wechatTimer)),vB&&uB&&"error"===e.type&&(clearTimeout(i._edgeTimer),i._edgeTimer=window.setTimeout((function(){var e;0===(null===(e=i._audioDom)||void 0===e?void 0:e.currentTime)&&i._autoPlayError("edge")}),500)),i.emit("playback_event",a)})),af(dx(i),"_internalPlay",(function(){var e,t;if(qV(i.engineId,"audio _internalPlay",{paused:null===(e=i._audioDom)||void 0===e?void 0:e.paused,userId:i.userId,screen:i.isScreen}),null!==(t=i._audioDom)&&void 0!==t&&t.paused)try{var r,n=i._audioDom.play(),o=mK.getAudioContextInstance();if("suspended"===o.state){var a=o.resume(),s=setTimeout((function(){var e;"suspended"===o.state&&(i._autoPlayError("AudioContext cannot resume"),null===(e=i._monitor)||void 0===e||e.report("rtc_error",{message:"audio autoplay failed, userId: ".concat(i.userId,": Cannot resume the AudioContext - timeout"),error_code:kX.AUTOPLAY_FAILED})),clearTimeout(s)}));a.catch((function(e){var t,r,n;i._autoPlayError("AudioContext cannot resume"),null===(t=i._monitor)||void 0===t||t.report("rtc_error",{message:JS(r=JS(n="audio autoplay failed, userId: ".concat(i.userId,": Cannot resume the AudioContext - rejected by: [")).call(n,null==e?void 0:e.name,"]")).call(r,null==e?void 0:e.message),error_code:kX.AUTOPLAY_FAILED})})).finally((function(){clearTimeout(s)}))}null!==(r=n)&&void 0!==r&&r.then&&(mB&&vB&&(n=n.then((function(){return new qS((function(e){setTimeout(HS(BS().mark((function t(){var r;return BS().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return null===(r=i._audioDom)||void 0===r||r.pause(),i._audioDom.volume=1,t.next=4,i._audioDom.play();case 4:e();case 5:case"end":return t.stop()}}),t)}))),500)}))}))),n.then((function(){qV(i.engineId,"_internalPlay successfully",{userId:i.userId,screen:i.isScreen}),i._pasued=!1})).catch((function(e){var t,r,n;i._autoPlayError(e),null===(t=i._monitor)||void 0===t||t.report("rtc_error",{message:JS(r=JS(n="audio autoplay failed, userId: ".concat(i.userId,": ")).call(n,e.message," ")).call(r,e.name),error_code:kX.AUTOPLAY_FAILED})})))}catch(e){var c,u,d;i._autoPlayError(e),null===(c=i._monitor)||void 0===c||c.report("rtc_error",{message:JS(u=JS(d="audio autoplay failed, userId: ".concat(i.userId,": ")).call(d,e.message," ")).call(u,e.name),error_code:kX.AUTOPLAY_FAILED})}})),i.engineId=e,a){var u=document.getElementById(a);if(!u)throw new rN(_P.CANT_FIND_DOM,"can't find dom");i._containerDom=u}else i._containerDom=document.body;return i.userId=t,i.muted=s,i.isScreen=c,i._monitor=GV(e),i.logger=new dF("Player",0,e),i._initAudio(),i}return nf(n,[{key:"_initAudio",value:function(){var e;this._audioDom||(this._audioDom=E2("audio",{style:{display:"none"},attributes:T2}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id=JS(e="".concat(this.userId,"_")).call(e,EF()),this._containerDom.appendChild(this._audioDom)),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&k2.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitAudioEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._audioDom&&(k2.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))}},{key:"playAudio",value:(t=HS(BS().mark((function e(t){var r,n,i,o,a,s=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("playAudio","play audio track: ".concat(this.userId)),!((o=this._audioDom)&&o.srcObject instanceof MediaStream&&o.srcObject.getTrackById(null===(r=t.preprocessingTrack)||void 0===r?void 0:r.id))){e.next=4;break}return e.abrupt("return");case 4:o||(this._initAudio(),o=this._audioDom),a=new MediaStream,t instanceof bK?(this._fakeAudioDom=new Audio,this._fakeAudioDom.muted=!0,this._fakeAudioDom.srcObject=new MediaStream([t.originTrack]),a.addTrack(t.preprocessingTrack)):a.addTrack(t.preprocessingTrack),mB&&vB&&(this._audioDom.volume=0),o.srcObject=a,null===(n=o)||void 0===n||n.addEventListener("canplay",this._internalPlay),null===(i=o)||void 0===i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return s._internalPlay()})),this.played=!0;case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_autoPlayError",value:function(e){var t,r;this._emitPlayFailed||(this._emitPlayFailed=!0,this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0}))}},{key:"pause",value:function(){if(!this._audioDom)throw new rN(_P.INVALID_PARAMS,"Player not found");this._pasued=!0,this._audioDom.pause()}},{key:"manuallyPause",value:function(){return this.pause()}},{key:"manuallyPlay",value:function(){var e,t=this;if(this.logger.info("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new rN(_P.INVALID_PARAMS,"Player not found");if(!this.played)return qS.resolve();this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var r=[],n=this._audioDom.play();null!=n&&n.then&&r.push(n);var i=mK.getAudioContextInstance();if("suspended"===i.state){var o=i.resume();null!=o&&o.then&&r.push(o)}(r.length>0?qS.all(r):qS.resolve(n)).then((function(){t._pasued=!1}))}},{key:"setPlaybackDevice",value:(e=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,PK.enumerateAudioPlaybackDevices();case 3:if(r=e.sent,n=ob(r).call(r,(function(e){return e.deviceId})),vE(n).call(n,t)&&this._audioDom&&this._audioDom.setSinkId){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this._audioDom.setSinkId(t);case 9:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"stop",value:function(){var e=this._containerDom;this.logger.info("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,null!=e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0),this.played=!1}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){this.logger.info("destroy","audio player: ".concat(this.userId)),this.stop(),Bx(Fx(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom),this._edgeTimer&&clearTimeout(this._edgeTimer)}}]),n}(),w2=function(){var e=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Audio(YW.createObjectURL(new Blob([t],r))),e.prev=1,n.muted=!0,e.next=5,n.play();case 5:return n.pause(),e.abrupt("return",!0);case 9:return e.prev=9,e.t0=e.catch(1),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,r){return e.apply(this,arguments)}}(),A2=LR,x2=ww,O2=function(e,t,r,n){for(var i,o=x2(t,r),a=e.length-1;a>=0;a--)(i=e[a])&&(o=i(t,r,o)||o);return o&&A2(t,r,o),o},P2=function(){function e(t,r){of(this,e),af(this,"_sharedAudioContext",new AudioContext),af(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),af(this,"_localGainNode",this._sharedAudioContext.createGain()),af(this,"_bufferGainNode",this._sharedAudioContext.createGain()),af(this,"_audioBufferSource",void 0),af(this,"_localSource",void 0),af(this,"_context",void 0),af(this,"_failedAudioList",[]),af(this,"_startingIds",new DR),af(this,"_revokeURLs",new i1),af(this,"mixingMap",new DR),af(this,"resourcesCache",new DR),af(this,"volumeConfig",new DR),af(this,"cachedBuffer",[]),af(this,"id","AudioMixingManager"),this.engineId=r,this._context=t,this._localGainNode.gain.value=1}var t,r,n;return nf(e,[{key:"mixMediaStream",value:function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)}},{key:"startAudioMixing",value:(n=HS(BS().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f,v,_,m=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===this._startingIds.get(t)){e.next=3;break}return console.warn("AudioMixing task id: ".concat(t," is starting")),e.abrupt("return");case 3:if(this._startingIds.set(t,t),i=n.playCount,nj(o=n.type,"mixingType",sQ(P1)),a=this._context.getLocalAudioTrack()){e.next=9;break}return e.abrupt("return");case 9:if((s=a.preprocessingTrack)&&this.mixMediaStream(new MediaStream([s])),a.once("needReplaceTrack",(function(){m.mixMediaStream(new MediaStream([a.preprocessingTrack]))})),null!=(c=this.mixingMap.get(t))&&c.audioNode){c.audioNode.pause(),this._context.emitMessage({mixId:t,state:N1.AUDIO_MIXING_STATE_STOPPED,error:mP.AUDIO_MIXING_ERROR_OK});try{c.gainNode.disconnect(this._audioDestination),c.audioSource.disconnect(c.gainNode)}catch(e){}}if(!(d=this.resourcesCache.get(t))||d.filePath!==r){e.next=19;break}u=d.getAudioNode(),e.next=32;break;case 19:return e.next=21,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw m._context.emitMessage({mixId:t,state:N1.AUDIO_MIXING_STATE_FAILED,error:mP.AUDIO_MIXING_ERROR_START_FAILED}),new rN(_P.LOAD_RESOURCES_FAILED,e.statusText)}));case 21:return l=e.sent,pC(r).call(r,"mp3")?h={type:"audio/mpeg"}:pC(r).call(r,"aac")&&(h={type:"audio/aac"}),e.next=25,w2(l,h);case 25:if(e.sent){e.next=29;break}throw this._context.emitMessage({mixId:t,state:N1.AUDIO_MIXING_STATE_FAILED,error:mP.AUDIO_MIXING_ERROR_START_FAILED}),new rN(_P.LOAD_RESOURCES_FAILED,"invalid audio resource");case 29:(u=new Audio).crossOrigin="anonymous",u.src=YW.createObjectURL(new Blob([l],h));case 32:return i<=0?u.loop=!0:i>0&&(p=i,u.onended=function(){--p>0?u.play():(m.mixingMap.delete(t),m._context.emitMessage({mixId:t,state:N1.AUDIO_MIXING_STATE_FINISHED,error:mP.AUDIO_MIXING_ERROR_OK}))}),e.prev=33,e.next=36,u.play();case 36:e.next=43;break;case 38:e.prev=38,e.t0=e.catch(33),console.error(e.t0),this._failedAudioList.push(u),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:CP.STREAM_INDEX_MAIN,mediaType:wP.AUDIO});case 43:if(this._startingIds.delete(t),f=this._sharedAudioContext.createMediaElementSource(u),v=this._sharedAudioContext.createGain(),_=this.volumeConfig.get(t),v.gain.value=_?_/100:1,f.connect(v).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:f,audioNode:u,gainNode:v,type:"file"}),o===P1.PUBLISH)try{v.disconnect(this._sharedAudioContext.destination)}catch(e){}else v.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:N1.AUDIO_MIXING_STATE_PLAYING,error:mP.AUDIO_MIXING_ERROR_OK});case 53:case"end":return e.stop()}}),e,this,[[33,38]])}))),function(e,t,r){return n.apply(this,arguments)})},{key:"stopAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:N1.AUDIO_MIXING_STATE_STOPPED,error:mP.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:N1.AUDIO_MIXING_STATE_PAUSED,error:mP.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())}},{key:"resumeAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:N1.AUDIO_MIXING_STATE_PLAYING,error:mP.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=HS(BS().mark((function e(t,r){var n,i,o=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.stopAudioMixing(t),e.next=3,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw new rN(_P.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){if(o._context.emitMessage({mixId:t,state:N1.AUDIO_MIXING_STATE_FAILED,error:mP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),e instanceof rN)throw e;throw new rN(_P.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,pC(r).call(r,"mp3")?i={type:"audio/mpeg"}:pC(r).call(r,"aac")&&(i={type:"audio/aac"}),e.next=7,w2(n,i);case 7:if(e.sent){e.next=11;break}throw this._context.emitMessage({mixId:t,state:N1.AUDIO_MIXING_STATE_FAILED,error:mP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new rN(_P.LOAD_RESOURCES_FAILED,"Load resources failed");case 11:return this._context.emitMessage({mixId:t,state:N1.AUDIO_MIXING_STATE_PRELOADED,error:mP.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){var e=YW.createObjectURL(new Blob([n],i));return o._revokeURLs.add(e),new Audio(e)},filePath:r,duration:0}),e.next=15,new qS((function(e){var r=YW.createObjectURL(new Blob([n],i)),a=new Audio(r);a.addEventListener("durationchange",(function(){var n=o.resourcesCache.get(t);n&&(n.duration=a.duration,o.resourcesCache.set(t,n)),YW.revokeObjectURL(r),e(null)}))}));case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"unloadAudioMixing",value:function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)}},{key:"getAudioMixingVolume",value:function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0}},{key:"setAudioMixingVolume",value:function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)}},{key:"getAudioMixingDuration",value:function(e){var t=this.mixingMap.get(e),r=this.resourcesCache.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.duration:0:0}},{key:"getAudioMixingCurrentPosition",value:function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0}},{key:"setAudioMixingPosition",value:function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())}},{key:"enableAudioMixingBuffer",value:function(e){nj(e,"type",sQ(P1));var t=this._context.getLocalAudioTrack();if(t){var r=t.preprocessingTrack;if(r&&this.mixMediaStream(new MediaStream([r])),e===P1.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:N1.AUDIO_MIXING_STATE_PCM_ENABLED,error:mP.AUDIO_MIXING_ERROR_OK})}}},{key:"disableAudioMixingBuffer",value:function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.onended=null,this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:N1.AUDIO_MIXING_STATE_PCM_DISABLED,error:mP.AUDIO_MIXING_ERROR_OK})}}},{key:"pushAudioMixingBuffer",value:function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(e){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}}}}},{key:"stopAll",value:function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))}},{key:"mixTrack",get:function(){return this._audioDestination.stream.getAudioTracks()[0]}},{key:"sharedAudioContext",get:function(){return this._sharedAudioContext}},{key:"resumeLocalPlay",value:(t=HS(BS().mark((function e(){var t,r,n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=Ab(this._failedAudioList),e.prev=2,r.s();case 4:if((n=r.n()).done){e.next=24;break}if(i=n.value,e.prev=6,!(i instanceof HTMLAudioElement)){e.next=13;break}return i.muted=!1,e.next=11,i.play();case 11:e.next=14;break;case 13:i.start();case 14:e.next=22;break;case 16:return e.prev=16,e.t0=e.catch(6),t.push(i),console.error(e.t0),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:CP.STREAM_INDEX_MAIN,mediaType:wP.AUDIO}),e.abrupt("break",24);case 22:e.next=4;break;case 24:e.next=29;break;case 26:e.prev=26,e.t1=e.catch(2),r.e(e.t1);case 29:return e.prev=29,r.f(),e.finish(29);case 32:this._failedAudioList=t;case 33:case"end":return e.stop()}}),e,this,[[2,26,29,32],[6,16]])}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear(),this._startingIds=new DR,this._revokeURLs.forEach((function(e){YW.revokeObjectURL(e)}))}}]),e}();O2([KV("id","filePath","options")],P2.prototype,"startAudioMixing"),O2([KV("id")],P2.prototype,"stopAudioMixing"),O2([KV("id")],P2.prototype,"pauseAudioMixing"),O2([KV("id")],P2.prototype,"resumeAudioMixing"),O2([KV("id")],P2.prototype,"preloadAudioMixing"),O2([KV("id")],P2.prototype,"unloadAudioMixing"),O2([KV("id")],P2.prototype,"getAudioMixingVolume"),O2([KV("id","volume")],P2.prototype,"setAudioMixingVolume"),O2([KV("id")],P2.prototype,"getAudioMixingDuration"),O2([KV("id")],P2.prototype,"getAudioMixingCurrentPosition"),O2([KV("id","position")],P2.prototype,"setAudioMixingPosition"),O2([KV("type")],P2.prototype,"enableAudioMixingBuffer"),O2([KV()],P2.prototype,"disableAudioMixingBuffer"),O2([KV("buffer")],P2.prototype,"pushAudioMixingBuffer");var N2=function(){Hx(s,Ej.EventEmitter);var e,t,r,n,i,o,a=oO(s);function s(e){var t;return of(this,s),af(dx(t=a.call(this)),"_loginSessionId",null),af(dx(t),"_userId",null),af(dx(t),"_token",null),af(dx(t),"_loginResolveCallback",void 0),af(dx(t),"_loginRejectCallback",void 0),af(dx(t),"_waitLoginToken",!1),af(dx(t),"_serverParamsCache",void 0),af(dx(t),"id",void 0),af(dx(t),"logger",void 0),af(dx(t),"_clearListeners",void 0),t._ctx=e,t.id=e.id,t.logger=new dF("RTSClient",1,e.id),t}return nf(s,[{key:"login",value:function(e,t){var r=this;return new qS((function(n,i){var o;if(r.logger.info("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new rN(_P.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new rN(_P.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,null===(o=GV(r.id))||void 0===o||o.set({rtm_user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._ctx.signalingManager.connect().then((function(){r._addSignalEventHandler(),r._login()}))}))}},{key:"logout",value:(o=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new rN(_P.NOT_LOGIN,"login first");case 2:return e.next=4,this._ctx.signalingManager.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._ctx.appId},{functionType:b1.C2RTM}).catch((function(){}));case 4:this._clearState();case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"updateLoginToken",value:(i=HS(BS().mark((function e(t){var r=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._token=t,e.abrupt("return",new qS((function(e,t){r._waitLoginToken?(r._loginResolveCallback=e,r._loginRejectCallback=t,r._login()):e()})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(n=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new rN(_P.NOT_LOGIN,"login first");case 2:return e.next=4,this._ctx.signalingManager.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._ctx.appId,peerUserId:t},{functionType:b1.C2RTM});case 4:return r=e.sent,e.abrupt("return",null==r?void 0:r.status);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(r=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new rN(_P.NOT_LOGIN,"login first");case 2:return e.abrupt("return",this._ctx.signalingManager.sendP2PMessage({from:this._userId,app:this._ctx.appId,to:t,room:"",msg:r}));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setServerParams",value:(t=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,rj(t,"signature"),rj(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new rN(_P.NOT_LOGIN,"login first");case 5:return e.next=7,this._ctx.signalingManager.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._ctx.appId,signature:t,url:r},{functionType:b1.C2RTM}).catch((function(e){throw new rN(_P.UNEXPECTED_ERROR,e.msg)}));case 7:MV.setServerUrl(this.id,r),this._serverParamsCache={signature:t,url:r},this.emit("onServerParamsSetResult"),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),this.emit("onServerParamsSetResult",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[0,12]])}))),function(e,r){return t.apply(this,arguments)})},{key:"sendServerMessage",value:(e=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new rN(_P.NOT_LOGIN,"login first");case 2:return e.abrupt("return",this._ctx.signalingManager.sendP2PMessage({from:this._userId,app:this._ctx.appId,to:"",room:"",type:_1.BUSINESS_SERVER,msg:t}));case 3:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"destroy",value:function(){this.logger.info("destroy","invoke."),Bx(Fx(s.prototype),"removeAllListeners",this).call(this),this._loginResolveCallback&&this._loginRejectCallback&&(this._loginRejectCallback(new rN(_P.LOGIN_FAILED,"logout")),delete this._loginResolveCallback,delete this._loginRejectCallback),this._clearState(),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=EF();this._ctx.signalingManager.sendSignaling("login",{Token:IF.token2auth(this._ctx.appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:WB.VERSION,deviceId:VB.getDeviceId(),appId:this._ctx.appId,userId:this._userId}},{functionType:b1.C2RTM}).then((function(){"function"==typeof e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,MV.setRtsSessionId(e.id,t),e._waitLoginToken=!1,e._serverParamsCache&&e.setServerParams(e._serverParamsCache.signature,e._serverParamsCache.url)})).catch((function(t){var r,n,i=t||{},o=i.code,a=i.message;e._waitLoginToken=!1,o>=700&&o<800?708===o?(r=_P.INVALID_PARAMS,n="Invalid userId"):(r=_P.INVALID_TOKEN,n="Invalid token",e._waitLoginToken=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=_P.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new rN(r,a||n))})).finally((function(){delete e._loginResolveCallback,delete e._loginRejectCallback}))}}},{key:"_addSignalEventHandler",value:function(){var e=this,t=function(t){t.state===xP.CONNECTION_STATE_RECONNECTED&&e._login()},r=function(){return e._clearState()},n=function(t){e.emit("onUserMessageReceivedOutsideRoom",{userId:t.from,message:t.msg})},i=function(t){e.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:t.from,message:t.msg})},o=function(t){t.clientId!==e._userId||t.roomId||(e.emit("onUserDisconnection"),e._clearState())};this._ctx.signalingManager.on(Oj.ON_CONNECTION_STATE_CHANGE,t),this._ctx.signalingManager.on(Oj.ON_RECONNECT_FAILED,r),this._ctx.signalingManager.on(Aj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,n),this._ctx.signalingManager.on(Aj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,i),this._ctx.signalingManager.on(Aj.USER_DISCONNECTION,o),this._clearListeners=function(){e._ctx.signalingManager.off(Oj.ON_CONNECTION_STATE_CHANGE,t),e._ctx.signalingManager.off(Oj.ON_RECONNECT_FAILED,r),e._ctx.signalingManager.off(Aj.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,n),e._ctx.signalingManager.off(Aj.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,i),e._ctx.signalingManager.off(Aj.USER_DISCONNECTION,o)}}},{key:"_clearState",value:function(){var e;null===(e=this._clearListeners)||void 0===e||e.call(this),this._userId=null,this._token=null,this._loginSessionId=null,MV.setRtsSessionId(this.id,"")}}]),s}(),M2=LR,D2=ww,L2=function(e,t,r,n){for(var i,o=D2(t,r),a=e.length-1;a>=0;a--)(i=e[a])&&(o=i(t,r,o)||o);return o&&M2(t,r,o),o},U2=function(){Hx(o,Ij);var e,t,r,n,i=oO(o);function o(e){var t;return of(this,o),af(dx(t=i.call(this)),"_remoteStreams",new DR),af(dx(t),"_logger",void 0),af(dx(t),"_monitor",void 0),af(dx(t),"_ontrackCallbackMap",new DR),t._ctx=e,t._monitor=GV(e.id),t._logger=new dF("PublicStreamManager",1,e.id),t}return nf(o,[{key:"getRemoteStream",value:function(e){return this._remoteStreams.get(e)}},{key:"getRemoteStreams",value:function(){return this._remoteStreams}},{key:"startPlayPublicStream",value:(n=HS(BS().mark((function e(t){var r,n=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.getRemoteStream(t)){e.next=2;break}throw new rN(_P.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new oX(this._ctx,t,t,!1,!0,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var t=UF(e),i=0;i<t.seiCount;i++)n.safeEmit("onSEIMessageReceived",{sei:t.seis[i],publicStreamId:r.streamId})})),e.next=6,this._ctx.signalingManager.connect();case 6:return e.next=8,this._subscribePublicStream(r);case 8:return this._remoteStreams.set(t,r),e.abrupt("return",r);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(r=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getRemoteStream(t)){e.next=3;break}return e.abrupt("return");case 3:return this._remoteStreams.delete(t),e.next=6,this._ctx.signalingManager.connect();case 6:return e.abrupt("return",this._unsubscribePublicStream(r));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this._remoteStreams.forEach((function(e){e.clean()})),this._remoteStreams=new DR,this.removeAllListeners(),this._ontrackCallbackMap.clear()}},{key:"_subscribePublicStream",value:(t=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this._ctx.handler)||void 0===r?void 0:r.subscribe(t,{multiChatMode:!1});case 2:if(a=e.sent){e.next=5;break}throw new rN(_P.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return s=kF(),c=a.audioMid,u=a.videoMid,e.t0=this._ctx.appId,e.t1=t.streamId,e.t2=c,e.t3=u,e.t4={sdp:a.partialSdp,semantics:a.semantics,type:a.type},e.next=15,Gj();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=WB.VERSION,e.t8=VB.getDeviceId(),e.t9=this._ctx.appId,e.t10=this._ctx.businessId,e.t11=this._ctx.useCloudProxy,e.t12={supportedCodecs:e.t5,deviceType:"web",userAgent:e.t6,sdkVersion:e.t7,deviceId:e.t8,appId:e.t9,businessId:e.t10,enableCloudProxy:e.t11},e.t13={enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},d={appId:e.t0,streamId:e.t1,audio:!0,video:!0,data:!0,audioMid:e.t2,videoMid:e.t3,sdpInfo:e.t4,params:e.t12,config:e.t13},e.next=27,this._ctx.signalingManager.sendSignaling("startPullStream",d);case 27:return l=e.sent,(h=[]).push(new qS((function(e,r){var n=setTimeout((function(){return r(new rN(_P.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),lQ);t.on("ontrack",(function r(i){"video"===i.mediaType&&(m._logger.success("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),h.push(new qS((function(e,r){var n=setTimeout((function(){return r(new rN(_P.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),lQ);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(m._logger.success("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p=function(e){t.ontrack(e)},null===(n=this._ctx.handler)||void 0===n||n.on("ontrack",p),this._ontrackCallbackMap.set(t,p),f=l.relayMessage,v=f.sequenceId,_=f.sdp,t.videoMid=u,t.audioMid=c,t.sequenceId=v,t.streamState=nX.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=43,null===(i=this._ctx.handler)||void 0===i?void 0:i.handleAck({action:U1.subscribe,streamId:t.streamId,audioMid:c,videoMid:u,audioTransceiverInit:a.audioTransceiverInit,videoTransceiverInit:a.videoTransceiverInit,signalingAck:{sdp:_,sequenceId:v},stream:t});case 43:return e.next=45,qS.all(h);case 45:null===(o=this._monitor)||void 0===o||o.report("rtc_subscribe_stat",{result:"success",start:s,message:"unknown",stream_user_id:t.userId}),t.startReport((function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,m.safeEmit("onRemoteStreamStats",e)}),this._ctx.handler);case 47:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_unsubscribePublicStream",value:(e=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return hQ("_unsubscribePublicStream()",t,this._logger),n={appId:this._ctx.appId,streamId:t.streamId},e.prev=2,e.next=5,this._ctx.signalingManager.sendSignaling("stopPullStream",n);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:return t.streamState=nX.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._ctx.handler)||void 0===r?void 0:r.handleAck({action:U1.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 14:t.clean(),t.subMediaType=uH.NONE,this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 18:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(t){return e.apply(this,arguments)})},{key:"removeOnTrackListener",value:function(e){var t=this._ontrackCallbackMap.get(e);if(t){var r=e.vendorHandler||this._ctx.handler;null==r||r.off("ontrack",t),this._ontrackCallbackMap.delete(e)}}},{key:"handleReconnected",value:function(){var e,t=this,r=Ab(this._remoteStreams);try{for(r.s();!(e=r.n()).done;){var n=xb(e.value,2),i=n[0],o=n[1];o.clean(),o.statsReport.unsubscribe(),this._remoteStreams.delete(i),this.startPlayPublicStream(i).then((function(e){t.safeEmit("onResubscribe",{stream:e})}))}}catch(e){r.e(e)}finally{r.f()}}}]),o}();L2([$1],U2.prototype,"_subscribePublicStream"),L2([$1],U2.prototype,"_unsubscribePublicStream");var V2=new dF("AudioDeviceManager",1),F2=function(){Hx(s,Ej.EventEmitter);var e,t,r,n,i,o,a=oO(s);function s(e,t){var r;return of(this,s),af(dx(r=a.call(this)),"_audioLevelFetcher",void 0),af(dx(r),"_playbackDeviceTestTimer",void 0),af(dx(r),"_audioElement",void 0),af(dx(r),"_audioTrack",void 0),af(dx(r),"_mediaRecorder",void 0),af(dx(r),"_recoderTimer",void 0),af(dx(r),"_isAudioPlaybackDeviceTesting",!1),af(dx(r),"_isAudioDeviceRecordTesting",!1),af(dx(r),"_audioCaptureAndRecoderResolve",void 0),af(dx(r),"_onAutoplayFailed",void 0),af(dx(r),"_audioPlaybackDeviceId",void 0),r._ctx=e,r._extensionManager=t,r}return nf(s,[{key:"audioTrack",get:function(){return this._audioTrack}},{key:"startAudioPlaybackDeviceTest",value:(o=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new rN(_P.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,V2.info("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(4),V2.error("startAudioPlaybackDeviceTest()","error",e.t0),this.stopAudioPlaybackDeviceTest(),e.t0;case 14:this._startEmitAudioPlaybackDeviceTestVolume(r);case 15:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return o.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(V2.info("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(i=HS(BS().mark((function e(t,r,n){var i,o=this,a=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=a.length>3&&void 0!==a[3]?a[3]:3e4,window.MediaRecorder){e.next=3;break}throw new rN(_P.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");case 3:if(!this._isAudioDeviceRecordTesting&&!this._isAudioPlaybackDeviceTesting){e.next=5;break}throw new rN(_P.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 5:return this._isAudioDeviceRecordTesting=!0,V2.info("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){V2.info("startAudioDeviceRecordTest()","".concat(i,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),o._stopAudioCaptureAndRecoder()}),i),e.prev=8,this._onAutoplayFailed=r,e.next=12,this._startAudioCaptureAndRecoder(t,null!=n?n:100);case 12:e.next=19;break;case 14:throw e.prev=14,e.t0=e.catch(8),this._isAudioDeviceRecordTesting=!1,delete this._onAutoplayFailed,e.t0;case 19:delete this._audioCaptureAndRecoderResolve;case 20:case"end":return e.stop()}}),e,this,[[8,14]])}))),function(e,t,r){return i.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){V2.info("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(V2.info("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this._mediaRecorder&&(this._mediaRecorder.ondataavailable=null),this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement()),delete this._onAutoplayFailed}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"setSinkId",value:(n=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(V2.info("setSinkId()","Invoke"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=3;break}throw new rN(_P.NOT_SUPPORTED,"setSinkId not supported by current browser");case 3:return e.next=5,PK.getAudioPlaybackDeviceById(t);case 5:if(r=e.sent){e.next=8;break}throw new rN(_P.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 8:return this._audioPlaybackDeviceId=t,this._setAudioCtxSinkId(),e.abrupt("return",r);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"getSinkId",value:function(){return this._audioPlaybackDeviceId}},{key:"destroy",value:function(){V2.info("destroy()","Invoke"),Bx(Fx(s.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:(r=HS(BS().mark((function e(t,r){var n,i=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V2.info("_playAudioFile()",JS(n="Invoke url=".concat(t,"; loop=")).call(n,r.loop)),e.abrupt("return",new qS((function(e,n){var o=E2("audio",{attributes:{src:t,crossOrigin:"anonymous"}});i._audioElement=o,o.loop=r.loop,i._audioLevelFetcher=new _K(o),o.onplaying=function(){o.onplaying=null,V2.info("_playAudioFile()","onplaying"),e()},o.onerror=function(){var e=HS(BS().mark((function e(t){var r,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:V2.error("_playAudioFile()","onerror",t),i=t.message||(null==o||null===(r=o.error)||void 0===r?void 0:r.message),n(new rN(_P.LOAD_RESOURCES_FAILED,"Failed to play recorded audio".concat(i?", reason: ".concat(i):".")));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i._setAudioCtxSinkId().then((function(){var e,t;return null===(e=o.play())||void 0===e||null===(t=e.catch)||void 0===t?void 0:t.call(e,(function(e){var t;V2.warn("_playAudioFile()","autoplay error",e);var r=JS(t="Failed to play recorded audio, ".concat(e.name,": ")).call(t,e.message);"NotAllowedError"===e.name&&i._onAutoplayFailed?i._onAutoplayFailed((function(){var e;return qS.all([null===(e=i._audioLevelFetcher)||void 0===e?void 0:e.resume(),o.play()])})):n(new rN(_P.LOAD_RESOURCES_FAILED,r))}))}))})));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return r.apply(this,arguments)})},{key:"_destroyAudioElement",value:function(){this._audioElement&&(V2.info("_destroyAudioElement()","Invoke"),this._audioElement.onplaying=null,this._audioElement.onerror=null,this._audioElement.src="",delete this._audioElement,"function"==typeof this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())}},{key:"_startEmitAudioPlaybackDeviceTestVolume",value:function(e){var t=this;e=Math.max(e,100),this._audioElement&&(V2.info("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(V2.info("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher}},{key:"_startAudioCaptureAndRecoder",value:(t=HS(BS().mark((function e(t,r){var n,i=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,BK(this._ctx.audioProfileManager.getConstraints(),this._extensionManager);case 2:return this._audioTrack=e.sent,this._audioTrack.setVolume(r+.01),n=new MediaStream([this._audioTrack.preprocessingTrack]),V2.info("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new qS((function(e,r){var o,a;"function"==typeof MediaRecorder.isTypeSupported&&(o=DC(a=["audio/webm","audio/mp4"]).call(a,(function(e){return MediaRecorder.isTypeSupported(e)})),V2.info("startAudioDeviceRecordTest()","use mimeType: ".concat(o))),i._mediaRecorder=new MediaRecorder(n,o?{mimeType:o}:void 0);var s=i._mediaRecorder.mimeType;i._mediaRecorder.ondataavailable=function(){var n=HS(BS().mark((function n(o){var a,c;return BS().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!i._isAudioDeviceRecordTesting){n.next=16;break}return V2.info("startAudioDeviceRecordTest()","get recorded file(mimeType: ".concat(s,").")),c=new Blob([o.data],{type:s}),n.prev=3,n.next=6,i._playAudioFile(YW.createObjectURL(c),{loop:!1});case 6:n.next=11;break;case 8:return n.prev=8,n.t0=n.catch(3),n.abrupt("return",r(n.t0));case 11:i._startEmitAudioPlaybackDeviceTestVolume(t),null===(a=i._audioElement)||void 0===a||a.addEventListener("ended",(function(){i.stopAudioDevicePlayTest(),e()})),i._audioCaptureAndRecoderResolve=e,n.next=17;break;case 16:e();case 17:case"end":return n.stop()}}),n,null,[[3,8]])})));return function(e){return n.apply(this,arguments)}}(),i._mediaRecorder.onerror=function(e){r(new rN(_P.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},i._audioCaptureAndRecoderResolve=e,i._mediaRecorder.start()})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"_stopAudioCaptureAndRecoder",value:function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.destroy(),delete this._audioTrack}},{key:"_setAudioCtxSinkId",value:(e=HS(BS().mark((function e(){var t,r,n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._audioPlaybackDeviceId){"default"===t&&(t="");try{null===(r=mK.getAudioContextInstance())||void 0===r||null===(n=r.setSinkId)||void 0===n||n.call(r,t),V2.info("setSinkId","ctx.sinkId=".concat(t))}catch(e){V2.error("setSinkId",JS(i="failed, ".concat(e.name," - ")).call(i,e.message))}}case 2:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})}]),s}(),B2=function(){return{url:"",video:{codec:XP.H264,width:640,height:360,fps:15,gop:2,kBitRate:j2(640,360,15)},audio:{codec:"AAC",kBitRate:64,sampleRate:48e3,channels:2,AACProfile:KP.LC},layout:{regions:[],appData:"",backgroundColor:"#000000"}}};function j2(e,t,r){return e*t<=288e3?r<=15?800:1200:e*t<=864e3?r<=15?1200:1800:e*t<=1152e3?r<=15?1600:2400:e*t<=2592e3?r<=15?2500:3750:r<=15?3300:5e3}function H2(e){if("string"!=typeof e||!/^rtmps?:\/\//.test(e))throw new rN(_P.INVALID_PARAMS,"Invalid rtmp address")}function z2(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)throw new rN(_P.INVALID_PARAMS,"regions should not be empty.");var t,r=Ab(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if("string"!=typeof n.userId)throw new rN(_P.INVALID_PARAMS,"region.userId(".concat(n.userId,") should be a string."));if(dj(n.userId),"boolean"!=typeof n.isScreenStream)throw new rN(_P.INVALID_PARAMS,"region.isScreenStream(".concat(n.isScreenStream,") should be a boolean."))}}catch(e){r.e(e)}finally{r.f()}}function G2(e,t){var r,n,i,o=function(e,r){var n=wE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),t),i=wE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),B2());return n&&r(n)?n:i},a=function(e){return e%2==0?e:e+1},s=a(o(["video","width"],(function(e){return e>=2&&e<=1920}))),c=a(o(["video","height"],(function(e){return e>=2&&e<=1920}))),u=o(["video","fps"],(function(e){return e>=1&&e<=60})),d=(null===(r=t.video)||void 0===r?void 0:r.kBitRate)||0,l=o(["audio","sampleRate"],(function(e){var t;return!!DC(t=[32e3,44100,48e3]).call(t,(function(t){return t===e||t/1e3===e}))}));return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:o(["audio","codec"],(function(e){return"AAC"===e})),bitRate:1e3*o(["audio","kBitRate"],(function(e){return e>=32&&e<=192})),sampleRate:l<100?1e3*l:l,channels:o(["audio","channels"],(function(e){var t;return vE(t=[1,2]).call(t,e)})),profile:o(["audio","AACProfile"],(function(e){var t;return vE(t=[KP.LC,KP.HEv1,KP.HEv2]).call(t,e)}))},video:{codec:o(["video","codec"],(function(e){var t;return vE(t=["H264","H265"]).call(t,e)})),fps:u,gop:o(["video","gop"],(function(e){return e>=1&&e<=5}))*u,bitRate:1e3*(d>=16&&d<=1e4?d:j2(s,c,u)),width:s,height:c},layout:{canvas:{bgnd:o(["layout","backgroundColor"],(function(e){return/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(e)}))},regions:(null===(n=t.layout)||void 0===n||null===(i=n.regions)||void 0===i?void 0:ob(i).call(i,(function(e){var t,r;return{alpha:!e.alpha||Number(e.alpha)>1||Number(e.alpha)<=0?1:Number(e.alpha),uid:e.userId,zorder:!e.zorder||Number(e.zorder)<0||Number(e.zorder)>100?0:Number(e.zorder),x:!e.x||Number(e.x)>=1||Number(e.x)<0?0:Number(e.x),y:!e.y||Number(e.y)>=1||Number(e.y)<0?0:Number(e.y),w:!e.w||Number(e.w)>1||Number(e.w)<=0?1:Number(e.w),h:!e.h||Number(e.h)>1||Number(e.h)<=0?1:Number(e.h),renderMode:e.renderMode&&vE(t=[1,2,3]).call(t,e.renderMode)?e.renderMode:1,contentControl:e.contentControl&&vE(r=[0,1,2]).call(r,e.contentControl)?e.contentControl:0,screen:!!e.isScreenStream}})))||[],app_data:o(["layout","appData"],(function(e){return"string"==typeof e}))}}}}var W2,K2={getDefaultValue:B2,checkStartParams:function(e){var t;H2(e.url),z2(null===(t=e.layout)||void 0===t?void 0:t.regions)},checkUpdateParams:function(e){var t;e.url&&H2(e.url),z2(null===(t=e.layout)||void 0===t?void 0:t.regions)},getStartParams:function(e){return G2("started",e)},getUpdateParams:function(e){return G2("layoutChanged",e)}},X2=Zv,J2=ka;Zo({target:"Object",stat:!0},{fromEntries:function(e){var t={};return X2(e,(function(e,r){J2(t,e,r)}),{AS_ENTRIES:!0}),t}});var q2,Y2=Er(kn.Object.fromEntries),Q2=["ele","fakeEle"],Z2=["orgTrack","mediaTrack","preprocessingTrack"],$2=["orgTrack","mediaTrack","preprocessingTrack"],e3=["currentTime","duration","ended","error","muted","networkState","paused","readyState","seekable","sinkId","src","volume"],t3=["currentTime","sampleRate","state","baseLatency","outputLatency","sinkId"],r3=["contentHint","enabled","id","kind","label","muted","readyState"],n3=["currentDirection","direction","mid","stopped"];function i3(e){return o3.apply(this,arguments)}function o3(){return(o3=HS(BS().mark((function e(t){var r,n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Date.now(),n=[],!t._ctx.handler||!t._ctx.handler._peerConnection){e.next=6;break}return e.next=5,t._ctx.handler._peerConnection.getStats();case 5:n=e.sent;case 6:return i=[],n.forEach((function(e){i.push(e)})),e.abrupt("return",{timestamp:r,stats:i});case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function a3(e){var t={};if(e instanceof MediaStream){t.id=e.id,t.active=e.active;var r=e.getTracks();t.tracks=ob(r).call(r,(function(e){return Y2(ob(r3).call(r3,(function(t){return[t,e[t]]})))}))}return t}function s3(e){return c3.apply(this,arguments)}function c3(){return(c3=HS(BS().mark((function e(t){var r,n,i,o,a;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Date.now(),n=[],t._videoPlayer&&n.push({userId:"__local__",mediaType:"video",isScreen:!1,isPublic:!1,ele:t._videoPlayer._videoDom}),t._screenPlayer&&n.push({userId:"__local__",mediaType:"video",isScreen:!0,isPublic:!1,ele:t._screenPlayer._videoDom}),t._remoteVideoPlayer&&t._remoteVideoPlayer.forEach((function(e,t){n.push({userId:t,mediaType:"video",isScreen:!1,isPublic:!1,ele:e?e._videoDom:void 0})})),t._remoteScreenPlayer&&(null===(i=t._remoteScreenPlayer)||void 0===i||i.forEach((function(e,t){n.push({userId:t,mediaType:"video",isScreen:!0,isPublic:!1,ele:e?e._videoDom:void 0})}))),t._remoteAudioPlayer&&t._remoteAudioPlayer.forEach((function(e,t){n.push({userId:t,mediaType:"audio",isScreen:!1,isPublic:!1,ele:e?e._audioDom:void 0,fakeEle:e?e._fakeAudioDom:void 0})})),t._remoteScreenAudioPlayer&&t._remoteScreenAudioPlayer.forEach((function(e,t){n.push({userId:t,mediaType:"audio",isScreen:!0,isPublic:!1,ele:e?e._audioDom:void 0,fakeEle:e?e._fakeAudioDom:void 0})})),t._publicStreamVideoPlayer&&t._publicStreamVideoPlayer.forEach((function(e,t){n.push({userId:t,mediaType:"video",isScreen:!1,isPublic:!0,ele:e?e._videoDom:void 0})})),t._publicStreamAudioPlayer&&t._publicStreamAudioPlayer.forEach((function(e,t){n.push({userId:t,mediaType:"audio",isScreen:!1,isPublic:!0,ele:e?e._audioDom:void 0,fakeEle:e?e._fakeAudioDom:void 0})})),t._localVideoTrack&&t._localVideoTrack.videoPlayers&&t._localVideoTrack.videoPlayers.forEach((function(e,t){n.push({playerId:t.toString(),userId:"__local__",mediaType:"video",isScreen:!1,isPublic:!1,ele:e._videoDom})})),t._localScreenTrack&&t._localScreenTrack.videoPlayers&&t._localScreenTrack.videoPlayers.forEach((function(e,t){n.push({playerId:t.toString(),userId:"__local__",mediaType:"video",isScreen:!0,isPublic:!1,ele:e._videoDom})})),t._room&&t._room._remoteStreams&&t._room._remoteStreams.forEach((function(e,t){e.forEach((function(e){if(e.audioTrack){var r=e.audioTrack._audioPlayer;n.push({userId:t,mediaType:"audio",isScreen:e.isScreen,isPublic:!1,ele:r?r._audioDom:void 0,fakeEle:r?r._fakeAudioDom:void 0})}e.videoTrack&&e.videoTrack.videoPlayers&&e.videoTrack.videoPlayers.forEach((function(r,i){n.push({playerId:i.toString(),userId:t,mediaType:"video",isScreen:e.isScreen,isPublic:!1,ele:r?r._videoDom:void 0})}))}))})),(o=t._publicStreamManager)||(o=t._outsideRoom),o&&o.remoteStreams&&o.remoteStreams.forEach((function(e,t){if(e.audioTrack){var r=e.audioTrack._audioPlayer;n.push({userId:t,mediaType:"audio",isScreen:!1,isPublic:!0,ele:r?r._audioDom:void 0,fakeEle:r?r._fakeAudioDom:void 0})}e.videoTrack&&e.videoTrack.videoPlayers&&e.videoTrack.videoPlayers.forEach((function(e,r){n.push({playerId:r.toString(),userId:t,mediaType:"video",isScreen:!1,isPublic:!0,ele:e?e._videoDom:void 0})}))})),t&&t._room&&t._room._virtualStreams&&t._room._virtualStreams.forEach((function(e,t){if(e.audioTrack){var r=e.audioTrack._audioPlayer;n.push({userId:"virtualStream-".concat(t),mediaType:"audio",isScreen:!1,isPublic:!1,isVirtual:!0,ele:r?r._audioDom:void 0,fakeEle:r?r._fakeAudioDom:void 0})}})),a=ob(n).call(n,(function(e){var t=e.ele,r=e.fakeEle,n=gV(e,Q2),i=ux({ele:ux({srcObject:t?a3(t.srcObject):void 0},Y2(ob(e3).call(e3,(function(e){return[e,t[e]]}))))},n);return r&&(i.fakeEle=ux({srcObject:a3(r.srcObject)},Y2(ob(e3).call(e3,(function(e){return[e,r[e]]}))))),i})),e.abrupt("return",{timestamp:r,elementStats:a});case 19:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function u3(e){var t,r=[],n=[];e&&e._room&&e._room._remoteStreams&&(n=zN(t=e._room._remoteStreams).call(t));var i,o=Ab(n);try{for(o.s();!(i=o.n()).done;)i.value.forEach((function(e){e.audioTrack&&r.push(e.audioTrack)}))}catch(e){o.e(e)}finally{o.f()}e._localAudioTrack&&r.push(e._localAudioTrack),e._localScreenAudioTrack&&r.push(e._localScreenAudioTrack);for(var a=0,s=r;a<s.length;a++){var c,u,d=s[a];if(d._audioLevelFetcher&&d._audioLevelFetcher._ctx)return d._audioLevelFetcher._ctx;if(d._ac)return d._ac;if(d._audioFetchMap&&CN(zN(c=d._audioFetchMap).call(c)).length)return CN(zN(u=d._audioFetchMap).call(u))[0]._ctx;if(d._ap&&d._ap._ac)return d._ap._ac}return null}function d3(e){return l3.apply(this,arguments)}function l3(){return(l3=HS(BS().mark((function e(t){var r,n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=Date.now(),n=u3(t),i={},n){e.next=5;break}return e.abrupt("return",{timestamp:r,acState:void 0});case 5:return t3.forEach((function(e){i[e]=n[e]})),e.abrupt("return",{timestamp:r,acState:i});case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h3(e){var t=[];e._localAudioTrack&&t.push({userId:"__local__",mediaType:"audio",isScreen:!1,isPublic:!1,isVirtual:!1,orgTrack:e._localAudioTrack._originTrack,mediaTrack:e._localAudioTrack._mediaTrack,preprocessingTrack:e._localAudioTrack._preProcessingTrack}),e._localScreenAudioTrack&&t.push({userId:"__local__",mediaType:"audio",isScreen:!0,isPublic:!1,isVirtual:!1,orgTrack:e._localScreenAudioTrack._originTrack,mediaTrack:e._localScreenAudioTrack._mediaTrack,preprocessingTrack:e._localScreenAudioTrack._preProcessingTrack}),e._localVideoTrack&&t.push({userId:"__local__",mediaType:"video",isScreen:!1,isPublic:!1,isVirtual:!1,orgTrack:e._localVideoTrack._originTrack,mediaTrack:e._localVideoTrack._mediaTrack,preprocessingTrack:e._localVideoTrack._preProcessingTrack}),e._localScreenVideoTrack&&t.push({userId:"__local__",mediaType:"video",isScreen:!0,isPublic:!1,isVirtual:!1,orgTrack:e._localScreenVideoTrack._originTrack,mediaTrack:e._localScreenVideoTrack._mediaTrack,preprocessingTrack:e._localScreenVideoTrack._preProcessingTrack}),e._room&&e._room._remoteStreams&&e._room._remoteStreams.forEach((function(e,r){e.forEach((function(e){e.audioTrack&&t.push({userId:r,mediaType:"audio",isScreen:e.isScreen,isPublic:!1,isVirtual:!1,orgTrack:e.audioTrack._originTrack,mediaTrack:e.audioTrack._mediaTrack}),e.videoTrack&&t.push({userId:r,mediaType:"video",isScreen:e.isScreen,isPublic:!1,isVirtual:!1,orgTrack:e.videoTrack._originTrack,mediaTrack:e.videoTrack._mediaTrack})}))}));var r=e._publicStreamManager;return r||(r=e._outsideRoom),r&&r.remoteStreams&&r.remoteStreams.forEach((function(e,r){e.audioTrack&&t.push({userId:r,mediaType:"audio",isScreen:e.isScreen,isPublic:!0,isVirtual:!1,orgTrack:e.audioTrack._originTrack,mediaTrack:e.audioTrack._mediaTrack}),e.videoTrack&&t.push({userId:r,mediaType:"video",isScreen:e.isScreen,isPublic:!0,isVirtual:!1,orgTrack:e.videoTrack._originTrack,mediaTrack:e.videoTrack._mediaTrack})})),e&&e._room&&e._room._virtualStreams&&e._room._virtualStreams.forEach((function(e,r){e.audioTrack&&t.push({userId:"virtualStream-".concat(r),mediaType:"audio",isScreen:!1,isPublic:!1,isVirtual:!0,orgTrack:e.audioTrack._originTrack,mediaTrack:e.audioTrack._mediaTrack}),e.videoTrack&&t.push({userId:"virtualStream-".concat(r),mediaType:"video",isScreen:!1,isPublic:!1,isVirtual:!0,orgTrack:e.videoTrack._originTrack,mediaTrack:e.videoTrack._mediaTrack})})),t}function p3(e,t){return f3.apply(this,arguments)}function f3(){return f3=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=2048,i=50,o=128,a=256,s=2,t){e.next=7;break}return e.abrupt("return",void 0);case 7:return(c=new MediaStream).addTrack(t),u=r.createMediaStreamSource(c),d=r.createAnalyser(),u.connect(d),"suspended"===r.state&&(console.warn(r.state),r.resume()),l=new Uint8Array(n),d.getByteTimeDomainData(l),e.next=17,new qS((function(e){setTimeout(e,i)}));case 17:return d.getByteTimeDomainData(l),e.next=20,new qS((function(e){setTimeout(e,i)}));case 20:return h=0,l.forEach((function(e){return h=Math.max(h,Math.abs(e-o))})),f=(p=h/o*a)>s?p:0,u.disconnect(),d.disconnect(),e.abrupt("return",f);case 27:case"end":return e.stop()}}),e)}))),f3.apply(this,arguments)}function v3(e){return _3.apply(this,arguments)}function _3(){return _3=HS(BS().mark((function e(t){var r,n,i,o;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Date.now(),q2||(q2=new AudioContext),"suspended"!==q2.state){e.next=6;break}return e.next=6,new qS((function(e){var r=setTimeout((function(){console.warn("[RTC_AMBULANCE] AudioContext resume failed, try to find one in RTCEngine"),(q2=u3(t))&&console.warn("[RTC_AMBULANCE] find AudioContext in RTCEngine success"),e()}),1e3);q2.resume().then((function(){clearTimeout(r),e()}),(function(){clearTimeout(r),q2=null,e()}))}));case 6:if(q2){e.next=9;break}return console.error("[RTC_AMBULANCE] get volume is not supported"),e.abrupt("return");case 9:return i=h3(t),o=[],e.next=13,qS.all(ob(r=Wb(i).call(i,(function(e){return"audio"===e.mediaType}))).call(r,function(){var e=HS(BS().mark((function e(t){var r,n,i,a,s;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.orgTrack,n=t.mediaTrack,i=t.preprocessingTrack,a=gV(t,Z2),s=ux({},a),e.next=4,qS.all([p3(r,q2).then((function(e){s.orgTrackVolume=e})),p3(n,q2).then((function(e){s.mediaTrackVolume=e})),p3(i,q2).then((function(e){s.preprocessingTrackVolume=e}))]);case 4:o.push(s);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 13:return e.abrupt("return",{timestamp:n,trackVolumes:o});case 14:case"end":return e.stop()}}),e)}))),_3.apply(this,arguments)}function m3(e){return g3.apply(this,arguments)}function g3(){return(g3=HS(BS().mark((function e(t){var r,n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Date.now(),n=h3(t),i=ob(n).call(n,(function(e){var t=e.orgTrack,r=e.mediaTrack,n=e.preprocessingTrack,i=gV(e,$2);return ux({orgTrack:t?Y2(ob(r3).call(r3,(function(e){return[e,t[e]]}))):void 0,mediaTrack:r?Y2(ob(r3).call(r3,(function(e){return[e,r[e]]}))):void 0,preprocessingTrack:n?Y2(ob(r3).call(r3,(function(e){return[e,n[e]]}))):void 0},i)})),e.abrupt("return",{timestamp:r,trackStates:i});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function y3(e){if(e){var t={track:e.track?e.track.id:void 0,transport:{state:e.transport?e.transport.state:void 0}};return e.transport&&e.transport.iceTransport&&(t.iceTransport={state:e.transport.iceTransport.state,role:e.transport.iceTransport.role,gatheringState:e.transport.iceTransport.gatheringState,component:e.transport.iceTransport.component}),t}}function S3(e){return b3.apply(this,arguments)}function b3(){return(b3=HS(BS().mark((function e(t){var r,n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Date.now(),n=[],t._ctx._handler&&t._ctx._handler._peerConnection&&(n=t._ctx._handler._peerConnection.getTransceivers()),i=[],n.forEach((function(e){var t=ux({sender:y3(e.sender),receiver:y3(e.receiver)},Y2(ob(n3).call(n3,(function(t){return[t,e[t]]}))));i.push(t)})),e.abrupt("return",{timestamp:r,tranceiverStates:i});case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function E3(e){return k3.apply(this,arguments)}function k3(){return(k3=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={stats:[],mediaElementStates:[],audioContextStates:[],volumes:[],trackStates:[],tranceiverStates:[]},n=[],e.next=4,new qS((function(e){var i,o=0;i=setTimeout((function a(){n.push(i3(t).then((function(e){r.stats.push(e)})),s3(t).then((function(e){r.mediaElementStates.push(e)})),d3(t).then((function(e){r.audioContextStates.push(e)})),v3(t).then((function(e){r.volumes.push(e)})),m3(t).then((function(e){r.trackStates.push(e)})),S3(t).then((function(e){r.tranceiverStates.push(e)}))),++o>=10?qS.all(n).then((function(){e()})):(clearTimeout(i),i=setTimeout(a,500))}),500)}));case 4:return console.log("RTC_AMBULANCE",r),e.abrupt("return",r);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var T3=Ur,I3=PT,R3=pT.getWeakData,C3=A_,w3=Ro,A3=pn,x3=En,O3=Zv,P3=bi,N3=Eu.set,M3=Eu.getterFor,D3=xu.find,L3=xu.findIndex,U3=T3([].splice),V3=0,F3=function(e){return e.frozen||(e.frozen=new B3)},B3=function(){this.entries=[]},j3=function(e,t){return D3(e.entries,(function(e){return e[0]===t}))};B3.prototype={get:function(e){var t=j3(this,e);if(t)return t[1]},has:function(e){return!!j3(this,e)},set:function(e,t){var r=j3(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=L3(this.entries,(function(t){return t[0]===e}));return~t&&U3(this.entries,t,1),!!~t}};var H3={getConstructor:function(e,t,r,n){var i=e((function(e,i){C3(e,o),N3(e,{type:t,id:V3++,frozen:void 0}),A3(i)||O3(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=M3(t),s=function(e,t,r){var n=a(e),i=R3(w3(t),!0);return!0===i?F3(n).set(t,r):i[n.id]=r,e};return I3(o,{delete:function(e){var t=a(this);if(!x3(e))return!1;var r=R3(e);return!0===r?F3(t).delete(e):r&&P3(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!x3(e))return!1;var r=R3(e);return!0===r?F3(t).has(e):r&&P3(r,t.id)}}),I3(o,r?{get:function(e){var t=a(this);if(x3(e)){var r=R3(e);return!0===r?F3(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),i}};xT("WeakSet",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),H3);var z3=kn.WeakSet,G3=qn,W3=function(e){if("object"==typeof e&&"has"in e&&"add"in e&&"delete"in e)return e;throw TypeError(G3(e)+" is not a weakset")},K3=qT,X3={WeakSet:wn("WeakSet"),add:K3("add",1),has:K3("has",1),remove:K3("delete",1)},J3=W3,q3=X3.add;Zo({target:"WeakSet",proto:!0,real:!0,forced:!0},{addAll:function(){for(var e=J3(this),t=0,r=arguments.length;t<r;t++)q3(e,arguments[t]);return e}});var Y3=W3,Q3=X3.remove;Zo({target:"WeakSet",proto:!0,real:!0,forced:!0},{deleteAll:function(){for(var e,t=Y3(this),r=!0,n=0,i=arguments.length;n<i;n++)e=Q3(t,arguments[n]),r=r&&e;return!!r}}),Zo({target:"WeakSet",stat:!0,forced:!0},{from:_I}),Zo({target:"WeakSet",stat:!0,forced:!0},{of:gI});var Z3=Er(z3),$3=function(){function e(){of(this,e),af(this,"containers",new Z3)}return nf(e,[{key:"getContainerById",value:function(e){return document.getElementById(e)}},{key:"registerContainer",value:function(e){var t;return"string"==typeof e&&(e=null!==(t=this.getContainerById(e))&&void 0!==t?t:void 0),!(!e||this.containers.has(e)||(this.containers.add(e),0))}},{key:"unregisterContainer",value:function(e){var t;return"string"==typeof e&&(e=null!==(t=this.getContainerById(e))&&void 0!==t?t:void 0),!!e&&(this.containers.delete(e),!0)}}]),e}(),e4=LR,t4=ww,r4=function(e,t,r,n){for(var i,o=t4(t,r),a=e.length-1;a>=0;a--)(i=e[a])&&(o=i(t,r,o)||o);return o&&e4(t,r,o),o},n4=function(){Hx(De,Ij);var e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R,C,w,A,x,O,P,N,M,D,L,U,V,F,B,j,H,z,G,W,K,X,J,q,Y,Q,Z,$,ee,te,re,ne,ie,oe,ae,se,ce,ue,de,le,he,pe,fe,ve,_e,me,ge,ye,Se,be,Ee,ke,Te,Ie,Re,Ce,we,Ae,xe,Oe,Pe,Ne,Me=oO(De);function De(e,t,r){var n,i,o;return of(this,De),af(dx(o=Me.call(this)),"monitor",void 0),af(dx(o),"logger",void 0),af(dx(o),"_room",void 0),af(dx(o),"_publicStreamManager",void 0),af(dx(o),"_appId",void 0),af(dx(o),"_localVideoTrack",void 0),af(dx(o),"_localAudioTrack",void 0),af(dx(o),"_localImgVideoTrack",void 0),af(dx(o),"_localImgScreenTrack",void 0),af(dx(o),"_localScreenVideoTrack",void 0),af(dx(o),"_localScreenAudioTrack",void 0),af(dx(o),"_tempMixingAudioTrack",void 0),af(dx(o),"_localAudioVolume",100),af(dx(o),"_localScreenAudioVolume",100),af(dx(o),"_remoteAudioVolume",new DR),af(dx(o),"_remoteScreenAudioVolume",new DR),af(dx(o),"_publicAudioVolume",new DR),af(dx(o),"_localVideoPlayerConfig",(af(n={},CP.STREAM_INDEX_MAIN,new DR),af(n,CP.STREAM_INDEX_SCREEN,new DR),n)),af(dx(o),"_remoteVideoPlayerConfig",(af(i={},CP.STREAM_INDEX_MAIN,new DR),af(i,CP.STREAM_INDEX_SCREEN,new DR),i)),af(dx(o),"_publicVideoPlayerConfig",new DR),af(dx(o),"_publicStreamIds",new DR),af(dx(o),"_videoStreamConstraints",ux({},QB)),af(dx(o),"_audioStreamConstraints",{}),af(dx(o),"_enableSimulcast",!1),af(dx(o),"_videoStreamEncodeConfig",[ux({},QB)]),af(dx(o),"_screenStreamEncodeConfig",[ux({},ZB)]),af(dx(o),"_dummyMainImage",void 0),af(dx(o),"_dummyScreenImage",void 0),af(dx(o),"_trackSourceType",void 0),af(dx(o),"_liveTranscodeConfig",void 0),af(dx(o),"_startCloudProxyTimestamp",void 0),af(dx(o),"_localVideoDeviceId",void 0),af(dx(o),"_pauseAllSubscribeState",{audio:void 0,video:void 0,resumeAudioStreamIds:{},resumeVideoStreamIds:{}}),af(dx(o),"_audioVolumeIndicationTimer",void 0),af(dx(o),"_dummyMainTimer",void 0),af(dx(o),"_dummyScreenTimer",void 0),af(dx(o),"_audioPropertiesReportTimer",null),af(dx(o),"_mirrorType",PP.MIRROR_TYPE_RENDER),af(dx(o),"_audioMixingManager",void 0),af(dx(o),"_pubLock",void 0),af(dx(o),"_subLocks",void 0),af(dx(o),"_audioCaptureLock",void 0),af(dx(o),"_videoCaptureLock",void 0),af(dx(o),"_screenCaptureLock",void 0),af(dx(o),"_subScreenLocks",void 0),af(dx(o),"_rtmClient",void 0),af(dx(o),"_messageStatisticsObserver",void 0),af(dx(o),"_waitForNewToken",!1),af(dx(o),"_originIceConfigRequestUrls",void 0),af(dx(o),"_originConfigServerUrls",void 0),af(dx(o),"_originLogServerUrl",void 0),af(dx(o),"_extensionManager",void 0),af(dx(o),"_audioDeviceManager",void 0),af(dx(o),"_remoteVideoConfig",new DR),af(dx(o),"_config",void 0),af(dx(o),"_needClosePreTrack",!1),af(dx(o),"_containerCollisionDetector",new $3),af(dx(o),"_ctx",void 0),af(dx(o),"_updateMixAudioTrack",function(){var e=HS(BS().mark((function e(t){var r,n,i=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>1&&void 0!==i[1]?i[1]:P1.PLAYOUT_AND_PUBLISH,o.logger.info("_updateMixAudioTrack()"),o._localAudioTrack){e.next=5;break}return t&&(o._tempMixingAudioTrack={track:t,type:n}),e.abrupt("return");case 5:if(t?(o._localAudioTrack.mixType=n,o._localAudioTrack.mixedAudioTrack=t):(delete o._localAudioTrack.mixType,delete o._localAudioTrack.mixedAudioTrack),null===(r=o._room)||void 0===r||!r.hasPublished){e.next=9;break}return e.next=9,o._updatePublish();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),af(dx(o),"_onAudioMixingMessage",(function(e){o.safeEmit(QF.onAudioMixingStateChanged,e)})),af(dx(o),"_onAudioMixingAutoplayFailed",(function(e){o.safeEmit(QF.onAutoplayFailed,e)})),o.id=t,o._appId=e,o.monitor=GV(t),o._ctx=new Z1(t,e,r),o._pubLock=new q1("pubLock"),o._subLocks=new DR,o._subScreenLocks=new DR,o._audioCaptureLock=new q1("audioCap"),o._videoCaptureLock=new q1("videoCap"),o._screenCaptureLock=new q1("screenCap"),o._addDeviceEventHandler(),o._extensionManager=new uK(t),o._audioDeviceManager=new F2(o._ctx,o._extensionManager),o._audioMixingManager=new P2({getLocalAudioTrack:function(){return o._localAudioTrack},updateLocalAudioTrack:o._updateMixAudioTrack,emitMessage:o._onAudioMixingMessage,onAutoPlayFailed:o._onAudioMixingAutoplayFailed},t),o._addSignalingEventHandler(),o._publicStreamManager=new U2(o._ctx),o._addPublicStreamEventHandler(),window.__rtc_engine__=dx(o),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=dx(o),o._trackSourceType={video:gP.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:gP.VIDEO_SOURCE_TYPE_INTERNAL,audio:yP.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:yP.AUDIO_SOURCE_TYPE_INTERNAL},o._config=r,o._rtmClient=new N2(o._ctx),o._handleRTMClient(o._rtmClient),o._handleAudioDeviceManager(),o._messageStatisticsObserver=new DV(t),o.logger=new dF("Engine",0,t),MV.createRTSMsgReportor(o.id),o._getServerConfig(),o.monitor.reportLongString("NativeDetector",ZS(uk)),o}return nf(De,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(Ne=HS(BS().mark((function e(t){var r,n,i,o,a;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("updateToken()","token: %s",t),rj(t,"token"),!this._room||!this._waitForNewToken){e.next=8;break}return this._waitForNewToken=!1,this._room.config.token=t,e.next=7,this._join(this._room);case 7:return e.abrupt("return",e.sent);case 8:if(this._room){e.next=10;break}throw new rN(_P.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 10:return e.next=12,this._room.updateToken(t);case 12:return r=[],this._room.config.tokenPublishPrivilegeExpired&&this._room.config.isAutoPublish&&this._ctx.visibility&&r.push(this._updatePublish({mediaType:wP.AUDIO_AND_VIDEO})),this._room.config.tokenSubscribePrivilegeExpired&&(n=this._room.config,i=n.isAutoSubscribeAudio,o=n.isAutoSubscribeVideo,(a=(i?wP.AUDIO:0)|(o?wP.VIDEO:0))&&r.push(this._triedResumeAllRemoteStreams(a,!0))),e.next=17,qS.allSettled(r);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return Ne.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(Pe=HS(BS().mark((function e(t){var r,n,i,o,a,s=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("setVideoCaptureDevice()","deviceId: %s",t),rj(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:if(!fB||!mB){e.next=9;break}if(this._localVideoTrack.originTrack.getSettings().deviceId!==t){e.next=9;break}return e.abrupt("return");case 9:return n=uq({},this._videoStreamConstraints),"user"===t||"environment"===t||"left"===t||"right"===t?(delete n.deviceId,n.facingMode=t):!dB||_B?n.deviceId={exact:t}:delete n.deviceId,mB&&iB&&AB>=85&&AB<=91&&(null===(i=this.localVideoTrack)||void 0===i||i.removePlayerTrack()),this._needClosePreTrack=this._needClosePreTrack||aH,this._needClosePreTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.destroy(),delete this._localVideoTrack),this.logger.info("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=17,VK(n,this._extensionManager).catch((function(e){if(s._localVideoTrack&&!s._localVideoTrack.dummy)return s.logger.warn("setVideoCaptureDevice()","createCameraVideoTrack failed, stop pre VideoTrack."),s._removeLocalTrackEvents(s._localVideoTrack),s._localVideoTrack.destroy(),delete s._localVideoTrack,VK(n,s._extensionManager).then((function(e){return s._needClosePreTrack=!0,e})).catch(HS(BS().mark((function t(){var r;return BS().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s.logger.error("setVideoCaptureDevice()","createCameraVideoTrack failed, rollback."),t.next=3,VK(s._videoStreamConstraints,s._extensionManager);case 3:throw r=t.sent,s._switchTrack(r),e;case 6:case"end":return t.stop()}}),t)}))));throw e}));case 17:return o=e.sent,this.logger.success("setVideoCaptureDevice()","createCameraVideoTrack success."),this._videoStreamConstraints=n,this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.destroy()),null!==(r=this._videoStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&o.setContentHint(null===(a=this._videoStreamEncodeConfig[0])||void 0===a?void 0:a.contentHint),e.next=24,this._switchTrack(o);case 24:case"end":return e.stop()}}),e,this)}))),function(e){return Pe.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(Oe=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("setAudioCaptureDevice()","deviceId: %s",t),rj(t,"deviceId"),this._ctx.audioProfileManager.updateConstraints({deviceId:{exact:t}}),this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return this._localAudioTrack.destroy(),this._removeLocalTrackEvents(this._localAudioTrack),e.next=9,BK(this._ctx.audioProfileManager.getConstraints(),this._extensionManager);case 9:if(n=e.sent,this._initLocalTrackEvents(n),this._localAudioTrack=n,this._localAudioTrack.setVolume(this._localAudioVolume),this._room){e.next=15;break}return e.abrupt("return");case 15:if(null===(r=this._room.localStream)||void 0===r||!r.pubAudio){e.next=18;break}return e.next=18,this._updatePublish();case 18:case"end":return e.stop()}}),e,this)}))),function(e){return Oe.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){PK.on(QF.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),PK.on(QF.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addSignalingEventHandler",value:function(){var e=this,t=this._ctx.signalingManager;t.on(Oj.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),t.on(Oj.ON_RECONNECT_FAILED,(function(){e.safeEmit(QF.onError,{errorCode:_P.RECONNECT_FAILED})})),t.on(Oj.CONNECT_WITH_TCP,(function(){e.safeEmit(QF.onIceConnectWithTcp)}))}},{key:"_addPublicStreamEventHandler",value:function(){var e=this;this._publicStreamManager.on("onResubscribe",(function(e){var t=e.stream;t&&(t.audioTrack&&t.audioTrack.play(),t.videoTrack&&t.videoTrack.play(CK))})),this._publicStreamManager.on("onRemoteStreamStats",(function(t){e.safeEmit(QF.onPublicStreamStats,t)})),this._publicStreamManager.on("onSEIMessageReceived",(function(t){e.safeEmit(QF.onPublicStreamSEIMessageReceived,t)}))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R,C,w,A,x,O,P,N,M,D,L,U,V,F,B,j=this;null===(e=this._room)||void 0===e||e.on(Aj.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(Aj.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(Aj.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(aX.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(aX.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(aX.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(Aj.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(Aj.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(Aj.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(Aj.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(Aj.ON_TOKEN_PUBLISH_PRIVILEGE_WILL_EXPIRE,this._onUserTokenPublishPrivilegeWillExpire.bind(this)),null===(l=this._room)||void 0===l||l.on(Aj.ON_TOKEN_PUBLISH_PRIVILEGE_DID_EXPIRED,this._onUserTokenPublishPrivilegeDidExpired.bind(this)),null===(h=this._room)||void 0===h||h.on(Aj.ON_TOKEN_SUBSCRIBE_PRIVILEGE_WILL_EXPIRE,this._onUserTokenSubscribePrivilegeWillExpire.bind(this)),null===(p=this._room)||void 0===p||p.on(Aj.ON_TOKEN_SUBSCRIBE_PRIVILEGE_DID_EXPIRED,this._onUserTokenSubscribePrivilegeDidExpired.bind(this)),null===(f=this._room)||void 0===f||f.on(Aj.POST_PROCESSING_MESSAGE,(function(e){var t;"2.0"===(null==(t=e)?void 0:t.protocol)?j._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?j._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&j._onLiveTranscodingResult(e)})),null===(v=this._room)||void 0===v||v.on(Oj.ON_VENDOR_CONNECTION_STATE_CHANGE,(function(e){return j.safeEmit(QF.onVendorConnectionStateChanged,e)})),null===(_=this._room)||void 0===_||_.on(aX.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(m=this._room)||void 0===m||m.on(aX.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(g=this._room)||void 0===g||g.on(aX.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(y=this._room)||void 0===y||y.on(aX.ON_PUBLISH_RESULT,(function(e){var t,r,n;e.state===TP.PUBLISH_SUCC&&(null===(r=j._room)||void 0===r||r.config.setTokenPublishPrivilegeExpired(!1)),e.state===TP.PUBLISH_FAIL&&e.errorCode===_P.TOKEN_NO_PUBLISH_PERMISSION&&(null===(n=j._room)||void 0===n||n.config.setTokenPublishPrivilegeExpired(!0));var i=!(e.retry||null===(t=j._room)||void 0===t||!t.config.isAutoPublish);i&&j.safeEmit(QF.onAutoPublishResult,e),j.safeEmit(QF.onPublishResult,{isScreen:e.isScreen,isAutoPublish:i,errorCode:e.errorCode})})),null===(S=this._room)||void 0===S||S.on(aX.ON_SUBSCRIBE_RESULT,(function(e){var t;e.state===kP.SUBSCRIBE_SUCC&&(null===(t=j._room)||void 0===t||t.config.setTokenSubscribePrivilegeExpired(!1)),e.state===kP.SUBSCRIBE_FAIL&&e.errorCode===_P.TOKEN_NO_SUBSCRIBE_PERMISSION&&j._handleLoseSubscribePrivilege(),j.safeEmit(QF.onSubscribeResult,{userId:e.userId,isScreen:e.isScreen,isAutoSubscribe:!1,errorCode:e.errorCode})})),null===(b=this._room)||void 0===b||b.on(aX.ON_REMOTE_STREAM_STATS,(function(e){j.safeEmit(QF.onRemoteStreamStats,e)})),null===(E=this._room)||void 0===E||E.on(aX.ON_LOCAL_STREAM_STATS,(function(e){j.safeEmit(QF.onLocalStreamStats,e)})),null===(k=this._room)||void 0===k||k.on(aX.ON_SUBTITLE_STATE_CHANGED,(function(e){j.safeEmit(QF.onSubtitleStateChanged,e)})),null===(T=this._room)||void 0===T||T.on(aX.ON_SUBTITLE_MESSAGE_RECEIVED,(function(e){j.safeEmit(QF.onSubtitleMessageReceived,e)})),null===(I=this._room)||void 0===I||I.on(aX.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(R=this._room)||void 0===R||R.on(aX.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;j._updateAudioPlayerState(t),j.safeEmit(QF.onUserStartAudioCapture,{userId:r})})),null===(C=this._room)||void 0===C||C.on(aX.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;j.safeEmit(QF.onUserStopAudioCapture,{userId:t})})),null===(w=this._room)||void 0===w||w.on(aX.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;j.safeEmit(QF.onUserStartVideoCapture,{userId:t})})),null===(A=this._room)||void 0===A||A.on(aX.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;j.safeEmit(QF.onUserStopVideoCapture,{userId:t})})),null===(x=this._room)||void 0===x||x.on(aX.ON_SEI_MESSAGED_RECEIVED,(function(e){j.safeEmit(QF.onSEIMessageReceived,e)})),null===(O=this._room)||void 0===O||O.on(aX.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){j.safeEmit(QF.onRemoteVideoSizeChanged,e,t)})),null===(P=this._room)||void 0===P||P.on(aX.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return j.safeEmit(QF.onSimulcastSubscribeFallback,e)})),null===(N=this._room)||void 0===N||N.on(aX.ON_VIDEO_STREAM_BANNED,(function(e){j.safeEmit(QF.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(M=this._room)||void 0===M||M.on(aX.ON_AUDIO_STREAM_BANNED,(function(e){j.safeEmit(QF.onAudioStreamBanned,{uid:e.uid,banned:e.banned})})),null===(D=this._room)||void 0===D||D.on(aX.ON_FORWARD_STREAM_ERROR,(function(e){j.safeEmit(QF.onForwardStreamError,e)})),null===(L=this._room)||void 0===L||L.on(aX.ON_REJOIN_WITH_TCP,(function(){j.safeEmit(QF.onRejoinWithTcp)})),null===(U=this._room)||void 0===U||U.on(aX.PUB_RETRY,(function(e){j.safeEmit(QF.onPublishRetry,e)})),null===(V=this._room)||void 0===V||V.on(aX.SUB_RETRY,(function(e){j.safeEmit(QF.onSubscribeRetry,e)})),null===(F=this._room)||void 0===F||F.on(aX.VIDEO_TYPE_CHANGE,(function(e){j.safeEmit(QF.onSEIStreamUpdate,e)})),null===(B=this._room)||void 0===B||B.on(aX.JOIN_SUCCESS,(function(e){j._ctx.isPreConnection||j.safeEmit(QF.onConnectionStateChanged,{state:e?xP.CONNECTION_STATE_RECONNECTED:xP.CONNECTION_STATE_CONNECTED})}))}},{key:"safeEmit",value:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return function(e){var t,r=XB("FORCE_ENABLED_REPORT_CALLBACKS");return!(null==r||!vE(r).call(r,e))||!vE(t=[QF.onRemoteStreamStats,QF.onLocalStreamStats,QF.onAudioVolumeIndication,QF.onLocalAudioPropertiesReport,QF.onRemoteAudioPropertiesReport]).call(t,e)}(e)&&JV(this.id,e,i),(t=Bx(Fx(De.prototype),"safeEmit",this)).call.apply(t,JS(r=[this,e]).call(r,i))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()}},{key:"connect",value:(xe=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ctx.signalingManager.connect();case 2:case"end":return e.stop()}}),e,this)}))),function(){return xe.apply(this,arguments)})},{key:"joinRoom",value:(Ae=HS(BS().mark((function e(t,r,n,i){var o,a,s,c,u;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,i),cj(t)||rj(t,"token"),!this._room){e.next=4;break}throw new rN(_P.REPEAT_JOIN,"Already joined");case 4:return uj(r),hj(n),pj((u=new dQ({token:t,roomId:r,userInfo:n},this._ctx)).updateRoomConfig(i)),u.setLiveControlMessage(this._liveTranscodeConfig&&K2.getStartParams(this._liveTranscodeConfig)),this._room=new b2(u,this._ctx),this._addHandlerEventHandler(),this._ctx.useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),null===(o=this._localVideoTrack)||void 0===o||o.setUserId(n.userId),null===(a=this._localScreenVideoTrack)||void 0===a||a.setUserId(n.userId),null===(s=this._localAudioTrack)||void 0===s||s.setUserId(n.userId),null===(c=this._localScreenAudioTrack)||void 0===c||c.setUserId(n.userId),yX(n),e.next=19,this._join(this._room);case 19:return e.abrupt("return",e.sent);case 20:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return Ae.apply(this,arguments)})},{key:"_join",value:(we=HS(BS().mark((function e(t){var r,n,i=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.join();case 3:return n=e.sent,this.monitor.set({rtc_session_id:t.config.sessionId}),this._waitForNewToken=!1,this._ctx.audioProfileManager.setRoomId(t.config.roomId),null!==(r=this._room)&&void 0!==r&&r.config.isAutoPublish&&(this._ctx.visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:wP.AUDIO_AND_VIDEO}).catch((function(e){i.logger.error("_join","_updatePublish failed",e)})):(this.safeEmit(QF.onAutoPublishResult,{isScreen:!1,state:TP.PUBLISH_FAIL}),this.safeEmit(QF.onPublishResult,{isScreen:!1,isAutoPublish:!0,errorCode:_P.NO_PUBLISH_PERMISSION}))),this.monitor.set({rtc_vid:t.config.rtcVid}),MV.setRoomId(this.id,t.config.roomId),MV.setUserId(this.id,t.config.userId),e.abrupt("return",n);case 14:throw e.prev=14,e.t0=e.catch(0),e.t0.code===_P.INVALID_TOKEN?this._waitForNewToken=!0:(t.destroy(),this._room===t&&delete this._room),e.t0;case 18:case"end":return e.stop()}}),e,this,[[0,14]])}))),function(e){return we.apply(this,arguments)})},{key:"leaveRoom",value:(Ce=HS(BS().mark((function e(){var t,r,n=this,i=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],this.logger.info("leaveRoom()"),r=this._room,delete this._room,this._ctx.resetPubSubLock(Q1.LEAVE),!t){e.next=10;break}return e.next=8,null==r?void 0:r.leave(t);case 8:e.next=11;break;case 10:null==r||r.leave(t).catch();case 11:this._removeHandlerEventHandler(),this._subLocks=new DR,this._subScreenLocks=new DR,this._ctx.audioProfileManager.setRoomId(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),null==r||r.destroy(),this._remoteVideoPlayerConfig[CP.STREAM_INDEX_MAIN].forEach((function(e){e.forEach((function(e){var t=e.player,r=e.renderDom;null==t||t.destroy(),n._containerCollisionDetector.unregisterContainer(r)}))})),this._remoteVideoPlayerConfig[CP.STREAM_INDEX_MAIN].clear(),this._remoteVideoPlayerConfig[CP.STREAM_INDEX_SCREEN].forEach((function(e){e.forEach((function(e){var t=e.player,r=e.renderDom;null==t||t.destroy(),n._containerCollisionDetector.unregisterContainer(r)}))})),this._remoteVideoPlayerConfig[CP.STREAM_INDEX_SCREEN].clear(),this._publicStreamIds=new DR,MV.setRoomId(this.id,""),MV.setUserId(this.id,""),this.monitor.set({rtc_session_id:"",rtc_vid:""});case 25:case"end":return e.stop()}}),e,this)}))),function(){return Ce.apply(this,arguments)})},{key:"_destroyLocalTrack",value:function(){this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.destroy(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.destroy(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.destroy(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.destroy(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0)}},{key:"destroy",value:function(){var e;this.logger.info("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,this._subLocks=new DR,this._subScreenLocks=new DR,this._audioCaptureLock=new q1("audioCap"),this._videoCaptureLock=new q1("videoCap"),this._screenCaptureLock=new q1("screenCap"),this._videoStreamConstraints={},this._videoStreamEncodeConfig=[QB],this._screenStreamEncodeConfig=[ZB],this._pauseAllSubscribeState={audio:void 0,video:void 0,resumeVideoStreamIds:{},resumeAudioStreamIds:{}},this._messageStatisticsObserver.destroy(),this.monitor.destroy(),MV.destroyRTSMsgReportor(this.id),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyMainTimer),clearInterval(this._dummyScreenTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._destroyLocalTrack(),pK.on("".concat(this.id,"capture-end"),this._destroyLocalTrack.bind(this)),this._audioMixingManager.destroy(),this._rtmClient.destroy(),this._publicStreamManager.destroy(),this._publicStreamIds=new DR,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new DR,this._extensionManager.destroy(),this._ctx.destroy(),this._localAudioVolume=100,this._localScreenAudioVolume=100,this._remoteAudioVolume.clear(),this._remoteScreenAudioVolume.clear(),this._publicAudioVolume.clear(),this._localVideoPlayerConfig[CP.STREAM_INDEX_MAIN].forEach((function(e){e.player.destroy()})),this._localVideoPlayerConfig[CP.STREAM_INDEX_MAIN].clear(),this._localVideoPlayerConfig[CP.STREAM_INDEX_SCREEN].forEach((function(e){e.player.destroy()})),this._localVideoPlayerConfig[CP.STREAM_INDEX_SCREEN].clear(),this._remoteVideoPlayerConfig[CP.STREAM_INDEX_MAIN].forEach((function(e){e.forEach((function(e){e.player.destroy()}))})),this._remoteVideoPlayerConfig[CP.STREAM_INDEX_MAIN].clear(),this._remoteVideoPlayerConfig[CP.STREAM_INDEX_SCREEN].forEach((function(e){e.forEach((function(e){e.player.destroy()}))})),this._remoteVideoPlayerConfig[CP.STREAM_INDEX_SCREEN].clear(),this._publicVideoPlayerConfig.forEach((function(e){e.player.destroy()})),this._publicVideoPlayerConfig.clear()}},{key:"publishStream",value:(Re=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!DF(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,MK(this._localImgVideoTrack,this._extensionManager);case 6:this._localVideoTrack=e.sent;case 7:return e.next=9,this._updatePublish({mediaType:t},!0);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Re.apply(this,arguments)})},{key:"unpublishStream",value:(Ie=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("unpublishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!r){e.next=5;break}return e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.unpublish());case 5:return e.next=7,this._updatePublish({mediaType:t,pubState:cX.UNPUB},!0);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ie.apply(this,arguments)})},{key:"publishScreen",value:(Te=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!DF(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,LK(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:cX.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof rN)){e.next=18;break}throw e.t0;case 18:throw new rN(_P.UNEXPECTED_ERROR,"unexpected error",e.t0);case 19:case"end":return e.stop()}}),e,this,[[3,12]])}))),function(e){return Te.apply(this,arguments)})},{key:"unpublishScreen",value:(ke=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:cX.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ke.apply(this,arguments)})},{key:"subscribeStream",value:(Ee=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("subscribeStream()","userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!1,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ee.apply(this,arguments)})},{key:"_subscribe",value:(be=HS(BS().mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=n,n!==wP.AUDIO||null===(i=this._room)||void 0===i||!i.config.isMultiChatMode()){e.next=4;break}return this.logger.warn("subscribeStream()","due to multiChatMode return"),e.abrupt("return");case 4:if(s=this._room.remoteStreams.get(r),c=null==s?void 0:DC(s).call(s,(function(e){return e.isScreen===t}))){e.next=8;break}throw new rN(_P.STREAM_NOT_EXIST,"stream not exist");case 8:return u=this._pauseAllSubscribeState.audio,d=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(n-=n&wP.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&wP.VIDEO),this.logger.warn("subscribeStream()","due to pauseAll mediaType: %o",n),l=c.hasSubscribed,h=this._remoteVideoConfig.get(r)||(null===(o=this._room)||void 0===o?void 0:o.config.remoteVideoConfig),c.originalMediaType=n,e.prev=16,e.next=19,this._room.subscribe(c,n,h);case 19:MF(n)&&this._updateAudioPlayerState(c),DF(n)&&this._updateVideoPlayerState(c),f=0,v=0,u!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?f|=wP.AUDIO:v|=wP.AUDIO),d!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?f|=wP.VIDEO:v|=wP.VIDEO),f&&this.pauseAllSubscribedStream(f),v&&this.resumeAllSubscribedStream(v),MF(a)&&(this._pauseAllSubscribeState.resumeAudioStreamIds[c.streamId]=c.streamId),DF(a)&&(this._pauseAllSubscribeState.resumeVideoStreamIds[c.streamId]=c.streamId),(c.audioTrack||c.videoTrack)&&(g=!(t||!(null!==(_=this._room)&&void 0!==_&&_.config.isAutoSubscribeAudio||null!==(m=this._room)&&void 0!==m&&m.config.isAutoSubscribeVideo)),y={userId:r,isScreen:!1,state:kP.SUBSCRIBE_SUCC},g&&this.safeEmit(QF.onAutoSubscribeResult,y),this.safeEmit(QF.onSubscribeResult,{userId:r,isScreen:t,isAutoSubscribe:g})),null!==(p=this._room)&&void 0!==p&&p.config.isMultiChatMode()||l||!MF(n)||!c.hasAudio||null===(S=c.observer)||void 0===S||S.setSubscribeAudio(!0),!l&&DF(n)&&c.hasVideo&&(null===(b=c.observer)||void 0===b||b.setSubscribeVideo(!0)),e.next=38;break;case 34:throw e.prev=34,e.t0=e.catch(16),e.t0 instanceof rN&&e.t0.code===_P.TOKEN_NO_SUBSCRIBE_PERMISSION&&this._handleLoseSubscribePrivilege(),e.t0;case 38:case"end":return e.stop()}}),e,this,[[16,34]])}))),function(e,t,r){return be.apply(this,arguments)})},{key:"_handleLoseSubscribePrivilege",value:(Se=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return null===(t=this._room)||void 0===t||t.config.setTokenSubscribePrivilegeExpired(!0),e.prev=1,e.next=4,this._unSubscribeAllRemoteStreams();case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:case"end":return e.stop()}}),e,this,[[1,6]])}))),function(){return Se.apply(this,arguments)})},{key:"unsubscribeStream",value:(ye=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("unsubscribeStream()","userId: %o, mediaType: %o",t,r),e.abrupt("return",this._unsubscribe(!1,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return ye.apply(this,arguments)})},{key:"subscribeScreen",value:(ge=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("subscribeScreen() userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!0,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return ge.apply(this,arguments)})},{key:"unsubscribeScreen",value:(me=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("unsubscribeScreen() userId: %o, mediaType: %o",t,r),e.abrupt("return",this._unsubscribe(!0,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return me.apply(this,arguments)})},{key:"_unsubscribe",value:function(e,t,r,n){var i,o=this;if(r!==wP.AUDIO||null===(i=this._room)||void 0===i||!i.config.isMultiChatMode()){var a,s=this._room.remoteStreams.get(t),c=null==s?void 0:DC(s).call(s,(function(t){return t.isScreen===e}));if(!c)throw new rN(_P.STREAM_NOT_EXIST,"stream not exist");return mB&&AB&&AB>=85&&AB<=91&&r!==wP.AUDIO&&(null===(a=c.videoTrack)||void 0===a||a.stopAll()),this._room.unsubscribe(c,r).then((function(){n||(MF(r)&&delete o._pauseAllSubscribeState.resumeAudioStreamIds[c.streamId],DF(r)&&delete o._pauseAllSubscribeState.resumeVideoStreamIds[c.streamId])}))}this.logger.warn("subscribeStream()","due to multiChatMode return")}},{key:"setRemoteVideoConfig",value:(_e=HS(BS().mark((function e(t,r){var n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),dj(t),_j(r),this._remoteVideoConfig.set(t,r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.updateSubVideoConfig(t,r).then((function(){})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return _e.apply(this,arguments)})},{key:"startVideoCapture",value:(ve=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("startVideoCapture()","deviceId: %s",t),cj(t)||rj(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,this._trackSourceType.video!==gP.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new rN(_P.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(!this._localVideoTrack||this._localVideoTrack.dummy){e.next=8;break}throw new rN(_P.REPEAT_CAPTURE,"Has already capture");case 8:return a=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?(a.facingMode=t,delete a.deviceId):!dB||_B?a.deviceId={exact:t}:delete a.deviceId,this._videoStreamConstraints=a),s={},e.next=13,VK(a,this._extensionManager);case 13:if(c=e.sent,null!==(r=this._videoStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&c.setContentHint(null===(u=this._videoStreamEncodeConfig[0])||void 0===u?void 0:u.contentHint),this._initLocalTrackEvents(c),this._localVideoTrack=c,this._localVideoPlayerConfig[CP.STREAM_INDEX_MAIN].forEach((function(e){var t,r;null===(t=p._localVideoTrack)||void 0===t||t.setPlayer(p.id,e,p._mirrorType,null===(r=p._config)||void 0===r?void 0:r.autoPlayPolicy,p._initPlayerEvents.bind(p))})),d=c.originTrack,s=d.getSettings(),l={width:s.width,height:s.height},this._localVideoTrack.resolution=l,this.autoResetVideoEncoderConfig(s),setTimeout((function(){return p.safeEmit(QF.onLocalVideoSizeChanged,{streamIndex:CP.STREAM_INDEX_MAIN,info:l})})),pK.emit("".concat(this.id,"capture-end")),this._room){e.next=28;break}return e.abrupt("return",s);case 28:return h=this._room.config.isAutoPublish,(null!==(n=this._room.localStream)&&void 0!==n&&n.pubVideo||h)&&this._ctx.visibility&&this._updatePublish(),null===(i=this._room.localStream)||void 0===i||null===(o=i.observer)||void 0===o||o.setEnableVideo(!0),e.abrupt("return",s);case 32:case"end":return e.stop()}}),e,this)}))),function(e){return ve.apply(this,arguments)})},{key:"stopVideoCapture",value:(fe=HS(BS().mark((function e(){var t,r,n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("stopVideoCapture()"),this._trackSourceType.video!==gP.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=3;break}throw new rN(_P.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 3:if(this._localVideoTrack&&(this._localVideoTrack.dummy||((i=this._extensionManager.getPluginByName(cK.PRE_PROCESSING,"RTCBeautyExtension"))&&i.emit("stop"),this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.destroy(),this._localImgVideoTrack?this._localVideoTrack.setTrack(this._localImgVideoTrack,this._extensionManager,{isDummy:!0}):this._localVideoTrack=void 0)),this._room){e.next=6;break}return e.abrupt("return");case 6:if(null===(t=this._room.localStream)||void 0===t||!t.pubVideo){e.next=9;break}return e.next=9,this._updatePublish();case 9:null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableVideo(!1);case 10:case"end":return e.stop()}}),e,this)}))),function(){return fe.apply(this,arguments)})},{key:"startAudioCapture",value:(pe=HS(BS().mark((function e(t){var r,n,i,o,a,s;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("startAudioCapture()","deviceId: $o",t),cj(t)||rj(t,"deviceId"),t&&this._ctx.audioProfileManager.updateConstraints({deviceId:{exact:t}}),this._trackSourceType.audio!==yP.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new rN(_P.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 5:if(!this._localAudioTrack){e.next=7;break}throw new rN(_P.REPEAT_CAPTURE,"Has already capture");case 7:return o={},e.next=10,BK(this._ctx.audioProfileManager.getConstraints(),this._extensionManager);case 10:if(a=e.sent,o=a.originTrack.getSettings(),this._initLocalTrackEvents(a),this._localAudioTrack=a,this._localAudioTrack.setVolume(this._localAudioVolume),this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),pK.emit("".concat(this.id,"capture-end")),this._room){e.next=19;break}return e.abrupt("return",o);case 19:return s=this._room.config.isAutoPublish,(null!==(r=this._room.localStream)&&void 0!==r&&r.pubAudio||s)&&this._ctx.visibility&&this._updatePublish(),null===(n=this._room.localStream)||void 0===n||null===(i=n.observer)||void 0===i||i.setEnableAudio(!0),e.abrupt("return",o);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return pe.apply(this,arguments)})},{key:"stopAudioCapture",value:(he=HS(BS().mark((function e(){var t,r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("stopAudioCapture()"),this._trackSourceType.audio!==yP.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=3;break}throw new rN(_P.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 3:if(this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.destroy()),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._room){e.next=8;break}return e.abrupt("return");case 8:if(null===(t=this._room.localStream)||void 0===t||!t.pubAudio){e.next=11;break}return e.next=11,this._updatePublish();case 11:null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!1);case 12:case"end":return e.stop()}}),e,this)}))),function(){return he.apply(this,arguments)})},{key:"checkAudioAndVideoDeviceId",value:function(e,t){var r;return this.logger.print("startAudioAndVideoCapture","optionsOrAudioDeviceId: $o",e,"videoDeviceId: $o",t),cj(t)||rj(t,"videoDeviceId"),cj(e)||("string"==typeof e?(rj(e,"audioDeviceId"),r=e):(r=null==e?void 0:e.audioDeviceId,t=null==e?void 0:e.videoDeviceId,rj(r,"audioDeviceId"),rj(t,"videoDeviceId"))),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,{audioDeviceId:r,videoDeviceId:t}}},{key:"startAudioAndVideoCapture",value:(le=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.print("startAudioAndVideoCapture","optionsOrAudioDeviceId: $o",t,"videoDeviceId: $o",r),d=this.checkAudioAndVideoDeviceId(t,r),l=d.audioDeviceId,h=d.videoDeviceId,r=h,l&&this._ctx.audioProfileManager.updateConstraints({deviceId:{exact:l}}),this._trackSourceType.video!==gP.VIDEO_SOURCE_TYPE_EXTERNAL&&this._trackSourceType.audio!==yP.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new rN(_P.STREAM_TYPE_NOT_MATCH,this._trackSourceType.video===gP.VIDEO_SOURCE_TYPE_EXTERNAL?"setVideoSourceType as internal first":"setAudioSourceType as internal first");case 6:if(!this._localVideoTrack||this._localVideoTrack.dummy){e.next=8;break}throw new rN(_P.REPEAT_CAPTURE,"video has already capture");case 8:if(!this._localAudioTrack){e.next=10;break}throw new rN(_P.REPEAT_CAPTURE,"audio has already capture");case 10:return p=this._videoStreamConstraints,r&&("user"===r||"environment"===r||"left"===r||"right"===r?(p.facingMode=r,delete p.deviceId):!dB||_B?p.deviceId={exact:r}:delete p.deviceId,this._videoStreamConstraints=p),f={},v={},e.next=16,HK(this._ctx.audioProfileManager.getConstraints(),p,this._extensionManager);case 16:if(_=e.sent,m=_.audioTrack,g=_.videoTrack,null!==(n=this._videoStreamEncodeConfig[0])&&void 0!==n&&n.contentHint&&g.setContentHint(null===(y=this._videoStreamEncodeConfig[0])||void 0===y?void 0:y.contentHint),this._initLocalTrackEvents(g),this._localVideoTrack=g,this._localVideoPlayerConfig[CP.STREAM_INDEX_MAIN].forEach((function(e){var t,r;null===(t=k._localVideoTrack)||void 0===t||t.setPlayer(k.id,e,k._mirrorType,null===(r=k._config)||void 0===r?void 0:r.autoPlayPolicy,k._initPlayerEvents.bind(k))})),this._initLocalTrackEvents(m),this._localAudioTrack=m,this._localAudioTrack.setVolume(this._localAudioVolume),this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),S=g.originTrack,f=S.getSettings(),b={width:f.width||0,height:f.height||0},this._localVideoTrack.resolution=b,this.autoResetVideoEncoderConfig(f),setTimeout((function(){return k.safeEmit(QF.onLocalVideoSizeChanged,{streamIndex:CP.STREAM_INDEX_MAIN,info:b})})),S=m.originTrack,v=S.getSettings(),pK.emit("".concat(this.id,"capture-end")),this._room){e.next=39;break}return e.abrupt("return",{audioTrackSettings:v,videoTrackSettings:f});case 39:return E=this._room.config.isAutoPublish,(null!==(i=this._room.localStream)&&void 0!==i&&i.pubVideo||null!==(o=this._room.localStream)&&void 0!==o&&o.pubAudio||E)&&this._ctx.visibility&&this._updatePublish(),null===(a=this._room.localStream)||void 0===a||null===(s=a.observer)||void 0===s||s.setEnableVideo(!0),null===(c=this._room.localStream)||void 0===c||null===(u=c.observer)||void 0===u||u.setEnableAudio(!0),e.abrupt("return",{audioTrackSettings:v,videoTrackSettings:f});case 44:case"end":return e.stop()}}),e,this)}))),function(e,t){return le.apply(this,arguments)})},{key:"startVideoAndAudioCapture",value:(de=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.startAudioAndVideoCapture(r,t));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return de.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return this.logger.info("getAudioMixingManager()","invoke"),this._audioMixingManager}},{key:"startScreenCapture",value:(ue=HS(BS().mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,p,f=this,v=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=v.length>0&&void 0!==v[0]?v[0]:{},this.logger.info("startScreenCapture()","config: %o",s),this._trackSourceType.screenVideo!==gP.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=4;break}throw new rN(_P.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 4:if(this._trackSourceType.screenAudio!==yP.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new rN(_P.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:return e.next=8,GK(s,this._extensionManager,this._screenStreamEncodeConfig[0]);case 8:if(c=e.sent,u=xb(c,2),d=u[0],null==(l=u[1])||l.setVolume(this._localScreenAudioVolume),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.destroy()),null===(t=this._localScreenAudioTrack)||void 0===t||t.destroy(),delete this._localScreenAudioTrack,this._localScreenVideoTrack=d,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&d.setContentHint(null===(h=this._screenStreamEncodeConfig[0])||void 0===h?void 0:h.contentHint),p=d.originTrack,setTimeout((function(){var e=p.getSettings(),t={width:e.width,height:e.height};d.resolution=t,f.safeEmit(QF.onLocalVideoSizeChanged,{streamIndex:CP.STREAM_INDEX_SCREEN,info:{width:e.width,height:e.height}})}),500),l&&(this._localScreenAudioTrack=l,this._initLocalTrackEvents(l)),this._localVideoPlayerConfig[CP.STREAM_INDEX_SCREEN].forEach((function(e){var t,r;null===(t=f._localScreenVideoTrack)||void 0===t||t.setPlayer(f.id,e,PP.MIRROR_TYPE_NONE,null===(r=f._config)||void 0===r?void 0:r.autoPlayPolicy,f._initPlayerEvents.bind(f))})),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),!(null!==(n=this._room)&&void 0!==n&&null!==(i=n.localScreenStream)&&void 0!==i&&i.pubAudio||null!==(o=this._room)&&void 0!==o&&null!==(a=o.localScreenStream)&&void 0!==a&&a.pubVideo)){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(){return ue.apply(this,arguments)})},{key:"stopScreenCapture",value:(ce=HS(BS().mark((function e(){var t,r,n,i,o,a;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("stopScreenCapture()"),null===(t=this._localScreenVideoTrack)||void 0===t||t.stopAll(),this._localScreenVideoTrack&&(this._localScreenVideoTrack.dummy||(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.destroy(),this._localImgScreenTrack&&this._localScreenVideoTrack.setTrack(this._localImgScreenTrack,this._extensionManager,{isDummy:!0}))),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.destroy()),this._localScreenAudioTrack=void 0,null!==(r=this._localScreenVideoTrack)&&void 0!==r&&r.dummy||(this._localScreenVideoTrack=void 0),!(null!==(n=this._room)&&void 0!==n&&null!==(i=n.localScreenStream)&&void 0!==i&&i.pubAudio||null!==(o=this._room)&&void 0!==o&&null!==(a=o.localScreenStream)&&void 0!==a&&a.pubVideo)){e.next=9;break}return e.next=9,this._updateScreenPublish();case 9:case"end":return e.stop()}}),e,this)}))),function(){return ce.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){var r;this.logger.info("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),nj(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]);var n=e===CP.STREAM_INDEX_MAIN?this._localVideoTrack:this._localScreenVideoTrack,i=null!==(r=null==t?void 0:t.playerId)&&void 0!==r?r:CK;if(null==t||!t.renderDom){var o,a,s;null===(o=this._localVideoPlayerConfig[e].get(i))||void 0===o||null===(a=o.player)||void 0===a||a.destroy();var c=null===(s=this._localVideoPlayerConfig[e].get(i))||void 0===s?void 0:s.renderDom;return this._containerCollisionDetector.unregisterContainer(c),void this._localVideoPlayerConfig[e].delete(i)}fj(t);var u=this._localVideoPlayerConfig[e].get(i);if(!u){var d,l,h,p=t.renderDom;if(!this._containerCollisionDetector.registerContainer(p))return this.monitor.report("rtc_error",{message:"RenderDom is not empty",error_code:kX.DUPLICATE_DOM}),void BF("renderDom is not empty");var f=new R2(this._ctx.id,i,ux(ux({},t),{},{isLocal:!0,isScreen:e===CP.STREAM_INDEX_SCREEN,userId:null!==(d=t.userId)&&void 0!==d?d:"_local_"})),v=ux(ux({},t),{},{player:f});return this._localVideoPlayerConfig[e].set(i,v),null==n||n.setPlayer(this.id,v,e===CP.STREAM_INDEX_MAIN?this._mirrorType:PP.MIRROR_TYPE_NONE,null===(l=this._config)||void 0===l?void 0:l.autoPlayPolicy,this._initPlayerEvents.bind(this)),null===(h=v.player)||void 0===h?void 0:h.domElement}void 0!==t.renderMode&&(null==n||n.setRenderMode(i,t.renderMode),u.renderMode=t.renderMode)}},{key:"startLiveTranscoding",value:(se=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("startLiveTranscoding()","transcode: %o",t),K2.checkStartParams(t),this._liveTranscodeConfig=t,!((n=null===(r=this._room)||void 0===r?void 0:r.config)&&n.roomId.length+n.userId.length>126)){e.next=6;break}throw new rN(_P.INVALID_PARAMS,"The roomId+userId must be within 126 bytes");case 6:if(e.prev=6,this.safeEmit(QF.onStreamMixingEvent,{event:sX.START,error:0,message:""}),!this._room||!this._ctx.signalingManager.isConnected()){e.next=11;break}return e.next=11,this._room.liveControlMessage(K2.getStartParams(this._liveTranscodeConfig));case 11:e.next=20;break;case 13:if(e.prev=13,e.t0=e.catch(6),!(e.t0 instanceof rN)){e.next=19;break}throw e.t0;case 19:throw new rN(_P.UNEXPECTED_ERROR,"unexpected error",e.t0);case 20:case"end":return e.stop()}}),e,this,[[6,13]])}))),function(e){return se.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(ae=HS(BS().mark((function e(t){var r,n,i,o;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete(i=uq({},t)).audio,null===(r=i.video)||void 0===r||delete r.codec,null===(n=i.video)||void 0===n||delete n.gop,K2.checkUpdateParams(i),this._liveTranscodeConfig=uq(this._liveTranscodeConfig,i),e.prev=9,this.safeEmit(QF.onStreamMixingEvent,{event:sX.UPDATE,error:0,message:""}),e.next=13,null===(o=this._room)||void 0===o?void 0:o.liveControlMessage(K2.getUpdateParams(this._liveTranscodeConfig));case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(9),!(e.t0 instanceof rN)){e.next=21;break}throw e.t0;case 21:throw new rN(_P.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:case"end":return e.stop()}}),e,this,[[9,15]])}))),function(e){return ae.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(oe=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(QF.onStreamMixingEvent,{event:sX.STOP,error:0,message:""}),e.next=8,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage({action:"stopped",type:"transcode"});case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof rN)){e.next=16;break}throw e.t0;case 16:throw new rN(_P.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return oe.apply(this,arguments)})},{key:"startSubtitle",value:(ie=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("startSubtitle()","config: %o",t),this._assertNotInRoom(),e.next=4,null===(r=this._room)||void 0===r?void 0:r.startSubtitle(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return ie.apply(this,arguments)})},{key:"updateSubtitleConfig",value:(ne=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("updateSubtitleConfig()","config: %o",t),this._assertNotInRoom(),e.next=4,null===(r=this._room)||void 0===r?void 0:r.updateSubtitleConfig(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"stopSubtitle",value:function(){var e;this.logger.info("stopSubtitle()","invoke"),null===(e=this._room)||void 0===e||e.stopSubtitle()}},{key:"setBusinessId",value:function(e){return this.logger.info("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(this._ctx.businessId=e,!0)}},{key:"setUserVisibility",value:(re=HS(BS().mark((function e(t){var r,n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("setUserVisibility()","enable: %o",t),t=!!t,this._ctx.visibility!==t){e.next=4;break}return e.abrupt("return");case 4:if(this._room){e.next=7;break}return this._ctx.visibility=t,e.abrupt("return");case 7:if(this._assertNotInRoom(),this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),t){e.next=14;break}return e.next=12,this._pubLock.lock();case 12:i=e.sent;try{this._room.unpublish(),this._room.unpublishScreen()}finally{i()}case 14:return this._ctx.visibility=t,e.prev=15,e.next=18,this._room.updateUserAttributes();case 18:e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(15),this._ctx.visibility=!t,e.t0;case 24:t&&null!==(r=this._room)&&void 0!==r&&r.config.isAutoPublish&&this._updatePublish({mediaType:wP.AUDIO_AND_VIDEO});case 25:case"end":return e.stop()}}),e,this,[[15,20]])}))),function(e){return re.apply(this,arguments)})},{key:"_initPlayerEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:CP.STREAM_INDEX_MAIN)===CP.STREAM_INDEX_SCREEN;e.on("playback_event",(function(i){switch(i.eventName){case"timeupdate":return;case"loadeddata":if("audio"===i.type){var o,a,s=e.userId.replace("_screen",""),c=null===(o=t._room)||void 0===o||null===(a=o.remoteStreams.get(s))||void 0===a?void 0:DC(a).call(a,(function(e){return e.isScreen===n})),u=function(){r?t.safeEmit(QF.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:s}):(t.safeEmit(QF.onAudioFirstFrameDecoded,{userId:s,isScreen:n}),t.safeEmit(QF.onRemoteAudioFirstFrame,{userId:s,isScreen:n})),t.monitor.report("first_remote_audio_render",{stream_id:"",stream_user_id:s||""},{isScreen:n})};null==c||!c.observer||c.observer.audioFirstFrameReceived?u():c.observer.once("recvAudioFirstFrame",u)}else{var d,l,h={userId:e.userId,height:(null===(d=e.domElement)||void 0===d?void 0:d.videoHeight)||0,width:(null===(l=e.domElement)||void 0===l?void 0:l.videoWidth)||0,isScreen:n,playerId:e.playerId};r?(h.publicStreamId=h.userId,delete h.userId,delete h.isScreen,t.safeEmit(QF.onFirstPublicStreamVideoFrameRendered,h),t.safeEmit(QF.onFirstPublicStreamVideoFrameDecoded,h)):e.isLocal||(t.safeEmit(QF.onVideoFirstFrameRendered,h),t.safeEmit(QF.onVideoFirstFrameDecoded,h),t.safeEmit(QF.onRemoteVideoFirstFrame,h)),t.monitor.report("first_remote_video_render",{stream_id:"",stream_user_id:i.userId||""},{isScreen:n})}break;case"autoplay-error":r&&(i.publicStreamId=i.userId),qV(t.id,"autoplay-error",e instanceof R2?"video":"audio",0,i.userId||"");var p={userId:i.userId,kind:e instanceof R2?"video":"audio",mediaType:e instanceof R2?wP.VIDEO:wP.AUDIO,streamIndex:e.isScreen?CP.STREAM_INDEX_SCREEN:CP.STREAM_INDEX_MAIN};return e instanceof R2&&(p.playerId=e.playerId===CK?void 0:e.playerId),void t.safeEmit(QF.onAutoplayFailed,p)}e instanceof R2&&(i.playerId=e.playerId===CK?void 0:e.playerId),t.safeEmit(QF.onPlayerEvent,i)}))}},{key:"_initLocalTrackEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];["track-ended","track-mute","track-unmute"].forEach((function(r){e.on(r,function(){var e=HS(BS().mark((function e(n){var i,o,a;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor.report("rtc_error",{message:JS(i="track-".concat(r," mediaType: ")).call(i,n.originTrack.kind),error_code:kX.TRACK_ERROR,capture_session_id:n.captureSessionId,media_type:r,reason:r}),o=!1,n!==t._localScreenAudioTrack&&n!==t._localScreenVideoTrack||(o=!0),a=n.originTrack.kind,t.safeEmit({"track-ended":QF.onTrackEnded,"track-mute":QF.onTrackMute,"track-unmute":QF.onTrackUnmute}[r],{kind:a,isScreen:o}),!_B&&!hB){e.next=13;break}if("track-mute"!==r){e.next=12;break}if(pK.emit(lK.ON_IOS_LOCAL_TRACK_MUTE,a),"audio"!==a){e.next=12;break}return e.next=11,t.stopAudioCapture();case 11:t.startAudioCapture();case 12:"track-unmute"===r&&pK.emit(lK.ON_IOS_LOCAL_TRACK_UNMUTE,a);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())})),e.on("resolution-change",(function(e){t._extensionManager.getPluginsByType(cK.PRE_PROCESSING).forEach((function(t){var n;null==t||null===(n=t.applyConstraints)||void 0===n||n.call(t,r?CP.STREAM_INDEX_SCREEN:CP.STREAM_INDEX_MAIN,e)})),t.safeEmit(QF.onLocalVideoSizeChanged,{streamIndex:r?CP.STREAM_INDEX_SCREEN:CP.STREAM_INDEX_MAIN,info:e})}))}},{key:"_removeLocalTrackEvents",value:function(e){e.removeAllListeners("track-ended"),e.removeAllListeners("track-mute"),e.removeAllListeners("track-unmute"),e.removeAllListeners("resolution-change")}},{key:"setRemoteVideoPlayer",value:function(e,t){var r,n,i,o,a,s,c,u;this.logger.info("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),nj(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),fj(t);var d=t.userId,l=e===CP.STREAM_INDEX_SCREEN,h=null===(r=this._room)||void 0===r||null===(n=r.remoteStreams.get(d))||void 0===n?void 0:DC(n).call(n,(function(e){return e.isScreen===l})),p=null==h?void 0:h.videoTrack,f=null!==(i=t.playerId)&&void 0!==i?i:CK;null===(o=this._getRemoteVideoPlayerConfig(e,d,f))||void 0===o||null===(a=o.player)||void 0===a||a.destroy();var v,_=null===(s=this._getRemoteVideoPlayerConfig(e,d,f))||void 0===s?void 0:s.renderDom;if(this._containerCollisionDetector.unregisterContainer(_),t.renderDom){var m=t.renderDom;if(!this._containerCollisionDetector.registerContainer(m))return this.monitor.report("rtc_error",{message:"RenderDom is not empty",error_code:kX.DUPLICATE_DOM}),void BF("renderDom is not empty");var g=new R2(this.id,f,ux(ux({},t),{},{isLocal:!1,isScreen:l,userId:d})),y=ux(ux({},t),{},{player:g});return this._setRemoteVideoPlayerConfig(e,d,f,y),null==p||p.setPlayer(this.id,y,null===(c=this._config)||void 0===c?void 0:c.autoPlayPolicy,this._initPlayerEvents.bind(this)),h&&this._updateVideoPlayerState(h),null===(u=y.player)||void 0===u?void 0:u.domElement}null===(v=this._remoteVideoPlayerConfig[e].get(d))||void 0===v||v.delete(f)}},{key:"setLocalVideoMirrorType",value:function(e){var t;this.logger.info("setLocalVideoMirrorType()","mirrorType: %o",e),nj(e,"mirrorType",[PP.MIRROR_TYPE_NONE,PP.MIRROR_TYPE_RENDER]),this._mirrorType=e,null===(t=this.localVideoTrack)||void 0===t||t.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(te=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("setAudioPlaybackDevice()","deviceId: %s",t),rj(t,"deviceId"),e.next=4,this._audioDeviceManager.setSinkId(t);case 4:n=e.sent,null===(r=this._room)||void 0===r||r.remoteStreams.forEach((function(e){e.forEach((function(e){var r;null===(r=e.audioTrack)||void 0===r||r.setPlaybackDevice(t)}))})),this.safeEmit(QF.onAudioPlaybackDeviceChanged,n),this.monitor.report("rtc_audio_device",{audio_event:"playout_device_switch",message:ZS(n),error_code:0});case 8:case"end":return e.stop()}}),e,this)}))),function(e){return te.apply(this,arguments)})},{key:"play",value:(ee=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=m.length>1&&void 0!==m[1]?m[1]:wP.AUDIO_AND_VIDEO,i=m.length>2?m[2]:void 0,o=m.length>3?m[3]:void 0,this.logger.info("play()","userId: %s, mediaType: %s, streamIndex: %s",t,n,i),a=null!=o?o:CK,s=!t||t===this._getUserId()||"local_user"===t,c=void 0===i||i===CP.STREAM_INDEX_MAIN,u=void 0===i||i===CP.STREAM_INDEX_SCREEN,d=n!==wP.VIDEO,l=n!==wP.AUDIO,h=[],s&&l&&(c&&this._localVideoTrack&&(this._localVideoTrack.mirror(!!this._mirrorType),(p=this._localVideoTrack.play(a))&&h.push(p)),u&&this._localScreenVideoTrack&&(null===(f=this._localScreenVideoTrack)||void 0===f?void 0:f.manuallyPlay(a))&&h.push()),t===this._audioMixingManager.id&&h.push(this._audioMixingManager.resumeLocalPlay()),v=[],null===(r=this._room)||void 0===r||r.remoteStreams.forEach((function(e,r){t&&t!==r||e.forEach((function(e){e.audioTrack&&v.push(e.audioTrack),e.videoTrack&&v.push(e.videoTrack)}))})),this._publicStreamManager.getRemoteStreams().forEach((function(e,r){t&&t!==r||(e.audioTrack&&v.push(e.audioTrack),e.videoTrack&&v.push(e.videoTrack))})),c||(v=Wb(v).call(v,(function(e){return!!e.isScreen}))),u||(v=Wb(v).call(v,(function(e){return!e.isScreen}))),d||(v=Wb(v).call(v,(function(e){return"audio"!==e.mediaType}))),l||(v=Wb(v).call(v,(function(e){return"video"!==e.mediaType}))),d&&(null===(_=this._room)||void 0===_||_.virtualStreams.forEach((function(e){e.audioTrack&&v.push(e.audioTrack)}))),v.forEach((function(e){var t=e.play(a);t&&h.push(t)})),e.abrupt("return",qS.all(h).then((function(){})));case 23:case"end":return e.stop()}}),e,this)}))),function(e){return ee.apply(this,arguments)})},{key:"stop",value:($=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=v.length>1&&void 0!==v[1]?v[1]:wP.AUDIO_AND_VIDEO,n=v.length>2?v[2]:void 0,i=v.length>3?v[3]:void 0,this.logger.info("stop()","userId: %s, mediaType: %s, streamIndex: %s, playerId: %s",t,r,n,i),o=null!=i?i:CK,a=!t||t===this._getUserId()||"local_user"===t,s=void 0===n||n===CP.STREAM_INDEX_MAIN,c=void 0===n||n===CP.STREAM_INDEX_SCREEN,u=r!==wP.VIDEO,d=r!==wP.AUDIO,a&&d&&(s&&this._localVideoTrack&&this._localVideoTrack.pause(o),c&&this._localScreenVideoTrack&&this._localScreenVideoTrack.pause(o)),t&&(p=[],null===(l=this._room)||void 0===l||null===(h=l.remoteStreams.get(t))||void 0===h||h.forEach((function(e){e.audioTrack&&p.push(e.audioTrack),e.videoTrack&&p.push(e.videoTrack)})),(null==(f=this._publicStreamManager.getRemoteStream(t))?void 0:f.audioTrack)&&p.push(f.audioTrack),(null==f?void 0:f.videoTrack)&&p.push(f.videoTrack),s||(p=Wb(p).call(p,(function(e){return!!e.isScreen}))),c||(p=Wb(p).call(p,(function(e){return!e.isScreen}))),u||(p=Wb(p).call(p,(function(e){return"audio"!==e.mediaType}))),d||(p=Wb(p).call(p,(function(e){return"video"!==e.mediaType}))),p.forEach((function(e){e.pause(o)})));case 12:case"end":return e.stop()}}),e,this)}))),function(e){return $.apply(this,arguments)})},{key:"getAudioVolume",value:function(e,t){nj(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]);var r=0;if(t){var n,i,o,a=null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(o=DC(i).call(i,(function(t){return t.isScreen===(e===CP.STREAM_INDEX_SCREEN)})))||void 0===o?void 0:o.audioTrack;a&&(r=a.getAudioLevel())}else{var s=e===CP.STREAM_INDEX_MAIN?this._localAudioTrack:this._localScreenAudioTrack;s&&(r=s.getAudioLevel())}return{linearVolume:r,nonlinearVolume:NF(r)}}},{key:"pauseAllSubscribedStream",value:(Z=HS(BS().mark((function e(t){var r=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),MF(t)&&(r._pauseAllSubscribeState.audio=!0),DF(t)&&(r._pauseAllSubscribeState.video=!0),this._room){e.next=6;break}return e.abrupt("return",qS.resolve());case 6:return e.abrupt("return",this._pauseAllRemoteStreams(t));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return Z.apply(this,arguments)})},{key:"_pauseAllRemoteStreams",value:(Q=HS(BS().mark((function e(t){var r,n=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._room){e.next=2;break}return e.abrupt("return",qS.resolve());case 2:return r=[],this._room.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){if(e.hasSubscribed){e.attributes.audiostream&&MF(t)&&(n._pauseAllSubscribeState.resumeAudioStreamIds[e.streamId]=e.streamId),e.attributes.videostream&&DF(t)&&(n._pauseAllSubscribeState.resumeVideoStreamIds[e.streamId]=e.streamId);var i=n._unsubscribe(e.isScreen,e.userId,t,!0);i&&r.push(i)}}))})),e.abrupt("return",qS.all(r).then((function(){})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return Q.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(Y=HS(BS().mark((function e(t){var r=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),MF(t)&&(r._pauseAllSubscribeState.audio=!1),DF(t)&&(r._pauseAllSubscribeState.video=!1),this._room){e.next=6;break}return e.abrupt("return",qS.resolve());case 6:return e.next=8,this._triedResumeAllRemoteStreams(t,!1);case 8:return e.abrupt("return");case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Y.apply(this,arguments)})},{key:"_triedResumeAllRemoteStreams",value:(q=HS(BS().mark((function e(t,r){var n,i,o,a=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._room){e.next=2;break}return e.abrupt("return",qS.resolve());case 2:if(!this._pauseAllSubscribeState.audio||t!==wP.AUDIO){e.next=4;break}return e.abrupt("return",qS.resolve());case 4:if(!this._pauseAllSubscribeState.video||t!==wP.VIDEO){e.next=6;break}return e.abrupt("return",qS.resolve());case 6:if(!this._pauseAllSubscribeState.video||!this._pauseAllSubscribeState.audio||t!==wP.AUDIO_AND_VIDEO){e.next=8;break}return e.abrupt("return",qS.resolve());case 8:return n=[],i=jw(ck(this._pauseAllSubscribeState.resumeAudioStreamIds)),o=jw(ck(this._pauseAllSubscribeState.resumeVideoStreamIds)),this._room.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){if(!r||!e.isScreen){var i=a._pauseAllSubscribeState.resumeAudioStreamIds[e.streamId],o=a._pauseAllSubscribeState.resumeVideoStreamIds[e.streamId];if(i&&MF(t)||o&&DF(t)){var s=a._subscribe(e.isScreen,e.userId,t).then((function(){i&&MF(t)&&delete a._pauseAllSubscribeState.resumeAudioStreamIds[e.streamId],o&&DF(t)&&delete a._pauseAllSubscribeState.resumeVideoStreamIds[e.streamId]}));s&&n.push(s)}}}))})),e.abrupt("return",qS.all(n).then((function(){var e;return null===(e=a._room)||void 0===e||e.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){a._updateAudioPlayerState(e),a._updateVideoPlayerState(e)}))})),qS.resolve()})).finally((function(){var e;return null!==(e=a._room)&&void 0!==e&&e.config.tokenSubscribePrivilegeExpired&&(i.forEach((function(e){a._pauseAllSubscribeState.resumeAudioStreamIds[e]=e})),o.forEach((function(e){a._pauseAllSubscribeState.resumeVideoStreamIds[e]=e}))),qS.resolve()})));case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return q.apply(this,arguments)})},{key:"sendUserMessage",value:(J=HS(BS().mark((function e(t,r){var n,i,o,a=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dj(t),vj(r),this._assertNotInRoom(),o=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!1,o,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!1,o,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return J.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(X=HS(BS().mark((function e(t,r){var n,i,o,a=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dj(t),aj(r,"message"),vj(r),this._assertNotInRoom(),o=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!0,o,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!0,o,e),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return X.apply(this,arguments)})},{key:"sendRoomMessage",value:(K=HS(BS().mark((function e(t){var r,n,i,o,a,s=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vj(t),this._assertNotInRoom(),o=null===(r=this._room)||void 0===r?void 0:r.config.roomId,a=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendRoomMessage(t))||void 0===i?void 0:i.then((function(e){return s._messageStatisticsObserver.countRoomMessage(!0,o,!1,a),e})).catch((function(e){throw s._messageStatisticsObserver.countRoomMessage(!1,o,!1,a),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return K.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(W=HS(BS().mark((function e(t){var r,n,i,o,a,s=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return vj(t),this._assertNotInRoom(),o=null===(r=this._room)||void 0===r?void 0:r.config.roomId,a=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendRoomMessage(t,!0))||void 0===i?void 0:i.then((function(e){return s._messageStatisticsObserver.countRoomMessage(!0,o,!0,a),e})).catch((function(e){throw s._messageStatisticsObserver.countRoomMessage(!1,o,!0,a),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return W.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(G=HS(BS().mark((function e(){var t,r=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=r.length>0&&void 0!==r[0]?r[0]:{},this.logger.info("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,sj(t),this._shouldUpdateAudioConf("setAudioCaptureConfig")&&this._ctx.audioProfileManager.updateConstraints(t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return G.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(z=HS(BS().mark((function e(){var t,r=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:{},this.logger.info("setVideoCaptureConfig()","config: %o",t),e.abrupt("return",this._setVideoCaptureConfig(t));case 3:case"end":return e.stop()}}),e,this)}))),function(){return z.apply(this,arguments)})},{key:"_setVideoCaptureConfig",value:(H=HS(BS().mark((function e(){var t,r,n,i=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(delete(r=i.length>0&&void 0!==i[0]?i[0]:{}).deviceId,sj(r),n=ux(ux({},r),{},{deviceId:this._videoStreamConstraints.deviceId}),!this._localVideoTrack){e.next=7;break}return e.next=7,this._localVideoTrack.updateVideoCaptureConfig(n);case 7:return this._videoStreamConstraints=n,e.abrupt("return",(null===(t=this._localVideoTrack)||void 0===t?void 0:t.originTrack.getSettings())||{});case 9:case"end":return e.stop()}}),e,this)}))),function(){return H.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){var t;return this.logger.info("enableSimulcastMode()","enabled: %o",e),!(rB||lB||14===(null==RB?void 0:RB[0])||(this._enableSimulcast=e,null!==(t=this._room)&&void 0!==t&&t.hasPublished&&BF("You must call this API before publishing the video streams"),0))}},{key:"setVideoEncoderConfig",value:(j=HS(BS().mark((function e(t){var r,n,i,o,a;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(this.logger.info("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),gj(t=Wb(t).call(t,(function(e){return!!e}))),t.length>3&&(BF("setVideoEncoderConfig: You can set parameters for up to 3 streams"),t=LC(t).call(t,0,3)),n=1;n<t.length;n++)i=jF(t[0].width)/jF(t[n].width)||1,Math.floor(i)!==i&&BF("setVideoEncoderConfig: The resolution setting needs to be an integer multiple");return zO(t).call(t,(function(e,t){return t.maxKbps-e.maxKbps})),this._localVideoTrack&&null!==(o=t[0])&&void 0!==o&&o.contentHint&&this._localVideoTrack.setContentHint(null===(a=t[0])||void 0===a?void 0:a.contentHint),e.next=10,this._setVideoCaptureConfig(ux({},t[0]));case 10:this._videoStreamEncodeConfig=t,this._updateDummyCaptureImage(CP.STREAM_INDEX_MAIN),null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 13:case"end":return e.stop()}}),e,this)}))),function(e){return j.apply(this,arguments)})},{key:"setVideoEncoderAutoConfigList",value:function(e){if(Array.isArray(e))return zO(e).call(e,(function(e,t){return e.maxKbps-t.maxKbps})),YB(e)}},{key:"autoResetVideoEncoderConfig",value:function(e){var t,r=qB;if(r.length){this._videoStreamEncodeConfig.length||(this._videoStreamEncodeConfig=[QB]);var n=this._videoStreamEncodeConfig[0],i=e.width||jF(n.width),o=e.height||jF(n.height),a=i*o;if(!(jF(n.width)*jF(n.height)<=a)){var s,c,u=r[0];r.forEach((function(e){var t=jF(e.width)*jF(e.height);s||(a<t?s=e:u=e)})),c=s&&jF(s.width)*jF(s.height)-a<a-jF(u.width)*jF(u.height)?QR({},s):QR({},u),this._videoStreamEncodeConfig=Wb(t=this._videoStreamEncodeConfig).call(t,(function(e){return!(c&&jF(e.width)*jF(e.height)>=a&&(c.maxKbps=Math.min(e.maxKbps,c.maxKbps),1))})),this._videoStreamEncodeConfig.unshift({width:i,height:o,frameRate:e.frameRate?Math.round(e.frameRate):this._videoStreamEncodeConfig[0].frameRate,maxKbps:c.maxKbps}),this.logger.print("autoResetVideoEncoderConfig() result",ZS(this._videoStreamEncodeConfig)),qV(this.id,"autoResetVideoEncoderConfig",ZS(this._videoStreamEncodeConfig))}}}},{key:"setScreenEncoderConfig",value:(B=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.info("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],!this._localScreenVideoTrack){e.next=7;break}if("16.1"===IB){e.next=6;break}return e.next=6,this._localScreenVideoTrack.updateVideoCaptureConfig(t);case 6:t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint);case 7:this._updateDummyCaptureImage(CP.STREAM_INDEX_SCREEN),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 9:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){var n=this;if(this.logger.info("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),!tH())return BF("Your browser does not support sending SEI"),!1;nj(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),tj(r,"repeatCount",0,30);var i,o="string"==typeof t?new Uint8Array(IF.str2ab(t)):t;if(!t.length)return this.logger.warn("sei message must not be empty"),!1;if(e===CP.STREAM_INDEX_MAIN){var a,s,c,u;if(!(null!==(a=this._room)&&void 0!==a&&null!==(s=a.localStream)&&void 0!==s&&s.pubAudio||null!==(c=this._room)&&void 0!==c&&null!==(u=c.localStream)&&void 0!==u&&u.pubVideo))return;i=this._room.localStream}else{var d,l,h,p;if(!(null!==(d=this._room)&&void 0!==d&&null!==(l=d.localScreenStream)&&void 0!==l&&l.pubAudio||null!==(h=this._room)&&void 0!==h&&null!==(p=h.localScreenStream)&&void 0!==p&&p.pubVideo))return;i=this._room.localScreenStream}if(o.byteLength>4096)this.logger.warn("sei size must not bigger than 4KB");else{var f;mB||null===(f=this._room)||void 0===f||f.maybeFillBackFrame2Stream(i);var v=EF();i.seiList.push({content:o,uuid:v,repeatCount:r+1}),setTimeout((function(){var e;if(i){var r,o=$O(e=i.seiList).call(e,(function(e){return e.uuid===v}));o>=0&&(mw(r=i.seiList).call(r,o,1),console.error("[RTC WebSDK] sei timeout for message: %o",t),n.monitor.report("rtc_sdk_callback",{sdk_callback_name:"sendSEIMessage",message:"timeout for message: ".concat(t),error_code:400}))}}),XB("SEI_TIME_OUT"))}}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;this.logger.info("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,n;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n;if(0!==e.length){var i=DC(e).call(e,(function(e){return!e.isScreen})),o=null==i||null===(n=i.audioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t,volume:o||0})}}));var i=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t._getUserId(),volume:i||0}),t.safeEmit(QF.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n,i=e[0],o=wE(t).call(t,(function(e,t){return e&&e.audioPropertiesInfo.nonlinearVolume>t.audioPropertiesInfo.nonlinearVolume?e:t}),void 0);(r=i?o?i.audioPropertiesInfo.nonlinearVolume>o.audioPropertiesInfo.nonlinearVolume?i:o:i:o)&&r.audioPropertiesInfo.nonlinearVolume>-35&&(n=r.streamKey?this._room.remoteUsers.get(r.streamKey.userId):this._room.config.userInfo)&&this.safeEmit(QF.onActiveSpeaker,{userId:n.userId,extraInfo:n.extraInfo})}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger.info("enableAudioPropertiesReport()","config %o: ",t);var r=t.enableInBackground,n=void 0===r||r,i=t.localMainReportMode,o=void 0===i?NP.NORMAL:i,a=t.audioReportMode,s=void 0===a?MP.MICROPHONE:a,c=t.interval,u=void 0===c?100:c;this._stopAudioPropertiesReport(),u<=0||(u=Math.max(100,u),this._audioPropertiesReportTimer=self.setInterval((function(){if(n||"hidden"!==document.visibilityState){var t=[],r=e._audioDeviceManager.getRecordTrack()||e._localAudioTrack;if(r){var i,a,c=null===(i=e._room)||void 0===i||null===(a=i.localStream)||void 0===a?void 0:a.audioHasPublish,u=!!e._audioDeviceManager.getRecordTrack(),d=r.getAudioLevel(s),l=NF(d),h={streamIndex:CP.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:d,nonlinearVolume:l}};if(c||u)t.push(h);else switch(o){case NP.DISCONNECT:break;case NP.RESET:h.audioPropertiesInfo.linearVolume=0,h.audioPropertiesInfo.nonlinearVolume=-127,t.push(h);break;case NP.NORMAL:t.push(h);break;default:throw new rN(_P.INVALID_PARAMS,"invalid localMainReportMode: ".concat(o," in config"))}}if(e._localScreenAudioTrack){var p=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:CP.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:p,nonlinearVolume:NF(p)}})}if(e.safeEmit(QF.onLocalAudioPropertiesReport,t),e._room){var f=[];e._room.config.isMultiChatMode()?e._room.getActiveSpeakerInMultiChatMode().forEach((function(t){var r,n,i=255*t.audioLevel;f.push({streamKey:{userId:t.userId,streamIndex:CP.STREAM_INDEX_MAIN,roomId:null!==(r=null===(n=e._room)||void 0===n?void 0:n.config.roomId)&&void 0!==r?r:""},audioPropertiesInfo:{linearVolume:i,nonlinearVolume:NF(i)}})})):e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,o=t.audioTrack.getAudioLevel();f.push({streamKey:{userId:r,streamIndex:t.isScreen?CP.STREAM_INDEX_SCREEN:CP.STREAM_INDEX_MAIN,roomId:null!==(n=null===(i=e._room)||void 0===i?void 0:i.config.roomId)&&void 0!==n?n:""},audioPropertiesInfo:{linearVolume:o,nonlinearVolume:NF(o)}})}}))})),e.safeEmit(QF.onRemoteAudioPropertiesReport,f),e._sendActiveSpeaker(t,Wb(f).call(f,(function(e){return e.streamKey.streamIndex!==CP.STREAM_INDEX_SCREEN})))}}}),u))}},{key:"setVideoSourceType",value:(F=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I,R,C;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),nj(t,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),nj(r,"VideoSourceType",[gP.VIDEO_SOURCE_TYPE_EXTERNAL,gP.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===CP.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,this.logger.print("setVideoSourceType",JS(i="set ".concat(n," source type to ")).call(i,r)),!this._localVideoTrack||t!==CP.STREAM_INDEX_MAIN){e.next=17;break}if(u=!1,r===gP.VIDEO_SOURCE_TYPE_EXTERNAL&&(u=!0,(d=this._extensionManager.getPluginByName(cK.PRE_PROCESSING,"RTCBeautyExtension"))&&d.emit("stop"),this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.destroy()),null===(o=this._localVideoTrack)||void 0===o||o.destroy(),this._localVideoTrack=void 0,l=null===(a=this._room)||void 0===a?void 0:a.config.isAutoPublish,u?null===(h=this._room)||void 0===h||null===(p=h.localStream)||void 0===p||null===(f=p.observer)||void 0===f||f.setEnableVideo(!1):null===(v=this._room)||void 0===v||null===(_=v.localStream)||void 0===_||null===(m=_.observer)||void 0===m||m.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&null!==(c=s.localStream)&&void 0!==c&&c.pubVideo||l)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==CP.STREAM_INDEX_SCREEN){e.next=26;break}if(b=!1,r===gP.VIDEO_SOURCE_TYPE_EXTERNAL&&(b=!0,this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.destroy()),null===(g=this._localScreenVideoTrack)||void 0===g||g.destroy(),this._localScreenVideoTrack=void 0,b?null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setEnableVideo(!1):null===(I=this._room)||void 0===I||null===(R=I.localScreenStream)||void 0===R||null===(C=R.observer)||void 0===C||C.setPushVideo(!1),null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||!S.pubVideo){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return F.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(V=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.print("setExternalVideoTrack()","index: %o, track: %o",t,r),nj(t,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),ij(r),t!==CP.STREAM_INDEX_MAIN){e.next=16;break}if(this._trackSourceType.video===gP.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new rN(_P.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,XK(r,this._extensionManager);case 8:if(this._localVideoTrack=e.sent,!r.contentHint&&null!==(n=this._videoStreamEncodeConfig[0])&&void 0!==n&&n.contentHint&&this._localVideoTrack.setContentHint(null===(s=this._videoStreamEncodeConfig[0])||void 0===s?void 0:s.contentHint),this._initLocalTrackEvents(this._localVideoTrack),this._localVideoPlayerConfig[CP.STREAM_INDEX_MAIN].forEach((function(e){var t,r;null===(t=f._localVideoTrack)||void 0===t||t.setPlayer(f.id,e,f._mirrorType,null===(r=f._config)||void 0===r?void 0:r.autoPlayPolicy,f._initPlayerEvents.bind(f))})),c=null===(i=this._room)||void 0===i?void 0:i.config.isAutoPublish,!(null!==(o=this._room)&&void 0!==o&&null!==(a=o.localStream)&&void 0!==a&&a.pubVideo||c)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(t!==CP.STREAM_INDEX_SCREEN){e.next=28;break}if(this._trackSourceType.screenVideo===gP.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=19;break}throw new rN(_P.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 19:return e.next=21,QK(r,this._extensionManager);case 21:if(this._localScreenVideoTrack=e.sent,this._initLocalTrackEvents(this._localScreenVideoTrack,!0),this._localVideoPlayerConfig[CP.STREAM_INDEX_SCREEN].forEach((function(e){var t,r;null===(t=f._localScreenVideoTrack)||void 0===t||t.setPlayer(f.id,e,f._mirrorType,null===(r=f._config)||void 0===r?void 0:r.autoPlayPolicy,f._initPlayerEvents.bind(f))})),null===(u=this._room)||void 0===u||null===(d=u.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushVideo(!0),null===(h=this._room)||void 0===h||null===(p=h.localScreenStream)||void 0===p||!p.pubVideo){e.next=28;break}return e.next=28,this._updateScreenPublish();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t){return V.apply(this,arguments)})},{key:"setAudioSourceType",value:(U=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),nj(t,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),nj(r,"audioSourceType",[yP.AUDIO_SOURCE_TYPE_EXTERNAL,yP.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===CP.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,this.logger.print("setVideoSourceType",JS(i="set ".concat(n," source type to ")).call(i,r)),!this._localAudioTrack||t!==CP.STREAM_INDEX_MAIN){e.next=16;break}if(c=!1,this._trackSourceType.audio===yP.AUDIO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.destroy()),this._localAudioTrack=void 0,u=null===(o=this._room)||void 0===o?void 0:o.config.isAutoPublish,c?null===(d=this._room)||void 0===d||null===(l=d.localStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setEnableAudio(!1):null===(p=this._room)||void 0===p||null===(f=p.localStream)||void 0===f||null===(v=f.observer)||void 0===v||v.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&null!==(s=a.localStream)&&void 0!==s&&s.pubAudio||u)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==CP.STREAM_INDEX_SCREEN){e.next=24;break}if(g=!1,this._trackSourceType.audio===yP.AUDIO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.destroy()),this._localScreenAudioTrack=void 0,g?null===(y=this._room)||void 0===y||null===(S=y.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setEnableAudio(!1):null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushAudio(!1),null===(_=this._room)||void 0===_||null===(m=_.localScreenStream)||void 0===m||!m.pubAudio){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return U.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(L=HS(BS().mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.print("setExternalAudioTrack()","index: %o, track: %o",t,r),nj(t,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),ij(r),t!==CP.STREAM_INDEX_MAIN){e.next=16;break}if(this._trackSourceType.audio===yP.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new rN(_P.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,qK(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._localAudioTrack.setVolume(this._localAudioVolume),this._initLocalTrackEvents(this._localAudioTrack),u=null===(n=this._room)||void 0===n?void 0:n.config.isAutoPublish,null===(i=this._room)||void 0===i||null===(o=i.localStream)||void 0===o||null===(a=o.observer)||void 0===a||a.setPushAudio(!0),!(null!==(s=this._room)&&void 0!==s&&null!==(c=s.localStream)&&void 0!==c&&c.pubAudio||u)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(t!==CP.STREAM_INDEX_SCREEN){e.next=28;break}if(this._trackSourceType.screenAudio===yP.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=19;break}throw new rN(_P.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 19:return e.next=21,$K(r,this._extensionManager);case 21:if(this._localScreenAudioTrack=e.sent,this._localScreenAudioTrack.setVolume(this._localScreenAudioVolume),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(d=this._room)||void 0===d||null===(l=d.localScreenStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setPushAudio(!0),null===(p=this._room)||void 0===p||null===(f=p.localScreenStream)||void 0===f||!f.pubAudio){e.next=28;break}return e.next=28,this._updateScreenPublish();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t){return L.apply(this,arguments)})},{key:"login",value:(D=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("login()","token: %o, userInfo: %o",t,r),cj(t)||rj(t,"token"),dj(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return D.apply(this,arguments)})},{key:"logout",value:(M=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return M.apply(this,arguments)})},{key:"updateLoginToken",value:(N=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("updateLoginToken()","token: %o",t),cj(t)||rj(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return N.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(P=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("getPeerOnlineStatus()","userId: %o",t),dj(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return P.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(O=HS(BS().mark((function e(t,r){var n,i=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dj(t),vj(r),n=Date.now(),e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!1,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(x=HS(BS().mark((function e(t,r){var n,i=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dj(t),aj(r,"message"),vj(r),n=Date.now(),e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!0,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return x.apply(this,arguments)})},{key:"setServerParams",value:(A=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.info("setServerParams()","signature: %o, url: %0",t,r),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"sendServerMessage",value:(w=HS(BS().mark((function e(t){var r,n=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return rj(t,"message"),vj(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!1,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!1,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return w.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(C=HS(BS().mark((function e(t){var r,n=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return aj(t,"message"),vj(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!0,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!0,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return C.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new rN(_P.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");this.logger.info("startCloudProxy()",e),rj(e.logProxy,"logProxy"),rj(e.accessProxy,"accessProxy"),rj(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=XB("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=XB("LOG_SERVER_URL"),this._originConfigServerUrls=XB("CONFIG_REQUEST_DOMAINS"),KB("ICE_CONFIG_REQUEST_URLS",e.accessProxy),KB("LOG_SERVER_URL",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://".concat(e)),"".concat(e,"/video/v1/webrtc_log/")}(e.logProxy)),KB("CONFIG_REQUEST_DOMAINS",[e.configProxy]),VB.clearAccessNode(this._appId),VB.clearAccessUrls(),this._ctx.useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){var e,t,r;if(this._room)throw new rN(_P.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");this.logger.info("stopCloudProxy()");var n=null===(e=this._originIceConfigRequestUrls)||void 0===e?void 0:ob(e).call(e,(function(e){return e.replace("https://","").replace("/dispatch/v1/AccessInfo?Action=GetAccessInfo","")}));KB("ICE_CONFIG_REQUEST_URLS",null!=n?n:[]),KB("LOG_SERVER_URL",null!==(t=this._originLogServerUrl)&&void 0!==t?t:""),KB("CONFIG_REQUEST_DOMAINS",null!==(r=this._originConfigServerUrls)&&void 0!==r?r:[]),VB.clearAccessNode(this._appId),VB.clearAccessUrls(),this._ctx.useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(R=HS(BS().mark((function e(t,r){var n,i,o,a=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),lj(t),this._assertNotInRoom(),!this._publicStreamIds.get(t)){e.next=5;break}throw new rN(_P.REPEAT_PUSH,"repeat push public media stream");case 5:return o=JB(t,"started",r),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.publicStreamControlMessage(o))||void 0===i?void 0:i.then((function(){a._publicStreamIds.set(t,t)})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(I=HS(BS().mark((function e(t,r){var n,i;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),lj(t),this._assertNotInRoom(),i=JB(t,"layoutChanged",r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.publicStreamControlMessage(i));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"stopPushPublicStream",value:(T=HS(BS().mark((function e(t){var r,n=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.print("startPushPublicStream()","publicStreamId: %o",t),lj(t),this._assertNotInRoom(),e.abrupt("return",null===(r=this._room)||void 0===r?void 0:r.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){n._publicStreamIds.delete(t)})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"startPlayPublicStream",value:(k=HS(BS().mark((function e(t){var r,n,i,o,a,s,c,u;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return lj(t),e.next=3,this._publicStreamManager.startPlayPublicStream(t);case 3:n=e.sent,(i=this._publicVideoPlayerConfig.get(t))&&(null===(o=n.videoTrack)||void 0===o||o.setPlayer(this.id,i,null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy,this._initPlayerEvents.bind(this))),null===(r=n.videoTrack)||void 0===r||r.play(CK),n.audioTrack&&(u=new C2(this.id,t,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===WP.VIDEO_ONLY||(null===(c=this._config)||void 0===c?void 0:c.autoPlayPolicy)===WP.PLAY_MANUALLY,isScreen:!1}),n.audioTrack.setPlayer(u),this._initPlayerEvents(u,!0),u.playAudio(n.audioTrack));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(E=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._publicStreamManager.stopPlayPublicStream(t),null==(n=this._publicStreamManager.getRemoteStream(t))||null===(r=n.audioTrack)||void 0===r||r.stop();case 3:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"setAudioProfile",value:(b=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.logger.info("setAudioProfile()","profile: %o",t),this._shouldUpdateAudioConf("setAudioProfile")&&this._ctx.audioProfileManager.setAudioProfile(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"setAudioEncodeMaxBitrate",value:(S=HS(BS().mark((function e(t){var r,n,i,o,a,s;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.print("setAudioEncodeMaxBitrate()",t),tj(t,"maxBitrate",6,256),this._ctx.audioProfileManager.setCustomMaxBitrate(t),!this._ctx.audioProfileManager.customMaxBitrate){e.next=10;break}if(!rB||!(null!==(r=this._room)&&void 0!==r&&null!==(n=r.localStream)&&void 0!==n&&n.pubAudio||null!==(i=this._room)&&void 0!==i&&null!==(o=i.localScreenStream)&&void 0!==o&&o.pubAudio)){e.next=6;break}throw new rN(_P.NOT_SUPPORTED,"Your browser does not support set audio encode maxBitrate dynamically.");case 6:return e.next=8,null===(a=this._room)||void 0===a?void 0:a.setAudioEncodeMaxBitrate(CP.STREAM_INDEX_MAIN,t);case 8:return e.next=10,null===(s=this._room)||void 0===s?void 0:s.setAudioEncodeMaxBitrate(CP.STREAM_INDEX_SCREEN,t);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,i,o;this.logger.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var a=this._publicStreamManager.getRemoteStream(e);if(null===(r=this._publicVideoPlayerConfig.get(e))||void 0===r||null===(n=r.player)||void 0===n||n.destroy(),t.renderDom){var s=new R2(this._ctx.id,CK,ux(ux({},t),{},{isLocal:!1,userId:e})),c=ux(ux({},t),{},{player:s});this._publicVideoPlayerConfig.set(e,c),null==a||null===(i=a.videoTrack)||void 0===i||i.setPlayer(this.id,ux({},c),null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy,this._initPlayerEvents.bind(this))}else this._publicVideoPlayerConfig.delete(e)}},{key:"setDummyCaptureImagePath",value:(y=HS(BS().mark((function e(t,r){var n=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new qS((function(e,i){rj(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){t===CP.STREAM_INDEX_MAIN?n._dummyMainImage=o:n._dummyScreenImage=o;try{n._updateDummyCaptureImage(t),e()}catch(e){i(new rN(_P.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){i(new rN(_P.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return y.apply(this,arguments)})},{key:"_updateDummyCaptureImage",value:function(e){var t,r;if(e===CP.STREAM_INDEX_MAIN?(t=this._dummyMainImage,r=this._videoStreamEncodeConfig[0]):(t=this._dummyScreenImage,r=this._screenStreamEncodeConfig[0]),t){var n,i,o=document.createElement("canvas"),a=o.getContext("2d"),s=jF(r.width),c=jF(r.height);if(!a)throw new rN(_P.UNEXPECTED_ERROR,"Not support canvas");!s||!c||t.width<=s&&t.height<=c?(n=t.width,i=t.height):(n=Math.min(s,t.width*c/t.height),i=Math.min(c,t.height*s/t.width)),o.width=n,o.height=i,a.drawImage(t,0,0,t.width,t.height,0,0,n,i);var u=window.setInterval((function(){t&&a.drawImage(t,0,0,t.width,t.height,0,0,n,i)}),200);e===CP.STREAM_INDEX_MAIN?(clearInterval(this._dummyMainTimer),this._dummyMainTimer=u):(clearInterval(this._dummyScreenTimer),this._dummyScreenTimer=u);var d,l,h=o.captureStream(5).getVideoTracks()[0];e===CP.STREAM_INDEX_MAIN?(this._localImgVideoTrack=h,null!==(d=this._localVideoTrack)&&void 0!==d&&d.dummy&&this._localVideoTrack.setTrack(this._localImgVideoTrack,this._extensionManager)):(this._localImgScreenTrack=h,null!==(l=this._localScreenVideoTrack)&&void 0!==l&&l.dummy&&this._localScreenVideoTrack.setTrack(this._localImgScreenTrack,this._extensionManager))}}},{key:"_addListenExtensionEvent",value:function(e){var t=this;e.on("re-capture-audio",(function(){t._localAudioTrack&&t.stopAudioCapture().then((function(){t.startAudioCapture()}))})),e.on("re-capture-video",(function(){t._localVideoTrack&&!t._localVideoTrack.dummy&&t.stopVideoCapture().then((function(){t.startVideoCapture()}))})),e.on("reset-video-effect",function(){var e=HS(BS().mark((function e(r,n){var i,o;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t._localVideoTrack||t._localVideoTrack.dummy){e.next=18;break}return t._localVideoTrack&&t._removeLocalTrackEvents(t._localVideoTrack),e.prev=2,e.next=5,t._localVideoTrack.generatePreProcessingTrack();case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(2),n(e.t0);case 10:if(t._initLocalTrackEvents(t._localVideoTrack),t._localVideoTrack.stopAll(),t._localVideoTrack.playAll(),t.safeEmit(QF.onLocalStreamTrackChangedByExtension,{streamIndex:CP.STREAM_INDEX_MAIN,type:"video"}),r(),null===(i=t._room)||void 0===i||null===(o=i.localStream)||void 0===o||!o.pubVideo){e.next=18;break}return e.next=18,t._updatePublish();case 18:r();case 19:case"end":return e.stop()}}),e,null,[[2,7]])})));return function(t,r){return e.apply(this,arguments)}}())}},{key:"registerExtension",value:(g=HS(BS().mark((function e(t){var r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.monitor=this.monitor,e.prev=1,e.next=4,t.isSupported();case 4:if(e.sent){e.next=7;break}throw new Error("This extension is not supported.");case 7:e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(1),new Error("This extension is not supported.");case 12:return e.next=14,t.init({videoCaptureConfig:this._videoStreamConstraints});case 14:this._extensionManager.register(t),this._addListenExtensionEvent(t),null===(r=this._localAudioTrack)||void 0===r||r.generatePreProcessingTrack(),null===(n=this._localVideoTrack)||void 0===n||n.generatePreProcessingTrack();case 18:case"end":return e.stop()}}),e,this,[[1,9]])}))),function(e){return g.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(ZS(K2.getDefaultValue()))}},{key:"_updatePublish",value:(m=HS(BS().mark((function e(){var t,r,n,i,o=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:{},r=o.length>1&&void 0!==o[1]&&o[1],this.logger.info("_updatePublish()","config: %o",t),n={mediaType:void 0,invokeByJoinRoom:!1,pubState:cX.PUB},t=ux(ux({},n),t),this._ctx.visibility){e.next=7;break}throw new rN(_P.NO_PUBLISH_PERMISSION,"no publish permission");case 7:return e.next=9,this._pubLock.lock();case 9:if(i=e.sent,this._room&&this._ctx.signalingManager.isConnected()){e.next=17;break}if(i(),!r){e.next=16;break}throw new rN(_P.NOT_CONNECTED_YET,"not connected");case 16:return e.abrupt("return");case 17:return e.prev=17,e.next=20,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,t.mediaType,t.pubState,t.invokeByJoinRoom);case 20:e.next=30;break;case 22:if(e.prev=22,e.t0=e.catch(17),!(e.t0 instanceof rN)){e.next=29;break}throw e.t0.code===_P.TOKEN_NO_PUBLISH_PERMISSION&&this._room.config.setTokenPublishPrivilegeExpired(!0),e.t0;case 29:throw new rN(_P.UNEXPECTED_ERROR,"unexpected error",e.t0);case 30:return e.prev=30,i(),e.finish(30);case 33:case"end":return e.stop()}}),e,this,[[17,22,30,33]])}))),function(){return m.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(_=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),rj(t,"filePath"),tj(r,"indicationInterval"),e.next=5,this._audioDeviceManager.startAudioPlaybackDeviceTest(t,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this.logger.info("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(v=HS(BS().mark((function e(t,r){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),tj(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t,r,this._localAudioVolume);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){this.logger.info("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){this.logger.info("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;this.logger.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{dj(e),nj(t,"priority",[BP.HIGH,BP.MEDIUM,BP.LOW])}catch(e){return console.warn(e),!1}return this._ctx.userPriority.set(e,t),null===(r=this._room)||void 0===r||r.updateRemoteUserPriority(e),!0}},{key:"takeLocalSnapshot",value:(f=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.print("takeLocalSnapshot()","streamIndex: %o",t),nj(t,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),r=t===CP.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new rN(_P.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return e.abrupt("return",r.snapshot());case 6:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(p=HS(BS().mark((function e(t,r){var n,i,o,a,s;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.logger.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),rj(t,"id"),nj(r,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),s=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(o=DC(i).call(i,(function(e){return e.isScreen===(r===CP.STREAM_INDEX_SCREEN)})))||void 0===o?void 0:o.videoTrack)||(null===(a=this._publicStreamManager.getRemoteStream(t))||void 0===a?void 0:a.videoTrack)){e.next=6;break}throw new rN(_P.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",s.snapshot());case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){this.logger.info("setSubscribeFallbackOption()","option: %o",e);try{nj(e,"option",[FP.DISABLE,FP.VIDEO_STREAM_LOW,FP.AUDIO_ONLY])}catch(e){return console.warn(e),!1}return!this._room&&(this._ctx.subscribeFallbackOption=e,!0)}},{key:"getLocalStreamTrack",value:function(e,t){var r,n,i=this;if(e===CP.STREAM_INDEX_MAIN?(r="video"===t?this.localVideoTrack:this.localAudioTrack,n=function(){var e;return null===(e=i._room)||void 0===e?void 0:e.localStream}):(r="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,n=function(){var e;return null===(e=i._room)||void 0===e?void 0:e.localScreenStream}),r){var o=r instanceof SK&&r.mixedAudioTrack?r.mixedAudioTrack:r.preprocessingTrack;if(o){var a=n();return this._reportMsTrackEvent(o,(null==a?void 0:a.stream.id)||"local"),o}}}},{key:"getRemoteStreamTrack",value:function(e,t,r){var n,i,o,a,s,c,u,d=(null===(n=this._room)||void 0===n?void 0:n.remoteStreams.get(e))||[];if(null!=d&&d.length&&(t===CP.STREAM_INDEX_MAIN?(o=DC(d).call(d,(function(e){return!e.isScreen})),i="video"===r?null===(a=o)||void 0===a?void 0:a.videoTrack:null===(s=o)||void 0===s?void 0:s.audioTrack):(o=DC(d).call(d,(function(e){return e.isScreen})),i="video"===r?null===(c=o)||void 0===c?void 0:c.videoTrack:null===(u=o)||void 0===u?void 0:u.audioTrack),i)){var l=i.preprocessingTrack;if(l&&o){var h=o.streamId;return this._reportMsTrackEvent(l,h),l}}}},{key:"getPublicStreamTrack",value:function(e,t){var r=this._publicStreamManager.getRemoteStream(e);if(r){var n="video"===t?r.videoTrack:r.audioTrack;if(n){var i=n.preprocessingTrack;if(i){var o=r.streamId;return this._reportMsTrackEvent(i,o),i}}}}},{key:"setRemoteStreamRenderSync",value:function(e){return!this._room&&(this._ctx.avSync=!!e,!0)}},{key:"setJoinRoomParams",value:function(e){e&&(this._ctx.joinRoomParams=e)}},{key:"setAudioSelectionConfig",value:(h=HS(BS().mark((function e(t){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(nj(t,"audioSelectionPriority",[ZP.DEFAULT,ZP.HIGH]),this._ctx.mediaParams||(this._ctx.mediaParams={}),this._ctx.mediaParams.audioSelectionConfig={isHighPriority:t===ZP.HIGH},!this._room){e.next=6;break}return e.next=6,this._room.updateMediaParams(this._ctx.mediaParams);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"setCaptureVolume",value:function(e,t){var r,n,i,o,a,s=this;nj(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),t=yj(t,"volume",0,400),e===CP.STREAM_INDEX_SCREEN?(null===(r=this._localScreenAudioTrack)||void 0===r||r.once("needReplaceTrack",(function(){var e;null===(e=s._room)||void 0===e||e.updatePubScreenTrack()})),null===(n=this._localScreenAudioTrack)||void 0===n||n.setVolume(t),this._localScreenAudioVolume=t):(null===(i=this._localAudioTrack)||void 0===i||i.once("needReplaceTrack",(function(){var e;null===(e=s._room)||void 0===e||e.updatePubTrack()})),null===(o=this._localAudioTrack)||void 0===o||o.setVolume(t),null===(a=this._audioDeviceManager.audioTrack)||void 0===a||a.setVolume(t),this._localAudioVolume=t)}},{key:"setPlaybackVolume",value:function(e,t,r){var n,i,o,a;if(dj(e),nj(t,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),r=yj(r,"volume",0,400),null!==(n=this._room)&&void 0!==n&&n.config.isMultiChatMode())BF("setPlaybackVolume is not supported in Conference mode");else{var s=t===CP.STREAM_INDEX_SCREEN;s?this._remoteScreenAudioVolume.set(e,r):this._remoteAudioVolume.set(e,r);var c=null===(i=this._room)||void 0===i||null===(o=i.remoteStreams.get(e))||void 0===o?void 0:DC(o).call(o,(function(e){return e.isScreen===s}));null==c||null===(a=c.audioTrack)||void 0===a||a.setVolume(r)}}},{key:"setPublicStreamVolume",value:function(e,t){var r,n;rj(e,"publicStreamId"),t=yj(t,"volume",0,400),this._publicAudioVolume.set(e,t),null===(r=this._publicStreamManager.getRemoteStream(e))||void 0===r||null===(n=r.audioTrack)||void 0===n||n.setVolume(t)}},{key:"startForwardStreamToRooms",value:(l=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.forEach((function(e){uj(e.roomId)})),this._assertNotInRoom(),e.next=4,this._room.startForwardStream2Rooms(t);case 4:return r=e.sent,e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"updateForwardStreamToRooms",value:(d=HS(BS().mark((function e(t){var r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.forEach((function(e){uj(e.roomId)})),this._assertNotInRoom(),e.next=4,this._room.updateForwardStream2Rooms(t);case 4:return r=e.sent,e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"stopForwardStreamToRooms",value:(u=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._assertNotInRoom(),e.next=3,this._room.stopForwardStream2Rooms();case 3:return t=e.sent,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"pauseForwardStreamToAllRooms",value:(c=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._assertNotInRoom(),e.next=3,this._room.pauseForwardStream2AllRooms();case 3:return t=e.sent,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"resumeForwardStreamToAllRooms",value:(s=HS(BS().mark((function e(){var t;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._assertNotInRoom(),e.next=3,this._room.resumeForwardStream2AllRooms();case 3:return t=e.sent,e.abrupt("return",t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"ambulance",value:(a=HS(BS().mark((function e(){var t,r;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E3(this);case 2:return t=e.sent,r=ZS(t),this.monitor.reportLongString("ambulance",r),e.abrupt("return",t);case 6:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"_reportMsTrackEvent",value:function(e,t){var r=this;if(!e.hookStop){e.hookStop=!0;var n=e.stop;e.stop=function(){qV(r.id,"stop",t,0,t),n.call(e)}}}},{key:"_updateScreenPublish",value:(o=HS(BS().mark((function e(){var t,r,n,i=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},this.logger.info("_updateScreenPublish()"),r={mediaType:void 0,pubState:cX.PUB},t=ux(ux({},r),t),this._ctx.visibility){e.next=6;break}throw new rN(_P.NO_PUBLISH_PERMISSION,"no publish permission");case 6:return e.next=8,this._pubLock.lock();case 8:if(n=e.sent,this._room&&this._ctx.signalingManager.isConnected()){e.next=12;break}return n(),e.abrupt("return");case 12:return e.prev=12,e.next=15,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,t.mediaType,t.pubState);case 15:e.next=24;break;case 17:if(e.prev=17,e.t0=e.catch(12),!(e.t0 instanceof rN)){e.next=23;break}throw e.t0;case 23:throw new rN(_P.UNEXPECTED_ERROR,"unexpected error",e.t0);case 24:return e.prev=24,n(),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[12,17,24,27]])}))),function(){return o.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){var t;this.logger.info("_updateAudioPlayerState()");var r=e.userId,n=e.isScreen,i=null===(t=e.audioTrack)||void 0===t?void 0:t.dangerousGetPlayer();if(e.audioTrack&&e.attributes.audiostream&&e.subAudio){var o,a;if(!i){var s,c;i=new C2(this.id,r,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===WP.VIDEO_ONLY||(null===(c=this._config)||void 0===c?void 0:c.autoPlayPolicy)===WP.PLAY_MANUALLY,isScreen:n}),this._initPlayerEvents(i,!1,n?CP.STREAM_INDEX_SCREEN:CP.STREAM_INDEX_MAIN),e.audioTrack.setPlayer(i);var u=this._audioDeviceManager.getSinkId();u&&i.setPlaybackDevice(u)}i.playAudio(e.audioTrack),e.audioTrack.setPlayer(i);var d,l,h=n?null!==(o=this._remoteScreenAudioVolume.get(r))&&void 0!==o?o:100:null!==(a=this._remoteAudioVolume.get(r))&&void 0!==a?a:100;if(e.audioTrack.setVolume(h),nB&&hB)!function(e){W2&&clearTimeout(W2),W2=setTimeout((function(){var t,r=Ab(e);try{for(r.s();!(t=r.n()).done;){var n=xb(t.value,2),i=n[0],o=n[1];null!=i&&vP(i).call(i,"mux")&&o.forEach((function(e){var t;null===(t=e.audioTrack)||void 0===t||t.pause()}))}}catch(e){r.e(e)}finally{r.f()}var a,s=Ab(e);try{for(s.s();!(a=s.n()).done;){var c=xb(a.value,2),u=c[0],d=c[1];null!=u&&vP(u).call(u,"mux")&&d.forEach((function(e){var t;null===(t=e.audioTrack)||void 0===t||t.play()}))}}catch(e){s.e(e)}finally{s.f()}}),2e3)}(null!==(d=null===(l=this._room)||void 0===l?void 0:l.remoteStreams)&&void 0!==d?d:new DR)}else{var p;null===(p=i)||void 0===p||p.stop()}}},{key:"_updateVideoPlayerState",value:function(e){if(this.logger.info("_updateVideoPlayerState()"),e.videoTrack){var t=this._remoteVideoPlayerConfig[e.isScreen?CP.STREAM_INDEX_SCREEN:CP.STREAM_INDEX_MAIN].get(e.userId);if(t){var r,n=Ab(t);try{for(n.s();!(r=n.n()).done;){var i,o=xb(r.value,2)[1];e.videoTrack.setPlayer(this.id,o,null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy,this._initPlayerEvents.bind(this))}}catch(e){n.e(e)}finally{n.f()}}}}},{key:"_onAddStream",value:(i=HS(BS().mark((function e(t){var r,n,i,o,a,s,c;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.stream,n=r.attributes,i=n.localaudio,o=n.audiostream,a=n.localvideo,s=n.videostream,c=uH.NONE,o&&(c|=wP.AUDIO),s&&(c|=wP.VIDEO),!c){e.next=11;break}return e.next=8,new qS((function(e){return setTimeout(e)}));case 8:r.isScreen?this.safeEmit(QF.onUserPublishScreen,{userId:r.userId,mediaType:c}):(this.safeEmit(QF.onUserPublishStream,{userId:r.userId,mediaType:c,videoStreamDescriptions:r.attributes.videoDescriptions}),this._handleAutoSubscribe(r,!0)),this.safeEmit("onAddStream",{userId:r.userId,mediaType:c,isScreen:!!r.isScreen}),r.isScreen||(i&&this.safeEmit(QF.onUserStartAudioCapture,{userId:r.userId}),a&&this.safeEmit(QF.onUserStartVideoCapture,{userId:r.userId}));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i,o,a,s=uH.NONE;(null!==(r=this._room)&&void 0!==r&&r.config.isAutoSubscribeAudio&&(s|=wP.AUDIO),null!==(n=this._room)&&void 0!==n&&n.config.isAutoSubscribeVideo&&(s|=wP.VIDEO),s)&&(t&&MF(s)&&(null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0)),t&&DF(s)&&(null===(a=e.observer)||void 0===a||a.setAutoSubscribeVideo(!0)),null!==(i=this._room)&&void 0!==i&&i.config.tokenSubscribePrivilegeExpired?(MF(s)&&(this._pauseAllSubscribeState.resumeAudioStreamIds[e.streamId]=e.streamId),DF(s)&&(this._pauseAllSubscribeState.resumeVideoStreamIds[e.streamId]=e.streamId)):this._subscribe(!1,e.userId,s))}},{key:"_onRemoveStream",value:function(e){var t,r=e.stream,n=null!==(t=i4[e.reason])&&void 0!==t?t:AP.STREAM_REMOVE_REASON_OTHER,i=r.isScreen?QF.onUserUnpublishScreen:QF.onUserUnpublishStream,o=uH.NONE;r.attributes.audiostream&&(o|=wP.AUDIO),r.attributes.videostream&&(o|=wP.VIDEO),o!==uH.NONE&&(this.safeEmit(i,{userId:r.userId,mediaType:o,reason:n}),this.safeEmit("onRemoveStream",{userId:r.userId,isScreen:r.isScreen})),delete this._pauseAllSubscribeState.resumeAudioStreamIds[r.streamId],delete this._pauseAllSubscribeState.resumeVideoStreamIds[r.streamId],"function"==typeof e.callback&&e.callback()}},{key:"_onUserConnection",value:function(e){var t=this;setTimeout((function(){return t.safeEmit(QF.onUserJoined,e)}))}},{key:"_onUserLeave",value:function(e){this.safeEmit(QF.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(QF.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0}},{key:"_onNetworkQuality",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this.safeEmit.apply(this,JS(e=[QF.onNetworkQuality]).call(e,r))}},{key:"_onConnectionStateChange",value:function(e){if(void 0!==this._startCloudProxyTimestamp&&this._ctx.useCloudProxy&&e.state===xP.CONNECTION_STATE_CONNECTED&&this.safeEmit(QF.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),(this._ctx.isPreConnection||e.state!==xP.CONNECTION_STATE_CONNECTED&&e.state!==xP.CONNECTION_STATE_RECONNECTED)&&this.safeEmit(QF.onConnectionStateChanged,e),e.state===xP.CONNECTION_STATE_RECONNECTING){var t,r,n,i=Ab(null!==(t=null===(r=this._room)||void 0===r?void 0:r.remoteStreams)&&void 0!==t?t:new DR);try{for(i.s();!(n=i.n()).done;){var o=xb(n.value,2),a=o[0],s=o[1];vP(a).call(a,"mux")&&s.forEach((function(e){var t;return null===(t=e.audioTrack)||void 0===t?void 0:t.stop()}))}}catch(e){i.e(e)}finally{i.f()}}else e.state===xP.CONNECTION_STATE_RECONNECTED&&this._publicStreamManager.handleReconnected()}},{key:"_stopAudioPropertiesReport",value:function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)}},{key:"_onResubscribe",value:function(e){var t,r;e.stream&&(null===(t=e.stream.videoTrack)||void 0===t||t.stopAll(),null===(r=e.stream.audioTrack)||void 0===r||r.stop(),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))}},{key:"_onSubscribePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onRemovePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onVideoDeviceStateChange",value:function(e){this.safeEmit(QF.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(QF.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t=this,r=e.userId,n=e.isScreen,i=e.mediaType,o=e.pubState,a=e.remoteStream,s={userId:r,mediaType:i};i&wP.AUDIO&&setTimeout((function(){t._updateAudioPlayerState(a)})),n?o===cX.PUB?this.safeEmit(QF.onUserPublishScreen,s):this.safeEmit(QF.onUserUnpublishScreen,ux(ux({},s),{},{reason:AP.STREAM_REMOVE_REASON_UNPUBLISH})):o===cX.PUB?(s.videoStreamDescriptions=a.attributes.videoDescriptions,this.safeEmit(QF.onUserPublishStream,s),this._handleAutoSubscribe(a,!0)):this.safeEmit(QF.onUserUnpublishStream,ux(ux({},s),{},{reason:AP.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(QF.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(QF.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(QF.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(QF.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(QF.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(QF.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(QF.onTokenWillExpire)}},{key:"_onUserTokenPublishPrivilegeWillExpire",value:function(){this.safeEmit(QF.onTokenPublishPrivilegeWillExpire)}},{key:"_onUserTokenPublishPrivilegeDidExpired",value:(n=HS(BS().mark((function e(){var t,r,n;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this._room)||void 0===t?void 0:t.unpublish();case 2:return e.next=4,null===(r=this._room)||void 0===r?void 0:r.unpublishScreen();case 4:null===(n=this._room)||void 0===n||n.config.setTokenPublishPrivilegeExpired(!0),this.safeEmit(QF.onTokenPublishPrivilegeDidExpired,{errorCode:_P.TOKEN_NO_PUBLISH_PERMISSION,message:"Token no longer has publish privilege"});case 6:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_onUserTokenSubscribePrivilegeWillExpire",value:function(){this.safeEmit(QF.onTokenSubscribePrivilegeWillExpire)}},{key:"_onUserTokenSubscribePrivilegeDidExpired",value:(r=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._handleLoseSubscribePrivilege(),this.safeEmit(QF.onTokenSubscribePrivilegeDidExpired,{errorCode:_P.TOKEN_NO_SUBSCRIBE_PERMISSION,message:"Token no longer has subscribe privilege"});case 2:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_unSubscribeAllRemoteStreams",value:(t=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._room){e.next=2;break}return e.abrupt("return",qS.resolve());case 2:return e.abrupt("return",this._pauseAllRemoteStreams(wP.AUDIO_AND_VIDEO));case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(QF.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(QF.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(QF.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(QF.onError,{errorCode:_P.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(QF.onError,{errorCode:_P.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(QF.onServerParamsSetResult,null==e?void 0:e.code)}))}},{key:"getSubLock",value:function(e,t){var r,n=e?this._subScreenLocks:this._subLocks,i=n.get(t);return i||(i=new q1(JS(r="sub_".concat(e?1:0,"_")).call(r,t)),n.set(t,i)),i}},{key:"localAudioTrack",get:function(){return this._localAudioTrack}},{key:"localVideoTrack",get:function(){return this._localVideoTrack}},{key:"localScreenAudioTrack",get:function(){return this._localScreenAudioTrack}},{key:"localScreenVideoTrack",get:function(){return this._localScreenVideoTrack}},{key:"remoteStreams",get:function(){var e,t=[];return null!==(e=this._room)&&void 0!==e&&e.remoteStreams&&this._room.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){t.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))})),t}},{key:"iceState",get:function(){var e;return null===(e=this._ctx.peerConnection)||void 0===e?void 0:e.getIceConnectionState()}},{key:"remoteUsers",get:function(){var e,t=[];return null!==(e=this._room)&&void 0!==e&&e.remoteUsers&&this._room.remoteUsers.forEach((function(e){t.push({userId:e.userId})})),t}},{key:"multiChatMode",get:function(){var e;return!(null===(e=this._room)||void 0===e||!e.config.isMultiChatMode())}},{key:"checkMediaType",get:function(){return this._checkMediaType}},{key:"assertNotInRoom",get:function(){return this._assertNotInRoom}},{key:"peerConnection",get:function(){var e;return null===(e=this._ctx.peerConnection)||void 0===e?void 0:e.getOriginRTCPeerConnection()}},{key:"_handleAudioDeviceManager",value:function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(QF.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||!this._ctx.signalingManager.isConnected())throw new rN(_P.NOT_CONNECTED_YET,"server not connected")}},{key:"_checkMediaType",value:function(e){nj(e,"mediaType",[wP.AUDIO,wP.VIDEO,wP.AUDIO_AND_VIDEO])}},{key:"_getUserId",value:function(){var e;return(null===(e=this._room)||void 0===e?void 0:e.config.userInfo.userId)||"local_user"}},{key:"_switchTrack",value:(e=HS(BS().mark((function e(t){var r,n,i=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._initLocalTrackEvents(t),this._localVideoTrack=t,this._localVideoPlayerConfig[CP.STREAM_INDEX_MAIN].forEach((function(e){var r;t.setPlayer(i.id,e,i._mirrorType,null===(r=i._config)||void 0===r?void 0:r.autoPlayPolicy,i._initPlayerEvents.bind(i))})),null===(r=this._room)||void 0===r||null===(n=r.localStream)||void 0===n||!n.pubVideo){e.next=6;break}return e.next=6,this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(t){return e.apply(this,arguments)})},{key:"_shouldUpdateAudioConf",value:function(e){var t,r,n,i=(null===(t=this._room)||void 0===t?void 0:t.hasPublished)||(null===(r=this._room)||void 0===r||null===(n=r.localStream)||void 0===n?void 0:n.pubAudio)||this._localAudioTrack&&this._localAudioTrack.sourceType===Dj.INTERNAL;if(i){var o="engine.".concat(e," should be called before publishing or capturing.");console.warn("[RTC WebSDK]: ".concat(o)),qV(this.id,e,o)}return!i}},{key:"_getServerConfig",value:function(){var e=this,t=VB.getServerConfig(this.appId);t.rts_report&&MV.setConfig(t.rts_report),this._ctx.joinRoomConfig.setServerConfig(t.web_join_room),this._preConnect(t),this._getServerConfigExecutor(t),hF({engineId:this.id,appId:this.appId,sdkVersion:XB("VERSION"),requestDomains:XB("CONFIG_REQUEST_DOMAINS"),keys:["rts_report","web_join_room","web_rtc_config"],deviceId:XB("DEVICE_ID")}).then((function(t){VB.setServerConfig(e.appId,t)}))}},{key:"_getServerConfigExecutor",value:function(e){var t,r,n,i;AM.setParameter("UPLOAD_CONSOLE_ON",!(null==e||null===(t=e.web_rtc_config)||void 0===t||!t.upload_console_on)),AM.setParameter("UPLOAD_CONSOLE_LENGTH_CUT",null==e||null===(r=e.web_rtc_config)||void 0===r?void 0:r.upload_console_length_cut),AM.setParameter("UPLOAD_REPORT_LIMIT",null==e||null===(n=e.web_rtc_config)||void 0===n?void 0:n.upload_report_limit),AM.setParameter("ENABLE_REPORT_IDB_BUFFER",!(null==e||null===(i=e.web_rtc_config)||void 0===i||!i.enable_report_idb_buffer))}},{key:"_preConnect",value:function(e){var t,r=XB("PRE_ICE");"boolean"==typeof(null==e||null===(t=e.web_rtc_config)||void 0===t?void 0:t.pre_ice)&&(r=e.web_rtc_config.pre_ice),r&&(this.logger.print("preConnect","start pre ice connection."),this._ctx.signalingManager.connect(),this.monitor.set({pre_connection:!0}),this._ctx.isPreConnection=!0)}},{key:"_getRemoteVideoPlayerConfig",value:function(e,t,r){var n;return null===(n=this._remoteVideoPlayerConfig[e].get(t))||void 0===n?void 0:n.get(r)}},{key:"_setRemoteVideoPlayerConfig",value:function(e,t,r,n){var i=this._remoteVideoPlayerConfig[e].get(t)||new DR;i.set(r,n),this._remoteVideoPlayerConfig[e].set(t,i)}}]),De}();r4([KV()],n4.prototype,"updateToken"),r4([KV(),s4("video")],n4.prototype,"setVideoCaptureDevice"),r4([KV(),s4("audio")],n4.prototype,"setAudioCaptureDevice"),r4([KV()],n4.prototype,"connect"),r4([function(e,t,r){if("function"==typeof r.value){var n=r.value;r.value=function(){for(var e,t=GV(this.id),r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return null==t||t.set({room_id:i[1],user_id:null===(e=i[2])||void 0===e?void 0:e.userId}),n.apply(this,i)}}},KV()],n4.prototype,"joinRoom"),r4([KV()],n4.prototype,"leaveRoom"),r4([KV()],n4.prototype,"destroy"),r4([KV()],n4.prototype,"publishStream"),r4([KV()],n4.prototype,"unpublishStream"),r4([KV()],n4.prototype,"publishScreen"),r4([KV()],n4.prototype,"unpublishScreen"),r4([KV()],n4.prototype,"subscribeStream"),r4([o4],n4.prototype,"_subscribe"),r4([KV()],n4.prototype,"unsubscribeStream"),r4([KV()],n4.prototype,"subscribeScreen"),r4([KV()],n4.prototype,"unsubscribeScreen"),r4([o4],n4.prototype,"_unsubscribe"),r4([KV(),a4],n4.prototype,"setRemoteVideoConfig"),r4([KV(),s4("video")],n4.prototype,"startVideoCapture"),r4([KV(),s4("video")],n4.prototype,"stopVideoCapture"),r4([KV(),s4("audio")],n4.prototype,"startAudioCapture"),r4([KV(),s4("audio")],n4.prototype,"stopAudioCapture"),r4([KV(),s4("all")],n4.prototype,"startAudioAndVideoCapture"),r4([KV()],n4.prototype,"startVideoAndAudioCapture"),r4([KV()],n4.prototype,"getAudioMixingManager"),r4([KV(),c4],n4.prototype,"startScreenCapture"),r4([KV(),c4],n4.prototype,"stopScreenCapture"),r4([KV()],n4.prototype,"setLocalVideoPlayer"),r4([KV()],n4.prototype,"startLiveTranscoding"),r4([KV()],n4.prototype,"updateLiveTranscoding"),r4([KV()],n4.prototype,"stopLiveTranscoding"),r4([KV()],n4.prototype,"startSubtitle"),r4([KV()],n4.prototype,"updateSubtitleConfig"),r4([KV()],n4.prototype,"stopSubtitle"),r4([KV()],n4.prototype,"setBusinessId"),r4([KV()],n4.prototype,"setUserVisibility"),r4([KV()],n4.prototype,"setRemoteVideoPlayer"),r4([KV()],n4.prototype,"setLocalVideoMirrorType"),r4([KV()],n4.prototype,"setAudioPlaybackDevice"),r4([KV()],n4.prototype,"play"),r4([KV()],n4.prototype,"stop"),r4([KV()],n4.prototype,"getAudioVolume"),r4([KV()],n4.prototype,"pauseAllSubscribedStream"),r4([KV()],n4.prototype,"resumeAllSubscribedStream"),r4([KV()],n4.prototype,"sendUserMessage"),r4([KV()],n4.prototype,"sendUserBinaryMessage"),r4([KV()],n4.prototype,"sendRoomMessage"),r4([KV()],n4.prototype,"sendRoomBinaryMessage"),r4([KV()],n4.prototype,"setAudioCaptureConfig"),r4([FF("4.51"),KV()],n4.prototype,"setVideoCaptureConfig"),r4([KV()],n4.prototype,"enableSimulcastMode"),r4([KV()],n4.prototype,"setVideoEncoderConfig"),r4([KV()],n4.prototype,"setScreenEncoderConfig"),r4([KV()],n4.prototype,"sendSEIMessage"),r4([FF("4.42"),KV()],n4.prototype,"setAudioVolumeIndicationInterval"),r4([KV()],n4.prototype,"enableAudioPropertiesReport"),r4([KV()],n4.prototype,"setVideoSourceType"),r4([KV()],n4.prototype,"setExternalVideoTrack"),r4([KV()],n4.prototype,"setAudioSourceType"),r4([KV()],n4.prototype,"setExternalAudioTrack"),r4([KV()],n4.prototype,"login"),r4([KV()],n4.prototype,"logout"),r4([KV()],n4.prototype,"updateLoginToken"),r4([KV()],n4.prototype,"getPeerOnlineStatus"),r4([KV()],n4.prototype,"sendUserMessageOutsideRoom"),r4([KV()],n4.prototype,"sendUserBinaryMessageOutsideRoom"),r4([KV()],n4.prototype,"setServerParams"),r4([KV()],n4.prototype,"sendServerMessage"),r4([KV()],n4.prototype,"sendServerBinaryMessage"),r4([KV()],n4.prototype,"startCloudProxy"),r4([KV()],n4.prototype,"stopCloudProxy"),r4([KV()],n4.prototype,"startPushPublicStream"),r4([KV()],n4.prototype,"updatePublicStreamParam"),r4([KV()],n4.prototype,"stopPushPublicStream"),r4([KV("streamId")],n4.prototype,"startPlayPublicStream"),r4([KV("streamId")],n4.prototype,"stopPlayPublicStream"),r4([KV()],n4.prototype,"setAudioProfile"),r4([KV()],n4.prototype,"setAudioEncodeMaxBitrate"),r4([KV()],n4.prototype,"setPublicStreamVideoPlayer"),r4([KV()],n4.prototype,"setDummyCaptureImagePath"),r4([KV()],n4.prototype,"registerExtension"),r4([KV()],n4.prototype,"startAudioPlaybackDeviceTest"),r4([KV()],n4.prototype,"stopAudioPlaybackDeviceTest"),r4([KV()],n4.prototype,"startAudioDeviceRecordTest"),r4([KV()],n4.prototype,"stopAudioDeviceRecordAndPlayTest"),r4([KV()],n4.prototype,"stopAudioDevicePlayTest"),r4([KV(),a4],n4.prototype,"setRemoteUserPriority"),r4([KV()],n4.prototype,"takeLocalSnapshot"),r4([KV()],n4.prototype,"takeRemoteSnapshot"),r4([KV()],n4.prototype,"setSubscribeFallbackOption"),r4([KV()],n4.prototype,"getLocalStreamTrack"),r4([KV()],n4.prototype,"getRemoteStreamTrack"),r4([KV()],n4.prototype,"getPublicStreamTrack"),r4([KV()],n4.prototype,"setRemoteStreamRenderSync"),r4([KV()],n4.prototype,"setJoinRoomParams"),r4([KV()],n4.prototype,"setAudioSelectionConfig"),r4([KV()],n4.prototype,"startForwardStreamToRooms"),r4([KV()],n4.prototype,"updateForwardStreamToRooms"),r4([KV()],n4.prototype,"stopForwardStreamToRooms"),r4([KV()],n4.prototype,"pauseForwardStreamToAllRooms"),r4([KV()],n4.prototype,"resumeForwardStreamToAllRooms");var i4={"client unpublished":AP.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":AP.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":AP.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":AP.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":AP.STREAM_REMOVE_REASON_REPUBLISH,"token publish privilege expired":AP.STREAM_REMOVE_REASON_TOKEN_PRIVILEGE_EXPIRED};function o4(e,t,r){var n=r.value;return r.value=HS(BS().mark((function e(){var t,r,i,o,a,s,c,u=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=u.length,r=new Array(t),i=0;i<t;i++)r[i]=u[i];return o=r[0],a=r[1],s=r[2],this.checkMediaType(s),this.assertNotInRoom(),e.next=6,this.getSubLock(o,a).lock();case 6:return c=e.sent,e.prev=7,e.next=10,n.apply(this,r);case 10:return e.abrupt("return",e.sent);case 11:return e.prev=11,c(),e.finish(11);case 14:case"end":return e.stop()}}),e,this,[[7,,11,14]])}))),r}function a4(e,t,r){var n=r.value;return r.value=HS(BS().mark((function e(){var t,r,i,o,a,s=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=s.length,r=new Array(t),i=0;i<t;i++)r[i]=s[i];return o=r[0],e.next=4,this.getSubLock(!1,o).lock();case 4:return a=e.sent,e.prev=5,e.next=8,n.apply(this,r);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,a(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[5,,9,12]])}))),r}function s4(e){return function(t,r,n){var i=n.value;return n.value=HS(BS().mark((function t(){var r,n,o,a,s,c=arguments;return BS().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[],"video"!==e&&r.push(this._audioCaptureLock.lock()),"audio"!==e&&r.push(this._videoCaptureLock.lock()),t.next=5,qS.all(r);case 5:for(n=t.sent,t.prev=6,o=c.length,a=new Array(o),s=0;s<o;s++)a[s]=c[s];return t.next=10,i.apply(this,a);case 10:return t.abrupt("return",t.sent);case 11:return t.prev=11,n.forEach((function(e){return e()})),t.finish(11);case 14:case"end":return t.stop()}}),t,this,[[6,,11,14]])}))),n}}function c4(e,t,r){var n=r.value;return r.value=HS(BS().mark((function e(){var t,r,i,o,a=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._screenCaptureLock.lock();case 2:for(t=e.sent,e.prev=3,r=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];return e.next=7,n.apply(this,i);case 7:return e.abrupt("return",e.sent);case 8:return e.prev=8,t(),e.finish(8);case 11:case"end":return e.stop()}}),e,this,[[3,,8,11]])}))),r}var u4,d4=LR,l4=ww,h4=function(e,t,r,n){for(var i,o=l4(t,r),a=e.length-1;a>=0;a--)(i=e[a])&&(o=i(t,r,o)||o);return o&&d4(t,r,o),o},p4=function(){Hx(n,n4);var e,t,r=oO(n);function n(e,t,i){var o;return of(this,n),af(dx(o=r.call(this,e,t,i)),"singleStreamRenderMode",!1),o.id=t,o.logger=new dF("BLWEngine",0,t),YB([{width:192,height:108,frameRate:15,maxKbps:100},{width:320,height:180,frameRate:15,maxKbps:140},{width:640,height:360,frameRate:15,maxKbps:400},{width:1280,height:720,frameRate:15,maxKbps:1e3},{width:1920,height:1080,frameRate:15,maxKbps:2e3}]),o._handleEngineEvents(),o}return nf(n,[{key:"subscribeStream",value:(t=HS(BS().mark((function e(t,r){var i=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.print("subscribeStream()","userId: %o, mediaType: %o",t,r),this.singleStreamRenderMode&&DF(r)&&Bx(Fx(n.prototype),"subscribeScreen",this).call(this,t,wP.VIDEO).catch((function(e){i.logger.error("singleStreamRenderMode subscribeScreen()",e)})),e.abrupt("return",Bx(Fx(n.prototype),"subscribeStream",this).call(this,t,r));case 3:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"unsubscribeStream",value:(e=HS(BS().mark((function e(t,r){var i=this;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this.singleStreamRenderMode&&DF(r)&&Bx(Fx(n.prototype),"unsubscribeScreen",this).call(this,t,wP.VIDEO).catch((function(e){i.logger.error("singleStreamRenderMode unsubscribeScreen()",e)})),e.abrupt("return",Bx(Fx(n.prototype),"unsubscribeStream",this).call(this,t,r));case 3:case"end":return e.stop()}}),e,this)}))),function(t,r){return e.apply(this,arguments)})},{key:"setRemoteScreenVideoStreamIndex",value:function(e){return this.logger.print("setRemoteScreenVideoStreamIndex()","streamIndex: %o",e),!this._room&&(this.singleStreamRenderMode=e===CP.STREAM_INDEX_MAIN,!0)}},{key:"setRemoteVideoPlayer",value:function(e,t){if(this.logger.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),null==t||delete t.playerId,!this.singleStreamRenderMode||e!==CP.STREAM_INDEX_SCREEN)return Bx(Fx(n.prototype),"setRemoteVideoPlayer",this).call(this,e,t)}},{key:"destroy",value:function(){this.singleStreamRenderMode=!1,Bx(Fx(n.prototype),"destroy",this).call(this)}},{key:"_updateVideoPlayerState",value:function(e){var t,r,i,o,a;if(!this.singleStreamRenderMode)return Bx(Fx(n.prototype),"_updateVideoPlayerState",this).call(this,e);var s,c,u=e.userId,d=null===(t=this._room)||void 0===t?void 0:t.remoteStreams.get(u);Array.isArray(d)&&d.forEach((function(e){e.isScreen?s=e:c=e}));var l,h,p,f=null===(r=c)||void 0===r||null===(i=r.videoTrack)||void 0===i?void 0:i.dangerousGetPlayer(CK);if(!f){var v,_,m,g,y,S,b=null===(v=this._remoteVideoPlayerConfig[CP.STREAM_INDEX_MAIN].get(u))||void 0===v?void 0:v.get(CK);if(!b)return;null===(_=c)||void 0===_||null===(m=_.videoTrack)||void 0===m||m.setPlayer(this.id,b,null===(g=this._config)||void 0===g?void 0:g.autoPlayPolicy,this._initPlayerEvents.bind(this)),f=null===(y=c)||void 0===y||null===(S=y.videoTrack)||void 0===S?void 0:S.dangerousGetPlayer(CK)}if(!e.isScreen&&null!==(o=s)&&void 0!==o&&o.videoTrack&&s.videoHasPublish)return this.logger.print("_updateVideoPlayerState","prevent play main stream"),void(null===(l=f)||void 0===l||l.playVideo(s.videoTrack));e.videoTrack?(null===(h=this._config)||void 0===h?void 0:h.autoPlayPolicy)!==WP.PLAY_MANUALLY&&(null===(p=f)||void 0===p||p.playVideo(e.videoTrack)):null!==(a=f)&&void 0!==a&&a.played&&f.stop()}},{key:"_handleEngineEvents",value:function(){var e=this;this.on(QF.onUserPublishScreen,(function(t){if(e.singleStreamRenderMode&&DF(t.mediaType)){var r,n,i=null===(r=e._room)||void 0===r?void 0:r.remoteStreams.get(t.userId),o=null==i?void 0:DC(i).call(i,(function(e){return!e.isScreen})),a=null==i?void 0:DC(i).call(i,(function(e){return e.isScreen}));null!=a&&a.hasSubscribed?(e.logger.info("onUserPublishScreen","singleStreamRenderMode screen hasSubscribed"),e._updateVideoPlayerState(a)):(null!==(n=e._room)&&void 0!==n&&n.config.isAutoSubscribeVideo||null!=o&&o.hasSubscribed&&DF(o.subMediaType))&&(e.logger.info("onUserPublishScreen","singleStreamRenderMode subscribeScreen"),e.subscribeScreen(t.userId,wP.VIDEO))}})),this.on(QF.onUserUnpublishScreen,(function(t){if(e.singleStreamRenderMode&&DF(t.mediaType)){var r,n=null===(r=e._room)||void 0===r?void 0:r.remoteStreams.get(t.userId),i=null==n?void 0:DC(n).call(n,(function(e){return!e.isScreen}));i&&setTimeout((function(){e._updateVideoPlayerState(i)}))}}))}}]),n}();h4([KV()],p4.prototype,"subscribeStream"),h4([KV()],p4.prototype,"unsubscribeStream"),h4([KV()],p4.prototype,"setRemoteScreenVideoStreamIndex"),h4([KV()],p4.prototype,"setRemoteVideoPlayer"),h4([KV()],p4.prototype,"destroy");var f4=new dF("VERTC",0);gM.storeKey=JS(u4="".concat(Date.now(),"-")).call(u4,VB.getDeviceId()),LV({rtc_sdk_version:WB.VERSION,device_id:VB.getDeviceId(),log_cache_key:gM.storeKey}),UV(WB.LOG_SERVER_URL);var v4=1,_4=function(e,t){f4.info("createEngine","Invoke VERTC.createEngine"),rj(e,"appId");var r=(v4++).toString();return WV(r,{rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy}),new n4(e,r,t)},m4=function(e,t){f4.print("createBLWEngine","Invoke VERTC.createBLWEngine"),rj(e,"appId");var r=(v4++).toString();return WV(r,{rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy}),new p4(e,r,t)},g4=function(e){if(f4.info("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof n4))throw new rN(_P.INVALID_ENGINE,"Invalid engine object");e.destroy(),function(e){e.report("sdk_init_engine",{start:Date.now(),type:"end"}),zV.delete(e.id)}(e.monitor)},y4=function(){var e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",PK.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S4=function(){var e=HS(BS().mark((function e(){var t,r,n,i,o,a=arguments;return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=(t=a.length>0&&void 0!==a[0]?a[0]:{video:!0,audio:!0}).video,n=t.audio,i={video:!1,audio:!1},o=[],r&&o.push(PK.getPermissions({video:!0,force:!0}).then((function(e){i.video=e.video,e.video||(i.videoExceptionError=e.reason)}))),n&&o.push(PK.getPermissions({audio:!0,force:!0}).then((function(e){i.audio=e.audio,e.audio||(i.audioExceptionError=e.reason)}))),e.next=8,qS.allSettled(o);case 8:return e.abrupt("return",i);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b4=function(){var e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",PK.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),E4=function(){var e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",PK.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),k4=function(){var e=HS(BS().mark((function e(){return BS().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",PK.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),T4=function(){return WB.VERSION},I4=function(){return zj()},R4=function(){return Wj()},C4=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(gM.logLevel=t),r&&(gM.LogfileSize=r)},w4=function(e){gM.download(e)};function A4(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return ZS(ob(t).call(t,(function(e){return e instanceof n4?"[ENGINE]":e})))}function x4(e,t){return function(){FV(t,0,A4.apply(void 0,arguments));var r=e.apply(void 0,arguments);return"function"==typeof(null==r?void 0:r.then)?r.then((function(e){return BV(t,0,A4(e)),e})).catch((function(e){throw BV(t,e.code,e.message),e})):(BV(t,0,A4(r)),r)}}var O4=nf((function e(){of(this,e),af(this,"getSdkVersion",x4(T4,"getSdkVersion")),af(this,"createEngine",x4(_4,"createEngine")),af(this,"createBLWEngine",x4(m4,"createBLWEngine")),af(this,"destroyEngine",x4(g4,"destroyEngine")),af(this,"enumerateDevices",x4(y4,"enumerateDevices")),af(this,"enableDevices",x4(S4,"enableDevices")),af(this,"enumerateAudioCaptureDevices",x4(b4,"enumerateAudioCaptureDevices")),af(this,"enumerateVideoCaptureDevices",x4(E4,"enumerateVideoCaptureDevices")),af(this,"enumerateAudioPlaybackDevices",x4(k4,"enumerateAudioPlaybackDevices")),af(this,"getParameter",XB),af(this,"setParameter",KB),af(this,"isSupported",x4(I4,"isSupported")),af(this,"getSupportedCodecs",x4(R4,"getSupportedCodecs")),af(this,"events",QF),af(this,"ErrorCode",_P),af(this,"platform","VolcEngine"),af(this,"commitInfo","HEAD<64715bf*>"),af(this,"downloadLog",x4(w4,"downloadLog")),af(this,"setLogConfig",x4(C4,"setLogConfig"))})),P4=new O4,N4=function(){function e(e,t,r){this.engine=null,this.params=null,this.pads=[],this.callbacks=null,this.params=e,this.pads=t,this.callbacks=r}return e.prototype.getEngine=function(){return yr(this,void 0,void 0,(function(){var e=this;return Sr(this,(function(t){return[2,new Promise((function(t,r){var n,i=e.params,o=i.userId,a=i.videoStream,s=i.uuid,c=i.token;mr.post("https://openapi.armcloud.net/rtc/open/room/sdk/share/applyToken",{userId:o,uuid:s,terminal:"h5",expire:3600,pushPublicStream:!1,pads:null===(n=e.pads)||void 0===n?void 0:n.map((function(e){return{padCode:e,videoStream:a,userId:o}}))},{headers:{token:c}}).then((function(n){var i,a=(null===(i=null==n?void 0:n.data)||void 0===i?void 0:i.data)||{},s=a.appId,c=a.roomCode,u=a.roomToken;e.engine=P4.createEngine(s),e.joinRoom({roomCode:c,roomToken:u,userId:o,resolve:t,reject:r})})).catch((function(){var e=new Error("Get Token Error");e.code="TOKEN_ERR",r(e)}))}))]}))}))},e.prototype.sendUserMessage=function(e,t){return yr(this,void 0,void 0,(function(){var r;return Sr(this,(function(n){switch(n.label){case 0:return[4,null===(r=null==this?void 0:this.engine)||void 0===r?void 0:r.sendUserMessage(e,t)];case 1:return[2,n.sent()]}}))}))},e.prototype.sendRoomMessage=function(e){return yr(this,void 0,void 0,(function(){var t;return Sr(this,(function(r){switch(r.label){case 0:return console.log("sendRoomMessage",e),[4,null===(t=null==this?void 0:this.engine)||void 0===t?void 0:t.sendRoomMessage(e)];case 1:return[2,r.sent()]}}))}))},e.prototype.getMsgTemplate=function(e,t){return JSON.stringify({touchType:e,content:JSON.stringify(t)})},e.prototype.onUserJoined=function(){var e,t=this;null===(e=null==this?void 0:this.engine)||void 0===e||e.on(P4.events.onUserJoined,(function(e){var r;console.log(e),t.sendUserMessage(null===(r=null==e?void 0:e.userInfo)||void 0===r?void 0:r.userId,t.getMsgTemplate("openGroupControl",{isOpen:!0})),t.callbacks.onUserLeaveOrJoin({type:"join",userInfo:null==e?void 0:e.userInfo})}))},e.prototype.onUserLeave=function(){var e,t=this;null===(e=null==this?void 0:this.engine)||void 0===e||e.on(P4.events.onUserLeave,(function(e){t.callbacks.onUserLeaveOrJoin({type:"leave",userInfo:null==e?void 0:e.userInfo})}))},e.prototype.joinRoom=function(e){return yr(this,void 0,void 0,(function(){var t,r,n,i,o,a,s,c,u,d;return Sr(this,(function(l){switch(l.label){case 0:t=e.roomToken,r=e.roomCode,n=e.userId,i=e.resolve,o=e.reject,a=this.params,s=a.isAutoSubscribeAudio,c=a.isAutoSubscribeVideo,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.engine.joinRoom(t,r,{userId:n},{isAutoPublish:!1,isAutoSubscribeAudio:s,isAutoSubscribeVideo:c})];case 2:return u=l.sent(),this.onUserJoined(),this.onUserLeave(),this.sendRoomMessage(this.getMsgTemplate("openGroupControl",{pads:this.pads})),i({engine:this.engine,result:u}),[3,4];case 3:return d=l.sent(),o(d),[3,4];case 4:return[2]}}))}))},e}(),M4=function(){function e(){this.isRunning=!1}return e.prototype.startShakeSimulation=function(e,t){var r=this;void 0===e&&(e=1800),this.isRunning=!0;var n=Date.now();this.intervalId=setInterval((function(){if(r.isRunning){var i=r.randomAcceleration(),o=r.randomAcceleration(),a=r.randomAcceleration();t({x:i,y:o,z:a}),Date.now()-n>e&&r.stopShakeSimulation()}}),10)},e.prototype.randomAcceleration=function(){return 15*Math.random()-5},e.prototype.stopShakeSimulation=function(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0,this.isRunning=!1)},e}(),D4=0,L4=-1,U4=1,V4=0,F4=1,B4=1,j4=0,H4={AUDIO_ONLY:1,VIDEO_ONLY:2,AUDIO_VIDEO:3,NOT_AUDIO_VIDEO:4},z4=1,G4=2,W4=3,K4={code:100,msg:"WS开始连接"},X4={code:101,msg:"WS连接成功"},J4={code:102,msg:"WS连接关闭"},q4={code:103,msg:"WS连接出错"},Y4={code:104,msg:"WS重连中"},Q4={code:200,msg:"收到加入房间信息"},Z4={code:201,msg:"设置offer信息成功"},$4={code:202,msg:"设置offer信息失败"},e5={code:203,msg:"发送answer信息"},t5={code:204,msg:"发送answer信息失败"},r5={code:205,msg:"添加ICE信息成功"},n5={code:206,msg:"添加ICE信息失败"},i5={code:207,msg:"发送ICE信息"},o5={code:300,msg:"RTC正在连接"},a5={code:301,msg:"RTC连接成功"},s5={code:302,msg:"RTC断开连接"},c5={code:303,msg:"RTC连接关闭"},u5={code:304,msg:"RTC连接失败"},d5={code:305,msg:"RTC接收VIDEO流"},l5={code:306,msg:"RTC接收VIDEO流后在VIDEO中加载成功"},h5={code:307,msg:"RTC消息通道连接成功"},p5={code:308,msg:"RTC消息通道连接失败"},f5={code:309,msg:"VIDEO加载成功当未收到云机的UI信息"},v5={code:310,msg:"VIDEO第一帧渲染成功"},_5=function(){function e(e,t,r,n){var i,o;this.initDomId="",this.initDomWidth=0,this.initDomHeight=0,this.videoDomId="",this.hasPushDown=!1,this.remoteResolution={width:0,height:0},this.touchConfig={action:0,widthPixels:document.body.clientWidth,heightPixels:document.body.clientHeight,pointCount:1,touchType:"gesture",properties:[],coords:[]},this.roomMessage={},this.autoRecoveryTimer=null,this.errorInfo=[],this.isFirstFrame=!1,this.firstFrameCount=0,this.rotation=0,this.isGroupControl=!1,this.enterkeyhintObj={2:"go",3:"search",4:"send",5:"next",6:"done",7:"previous"},this.callbacks={},this.logTime={},this.remoteUserId="",this.enableMicrophone=!1,this.enableCamera=!1,this.initDomId=e,this.options=t,this.callbacks=r,this.logTime=n,this.remoteUserId=t.padCode,this.enableMicrophone=t.enableMicrophone,this.enableCamera=t.enableCamera;var a=document.getElementById(this.initDomId);console.log("h5Dom节点宽高",null==a?void 0:a.clientWidth,null==a?void 0:a.clientHeight),this.initDomWidth=null!==(i=null==a?void 0:a.clientWidth)&&void 0!==i?i:0,this.initDomHeight=null!==(o=null==a?void 0:a.clientHeight)&&void 0!==o?o:0;var s=document.createElement("div");s.setAttribute("id","armcloudVideo"),this.videoDomId="armcloudVideo",null==a||a.appendChild(s),this.createEngine()}return e.prototype.isMobile=function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},e.prototype.isSupported=function(){return P4.isSupported()},e.prototype.setLogTime=function(e){this.logTime[e]=(new Date).getTime()},e.prototype.addReportInfo=function(e){var t=(new Date).getTime();this.errorInfo.push({type:"WebVolcanoRtc",time:t,timeDiff:t-this.logTime.joinRoom,info:e})},e.prototype.sendEventReport=function(e){var t=this,r=function(e,r){mr.post("https://openapi.armcloud.net/openapi/open/clientException/sendInfo",{padCode:t.remoteUserId,errorJson:JSON.stringify(r),type:e}).finally((function(){t.errorInfo=[]}))},n=(new Date).getTime();if("error"!==e||this.isFirstFrame||!this.errorInfo.length){if("init"===e){var i=this.logTime,o=i.rtcSuccess,a=i.reconnectSuccess,s=i.wsJoinRoom,c=i.joinRoom,u=i.tokenResEnd,d=i.tokenResStart;r(B4,{data:this.errorInfo,joinRoomTime:s-c,rtcLinkTime:(o||a)-c,totalTime:n-d,questServerTime:u-d,type:"WebVolcanoRtc"})}}else r(j4,this.errorInfo)},e.prototype.setMicrophone=function(e){this.enableMicrophone=!!e},e.prototype.setCamera=function(e){this.enableCamera=!!e},e.prototype.triggerRecoveryTimeCallback=function(){var e=this;this.autoRecoveryTimer&&clearTimeout(this.autoRecoveryTimer),this.autoRecoveryTimer=setTimeout((function(){console.log("触发无操作回收了"),e.stop(),e.callbacks.onAutoRecoveryTime()}),1e3*this.options.autoRecoveryTime)},e.prototype.createEngine=function(){return yr(this,void 0,void 0,(function(){var e=this;return Sr(this,(function(t){return this.inputElement||this.addInputElement(),this.engine=P4.createEngine(this.options.appId),console.log("createEngine",this.engine),this.engine.on(P4.events.onConnectionStateChanged,(function(t){switch(t.state){case xP.CONNECTION_STATE_CONNECTING:e.addReportInfo({describe:"首次连接,正在连接中。",e:t});case xP.CONNECTION_STATE_CONNECTED:console.log("首次连接成功",xP.CONNECTION_STATE_CONNECTED),e.addReportInfo({describe:"首次连接成功。",e:t}),e.setLogTime("rtcSuccess");break;case xP.CONNECTION_STATE_RECONNECTING:e.addReportInfo({describe:"连接断开后重新连接中。",e:t});case xP.CONNECTION_STATE_RECONNECTED:e.addReportInfo({describe:"连接断开后重连成功。",e:t}),e.setLogTime("reconnectSuccess")}e.callbacks.onConnectionStateChanged(t)})),this.engine.on(P4.events.onError,(function(t){e.addReportInfo({describe:"当SDK内部发生不可逆转错误时触发该回调",error:t}),e.sendEventReport("error"),e.callbacks.onErrorMessage(t)})),this.engine.on(P4.events.onAutoplayFailed,(function(t){e.callbacks.onAutoplayFailed(t)})),this.engine.on(P4.events.onRemoteStreamStats,(function(t){e.callbacks.onRunInformation(t)})),[2]}))}))},e.prototype.createGroupEngine=function(){return yr(this,arguments,void 0,(function(e,t){var r,n,i;return void 0===e&&(e=[]),Sr(this,(function(o){switch(o.label){case 0:r=new N4(gr(gr({},this.options),t),e,this.callbacks),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.getEngine()];case 2:return n=o.sent(),this.groupEngine=n.engine,[3,4];case 3:return i=o.sent(),this.callbacks.onGroupControlError({code:i.code,msg:i.message}),[3,4];case 4:return[2]}}))}))},e.prototype.destroyEngine=function(){this.engine&&P4.destroyEngine(this.engine),this.groupEngine&&P4.destroyEngine(this.groupEngine)},e.prototype.startPlay=function(){this.engine&&this.engine.play(this.options.clientId)},e.prototype.sendGroupRoomMessage=function(e){return yr(this,void 0,void 0,(function(){var t;return Sr(this,(function(r){switch(r.label){case 0:return[4,null===(t=null==this?void 0:this.groupEngine)||void 0===t?void 0:t.sendRoomMessage(e)];case 1:return[2,r.sent()]}}))}))},e.prototype.getMsgTemplate=function(e,t){return JSON.stringify({touchType:e,content:JSON.stringify(t)})},e.prototype.getEquipmentInfo=function(e){this.sendUserMessage(this.options.clientId,this.getMsgTemplate("equipmentInfo",{type:e}),!0)},e.prototype.appUnInstall=function(e){console.log(this.getMsgTemplate("appUnInstall",e)),this.sendUserMessage(this.options.clientId,this.getMsgTemplate("appUnInstall",e),!0)},e.prototype.sendUserMessage=function(e,t,r){return yr(this,void 0,void 0,(function(){var n;return Sr(this,(function(i){switch(i.label){case 0:return this.triggerRecoveryTimeCallback(),!r&&this.sendGroupRoomMessage(t),[4,null===(n=null==this?void 0:this.engine)||void 0===n?void 0:n.sendUserMessage(e,t)];case 1:return[2,i.sent()]}}))}))},e.prototype.start=function(e,t){var r=this;void 0===e&&(e=!1),void 0===t&&(t=[]),this.addReportInfo({describe:"开始加入房间"});var n={appId:this.options.appId,roomId:this.options.roomCode,uid:this.options.userId,token:this.options.roomToken},i=1===this.options.mediaType||3===this.options.mediaType,o=2===this.options.mediaType||3===this.options.mediaType;this.setLogTime("joinRoom"),this.engine.joinRoom(n.token,n.roomId,{userId:n.uid},{isAutoPublish:!1,isAutoSubscribeAudio:i,isAutoSubscribeVideo:o}).then((function(n){return yr(r,void 0,void 0,(function(){var r,a,s,c,u,d,l,h,p,f=this;return Sr(this,(function(v){return e&&this.createGroupEngine(t,{isAutoPublish:!1,isAutoSubscribeAudio:i,isAutoSubscribeVideo:o}),this.setLogTime("wsJoinRoom"),this.addReportInfo({describe:"加入房间成功",res:n}),r=this,a=this.options.clientId,(s=document.getElementById(r.videoDomId)).style.width="0px",s.style.height="0px",c=r.isMobile(),u="touchstart",d="touchmove",l="touchend",c||(u="mousedown",d="mousemove",l="mouseup"),s.addEventListener("wheel",(function(e){e.preventDefault(),clearTimeout(h),h=setTimeout((function(){var t={action:0,widthPixels:s.clientWidth,heightPixels:s.clientHeight,pointCount:1,touchType:"gesture",properties:[{id:0,toolType:1}],coords:[{pressure:1,size:1,x:e.offsetX,y:e.deltaY>0?e.offsetY+.671875:e.offsetY-e.deltaY+.671875}]},n=JSON.stringify(t);r.sendUserMessage(a,n);var i=e.deltaY;if(i>=0)for(var o=0;o<=i;o++){var c={action:2,widthPixels:s.clientWidth,heightPixels:s.clientHeight,pointCount:1,touchType:"gesture",properties:[{id:0,toolType:1}],coords:[{pressure:1,size:1,x:e.offsetX,y:e.offsetY-o+.671875}]},u=JSON.stringify(c);r.sendUserMessage(a,u)}else for(o=-100;o<=0;o++){c={action:2,widthPixels:s.clientWidth,heightPixels:s.clientHeight,pointCount:1,touchType:"gesture",properties:[{id:0,toolType:1}],coords:[{pressure:1,size:1,x:e.offsetX,y:e.offsetY+o+.671875}]},u=JSON.stringify(c);r.sendUserMessage(a,u)}var d={action:1,widthPixels:s.clientWidth,heightPixels:s.clientHeight,pointCount:1,touchType:"gesture",properties:[{id:0,toolType:1}],coords:[{pressure:1,size:1,x:e.offsetX,y:e.deltaY>0?e.offsetY-e.deltaY+.671875:e.offsetY+.671875}]},l=JSON.stringify(d);r.sendUserMessage(a,l)}),300)})),s.addEventListener("mouseleave",(function(e){if(e.preventDefault(),f.hasPushDown){f.touchConfig.action=1;var t=JSON.stringify(f.touchConfig);f.sendUserMessage(a,t)}})),s.addEventListener(u,(function(e){var t;e.preventDefault(),r.hasPushDown=!0,r.roomMessage.inputStateIsOpen&&r.inputElement?r.inputElement.focus():r.inputElement.blur();var n=s.getBoundingClientRect(),i=n.top,o=n.left;r.touchConfig.properties=[],r.touchConfig.coords=[];var u=c?null===(t=null==e?void 0:e.touches)||void 0===t?void 0:t.length:1;r.touchConfig.action=0,r.touchConfig.pointCount=u,r.touchConfig.widthPixels=1!==r.options.rotateType&&r.roomMessage.isVertical?s.clientWidth:s.clientHeight,r.touchConfig.heightPixels=1!==r.options.rotateType&&r.roomMessage.isVertical?s.clientHeight:s.clientWidth;for(var d=0;d<u;d+=1){var l=c?e.touches[d]:e;r.touchConfig.properties[d]={id:d,toolType:1},r.touchConfig.coords.push({pressure:1,size:1,x:1!==r.options.rotateType&&r.roomMessage.isVertical?l.clientX-o:l.clientY-i,y:1!==r.options.rotateType&&r.roomMessage.isVertical?l.clientY-i:s.clientWidth-l.clientX+o})}var h={action:u>1?261:0,widthPixels:r.touchConfig.widthPixels,heightPixels:r.touchConfig.heightPixels,pointCount:u,touchType:"gesture",properties:r.touchConfig.properties,coords:r.touchConfig.coords},p=JSON.stringify(h);r.sendUserMessage(a,p)})),s.addEventListener(d,(function(e){var t;if(e.preventDefault(),r.hasPushDown){var n=s.getBoundingClientRect(),i=n.top,o=n.left,u=c?null===(t=null==e?void 0:e.touches)||void 0===t?void 0:t.length:1;r.touchConfig.action=2,r.touchConfig.pointCount=u,r.touchConfig.coords=[];for(var d=[],l=0;l<u;l+=1){var h=c?e.touches[l]:e;r.touchConfig.properties[l]={id:l,toolType:1},d.push({pressure:1,size:1,x:1!==r.options.rotateType&&r.roomMessage.isVertical?h.clientX-o:h.clientY-i,y:1!==r.options.rotateType&&r.roomMessage.isVertical?h.clientY-i:s.clientWidth-h.clientX})}r.touchConfig.coords=d;var p={action:2,widthPixels:r.touchConfig.widthPixels,heightPixels:r.touchConfig.heightPixels,pointCount:u,touchType:"gesture",properties:r.touchConfig.properties,coords:r.touchConfig.coords},f=JSON.stringify(p);r.sendUserMessage(a,f)}})),s.addEventListener(l,(function(e){if(e.preventDefault(),r.hasPushDown=!1,c){if(0===e.touches.length){r.touchConfig.action=1;var t=JSON.stringify(r.touchConfig);r.sendUserMessage(a,t)}}else{r.touchConfig.action=1;t=JSON.stringify(r.touchConfig);r.sendUserMessage(a,t)}})),r.onRoomMessageReceived(),r.onUserMessageReceived(),r.onUserJoined(),r.onUserLeave(),r.onRemoteVideoFirstFrame(),r.onUserPublishStream(),((p=Number(r.options.autoRecoveryTime))<1||p>7200)&&(r.options.autoRecoveryTime=300),this.callbacks.onConnectSuccess(),[2]}))}))})).catch((function(e){r.addReportInfo({describe:"加入房间失败",error:e}),r.sendEventReport("error"),console.log("进房错误",e),r.callbacks.onConnectFail({code:e.code,msg:e.message})}))},e.prototype.onUserLeave=function(){var e=this;this.engine.on(P4.events.onUserLeave,(function(t,r){e.addReportInfo({describe:"远端用户离开房间",userId:t,reason:r}),e.sendEventReport("error")}))},e.prototype.updateUiH5=function(){return yr(this,void 0,void 0,(function(){var e,t,r,n,i;return Sr(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e=this.options.clientId,t={type:"updateUiH5"},r={touchType:"eventSdk",content:JSON.stringify(t)},n=JSON.stringify(r),[4,this.sendUserMessage(e,n)];case 1:return i=o.sent(),this.addReportInfo({describe:"发送updateUiH5信息",res:i}),[3,3];case 2:return o.sent(),this.addReportInfo({describe:"发送updateUiH5失败"}),this.updateUiH5(),[3,3];case 3:return[2]}}))}))},e.prototype.onUserJoined=function(){var e=this,t=this;this.options.clientId,t.engine.on(P4.events.onUserJoined,(function(r){1==t.options.mediaType?t.engine.pauseAllSubscribedStream(2):2==t.options.mediaType&&t.engine.pauseAllSubscribedStream(1),e.addReportInfo({describe:"远端用户加入房间",user:r}),t.updateUiH5(),t.onCheckInputState(),t.setKeyboardStyle(t.options.keyboard),t.triggerRecoveryTimeCallback()}))},e.prototype.onRemoteVideoFirstFrame=function(){var e=this;this.engine.on(P4.events.onRemoteVideoFirstFrame,(function(t){e.addReportInfo({describe:"视频首帧渲染成功",event:t}),console.log("视频首帧渲染回调",t),e.firstFrameCount||(e.sendEventReport("init"),e.firstFrameCount++),e.callbacks.onRenderedFirstFrame(),e.isFirstFrame=!0}))},e.prototype.stop=function(){return yr(this,void 0,void 0,(function(){var e,t;return Sr(this,(function(r){switch(r.label){case 0:return clearTimeout(this.autoRecoveryTimer),[4,this.engine.stopAudioCapture()];case 1:return r.sent(),[4,this.engine.stopVideoCapture()];case 2:return r.sent(),[4,this.engine.stopScreenCapture()];case 3:return r.sent(),[4,this.engine.leaveRoom()];case 4:return r.sent(),[4,null===(t=this.groupEngine)||void 0===t?void 0:t.leaveRoom()];case 5:if(r.sent(),this.destroyEngine(),e=document.getElementById(this.initDomId))for(;e.firstChild;)e.removeChild(e.firstChild);return this.sendEventReport("error"),[2]}}))}))},e.prototype.onUserPublishStream=function(){var e=this,t=this;this.engine.on(P4.events.onUserPublishStream,(function(r){return yr(e,void 0,void 0,(function(){var e;return Sr(this,(function(n){switch(n.label){case 0:return e=document.querySelector("#".concat(t.videoDomId)),[4,t.engine.setRemoteVideoPlayer(CP.STREAM_INDEX_MAIN,{userId:r.userId,renderDom:e,renderMode:2,rotation:this.rotation||0})];case 1:return n.sent(),t.addReportInfo({describe:"订阅和播放房间内的音视频流",e:r}),[2]}}))}))}))},e.prototype.sendShakeInfo=function(e){var t=this,r=this.options.clientId;(new M4).startShakeSimulation(e,(function(e){var n=function(t){return JSON.stringify({coords:[],heightPixels:0,isOpenScreenFollowRotation:!1,keyCode:0,pointCount:0,properties:[],text:"",touchType:"eventSdk",widthPixels:0,action:0,content:JSON.stringify(gr(gr({},e),{type:"sdkSensor",sensorType:t}))})};t.sendUserMessage(r,n("gyroscope")),t.sendUserMessage(r,n("gravity")),t.sendUserMessage(r,n("acceleration"))}))},e.prototype.onRoomMessageReceived=function(){var e=this,t=this;t.engine.on(P4.events.onRoomMessageReceived,(function(r){return yr(e,void 0,void 0,(function(){var e,n,i,o,a,s,c,u,d,l,h,p;return Sr(this,(function(f){if(r.message){if(e=JSON.parse(r.message),t.addReportInfo({describe:"接收到房间内广播消息的回调",msg:e}),"message"===e.key&&this.callbacks.onTransparentMsg(0,e.data),"refreshUiType"===e.key){if(p=JSON.parse(e.data),t.roomMessage.isVertical=p.isVertical,p.width==t.remoteResolution.width&&p.height==t.remoteResolution.height)return[2,!1];t.callbacks.onChangeResolution(p.width,p.height),t.remoteResolution.width=p.width,t.remoteResolution.height=p.height,n=t.initDomWidth,i=t.initDomHeight,0!==t.options.isFullScreen||1!==t.options.rotateType&&p.isVertical?0!==t.options.isFullScreen||0!==t.options.rotateType&&!p.isVertical?1!==t.options.isFullScreen||1!==t.options.rotateType&&p.isVertical?(console.log("填充屏幕 + 竖屏"),(d=document.getElementById(t.videoDomId)).style.width="".concat(n,"px"),d.style.height="".concat(i,"px"),l=document.querySelector("#".concat(t.videoDomId)),t.engine.setRemoteVideoPlayer(CP.STREAM_INDEX_MAIN,{userId:t.options.clientId,renderDom:l,renderMode:2,rotation:0}),this.rotation=0):(console.log("填充屏幕 + 横屏"),(d=document.getElementById(t.videoDomId)).style.width="".concat(n,"px"),d.style.height="".concat(i,"px"),l=document.querySelector("#".concat(t.videoDomId)),t.engine.setRemoteVideoPlayer(CP.STREAM_INDEX_MAIN,{userId:t.options.clientId,renderDom:l,renderMode:2,rotation:90}),this.rotation=90):(console.log("自适应 + 竖屏"),o=p.width,a=p.height,s=Math.min(n/o,i/a),c=o*s,u=a*s,(d=document.getElementById(t.videoDomId)).style.width="".concat(c,"px"),d.style.height="".concat(u,"px"),l=document.querySelector("#".concat(t.videoDomId)),t.engine.setRemoteVideoPlayer(CP.STREAM_INDEX_MAIN,{userId:t.options.clientId,renderDom:l,renderMode:2,rotation:0}),this.rotation=0):(console.log("自适应 + 横屏"),d=document.getElementById(t.videoDomId),s=Math.min(n/p.height,i/p.width),o=p.height*s,a=p.width*s,d.style.width="".concat(o,"px"),d.style.height="".concat(a,"px"),l=document.querySelector("#".concat(t.videoDomId)),t.engine.setRemoteVideoPlayer(CP.STREAM_INDEX_MAIN,{userId:t.options.clientId,renderDom:l,renderMode:2,rotation:90}),this.rotation=90)}"inputState"===e.key&&t.inputElement&&(p=JSON.parse(e.data),t.roomMessage.inputStateIsOpen=p.isOpen,h=t.enterkeyhintObj[p.imeOptions],t.inputElement.setAttribute("enterkeyhint",h),!1===p.isOpen&&t.inputElement.blur()),"clipboard"===e.key&&t.options.saveCloudClipboard&&(p=JSON.parse(e.data),t.callbacks.onOutputClipper(p))}return[2]}))}))}))},e.prototype.onUserMessageReceived=function(){var e=this,t=this;t.engine.on(P4.events.onUserMessageReceived,(function(r){return yr(e,void 0,void 0,(function(){var e,n,i,o,a,s,c=this;return Sr(this,(function(u){switch(u.label){case 0:return r.message?(e=JSON.parse(r.message),t.addReportInfo({describe:"收到来自房间中其他用户通过 sendUserMessage 发来的点对点文本消息",msg:e}),console.log("个人广播消息",e),e.key,"equipmentInfo"===e.key&&(null===(a=this.callbacks)||void 0===a||a.onEquipmentInfo(JSON.parse(e.data||[]))),"videoAndAudioControl"!==e.key?[3,11]:(o=JSON.parse(e.data),this.enableMicrophone||this.enableCamera?(n=this.enableMicrophone&&this.enableCamera?MediaType.AUDIO_AND_VIDEO:this.enableCamera?MediaType.VIDEO:MediaType.AUDIO,!0!==o.isOpen?[3,7]:this.enableMicrophone?[4,t.engine.startAudioCapture().then((function(e){console.log("采集音视频成功",e)})).catch((function(e){console.log("采集音视频错误",e)}))]:[3,2]):[2])):[3,12];case 1:u.sent(),u.label=2;case 2:return this.enableCamera?(i=o.isFront?"user":"environment",[4,t.engine.setVideoCaptureDevice(i)]):[3,5];case 3:return u.sent(),[4,t.engine.startVideoCapture().then((function(e){console.log("采集音视频成功",e)})).catch((function(e){console.log("采集音视频错误",e)}))];case 4:u.sent(),u.label=5;case 5:return[4,t.engine.publishStream(n)];case 6:return u.sent(),[3,11];case 7:return[4,t.engine.stopAudioCapture()];case 8:return u.sent(),[4,t.engine.stopVideoCapture()];case 9:return u.sent(),[4,t.engine.unpublishStream(n)];case 10:u.sent(),console.log("停止所有采集"),u.label=11;case 11:if("audioControl"===e.key&&this.enableMicrophone)if((o=JSON.parse(e.data)).isOpen){if(!(null===(s=null===navigator||void 0===navigator?void 0:navigator.mediaDevices)||void 0===s?void 0:s.getUserMedia))return this.callbacks.onAudioError({code:L4,msg:"API_NOT_AVAILABLE"}),[2];t.engine.startAudioCapture().then((function(e){c.callbacks.onAudioInit({code:D4})})).catch((function(e){c.callbacks.onAudioError({code:L4,msg:e.message||e.name})})),t.engine.publishStream(MediaType.AUDIO)}else t.engine.stopAudioCapture(),t.engine.unpublishStream(MediaType.AUDIO),console.log("停止音频采集");u.label=12;case 12:return[2]}}))}))}))},e.prototype.sendInputClipper=function(e){return yr(this,void 0,void 0,(function(){var t,r;return Sr(this,(function(n){switch(n.label){case 0:return t=this.options.clientId,r=JSON.stringify({text:e,touchType:"clipboard"}),[4,this.sendUserMessage(t,r)];case 1:return n.sent(),[2]}}))}))},e.prototype.sendInputString=function(e){return yr(this,void 0,void 0,(function(){var t,r;return Sr(this,(function(n){switch(n.label){case 0:return t=this.options.clientId,r=JSON.stringify({text:e,touchType:"inputBox"}),[4,this.sendUserMessage(t,r)];case 1:return n.sent(),[2]}}))}))},e.prototype.setStreamConfig=function(e){var t=/^[1-9]\d*$/;if(e.definitionId&&e.framerateId&&e.bitrateId&&(Object.values(e).every((function(e){return t.test(e)}))&&e.definitionId>=7&&e.definitionId<=20&&e.framerateId>=1&&e.framerateId<=9&&e.bitrateId>=1&&e.bitrateId<=15)){var r={type:"definitionUpdata",definitionId:e.definitionId,framerateId:e.framerateId,bitrateId:e.bitrateId},n={touchType:"eventSdk",content:JSON.stringify(r)},i=this.options.clientId,o=JSON.stringify(n);this.sendUserMessage(i,o,!0)}},e.prototype.pauseAllSubscribedStream=function(e){if(void 0===e&&(e=3),this.triggerRecoveryTimeCallback(),3!==e)return this.engine.pauseAllSubscribedStream(e);var t={touchType:"eventSdk",content:JSON.stringify({type:"openAudioAndVideo",isOpen:!1})},r=this.options.clientId,n=JSON.stringify(t);return this.engine.sendUserMessage(r,n),this.engine.pauseAllSubscribedStream(e)},e.prototype.resumeAllSubscribedStream=function(e){if(void 0===e&&(e=3),this.triggerRecoveryTimeCallback(),this.startPlay(),3!==e)return this.engine.resumeAllSubscribedStream(e);var t={touchType:"eventSdk",content:JSON.stringify({type:"openAudioAndVideo",isOpen:!0})},r=this.options.clientId,n=JSON.stringify(t);return this.sendUserMessage(r,n),this.engine.resumeAllSubscribedStream(e)},e.prototype.saveScreenShotToLocal=function(){var e=this.options.clientId;return this.engine.takeRemoteSnapshot(e,0)},e.prototype.saveScreenShotToRemote=function(){var e={touchType:"eventSdk",content:JSON.stringify({type:"localScreenshot"})},t=this.options.clientId,r=JSON.stringify(e);this.sendUserMessage(t,r)},e.prototype.setPhoneRotation=function(e){this.triggerRecoveryTimeCallback(),0===e?this.rotateScreen(0):1===e&&this.rotateScreen(90)},e.prototype.rotateScreen=function(e){var t=this;this.options.rotateType=90===e?1:0;var r=t.initDomWidth,n=t.initDomHeight;if(0===t.options.isFullScreen&&90===e){console.log("手动 自适应 + 横屏");var i=document.getElementById(t.videoDomId),o=Math.min(r/t.remoteResolution.height,n/t.remoteResolution.width),a=t.remoteResolution.height*o,s=t.remoteResolution.width*o;i.style.width="".concat(a,"px"),i.style.height="".concat(s,"px");var c=document.querySelector("#".concat(t.videoDomId));t.engine.setRemoteVideoPlayer(CP.STREAM_INDEX_MAIN,{userId:t.options.clientId,renderDom:c,renderMode:2,rotation:90}),this.rotation=90}else if(0===t.options.isFullScreen&&0===e){console.log("手动 自适应 + 竖屏");a=t.remoteResolution.width,s=t.remoteResolution.height;var u=a*(o=Math.min(r/a,n/s)),d=s*o;(i=document.getElementById(t.videoDomId)).style.width="".concat(u,"px"),i.style.height="".concat(d,"px");c=document.querySelector("#".concat(t.videoDomId));t.engine.setRemoteVideoPlayer(CP.STREAM_INDEX_MAIN,{userId:t.options.clientId,renderDom:c,renderMode:2,rotation:0}),this.rotation=0}else if(1===t.options.isFullScreen&&90===e){console.log("手动 填充屏幕 + 横屏"),(i=document.getElementById(t.videoDomId)).style.width="".concat(r,"px"),i.style.height="".concat(n,"px");c=document.querySelector("#".concat(t.videoDomId));t.engine.setRemoteVideoPlayer(CP.STREAM_INDEX_MAIN,{userId:t.options.clientId,renderDom:c,renderMode:2,rotation:90}),this.rotation=90}else{console.log("手动 填充屏幕 + 竖屏"),(i=document.getElementById(t.videoDomId)).style.width="".concat(r,"px"),i.style.height="".concat(n,"px");c=document.querySelector("#".concat(t.videoDomId));t.engine.setRemoteVideoPlayer(CP.STREAM_INDEX_MAIN,{userId:t.options.clientId,renderDom:c,renderMode:2,rotation:0}),this.rotation=0}},e.prototype.setGPS=function(e,t){var r={latitude:t,longitude:e,time:(new Date).getTime()},n={type:"sdkLocation",content:JSON.stringify(r)},i={touchType:"eventSdk",content:JSON.stringify(n)},o=this.options.clientId,a=JSON.stringify(i);console.log("手动传入经纬度",a),this.sendUserMessage(o,a)},e.prototype.setKeyboardStyle=function(e){var t={type:"keyBoardType",isLocalKeyBoard:"local"===e},r={touchType:"eventSdk",content:JSON.stringify(t)},n=this.options.clientId,i=JSON.stringify(r);this.sendUserMessage(n,i)},e.prototype.onCheckInputState=function(){return yr(this,void 0,void 0,(function(){var e,t;return Sr(this,(function(r){switch(r.label){case 0:return e=this.options.clientId,t=JSON.stringify({touchType:"inputState"}),[4,this.sendUserMessage(e,t)];case 1:return r.sent(),[2]}}))}))},e.prototype.addInputElement=function(){var e=this,t=document.getElementById(this.initDomId);this.inputElement=document.createElement("input"),this.inputElement.setAttribute("type","text"),this.inputElement.setAttribute("style","position: absolute; top: 50px;left: 80px;z-index: -1");var r=!1;this.inputElement.addEventListener("compositionstart",(function(){r=!0})),this.inputElement.addEventListener("compositionend",(function(t){r=!1;var n={action:1,touchType:"input",keyCode:1,text:t.target.value},i=e.options.clientId,o=JSON.stringify(n);e.inputElement.value="",i&&e.sendUserMessage(i,o)})),this.inputElement.addEventListener("input",(function(t){if(!r){var n={action:1,touchType:"input",keyCode:1,text:t.target.value},i=e.options.clientId,o=JSON.stringify(n);e.inputElement.value="",i&&e.sendUserMessage(i,o)}})),this.inputElement.addEventListener("keydown",(function(t){if("Backspace"===t.key){var r=e.options.clientId,n=JSON.stringify({action:1,touchType:"input",keyCode:67,text:""}),i=JSON.stringify({action:0,touchType:"input",keyCode:67,text:""});r&&(e.sendUserMessage(r,n),e.sendUserMessage(r,i))}else if("Enter"===t.key){r=e.options.clientId;var o=JSON.stringify({action:1,touchType:"input",keyCode:66,text:""}),a=JSON.stringify({action:0,touchType:"input",keyCode:66,text:""});e.inputElement.blur(),r&&(e.sendUserMessage(r,o),e.sendUserMessage(r,a))}})),t.appendChild(this.inputElement)},e.prototype.setAutoRecycleTime=function(e){e>=1&&e<=7200&&(this.options.autoRecoveryTime=e,this.triggerRecoveryTimeCallback())},e.prototype.getAutoRecycleTime=function(){return this.options.autoRecoveryTime},e.prototype.sendCommand=function(e){switch(e){case"back":this.goAppUpPage();break;case"home":this.goAppHome();break;case"menu":this.goAppMenu()}},e.prototype.goAppUpPage=function(){var e=this.options.clientId,t=JSON.stringify({action:0,touchType:"keystroke",keyCode:4,text:""});e&&this.sendUserMessage(e,t)},e.prototype.goAppHome=function(){var e=this.options.clientId,t=JSON.stringify({action:1,touchType:"keystroke",keyCode:3,text:""}),r=JSON.stringify({action:0,touchType:"keystroke",keyCode:3,text:""});e&&(this.sendUserMessage(e,t),this.sendUserMessage(e,r))},e.prototype.goAppMenu=function(){var e=this.options.clientId,t=JSON.stringify({action:1,touchType:"keystroke",keyCode:187,text:""}),r=JSON.stringify({action:0,touchType:"keystroke",keyCode:187,text:""});e&&(this.sendUserMessage(e,t),this.sendUserMessage(e,r))},e.prototype.increaseVolume=function(){this.startPlay();var e=this.options.clientId,t=JSON.stringify({action:1,touchType:"keystroke",keyCode:24,text:""}),r=JSON.stringify({action:0,touchType:"keystroke",keyCode:24,text:""});e&&(this.sendUserMessage(e,t,!0),this.sendUserMessage(e,r,!0))},e.prototype.decreaseVolume=function(){this.startPlay();var e=this.options.clientId,t=JSON.stringify({action:1,touchType:"keystroke",keyCode:25,text:""}),r=JSON.stringify({action:0,touchType:"keystroke",keyCode:25,text:""});e&&(this.sendUserMessage(e,t,!0),this.sendUserMessage(e,r,!0))},e.prototype.saveCloudClipboard=function(e){this.options.saveCloudClipboard=e},e}(),m5={exports:{}};var g5,y5={exports:{}},S5=J(Object.freeze({__proto__:null,default:{}}));function b5(){return g5||(g5=1,y5.exports=function(){var e=e||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==K&&K.crypto&&(r=K.crypto),!r)try{r=S5}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),o={},a=o.lib={},s=a.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=a.WordArray=s.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||d).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var a=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(var s=0;s<i;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),u=o.enc={},d=u.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},l=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},h=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,s=o/(4*a),u=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,d=e.min(4*u,o);if(u){for(var l=0;l<u;l+=a)this._doProcessBlock(i,l);r=i.splice(0,u),n.sigBytes-=d}return new c.init(r,d)},clone:function(){var e=s.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});a.Hasher=p.extend({cfg:s.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new f.HMAC.init(e,r).finalize(t)}}});var f=o.algo={};return o}(Math);return e}()),y5.exports}var E5,k5={exports:{}};function T5(){return E5||(E5=1,k5.exports=function(e){return n=(r=e).lib,i=n.Base,o=n.WordArray,(a=r.x64={}).Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=i.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var i=e[n];r.push(i.high),r.push(i.low)}return o.create(r,this.sigBytes)},clone:function(){for(var e=i.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}}),e;var t,r,n,i,o,a}(b5())),k5.exports}var I5,R5={exports:{}};function C5(){return I5||(I5=1,R5.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,n=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,n=[],i=0;i<t;i++)n[i>>>2]|=e[i]<<24-i%4*8;r.call(this,n,t)}else r.apply(this,arguments)};n.prototype=t}}(),e.lib.WordArray}(b5())),R5.exports}var w5,A5={exports:{}};function x5(){return w5||(w5=1,A5.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var o=t[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var a=i(t[o>>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16}(b5())),A5.exports}var O5,P5={exports:{}};function N5(){return O5||(O5=1,P5.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],o=0,a=0;a<t;a++)if(a%4){var s=n[e.charCodeAt(a-1)]<<a%4*2|n[e.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return r.create(i,o)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;o+=3)for(var a=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<r;s++)i.push(n.charAt(a>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<r.length;o++)i[r.charCodeAt(o)]=o}var a=r.charAt(64);if(a){var s=e.indexOf(a);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(b5())),P5.exports}var M5,D5={exports:{}};function L5(){return M5||(M5=1,D5.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var i=[],o=0,a=0;a<t;a++)if(a%4){var s=n[e.charCodeAt(a-1)]<<a%4*2|n[e.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return r.create(i,o)}t.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,n=e.sigBytes,i=t?this._safe_map:this._map;e.clamp();for(var o=[],a=0;a<n;a+=3)for(var s=(r[a>>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,c=0;c<4&&a+.75*c<n;c++)o.push(i.charAt(s>>>6*(3-c)&63));var u=i.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,i=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a<i.length;a++)o[i.charCodeAt(a)]=a}var s=i.charAt(64);if(s){var c=e.indexOf(s);-1!==c&&(r=c)}return n(e,r,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),e.enc.Base64url}(b5())),D5.exports}var U5,V5={exports:{}};function F5(){return U5||(U5=1,V5.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,a=r.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=a.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],p=e[t+2],f=e[t+3],v=e[t+4],_=e[t+5],m=e[t+6],g=e[t+7],y=e[t+8],S=e[t+9],b=e[t+10],E=e[t+11],k=e[t+12],T=e[t+13],I=e[t+14],R=e[t+15],C=o[0],w=o[1],A=o[2],x=o[3];C=u(C,w,A,x,a,7,s[0]),x=u(x,C,w,A,c,12,s[1]),A=u(A,x,C,w,p,17,s[2]),w=u(w,A,x,C,f,22,s[3]),C=u(C,w,A,x,v,7,s[4]),x=u(x,C,w,A,_,12,s[5]),A=u(A,x,C,w,m,17,s[6]),w=u(w,A,x,C,g,22,s[7]),C=u(C,w,A,x,y,7,s[8]),x=u(x,C,w,A,S,12,s[9]),A=u(A,x,C,w,b,17,s[10]),w=u(w,A,x,C,E,22,s[11]),C=u(C,w,A,x,k,7,s[12]),x=u(x,C,w,A,T,12,s[13]),A=u(A,x,C,w,I,17,s[14]),C=d(C,w=u(w,A,x,C,R,22,s[15]),A,x,c,5,s[16]),x=d(x,C,w,A,m,9,s[17]),A=d(A,x,C,w,E,14,s[18]),w=d(w,A,x,C,a,20,s[19]),C=d(C,w,A,x,_,5,s[20]),x=d(x,C,w,A,b,9,s[21]),A=d(A,x,C,w,R,14,s[22]),w=d(w,A,x,C,v,20,s[23]),C=d(C,w,A,x,S,5,s[24]),x=d(x,C,w,A,I,9,s[25]),A=d(A,x,C,w,f,14,s[26]),w=d(w,A,x,C,y,20,s[27]),C=d(C,w,A,x,T,5,s[28]),x=d(x,C,w,A,p,9,s[29]),A=d(A,x,C,w,g,14,s[30]),C=l(C,w=d(w,A,x,C,k,20,s[31]),A,x,_,4,s[32]),x=l(x,C,w,A,y,11,s[33]),A=l(A,x,C,w,E,16,s[34]),w=l(w,A,x,C,I,23,s[35]),C=l(C,w,A,x,c,4,s[36]),x=l(x,C,w,A,v,11,s[37]),A=l(A,x,C,w,g,16,s[38]),w=l(w,A,x,C,b,23,s[39]),C=l(C,w,A,x,T,4,s[40]),x=l(x,C,w,A,a,11,s[41]),A=l(A,x,C,w,f,16,s[42]),w=l(w,A,x,C,m,23,s[43]),C=l(C,w,A,x,S,4,s[44]),x=l(x,C,w,A,k,11,s[45]),A=l(A,x,C,w,R,16,s[46]),C=h(C,w=l(w,A,x,C,p,23,s[47]),A,x,a,6,s[48]),x=h(x,C,w,A,g,10,s[49]),A=h(A,x,C,w,I,15,s[50]),w=h(w,A,x,C,_,21,s[51]),C=h(C,w,A,x,k,6,s[52]),x=h(x,C,w,A,f,10,s[53]),A=h(A,x,C,w,b,15,s[54]),w=h(w,A,x,C,c,21,s[55]),C=h(C,w,A,x,y,6,s[56]),x=h(x,C,w,A,R,10,s[57]),A=h(A,x,C,w,m,15,s[58]),w=h(w,A,x,C,T,21,s[59]),C=h(C,w,A,x,v,6,s[60]),x=h(x,C,w,A,E,10,s[61]),A=h(A,x,C,w,p,15,s[62]),w=h(w,A,x,C,S,21,s[63]),o[0]=o[0]+C|0,o[1]=o[1]+w|0,o[2]=o[2]+A|0,o[3]=o[3]+x|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var o=t.floor(n/4294967296),a=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var d=c[u];c[u]=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,o,a){var s=e+(t&r|~t&n)+i+a;return(s<<o|s>>>32-o)+t}function d(e,t,r,n,i,o,a){var s=e+(t&n|r&~n)+i+a;return(s<<o|s>>>32-o)+t}function l(e,t,r,n,i,o,a){var s=e+(t^r^n)+i+a;return(s<<o|s>>>32-o)+t}function h(e,t,r,n,i,o,a){var s=e+(r^(t|~n))+i+a;return(s<<o|s>>>32-o)+t}r.MD5=o._createHelper(c),r.HmacMD5=o._createHmacHelper(c)}(Math),e.MD5}(b5())),V5.exports}var B5,j5={exports:{}};function H5(){return B5||(B5=1,j5.exports=function(e){return r=(t=e).lib,n=r.WordArray,i=r.Hasher,o=t.algo,a=[],s=o.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],c=r[4],u=0;u<80;u++){if(u<16)a[u]=0|e[t+u];else{var d=a[u-3]^a[u-8]^a[u-14]^a[u-16];a[u]=d<<1|d>>>31}var l=(n<<5|n>>>27)+c+a[u];l+=u<20?1518500249+(i&o|~i&s):u<40?1859775393+(i^o^s):u<60?(i&o|i&s|o&s)-1894007588:(i^o^s)-899497514,c=s,s=o,o=i<<30|i>>>2,i=n,n=l}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=i._createHelper(s),t.HmacSHA1=i._createHmacHelper(s),e.SHA1;var t,r,n,i,o,a,s}(b5())),j5.exports}var z5,G5={exports:{}};function W5(){return z5||(z5=1,G5.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,a=r.algo,s=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(s[i]=r(t.pow(n,.5))),c[i]=r(t.pow(n,1/3)),i++),n++}();var u=[],d=a.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],d=r[5],l=r[6],h=r[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var f=u[p-15],v=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,_=u[p-2],m=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;u[p]=v+u[p-7]+m+u[p-16]}var g=n&i^n&o^i&o,y=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),S=h+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&d^~s&l)+c[p]+u[p];h=l,l=d,d=s,s=a+S|0,a=o,o=i,i=n,n=S+(y+g)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+d|0,r[6]=r[6]+l|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=o._createHelper(d),r.HmacSHA256=o._createHmacHelper(d)}(Math),e.SHA256}(b5())),G5.exports}var K5,X5={exports:{}};var J5,q5={exports:{}};function Y5(){return J5||(J5=1,q5.exports=function(e){return function(){var t=e,r=t.lib.Hasher,n=t.x64,i=n.Word,o=n.WordArray,a=t.algo;function s(){return i.create.apply(i,arguments)}var c=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=s()}();var d=a.SHA512=r.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],d=r[5],l=r[6],h=r[7],p=n.high,f=n.low,v=i.high,_=i.low,m=o.high,g=o.low,y=a.high,S=a.low,b=s.high,E=s.low,k=d.high,T=d.low,I=l.high,R=l.low,C=h.high,w=h.low,A=p,x=f,O=v,P=_,N=m,M=g,D=y,L=S,U=b,V=E,F=k,B=T,j=I,H=R,z=C,G=w,W=0;W<80;W++){var K,X,J=u[W];if(W<16)X=J.high=0|e[t+2*W],K=J.low=0|e[t+2*W+1];else{var q=u[W-15],Y=q.high,Q=q.low,Z=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,$=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),ee=u[W-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=u[W-7],ae=oe.high,se=oe.low,ce=u[W-16],ue=ce.high,de=ce.low;X=(X=(X=Z+ae+((K=$+se)>>>0<$>>>0?1:0))+ne+((K+=ie)>>>0<ie>>>0?1:0))+ue+((K+=de)>>>0<de>>>0?1:0),J.high=X,J.low=K}var le,he=U&F^~U&j,pe=V&B^~V&H,fe=A&O^A&N^O&N,ve=x&P^x&M^P&M,_e=(A>>>28|x<<4)^(A<<30|x>>>2)^(A<<25|x>>>7),me=(x>>>28|A<<4)^(x<<30|A>>>2)^(x<<25|A>>>7),ge=(U>>>14|V<<18)^(U>>>18|V<<14)^(U<<23|V>>>9),ye=(V>>>14|U<<18)^(V>>>18|U<<14)^(V<<23|U>>>9),Se=c[W],be=Se.high,Ee=Se.low,ke=z+ge+((le=G+ye)>>>0<G>>>0?1:0),Te=me+ve;z=j,G=H,j=F,H=B,F=U,B=V,U=D+(ke=(ke=(ke=ke+he+((le+=pe)>>>0<pe>>>0?1:0))+be+((le+=Ee)>>>0<Ee>>>0?1:0))+X+((le+=K)>>>0<K>>>0?1:0))+((V=L+le|0)>>>0<L>>>0?1:0)|0,D=N,L=M,N=O,M=P,O=A,P=x,A=ke+(_e+fe+(Te>>>0<me>>>0?1:0))+((x=le+Te|0)>>>0<le>>>0?1:0)|0}f=n.low=f+x,n.high=p+A+(f>>>0<x>>>0?1:0),_=i.low=_+P,i.high=v+O+(_>>>0<P>>>0?1:0),g=o.low=g+M,o.high=m+N+(g>>>0<M>>>0?1:0),S=a.low=S+L,a.high=y+D+(S>>>0<L>>>0?1:0),E=s.low=E+V,s.high=b+U+(E>>>0<V>>>0?1:0),T=d.low=T+B,d.high=k+F+(T>>>0<B>>>0?1:0),R=l.low=R+H,l.high=I+j+(R>>>0<H>>>0?1:0),w=h.low=w+G,h.high=C+z+(w>>>0<G>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(d),t.HmacSHA512=r._createHmacHelper(d)}(),e.SHA512}(b5(),T5())),q5.exports}var Q5,Z5={exports:{}};var $5,e6={exports:{}};function t6(){return $5||($5=1,e6.exports=function(e){return function(t){var r=e,n=r.lib,i=n.WordArray,o=n.Hasher,a=r.x64.Word,s=r.algo,c=[],u=[],d=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var s=0,l=0,h=0;h<7;h++){if(1&i){var p=(1<<h)-1;p<32?l^=1<<p:s^=1<<p-32}128&i?i=i<<1^113:i<<=1}d[o]=a.create(s,l)}}();var l=[];!function(){for(var e=0;e<25;e++)l[e]=a.create()}();var h=s.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,i=0;i<n;i++){var o=e[t+2*i],a=e[t+2*i+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(w=r[i]).high^=a,w.low^=o}for(var s=0;s<24;s++){for(var h=0;h<5;h++){for(var p=0,f=0,v=0;v<5;v++)p^=(w=r[h+5*v]).high,f^=w.low;var _=l[h];_.high=p,_.low=f}for(h=0;h<5;h++){var m=l[(h+4)%5],g=l[(h+1)%5],y=g.high,S=g.low;for(p=m.high^(y<<1|S>>>31),f=m.low^(S<<1|y>>>31),v=0;v<5;v++)(w=r[h+5*v]).high^=p,w.low^=f}for(var b=1;b<25;b++){var E=(w=r[b]).high,k=w.low,T=c[b];T<32?(p=E<<T|k>>>32-T,f=k<<T|E>>>32-T):(p=k<<T-32|E>>>64-T,f=E<<T-32|k>>>64-T);var I=l[u[b]];I.high=p,I.low=f}var R=l[0],C=r[0];for(R.high=C.high,R.low=C.low,h=0;h<5;h++)for(v=0;v<5;v++){var w=r[b=h+5*v],A=l[b],x=l[(h+1)%5+5*v],O=l[(h+2)%5+5*v];w.high=A.high^~x.high&O.high,w.low=A.low^~x.low&O.low}w=r[0];var P=d[s];w.high^=P.high,w.low^=P.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/o)*o>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,c=s/8,u=[],d=0;d<c;d++){var l=a[d],h=l.high,p=l.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),u.push(p),u.push(h)}return new i.init(u,s)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=o._createHelper(h),r.HmacSHA3=o._createHmacHelper(h)}(Math),e.SHA3}(b5(),T5())),e6.exports}var r6,n6={exports:{}};var i6,o6={exports:{}};function a6(){return i6||(i6=1,o6.exports=function(e){var t,r,n;r=(t=e).lib.Base,n=t.enc.Utf8,t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),s=o.words,c=a.words,u=0;u<r;u++)s[u]^=1549556828,c[u]^=909522486;o.sigBytes=a.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}(b5())),o6.exports}var s6,c6={exports:{}};var u6,d6={exports:{}};function l6(){return u6||(u6=1,d6.exports=function(e){return r=(t=e).lib,n=r.Base,i=r.WordArray,o=t.algo,a=o.MD5,s=o.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,o=n.hasher.create(),a=i.create(),s=a.words,c=n.keySize,u=n.iterations;s.length<c;){r&&o.update(r),r=o.update(e).finalize(t),o.reset();for(var d=1;d<u;d++)r=o.finalize(r),o.reset();a.concat(r)}return a.sigBytes=4*c,a}}),t.EvpKDF=function(e,t,r){return s.create(r).compute(e,t)},e.EvpKDF;var t,r,n,i,o,a,s}(b5(),H5(),a6())),d6.exports}var h6,p6={exports:{}};function f6(){return h6||(h6=1,p6.exports=function(e){e.lib.Cipher||function(t){var r=e,n=r.lib,i=n.Base,o=n.WordArray,a=n.BufferedBlockAlgorithm,s=r.enc;s.Utf8;var c=s.Base64,u=r.algo.EvpKDF,d=n.Cipher=a.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?y:m}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()});n.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=r.mode={},h=n.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=l.CBC=function(){var e=h.extend();function r(e,r,n){var i,o=this._iv;o?(i=o,this._iv=t):i=this._prevBlock;for(var a=0;a<n;a++)e[r+a]^=i[a]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=e.slice(t,t+i);n.decryptBlock(e,t),r.call(this,e,t,i),this._prevBlock=o}}),e}(),f=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,a=[],s=0;s<n;s+=4)a.push(i);var c=o.create(a,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=d.extend({cfg:d.cfg.extend({mode:p,padding:f}),reset:function(){var e;d.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var v=n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(t):t).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=o.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),v.create({ciphertext:r,salt:t})}},m=n.SerializableCipher=i.extend({cfg:i.extend({format:_}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),a=i.cfg;return v.create({ciphertext:o,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),g=(r.kdf={}).OpenSSL={execute:function(e,t,r,n,i){if(n||(n=o.random(8)),i)a=u.create({keySize:t+r,hasher:i}).compute(e,n);else var a=u.create({keySize:t+r}).compute(e,n);var s=o.create(a.words.slice(t),4*r);return a.sigBytes=4*t,v.create({key:a,iv:s,salt:n})}},y=n.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:g}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=i.iv;var o=m.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=i.iv,m.decrypt.call(this,e,t,i.key,n)}})}()}(b5(),l6())),p6.exports}var v6,_6={exports:{}};function m6(){return v6||(v6=1,_6.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,n){var i,o=this._iv;o?(i=o.slice(0),this._iv=void 0):i=this._prevBlock,n.encryptBlock(i,0);for(var a=0;a<r;a++)e[t+a]^=i[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i,n),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=e.slice(t,t+i);r.call(this,e,t,i,n),this._prevBlock=o}}),t}(),e.mode.CFB}(b5(),f6())),_6.exports}var g6,y6={exports:{}};function S6(){return g6||(g6=1,y6.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,o=this._counter;i&&(o=this._counter=i.slice(0),this._iv=void 0);var a=o.slice(0);r.encryptBlock(a,0),o[n-1]=o[n-1]+1|0;for(var s=0;s<n;s++)e[t+s]^=a[s]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(b5(),f6())),y6.exports}var b6,E6={exports:{}};function k6(){return b6||(b6=1,E6.exports=function(e){
|
|
4
|
+
/** @preserve
|
|
5
|
+
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
6
|
+
* derived from CryptoJS.mode.CTR
|
|
7
|
+
* Jan Hruby jhruby.web@gmail.com
|
|
8
|
+
*/
|
|
9
|
+
return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255&~(e>>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}return e}function n(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var i=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,o=this._iv,a=this._counter;o&&(a=this._counter=o.slice(0),this._iv=void 0),n(a);var s=a.slice(0);r.encryptBlock(s,0);for(var c=0;c<i;c++)e[t+c]^=s[c]}});return t.Decryptor=i,t}(),e.mode.CTRGladman}(b5(),f6())),E6.exports}var T6,I6={exports:{}};function R6(){return T6||(T6=1,I6.exports=function(e){return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,o=this._keystream;i&&(o=this._keystream=i.slice(0),this._iv=void 0),r.encryptBlock(o,0);for(var a=0;a<n;a++)e[t+a]^=o[a]}}),t.Decryptor=r,t),e.mode.OFB;var t,r}(b5(),f6())),I6.exports}var C6,w6={exports:{}};var A6,x6={exports:{}};var O6,P6={exports:{}};var N6,M6={exports:{}};var D6,L6={exports:{}};var U6,V6={exports:{}};var F6,B6={exports:{}};var j6,H6={exports:{}};var z6,G6={exports:{}};function W6(){return z6||(z6=1,G6.exports=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,i=r.BlockCipher,o=t.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],d=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=o.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=a[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var u=i[o]=[],d=c[o];for(r=0;r<24;r++)u[r/6|0]|=t[(s[r]-1+d)%28]<<31-r%6,u[4+(r/6|0)]|=t[28+(s[r+24]-1+d)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var l=this._invSubKeys=[];for(r=0;r<16;r++)l[r]=i[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),h.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,a=this._rBlock,s=0,c=0;c<8;c++)s|=u[c][((a^i[c])&d[c])>>>0];this._lBlock=a,this._rBlock=o^s}var l=this._lBlock;this._lBlock=this._rBlock,this._rBlock=l,h.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function p(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}t.DES=i._createHelper(l);var f=o.TripleDES=i.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),i=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=l.createEncryptor(n.create(t)),this._des2=l.createEncryptor(n.create(r)),this._des3=l.createEncryptor(n.create(i))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=i._createHelper(f)}(),e.TripleDES}(b5(),N5(),F5(),l6(),f6())),G6.exports}var K6,X6={exports:{}};var J6,q6={exports:{}};var Y6,Q6={exports:{}};var Z6,$6={exports:{}};function e8(){return Z6||(Z6=1,$6.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo;const i=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var s={pbox:[],sbox:[]};function c(e,t){let r=t>>24&255,n=t>>16&255,i=t>>8&255,o=255&t,a=e.sbox[0][r]+e.sbox[1][n];return a^=e.sbox[2][i],a+=e.sbox[3][o],a}function u(e,t,r){let n,o=t,a=r;for(let t=0;t<i;++t)o^=e.pbox[t],a=c(e,o)^a,n=o,o=a,a=n;return n=o,o=a,a=n,a^=e.pbox[i],o^=e.pbox[i+1],{left:o,right:a}}function d(e,t,r){let n,o=t,a=r;for(let t=i+1;t>1;--t)o^=e.pbox[t],a=c(e,o)^a,n=o,o=a,a=n;return n=o,o=a,a=n,a^=e.pbox[1],o^=e.pbox[0],{left:o,right:a}}function l(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let n=0;for(let a=0;a<i+2;a++)e.pbox[a]=o[a]^t[n],n++,n>=r&&(n=0);let s=0,c=0,d=0;for(let t=0;t<i+2;t+=2)d=u(e,s,c),s=d.left,c=d.right,e.pbox[t]=s,e.pbox[t+1]=c;for(let t=0;t<4;t++)for(let r=0;r<256;r+=2)d=u(e,s,c),s=d.left,c=d.right,e.sbox[t][r]=s,e.sbox[t][r+1]=c;return!0}var h=n.Blowfish=r.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4;l(s,t,r)}},encryptBlock:function(e,t){var r=u(s,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},decryptBlock:function(e,t){var r=d(s,e[t],e[t+1]);e[t]=r.left,e[t+1]=r.right},blockSize:2,keySize:4,ivSize:2});t.Blowfish=r._createHelper(h)}(),e.Blowfish}(b5(),N5(),F5(),l6(),f6())),$6.exports}m5.exports=function(e){return e}(b5(),T5(),C5(),x5(),N5(),L5(),F5(),H5(),W5(),K5||(K5=1,X5.exports=function(e){return r=(t=e).lib.WordArray,n=t.algo,i=n.SHA256,o=n.SHA224=i.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=i._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=i._createHelper(o),t.HmacSHA224=i._createHmacHelper(o),e.SHA224;var t,r,n,i,o}(b5(),W5())),Y5(),Q5||(Q5=1,Z5.exports=function(e){return r=(t=e).x64,n=r.Word,i=r.WordArray,o=t.algo,a=o.SHA512,s=o.SHA384=a.extend({_doReset:function(){this._hash=new i.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=a._createHelper(s),t.HmacSHA384=a._createHmacHelper(s),e.SHA384;var t,r,n,i,o,a,s}(b5(),T5(),Y5())),t6(),r6||(r6=1,n6.exports=function(e){
|
|
10
|
+
/** @preserve
|
|
11
|
+
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
12
|
+
|
|
13
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
14
|
+
|
|
15
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
16
|
+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
19
|
+
*/
|
|
20
|
+
return function(){var t=e,r=t.lib,n=r.WordArray,i=r.Hasher,o=t.algo,a=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=n.create([0,1518500249,1859775393,2400959708,2840853838]),l=n.create([1352829926,1548603684,1836072691,2053994217,0]),h=o.RIPEMD160=i.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,h,y,S,b,E,k,T,I,R,C,w=this._hash.words,A=d.words,x=l.words,O=a.words,P=s.words,N=c.words,M=u.words;for(E=o=w[0],k=h=w[1],T=y=w[2],I=S=w[3],R=b=w[4],r=0;r<80;r+=1)C=o+e[t+O[r]]|0,C+=r<16?p(h,y,S)+A[0]:r<32?f(h,y,S)+A[1]:r<48?v(h,y,S)+A[2]:r<64?_(h,y,S)+A[3]:m(h,y,S)+A[4],C=(C=g(C|=0,N[r]))+b|0,o=b,b=S,S=g(y,10),y=h,h=C,C=E+e[t+P[r]]|0,C+=r<16?m(k,T,I)+x[0]:r<32?_(k,T,I)+x[1]:r<48?v(k,T,I)+x[2]:r<64?f(k,T,I)+x[3]:p(k,T,I)+x[4],C=(C=g(C|=0,M[r]))+R|0,E=R,R=I,I=g(T,10),T=k,k=C;C=w[1]+y+I|0,w[1]=w[2]+S+R|0,w[2]=w[3]+b+E|0,w[3]=w[4]+o+k|0,w[4]=w[0]+h+T|0,w[0]=C},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,o=i.words,a=0;a<5;a++){var s=o[a];o[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return i},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function f(e,t,r){return e&t|~e&r}function v(e,t,r){return(e|~t)^r}function _(e,t,r){return e&r|t&~r}function m(e,t,r){return e^(t|~r)}function g(e,t){return e<<t|e>>>32-t}t.RIPEMD160=i._createHelper(h),t.HmacRIPEMD160=i._createHmacHelper(h)}(),e.RIPEMD160}(b5())),a6(),s6||(s6=1,c6.exports=function(e){return n=(r=(t=e).lib).Base,i=r.WordArray,a=(o=t.algo).SHA256,s=o.HMAC,c=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=s.create(r.hasher,e),o=i.create(),a=i.create([1]),c=o.words,u=a.words,d=r.keySize,l=r.iterations;c.length<d;){var h=n.update(t).finalize(a);n.reset();for(var p=h.words,f=p.length,v=h,_=1;_<l;_++){v=n.finalize(v),n.reset();for(var m=v.words,g=0;g<f;g++)p[g]^=m[g]}o.concat(h),u[0]++}return o.sigBytes=4*d,o}}),t.PBKDF2=function(e,t,r){return c.create(r).compute(e,t)},e.PBKDF2;var t,r,n,i,o,a,s,c}(b5(),W5(),a6())),l6(),f6(),m6(),S6(),k6(),R6(),C6||(C6=1,w6.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(b5(),f6())),A6||(A6=1,x6.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,i=n-r%n,o=r+i-1;e.clamp(),e.words[o>>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(b5(),f6())),O6||(O6=1,P6.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var n=4*r,i=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(i-1)).concat(e.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(b5(),f6())),N6||(N6=1,M6.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(b5(),f6())),D6||(D6=1,L6.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding}(b5(),f6())),U6||(U6=1,V6.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(b5(),f6())),F6||(F6=1,B6.exports=function(e){return r=(t=e).lib.CipherParams,n=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return r.create({ciphertext:t})}},e.format.Hex;var t,r,n}(b5(),f6())),j6||(j6=1,H6.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo,i=[],o=[],a=[],s=[],c=[],u=[],d=[],l=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var f=n^n<<1^n<<2^n<<3^n<<4;f=f>>>8^255&f^99,i[r]=f,o[f]=r;var v=e[r],_=e[v],m=e[_],g=257*e[f]^16843008*f;a[r]=g<<24|g>>>8,s[r]=g<<16|g>>>16,c[r]=g<<8|g>>>24,u[r]=g,g=16843009*m^65537*_^257*v^16843008*r,d[f]=g<<24|g>>>8,l[f]=g<<16|g>>>16,h[f]=g<<8|g>>>24,p[f]=g,r?(r=v^e[e[e[m^v]]],n^=e[e[n]]):r=n=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],v=n.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],a=0;a<n;a++)a<r?o[a]=t[a]:(u=o[a-1],a%r?r>6&&a%r==4&&(u=i[u>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u]):(u=i[(u=u<<8|u>>>24)>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u],u^=f[a/r|0]<<24),o[a]=o[a-r]^u);for(var s=this._invKeySchedule=[],c=0;c<n;c++){if(a=n-c,c%4)var u=o[a];else u=o[a-4];s[c]=c<4||a<=4?u:d[i[u>>>24]]^l[i[u>>>16&255]]^h[i[u>>>8&255]]^p[i[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,d,l,h,p,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,a,s){for(var c=this._nRounds,u=e[t]^r[0],d=e[t+1]^r[1],l=e[t+2]^r[2],h=e[t+3]^r[3],p=4,f=1;f<c;f++){var v=n[u>>>24]^i[d>>>16&255]^o[l>>>8&255]^a[255&h]^r[p++],_=n[d>>>24]^i[l>>>16&255]^o[h>>>8&255]^a[255&u]^r[p++],m=n[l>>>24]^i[h>>>16&255]^o[u>>>8&255]^a[255&d]^r[p++],g=n[h>>>24]^i[u>>>16&255]^o[d>>>8&255]^a[255&l]^r[p++];u=v,d=_,l=m,h=g}v=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^r[p++],_=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&u])^r[p++],m=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^r[p++],g=(s[h>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^r[p++],e[t]=v,e[t+1]=_,e[t+2]=m,e[t+3]=g},keySize:8});t.AES=r._createHelper(v)}(),e.AES}(b5(),N5(),F5(),l6(),f6())),W6(),K6||(K6=1,X6.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,i=n.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],i=0;i<256;i++)n[i]=i;i=0;for(var o=0;i<256;i++){var a=i%r,s=t[a>>>2]>>>24-a%4*8&255;o=(o+n[i]+s)%256;var c=n[i];n[i]=n[o],n[o]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[r],e[r]=o,n|=e[(e[t]+e[r])%256]<<24-8*i}return this._i=t,this._j=r,n}t.RC4=r._createHelper(i);var a=n.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});t.RC4Drop=r._createHelper(a)}(),e.RC4}(b5(),N5(),F5(),l6(),f6())),J6||(J6=1,q6.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,i=[],o=[],a=[],s=n.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var o=t.words,a=o[0],s=o[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=u>>>16|4294901760&d,h=d<<16|65535&u;for(i[0]^=u,i[1]^=l,i[2]^=d,i[3]^=h,i[4]^=u,i[5]^=l,i[6]^=d,i[7]^=h,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,s=n>>>16,c=((i*i>>>17)+i*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=r._createHelper(s)}(),e.Rabbit}(b5(),N5(),F5(),l6(),f6())),Y6||(Y6=1,Q6.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,i=[],o=[],a=[],s=n.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)c.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(t){var o=t.words,a=o[0],s=o[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=u>>>16|4294901760&d,h=d<<16|65535&u;for(n[0]^=u,n[1]^=l,n[2]^=d,n[3]^=h,n[4]^=u,n[5]^=l,n[6]^=d,n[7]^=h,i=0;i<4;i++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,s=n>>>16,c=((i*i>>>17)+i*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=r._createHelper(s)}(),e.RabbitLegacy}(b5(),N5(),F5(),l6(),f6())),e8());var t8=X(m5.exports),r8=function(e){return e?{name:(null==e?void 0:e.name)||"",message:(null==e?void 0:e.message)||"",stack:(null==e?void 0:e.stack)||"",time:(new Date).getTime()}:{}},n8=function(e){return e?{errorCode:e.errorCode,errorText:e.errorText,url:e.url,address:e.address,port:e.port,time:(new Date).getTime()}:{}},i8=function(){function e(e,t,r,n){var i,o;this.initDomId="",this.initDomWidth=0,this.initDomHeight=0,this.videoDomId="",this.remoteVideoContainerId="",this.remoteVideoId="",this.remoteAudioStream=null,this.remoteVideoStream=null,this.hasPushDown=!1,this.refreshUiMsgNumber=0,this.getFirstFrame=!1,this.errorInfo=[],this.remoteResolution={width:0,height:0},this.roomMessage={inputStateIsOpen:!1,isVertical:!0},this.remotePc=null,this.autoRecoveryTimer=null,this.runInfoTimer=null,this.touchConfig={action:0,widthPixels:document.body.clientWidth,heightPixels:document.body.clientHeight,pointCount:1,touchType:"gesture",properties:[],coords:[]},this.enterkeyhintObj={2:"go",3:"search",4:"send",5:"next",6:"done",7:"previous"},this.callbacks={},this.audioStream=null,this.audioSender=null,this.logTime=null,this.logTime=n,this.initDomId=e,this.options=t,this.callbacks=r,this.remoteUserId=t.padCode,this.retryCount=t.retryCount,this.retryCountBackup=t.retryCount,this.retryTime=t.retryTime;var a=document.getElementById(this.initDomId);console.log("h5Dom节点宽高",null==a?void 0:a.clientWidth,null==a?void 0:a.clientHeight),this.initDomWidth=null!==(i=null==a?void 0:a.clientWidth)&&void 0!==i?i:0,this.initDomHeight=null!==(o=null==a?void 0:a.clientHeight)&&void 0!==o?o:0;var s=document.createElement("div");s.setAttribute("id","armcloudVideo"),this.videoDomId="armcloudVideo";var c=document.createElement("div");c.style.width="100%",c.style.height="100%",c.style.position="relative",c.style.overflow="hidden";var u=document.createElement("div");u.setAttribute("id","remoteVideoContainer"),this.remoteVideoContainerId="remoteVideoContainer",u.style.transform="rotate(0deg)",u.style.width="100%",u.style.height="100%",u.style.position="absolute",u.style.top="0px",u.style.left="0px";var d=document.createElement("video");d.setAttribute("id","remoteVideo"),d.setAttribute("playsinline",""),d.setAttribute("webkit-playsinline",""),d.setAttribute("x5-playsinline",""),d.setAttribute("x5-video-player-type","h5"),this.remoteVideoId="remoteVideo",d.controls=!1,d.muted=!0,d.style.width="100%",d.style.height="100%",d.style.objectFit="fill",u.appendChild(d),c.appendChild(u),s.appendChild(c),a.appendChild(s),this.addInputElement();var l=this.decryptAES(this.options.signalServer,this.options.padCode),h="".concat(l,"/").concat(this.options.roomToken),p=this.decryptAES(this.options.stuns,this.options.padCode);JSON.parse(p);var f=this.decryptAES(this.options.turns,this.options.padCode),v=JSON.parse(f),_={iceServers:[{urls:[v[0].uri],username:v[0].username,credential:v[0].pwd}]};this.socketParams={wsUrl:h,rtcConfig:_,remoteVideo:d},this.remotePc=new RTCPeerConnection(this.socketParams.rtcConfig)}return e.prototype.setLogTime=function(e){this.logTime[e]=(new Date).getTime()},e.prototype.sendEventReport=function(e){var t,r=this,n=function(e,t){mr.post("https://openapi.armcloud.net/openapi/open/clientException/sendInfo",{padCode:r.remoteUserId,errorJson:JSON.stringify(t),type:e}).finally((function(){r.errorInfo=[]}))};if(e||this.isFirstFrameSuccess()||!(null===(t=this.errorInfo)||void 0===t?void 0:t.length)){var i=(new Date).getTime();if("init"===e){var o=this.logTime,a=o.wsSuccess,s=o.joinRoom,c=o.rtcSuccess,u=o.tokenResStart,d=o.tokenResEnd,l=o.wsJoinRoom,h=o.receivedOffer,p=o.sendAnswer,f=o.videoTrack;n(B4,{rtcLinkTime:c-l,wsSuccessTime:a-s,joinRoomTime:l-a,totalTime:i-u,receivedOffer:h-l,sendAnswer:p-h,questServerTime:d-u,token:d,createTime:u,wsJoinRoom:l,wsSuccess:a,rtcSuccess:c,videoTrack:f,videoRender:i,type:"Web"})}"token"===e&&n(B4,{type:"Web",time:i,token:this.options.roomToken})}else n(j4,this.errorInfo)},e.prototype.getMsgTemplate=function(e,t){return JSON.stringify({touchType:e,content:JSON.stringify(t)})},e.prototype.getEquipmentInfo=function(e){this.sendUserMessage(this.options.clientId,this.getMsgTemplate("equipmentInfo",{type:e}),!0)},e.prototype.appUnInstall=function(e){this.sendUserMessage(this.options.clientId,this.getMsgTemplate("appUnInstall",e),!0)},e.prototype.addReportInfo=function(e){var t=(new Date).getTime();this.errorInfo.push({type:"Web",time:t,timeDiff:t-this.logTime.joinRoom,info:e})},e.prototype.decryptAES=function(e,t){try{var r=t8.enc.Base64.parse(e),n=t8.format.Hex.parse(r.toString()),i=t.padEnd(16,"0"),o=t8.enc.Utf8.parse(i),a=t8.AES.decrypt(n,o,{mode:t8.mode.ECB,padding:t8.pad.Pkcs7});return t8.enc.Utf8.stringify(a)}catch(e){return console.error("解密失败:",e.message),null}},e.prototype.pauseAudioMedia=function(){var e=this;this.audioStream&&(this.audioStream.getTracks().forEach((function(t){t.stop(),e.audioStream.removeTrack(t)})),console.log("麦克风音频流已停止"),this.audioSender&&this.remotePc.removeTrack(this.audioSender),this.audioStream=null,this.audioSender=null)},e.prototype.captureAndSendAudio=function(){return yr(this,void 0,void 0,(function(){var e,t,r,n=this;return Sr(this,(function(i){switch(i.label){case 0:if(!(null===(r=null===navigator||void 0===navigator?void 0:navigator.mediaDevices)||void 0===r?void 0:r.getUserMedia))return this.callbacks.onAudioError({code:L4,msg:"API_NOT_AVAILABLE"}),[2];i.label=1;case 1:return i.trys.push([1,3,,4]),e=this,[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 2:return e.audioStream=i.sent(),this.audioStream.getTracks().forEach((function(e){try{n.audioSender=n.remotePc.addTrack(e,n.audioStream)}catch(e){console.error("添加轨道失败: ".concat(e))}})),this.callbacks.onAudioInit({code:D4}),this.addReportInfo({describe:"麦克风音频流已捕获"}),[3,4];case 3:return t=i.sent(),this.callbacks.onAudioError({code:L4,msg:t.message||t.name}),this.addReportInfo({describe:"获取麦克风音频流失败",error:r8(t)}),[3,4];case 4:return[2]}}))}))},e.prototype.initWebSocket=function(){var e=this,t=!1,r=[];this.callbacks.onProgress(K4),this.socket=new WebSocket(this.socketParams.wsUrl),this.socket.onopen=function(){e.setLogTime("wsSuccess"),e.retryCount=e.retryCountBackup,console.log("ws连接成功"),e.addReportInfo({describe:"ws连接成功"}),e.callbacks.onSocketCallback({code:D4}),e.callbacks.onProgress(X4),e.sendEventReport("token")},this.socket.onclose=function(){console.log("ws连接关闭"),e.addReportInfo({describe:"ws连接关闭"}),e.retryCount===e.retryCountBackup&&(e.callbacks.onSocketCallback({code:U4}),e.callbacks.onProgress(J4),e.sendEventReport())},this.socket.onerror=function(t){console.log("ws连接失败"),e.addReportInfo({describe:"ws连接失败"}),e.retryCount--,e.retryCount>0?(setTimeout((function(){e.initWebSocket()}),e.retryTime),e.callbacks.onProgress(Y4)):(e.callbacks.onSocketCallback({code:L4}),e.callbacks.onProgress(q4),e.sendEventReport())};var n=function(t){e.remotePc.addIceCandidate({candidate:t.candidate,sdpMLiineIndex:t.label,sdpMid:t.id}).then((function(){e.addReportInfo({describe:"添加发送方Candidate信息成功",item:t}),e.callbacks.onProgress(r5)})).catch((function(t){e.addReportInfo({describe:"添加发送方Candidate信息失败",error:r8(t)}),e.callbacks.onProgress(n5)}))};this.socket.onmessage=function(i){return yr(e,void 0,void 0,(function(){var e,o,a,s,c,u;return Sr(this,(function(d){switch(d.label){case 0:return e=JSON.parse(i.data),console.log("ws收到消息",e),this.addReportInfo(gr({describe:"ws收到消息"},e)),"specifiedMsg"!==e.event?[3,4]:("re_answer"===(o=JSON.parse(e.data)).key&&this.receiveAnswer(e.sdp),"offer"!==o.key?[3,3]:(u=JSON.parse(o.value),[4,this.receiveOffer(u.sdp)]));case 1:return d.sent(),[4,this.sendAnswer()];case 2:for(d.sent(),t=!0,a=0,s=r;a<s.length;a++)c=s[a],n(c);d.label=3;case 3:return"ice_candidate"===o.key&&(u=JSON.parse(o.value),t?n(u):r.push(u)),[3,5];case 4:"ownJoinRoom"===e.event&&(this.setLogTime("wsJoinRoom"),this.callbacks.onProgress(Q4)),d.label=5;case 5:return[2]}}))}))}},e.prototype.startPlay=function(){var e=this;this.sendUserMessage(this.handleSendData({type:"openAudio",isOpen:!0}));var t=this.socketParams.remoteVideo;t.muted=!1,t.play().catch((function(t){console.error("播放失败-startPlay:",t),e.callbacks.onAutoplayFailed({userId:e.options.userId,kind:"video",message:t})}))},e.prototype.start=function(){var e=this;this.setLogTime("joinRoom"),this.addReportInfo({describe:"ws开始连接"}),this.initWebSocket(),this.remotePc.onicecandidate=function(t){var r;if(t.candidate){var n={event:"specifiedMsg",targetUserIds:[e.remoteUserId],data:JSON.stringify({key:"ice_candidate",value:JSON.stringify({candidate:JSON.stringify(null===(r=t.candidate)||void 0===r?void 0:r.candidate),label:t.candidate.sdpMLineIndex,id:t.candidate.sdpMid})})},i=JSON.stringify(n);e.socket.send(i),e.callbacks.onProgress(i5)}};var t=window.RTCRtpTransceiver&&"setCodecPreferences"in window.RTCRtpTransceiver.prototype;this.remotePc.ontrack=function(r){var n;switch(console.log("接收到的轨道类型: ".concat(r.track.kind)),null===(n=null==r?void 0:r.track)||void 0===n?void 0:n.kind){case"video":if(t){var i=function(e,t){return e.sort((function(e,r){var n=t.indexOf(null==e?void 0:e.mimeType),i=t.indexOf(null==r?void 0:r.mimeType);return(n>=0?n:Number.MAX_VALUE)-(i>=0?i:Number.MAX_VALUE)}))}(RTCRtpReceiver.getCapabilities("video").codecs,["video/VP9","video/H264","video/VP8"]);r.transceiver.setCodecPreferences(i)}var o=e.socketParams.remoteVideo;o.srcObject=r.streams[0],o.addEventListener("loadedmetadata",(function(t){[H4.AUDIO_ONLY,H4.NOT_AUDIO_VIDEO].includes(Number(e.options.mediaType))||o.play().catch((function(t){console.error("播放失败:",t),e.callbacks.onAutoplayFailed({userId:e.options.userId,kind:"video",message:t})})),e.callbacks.onProgress(l5)})),e.remoteVideoStream=r.streams,e.callbacks.onProgress(d5),e.setLogTime("videoTrack");break;case"audio":e.remoteAudioStream=r.streams}};var r=Number(this.options.autoRecoveryTime);this.remotePc.addEventListener("connectionstatechange",(function(t){switch(e.remotePc.connectionState){case"new":case"connecting":console.log("rtc connecting"),e.addReportInfo({despise:"rtc connecting"}),e.callbacks.onProgress(o5);break;case"connected":console.log("connected"),e.addReportInfo({despise:"rtc connected"}),(r<1||r>7200)&&(e.options.autoRecoveryTime=300),e.setLogTime("rtcSuccess"),e.triggerRecoveryTimeCallback(),e.callbacks.onConnectSuccess(),e.callbacks.onProgress(a5);break;case"disconnected":console.log("disconnected"),e.addReportInfo({describe:"rtc disconnected"}),e.callbacks.onConnectFail({code:L4,msg:"云机连接断开"}),e.sendEventReport(),e.callbacks.onProgress(s5);break;case"closed":console.log("rtc closed"),e.addReportInfo({describe:"rtc closed"}),e.sendEventReport(),e.callbacks.onProgress(c5);break;case"failed":console.log("failed"),e.addReportInfo({describe:"rtc failed"}),e.callbacks.onConnectFail({code:L4,msg:"云机连接失败"}),e.sendEventReport(),e.callbacks.onProgress(u5)}}),!1),this.remotePc.addEventListener("icecandidateerror",(function(t){701==t.errorCode&&e.addReportInfo({describe:"ICE协商时发生错误",error:n8(t)})}),!1);var n=document.getElementById(this.videoDomId);n.style.width="0px",n.style.height="0px";var i,o=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),a="touchstart",s="touchmove",c="touchend";o||(a="mousedown",s="mousemove",c="mouseup"),n.addEventListener("wheel",(function(t){t.preventDefault(),clearTimeout(i),i=setTimeout((function(){var r={action:0,widthPixels:n.clientWidth,heightPixels:n.clientHeight,pointCount:1,touchType:"gesture",properties:[{id:0,toolType:1}],coords:[{pressure:1,size:1,x:t.offsetX,y:t.deltaY>0?t.offsetY+.671875:t.offsetY-t.deltaY+.671875}]},i=JSON.stringify(r);e.sendUserMessage(i);var o=t.deltaY;if(o>=0)for(var a=0;a<=o;a++){var s={action:2,widthPixels:n.clientWidth,heightPixels:n.clientHeight,pointCount:1,touchType:"gesture",properties:[{id:0,toolType:1}],coords:[{pressure:1,size:1,x:t.offsetX,y:t.offsetY-a+.671875}]},c=JSON.stringify(s);e.sendUserMessage(c)}else for(a=-100;a<=0;a++){s={action:2,widthPixels:n.clientWidth,heightPixels:n.clientHeight,pointCount:1,touchType:"gesture",properties:[{id:0,toolType:1}],coords:[{pressure:1,size:1,x:t.offsetX,y:t.offsetY+a+.671875}]},c=JSON.stringify(s);e.sendUserMessage(c)}var u={action:1,widthPixels:n.clientWidth,heightPixels:n.clientHeight,pointCount:1,touchType:"gesture",properties:[{id:0,toolType:1}],coords:[{pressure:1,size:1,x:t.offsetX,y:t.deltaY>0?t.offsetY-t.deltaY+.671875:t.offsetY+.671875}]},d=JSON.stringify(u);e.sendUserMessage(d)}),300)})),n.addEventListener("mouseleave",(function(t){if(t.preventDefault(),e.hasPushDown){e.touchConfig.action=1;var r=JSON.stringify(e.touchConfig);e.sendUserMessage(r)}})),n.addEventListener(a,(function(t){var r,i,a;t.preventDefault(),e.hasPushDown=!0,(null===(r=e.roomMessage)||void 0===r?void 0:r.inputStateIsOpen)&&e.inputElement?e.inputElement.focus():null===(i=e.inputElement)||void 0===i||i.blur();var s=n.getBoundingClientRect(),c=s.top,u=s.left;e.touchConfig.properties=[],e.touchConfig.coords=[];var d=o?null===(a=null==t?void 0:t.touches)||void 0===a?void 0:a.length:1;e.touchConfig.action=0,e.touchConfig.pointCount=d,e.touchConfig.widthPixels=1!==e.options.rotateType&&e.roomMessage.isVertical?n.clientWidth:n.clientHeight,e.touchConfig.heightPixels=1!==e.options.rotateType&&e.roomMessage.isVertical?n.clientHeight:n.clientWidth;for(var l=0;l<d;l+=1){var h=o?t.touches[l]:t;e.touchConfig.properties[l]={id:l,toolType:1},e.touchConfig.coords.push({pressure:1,size:1,x:1!==e.options.rotateType&&e.roomMessage.isVertical?h.clientX-u:h.clientY-c,y:1!==e.options.rotateType&&e.roomMessage.isVertical?h.clientY-c:n.clientWidth-h.clientX+u})}var p={action:d>1?261:0,widthPixels:e.touchConfig.widthPixels,heightPixels:e.touchConfig.heightPixels,pointCount:d,touchType:"gesture",properties:e.touchConfig.properties,coords:e.touchConfig.coords},f=JSON.stringify(p);e.sendUserMessage(f)})),n.addEventListener(s,(function(t){var r;if(t.preventDefault(),e.hasPushDown){var i=n.getBoundingClientRect(),a=i.top,s=i.left,c=o?null===(r=null==t?void 0:t.touches)||void 0===r?void 0:r.length:1;e.touchConfig.action=2,e.touchConfig.pointCount=c,e.touchConfig.coords=[];for(var u=[],d=0;d<c;d+=1){var l=o?t.touches[d]:t;e.touchConfig.properties[d]={id:d,toolType:1},u.push({pressure:1,size:1,x:1!==e.options.rotateType&&e.roomMessage.isVertical?l.clientX-s:l.clientY-a,y:1!==e.options.rotateType&&e.roomMessage.isVertical?l.clientY-a:n.clientWidth-l.clientX})}e.touchConfig.coords=u;var h={action:2,widthPixels:e.touchConfig.widthPixels,heightPixels:e.touchConfig.heightPixels,pointCount:c,touchType:"gesture",properties:e.touchConfig.properties,coords:e.touchConfig.coords},p=JSON.stringify(h);e.sendUserMessage(p)}})),n.addEventListener(c,(function(t){if(t.preventDefault(),e.hasPushDown=!1,o){if(0===t.touches.length){e.touchConfig.action=1;var r=JSON.stringify(e.touchConfig);e.sendUserMessage(r)}}else{e.touchConfig.action=1;r=JSON.stringify(e.touchConfig);e.sendUserMessage(r)}}));var u=this.socketParams.remoteVideo;this.dataChannel=this.remotePc.createDataChannel("dataChannel"),this.dataChannel.onopen=function(){console.log("dataChannel 通道打开"),e.waitForFirstFrameRendered(u),e.remotePc&&(e.runInfoTimer=setInterval((function(){e.getStats()}),1e3)),e.onCheckInputState(),e.setKeyboardStyle(e.options.keyboard);var t={touchType:"eventSdk",content:JSON.stringify({type:"updateUiH5"})},r=JSON.stringify(t);e.sendUserMessage(r),e.callbacks.onProgress(h5)},this.dataChannel.onerror=function(t){console.error("dataChannel error: ",t.errorDetail,t.message,t),e.addReportInfo({time:(new Date).getTime(),describe:"数据通道发生错误",error:t}),e.callbacks.onErrorMessage({code:F4,msg:t.message||t.name}),e.callbacks.onProgress(p5)},clearInterval(this.runInfoTimer),this.onRoomMessageReceived()},e.prototype.sendOffer=function(){return yr(this,void 0,void 0,(function(){var e,t,r,n;return Sr(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.remotePc.createOffer()];case 1:return e=i.sent(),[4,this.remotePc.setLocalDescription(e)];case 2:return i.sent(),this.addReportInfo({describe:"获取offer信息成功",offer:e}),t={event:"specifiedMsg",targetUserIds:[this.remoteUserId],data:JSON.stringify({key:"re_offer",value:JSON.stringify({sdp:e.sdp})})},r=JSON.stringify(t),this.socket.send(r),this.addReportInfo({describe:"发送offer信息",offerMsg:t}),[3,4];case 3:return n=i.sent(),this.addReportInfo({describe:"发送offer信息失败",error:r8(n)}),[3,4];case 4:return[2]}}))}))},e.prototype.receiveOffer=function(e){return yr(this,void 0,void 0,(function(){var t,r;return Sr(this,(function(n){switch(n.label){case 0:t={type:"offer",sdp:e},n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.remotePc.setRemoteDescription(t)];case 2:return n.sent(),this.addReportInfo({describe:"设置offer信息成功",offer:e}),this.setLogTime("receivedOffer"),this.callbacks.onProgress(Z4),[3,4];case 3:return r=n.sent(),this.addReportInfo({describe:"设置offer信息失败",error:r8(r)}),this.callbacks.onProgress($4),[3,4];case 4:return[2]}}))}))},e.prototype.receiveAnswer=function(e){return yr(this,void 0,void 0,(function(){var t,r;return Sr(this,(function(n){switch(n.label){case 0:t={type:"answer",sdp:e},n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.remotePc.setRemoteDescription(t)];case 2:return n.sent(),this.addReportInfo({describe:"设置answer信息成功",answer:e}),[3,4];case 3:return r=n.sent(),this.addReportInfo({describe:"设置answer信息失败",error:r8(r)}),[3,4];case 4:return[2]}}))}))},e.prototype.sendAnswer=function(){return yr(this,void 0,void 0,(function(){var e,t,r,n;return Sr(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.remotePc.createAnswer()];case 1:return e=i.sent(),[4,this.remotePc.setLocalDescription(e)];case 2:return i.sent(),this.addReportInfo({describe:"获取Answer信息成功",answer:e}),t={event:"specifiedMsg",targetUserIds:[this.remoteUserId],data:JSON.stringify({key:"answer",value:JSON.stringify({sdp:e.sdp})})},r=JSON.stringify(t),this.socket.send(r),this.addReportInfo({describe:"发送Answer信息",answerMsg:t}),this.setLogTime("sendAnswer"),this.callbacks.onProgress(e5),[3,4];case 3:return n=i.sent(),this.addReportInfo({describe:"发送Answer信息失败",error:r8(n)}),this.callbacks.onProgress(t5),[3,4];case 4:return[2]}}))}))},e.prototype.isFirstFrameSuccess=function(){var e,t=null===(e=this.socketParams)||void 0===e?void 0:e.remoteVideo;return t&&t.currentTime>0},e.prototype.controlTrackVoice=function(e,t,r){void 0===t&&(t="video"),void 0===r&&(r=!1),null==e||e.forEach((function(e){var n="video"===t?e.getVideoTracks():e.getAudioTracks();null==n||n.forEach((function(e){e.enabled=r}))}))},e.prototype.renderedFirstFrame=function(){this.callbacks.onRenderedFirstFrame(),this.sendEventReport("init"),this.getFirstFrame=!1,this.callbacks.onProgress(v5)},e.prototype.waitForFirstFrameRendered=function(e){var t=this;if(console.log("首帧画面已被渲染",e.currentTime,e.readyState),e.currentTime>0){switch(Number(this.options.mediaType)){case H4.AUDIO_ONLY:this.sendUserMessage(this.handleSendData({type:"openVideo",isOpen:!1})),this.callbacks.onAutoplayFailed({userId:this.options.userId,kind:"audio",message:"自动播放音频失败"});break;case H4.VIDEO_ONLY:this.sendUserMessage(this.handleSendData({type:"openAudio",isOpen:!1}));break;case H4.AUDIO_VIDEO:this.callbacks.onAutoplayFailed({userId:this.options.userId,kind:"audio",message:"自动播放音频失败"});break;case H4.NOT_AUDIO_VIDEO:this.sendUserMessage(this.handleSendData({type:"openAudioAndVideo",isOpen:!1}))}this.getFirstFrame=!0,this.getFirstFrame&&this.refreshUiMsgNumber>0&&this.renderedFirstFrame(),this.getFirstFrame&&this.refreshUiMsgNumber<=0&&this.callbacks.onProgress(f5)}else requestAnimationFrame((function(){t.waitForFirstFrameRendered(e)}))},e.prototype.destroyEngine=function(){},e.prototype.stop=function(e){var t,r,n=this;console.log("退出房间"),clearTimeout(this.autoRecoveryTimer),clearInterval(this.runInfoTimer),this.remotePc&&(this.remotePc.getSenders().forEach((function(e){return n.remotePc.removeTrack(e)})),null===(t=this.remotePc)||void 0===t||t.close(),this.remotePc=null,this.dataChannel=null),null===(r=this.socket)||void 0===r||r.close(),this.socket=null,this.audioStream=null;var i=document.getElementById(this.initDomId);if(i)for(;i.firstChild;)i.removeChild(i.firstChild);this.addReportInfo({describe:e||"退出房间"}),this.sendEventReport()},e.prototype.getStats=function(){return yr(this,void 0,void 0,(function(){var e,t,r,n,i=this;return Sr(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.remotePc.getStats()];case 1:return e=o.sent(),t=0,e.forEach((function(e){if("inbound-rtp"===e.type&&"video"===e.kind){var r=e.framesPerSecond||0,n=JSON.stringify({content:JSON.stringify({framesPerSecond:r,time:(new Date).getTime()}),touchType:"rtcStats"});i.sendUserMessage(n)}if("candidate-pair"===e.type&&"succeeded"===e.state){var o=e.currentRoundTripTime||0;t=(1e3*o).toFixed(2)}})),r={userId:this.options.userId,audioStats:null,videoStats:{videoLossRate:0,rtt:t,statsInterval:5e3}},this.callbacks.onRunInformation(r),[3,3];case 2:return n=o.sent(),console.error("获取统计信息时出错:",n),this.callbacks.onErrorMessage({code:V4,msg:n.message||n.name}),[3,3];case 3:return[2]}}))}))},e.prototype.isSupported=function(){var e={RTCPeerConnection:"undefined"!=typeof RTCPeerConnection,RTCDataChannel:"undefined"!=typeof RTCDataChannel,RTCIceCandidate:"undefined"!=typeof RTCIceCandidate,RTCSessionDescription:"undefined"!=typeof RTCSessionDescription};return e.RTCPeerConnection&&e.RTCDataChannel},e.prototype.triggerRecoveryTimeCallback=function(){var e=this;this.autoRecoveryTimer&&clearTimeout(this.autoRecoveryTimer),this.autoRecoveryTimer=setTimeout((function(){e.addReportInfo({describe:"无操作回收"}),e.stop(),e.callbacks.onAutoRecoveryTime()}),1e3*this.options.autoRecoveryTime)},e.prototype.sendUserMessage=function(e){return yr(this,void 0,void 0,(function(){var t;return Sr(this,(function(r){switch(r.label){case 0:return this.triggerRecoveryTimeCallback(),this.dataChannel?[4,null===(t=this.dataChannel)||void 0===t?void 0:t.send(e)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},e.prototype.onRoomMessageReceived=function(){var e=this,t=0;this.remotePc.ondatachannel=function(r){var n=r.channel,i=function(r){var n,i=JSON.parse(r||"{}");if(console.log("房间广播消息",i),"audioControl"===i.key){if((JSON.parse(i.data)||{}).isOpen)return void e.captureAndSendAudio().then((function(){!t&&e.sendOffer().then((function(){t++}))}));e.pauseAudioMedia()}if("message"===i.key&&e.callbacks.onTransparentMsg(0,i.data),"equipmentInfo"===i.key&&(null===(n=e.callbacks)||void 0===n||n.onEquipmentInfo(JSON.parse(i.data||[]))),"refreshUiType"===i.key){e.refreshUiMsgNumber++,console.log("ui渲染次数",e.refreshUiMsgNumber),e.getFirstFrame&&e.refreshUiMsgNumber>0&&e.renderedFirstFrame(),e.getFirstFrame&&e.refreshUiMsgNumber<=0&&e.callbacks.onProgress(f5);var o=JSON.parse(i.data);if(e.roomMessage.isVertical=o.isVertical,o.width==e.remoteResolution.width&&o.height==e.remoteResolution.height)return!1;e.callbacks.onChangeResolution(o.width,o.height),e.remoteResolution.width=o.width,e.remoteResolution.height=o.height;var a=e.initDomWidth,s=e.initDomHeight;if(0!==e.options.isFullScreen||1!==e.options.rotateType&&o.isVertical)if(0!==e.options.isFullScreen||0!==e.options.rotateType&&!o.isVertical)if(1!==e.options.isFullScreen||1!==e.options.rotateType&&o.isVertical){console.log("填充屏幕 + 竖屏"),(h=document.getElementById(e.videoDomId)).style.width="".concat(a,"px"),h.style.height="".concat(s,"px"),(l=document.getElementById(e.remoteVideoContainerId)).style.transform="rotate(".concat(0,"deg)"),l.style.width="100%",l.style.height="100%",l.style.top="0px",l.style.left="0px"}else{console.log("填充屏幕 + 横屏"),(h=document.getElementById(e.videoDomId)).style.width="".concat(a,"px"),h.style.height="".concat(s,"px"),(l=document.getElementById(e.remoteVideoContainerId)).style.transform="rotate(".concat(90,"deg)"),l.style.width="".concat(s,"px"),l.style.height="".concat(a,"px");_=(a-s)/2;var c=(s-a)/2;l.style.top="".concat(c,"px"),l.style.left="".concat(_,"px")}else{console.log("自适应 + 竖屏");f=o.width,v=o.height;var u=f*(p=Math.min(a/f,s/v)),d=v*p;(h=document.getElementById(e.videoDomId)).style.width="".concat(u,"px"),h.style.height="".concat(d,"px"),(l=document.getElementById(e.remoteVideoContainerId)).style.transform="rotate(".concat(0,"deg)"),l.style.width="100%",l.style.height="100%",l.style.top="0px",l.style.left="0px"}else{console.log("自适应 + 横屏");var l,h=document.getElementById(e.videoDomId),p=Math.min(a/o.height,s/o.width),f=o.height*p,v=o.width*p;h.style.width="".concat(f,"px"),h.style.height="".concat(v,"px"),(l=document.getElementById(e.remoteVideoContainerId)).style.transform="rotate(".concat(90,"deg)"),l.style.width="".concat(v,"px"),l.style.height="".concat(f,"px");var _=(f-v)/2,m=(v-f)/2;l.style.top="".concat(m,"px"),l.style.left="".concat(_,"px")}}if("inputState"===i.key&&e.inputElement){o=JSON.parse(i.data);e.roomMessage.inputStateIsOpen=o.isOpen;var g=e.enterkeyhintObj[o.imeOptions];e.inputElement.setAttribute("enterkeyhint",g),!1===o.isOpen&&e.inputElement.blur()}if("clipboard"===i.key&&e.options.saveCloudClipboard){o=JSON.parse(i.data);e.callbacks.onOutputClipper(o)}};n.onmessage=function(e){if(e.data)switch((n=e.data)instanceof ArrayBuffer?"ArrayBuffer":n instanceof Blob?"Blob":"String"){case"ArrayBuffer":i((r=e.data,"undefined"!=typeof TextDecoder?new TextDecoder("utf-8").decode(r):String.fromCharCode.apply(null,new Uint8Array(r))));break;case"Blob":(t=e.data,new Promise((function(e,r){var n=new FileReader;n.onload=function(){e(n.result)},n.onerror=function(){r(new Error("Failed to read blob as text"))},n.readAsText(t)}))).then((function(e){i(e)}));break;default:i(e.data)}var t,r,n}}},e.prototype.sendInputClipper=function(e){return yr(this,void 0,void 0,(function(){var t;return Sr(this,(function(r){switch(r.label){case 0:return t=JSON.stringify({text:e,touchType:"clipboard"}),[4,this.sendUserMessage(t)];case 1:return r.sent(),[2]}}))}))},e.prototype.sendInputString=function(e){return yr(this,void 0,void 0,(function(){var t;return Sr(this,(function(r){switch(r.label){case 0:return t=JSON.stringify({text:e,touchType:"inputBox"}),[4,this.sendUserMessage(t)];case 1:return r.sent(),[2]}}))}))},e.prototype.sendShakeInfo=function(e){var t=this;(new M4).startShakeSimulation(e,(function(e){var r=function(t){return JSON.stringify({coords:[],heightPixels:0,isOpenScreenFollowRotation:!1,keyCode:0,pointCount:0,properties:[],text:"",touchType:"eventSdk",widthPixels:0,action:0,content:JSON.stringify(gr(gr({},e),{type:"sdkSensor",sensorType:t}))})};t.sendUserMessage(r("gyroscope")),t.sendUserMessage(r("gravity")),t.sendUserMessage(r("acceleration"))}))},e.prototype.setStreamConfig=function(e){var t=/^[1-9]\d*$/;if(e.definitionId&&e.framerateId&&e.bitrateId&&(Object.values(e).every((function(e){return t.test(e)}))&&e.definitionId>=7&&e.definitionId<=20&&e.framerateId>=1&&e.framerateId<=9&&e.bitrateId>=1&&e.bitrateId<=15)){var r={type:"definitionUpdata",definitionId:e.definitionId,framerateId:e.framerateId,bitrateId:e.bitrateId},n={touchType:"eventSdk",content:JSON.stringify(r)},i=JSON.stringify(n);this.sendUserMessage(i)}},e.prototype.handleSendData=function(e){var t={touchType:"eventSdk",content:JSON.stringify(e)};return JSON.stringify(t)},e.prototype.pauseAllSubscribedStream=function(e){switch(void 0===e&&(e=3),this.triggerRecoveryTimeCallback(),Number(e)){case z4:this.sendUserMessage(this.handleSendData({type:"openAudio",isOpen:!1}));break;case G4:this.sendUserMessage(this.handleSendData({type:"openVideo",isOpen:!1}));break;case W4:this.sendUserMessage(this.handleSendData({type:"openAudioAndVideo",isOpen:!1}))}},e.prototype.resumeAllSubscribedStream=function(e){switch(void 0===e&&(e=3),this.triggerRecoveryTimeCallback(),Number(e)){case z4:this.sendUserMessage(this.handleSendData({type:"openAudio",isOpen:!0}));break;case G4:this.sendUserMessage(this.handleSendData({type:"openVideo",isOpen:!0}));break;case W4:this.sendUserMessage(this.handleSendData({type:"openAudioAndVideo",isOpen:!0}))}},e.prototype.saveScreenShotToLocal=function(){var e=this;return new Promise((function(t,r){try{var n=document.getElementById(e.remoteVideoId),i=document.createElement("canvas"),o=i.getContext("2d");i.width=n.videoWidth,i.height=n.videoHeight,o.drawImage(n,0,0,i.width,i.height),t(o.getImageData(0,0,i.width,i.height))}catch(e){r(e)}}))},e.prototype.saveScreenShotToRemote=function(){var e={touchType:"eventSdk",content:JSON.stringify({type:"localScreenshot"})},t=JSON.stringify(e);this.sendUserMessage(t)},e.prototype.setPhoneRotation=function(e){this.triggerRecoveryTimeCallback(),0===e?this.rotateScreen(0):1===e&&this.rotateScreen(90)},e.prototype.rotateScreen=function(e){this.options.rotateType=90===e?1:0;var t=this.initDomWidth,r=this.initDomHeight;if(0===this.options.isFullScreen&&90===e){console.log("手动 自适应 + 横屏");var n=document.getElementById(this.videoDomId),i=Math.min(t/this.remoteResolution.height,r/this.remoteResolution.width),o=this.remoteResolution.height*i,a=this.remoteResolution.width*i;n.style.width="".concat(o,"px"),n.style.height="".concat(a,"px"),(h=document.getElementById(this.remoteVideoContainerId)).style.transform="rotate(".concat(90,"deg)"),h.style.width="".concat(a,"px"),h.style.height="".concat(o,"px");var s=(o-a)/2,c=(a-o)/2;h.style.top="".concat(c,"px"),h.style.left="".concat(s,"px")}else if(0===this.options.isFullScreen&&0===e){console.log("手动 自适应 + 竖屏");o=this.remoteResolution.width,a=this.remoteResolution.height;var u=o*(i=Math.min(t/o,r/a)),d=a*i;(n=document.getElementById(this.videoDomId)).style.width="".concat(u,"px"),n.style.height="".concat(d,"px"),(h=document.getElementById(this.remoteVideoContainerId)).style.transform="rotate(".concat(0,"deg)"),h.style.width="100%",h.style.height="100%",h.style.top="0px",h.style.left="0px"}else if(1===this.options.isFullScreen&&90===e){console.log("手动 填充屏幕 + 横屏"),(n=document.getElementById(this.videoDomId)).style.width="".concat(t,"px"),n.style.height="".concat(r,"px"),(h=document.getElementById(this.remoteVideoContainerId)).style.transform="rotate(".concat(90,"deg)"),h.style.width="".concat(r,"px"),h.style.height="".concat(t,"px");s=(t-r)/2;var l=(r-t)/2;h.style.top="".concat(l,"px"),h.style.left="".concat(s,"px")}else{var h;console.log("手动 填充屏幕 + 竖屏"),(n=document.getElementById(this.videoDomId)).style.width="".concat(t,"px"),n.style.height="".concat(r,"px"),(h=document.getElementById(this.remoteVideoContainerId)).style.transform="rotate(".concat(0,"deg)"),h.style.width="100%",h.style.height="100%",h.style.top="0px",h.style.left="0px"}},e.prototype.setGPS=function(e,t){var r={latitude:t,longitude:e,time:(new Date).getTime()},n={type:"sdkLocation",content:JSON.stringify(r)},i={touchType:"eventSdk",content:JSON.stringify(n)},o=JSON.stringify(i);this.sendUserMessage(o)},e.prototype.setKeyboardStyle=function(e){var t={type:"keyBoardType",isLocalKeyBoard:"local"===e},r={touchType:"eventSdk",content:JSON.stringify(t)},n=JSON.stringify(r);this.sendUserMessage(n)},e.prototype.onCheckInputState=function(){return yr(this,void 0,void 0,(function(){var e;return Sr(this,(function(t){return e=JSON.stringify({touchType:"inputState"}),this.sendUserMessage(e),[2]}))}))},e.prototype.addInputElement=function(){var e=this,t=document.getElementById(this.initDomId);this.inputElement=document.createElement("input"),this.inputElement.setAttribute("type","text"),this.inputElement.setAttribute("id","inputEle"),this.inputElement.setAttribute("style","position: absolute; top: 50px;left: 80px;z-index: -1");var r=!1;this.inputElement.addEventListener("compositionstart",(function(){r=!0})),this.inputElement.addEventListener("compositionend",(function(t){r=!1;var n={action:1,touchType:"input",keyCode:1,text:t.target.value},i=e.options.clientId,o=JSON.stringify(n);e.inputElement.value="",i&&e.sendUserMessage(o)})),this.inputElement.addEventListener("input",(function(t){if(!r){var n={action:1,touchType:"input",keyCode:1,text:t.target.value},i=e.options.clientId,o=JSON.stringify(n);e.inputElement.value="",i&&e.sendUserMessage(o)}})),this.inputElement.addEventListener("keydown",(function(t){if("Backspace"===t.key){var r=e.options.clientId,n=JSON.stringify({action:1,touchType:"input",keyCode:67,text:""}),i=JSON.stringify({action:0,touchType:"input",keyCode:67,text:""});r&&(e.sendUserMessage(n),e.sendUserMessage(i))}else if("Enter"===t.key){r=e.options.clientId;var o=JSON.stringify({action:1,touchType:"input",keyCode:66,text:""}),a=JSON.stringify({action:0,touchType:"input",keyCode:66,text:""});e.inputElement.blur(),r&&(e.sendUserMessage(o),e.sendUserMessage(a))}})),t.appendChild(this.inputElement)},e.prototype.setAutoRecycleTime=function(e){e>=1&&e<=7200&&(this.options.autoRecoveryTime=e,this.triggerRecoveryTimeCallback())},e.prototype.getAutoRecycleTime=function(){return this.options.autoRecoveryTime},e.prototype.sendCommand=function(e){switch(e){case"back":this.goAppUpPage();break;case"home":this.goAppHome();break;case"menu":this.goAppMenu()}},e.prototype.goAppUpPage=function(){var e=this.options.clientId,t=JSON.stringify({action:0,touchType:"keystroke",keyCode:4,text:""});e&&(this.sendUserMessage(t),console.log("抬起",t))},e.prototype.goAppHome=function(){var e=this.options.clientId,t=JSON.stringify({action:1,touchType:"keystroke",keyCode:3,text:""}),r=JSON.stringify({action:0,touchType:"keystroke",keyCode:3,text:""});e&&(this.sendUserMessage(t),this.sendUserMessage(r))},e.prototype.goAppMenu=function(){var e=this.options.clientId,t=JSON.stringify({action:1,touchType:"keystroke",keyCode:187,text:""}),r=JSON.stringify({action:0,touchType:"keystroke",keyCode:187,text:""});e&&(this.sendUserMessage(t),this.sendUserMessage(r))},e.prototype.increaseVolume=function(){var e=this.options.clientId,t=JSON.stringify({action:1,touchType:"keystroke",keyCode:24,text:""}),r=JSON.stringify({action:0,touchType:"keystroke",keyCode:24,text:""});e&&(this.sendUserMessage(t),this.sendUserMessage(r))},e.prototype.decreaseVolume=function(){var e=this.options.clientId,t=JSON.stringify({action:1,touchType:"keystroke",keyCode:25,text:""}),r=JSON.stringify({action:0,touchType:"keystroke",keyCode:25,text:""});e&&(this.sendUserMessage(t),this.sendUserMessage(r))},e.prototype.saveCloudClipboard=function(e){this.options.saveCloudClipboard=e},e}(),o8=function(){function e(e){var t,r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,g,y,S,b,E,k,T,I=this;if(this.version="1.1.1",this.rtcInstance=null,this.rtcOptions=null,this.callbacks=null,this.streamType=null,this.logTime={tokenResStart:null,tokenResEnd:null,joinRoom:null,wsSuccess:null,receivedOffer:null,sendAnswer:null,wsJoinRoom:null,rtcSuccess:null,reconnectSuccess:null,videoTrack:null},this.rtcOptions={appId:"",roomCode:"",roomToken:"",signalServer:"",stuns:"",turns:"",token:e.token,clientId:e.deviceInfo.padCode,padCode:e.deviceInfo.padCode,userId:e.deviceInfo.userId,retryCount:null!==(t=e.retryCount)&&void 0!==t?t:2,retryTime:null!==(r=e.retryTime)&&void 0!==r?r:2e3,enableMicrophone:e.enableMicrophone||!0,enableCamera:e.enableCamera||!0,videoStream:{resolution:null!==(o=null===(i=null===(n=null==e?void 0:e.deviceInfo)||void 0===n?void 0:n.videoStream)||void 0===i?void 0:i.resolution)&&void 0!==o?o:12,frameRate:null!==(c=null===(s=null===(a=null==e?void 0:e.deviceInfo)||void 0===a?void 0:a.videoStream)||void 0===s?void 0:s.frameRate)&&void 0!==c?c:2,bitrate:null!==(l=null===(d=null===(u=null==e?void 0:e.deviceInfo)||void 0===u?void 0:u.videoStream)||void 0===d?void 0:d.bitrate)&&void 0!==l?l:3},autoRecoveryTime:null!==(h=e.deviceInfo.autoRecoveryTime)&&void 0!==h?h:300,isFullScreen:null!==(p=e.deviceInfo.isFullScreen)&&void 0!==p?p:0,mediaType:null!==(f=e.deviceInfo.mediaType)&&void 0!==f?f:2,rotateType:null!==(v=e.deviceInfo.rotateType)&&void 0!==v?v:0,keyboard:null!==(_=e.deviceInfo.keyboard)&&void 0!==_?_:"pad",saveCloudClipboard:null===(m=e.deviceInfo.saveCloudClipboard)||void 0===m||m},this.callbacks={onInit:e.callbacks.onInit||function(){},onConnectSuccess:e.callbacks.onConnectSuccess||function(){},onConnectFail:e.callbacks.onConnectFail||function(){},onAutoRecoveryTime:e.callbacks.onAutoRecoveryTime||function(){},onAutoplayFailed:e.callbacks.onAutoplayFailed||function(){},onRunInformation:e.callbacks.onRunInformation||function(){},onChangeResolution:e.callbacks.onChangeResolution||function(){},onTransparentMsg:e.callbacks.onChangeResolution||function(){},onConnectionStateChanged:e.callbacks.onConnectionStateChanged||function(){},onErrorMessage:e.callbacks.onErrorMessage||function(){},onOutputClipper:e.callbacks.onOutputClipper||function(){},onRenderedFirstFrame:e.callbacks.onRenderedFirstFrame||function(){},onAudioError:(null===(g=e.callbacks)||void 0===g?void 0:g.onAudioError)||function(){},onAudioInit:(null===(y=e.callbacks)||void 0===y?void 0:y.onAudioInit)||function(){},onProgress:(null===(S=e.callbacks)||void 0===S?void 0:S.onProgress)||function(){},onSocketCallback:(null===(b=e.callbacks)||void 0===b?void 0:b.onSocketCallback)||function(){},onUserLeaveOrJoin:(null===(E=e.callbacks)||void 0===E?void 0:E.onUserLeaveOrJoin)||function(){},onGroupControlError:(null===(k=e.callbacks)||void 0===k?void 0:k.onGroupControlError)||function(){},onEquipmentInfo:(null===(T=e.callbacks)||void 0===T?void 0:T.onEquipmentInfo)||function(){}},e.token&&e.deviceInfo&&e.deviceInfo.padCode&&e.deviceInfo.userId){var R=localStorage.getItem("armcloud_uuid")||this.generateUUID();localStorage.setItem("armcloud_uuid",R||"");var C={sdkTerminal:"h5",userId:this.rtcOptions.userId,padCode:this.rtcOptions.padCode,uuid:R,expire:3600,videoStream:this.rtcOptions.videoStream};this.logTime.tokenResStart=(new Date).getTime(),mr.post("https://openapi.armcloud.net/rtc/open/room/applyToken",C,{headers:{"Content-Type":"application/json",token:this.rtcOptions.token}}).then((function(t){var r,n;200===t.data.code?(I.logTime.tokenResEnd=(new Date).getTime(),I.streamType=t.data.data.streamType,1==I.streamType?(I.rtcOptions.uuid=R,I.rtcOptions.appId=t.data.data.appId,I.rtcOptions.roomCode=t.data.data.roomCode,I.rtcOptions.roomToken=t.data.data.roomToken,I.rtcInstance=new _5(e.viewId,I.rtcOptions,I.callbacks,I.logTime)):2==I.streamType&&(I.rtcOptions.roomToken=t.data.data.roomToken,I.rtcOptions.signalServer=t.data.data.signalServer,I.rtcOptions.stuns=t.data.data.stuns,I.rtcOptions.turns=t.data.data.turns,I.rtcInstance=new i8(e.viewId,I.rtcOptions,I.callbacks,I.logTime)),I.callbacks.onInit({code:D4,msg:"初始化成功",streamType:I.streamType})):I.callbacks.onInit({code:(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.code)||L4,msg:null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.msg,streamType:I.streamType})})).catch((function(e){console.error("发生错误:",e),I.callbacks.onInit({code:L4,msg:e.message||e.name})}))}else this.callbacks.onInit({code:L4,msg:"初始化失败,缺少必填参数"})}return e.prototype.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},e.prototype.isSupported=function(){var e;return null===(e=this.rtcInstance)||void 0===e?void 0:e.isSupported()},e.prototype.destroyEngine=function(){this.rtcInstance&&this.rtcInstance.destroyEngine()},e.prototype.startPlay=function(){this.rtcInstance&&this.rtcInstance.startPlay()},e.prototype.start=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=[]),this.rtcInstance&&this.rtcInstance.start(e,t)},e.prototype.stop=function(){this.rtcInstance&&this.rtcInstance.stop()},e.prototype.getEquipmentInfo=function(e){this.rtcInstance&&this.rtcInstance.getEquipmentInfo(e)},e.prototype.appUnInstall=function(e){this.rtcInstance&&this.rtcInstance.appUnInstall(e)},e.prototype.setMicrophone=function(e){this.rtcInstance&&this.rtcInstance.setMicrophone(e)},e.prototype.setCamera=function(e){this.rtcInstance&&this.rtcInstance.setCamera(e)},e.prototype.sendInputClipper=function(e){this.rtcInstance&&this.rtcInstance.sendInputClipper(e)},e.prototype.sendInputString=function(e){this.rtcInstance&&this.rtcInstance.sendInputString(e)},e.prototype.setStreamConfig=function(e){this.rtcInstance&&this.rtcInstance.setStreamConfig(e)},e.prototype.pauseAllSubscribedStream=function(e){void 0===e&&(e=3),this.rtcInstance&&this.rtcInstance.pauseAllSubscribedStream(e)},e.prototype.resumeAllSubscribedStream=function(e){void 0===e&&(e=3),this.rtcInstance&&this.rtcInstance.resumeAllSubscribedStream(e)},e.prototype.saveScreenShotToLocal=function(){var e=this;return new Promise((function(t,r){if(e.rtcInstance)try{e.rtcInstance.saveScreenShotToLocal().then((function(e){t(e)}))}catch(e){r(e)}}))},e.prototype.saveScreenShotToRemote=function(){this.rtcInstance&&this.rtcInstance.saveScreenShotToRemote()},e.prototype.setPhoneRotation=function(e){this.rtcInstance&&this.rtcInstance.setPhoneRotation(e)},e.prototype.setGPS=function(e,t){this.rtcInstance&&this.rtcInstance.setGPS(e,t)},e.prototype.setKeyboardStyle=function(e){this.rtcInstance&&this.rtcInstance.setKeyboardStyle(e)},e.prototype.setAutoRecycleTime=function(e){this.rtcInstance&&this.rtcInstance.setAutoRecycleTime(e)},e.prototype.getAutoRecycleTime=function(){if(this.rtcInstance)return this.rtcInstance.getAutoRecycleTime()},e.prototype.sendCommand=function(e){this.rtcInstance&&this.rtcInstance.sendCommand(e)},e.prototype.increaseVolume=function(){this.rtcInstance&&this.rtcInstance.increaseVolume()},e.prototype.decreaseVolume=function(){this.rtcInstance&&this.rtcInstance.decreaseVolume()},e.prototype.saveCloudClipboard=function(e){this.rtcInstance&&this.rtcInstance.saveCloudClipboard(e)},e.prototype.sendShake=function(e){this.rtcInstance&&this.rtcInstance.sendShakeInfo(null!=e?e:1500)},e}(),a8={KEYTYPE:Object.freeze({KEYBACK:"back",EYHOMEPAGE:"home",KEYMENU:"menu"})};export{o8 as ArmcloudEngine,a8 as KEYTYPE};
|
|
21
|
+
//# sourceMappingURL=index.es.js.map
|