/*! For license information please see index.js.LICENSE.txt */ (()=>{var __webpack_modules__={504:function(module,__unused_webpack_exports,__webpack_require__){var t;"undefined"!=typeof self&&self,t=__WEBPACK_EXTERNAL_MODULE__8156__=>(()=>{var __webpack_modules__={4537:e=>{"use strict";e.exports=function(e,t){for(var c=new Array(arguments.length-1),n=0,i=2,a=!0;i{"use strict";var c=t;c.length=function(e){var t=e.length;if(!t)return 0;for(var c=0;--t%4>1&&"="===e.charAt(t);)++c;return Math.ceil(3*e.length)/4-c};for(var n=new Array(64),i=new Array(123),a=0;a<64;)i[n[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;c.encode=function(e,t,c){for(var i,a=null,r=[],o=0,s=0;t>2],i=(3&l)<<4,s=1;break;case 1:r[o++]=n[i|l>>4],i=(15&l)<<2,s=2;break;case 2:r[o++]=n[i|l>>6],r[o++]=n[63&l],s=0}o>8191&&((a||(a=[])).push(String.fromCharCode.apply(String,r)),o=0)}return s&&(r[o++]=n[i],r[o++]=61,1===s&&(r[o++]=61)),a?(o&&a.push(String.fromCharCode.apply(String,r.slice(0,o))),a.join("")):String.fromCharCode.apply(String,r.slice(0,o))};var r="invalid encoding";c.decode=function(e,t,c){for(var n,a=c,o=0,s=0;s1)break;if(void 0===(l=i[l]))throw Error(r);switch(o){case 0:n=l,o=1;break;case 1:t[c++]=n<<2|(48&l)>>4,n=l,o=2;break;case 2:t[c++]=(15&n)<<4|(60&l)>>2,n=l,o=3;break;case 3:t[c++]=(3&n)<<6|l,o=0}}if(1===o)throw Error(r);return c-a},c.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},9211:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,c){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:c||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var c=this._listeners[e],n=0;n{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),c=new Uint8Array(t.buffer),n=128===c[3];function i(e,n,i){t[0]=e,n[i]=c[0],n[i+1]=c[1],n[i+2]=c[2],n[i+3]=c[3]}function a(e,n,i){t[0]=e,n[i]=c[3],n[i+1]=c[2],n[i+2]=c[1],n[i+3]=c[0]}function r(e,n){return c[0]=e[n],c[1]=e[n+1],c[2]=e[n+2],c[3]=e[n+3],t[0]}function o(e,n){return c[3]=e[n],c[2]=e[n+1],c[1]=e[n+2],c[0]=e[n+3],t[0]}e.writeFloatLE=n?i:a,e.writeFloatBE=n?a:i,e.readFloatLE=n?r:o,e.readFloatBE=n?o:r}():function(){function t(e,t,c,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,c,n);else if(isNaN(t))e(2143289344,c,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,c,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,c,n);else{var a=Math.floor(Math.log(t)/Math.LN2);e((i<<31|a+127<<23|8388607&Math.round(t*Math.pow(2,-a)*8388608))>>>0,c,n)}}function r(e,t,c){var n=e(t,c),i=2*(n>>31)+1,a=n>>>23&255,r=8388607&n;return 255===a?r?NaN:i*(1/0):0===a?1401298464324817e-60*i*r:i*Math.pow(2,a-150)*(r+8388608)}e.writeFloatLE=t.bind(null,c),e.writeFloatBE=t.bind(null,n),e.readFloatLE=r.bind(null,i),e.readFloatBE=r.bind(null,a)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),c=new Uint8Array(t.buffer),n=128===c[7];function i(e,n,i){t[0]=e,n[i]=c[0],n[i+1]=c[1],n[i+2]=c[2],n[i+3]=c[3],n[i+4]=c[4],n[i+5]=c[5],n[i+6]=c[6],n[i+7]=c[7]}function a(e,n,i){t[0]=e,n[i]=c[7],n[i+1]=c[6],n[i+2]=c[5],n[i+3]=c[4],n[i+4]=c[3],n[i+5]=c[2],n[i+6]=c[1],n[i+7]=c[0]}function r(e,n){return c[0]=e[n],c[1]=e[n+1],c[2]=e[n+2],c[3]=e[n+3],c[4]=e[n+4],c[5]=e[n+5],c[6]=e[n+6],c[7]=e[n+7],t[0]}function o(e,n){return c[7]=e[n],c[6]=e[n+1],c[5]=e[n+2],c[4]=e[n+3],c[3]=e[n+4],c[2]=e[n+5],c[1]=e[n+6],c[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:a,e.writeDoubleBE=n?a:i,e.readDoubleLE=n?r:o,e.readDoubleBE=n?o:r}():function(){function t(e,t,c,n,i,a){var r=n<0?1:0;if(r&&(n=-n),0===n)e(0,i,a+t),e(1/n>0?0:2147483648,i,a+c);else if(isNaN(n))e(0,i,a+t),e(2146959360,i,a+c);else if(n>17976931348623157e292)e(0,i,a+t),e((r<<31|2146435072)>>>0,i,a+c);else{var o;if(n<22250738585072014e-324)e((o=n/5e-324)>>>0,i,a+t),e((r<<31|o/4294967296)>>>0,i,a+c);else{var s=Math.floor(Math.log(n)/Math.LN2);1024===s&&(s=1023),e(4503599627370496*(o=n*Math.pow(2,-s))>>>0,i,a+t),e((r<<31|s+1023<<20|1048576*o&1048575)>>>0,i,a+c)}}}function r(e,t,c,n,i){var a=e(n,i+t),r=e(n,i+c),o=2*(r>>31)+1,s=r>>>20&2047,l=4294967296*(1048575&r)+a;return 2047===s?l?NaN:o*(1/0):0===s?5e-324*o*l:o*Math.pow(2,s-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,c,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=r.bind(null,i,0,4),e.readDoubleBE=r.bind(null,a,4,0)}(),e}function c(e,t,c){t[c]=255&e,t[c+1]=e>>>8&255,t[c+2]=e>>>16&255,t[c+3]=e>>>24}function n(e,t,c){t[c]=e>>>24,t[c+1]=e>>>16&255,t[c+2]=e>>>8&255,t[c+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function a(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},7199:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},6662:e=>{"use strict";e.exports=function(e,t,c){var n=c||8192,i=n>>>1,a=null,r=n;return function(c){if(c<1||c>i)return e(c);r+c>n&&(a=e(n),r=0);var o=t.call(a,r,r+=c);return 7&r&&(r=1+(7|r)),o}}},4997:(e,t)=>{"use strict";var c=t;c.length=function(e){for(var t=0,c=0,n=0;n191&&n<224?a[r++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,a[r++]=55296+(n>>10),a[r++]=56320+(1023&n)):a[r++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],r>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,a)),r=0);return i?(r&&i.push(String.fromCharCode.apply(String,a.slice(0,r))),i.join("")):String.fromCharCode.apply(String,a.slice(0,r))},c.write=function(e,t,c){for(var n,i,a=c,r=0;r>6|192,t[c++]=63&n|128):55296==(64512&n)&&56320==(64512&(i=e.charCodeAt(r+1)))?(n=65536+((1023&n)<<10)+(1023&i),++r,t[c++]=n>>18|240,t[c++]=n>>12&63|128,t[c++]=n>>6&63|128,t[c++]=63&n|128):(t[c++]=n>>12|224,t[c++]=n>>6&63|128,t[c++]=63&n|128);return c-a}},8320:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(3922);t.default=class{constructor(e,t,c,n=1e3,i=200){this.realtimeController=e,this.selfAttendeeId=t,this.hasBandwidthPriorityCallback=c,this.waitIntervalMs=n,this.updateIntervalMs=i,this.speakerScores={},this.speakerMuteState={},this.detectorCallbackToHandler=new Map,this.detectorCallbackToScoresTimer=new Map,this.detectorCallbackToActivityTimer=new Map,this.hasBandwidthPriority=!1,this.mostRecentUpdateTimestamp={}}needUpdate(e){return!this.activeSpeakers||0===this.speakerScores[e]&&this.activeSpeakers.includes(e)||this.speakerScores[e]>0&&!this.activeSpeakers.includes(e)}updateActiveSpeakers(e,t,c){if(!this.needUpdate(c))return;const n=[],i=Object.keys(this.speakerScores);for(let e=0;et.activeScore-e.activeScore)).filter((function(e){return e.activeScore>0})).map((function(e){return e.attendeeId}));this.activeSpeakers=a,t(a);const r=a.length>0&&a[0]===this.selfAttendeeId&&e.prioritizeVideoSendBandwidthForActiveSpeaker();this.hasBandwidthPriority!==r&&(this.hasBandwidthPriority=r,this.hasBandwidthPriorityCallback(r))}updateScore(e,t,c,n,i){const a=e.calculateScore(c,n,i);this.speakerScores[c]!==a&&(this.speakerScores[c]=a,this.mostRecentUpdateTimestamp[c]=Date.now(),this.updateActiveSpeakers(e,t,c))}subscribe(e,t,c,n){const a=(c,n)=>{if(!n)return this.speakerScores[c]=0,this.mostRecentUpdateTimestamp[c]=Date.now(),void this.updateActiveSpeakers(e,t,c);this.realtimeController.realtimeSubscribeToVolumeIndicator(c,((c,n,i,a)=>{this.mostRecentUpdateTimestamp[c]=Date.now(),null!==i&&(this.speakerMuteState[c]=i),this.updateScore(e,t,c,n,i)}))};this.detectorCallbackToHandler.set(t,a);const r=new i.default(this.updateIntervalMs);if(r.start((()=>{for(const c in this.speakerScores)Date.now()-this.mostRecentUpdateTimestamp[c]>this.waitIntervalMs&&this.updateScore(e,t,c,0,this.speakerMuteState[c])})),this.detectorCallbackToActivityTimer.set(t,r),c&&n){const e=new i.default(n);e.start((()=>{c(this.speakerScores)})),this.detectorCallbackToScoresTimer.set(t,e)}this.realtimeController.realtimeSubscribeToAttendeeIdPresence(a)}unsubscribe(e){const t=this.detectorCallbackToHandler.get(e);this.detectorCallbackToHandler.delete(e),t&&this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(t);const c=this.detectorCallbackToActivityTimer.get(e);c&&(c.stop(),this.detectorCallbackToActivityTimer.delete(e));const n=this.detectorCallbackToScoresTimer.get(e);n&&(n.stop(),this.detectorCallbackToHandler.delete(e))}destroy(){return n(this,void 0,void 0,(function*(){for(const e of this.detectorCallbackToHandler.values())this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(e);for(const e of this.detectorCallbackToActivityTimer.values())e.stop();for(const e of this.detectorCallbackToScoresTimer.values())e.stop();this.detectorCallbackToHandler.clear(),this.detectorCallbackToActivityTimer.clear(),this.detectorCallbackToScoresTimer.clear()}))}}},2363:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e=.9,t=.01,c=.2,n=.2){this.speakerWeight=e,this.cutoffThreshold=t,this.silenceThreshold=c,this.takeoverRate=n,this.volumes={}}calculateScore(e,t,c){(c||null===t)&&(t=0),this.volumes.hasOwnProperty(e)||(this.volumes[e]=0),t=t>this.silenceThreshold?1:0;const n=this.volumes[e]*this.speakerWeight+t*(1-this.speakerWeight);this.volumes[e]=n;for(const c in this.volumes)c!==e&&(this.volumes[c]=Math.max(this.volumes[c]-this.takeoverRate*t,0));return n{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},6802:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(543);t.default=class{constructor(e){this.logger=e,this.audioDevice=null,this.audioElement=null,this.audioStream=null,this.browserBehavior=new i.default}bindAudioElement(e){return n(this,void 0,void 0,(function*(){if(!e)throw new Error(`Cannot bind audio element: ${e}`);return this.audioElement=e,this.audioElement.autoplay=!0,this.bindAudioMix()}))}unbindAudioElement(){this.audioElement&&(this.audioElement.srcObject=null,this.audioElement=null)}bindAudioStream(e){return n(this,void 0,void 0,(function*(){if(e){this.audioStream=e;try{yield this.bindAudioMix()}catch(e){this.logger&&this.logger.warn(`Failed to bind audio stream: ${e}`)}}}))}bindAudioDevice(e){return n(this,void 0,void 0,(function*(){if(e&&!this.browserBehavior.supportsSetSinkId())throw new Error("Cannot select audio output device. This browser does not support setSinkId.");return this.audioDevice=e,this.bindAudioMix()}))}bindAudioMix(){var e,t;return n(this,void 0,void 0,(function*(){if(!this.audioElement)return;this.audioStream&&(this.audioElement.srcObject=this.audioStream);const c=(null===(e=this.audioDevice)||void 0===e?void 0:e.deviceId)!==this.audioElement.sinkId;if(c&&void 0===this.audioElement.sinkId)throw new Error("Cannot select audio output device. This browser does not support setSinkId.");const n=this.audioDevice?this.audioDevice.deviceId:"";if(n===this.audioElement.sinkId)return;const i=this.audioElement,a=this.audioStream;if(this.browserBehavior.hasChromiumWebRTC()&&(i.srcObject=null),c)try{yield i.setSinkId(n)}catch(e){throw null===(t=this.logger)||void 0===t||t.error(`Failed to set sinkId for audio element: ${e}`),e}this.browserBehavior.hasChromiumWebRTC()&&(i.srcObject=a)}))}}},3765:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class c{constructor(e=null){this.audioBitrateBps=e}static fullbandSpeechMono(){return new c(4e4)}static fullbandMusicMono(){return new c(64e3)}}t.default=c},1876:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.logger=null,this.browserBehavior=null,this.signalingClient=null,this.meetingSessionConfiguration=null,this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,this.audioVideoController=null,this.realtimeController=null,this.videoTileController=null,this.mediaStreamBroker=null,this.audioMixController=null,this.activeAudioInput=null,this.activeVideoInput=null,this.transceiverController=null,this.indexFrame=null,this.iceCandidates=[],this.iceCandidateHandler=null,this.iceGatheringStateEventHandler=null,this.sdpAnswer=null,this.turnCredentials=null,this.reconnectController=null,this.removableObservers=[],this.audioProfile=null,this.videoStreamIndex=null,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.lastKnownVideoAvailability=null,this.localVideoSender=null,this.localAudioSender=null,this.videoCaptureAndEncodeParameter=null,this.videosToReceive=null,this.videoSubscriptions=null,this.videosPaused=null,this.videoDuplexMode=null,this.volumeIndicatorAdapter=null,this.statsCollector=null,this.connectionMonitor=null,this.videoInputAttachedTimestampMs=0,this.audioDeviceInformation={},this.videoDeviceInformation={},this.enableSimulcast=!1,this.eventController=null,this.signalingOpenDurationMs=null,this.iceGatheringDurationMs=null,this.startAudioVideoTimestamp=null,this.attendeePresenceDurationMs=null,this.meetingStartDurationMs=null,this.poorConnectionCount=0,this.maxVideoTileCount=0,this.startTimeMs=null}}},9059:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(8320),a=c(6802),r=c(3765),o=c(543),s=c(6688),l=c(8581),u=c(3831),f=c(7086),d=c(3789),h=c(5687),m=c(5723),p=c(7500),v=c(983),g=c(7797),b=c(9678),z=c(3860),C=c(9553),M=c(3013),S=c(1208),V=c(289),y=c(9636),H=c(8358),w=c(3216),x=c(7408),L=c(5054),k=c(1129),N=c(6240),E=c(1960),A=c(6180),I=c(2748),T=c(1981),_=c(4543),O=c(8556),P=c(1209),D=c(5547),R=c(120),F=c(9560),B=c(9485),j=c(7079),U=c(4833),q=c(5275),W=c(5924),$=c(250),G=c(6171),K=c(365),Z=c(5785),Q=c(1133),J=c(5185),X=c(2880),Y=c(1508),ee=c(1318),te=c(4242),ce=c(2958),ne=c(4922),ie=c(4450),ae=c(4442),re=c(9751),oe=c(1876);class se{constructor(e,t,c,n,i){this._audioProfile=new r.default,this.connectionHealthData=new s.default,this.observerQueue=new Set,this.meetingSessionContext=new oe.default,this.enableSimulcast=!1,this.totalRetryCount=0,this.startAudioVideoTimestamp=0,this.destroyed=!1,this._logger=t,this.sessionStateController=new b.default(this._logger),this._configuration=e,this.enableSimulcast=e.enableUnifiedPlanForChromiumBasedBrowsers&&e.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&(new o.default).hasChromiumWebRTC(),this._webSocketAdapter=c,this._realtimeController=new v.default,this._realtimeController.realtimeSetLocalAttendeeId(e.credentials.attendeeId,e.credentials.externalUserId),this._mediaStreamBroker=n,this._reconnectController=i,this._videoTileController=new ce.default(new ne.default,this,this._logger),this._audioMixController=new a.default(this._logger),this.meetingSessionContext.logger=this._logger,this._eventController=new u.default(this)}destroy(){return n(this,void 0,void 0,(function*(){this.observerQueue.clear(),this.destroyed=!0}))}get configuration(){return this._configuration}get realtimeController(){return this._realtimeController}get activeSpeakerDetector(){return this._activeSpeakerDetector||(this._activeSpeakerDetector=new i.default(this._realtimeController,this._configuration.credentials.attendeeId,this.handleHasBandwidthPriority.bind(this))),this._activeSpeakerDetector}get videoTileController(){return this._videoTileController}get audioMixController(){return this._audioMixController}get eventController(){return this._eventController}get logger(){return this._logger}get rtcPeerConnection(){return this.meetingSessionContext&&this.meetingSessionContext.peer||null}get mediaStreamBroker(){return this._mediaStreamBroker}getRTCPeerConnectionStats(e){return this.rtcPeerConnection?this.rtcPeerConnection.getStats(e):null}setAudioProfile(e){this._audioProfile=e}addObserver(e){this.logger.info("adding meeting observer"),this.observerQueue.add(e)}removeObserver(e){this.logger.info("removing meeting observer"),this.observerQueue.delete(e)}forEachObserver(e){for(const t of this.observerQueue)g.default.nextTick((()=>{this.observerQueue.has(t)&&e(t)}))}start(){this.activeSpeakerDetector,this.sessionStateController.perform(z.default.Connect,(()=>{this.actionConnect(!1)}))}actionConnect(e){return n(this,void 0,void 0,(function*(){if(this.connectionHealthData.reset(),this.meetingSessionContext=new oe.default,this.meetingSessionContext.logger=this.logger,this.meetingSessionContext.eventController=this.eventController,this.meetingSessionContext.browserBehavior=new o.default({enableUnifiedPlanForChromiumBasedBrowsers:this.configuration.enableUnifiedPlanForChromiumBasedBrowsers}),this.meetingSessionContext.meetingSessionConfiguration=this.configuration,this.meetingSessionContext.signalingClient=new S.default(this._webSocketAdapter,this.logger),this.meetingSessionContext.mediaStreamBroker=this._mediaStreamBroker,this.meetingSessionContext.realtimeController=this._realtimeController,this.meetingSessionContext.audioMixController=this._audioMixController,this.meetingSessionContext.audioVideoController=this,this.enableSimulcast?this.meetingSessionContext.transceiverController=new Z.default(this.logger,this.meetingSessionContext.browserBehavior):this.meetingSessionContext.transceiverController=new K.default(this.logger,this.meetingSessionContext.browserBehavior),this.meetingSessionContext.volumeIndicatorAdapter=new re.default(this.logger,this._realtimeController,se.MIN_VOLUME_DECIBELS,se.MAX_VOLUME_DECIBELS),this.meetingSessionContext.videoTileController=this._videoTileController,this.meetingSessionContext.videoDownlinkBandwidthPolicy=this.configuration.videoDownlinkBandwidthPolicy,this.meetingSessionContext.videoUplinkBandwidthPolicy=this.configuration.videoUplinkBandwidthPolicy,this.meetingSessionContext.enableSimulcast=this.enableSimulcast,this.enableSimulcast){const e=new ie.default(this.configuration.credentials.attendeeId,this.meetingSessionContext.logger);e.addObserver(this),this.meetingSessionContext.videoUplinkBandwidthPolicy=e,this.meetingSessionContext.videoDownlinkBandwidthPolicy=new X.default(this.logger,this.meetingSessionContext.videoTileController),this.meetingSessionContext.videoStreamIndex=new te.default(this.logger)}else this.meetingSessionContext.enableSimulcast=!1,this.meetingSessionContext.videoStreamIndex=new ee.default(this.logger),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new J.default(this.configuration.credentials.attendeeId)),this.meetingSessionContext.videoUplinkBandwidthPolicy||(this.meetingSessionContext.videoUplinkBandwidthPolicy=new ae.default(this.configuration.credentials.attendeeId)),this.meetingSessionContext.audioProfile=this._audioProfile;this.meetingSessionContext.lastKnownVideoAvailability=new m.default,this.meetingSessionContext.videoCaptureAndEncodeParameter=new Q.default(0,0,0,0,!1),this.meetingSessionContext.videosToReceive=new Y.default,this.meetingSessionContext.videosPaused=new Y.default,this.meetingSessionContext.statsCollector=new y.default(this,this.logger,this.meetingSessionContext.browserBehavior),this.meetingSessionContext.connectionMonitor=new l.default(this,this._realtimeController,this._videoTileController,this.connectionHealthData,new p.default(this.meetingSessionContext.signalingClient,se.PING_PONG_INTERVAL_MS,this.logger),this.meetingSessionContext.statsCollector),this.meetingSessionContext.reconnectController=this._reconnectController,this.meetingSessionContext.videoDeviceInformation={},e||(this.totalRetryCount=0,this._reconnectController.reset(),this.startAudioVideoTimestamp=Date.now(),this.forEachObserver((e=>{f.default.of(e.audioVideoDidStartConnecting).map((t=>t.bind(e)(!1)))})),this.eventController&&this.eventController.publishEvent("meetingStartRequested")),this.meetingSessionContext.startAudioVideoTimestamp=this.startAudioVideoTimestamp,this._reconnectController.hasStartedConnectionAttempt()?this._reconnectController.startedConnectionAttempt(!1):this._reconnectController.startedConnectionAttempt(!0);try{yield new j.default(this.logger,this.wrapTaskName("AudioVideoStart"),[new T.default(this.meetingSessionContext,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData),new P.default(this.meetingSessionContext),new $.default(this.logger,new j.default(this.logger,"Media",[new j.default(this.logger,"Signaling",[new _.default(this.meetingSessionContext),new I.default(this.meetingSessionContext),new B.default(this.meetingSessionContext),new E.default(this.meetingSessionContext),new D.default(this.meetingSessionContext),new F.default(this.meetingSessionContext)]),new j.default(this.logger,"Peer",[new L.default(this.meetingSessionContext),new H.default(this.meetingSessionContext),new k.default(this.meetingSessionContext),new U.default(this.meetingSessionContext),new N.default(this.meetingSessionContext),new W.default(this.meetingSessionContext),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs>0?new $.default(this.logger,new O.default(this.logger,"FinalizeConnection",[new G.default(this.meetingSessionContext),new q.default(this.meetingSessionContext)]),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs):new q.default(this.meetingSessionContext)])]),this.configuration.connectionTimeoutMs)]).run(),this.sessionStateController.perform(z.default.FinishConnecting,(()=>{this.eventController&&(this.meetingSessionContext.meetingStartDurationMs=Date.now()-this.startAudioVideoTimestamp,this.eventController.publishEvent("meetingStartSucceeded",{maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,poorConnectionCount:this.meetingSessionContext.poorConnectionCount,retryCount:this.totalRetryCount,signalingOpenDurationMs:this.meetingSessionContext.signalingOpenDurationMs,iceGatheringDurationMs:this.meetingSessionContext.iceGatheringDurationMs,meetingStartDurationMs:this.meetingSessionContext.meetingStartDurationMs})),this.meetingSessionContext.startTimeMs=Date.now(),this.actionFinishConnecting()}))}catch(e){this.sessionStateController.perform(z.default.Fail,(()=>n(this,void 0,void 0,(function*(){const t=new d.default(this.getMeetingStatusCode(e)||h.default.TaskFailed);yield this.actionDisconnect(t,!0,e),this.handleMeetingSessionStatus(t,e)||this.notifyStop(t,e)}))))}this.connectionHealthData.setConnectionStartTime()}))}actionFinishConnecting(){this.meetingSessionContext.videoDuplexMode=V.SdkStreamServiceType.RX,this.meetingSessionContext.enableSimulcast||this.enforceBandwidthLimitationForSender(this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0]),this.forEachObserver((e=>{f.default.of(e.audioVideoDidStart).map((t=>t.bind(e)()))})),this._reconnectController.reset()}stop(){this.sessionStateController.perform(z.default.Disconnect,(()=>{this._reconnectController.disableReconnect(),this.logger.info("attendee left meeting, session will not be reconnected"),this.actionDisconnect(new d.default(h.default.Left),!1,null)}))}actionDisconnect(e,t,c){return n(this,void 0,void 0,(function*(){try{yield new j.default(this.logger,this.wrapTaskName("AudioVideoStop"),[new $.default(this.logger,new A.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)]).run()}catch(e){this.logger.info("fail to stop")}try{yield new j.default(this.logger,this.wrapTaskName("AudioVideoClean"),[new $.default(this.logger,new x.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)]).run()}catch(e){this.logger.info("fail to clean")}this.sessionStateController.perform(z.default.FinishDisconnecting,(()=>{t||this.notifyStop(e,c)}))}))}update(){const e=this.sessionStateController.perform(z.default.Update,(()=>{this.actionUpdate(!0)}));return e===M.default.Transitioned||e===M.default.DeferredTransition}restartLocalVideo(e){const t=()=>n(this,void 0,void 0,(function*(){this._videoTileController.hasStartedLocalVideoTile()&&(this.logger.info("stopping local video tile prior to local video restart"),this._videoTileController.stopLocalVideoTile(),this.logger.info("preparing local video restart update"),yield this.actionUpdate(!1),this.logger.info("starting local video tile for local video restart"),this._videoTileController.startLocalVideoTile()),this.logger.info("finalizing local video restart update"),yield this.actionUpdate(!0),e()})),c=this.sessionStateController.perform(z.default.Update,(()=>{t()}));return c===M.default.Transitioned||c===M.default.DeferredTransition}replaceLocalVideo(){return n(this,void 0,void 0,(function*(){let e=null;try{e=yield this.mediaStreamBroker.acquireVideoInputStream()}catch(e){throw new Error(`could not acquire video stream from mediaStreamBroker due to ${e.message}`)}if(!e||e.getVideoTracks().length<1)throw new Error("could not acquire video track");const t=e.getVideoTracks()[0];if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw new Error("no active meeting and peer connection");if(!this.meetingSessionContext.browserBehavior.requiresUnifiedPlan())throw new Error("cannot replace track on Plan B");yield this.meetingSessionContext.transceiverController.setVideoInput(t);const c=this.meetingSessionContext.videoTileController.getLocalVideoTile();if(c){const t=c.state(),n=e.getVideoTracks()[0].getSettings();c.bindVideoStream(t.boundAttendeeId,!0,e,n.width,n.height,t.streamId,t.boundExternalUserId)}this.meetingSessionContext.activeVideoInput=e}))}restartLocalAudio(e){return n(this,void 0,void 0,(function*(){let t=null;try{t=yield this.mediaStreamBroker.acquireAudioInputStream()}catch(e){this.logger.info("could not acquire audio stream from mediaStreamBroker")}if(!t||t.getAudioTracks().length<1)throw new Error("could not acquire audio track");this.connectionHealthData.reset(),this.connectionHealthData.setConnectionStartTime();const c=t.getAudioTracks()[0];if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw new Error("no active meeting and peer connection");let n=!1;return n=this.meetingSessionContext.browserBehavior.requiresUnifiedPlan()?yield this.meetingSessionContext.transceiverController.replaceAudioTrack(c):yield K.default.replaceAudioTrackForSender(this.meetingSessionContext.localAudioSender,c),this._realtimeController.realtimeSetLocalAudioInput(t),this.meetingSessionContext.activeAudioInput=t,e(),n?Promise.resolve():Promise.reject()}))}actionUpdate(e){return n(this,void 0,void 0,(function*(){try{yield new j.default(this.logger,this.wrapTaskName("AudioVideoUpdate"),[new R.default(this.meetingSessionContext),new $.default(this.logger,new j.default(this.logger,"UpdateSession",[new H.default(this.meetingSessionContext),new k.default(this.meetingSessionContext),new U.default(this.meetingSessionContext),new N.default(this.meetingSessionContext),new W.default(this.meetingSessionContext),new q.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),e&&this.sessionStateController.perform(z.default.FinishUpdating,(()=>{this.actionFinishUpdating()}))}catch(e){this.sessionStateController.perform(z.default.FinishUpdating,(()=>{const t=new d.default(this.getMeetingStatusCode(e)||h.default.TaskFailed);t.statusCode()!==h.default.IncompatibleSDP&&this.logger.info("failed to update audio-video session"),this.handleMeetingSessionStatus(t,e)}))}}))}notifyStop(e,t){if(this.forEachObserver((t=>{f.default.of(t.audioVideoDidStop).map((c=>c.bind(t)(e)))})),this.eventController){const{signalingOpenDurationMs:c,poorConnectionCount:n,startTimeMs:i,iceGatheringDurationMs:a,attendeePresenceDurationMs:r,meetingStartDurationMs:o}=this.meetingSessionContext,s={maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,meetingDurationMs:null===i?0:Math.round(Date.now()-i),meetingStatus:h.default[e.statusCode()],signalingOpenDurationMs:c,iceGatheringDurationMs:a,attendeePresenceDurationMs:r,poorConnectionCount:n,meetingStartDurationMs:o,retryCount:this.totalRetryCount};0===s.meetingDurationMs?(s.meetingErrorMessage=t&&t.message||"",delete s.meetingDurationMs,delete s.attendeePresenceDurationMs,delete s.meetingStartDurationMs,this.eventController.publishEvent("meetingStartFailed",s)):e.isFailure()||e.isAudioConnectionFailure()?(s.meetingErrorMessage=t&&t.message||"",this.eventController.publishEvent("meetingFailed",s)):this.eventController.publishEvent("meetingEnded",s)}}actionFinishUpdating(){if(!this.meetingSessionContext.enableSimulcast){const e=this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0];this.enforceBandwidthLimitationForSender(e)}this.logger.info("updated audio-video session")}reconnect(e,t){const c=this._reconnectController.retryWithBackoff((()=>n(this,void 0,void 0,(function*(){this.sessionStateController.state()===C.default.NotConnected?this.sessionStateController.perform(z.default.Connect,(()=>{this.actionConnect(!0)})):this.sessionStateController.perform(z.default.Reconnect,(()=>{this.actionReconnect()})),this.totalRetryCount+=1}))),(()=>{this.logger.info("canceled retry")}));return c||this.sessionStateController.perform(z.default.Fail,(()=>{this.actionDisconnect(e,!1,t)})),c}actionReconnect(){return n(this,void 0,void 0,(function*(){this._reconnectController.hasStartedConnectionAttempt()||(this._reconnectController.startedConnectionAttempt(!1),this.forEachObserver((e=>{f.default.of(e.audioVideoDidStartConnecting).map((t=>t.bind(e)(!0)))}))),this.meetingSessionContext.volumeIndicatorAdapter.onReconnect(),this.connectionHealthData.reset();try{yield new j.default(this.logger,this.wrapTaskName("AudioVideoReconnect"),[new $.default(this.logger,new j.default(this.logger,"Media",[new w.default(this.meetingSessionContext),new j.default(this.logger,"Signaling",[new _.default(this.meetingSessionContext),new E.default(this.meetingSessionContext),new D.default(this.meetingSessionContext)]),new L.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs),new R.default(this.meetingSessionContext),new $.default(this.logger,new j.default(this.logger,"UpdateSession",[new H.default(this.meetingSessionContext),new k.default(this.meetingSessionContext),new U.default(this.meetingSessionContext),new N.default(this.meetingSessionContext),new W.default(this.meetingSessionContext),new q.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),this.sessionStateController.perform(z.default.FinishConnecting,(()=>{this.eventController&&this.eventController.pushMeetingState("meetingReconnected"),this.actionFinishConnecting()}))}catch(e){this.sessionStateController.perform(z.default.FinishConnecting,(()=>{this.logger.info("failed to reconnect audio-video session");const t=new d.default(this.getMeetingStatusCode(e)||h.default.TaskFailed);this.handleMeetingSessionStatus(t,e)}))}this.connectionHealthData.setConnectionStartTime()}))}wrapTaskName(e){return`${e}/${this.configuration.meetingId}/${this.configuration.credentials.attendeeId}`}getMeetingStatusCode(e){const t=/the meeting status code: (\d+)/.exec(e&&e.message);return t&&t.length>1?Number(t[1]):null}enforceBandwidthLimitationForSender(e){return n(this,void 0,void 0,(function*(){this.meetingSessionContext.browserBehavior.requiresUnifiedPlan()?yield this.meetingSessionContext.transceiverController.setVideoSendingBitrateKbps(e):yield K.default.setVideoSendingBitrateKbpsForSender(this.meetingSessionContext.localVideoSender,e,this.meetingSessionContext.logger)}))}handleMeetingSessionStatus(e,t){if(this.logger.info(`handling status: ${h.default[e.statusCode()]}`),e.isTerminal()||this.meetingSessionContext.statsCollector&&this.meetingSessionContext.statsCollector.logMeetingSessionStatus(e),e.statusCode()===h.default.IncompatibleSDP)return this.restartLocalVideo((()=>{this.logger.info("handled incompatible SDP by attempting to restart video")})),!0;if(e.statusCode()===h.default.VideoCallSwitchToViewOnly)return this._videoTileController.removeLocalVideoTile(),this.forEachObserver((e=>{f.default.of(e.videoSendDidBecomeUnavailable).map((t=>t.bind(e)()))})),!1;if(e.isTerminal()&&(this.logger.error("session will not be reconnected"),this.meetingSessionContext.reconnectController&&this.meetingSessionContext.reconnectController.disableReconnect()),(e.isFailure()||e.isTerminal())&&this.meetingSessionContext.reconnectController){const c=this.reconnect(e,t);return c?this.logger.warn(`will retry due to status code ${h.default[e.statusCode()]}${t?` and error: ${t.message}`:""}`):this.logger.error(`failed with status code ${h.default[e.statusCode()]}${t?` and error: ${t.message}`:""}`),c}return!1}setVideoMaxBandwidthKbps(e){this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&(this.logger.info(`video send has ideal max bandwidth ${e} kbps`),this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(e))}handleHasBandwidthPriority(e){return n(this,void 0,void 0,(function*(){if(this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&!this.meetingSessionContext.enableSimulcast){const t=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(e);const c=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();t!==c&&(this.logger.info(`video send bandwidth priority ${e} max has changed from ${t} kbps to ${c} kbps`),yield this.enforceBandwidthLimitationForSender(c))}}))}pauseReceivingStream(e){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.pause([e])}resumeReceivingStream(e){this.meetingSessionContext&&this.meetingSessionContext.signalingClient&&this.meetingSessionContext.signalingClient.resume([e])}getRemoteVideoSources(){const{videoStreamIndex:e}=this.meetingSessionContext;if(!e)return this.logger.info("meeting has not started"),[];const t=this.configuration.credentials.attendeeId;return e.allVideoSendingSourcesExcludingSelf(t)}encodingSimulcastLayersDidChange(e){this.forEachObserver((t=>{f.default.of(t.encodingSimulcastLayersDidChange).map((c=>c.bind(t)(e)))}))}}t.default=se,se.MIN_VOLUME_DECIBELS=-42,se.MAX_VOLUME_DECIBELS=-14,se.PING_PONG_INTERVAL_MS=1e4},9836:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(8434),i=c(209),a=c(4015),r=c(589),o=c(8015),s=c(6057),l=c(9141),u=c(7631),f=c(9059);class d extends f.default{constructor(e){const t=new r.default;t.meetingId="",t.externalMeetingId="",t.credentials=new o.default,t.credentials.attendeeId="",t.credentials.joinToken="",t.urls=new s.default,t.urls.turnControlURL="",t.urls.audioHostURL="",t.urls.screenViewingURL="",t.urls.screenDataURL="",t.urls.screenSharingURL="wss://localhost/",t.urls.signalingURL="wss://localhost/",super(e||t,new i.default,new u.default(new i.default),new a.default,new l.default(0,new n.default(0,0,0)))}setAudioProfile(e){}start(){}stop(){}}t.default=d},8538:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(7170);t.default=class{constructor(e,t,c,n,i,a){this.audioVideoController=e,this.videoTileController=t,this.realtimeController=c,this.audioMixController=n,this.deviceController=i,this.contentShareController=a}addObserver(e){this.audioVideoController.addObserver(e),this.trace("addObserver")}removeObserver(e){this.audioVideoController.removeObserver(e),this.trace("removeObserver")}setAudioProfile(e){this.trace("setAudioProfile",e),this.audioVideoController.setAudioProfile(e)}start(){this.audioVideoController.start(),this.trace("start")}stop(){this.audioVideoController.stop(),this.trace("stop")}getRTCPeerConnectionStats(e){return this.trace("getRTCPeerConnectionStats",e?e.id:null),this.audioVideoController.getRTCPeerConnectionStats(e)}bindAudioElement(e){const t=this.audioMixController.bindAudioElement(e);return this.trace("bindAudioElement",e.id,t),t}unbindAudioElement(){this.audioMixController.unbindAudioElement(),this.trace("unbindAudioElement")}bindVideoElement(e,t){this.videoTileController.bindVideoElement(e,t),this.trace("bindVideoElement",{tileId:e,videoElementId:t.id})}unbindVideoElement(e){this.videoTileController.unbindVideoElement(e),this.trace("unbindVideoElement",e)}startLocalVideoTile(){const e=this.videoTileController.startLocalVideoTile();return this.trace("startLocalVideoTile",null,e),e}stopLocalVideoTile(){this.videoTileController.stopLocalVideoTile(),this.trace("stopLocalVideoTile")}hasStartedLocalVideoTile(){const e=this.videoTileController.hasStartedLocalVideoTile();return this.trace("hasStartedLocalVideoTile",null,e),e}removeLocalVideoTile(){this.videoTileController.removeLocalVideoTile(),this.trace("removeLocalVideoTile")}getLocalVideoTile(){const e=this.videoTileController.getLocalVideoTile();return this.trace("getLocalVideoTile"),e}pauseVideoTile(e){this.videoTileController.pauseVideoTile(e),this.trace("pauseVideoTile",e)}unpauseVideoTile(e){this.videoTileController.unpauseVideoTile(e),this.trace("unpauseVideoTile",e)}getVideoTile(e){const t=this.videoTileController.getVideoTile(e);return this.trace("getVideoTile",e),t}getAllRemoteVideoTiles(){const e=this.videoTileController.getAllRemoteVideoTiles();return this.trace("getAllRemoteVideoTiles"),e}getAllVideoTiles(){const e=this.videoTileController.getAllVideoTiles();return this.trace("getAllVideoTiles"),e}addVideoTile(){const e=this.videoTileController.addVideoTile();return this.trace("addVideoTile",null,e.state()),e}removeVideoTile(e){this.videoTileController.removeVideoTile(e),this.trace("removeVideoTile",e)}removeVideoTilesByAttendeeId(e){const t=this.videoTileController.removeVideoTilesByAttendeeId(e);return this.trace("removeVideoTilesByAttendeeId",e,t),t}removeAllVideoTiles(){this.videoTileController.removeAllVideoTiles(),this.trace("removeAllVideoTiles")}captureVideoTile(e){const t=this.videoTileController.captureVideoTile(e);return this.trace("captureVideoTile",e),t}realtimeSubscribeToAttendeeIdPresence(e){this.realtimeController.realtimeSubscribeToAttendeeIdPresence(e),this.trace("realtimeSubscribeToAttendeeIdPresence")}realtimeUnsubscribeToAttendeeIdPresence(e){this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(e),this.trace("realtimeUnsubscribeToAttendeeIdPresence")}realtimeSetCanUnmuteLocalAudio(e){this.realtimeController.realtimeSetCanUnmuteLocalAudio(e),this.trace("realtimeSetCanUnmuteLocalAudio",e)}realtimeSubscribeToSetCanUnmuteLocalAudio(e){this.realtimeController.realtimeSubscribeToSetCanUnmuteLocalAudio(e),this.trace("realtimeSubscribeToSetCanUnmuteLocalAudio")}realtimeUnsubscribeToSetCanUnmuteLocalAudio(e){this.realtimeController.realtimeUnsubscribeToSetCanUnmuteLocalAudio(e)}realtimeCanUnmuteLocalAudio(){const e=this.realtimeController.realtimeCanUnmuteLocalAudio();return this.trace("realtimeCanUnmuteLocalAudio",null,e),e}realtimeMuteLocalAudio(){this.realtimeController.realtimeMuteLocalAudio(),this.trace("realtimeMuteLocalAudio")}realtimeUnmuteLocalAudio(){const e=this.realtimeController.realtimeUnmuteLocalAudio();return this.trace("realtimeUnmuteLocalAudio"),e}realtimeSubscribeToMuteAndUnmuteLocalAudio(e){this.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(e),this.trace("realtimeSubscribeToMuteAndUnmuteLocalAudio")}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(e){this.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(e)}realtimeIsLocalAudioMuted(){const e=this.realtimeController.realtimeIsLocalAudioMuted();return this.trace("realtimeIsLocalAudioMuted"),e}realtimeSubscribeToVolumeIndicator(e,t){this.realtimeController.realtimeSubscribeToVolumeIndicator(e,t),this.trace("realtimeSubscribeToVolumeIndicator",e)}realtimeUnsubscribeFromVolumeIndicator(e,t){this.realtimeController.realtimeUnsubscribeFromVolumeIndicator(e,t),this.trace("realtimeUnsubscribeFromVolumeIndicator",e,t)}realtimeSubscribeToLocalSignalStrengthChange(e){this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(e),this.trace("realtimeSubscribeToLocalSignalStrengthChange")}realtimeUnsubscribeToLocalSignalStrengthChange(e){this.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(e),this.trace("realtimeUnsubscribeToLocalSignalStrengthChange")}realtimeSendDataMessage(e,t,c){this.realtimeController.realtimeSendDataMessage(e,t,c),this.trace("realtimeSendDataMessage")}realtimeSubscribeToReceiveDataMessage(e,t){this.realtimeController.realtimeSubscribeToReceiveDataMessage(e,t),this.trace("realtimeSubscribeToReceiveDataMessage")}realtimeUnsubscribeFromReceiveDataMessage(e){this.realtimeController.realtimeUnsubscribeFromReceiveDataMessage(e),this.trace("realtimeUnsubscribeFromReceiveDataMessage")}realtimeSubscribeToFatalError(e){this.realtimeController.realtimeSubscribeToFatalError(e)}realtimeUnsubscribeToFatalError(e){this.realtimeController.realtimeUnsubscribeToFatalError(e)}subscribeToActiveSpeakerDetector(e,t,c,n){this.audioVideoController.activeSpeakerDetector.subscribe(e,t,c,n),this.trace("subscribeToActiveSpeakerDetector")}unsubscribeFromActiveSpeakerDetector(e){this.audioVideoController.activeSpeakerDetector.unsubscribe(e),this.trace("unsubscribeFromActiveSpeakerDetector")}listAudioInputDevices(){return n(this,void 0,void 0,(function*(){const e=yield this.deviceController.listAudioInputDevices();return this.trace("listAudioInputDevices",null,e),e}))}listVideoInputDevices(){return n(this,void 0,void 0,(function*(){const e=yield this.deviceController.listVideoInputDevices();return this.trace("listVideoInputDevices",null,e),e}))}listAudioOutputDevices(){return n(this,void 0,void 0,(function*(){const e=yield this.deviceController.listAudioOutputDevices();return this.trace("listAudioOutputDevices",null,e),e}))}chooseAudioInputDevice(e){return this.trace("chooseAudioInputDevice",e),this.deviceController.chooseAudioInputDevice(e)}chooseVideoInputDevice(e){return i.isVideoTransformDevice(e)?this.trace("chooseVideoInputDevice with transform device"):this.trace("chooseVideoInputDevice",e),this.deviceController.chooseVideoInputDevice(e)}chooseAudioOutputDevice(e){const t=this.deviceController.chooseAudioOutputDevice(e);return this.trace("chooseAudioOutputDevice",e),t}addDeviceChangeObserver(e){this.deviceController.addDeviceChangeObserver(e),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(e){this.deviceController.removeDeviceChangeObserver(e),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){const e=this.deviceController.createAnalyserNodeForAudioInput();return this.trace("createAnalyserNodeForAudioInput"),e}startVideoPreviewForVideoInput(e){this.deviceController.startVideoPreviewForVideoInput(e),this.trace("startVideoPreviewForVideoInput",e.id)}stopVideoPreviewForVideoInput(e){this.deviceController.stopVideoPreviewForVideoInput(e),this.trace("stopVideoPreviewForVideoInput",e.id)}setDeviceLabelTrigger(e){this.deviceController.setDeviceLabelTrigger(e),this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(e){const t=this.deviceController.mixIntoAudioInput(e);return this.trace("mixIntoAudioInput",e.id),t}chooseVideoInputQuality(e,t,c,n){this.deviceController.chooseVideoInputQuality(e,t,c,n),this.trace("chooseVideoInputQuality",{width:e,height:t,frameRate:c,maxBandwidthKbps:n})}getVideoInputQualitySettings(){const e=this.deviceController.getVideoInputQualitySettings();return this.trace("getVideoInputQualitySettings"),e}setContentAudioProfile(e){this.trace("setContentAudioProfile",e),this.contentShareController.setContentAudioProfile(e)}startContentShare(e){const t=this.contentShareController.startContentShare(e);return this.trace("startContentShare"),t}startContentShareFromScreenCapture(e,t){const c=this.contentShareController.startContentShareFromScreenCapture(e,t);return this.trace("startContentShareFromScreenCapture"),c}pauseContentShare(){this.contentShareController.pauseContentShare(),this.trace("pauseContentShare")}unpauseContentShare(){this.contentShareController.unpauseContentShare(),this.trace("unpauseContentShare")}stopContentShare(){this.contentShareController.stopContentShare(),this.trace("stopContentShare")}addContentShareObserver(e){this.contentShareController.addContentShareObserver(e),this.trace("addContentShareObserver")}removeContentShareObserver(e){this.contentShareController.removeContentShareObserver(e),this.trace("removeContentShareObserver")}trace(e,t,c){let n=`API/DefaultAudioVideoFacade/${this.audioVideoController.configuration.meetingId}/${this.audioVideoController.configuration.credentials.attendeeId}/${e}`;void 0!==t&&(n+=` ${JSON.stringify(t)}`),void 0!==c&&(n+=` -> ${JSON.stringify(c)}`),this.audioVideoController.logger.info(n)}getRemoteVideoSources(){const e=this.audioVideoController.getRemoteVideoSources();return this.trace("getRemoteVideoSources",null,e),e}}},8434:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,c){this.fixedWaitMs=e,this.shortBackoffMs=t,this.longBackoffMs=c,this.currentRetry=0,this.fixedWaitMs<0&&(this.fixedWaitMs=0),this.shortBackoffMs<0&&(this.shortBackoffMs=0),this.longBackoffMs<0&&(this.longBackoffMs=0),this.reset()}reset(){this.currentRetry=0}nextBackoffAmountMs(){const e=Math.random()*Math.min(this.longBackoffMs,this.shortBackoffMs*Math.pow(2,this.currentRetry))+this.fixedWaitMs;return this.currentRetry+=1,e}}},5640:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(8434),i=c(7300);t.default=class{constructor(e,t,c){this.fixedWaitMs=e,this.shortBackoffMs=t,this.longBackoffMs=c}create(){return new n.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs)}createWithLimit(e){return new i.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs,e)}}},7300:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(8434);class i extends n.default{constructor(e,t,c,n){super(e,t,c),this.limit=n,this.attempts=0}nextBackoffAmountMs(){if(this.attempts++,this.attempts>this.limit)throw new Error("retry limit exceeded");return super.nextBackoffAmountMs()}}t.default=i},543:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(3631);t.default=class{constructor({enableUnifiedPlanForChromiumBasedBrowsers:e=!1}={}){this.browser=i.detect(),this.browserSupport={chrome:78,"edge-chromium":79,electron:7,firefox:60,ios:12,safari:12,opera:66,samsung:12,crios:86,fxios:23},this.browserName={chrome:"Google Chrome","edge-chromium":"Microsoft Edge",electron:"Electron",firefox:"Mozilla Firefox",ios:"Safari iOS",safari:"Safari",opera:"Opera",samsung:"Samsung Internet",crios:"Chrome iOS",fxios:"Firefox iOS"},this.chromeLike=["chrome","edge-chromium","chromium-webview","opera","samsung"],this.webkitBrowsers=["crios","fxios","safari","ios"],this.enableUnifiedPlanForChromiumBasedBrowsers=e}version(){return this.browser.version}majorVersion(){return parseInt(this.version().split(".")[0])}name(){return this.browser.name}hasChromiumWebRTC(){for(const e of this.chromeLike)if(e===this.browser.name)return!0;return!1}hasWebKitWebRTC(){for(const e of this.webkitBrowsers)if(e===this.browser.name)return!0;return!1}hasFirefoxWebRTC(){return this.isFirefox()}supportsCanvasCapturedStreamPlayback(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()}requiresUnifiedPlan(){let e=this.isFirefox()||this.hasWebKitWebRTC()&&this.isUnifiedPlanSupported();return this.enableUnifiedPlanForChromiumBasedBrowsers&&(e=e||this.hasChromiumWebRTC()),e}requiresResolutionAlignment(e,t){return this.isAndroid()&&this.isPixel3()?[64*Math.ceil(e/64),64*Math.ceil(t/64)]:[e,t]}requiresCheckForSdpConnectionAttributes(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()}requiresIceCandidateGatheringTimeoutWorkaround(){return this.hasChromiumWebRTC()}requiresUnifiedPlanMunging(){let e=this.hasWebKitWebRTC()&&this.isUnifiedPlanSupported();return this.enableUnifiedPlanForChromiumBasedBrowsers&&(e=e||this.hasChromiumWebRTC()),e}requiresSortCodecPreferencesForSdpAnswer(){return this.isFirefox()&&this.majorVersion()<=68}requiresSimulcastMunging(){return this.isSafari()}requiresBundlePolicy(){return"max-bundle"}requiresPromiseBasedWebRTCGetStats(){return!this.hasChromiumWebRTC()}requiresVideoElementWorkaround(){return this.isSafari()}requiresNoExactMediaStreamConstraints(){return this.isSamsungInternet()||this.isIOSSafari()&&("12.0.0"===this.version()||"12.1.0"===this.version())}requiresGroupIdMediaStreamConstraints(){return this.isSamsungInternet()}requiresContextRecreationForAudioWorklet(){return"chrome"in c.g&&"Mac OS"===this.browser.os&&!(!this.isChrome()&&!this.isEdge())}getDisplayMediaAudioCaptureSupport(){return this.isChrome()||this.isEdge()}supportsSenderSideBandwidthEstimation(){return this.hasChromiumWebRTC()||this.isSafari()}screenShareUnsupported(){return console.warn("This function is no longer supported."),!!this.isSafari()}isSupported(){return!(!this.browserSupport[this.browser.name]||this.majorVersion()e.includes("a=rtpmap:"))).map((e=>e.replace(/.* /,"").replace(/\/.*/,""))).filter(((e,t,c)=>c.indexOf(e)===t)).filter((e=>"rtx"!==e&&"red"!==e&&"ulpfec"!==e))}))}supportsSetSinkId(){return"setSinkId"in HTMLAudioElement.prototype}isIOSSafari(){return"ios"===this.browser.name}isSafari(){return"safari"===this.browser.name||"ios"===this.browser.name}isFirefox(){return"firefox"===this.browser.name}isIOSFirefox(){return"fxios"===this.browser.name}isIOSChrome(){return"crios"===this.browser.name}isChrome(){return"chrome"===this.browser.name}isEdge(){return"edge-chromium"===this.browser.name}isSamsungInternet(){return"samsung"===this.browser.name}isAndroid(){return/(android)/i.test(navigator.userAgent)}isPixel3(){return/( pixel 3)/i.test(navigator.userAgent)}isUnifiedPlanSupported(){return RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection")}}},6196:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.ClientMetricReportDirection=void 0,function(e){e[e.UPSTREAM=0]="UPSTREAM",e[e.DOWNSTREAM=1]="DOWNSTREAM"}(c=t.ClientMetricReportDirection||(t.ClientMetricReportDirection={})),t.default=c},9496:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.ClientMetricReportMediaType=void 0,function(e){e[e.AUDIO=0]="AUDIO",e[e.VIDEO=1]="VIDEO"}(c=t.ClientMetricReportMediaType||(t.ClientMetricReportMediaType={})),t.default=c},2770:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},6893:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(289),i=c(6196),a=c(9496),r=c(2306);class o{constructor(e){this.logger=e,this.globalMetricReport=new r.default,this.streamMetricReports={},this.currentTimestampMs=0,this.previousTimestampMs=0,this.currentSsrcs={},this.identityValue=(e,t)=>{const c=t?this.streamMetricReports[t]:this.globalMetricReport;return Number(c.currentMetrics[e])},this.decoderLossPercent=(e,t)=>{const c=t?this.streamMetricReports[t]:this.globalMetricReport,n=c.currentMetrics.googDecodingNormal-(c.previousMetrics.googDecodingNormal||0),i=c.currentMetrics.googDecodingCTN-(c.previousMetrics.googDecodingCTN||0);if(i<=0)return 0;const a=i-n;return a<=0?0:100*a/i},this.packetLossPercent=(e,t)=>{const c=t?this.streamMetricReports[t]:this.globalMetricReport,n=c.currentMetrics[e]-(c.previousMetrics[e]||0),i=c.currentMetrics.packetsLost-(c.previousMetrics.packetsLost||0),a=n+i;return a<=0||i<=0?0:100*i/a},this.countPerSecond=(e,t)=>{const c=t?this.streamMetricReports[t]:this.globalMetricReport;let n=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(n<=0)return 0;this.previousTimestampMs<=0&&(n=1);const i=c.currentMetrics[e]-(c.previousMetrics[e]||0);return i<=0?0:Math.trunc(i/n)},this.bitsPerSecond=(e,t)=>{const c=t?this.streamMetricReports[t]:this.globalMetricReport;let n=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(n<=0)return 0;this.previousTimestampMs<=0&&(n=1);const i=8*(c.currentMetrics[e]-(c.previousMetrics[e]||0));return i<=0?0:Math.trunc(i/n)},this.secondsToMilliseconds=(e,t)=>{const c=t?this.streamMetricReports[t]:this.globalMetricReport;return Number(1e3*c.currentMetrics[e])},this.globalMetricMap={googActualEncBitrate:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_ACTUAL_ENCODER_BITRATE},googAvailableSendBandwidth:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_AVAILABLE_SEND_BANDWIDTH},googRetransmitBitrate:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_RETRANSMIT_BITRATE},googAvailableReceiveBandwidth:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_AVAILABLE_RECEIVE_BANDWIDTH},googTargetEncBitrate:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_TARGET_ENCODER_BITRATE},googBucketDelay:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_BUCKET_DELAY_MS},googRtt:{transform:this.identityValue,type:n.SdkMetric.Type.STUN_RTT_MS},packetsDiscardedOnSend:{transform:this.countPerSecond,type:n.SdkMetric.Type.SOCKET_DISCARDED_PPS},availableIncomingBitrate:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_AVAILABLE_RECEIVE_BANDWIDTH},availableOutgoingBitrate:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_AVAILABLE_SEND_BANDWIDTH},currentRoundTripTime:{transform:this.identityValue,type:n.SdkMetric.Type.STUN_RTT_MS}},this.audioUpstreamMetricMap={googJitterReceived:{transform:this.identityValue,type:n.SdkMetric.Type.RTC_MIC_JITTER_MS},jitter:{transform:this.secondsToMilliseconds,type:n.SdkMetric.Type.RTC_MIC_JITTER_MS},packetsSent:{transform:this.countPerSecond,type:n.SdkMetric.Type.RTC_MIC_PPS},bytesSent:{transform:this.bitsPerSecond,type:n.SdkMetric.Type.RTC_MIC_BITRATE},googRtt:{transform:this.identityValue,type:n.SdkMetric.Type.RTC_MIC_RTT_MS},packetsLost:{transform:this.packetLossPercent,type:n.SdkMetric.Type.RTC_MIC_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"}},this.audioDownstreamMetricMap={packetsReceived:{transform:this.countPerSecond,type:n.SdkMetric.Type.RTC_SPK_PPS},packetsLost:{transform:this.packetLossPercent,type:n.SdkMetric.Type.RTC_SPK_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},googJitterReceived:{transform:this.identityValue,type:n.SdkMetric.Type.RTC_SPK_JITTER_MS},jitter:{transform:this.secondsToMilliseconds,type:n.SdkMetric.Type.RTC_SPK_JITTER_MS},googDecodingCTN:{transform:this.countPerSecond},googDecodingNormal:{transform:this.decoderLossPercent,type:n.SdkMetric.Type.RTC_SPK_FRACTION_DECODER_LOSS_PERCENT,source:"googDecodingCTN"},bytesReceived:{transform:this.bitsPerSecond,type:n.SdkMetric.Type.RTC_SPK_BITRATE},googCurrentDelayMs:{transform:this.identityValue,type:n.SdkMetric.Type.RTC_SPK_CURRENT_DELAY_MS},googJitterBufferMs:{transform:this.identityValue,type:n.SdkMetric.Type.RTC_SPK_JITTER_BUFFER_MS}},this.videoUpstreamMetricMap={googRtt:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_SENT_RTT_MS},googEncodeUsagePercent:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_ENCODE_USAGE_PERCENT},googNacksReceived:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_NACKS_RECEIVED},nackCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_NACKS_RECEIVED},googPlisReceived:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_PLIS_RECEIVED},pliCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_PLIS_RECEIVED},googFirsReceived:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_FIRS_RECEIVED},firCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_FIRS_RECEIVED},googAvgEncodeMs:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_AVERAGE_ENCODE_MS},googFrameRateInput:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_INPUT_FPS},framesEncoded:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_ENCODE_FPS},googFrameRateSent:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_SENT_FPS},framerateMean:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_SENT_FPS},packetsSent:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_SENT_PPS},packetsLost:{transform:this.packetLossPercent,type:n.SdkMetric.Type.VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"},bytesSent:{transform:this.bitsPerSecond,type:n.SdkMetric.Type.VIDEO_SENT_BITRATE},droppedFrames:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_DROPPED_FPS},qpSum:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_SENT_QP_SUM}},this.videoDownstreamMetricMap={googTargetDelayMs:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_TARGET_DELAY_MS},googDecodeMs:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_DECODE_MS},googFrameRateOutput:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_OUTPUT_FPS},packetsReceived:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_RECEIVED_PPS},packetsLost:{transform:this.packetLossPercent,type:n.SdkMetric.Type.VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},googRenderDelayMs:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_RENDER_DELAY_MS},googFrameRateReceived:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_RECEIVED_FPS},framerateMean:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_RECEIVED_FPS},framesDecoded:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_DECODE_FPS},googNacksSent:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_NACKS_SENT},nackCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_NACKS_SENT},googFirsSent:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_FIRS_SENT},firCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_FIRS_SENT},googPlisSent:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_PLIS_SENT},pliCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_PLIS_SENT},bytesReceived:{transform:this.bitsPerSecond,type:n.SdkMetric.Type.VIDEO_RECEIVED_BITRATE},googCurrentDelayMs:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_CURRENT_DELAY_MS},googJitterBufferMs:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_JITTER_BUFFER_MS},discardedPackets:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_DISCARDED_PPS},googJitterReceived:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_RECEIVED_JITTER_MS},jitter:{transform:this.secondsToMilliseconds,type:n.SdkMetric.Type.VIDEO_RECEIVED_JITTER_MS},qpSum:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_RECEIVED_QP_SUM}},this.observableMetricSpec={audioPacketsReceived:{source:"packetsReceived",media:a.default.AUDIO,dir:i.default.DOWNSTREAM},audioPacketsReceivedFractionLoss:{source:"packetsLost",media:a.default.AUDIO,dir:i.default.DOWNSTREAM},audioDecoderLoss:{source:"googDecodingNormal",media:a.default.AUDIO,dir:i.default.DOWNSTREAM},videoUpstreamBitrate:{source:"bytesSent",media:a.default.VIDEO,dir:i.default.UPSTREAM},videoPacketSentPerSecond:{source:"packetsSent",media:a.default.VIDEO,dir:i.default.UPSTREAM},availableSendBandwidth:{source:"googAvailableSendBandwidth"},availableReceiveBandwidth:{source:"googAvailableReceiveBandwidth"},audioSpeakerDelayMs:{source:"googCurrentDelayMs",media:a.default.AUDIO,dir:i.default.DOWNSTREAM},availableIncomingBitrate:{source:"availableIncomingBitrate"},availableOutgoingBitrate:{source:"availableOutgoingBitrate"},nackCountReceivedPerSecond:{source:"nackCount",media:a.default.VIDEO,dir:i.default.UPSTREAM},googNackCountReceivedPerSecond:{source:"googNacksReceived",media:a.default.VIDEO,dir:i.default.UPSTREAM}}}getMetricMap(e,t){switch(e){case a.default.AUDIO:switch(t){case i.default.UPSTREAM:return this.audioUpstreamMetricMap;case i.default.DOWNSTREAM:return this.audioDownstreamMetricMap}case a.default.VIDEO:switch(t){case i.default.UPSTREAM:return this.videoUpstreamMetricMap;case i.default.DOWNSTREAM:return this.videoDownstreamMetricMap}default:return this.globalMetricMap}}getObservableMetricValue(e){const t=this.observableMetricSpec[e],c=this.getMetricMap(t.media,t.dir)[t.source],n=c.transform,i=c.source;if(!t.hasOwnProperty("media"))return n(i||t.source);for(const e in this.streamMetricReports){const c=this.streamMetricReports[e];if(t.source in c.currentMetrics&&c.direction===t.dir&&c.mediaType===t.media)return n(i||t.source,Number(e))}return 0}getObservableMetrics(){const e={};for(const t in this.observableMetricSpec)e[t]=this.getObservableMetricValue(t);return e}clone(){const e=new o(this.logger);return e.globalMetricReport=this.globalMetricReport,e.streamMetricReports=this.streamMetricReports,e.currentTimestampMs=this.currentTimestampMs,e.previousTimestampMs=this.previousTimestampMs,e}print(){const e={globalMetricReport:this.globalMetricReport,streamMetricReports:this.streamMetricReports,currentTimestampMs:this.currentTimestampMs,previousTimestampMs:this.previousTimestampMs};this.logger.debug((()=>`Client Metric Report: ${JSON.stringify(e)}`))}removeDestroyedSsrcs(){for(const e in this.streamMetricReports)this.currentSsrcs[e]||delete this.streamMetricReports[e]}}t.default=o},2306:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.previousMetrics={},this.currentMetrics={}}}},2811:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.previousMetrics={},this.currentMetrics={}}}},3940:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t){this.minHealth=e.minHealth,this.maxHealth=e.maxHealth,this.currentHealth=e.initialHealth,this.currentData=t.clone()}minimumHealth(){return this.minHealth}maximumHealth(){return this.maxHealth}health(){return this.maximumHealth()}update(e){this.currentData=e}getConnectionHealthData(){return this.currentData.clone()}healthy(){return this.health()>this.minimumHealth()}healthIfChanged(){const e=this.health();return e!==this.currentHealth?(this.currentHealth=e,e):null}}},6688:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class c{constructor(){this.connectionStartTimestampMs=0,this.consecutiveStatsWithNoPackets=0,this.lastPacketLossInboundTimestampMs=0,this.lastGoodSignalTimestampMs=0,this.lastWeakSignalTimestampMs=0,this.lastNoSignalTimestampMs=0,this.consecutiveMissedPongs=0,this.packetsReceivedInLastMinute=[],this.fractionPacketsLostInboundInLastMinute=[],this.audioSpeakerDelayMs=0,this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}static isTimestampRecent(e,t){return Date.now(){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.minHealth=0,this.maxHealth=1,this.initialHealth=1,this.connectionUnhealthyThreshold=25,this.noSignalThresholdTimeMs=1e4,this.connectionWaitTimeMs=1e4,this.zeroBarsNoSignalTimeMs=5e3,this.oneBarWeakSignalTimeMs=5e3,this.twoBarsTimeMs=5e3,this.threeBarsTimeMs=1e4,this.fourBarsTimeMs=2e4,this.fiveBarsTimeMs=6e4,this.cooldownTimeMs=6e4,this.pastSamplesToConsider=15,this.goodSignalTimeMs=15e3,this.fractionalLoss=.5,this.packetsExpected=50,this.maximumTimesToWarn=2,this.missedPongsLowerThreshold=1,this.missedPongsUpperThreshold=4,this.maximumAudioDelayMs=6e4,this.maximumAudioDelayDataPoints=10}}},9708:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(3940);class i extends n.default{constructor(e,t,c){super(t,c),this.logger=e,this.audioDelayPointsOverMaximum=0,i.CONNECTION_UNHEALTHY_THRESHOLD=t.connectionUnhealthyThreshold,i.CONNECTION_WAIT_TIME_MS=t.connectionWaitTimeMs,i.MISSED_PONGS_THRESHOLD=t.missedPongsUpperThreshold,i.MAXIMUM_AUDIO_DELAY_MS=t.maximumAudioDelayMs,i.MAXIMUM_AUDIO_DELAY_DATA_POINTS=t.maximumAudioDelayDataPoints}health(){if(this.currentData.isConnectionStartRecent(i.CONNECTION_WAIT_TIME_MS))return 1;const e=this.currentData.consecutiveStatsWithNoPackets>=i.CONNECTION_UNHEALTHY_THRESHOLD,t=this.currentData.consecutiveMissedPongs>=i.MISSED_PONGS_THRESHOLD;this.currentData.audioSpeakerDelayMs>i.MAXIMUM_AUDIO_DELAY_MS?this.audioDelayPointsOverMaximum+=1:this.audioDelayPointsOverMaximum=0;const c=this.audioDelayPointsOverMaximum>i.MAXIMUM_AUDIO_DELAY_DATA_POINTS;return c&&(this.audioDelayPointsOverMaximum=0),e||t||c?(this.logger.warn(`reconnection recommended due to: no packets received: ${e}, missed pongs: ${t}, bad audio delay: ${c}`),0):1}}t.default=i},1922:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(3940);class i extends n.default{constructor(e,t){super(e,t),this.coolDownTimeMs=e.cooldownTimeMs,this.pastSamplesToConsider=e.pastSamplesToConsider,this.fractionalLoss=e.fractionalLoss,this.packetsExpected=e.packetsExpected,this.maximumTimesToWarn=e.maximumTimesToWarn,this.lastWarnTimestampMs=0,this.warnCount=0}calculateFractionalLoss(){if(this.currentData.packetsReceivedInLastMinute.length=this.fractionalLoss?0!==this.currentHealth&&(this.lastWarnTimestampMs=Date.now(),this.warnCount++,this.warnCount>this.maximumTimesToWarn)?1:0:1}}t.default=i},8581:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(7086);t.default=class{constructor(e,t,c,n,i,a){this.audioVideoController=e,this.realtimeController=t,this.videoTileController=c,this.connectionHealthData=n,this.pingPong=i,this.statsCollector=a,this.isActive=!1,this.hasSeenValidPacketMetricsBefore=!1,this.lastAvailableSendBandwidthKbps=0,this.lastAvailableRecvBandwidthKbps=0,this.realtimeController.realtimeSubscribeToLocalSignalStrengthChange((e=>{this.isActive&&this.receiveSignalStrengthChange(e)}))}start(){this.isActive=!0,this.pingPong.addObserver(this),this.pingPong.start(),this.audioVideoController.addObserver(this)}stop(){this.isActive=!1,this.pingPong.removeObserver(this),this.pingPong.stop(),this.audioVideoController.removeObserver(this)}receiveSignalStrengthChange(e){0===e?this.connectionHealthData.setLastNoSignalTimestampMs(Date.now()):e<=.5?this.connectionHealthData.setLastWeakSignalTimestampMs(Date.now()):this.connectionHealthData.setLastGoodSignalTimestampMs(Date.now()),this.updateConnectionHealth()}didReceivePong(e,t,c){this.connectionHealthData.setConsecutiveMissedPongs(0),this.statsCollector.logLatency("ping_pong",t),this.statsCollector.logLatency("ping_pong_clock_skew",c),this.updateConnectionHealth()}didMissPongs(){this.connectionHealthData.setConsecutiveMissedPongs(this.connectionHealthData.consecutiveMissedPongs+1),this.updateConnectionHealth()}metricsDidReceive(e){let t=0,c=0;const n=e.getObservableMetrics(),i=n.audioPacketsReceived,a=n.audioPacketsReceivedFractionLoss;let r=0;const o=n.videoPacketSentPerSecond,s=n.videoUpstreamBitrate,l=n.availableSendBandwidth||n.availableOutgoingBitrate,u=n.availableReceiveBandwidth||n.availableIncomingBitrate,f=n.audioSpeakerDelayMs,d=n.nackCountReceivedPerSecond||n.googNackCountReceivedPerSecond;"number"!=typeof l||isNaN(l)||this.updateAvailableSendBandwidth(l/1e3,d),"number"!=typeof u||isNaN(u)||this.updateAvailableReceiveBandwidth(u/1e3),"number"!=typeof s||isNaN(s)||(r=s/1e3),"number"!=typeof f||isNaN(f)||this.connectionHealthData.setAudioSpeakerDelayMs(f),this.monitorVideoUplinkHealth(r,o),"number"==typeof i&&"number"==typeof a&&(t=i,c=a,t<0||c<0||(this.addToMinuteWindow(this.connectionHealthData.packetsReceivedInLastMinute,t),this.addToMinuteWindow(this.connectionHealthData.fractionPacketsLostInboundInLastMinute,c),t>0?(this.hasSeenValidPacketMetricsBefore=!0,this.connectionHealthData.setConsecutiveStatsWithNoPackets(0)):this.hasSeenValidPacketMetricsBefore&&this.connectionHealthData.setConsecutiveStatsWithNoPackets(this.connectionHealthData.consecutiveStatsWithNoPackets+1),(0===t||c>0)&&this.connectionHealthData.setLastPacketLossInboundTimestampMs(Date.now()),this.updateConnectionHealth()))}addToMinuteWindow(e,t){e.unshift(t),e.length>60&&e.pop()}updateAvailableSendBandwidth(e,t){if(e!==this.lastAvailableSendBandwidthKbps){if(0===this.lastAvailableSendBandwidthKbps)return void(this.lastAvailableSendBandwidthKbps=e);const c=this.lastAvailableSendBandwidthKbps;this.lastAvailableSendBandwidthKbps=e,this.audioVideoController.forEachObserver((i=>{n.default.of(i.videoSendBandwidthDidChange).map((n=>n.bind(i)(e,c,t)))}))}}updateAvailableReceiveBandwidth(e){if(e!==this.lastAvailableRecvBandwidthKbps){if(0===this.lastAvailableRecvBandwidthKbps)return void(this.lastAvailableRecvBandwidthKbps=e);const t=this.lastAvailableRecvBandwidthKbps;this.lastAvailableRecvBandwidthKbps=e,this.audioVideoController.forEachObserver((c=>{n.default.of(c.videoReceiveBandwidthDidChange).map((n=>n.bind(c)(e,t)))}))}}updateConnectionHealth(){this.audioVideoController.forEachObserver((e=>{n.default.of(e.connectionHealthDidChange).map((t=>t.bind(e)(this.connectionHealthData.clone())))}))}monitorVideoUplinkHealth(e,t){this.videoTileController.hasStartedLocalVideoTile()&&this.audioVideoController.forEachObserver((c=>{n.default.of(c.videoSendHealthDidChange).map((n=>n.bind(c)(e,t)))}))}}},8890:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Modality="#content"}(c||(c={})),t.default=c},8370:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(543),a=c(4142);class r{constructor(e){this.logger=e}get mediaStream(){return this._mediaStream}set mediaStream(e){this._mediaStream=e}acquireAudioInputStream(){return n(this,void 0,void 0,(function*(){return 0===this._mediaStream.getAudioTracks().length?a.default.synthesizeAudioDevice(0):this._mediaStream}))}acquireVideoInputStream(){return n(this,void 0,void 0,(function*(){return this._mediaStream}))}releaseMediaStream(e){this.logger.warn("release media stream called")}acquireDisplayInputStream(e){return n(this,void 0,void 0,(function*(){return e&&e.video&&e.video.mandatory&&e.video.mandatory.chromeMediaSource&&e.video.mandatory.chromeMediaSourceId?navigator.mediaDevices.getUserMedia(e):navigator.mediaDevices.getDisplayMedia(e)}))}bindToAudioVideoController(e){throw new Error("unsupported")}acquireScreenCaptureDisplayInputStream(e,t){return n(this,void 0,void 0,(function*(){return this.acquireDisplayInputStream(this.screenCaptureDisplayMediaConstraints(e,t))}))}screenCaptureDisplayMediaConstraints(e,t){return{audio:!(e||!(new i.default).getDisplayMediaAudioCaptureSupport()),video:Object.assign(Object.assign({},!e&&{frameRate:{max:t||r.defaultFrameRate}}),e&&{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:t||r.defaultFrameRate}})}}toggleMediaStream(e){let t=!1;if(this.mediaStream)for(let c=0;c{this.stopContentShare()}));this.contentAudioVideo.start(),this.mediaStreamBroker.mediaStream.getVideoTracks().length>0&&this.contentAudioVideo.videoTileController.startLocalVideoTile()}}))}startContentShareFromScreenCapture(e,t){return n(this,void 0,void 0,(function*(){const c=yield this.mediaStreamBroker.acquireScreenCaptureDisplayInputStream(e,t);return yield this.startContentShare(c),c}))}pauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!1)&&this.forEachContentShareObserver((e=>{i.default.of(e.contentShareDidPause).map((t=>t.call(e)))}))}unpauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!0)&&this.forEachContentShareObserver((e=>{i.default.of(e.contentShareDidUnpause).map((t=>t.call(e)))}))}destroy(){return n(this,void 0,void 0,(function*(){this.contentAudioVideo&&(this.destroyed=!0,this.contentAudioVideo.removeObserver(this),this.stopContentShare(),this.observerQueue.clear(),this.contentAudioVideo=void 0,this.attendeeAudioVideo=void 0,this.mediaStreamBroker=void 0)}))}stopContentShare(){this.contentAudioVideo.stop(),this.mediaStreamBroker.cleanup()}addContentShareObserver(e){this.observerQueue.add(e)}removeContentShareObserver(e){this.observerQueue.delete(e)}forEachContentShareObserver(e){for(const t of this.observerQueue)s.default.nextTick((()=>{this.observerQueue.has(t)&&e(t)}))}audioVideoDidStop(e){this.mediaStreamBroker.cleanup(),this.contentShareTile&&(this.attendeeAudioVideo.videoTileController.removeVideoTile(this.contentShareTile.id()),this.contentShareTile=null),this.forEachContentShareObserver((e=>{i.default.of(e.contentShareDidStop).map((t=>t.call(e)))}))}setupContentShareEvents(){this.attendeeAudioVideo.realtimeController.realtimeSubscribeToAttendeeIdPresence(((e,t,c,n)=>{const a=new o.default(e).hasModality(o.default.MODALITY_CONTENT),r=new o.default(e).base()===this.attendeeAudioVideo.configuration.credentials.attendeeId;if(!a||!r||!t||this.contentShareTile)return;const s=this.mediaStreamBroker.mediaStream;if(s.getVideoTracks().length>0){this.contentShareTile=this.attendeeAudioVideo.videoTileController.addVideoTile();const e=s.getVideoTracks()[0];let t,c;if(e.getSettings){const n=e.getSettings();t=n.width,c=n.height}else{const n=e.getCapabilities();t=n.width,c=n.height}this.contentShareTile.bindVideoStream(this.contentAudioVideo.configuration.credentials.attendeeId,!1,s,t,c,null,this.contentAudioVideo.configuration.credentials.externalUserId)}this.forEachContentShareObserver((e=>{i.default.of(e.contentShareDidStart).map((t=>t.call(e)))}))}))}}},1018:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,c,n,i,a){this.timestampMs=e,this.topic=t,this.data=c,this.senderAttendeeId=n,this.senderExternalUserId=i,this.throttled=!!a}text(){return(new TextDecoder).decode(this.data)}json(){return JSON.parse((new TextDecoder).decode(this.data))}}},146:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDestroyable=void 0,t.isDestroyable=function(e){return e&&"destroy"in e}},1746:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAudioTransformDevice=void 0,t.isAudioTransformDevice=function(e){return!!e&&"object"==typeof e&&"mute"in e&&"stop"in e&&"intrinsicDevice"in e}},4142:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(543),a=c(7086),r=c(6354),o=c(7797),s=c(3922),l=c(3327),u=c(1746),f=c(8128),d=c(5348),h=c(1238),m=c(3110),p=c(4842),v=c(6991),g=c(6950),b=c(4500),z=c(7170);class C{constructor(e,t,c=new i.default){this.logger=e,this.browserBehavior=c,this.deviceInfoCache=null,this.activeDevices={audio:null,video:null},this.chosenVideoTransformDevice=null,this.audioOutputDeviceId=null,this.deviceChangeObservers=new Set,this.deviceLabelTrigger=()=>navigator.mediaDevices.getUserMedia({audio:!0,video:!0}),this.audioInputDestinationNode=null,this.audioInputSourceNode=null,this.videoInputQualitySettings=null,this.useWebAudio=!1,this.inputDeviceCount=0,this.alreadyHandlingDeviceChange=!1;const{enableWebAudio:n=!1}=t||{};this.useWebAudio=n,this.muteCallback=e=>{var t;null===(t=this.transform)||void 0===t||t.device.mute(e)},this.videoInputQualitySettings=new b.default(C.defaultVideoWidth,C.defaultVideoHeight,C.defaultVideoFrameRate,C.defaultVideoMaxBandwidthKbps);const a=this.browserBehavior.requiresResolutionAlignment(this.videoInputQualitySettings.videoWidth,this.videoInputQualitySettings.videoHeight);this.videoInputQualitySettings.videoWidth=a[0],this.videoInputQualitySettings.videoHeight=a[1],this.logger.info(`DefaultDeviceController video dimension ${this.videoInputQualitySettings.videoWidth} x ${this.videoInputQualitySettings.videoHeight}`);try{this.mediaDeviceWrapper=(new r.default).create();const e=navigator.mediaDevices.getSupportedConstraints();this.logger.info(`Supported Constraints in this browser ${JSON.stringify(e)}`)}catch(t){e.error(t.message)}}isWatchingForDeviceChanges(){return!!this.onDeviceChangeCallback}ensureWatchingDeviceChanges(){this.isWatchingForDeviceChanges()||(this.logger.info("Starting devicechange listener."),this.onDeviceChangeCallback=()=>this.handleDeviceChange(),this.mediaDeviceWrapper.addEventListener("devicechange",this.onDeviceChangeCallback))}stopWatchingDeviceChanges(){this.isWatchingForDeviceChanges()&&(this.logger.info("Stopping devicechange listener."),this.mediaDeviceWrapper.removeEventListener("devicechange",this.onDeviceChangeCallback),this.onDeviceChangeCallback=void 0)}shouldObserveDeviceChanges(){return!!this.deviceChangeObservers.size||this.activeDevices.audio&&null!==this.activeDevices.audio.constraints||this.activeDevices.video&&null!==this.activeDevices.video.constraints||!!this.audioOutputDeviceId}watchForDeviceChangesIfNecessary(){this.shouldObserveDeviceChanges()?this.ensureWatchingDeviceChanges():this.stopWatchingDeviceChanges()}destroy(){var e,t;return n(this,void 0,void 0,(function*(){this.stopWatchingDeviceChanges(),yield this.chooseAudioInputDevice(null),yield this.chooseVideoInputDevice(null),null===(e=this.audioInputSourceNode)||void 0===e||e.disconnect(),null===(t=this.audioInputDestinationNode)||void 0===t||t.disconnect(),this.audioInputSourceNode=void 0,this.audioInputDestinationNode=void 0}))}listAudioInputDevices(){return n(this,void 0,void 0,(function*(){const e=yield this.listDevicesOfKind("audioinput");return this.trace("listAudioInputDevices",null,e),e}))}listVideoInputDevices(){return n(this,void 0,void 0,(function*(){const e=yield this.listDevicesOfKind("videoinput");return this.trace("listVideoInputDevices",null,e),e}))}listAudioOutputDevices(){return n(this,void 0,void 0,(function*(){const e=yield this.listDevicesOfKind("audiooutput");return this.trace("listAudioOutputDevices",null,e),e}))}pushAudioMeetingStateForPermissions(e){var t,c;null===(c=null===(t=this.boundAudioVideoController)||void 0===t?void 0:t.eventController)||void 0===c||c.publishEvent(null===e?"audioInputUnselected":"audioInputSelected")}pushVideoMeetingStateForPermissions(e){var t,c;null===(c=null===(t=this.boundAudioVideoController)||void 0===t?void 0:t.eventController)||void 0===c||c.publishEvent(null===e?"videoInputUnselected":"videoInputSelected")}chooseAudioInputDevice(e){var t;return n(this,void 0,void 0,(function*(){if(void 0!==e){if(u.isAudioTransformDevice(e)){this.logger.info(`Choosing transform input device ${e}`);const c=this.browserBehavior.requiresContextRecreationForAudioWorklet();return c&&(this.logger.info("Recreating audio context when selecting transform device."),this.transform&&(this.transform.nodes&&(this.transform.nodes.end.disconnect(),this.transform.nodes=void 0),this.transform=void 0),this.audioInputSourceNode&&(this.audioInputSourceNode.disconnect(),this.audioInputSourceNode=void 0),this.audioInputDestinationNode&&(this.audioInputDestinationNode.disconnect(),this.audioInputDestinationNode=void 0),C.closeAudioContext()),yield this.chooseAudioTransformInputDevice(e),c&&(null===(t=this.boundAudioVideoController)||void 0===t?void 0:t.rtcPeerConnection)&&this.boundAudioVideoController.restartLocalAudio((()=>{this.logger.info("Local audio restarted.")})),this.pushAudioMeetingStateForPermissions(e)}this.removeTransform(),yield this.chooseInputIntrinsicDevice("audio",e,!1),this.trace("chooseAudioInputDevice",e,"success"),this.pushAudioMeetingStateForPermissions(e)}else this.logger.error("Audio input device cannot be undefined")}))}chooseAudioTransformInputDevice(e){var t;return n(this,void 0,void 0,(function*(){if((null===(t=this.transform)||void 0===t?void 0:t.device)===e)return;if(!this.useWebAudio)throw new Error("Cannot apply transform device without enabling Web Audio.");const c=C.getAudioContext();if(c instanceof OfflineAudioContext);else switch(c.state){case"running":break;case"closed":throw new Error("Cannot choose a transform device with a closed audio context.");case"suspended":yield c.resume()}let n;try{n=yield e.createAudioNode(c)}catch(e){throw this.logger.error(`Unable to create transform device node: ${e}.`),e}const i=yield e.intrinsicDevice();yield this.chooseInputIntrinsicDevice("audio",i,!1),this.logger.debug(`Got inner stream: ${i}.`),this.setTransform(e,n)}))}chooseVideoTransformInputDevice(e){var t,c;return n(this,void 0,void 0,(function*(){if(e===this.chosenVideoTransformDevice)return void this.logger.info("Reselecting same VideoTransformDevice");const n=this.chosenVideoTransformDevice;n&&this.logger.info("Switched from previous VideoTransformDevice");const i=!!n,a=yield e.intrinsicDevice();if(!this.isMediaStreamReusableByDeviceId(null===(t=this.activeDevices.video)||void 0===t?void 0:t.stream,a))return this.logger.info("video transform device needs new intrinsic device"),i&&n.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=e,this.activeDevices.video=null,void(yield this.chooseInputIntrinsicDevice("video",a,!1,!0));this.chosenVideoTransformDevice=e;const r=this.activeDevices.video.stream;if(this.logger.info("video transform device uses previous stream"),!a.id){const e=a;e.width=e.width||this.videoInputQualitySettings.videoWidth,e.height=e.height||this.videoInputQualitySettings.videoHeight,e.frameRate=e.frameRate||this.videoInputQualitySettings.videoFrameRate,yield r.getVideoTracks()[0].applyConstraints(e)}yield e.transformStream(this.activeDevices.video.stream),(null===(c=this.boundAudioVideoController)||void 0===c?void 0:c.videoTileController.hasStartedLocalVideoTile())&&(this.boundAudioVideoController.replaceLocalVideo?this.restartLocalVideoAfterSelection(null,!1,!0):yield this.boundAudioVideoController.update())}))}chooseVideoInputDevice(e){return n(this,void 0,void 0,(function*(){if(void 0!==e){if(z.isVideoTransformDevice(e))return this.logger.info(`Choosing video transform device ${e}`),this.chooseVideoTransformInputDevice(e);this.updateMaxBandwidthKbps(),this.chosenVideoInputIsTransformDevice()&&(this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null),yield this.chooseInputIntrinsicDevice("video",e,!1),this.trace("chooseVideoInputDevice",e),this.pushVideoMeetingStateForPermissions(e)}else this.logger.error("Video input device cannot be undefined")}))}chooseAudioOutputDevice(e){return n(this,void 0,void 0,(function*(){this.audioOutputDeviceId=e,this.watchForDeviceChangesIfNecessary(),yield this.bindAudioOutput(),this.trace("chooseAudioOutputDevice",e,null)}))}addDeviceChangeObserver(e){this.logger.info("adding device change observer"),this.deviceChangeObservers.add(e),this.watchForDeviceChangesIfNecessary(),this.trace("addDeviceChangeObserver")}removeDeviceChangeObserver(e){this.logger.info("removing device change observer"),this.deviceChangeObservers.delete(e),this.watchForDeviceChangesIfNecessary(),this.trace("removeDeviceChangeObserver")}createAnalyserNodeForAudioInput(){var e,t;if(!this.activeDevices.audio)return null;const c=null===(t=null===(e=this.transform)||void 0===e?void 0:e.nodes)||void 0===t?void 0:t.end;if(c){const e=c.context.createAnalyser();return e.removeOriginalInputs=()=>{try{c.disconnect(e)}catch(e){}},c.connect(e),e}return this.createAnalyserNodeForRawAudioInput()}createAnalyserNodeForRawAudioInput(){return this.activeDevices.audio?this.createAnalyserNodeForStream(this.activeDevices.audio.stream):null}createAnalyserNodeForStream(e){const t=C.getAudioContext(),c=t.createAnalyser(),n=t.createMediaStreamSource(e);return n.connect(c),this.trace("createAnalyserNodeForAudioInput"),c.removeOriginalInputs=()=>{try{n.disconnect(c)}catch(e){}},c}startVideoPreviewForVideoInput(e){if(!this.activeDevices.video)return this.logger.warn("cannot bind video preview since video input device has not been chosen"),void this.trace("startVideoPreviewForVideoInput",e.id);this.releaseMediaStream(e.srcObject),l.default.disconnectVideoStreamFromVideoElement(e,!1),navigator.mediaDevices.getUserMedia(this.activeDevices.video.constraints).then((t=>{l.default.connectVideoStreamToVideoElement(t,e,!0)})).catch((t=>{this.logger.warn(`Unable to reacquire video stream for preview to element ${e.id}: ${t}`)})),this.trace("startVideoPreviewForVideoInput",e.id)}stopVideoPreviewForVideoInput(e){const t=e.srcObject,c=this.activeDevices.video;c&&this.releaseActiveDevice(c),t&&(this.releaseMediaStream(t),l.default.disconnectVideoStreamFromVideoElement(e,!1)),this.trace("stopVideoPreviewForVideoInput",e.id)}setDeviceLabelTrigger(e){this.deviceLabelTrigger=e,this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(e){let t=null;return this.useWebAudio?(t=C.getAudioContext().createMediaStreamSource(e),t.connect(this.getMediaStreamOutputNode())):this.logger.warn("WebAudio is not enabled, mixIntoAudioInput will not work"),this.trace("mixIntoAudioInput",e.id),t}chooseVideoInputQuality(e,t,c,n){const i=this.browserBehavior.requiresResolutionAlignment(e,t);this.videoInputQualitySettings=new b.default(i[0],i[1],c,n),this.updateMaxBandwidthKbps()}getVideoInputQualitySettings(){return this.videoInputQualitySettings}acquireAudioInputStream(){return this.acquireInputStream("audio")}acquireVideoInputStream(){return this.acquireInputStream("video")}acquireDisplayInputStream(e){return n(this,void 0,void 0,(function*(){return e&&e.video&&e.video.mandatory&&e.video.mandatory.chromeMediaSource&&e.video.mandatory.chromeMediaSourceId?navigator.mediaDevices.getUserMedia(e):navigator.mediaDevices.getDisplayMedia(e)}))}releaseAudioTransformStream(){this.logger.info("Stopping audio track for Web Audio graph"),this.stopTracksAndRemoveCallback("audio"),this.logger.info("Removing audio transform, if there is one."),this.removeTransform(),this.audioInputSourceNode.disconnect(),this.audioInputSourceNode=void 0,this.audioInputDestinationNode.disconnect(),this.audioInputDestinationNode=void 0}releaseVideoTransformStream(){this.logger.info("Stopping video track for transform"),this.stopTracksAndRemoveCallback("video"),this.logger.info("Disconnecting video transform"),this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null}stopTracksAndRemoveCallback(e){const t=this.activeDevices[e],c=null==t?void 0:t.endedCallback;for(const n of t.stream.getTracks())n.stop(),c&&(n.removeEventListener("ended",c),delete t.endedCallback),delete this.activeDevices[e]}releaseOrdinaryStream(e){var t;const c=e.getTracks();if(c.length){for(const e of c)e.stop();for(const n in this.activeDevices){const i=this.activeDevices[n];(null==i?void 0:i.stream)===e&&(i.endedCallback&&(c[0].removeEventListener("ended",i.endedCallback),delete i.endedCallback),delete this.activeDevices[n],"video"===n&&(null===(t=this.boundAudioVideoController)||void 0===t?void 0:t.videoTileController.hasStartedLocalVideoTile())&&this.boundAudioVideoController.videoTileController.stopLocalVideoTile())}}}releaseMediaStream(e){var t,c;if(e)try{if(e===(null===(t=this.audioInputDestinationNode)||void 0===t?void 0:t.stream))return void this.releaseAudioTransformStream();if(e===(null===(c=this.chosenVideoTransformDevice)||void 0===c?void 0:c.outputMediaStream))return void this.releaseVideoTransformStream();this.releaseOrdinaryStream(e)}finally{this.watchForDeviceChangesIfNecessary()}}chosenVideoInputIsTransformDevice(){return!!this.chosenVideoTransformDevice}bindToAudioVideoController(e){this.boundAudioVideoController&&this.unsubscribeFromMuteAndUnmuteLocalAudio(),this.boundAudioVideoController=e,this.subscribeToMuteAndUnmuteLocalAudio(),this.browserBehavior.supportsSetSinkId()&&o.default.nextTick((()=>{this.bindAudioOutput()}))}subscribeToMuteAndUnmuteLocalAudio(){this.boundAudioVideoController&&this.boundAudioVideoController.realtimeController&&this.boundAudioVideoController.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(this.muteCallback)}unsubscribeFromMuteAndUnmuteLocalAudio(){this.boundAudioVideoController.realtimeController&&this.boundAudioVideoController.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(this.muteCallback)}static getIntrinsicDeviceId(e){if(void 0===e)return;if(null===e)return null;if("string"==typeof e)return e;if(e.id)return e.id;const t=e.deviceId;if(void 0===t)return;if(null===t)return null;if("string"==typeof t||Array.isArray(t))return t;const c=t;return"string"==typeof c.exact||Array.isArray(c.exact)?c.exact:void 0}static createEmptyAudioDevice(){return C.synthesizeAudioDevice(0)}static createEmptyVideoDevice(){return C.synthesizeVideoDevice("black")}static synthesizeAudioDevice(e){const t=C.getAudioContext(),c=t.createMediaStreamDestination();if(e){const n=t.createGain();n.gain.value=.1,n.connect(c);const i=t.createOscillator();i.frequency.value=e,i.connect(n),i.start()}else{const e=t.createBufferSource();try{e.buffer=t.createBuffer(1,5*t.sampleRate,t.sampleRate)}catch(c){if(!c||"NotSupportedError"!==c.name)throw c;e.buffer=t.createBuffer(1,5*C.defaultSampleRate,C.defaultSampleRate)}e.buffer.getChannelData(0)[0]=3e-4,e.loop=!0,e.connect(c),e.start()}return c.stream}static synthesizeVideoDevice(e){const t=document.createElement("canvas");t.width=480,t.height=t.width/16*9;const c=function(e,t){const c=new s.default(1e3),n=e.getContext("2d"),i=e.captureStream(5)||null;if(!i)return;c.start((()=>{"smpte"===t?function(e,t){const c=e.width,n=e.height,i=2*n/3,a=3*n/4,r=n,o=["#c0c0c0","#c0c000","#00c0c0","#00c000","#c000c0","#c00000","#0000c0"],s=["#0000c0","#000000","#c000c0","#000000","#00c0c0","#000000","#c0c0c0"],l=["#00214c","#ffffff","#32006a","#131313","#090909","#131313","#1d1d1d","#131313"],u=[0*c,1*c/4*(5/7),2*c/4*(5/7),3*c/4*(5/7),c*(5/7),c*(5/7+1/21),c*(5/7+2/21),c*(6/7),1*c],f=c/o.length,d=e.getContext("2d");for(let e=0;e{c.stop()};return i.getVideoTracks()[0].addEventListener("ended",a),{listener:a,scheduler:c,stream:i}}(t,e);if(!c)return null;const{stream:n}=c;return n}updateMaxBandwidthKbps(){this.boundAudioVideoController&&this.boundAudioVideoController.setVideoMaxBandwidthKbps(this.videoInputQualitySettings.videoMaxBandwidthKbps)}listDevicesOfKind(e){return n(this,void 0,void 0,(function*(){return null!==this.deviceInfoCache&&this.isWatchingForDeviceChanges()||(yield this.updateDeviceInfoCacheFromBrowser()),this.listCachedDevicesOfKind(e)}))}updateDeviceInfoCacheFromBrowser(){return n(this,void 0,void 0,(function*(){if("undefined"==typeof MediaDeviceInfo)return void(this.deviceInfoCache=[]);let e=yield navigator.mediaDevices.enumerateDevices(),t=!0;for(const c of e)if(!c.label){t=!1;break}if(!t)try{this.logger.info("attempting to trigger media device labels since they are hidden");const t=yield this.deviceLabelTrigger();e=yield navigator.mediaDevices.enumerateDevices();for(const e of t.getTracks())e.stop()}catch(e){this.logger.info("unable to get media device labels")}this.deviceInfoCache=e}))}listCachedDevicesOfKind(e){const t=[];for(const c of this.deviceInfoCache)c.kind===e&&t.push(c);return t}handleDeviceChange(){return n(this,void 0,void 0,(function*(){if(null===this.deviceInfoCache)return;if(this.alreadyHandlingDeviceChange)return void o.default.nextTick((()=>{this.handleDeviceChange()}));this.alreadyHandlingDeviceChange=!0;const e=this.listCachedDevicesOfKind("audioinput"),t=this.listCachedDevicesOfKind("videoinput"),c=this.listCachedDevicesOfKind("audiooutput");yield this.updateDeviceInfoCacheFromBrowser();const n=this.listCachedDevicesOfKind("audioinput"),i=this.listCachedDevicesOfKind("videoinput"),r=this.listCachedDevicesOfKind("audiooutput");this.forEachObserver((o=>{this.areDeviceListsEqual(e,n)||a.default.of(o.audioInputsChanged).map((e=>e.bind(o)(n))),this.areDeviceListsEqual(t,i)||a.default.of(o.videoInputsChanged).map((e=>e.bind(o)(i))),this.areDeviceListsEqual(c,r)||a.default.of(o.audioOutputsChanged).map((e=>e.bind(o)(r)))})),this.alreadyHandlingDeviceChange=!1}))}handleDeviceStreamEnded(e,t){return n(this,void 0,void 0,(function*(){try{yield this.chooseInputIntrinsicDevice(e,null,!1)}catch(e){this.logger.error("Failed to choose null device after stream ended.")}"audio"===e?this.forEachObserver((e=>{a.default.of(e.audioInputStreamEnded).map((c=>c.bind(e)(t)))})):this.forEachObserver((e=>{a.default.of(e.videoInputStreamEnded).map((c=>c.bind(e)(t)))}))}))}forEachObserver(e){for(const t of this.deviceChangeObservers)o.default.nextTick((()=>{this.deviceChangeObservers.has(t)&&e(t)}))}areDeviceListsEqual(e,t){return JSON.stringify(e.map((e=>JSON.stringify(e))).sort())===JSON.stringify(t.map((e=>JSON.stringify(e))).sort())}intrinsicDeviceAsMediaStream(e){return e&&e.id?e:null}hasSameGroupId(e,t,c){if(""===e)return!0;const n=C.getIntrinsicDeviceId(c);return"string"==typeof n&&e===this.getGroupIdFromDeviceId(t,n)}getGroupIdFromDeviceId(e,t){if(null!==this.deviceInfoCache){const c=this.listCachedDevicesOfKind(`${e}input`).find((e=>e.deviceId===t));if(c&&c.groupId)return c.groupId}return""}getActiveDeviceId(e){if(this.activeDevices[e]&&this.activeDevices[e].constraints){const t=(this.activeDevices[e].constraints.audio||this.activeDevices[e].constraints.video).deviceId;let c;return c="string"==typeof t?t:t.exact,c}return null}restartLocalVideoAfterSelection(e,t,c){return n(this,void 0,void 0,(function*(){!t&&this.boundAudioVideoController&&this.boundAudioVideoController.videoTileController.hasStartedLocalVideoTile()?c?(yield this.boundAudioVideoController.replaceLocalVideo(),this.logger.info("successfully replaced video track"),(null==e?void 0:e.stream.active)&&(this.logger.warn("previous media stream is not stopped during restart video"),this.releaseActiveDevice(e))):(this.logger.info("restarting local video to switch to new device"),this.boundAudioVideoController.restartLocalVideo((()=>{(null==e?void 0:e.stream.active)&&(this.logger.warn("previous media stream is not stopped during restart video"),this.releaseActiveDevice(e))}))):this.releaseActiveDevice(e)}))}handleGetUserMediaError(e,t){if(!e)throw new d.default(e);switch(e.name){case"NotReadableError":case"TrackStartError":throw new m.default(e);case"NotFoundError":case"DevicesNotFoundError":throw new h.default(e);case"NotAllowedError":case"PermissionDeniedError":case"SecurityError":throw t&&tn)return this.logger.warn(`ignored to get video device for constraints ${JSON.stringify(u)} as no device was requested`),void this.releaseMediaStream(h.stream);yield this.handleDeviceChange();const t=h.stream.getTracks()[0];h.endedCallback=()=>{this.activeDevices[e]&&this.activeDevices[e].stream===h.stream&&(this.logger.warn(`${e} input device which was active is no longer available, resetting to null device`),this.handleDeviceStreamEnded(e,this.getActiveDeviceId(e)),delete h.endedCallback)},t.addEventListener("ended",h.endedCallback,{once:!0})}h.groupId=(null===(a=this.getMediaTrackSettings(h.stream))||void 0===a?void 0:a.groupId)||""}catch(t){let n;if(n=(null==t?void 0:t.name)&&t.message?`${t.name}: ${t.message}`:(null==t?void 0:t.name)?t.name:(null==t?void 0:t.message)?t.message:"UnknownError","audio"===e?null===(o=null===(r=this.boundAudioVideoController)||void 0===r?void 0:r.eventController)||void 0===o||o.publishEvent("audioInputFailed",{audioInputErrorMessage:n}):null===(l=null===(s=this.boundAudioVideoController)||void 0===s?void 0:s.eventController)||void 0===l||l.publishEvent("videoInputFailed",{videoInputErrorMessage:n}),this.logger.error(`failed to get ${e} device for constraints ${JSON.stringify(u)}: ${n}`),t&&"constraint"in t&&this.logger.error(`Over-constrained by constraint: ${t.constraint}`),"audio"===e){this.logger.info(`choosing null ${e} device instead`);try{h.stream=C.createEmptyAudioDevice(),h.constraints=null,yield this.handleNewInputDevice(e,h,c)}catch(t){this.logger.error(`failed to choose null ${e} device. ${t.name}: ${t.message}`)}}this.handleGetUserMediaError(t,Date.now()-d)}finally{this.watchForDeviceChangesIfNecessary()}this.logger.info(`got ${e} device for constraints ${JSON.stringify(u)}`),yield this.handleNewInputDevice(e,h,c,i)}))}handleNewInputDevice(e,t,c,i=!1){return n(this,void 0,void 0,(function*(){const n=this.activeDevices[e];if(this.activeDevices[e]=t,this.watchForDeviceChangesIfNecessary(),"video"===e)this.chosenVideoInputIsTransformDevice()&&(this.logger.info("apply processors to transform"),yield this.chosenVideoTransformDevice.transformStream(this.activeDevices.video.stream)),yield this.restartLocalVideoAfterSelection(n,c,i);else if(this.releaseActiveDevice(n),this.useWebAudio)this.attachAudioInputStreamToAudioContext(this.activeDevices[e].stream);else if(this.boundAudioVideoController)try{yield this.boundAudioVideoController.restartLocalAudio((()=>{}))}catch(e){this.logger.info(`cannot replace audio track due to: ${e.message}`)}else this.logger.info("no audio-video controller is bound to the device controller")}))}bindAudioOutput(){return n(this,void 0,void 0,(function*(){if(!this.boundAudioVideoController)return;const e=this.deviceInfoFromDeviceId("audiooutput",this.audioOutputDeviceId);yield this.boundAudioVideoController.audioMixController.bindAudioDevice(e)}))}calculateMediaStreamConstraints(e,t){let c={};""===t&&(t=null);const n=this.intrinsicDeviceAsMediaStream(t);return null===t?null:("string"==typeof t?this.browserBehavior.requiresNoExactMediaStreamConstraints()&&this.browserBehavior.requiresGroupIdMediaStreamConstraints()?(c.deviceId=t,c.groupId=this.getGroupIdFromDeviceId(e,t)):this.browserBehavior.requiresNoExactMediaStreamConstraints()?c.deviceId=t:c.deviceId={exact:t}:n?c.streamId=n.id:function(e){return"object"==typeof e&&"deviceId"in e&&"groupId"in e&&"kind"in e&&"label"in e}(t)?(c.deviceId=t.deviceId,c.groupId=t.groupId):c=t,"video"===e&&(c.width=c.width||{ideal:this.videoInputQualitySettings.videoWidth},c.height=c.height||{ideal:this.videoInputQualitySettings.videoHeight},c.frameRate=c.frameRate||{ideal:this.videoInputQualitySettings.videoFrameRate},c.googCpuOveruseDetection=!0,c.googCpuOveruseEncodeUsage=!0,c.googCpuOveruseThreshold=85,c.googCpuUnderuseThreshold=55),"audio"===e&&this.supportSampleRateConstraint()&&(c.sampleRate={ideal:C.defaultSampleRate}),"audio"===e&&this.supportSampleSizeConstraint()&&(c.sampleSize={ideal:C.defaultSampleSize}),"audio"===e&&this.supportChannelCountConstraint()&&(c.channelCount={ideal:C.defaultChannelCount}),"audio"===e&&(c=Object.assign({echoCancellation:!0,googEchoCancellation:!0,googEchoCancellation2:!0,googAutoGainControl:!0,googAutoGainControl2:!0,googNoiseSuppression:!0,googNoiseSuppression2:!0,googHighpassFilter:!0},c)),"audio"===e?{audio:c}:{video:c})}deviceInfoFromDeviceId(e,t){if(null===this.deviceInfoCache)return null;for(const c of this.deviceInfoCache)if(c.kind===e&&c.deviceId===t)return c;return null}acquireInputStream(e){return n(this,void 0,void 0,(function*(){if("audio"===e&&this.useWebAudio)return this.getMediaStreamDestinationNode().stream;if("video"===e&&this.chosenVideoInputIsTransformDevice())return this.chosenVideoTransformDevice.outputMediaStream;let t=null;if(this.activeDevices[e]){this.logger.info(`checking whether existing ${e} device can be reused`);const c=this.activeDevices[e];t=c.constraints?c.constraints[e]:null}else{if("audio"!==e)throw this.logger.error(`no ${e} device chosen, stopping local video tile`),this.boundAudioVideoController.videoTileController.stopLocalVideoTile(),new Error(`no ${e} device chosen, stopping local video tile`);this.logger.info(`no ${e} device chosen, creating empty ${e} device`)}try{yield this.chooseInputIntrinsicDevice(e,t,!0)}catch(t){if(this.logger.error(`unable to acquire ${e} device`),t instanceof v.default)throw t;throw new d.default(t,`unable to acquire ${e} device`)}return this.activeDevices[e].stream}))}hasAppliedTransform(){return!!this.transform}isMediaStreamReusableByDeviceId(e,t){if(!e||!e.active||!t)return!1;if(t.id)return e.id===t.id;const c=this.getMediaTrackSettings(e);if(!c.deviceId)return!1;const n=C.getIntrinsicDeviceId(t);return"string"==typeof n&&c.deviceId===n}getMediaTrackSettings(e){var t;return null===(t=e.getTracks()[0])||void 0===t?void 0:t.getSettings()}reconnectAudioInputs(){if(!this.audioInputSourceNode)return;this.audioInputSourceNode.disconnect();const e=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(e)}setTransform(e,t){var c,n;null===(n=null===(c=this.transform)||void 0===c?void 0:c.nodes)||void 0===n||n.end.disconnect(),this.transform={nodes:t,device:e};const i=null==t?void 0:t.end,a=this.getMediaStreamDestinationNode();this.logger.debug(`Connecting transform node ${i} to destination ${a}.`),null==i||i.connect(a),this.reconnectAudioInputs()}removeTransform(){var e;const t=this.transform;if(t)return null===(e=this.transform.nodes)||void 0===e||e.end.disconnect(),this.transform=void 0,this.reconnectAudioInputs(),t}attachAudioInputStreamToAudioContext(e){var t;null===(t=this.audioInputSourceNode)||void 0===t||t.disconnect(),this.audioInputSourceNode=C.getAudioContext().createMediaStreamSource(e);const c=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(c)}getMediaStreamDestinationNode(){return this.audioInputDestinationNode||(this.audioInputDestinationNode=C.getAudioContext().createMediaStreamDestination()),this.audioInputDestinationNode}getMediaStreamOutputNode(){var e,t;return(null===(t=null===(e=this.transform)||void 0===e?void 0:e.nodes)||void 0===t?void 0:t.start)||this.getMediaStreamDestinationNode()}static getAudioContext(){if(!C.audioContext){const e={};navigator.mediaDevices.getSupportedConstraints().sampleRate&&(e.sampleRate=C.defaultSampleRate),C.audioContext=new(window.AudioContext||window.webkitAudioContext)(e)}return C.audioContext}static closeAudioContext(){if(C.audioContext)try{C.audioContext.close()}catch(e){}C.audioContext=null}supportSampleRateConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleRate}supportSampleSizeConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().sampleSize}supportChannelCountConstraint(){return this.useWebAudio&&!!navigator.mediaDevices.getSupportedConstraints().channelCount}trace(e,t,c){let n=`API/DefaultDeviceController/${e}`;void 0!==t&&(n+=` ${JSON.stringify(t)}`),void 0!==c&&(n+=` -> ${JSON.stringify(c)}`),this.logger.info(n)}}t.default=C,C.permissionDeniedOriginDetectionThresholdMs=500,C.defaultVideoWidth=960,C.defaultVideoHeight=540,C.defaultVideoFrameRate=15,C.defaultVideoMaxBandwidthKbps=1400,C.defaultSampleRate=48e3,C.defaultSampleSize=16,C.defaultChannelCount=1,C.audioContext=null},8128:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.groupId=""}matchesConstraints(e){return JSON.stringify(this.constraints)===JSON.stringify(e)}}},5348:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class c extends Error{constructor(e,t){super(t||"Error fetching device."),this.cause=e}}t.default=c},6154:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DestroyableNoOpDeviceController=void 0;const i=c(4015);class a extends i.default{constructor(e){super()}listAudioInputDevices(){return Promise.resolve([])}listVideoInputDevices(){return Promise.resolve([])}listAudioOutputDevices(){return Promise.resolve([])}chooseAudioInputDevice(e){return Promise.reject()}chooseVideoInputDevice(e){return Promise.reject()}chooseAudioOutputDevice(e){return Promise.reject()}addDeviceChangeObserver(e){}removeDeviceChangeObserver(e){}createAnalyserNodeForAudioInput(){return null}startVideoPreviewForVideoInput(e){}stopVideoPreviewForVideoInput(e){}setDeviceLabelTrigger(e){}mixIntoAudioInput(e){return null}chooseVideoInputQuality(e,t,c,n){}getVideoInputQualitySettings(){return null}}t.default=a,t.DestroyableNoOpDeviceController=class extends a{constructor(){super(...arguments),this.destroyed=!1}destroy(){return n(this,void 0,void 0,(function*(){this.destroyed=!0}))}}},1238:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(5348);class i extends n.default{constructor(e){super(e)}}t.default=i},3110:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(5348);class i extends n.default{constructor(e){super(e)}}t.default=i},4842:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(5348);class i extends n.default{constructor(e,t){super(e),this.constraint=t}}t.default=i},6991:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(5348);class i extends n.default{constructor(e,t){super(e,t)}}t.default=i},7786:function(e,t){"use strict";var c=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.inner=e}mute(e){return c(this,void 0,void 0,(function*(){}))}stop(){var e;return c(this,void 0,void 0,(function*(){null===(e=this.node)||void 0===e||e.disconnect()}))}intrinsicDevice(){return c(this,void 0,void 0,(function*(){return this.inner}))}createAudioNode(e){var t;return c(this,void 0,void 0,(function*(){return null===(t=this.node)||void 0===t||t.disconnect(),this.node=yield this.createSingleAudioNode(e),{start:this.node,end:this.node}}))}}},6950:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(5348);class i extends n.default{constructor(e){super(e)}}t.default=i},4500:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,c,n){this.videoWidth=e,this.videoHeight=t,this.videoFrameRate=c,this.videoMaxBandwidthKbps=n}}},7170:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isVideoTransformDevice=void 0,t.isVideoTransformDevice=function(e){return!!e&&"object"==typeof e&&"transformStream"in e&&"stop"in e&&"intrinsicDevice"in e}},8236:function(e,t){"use strict";var c=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t){if(this.devicePixelRatioSource=e,this.observerQueue=new Set,this.mediaQueryListener=()=>{this.observerQueue.forEach((e=>{e.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())}))},"undefined"==typeof window)return;const c=matchMedia(`(resolution: ${this.devicePixelRatioSource.devicePixelRatio()}dppx)`);"function"==typeof c.addEventListener?(c.addEventListener("change",this.mediaQueryListener),this.mediaQueryList=c):"function"==typeof c.addListener?(c.addListener(this.mediaQueryListener),this.mediaQueryList=c):t.warn("ignoring DefaultDevicePixelRatioMonitor")}destroy(){return c(this,void 0,void 0,(function*(){this.mediaQueryList&&("function"==typeof this.mediaQueryList.addEventListener?this.mediaQueryList.removeEventListener("change",this.mediaQueryListener):this.mediaQueryList.removeListener(this.mediaQueryListener)),delete this.mediaQueryListener,this.observerQueue.clear()}))}registerObserver(e){this.observerQueue.add(e),e.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())}removeObserver(e){this.observerQueue.delete(e)}}},9190:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{devicePixelRatio(){return"undefined"!=typeof window&&window&&window.devicePixelRatio?window.devicePixelRatio:1}}},3831:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(2238),a=c(4046);class r{constructor(e){var t,c,n,a,o,s,l;this.audioVideoController=e,this.meetingHistoryStates=[];try{this.parserResult=navigator&&navigator.userAgent?new i.UAParser(navigator.userAgent).getResult():null}catch(t){e.logger.error(t.message)}this.browserMajorVersion=(null===(n=null===(c=null===(t=this.parserResult)||void 0===t?void 0:t.browser)||void 0===c?void 0:c.version)||void 0===n?void 0:n.split(".")[0])||r.UNAVAILABLE,this.browserName=(null===(a=this.parserResult)||void 0===a?void 0:a.browser.name)||r.UNAVAILABLE,this.browserVersion=(null===(o=this.parserResult)||void 0===o?void 0:o.browser.version)||r.UNAVAILABLE,this.deviceName=[(null===(s=this.parserResult)||void 0===s?void 0:s.device.vendor)||"",(null===(l=this.parserResult)||void 0===l?void 0:l.device.model)||""].join(" ").trim()||r.UNAVAILABLE}publishEvent(e,t){return n(this,void 0,void 0,(function*(){const c=Date.now();yield this.pushMeetingState(e,c);const n=Object.freeze(Object.assign(this.getAttributes(c),t));this.audioVideoController.forEachObserver((t=>{t.eventDidReceive&&t.eventDidReceive(e,n)}))}))}pushMeetingState(e,t=Date.now()){return n(this,void 0,void 0,(function*(){this.meetingHistoryStates.push({name:e,timestampMs:t})}))}getAttributes(e){var t,c;return{attendeeId:this.audioVideoController.configuration.credentials.attendeeId,browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,externalMeetingId:"string"==typeof this.audioVideoController.configuration.externalMeetingId?this.audioVideoController.configuration.externalMeetingId:"",externalUserId:this.audioVideoController.configuration.credentials.externalUserId,meetingHistory:this.meetingHistoryStates,meetingId:this.audioVideoController.configuration.meetingId,osName:(null===(t=this.parserResult)||void 0===t?void 0:t.os.name)||r.UNAVAILABLE,osVersion:(null===(c=this.parserResult)||void 0===c?void 0:c.os.version)||r.UNAVAILABLE,sdkVersion:a.default.sdkVersion,sdkName:a.default.sdkName,timestampMs:e}}}t.default=r,r.UNAVAILABLE="Unavailable"},3204:(e,t,c)=>{"use strict";t.mz=void 0,c(5185).default,c(7797).default,c(8358).default,c(7602).default,c(9880).default,c(3765).default,c(1876).default,c(3940).default,c(1789).default,c(9394).default,c(9807).default,c(2084).default,c(8892).default,c(9333).default,c(1087).default,c(2606).default,c(7415).default,c(4299).default,c(6818).default,c(1737).default,c(3216).default,c(7408).default,c(6196).default,c(9496).default,c(2770).default,c(6688).default,c(3731).default,c(8030).default,c(8890).default,c(8370).default,c(5054).default,c(1129).default,c(1018).default,c(8320).default,c(2363).default,c(6802).default,c(9059).default,c(8538).default,c(543).default,c(6893).default,c(8023).default,c(4142).default,c(8236).default,c(3831).default,c(6354).default,c(3980).default,c(4202).default,c(8947).default,c(214).default,c(7500).default,c(983).default,c(9141).default,c(7293).default,c(9678).default,c(334).default,c(1208).default,c(4450).default,c(9636).default,c(365).default,c(1133).default,c(8919).default,c(1508).default,c(1318).default,c(3327).default,c(2958).default,c(4922).default,c(7673).default,c(9751).default,c(7631).default,c(9190).default,c(8128).default,c(6240).default,c(8434).default,c(5640).default,c(7300).default,c(5348).default,c(2306).default,c(3922).default,c(1960).default,c(6180).default,c(2748).default,c(293).default,c(813).default,c(7086).default,c(4236).default,c(3990).default,c(589).default,c(8015).default,c(7604).default,c(1296).default,c(6326).default,c(3789).default,c(5687).default,c(7215).default,c(6057).default,c(5723).default,c(9358).default,c(4323).default,c(1981).default,c(9938).default,c(4442).default,c(9836).default,c(209).default,c(6154).default,c(7434).default,c(4015).default,c(8831).default,c(3663).default,c(2801).default,c(5319).default,c(657).default,c(8021).default,c(1238).default,c(3110).default,c(4543).default,c(4842).default,c(8556).default,c(6991).default,c(5910).default,c(9825).default,c(9576).default,c(1209).default,c(5547).default,c(120).default,c(9560).default,c(9708).default,c(4191).default,c(4076).default,c(9485).default,c(7079).default,c(3860).default,c(6850).default,c(9553).default,c(3013).default,c(4833).default,c(5275).default,c(8581).default,c(3920).default,c(2902).default,c(9416).default,c(2168).default,c(6729).default,c(7606).default,c(5785).default,c(4242).default,c(7786).default,c(9532).default,c(2811).default,c(5924).default,c(4456).default,c(4929).default,c(250).default,c(6950).default,c(1922).default,c(4046).default,c(2880).default,c(155).default,c(4500).default,c(60).default,c(6876).default,c(7804).default;const n=c(2497);t.mz=n.default,c(8878).default,c(6171).default,c(7387).default,c(1746),c(146),c(7170)},8030:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(813);t.default=class{constructor(e,t=n.default.WARN){this.name=e,this.level=t}info(e){this.log(n.default.INFO,e)}warn(e){this.log(n.default.WARN,e)}error(e){this.log(n.default.ERROR,e)}debug(e){n.default.DEBUG{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,c,n){this.sequenceNumber=e,this.message=t,this.timestampMs=c,this.logLevel=n}}},813:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.LogLevel=void 0,function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.OFF=4]="OFF"}(c=t.LogLevel||(t.LogLevel={})),t.default=c},6326:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(813),a=c(3922),r=c(293);t.default=class{constructor(e,t,c,n,a,r=i.default.WARN){this.name=e,this.configuration=t,this.batchSize=c,this.intervalMs=n,this.url=a,this.level=r,this.logCapture=[],this.sequenceNumber=0,this.lock=!1,this.startLogPublishScheduler(this.batchSize),this.eventListener=()=>{this.stop()},this.addEventListener()}addEventListener(){this.eventListener&&"window"in c.g&&window.addEventListener&&window.addEventListener("unload",this.eventListener)}removeEventListener(){this.eventListener&&"window"in c.g&&window.removeEventListener&&window.removeEventListener("unload",this.eventListener)}debug(e){i.default.DEBUGn(this,void 0,void 0,(function*(){if(!0===this.lock||0===this.getLogCaptureSize())return;this.lock=!0;const t=this.logCapture.slice(0,e),c=this.makeRequestBody(t);try{200===(yield fetch(this.url,{method:"POST",body:c})).status&&(this.logCapture=this.logCapture.slice(t.length))}catch(e){console.warn("[MeetingSessionPOSTLogger] "+e.message)}finally{this.lock=!1}}))))}stop(){var e;null===(e=this.intervalScheduler)||void 0===e||e.stop(),this.intervalScheduler=void 0,this.removeEventListener();const t=this.makeRequestBody(this.logCapture);navigator.sendBeacon(this.url,t)}destroy(){var e;return n(this,void 0,void 0,(function*(){null===(e=this.intervalScheduler)||void 0===e||e.stop(),this.intervalScheduler=void 0,this.removeEventListener(),this.configuration=void 0,this.logCapture=[]}))}makeRequestBody(e){return JSON.stringify({meetingId:this.configuration.meetingId,attendeeId:this.configuration.credentials.attendeeId,appName:this.name,logs:e})}log(e,t){if(e{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(813);t.default=class{constructor(...e){this._loggers=e}info(e){for(const t of this._loggers)t.info(e)}warn(e){for(const t of this._loggers)t.warn(e)}error(e){for(const t of this._loggers)t.error(e)}debug(e){let t,c;c="string"==typeof e?e:e?()=>(t||(t=e()),t):""+e;for(const e of this._loggers)e.debug(c)}setLogLevel(e){for(const t of this._loggers)t.setLogLevel(e)}getLogLevel(){for(const e of this._loggers)return e.getLogLevel();return n.default.OFF}}},209:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(813),i=c(7434);class a extends i.default{constructor(){super(n.default.DEBUG)}}t.default=a},7434:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(813);t.default=class{constructor(e=n.default.OFF){this.level=e}info(e){}warn(e){}error(e){}debug(e){n.default.DEBUG{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(8021),i=c(9532);t.default=class{static of(e){return null==e?n.default.of():i.default.of(e)}}},8021:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(7086);class i{constructor(){this.isSome=!1,this.isNone=!0}get(){throw new Error("value is null")}getOrElse(e){return e}map(e){return new i}flatMap(e){return new i}defaulting(e){return n.default.of(this.getOrElse(e))}static of(){return new i}}t.default=i},9532:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(7086);class i{constructor(e){this.value=e,this.isSome=!0,this.isNone=!1}map(e){return n.default.of(e(this.value))}flatMap(e){return e(this.value)}get(){return this.value}getOrElse(e){return this.value}defaulting(e){return n.default.of(this.getOrElse(e))}static of(e){if(null==e)throw new Error("value is ${value}");return new i(e)}}t.default=i},6354:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(4236);t.default=class{constructor(){this.isMediaDevicesSupported="undefined"!=typeof navigator&&!!navigator.mediaDevices}create(){if(this.isMediaDevicesSupported)return new Proxy(navigator.mediaDevices,new n.default);throw new Error("navigator.mediaDevices is not supported")}}},4236:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(7797),a=c(3922);class r{constructor(){this.scheduler=null,this.devices=null,this.deviceChangeListeners=new Set,this.get=(e,t,c)=>{if(!Reflect.has(e,t))return;if(!("ondevicechange"in navigator.mediaDevices)){if("addEventListener"===t)return this.patchAddEventListener(e,t,c);if("removeEventListener"===t)return this.patchRemoveEventListener(e,t,c)}const n=Reflect.get(e,t,c);return"function"==typeof n?n.bind(e):n},this.patchAddEventListener=(e,t,c)=>{const n=Reflect.get(e,t,c);return(t,c,i)=>{if("devicechange"!==t)return Reflect.apply(n,e,[t,c,i]);this.deviceChangeListeners.add(c),this.scheduler||(this.scheduler=new a.default(r.INTERVAL_MS),this.scheduler.start(this.pollDeviceLists))}},this.patchRemoveEventListener=(e,t,c)=>{const n=Reflect.get(e,t,c);return(t,c,i)=>{if("devicechange"!==t)return Reflect.apply(n,e,[t,c,i]);this.deviceChangeListeners.delete(c),0===this.deviceChangeListeners.size&&this.scheduler&&(this.scheduler.stop(),this.scheduler=null)}},this.pollDeviceLists=()=>n(this,void 0,void 0,(function*(){const e=yield this.sortedDeviceList();this.devices&&(e.length!==this.devices.length||e.some(((e,t)=>e.deviceId!==this.devices[t].deviceId)))&&this.handleDeviceChangeEvent(),this.devices=e}))}sortedDeviceList(){return n(this,void 0,void 0,(function*(){return(yield navigator.mediaDevices.enumerateDevices()).sort(((e,t)=>e.deviceIdt.deviceId?-1:0))}))}handleDeviceChangeEvent(){for(const e of this.deviceChangeListeners)i.default.nextTick((()=>{if(this.deviceChangeListeners.has(e)){const t=new Event("devicechange");"function"==typeof e?e(t):e.handleEvent(t)}}))}}t.default=r,r.INTERVAL_MS=1e3},4015:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{acquireAudioInputStream(){return Promise.reject()}acquireVideoInputStream(){return Promise.reject()}acquireDisplayInputStream(e){return Promise.reject()}releaseMediaStream(e){}bindToAudioVideoController(e){}}},2084:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.CheckAudioConnectivityFeedback=void 0,function(e){e[e.Succeeded=0]="Succeeded",e[e.AudioInputRequestFailed=1]="AudioInputRequestFailed",e[e.AudioInputPermissionDenied=2]="AudioInputPermissionDenied",e[e.ConnectionFailed=3]="ConnectionFailed",e[e.AudioNotReceived=4]="AudioNotReceived"}(c=t.CheckAudioConnectivityFeedback||(t.CheckAudioConnectivityFeedback={})),t.default=c},8892:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.CheckAudioInputFeedback=void 0,function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed",e[e.PermissionDenied=2]="PermissionDenied"}(c=t.CheckAudioInputFeedback||(t.CheckAudioInputFeedback={})),t.default=c},9333:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.CheckAudioOutputFeedback=void 0,function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed"}(c=t.CheckAudioOutputFeedback||(t.CheckAudioOutputFeedback={})),t.default=c},1087:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.CheckCameraResolutionFeedback=void 0,function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed",e[e.ResolutionNotSupported=2]="ResolutionNotSupported",e[e.PermissionDenied=3]="PermissionDenied"}(c=t.CheckCameraResolutionFeedback||(t.CheckCameraResolutionFeedback={})),t.default=c},2606:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.CheckContentShareConnectivityFeedback=void 0,function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed",e[e.PermissionDenied=2]="PermissionDenied",e[e.TimedOut=3]="TimedOut",e[e.ConnectionFailed=4]="ConnectionFailed"}(c=t.CheckContentShareConnectivityFeedback||(t.CheckContentShareConnectivityFeedback={})),t.default=c},7415:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.CheckNetworkTCPConnectivityFeedback=void 0,function(e){e[e.Succeeded=0]="Succeeded",e[e.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",e[e.ConnectionFailed=2]="ConnectionFailed",e[e.ICENegotiationFailed=3]="ICENegotiationFailed"}(c=t.CheckNetworkTCPConnectivityFeedback||(t.CheckNetworkTCPConnectivityFeedback={})),t.default=c},4299:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.CheckNetworkUDPConnectivityFeedback=void 0,function(e){e[e.Succeeded=0]="Succeeded",e[e.MeetingSessionURLsNotInitialized=1]="MeetingSessionURLsNotInitialized",e[e.ConnectionFailed=2]="ConnectionFailed",e[e.ICENegotiationFailed=3]="ICENegotiationFailed"}(c=t.CheckNetworkUDPConnectivityFeedback||(t.CheckNetworkUDPConnectivityFeedback={})),t.default=c},6818:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.CheckVideoConnectivityFeedback=void 0,function(e){e[e.Succeeded=0]="Succeeded",e[e.VideoInputRequestFailed=1]="VideoInputRequestFailed",e[e.VideoInputPermissionDenied=2]="VideoInputPermissionDenied",e[e.ConnectionFailed=3]="ConnectionFailed",e[e.VideoNotSent=4]="VideoNotSent"}(c=t.CheckVideoConnectivityFeedback||(t.CheckVideoConnectivityFeedback={})),t.default=c},1737:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.CheckVideoInputFeedback=void 0,function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed",e[e.PermissionDenied=2]="PermissionDenied"}(c=t.CheckVideoInputFeedback||(t.CheckVideoInputFeedback={})),t.default=c},3980:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(6802),a=c(543),r=c(4142),o=c(6991),s=c(1789),l=c(250),u=c(2084),f=c(8892),d=c(9333),h=c(1087),m=c(2606),p=c(7415),v=c(4299),g=c(6818),b=c(1737),z=c(3990);class C{constructor(e,t,c=new z.default){this.logger=e,this.meetingSession=t,this.configuration=c,this.browserBehavior=new a.default}static delay(e){return n(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))}))}checkAudioInput(e){return n(this,void 0,void 0,(function*(){try{return yield this.meetingSession.audioVideo.chooseAudioInputDevice(e),yield this.meetingSession.audioVideo.chooseAudioInputDevice(null),f.default.Succeeded}catch(e){return this.logger.error(`MeetingReadinessChecker: Audio input check failed with error ${e}`),e instanceof o.default?f.default.PermissionDenied:f.default.Failed}}))}checkAudioOutput(e,t,c=null){return n(this,void 0,void 0,(function*(){try{const n=e?r.default.getIntrinsicDeviceId(e):"";return yield this.playTone(n,440,c),(yield t())?d.default.Succeeded:d.default.Failed}catch(e){return this.logger.error(`MeetingReadinessChecker: Audio output check failed with error: ${e}`),d.default.Failed}finally{this.stopTone()}}))}playTone(e,t,c){return n(this,void 0,void 0,(function*(){this.oscillatorNode&&this.stopTone(),this.audioContext=r.default.getAudioContext(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=0,this.oscillatorNode=this.audioContext.createOscillator(),this.oscillatorNode.frequency.value=t,this.oscillatorNode.connect(this.gainNode),this.destinationStream=this.audioContext.createMediaStreamDestination(),this.gainNode.connect(this.destinationStream);const n=this.audioContext.currentTime+.1;this.gainNode.gain.linearRampToValueAtTime(0,n),this.gainNode.gain.linearRampToValueAtTime(.1,n+.1),this.oscillatorNode.start();const a=new i.default(this.logger);try{this.browserBehavior.supportsSetSinkId()&&(yield a.bindAudioDevice({deviceId:e}))}catch(e){this.logger.error(`Failed to bind audio device: ${e}`)}try{yield a.bindAudioElement(c||new Audio)}catch(e){this.logger.error(`Failed to bind audio element: ${e}`)}yield a.bindAudioStream(this.destinationStream.stream)}))}stopTone(){if(!(this.audioContext&&this.gainNode&&this.oscillatorNode&&this.destinationStream))return;const e=this.audioContext.currentTime;this.gainNode.gain.linearRampToValueAtTime(.1,e+.1+1),this.gainNode.gain.linearRampToValueAtTime(0,e+.2+1),this.oscillatorNode.stop(),this.oscillatorNode.disconnect(this.gainNode),this.gainNode.disconnect(this.destinationStream),this.oscillatorNode=null,this.gainNode=null,this.destinationStream=null}checkVideoInput(e){return n(this,void 0,void 0,(function*(){try{return yield this.meetingSession.audioVideo.chooseVideoInputDevice(e),yield this.meetingSession.audioVideo.chooseVideoInputDevice(null),b.default.Succeeded}catch(e){return this.logger.error(`MeetingReadinessChecker: Video check failed with error ${e}`),e instanceof o.default?b.default.PermissionDenied:b.default.Failed}}))}checkCameraResolution(e,t,c){return n(this,void 0,void 0,(function*(){let n;try{const i=r.default.getIntrinsicDeviceId(e),a={video:this.calculateVideoConstraint(i,t,c)};n=yield navigator.mediaDevices.getUserMedia(a)}catch(e){return this.logger.error(`MeetingReadinessChecker: Camera resolution check with width: ${t} height ${c} failed with error ${e}`),e&&"OverconstrainedError"===e.name?h.default.ResolutionNotSupported:e&&"NotAllowedError"===e.name?h.default.PermissionDenied:h.default.Failed}finally{n&&n.getTracks().forEach((function(e){e.stop()}))}return h.default.Succeeded}))}calculateVideoConstraint(e,t,c){const n=this.browserBehavior.requiresResolutionAlignment(t,c),i={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?(i.deviceId=e,i.width=t,i.height=c):(i.deviceId={exact:e},i.width={exact:n[0]},i.height={exact:n[1]}),i}checkContentShareConnectivity(e){return n(this,void 0,void 0,(function*(){let t=!1,c=!1;const i={contentShareDidStart:()=>{t=!0}},a={audioVideoDidStart:()=>{c=!0}};try{return this.meetingSession.audioVideo.addObserver(a),this.meetingSession.audioVideo.start(),this.meetingSession.audioVideo.addContentShareObserver(i),yield this.meetingSession.audioVideo.startContentShareFromScreenCapture(e),yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){return c&&t})))),c?(yield this.stopMeeting(),t?m.default.Succeeded:m.default.TimedOut):m.default.ConnectionFailed}catch(e){return this.logger.error(`MeetingReadinessChecker: Content share check failed with error ${e}`),"NotAllowedError"===e.name?m.default.PermissionDenied:m.default.Failed}finally{this.meetingSession.audioVideo.removeObserver(a),this.meetingSession.audioVideo.stopContentShare(),this.meetingSession.audioVideo.removeContentShareObserver(i)}}))}checkAudioConnectivity(e){return n(this,void 0,void 0,(function*(){let t=!1;const c=this.meetingSession.audioVideo,i=(e,c,n,i)=>{e===this.meetingSession.configuration.credentials.attendeeId&&c&&(t=!0)};try{yield c.chooseAudioInputDevice(e)}catch(e){return this.logger.error(`MeetingReadinessChecker: Failed to get audio input device with error ${e}`),e instanceof o.default?u.default.AudioInputPermissionDenied:u.default.AudioInputRequestFailed}if(c.realtimeSubscribeToAttendeeIdPresence(i),!(yield this.startMeeting())){c.realtimeUnsubscribeToAttendeeIdPresence(i);try{yield this.meetingSession.audioVideo.chooseAudioInputDevice(null)}catch(e){this.logger.error(`MeetingReadinessChecker: Failed to choose null device with error ${e}`)}return u.default.ConnectionFailed}yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){return t})))),c.realtimeUnsubscribeToAttendeeIdPresence(i),yield this.stopMeeting();try{yield this.meetingSession.audioVideo.chooseAudioInputDevice(null)}catch(e){this.logger.error(`MeetingReadinessChecker: Failed to choose null device with error ${e}`)}return t?u.default.Succeeded:u.default.AudioNotReceived}))}checkVideoConnectivity(e){return n(this,void 0,void 0,(function*(){const t=this.meetingSession.audioVideo;try{yield t.chooseVideoInputDevice(e)}catch(e){return this.logger.error(`MeetingReadinessChecker: Failed to get video input device with error ${e}`),e instanceof o.default?g.default.VideoInputPermissionDenied:g.default.VideoInputRequestFailed}if(!(yield this.startMeeting()))return g.default.ConnectionFailed;let c=0;return t.startLocalVideoTile(),yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){const e=yield t.getRTCPeerConnectionStats();return e&&e.forEach((e=>{"outbound-rtp"===e.type&&"video"===e.mediaType&&(c=e.packetsSent)})),c>0})))),t.stopLocalVideoTile(),yield this.stopMeeting(),c<=0?g.default.VideoNotSent:g.default.Succeeded}))}checkNetworkUDPConnectivity(){return n(this,void 0,void 0,(function*(){try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(e){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${e}`),v.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=e=>{const t=this.originalURLRewriter(e);return t.includes("transport=tcp")?"":t};const e=this.meetingSession.audioVideo;if(!(yield this.startMeeting()))return this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,v.default.ConnectionFailed;let t=!1;return yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){const c=yield e.getRTCPeerConnectionStats();return c&&c.forEach((e=>{"candidate-pair"===e.type&&"succeeded"===e.state&&(t=!0)})),t})))),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),t?v.default.Succeeded:v.default.ICENegotiationFailed}))}checkNetworkTCPConnectivity(){return n(this,void 0,void 0,(function*(){try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(e){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${e}`),p.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=e=>{const t=this.originalURLRewriter(e);return t.includes("transport=udp")?"":t};const e=this.meetingSession.audioVideo;if(!(yield this.startMeeting()))return this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,p.default.ConnectionFailed;let t=!1;return yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){const c=yield e.getRTCPeerConnectionStats();return c&&c.forEach((e=>{"candidate-pair"===e.type&&"succeeded"===e.state&&(t=!0)})),t})))),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),t?p.default.Succeeded:p.default.ICENegotiationFailed}))}startMeeting(){return n(this,void 0,void 0,(function*(){let e=!1;const t={audioVideoDidStart:()=>{e=!0}};return this.meetingSession.audioVideo.addObserver(t),this.meetingSession.audioVideo.start(),yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){return e})))),this.meetingSession.audioVideo.removeObserver(t),e}))}stopMeeting(){return n(this,void 0,void 0,(function*(){let e=!1;const t={audioVideoDidStop:t=>{e=!0}};return this.meetingSession.audioVideo.addObserver(t),this.meetingSession.audioVideo.stop(),yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){return e})))),this.meetingSession.audioVideo.removeObserver(t),e}))}executeTimeoutTask(e){return n(this,void 0,void 0,(function*(){let t=!1;class c extends s.default{constructor(e,t){super(e),this.waitDurationMs=t,this.isCancelled=!1}cancel(){this.isCancelled=!0}run(){return n(this,void 0,void 0,(function*(){for(;!this.isCancelled;){if(yield e()){t=!0;break}yield C.delay(this.waitDurationMs)}}))}}const i=new l.default(this.logger,new c(this.logger,this.configuration.waitDurationMs),this.configuration.timeoutMs);return yield i.run(),t}))}}t.default=C},3990:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.timeoutMs=1e4,this.waitDurationMs=3e3}}},4202:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(9059),a=c(8538),r=c(8434),o=c(543),s=c(8370),l=c(8023),u=c(146),f=c(9141),d=c(7631);class h{constructor(e,t,c){this._configuration=e,this._logger=t,this.checkBrowserSupportAndFeatureConfiguration(),this._deviceController=c,this.audioVideoController=new i.default(this._configuration,this._logger,new d.default(this._logger),c,new f.default(h.RECONNECT_TIMEOUT_MS,new r.default(h.RECONNECT_FIXED_WAIT_MS,h.RECONNECT_SHORT_BACKOFF_MS,h.RECONNECT_LONG_BACKOFF_MS))),c.bindToAudioVideoController(this.audioVideoController);const n=new s.default(this._logger);this.contentShareController=new l.default(n,new i.default(l.default.createContentShareMeetingSessionConfigure(this._configuration),this._logger,new d.default(this._logger),n,new f.default(h.RECONNECT_TIMEOUT_MS,new r.default(h.RECONNECT_FIXED_WAIT_MS,h.RECONNECT_SHORT_BACKOFF_MS,h.RECONNECT_LONG_BACKOFF_MS))),this.audioVideoController),this.audioVideoFacade=new a.default(this.audioVideoController,this.audioVideoController.videoTileController,this.audioVideoController.realtimeController,this.audioVideoController.audioMixController,this._deviceController,this.contentShareController)}get configuration(){return this._configuration}get logger(){return this._logger}get audioVideo(){return this.audioVideoFacade}get contentShare(){return this.contentShareController}get deviceController(){return this._deviceController}destroy(){return n(this,void 0,void 0,(function*(){u.isDestroyable(this.contentShareController)&&(yield this.contentShareController.destroy()),u.isDestroyable(this.audioVideoController)&&(yield this.audioVideoController.destroy()),this._logger=void 0,this._configuration=void 0,this._deviceController=void 0,this.audioVideoFacade=void 0,this.audioVideoController=void 0,this.contentShareController=void 0}))}checkBrowserSupportAndFeatureConfiguration(){const e=new o.default,t=`${e.name()} ${e.majorVersion()} (${e.version()})`;this.logger.info(`browser is ${t}`),e.isSupported()||this.logger.warn(`this browser is not currently supported. Stability may suffer. Supported browsers are: ${e.supportString()}.`),this._configuration.enableUnifiedPlanForChromiumBasedBrowsers&&(e.hasChromiumWebRTC()?this.logger.info("WebRTC unified plan for Chromium-based browsers is enabled"):this.logger.info(`WebRTC unified plan is required for ${e.name()}`)),this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&(this._configuration.enableUnifiedPlanForChromiumBasedBrowsers?e.hasChromiumWebRTC()?this.logger.info(`Simulcast is enabled for ${e.name()}`):(this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.logger.info("Simulcast requires WebRTC Unified Plan and is only supported on Chromium-based browsers")):(this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.logger.info("Simulcast requires enabling WebRTC Unified Plan for Chromium-based browsers")))}}t.default=h,h.RECONNECT_TIMEOUT_MS=12e4,h.RECONNECT_FIXED_WAIT_MS=0,h.RECONNECT_SHORT_BACKOFF_MS=1e3,h.RECONNECT_LONG_BACKOFF_MS=5e3},589:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(3731),i=c(5185),a=c(4442),r=c(8015),o=c(6057);t.default=class{constructor(e,t){this.meetingId=null,this.externalMeetingId=null,this.credentials=null,this.urls=null,this.connectionTimeoutMs=15e3,this.screenSharingTimeoutMs=5e3,this.screenViewingTimeoutMs=5e3,this.attendeePresenceTimeoutMs=0,this.connectionHealthPolicyConfiguration=new n.default,this.enableUnifiedPlanForChromiumBasedBrowsers=!0,this.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,e&&((e=this.toLowerCasePropertyNames(e)).meeting&&(e=e.meeting),this.meetingId=e.meetingid,this.externalMeetingId=e.externalmeetingid,this.urls=new o.default,this.urls.audioHostURL=e.mediaplacement.audiohosturl,this.urls.screenDataURL=e.mediaplacement.screendataurl,this.urls.screenSharingURL=e.mediaplacement.screensharingurl,this.urls.screenViewingURL=e.mediaplacement.screenviewingurl,this.urls.signalingURL=e.mediaplacement.signalingurl,this.urls.turnControlURL=e.mediaplacement.turncontrolurl),t&&((t=this.toLowerCasePropertyNames(t)).attendee&&(t=t.attendee),this.credentials=new r.default,this.credentials.attendeeId=t.attendeeid,this.credentials.externalUserId=t.externaluserid,this.credentials.joinToken=t.jointoken),this.videoDownlinkBandwidthPolicy=new i.default(this.credentials?this.credentials.attendeeId:null),this.videoUplinkBandwidthPolicy=new a.default(this.credentials?this.credentials.attendeeId:null)}toLowerCasePropertyNames(e){return null===e?null:"object"!=typeof e?e:Array.isArray(e)?e.map(this.toLowerCasePropertyNames):Object.keys(e).reduce(((t,c)=>{const n=e[c],i="object"==typeof n?this.toLowerCasePropertyNames(n):n;return t[c.toLowerCase()]=i,t}),{})}}},8015:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.attendeeId=null,this.externalUserId=null,this.joinToken=null}toJSON(){return{attendeeId:this.attendeeId,joinToken:null===this.joinToken?null:""}}}},7604:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.MeetingSessionLifecycleEvent=void 0,function(e){e[e.Connecting=0]="Connecting",e[e.Started=1]="Started",e[e.Stopped=2]="Stopped"}(c=t.MeetingSessionLifecycleEvent||(t.MeetingSessionLifecycleEvent={})),t.default=c},1296:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.MeetingSessionLifecycleEventCondition=void 0,function(e){e[e.ConnectingNew=0]="ConnectingNew",e[e.ReconnectingExisting=1]="ReconnectingExisting",e[e.StartedNew=2]="StartedNew",e[e.StartedExisting=3]="StartedExisting",e[e.StartedAfterReconnect=4]="StartedAfterReconnect",e[e.StoppedCleanly=5]="StoppedCleanly",e[e.StoppedWithFailure=6]="StoppedWithFailure"}(c=t.MeetingSessionLifecycleEventCondition||(t.MeetingSessionLifecycleEventCondition={})),t.default=c},3789:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(289),i=c(5687);class a{constructor(e){this._statusCode=e}statusCode(){return this._statusCode}isFailure(){switch(this._statusCode){case i.default.AudioAuthenticationRejected:case i.default.AudioCallAtCapacity:case i.default.AudioInternalServerError:case i.default.AudioServiceUnavailable:case i.default.AudioDisconnected:case i.default.VideoCallAtSourceCapacity:case i.default.SignalingBadRequest:case i.default.SignalingInternalServerError:case i.default.SignalingRequestFailed:case i.default.StateMachineTransitionFailed:case i.default.ICEGatheringTimeoutWorkaround:case i.default.ConnectionHealthReconnect:case i.default.RealtimeApiFailed:case i.default.TaskFailed:case i.default.NoAttendeePresent:return!0;default:return!1}}isTerminal(){switch(this._statusCode){case i.default.Left:case i.default.AudioJoinedFromAnotherDevice:case i.default.AudioAuthenticationRejected:case i.default.AudioCallAtCapacity:case i.default.MeetingEnded:case i.default.AudioDisconnected:case i.default.TURNCredentialsForbidden:case i.default.SignalingBadRequest:case i.default.SignalingRequestFailed:case i.default.VideoCallAtSourceCapacity:case i.default.RealtimeApiFailed:return!0;default:return!1}}isAudioConnectionFailure(){switch(this._statusCode){case i.default.AudioAuthenticationRejected:case i.default.AudioInternalServerError:case i.default.AudioServiceUnavailable:case i.default.StateMachineTransitionFailed:case i.default.ICEGatheringTimeoutWorkaround:case i.default.SignalingBadRequest:case i.default.SignalingInternalServerError:case i.default.SignalingRequestFailed:case i.default.RealtimeApiFailed:case i.default.NoAttendeePresent:return!0;default:return!1}}static fromSignalFrame(e){return e.error&&e.error.status?this.fromSignalingStatus(e.error.status):e.type===n.SdkSignalFrame.Type.AUDIO_STATUS?e.audioStatus?this.fromAudioStatus(e.audioStatus.audioStatus):new a(i.default.SignalingRequestFailed):new a(i.default.OK)}static fromAudioStatus(e){switch(e){case 200:return new a(i.default.OK);case 301:return new a(i.default.AudioJoinedFromAnotherDevice);case 302:return new a(i.default.AudioDisconnectAudio);case 403:return new a(i.default.AudioAuthenticationRejected);case 409:return new a(i.default.AudioCallAtCapacity);case 410:return new a(i.default.MeetingEnded);case 500:return new a(i.default.AudioInternalServerError);case 503:return new a(i.default.AudioServiceUnavailable);default:return 2===Math.floor(e/100)?new a(i.default.OK):new a(i.default.AudioDisconnected)}}static fromSignalingStatus(e){switch(e){case 206:return new a(i.default.VideoCallSwitchToViewOnly);case 509:return new a(i.default.VideoCallAtSourceCapacity);default:switch(Math.floor(e/100)){case 2:return new a(i.default.OK);case 4:return new a(i.default.SignalingBadRequest);case 5:return new a(i.default.SignalingInternalServerError);default:return new a(i.default.SignalingRequestFailed)}}}}t.default=a},5687:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.MeetingSessionStatusCode=void 0,function(e){e[e.OK=0]="OK",e[e.Left=1]="Left",e[e.AudioJoinedFromAnotherDevice=2]="AudioJoinedFromAnotherDevice",e[e.AudioDisconnectAudio=3]="AudioDisconnectAudio",e[e.AudioAuthenticationRejected=4]="AudioAuthenticationRejected",e[e.AudioCallAtCapacity=5]="AudioCallAtCapacity",e[e.AudioCallEnded=6]="AudioCallEnded",e[e.TURNMeetingEnded=6]="TURNMeetingEnded",e[e.MeetingEnded=6]="MeetingEnded",e[e.AudioInternalServerError=7]="AudioInternalServerError",e[e.AudioServiceUnavailable=8]="AudioServiceUnavailable",e[e.AudioDisconnected=9]="AudioDisconnected",e[e.VideoCallSwitchToViewOnly=10]="VideoCallSwitchToViewOnly",e[e.VideoCallAtSourceCapacity=11]="VideoCallAtSourceCapacity",e[e.SignalingBadRequest=12]="SignalingBadRequest",e[e.SignalingInternalServerError=13]="SignalingInternalServerError",e[e.SignalingRequestFailed=14]="SignalingRequestFailed",e[e.StateMachineTransitionFailed=15]="StateMachineTransitionFailed",e[e.ICEGatheringTimeoutWorkaround=16]="ICEGatheringTimeoutWorkaround",e[e.ConnectionHealthReconnect=17]="ConnectionHealthReconnect",e[e.RealtimeApiFailed=18]="RealtimeApiFailed",e[e.TaskFailed=19]="TaskFailed",e[e.AudioDeviceSwitched=20]="AudioDeviceSwitched",e[e.IncompatibleSDP=21]="IncompatibleSDP",e[e.TURNCredentialsForbidden=22]="TURNCredentialsForbidden",e[e.NoAttendeePresent=23]="NoAttendeePresent"}(c=t.MeetingSessionStatusCode||(t.MeetingSessionStatusCode={})),t.default=c},7215:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.username=null,this.password=null,this.ttl=null,this.uris=null}}},6057:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this._audioHostURL=null,this._screenDataURL=null,this._screenSharingURL=null,this._screenViewingURL=null,this._signalingURL=null,this._turnControlURL=null,this.urlRewriter=e=>e}get audioHostURL(){return this.urlRewriter(this._audioHostURL)}set audioHostURL(e){this._audioHostURL=e}get screenDataURL(){return this.urlRewriter(this._screenDataURL)}set screenDataURL(e){this._screenDataURL=e}get screenSharingURL(){return this.urlRewriter(this._screenSharingURL)}set screenSharingURL(e){this._screenSharingURL=e}get screenViewingURL(){return this.urlRewriter(this._screenViewingURL)}set screenViewingURL(e){this._screenViewingURL=e}get signalingURL(){return this.urlRewriter(this._signalingURL)}set signalingURL(e){this._signalingURL=e}get turnControlURL(){return this.urlRewriter(this._turnControlURL)}set turnControlURL(e){this._turnControlURL=e}}},5723:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class c{constructor(){this.remoteVideoAvailable=!1,this.canStartLocalVideo=!1}equal(e){return this.remoteVideoAvailable===e.remoteVideoAvailable&&this.canStartLocalVideo===e.canStartLocalVideo}clone(){const e=new c;return e.remoteVideoAvailable=this.remoteVideoAvailable,e.canStartLocalVideo=this.canStartLocalVideo,e}}t.default=c},9358:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,c){this.type=e,this.headers=t,this.payload=c}}},8947:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(8434),a=c(9358),r=c(9141),o=c(7797),s=c(334),l=c(7631),u=c(7387);t.default=class{constructor(e,t,c,n,a){this.configuration=e,this.logger=t,this.webSocket=c,this.reconnectController=n,this.sigV4=a,this.observerQueue=new Set,this.webSocket||(this.webSocket=new l.default(this.logger)),this.reconnectController||(this.reconnectController=new r.default(e.reconnectTimeoutMs,new i.default(e.reconnectFixedWaitMs,e.reconnectShortBackoffMs,e.reconnectLongBackoffMs))),this.sigV4||(this.sigV4=new s.default(this.configuration.chimeClient,this.configuration.awsClient))}addObserver(e){this.logger.info("adding messaging observer"),this.observerQueue.add(e)}removeObserver(e){this.logger.info("removing messaging observer"),this.observerQueue.delete(e)}start(){this.isClosed()?this.startConnecting(!1):this.logger.info("messaging session already started")}stop(){this.isClosed()?this.logger.info("no existing connection needs closing"):(this.isClosing=!0,this.webSocket.close())}forEachObserver(e){for(const t of this.observerQueue)o.default.nextTick((()=>{this.observerQueue.has(t)&&e(t)}))}setUpEventListeners(){this.webSocket.addEventListener("open",(()=>{this.openEventHandler()})),this.webSocket.addEventListener("message",(e=>{this.receiveMessageHandler(e.data)})),this.webSocket.addEventListener("close",(e=>{this.closeEventHandler(e)})),this.webSocket.addEventListener("error",(()=>{this.logger.error("WebSocket error")}))}startConnecting(e){const t=this.prepareWebSocketUrl();this.logger.info(`opening connection to ${t}`),e||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),this.webSocket.create(t,[],!0),this.forEachObserver((t=>{t.messagingSessionDidStartConnecting&&t.messagingSessionDidStartConnecting(e)})),this.setUpEventListeners()}prepareWebSocketUrl(){const e=new Map;return e.set("userArn",[this.configuration.userArn]),e.set("sessionId",[this.configuration.messagingSessionId]),this.sigV4.signURL("GET","wss","chime",this.configuration.endpointUrl,"/connect","",e)}isClosed(){return this.webSocket.readyState()===u.default.None||this.webSocket.readyState()===u.default.Closed}openEventHandler(){this.reconnectController.reset(),this.isFirstMessageReceived=!1}receiveMessageHandler(e){try{const t=JSON.parse(e),c=t.Headers["x-amz-chime-event-type"],n=new a.default(c,t.Headers,t.Payload||null);this.isFirstMessageReceived||(this.forEachObserver((e=>{e.messagingSessionDidStart&&e.messagingSessionDidStart()})),this.isFirstMessageReceived=!0),this.forEachObserver((e=>{e.messagingSessionDidReceiveMessage&&e.messagingSessionDidReceiveMessage(n)}))}catch(e){this.logger.error(`Messaging parsing failed: ${e}`)}}closeEventHandler(e){this.logger.info(`WebSocket close: ${e.code} ${e.reason}`),this.webSocket.destroy(),!this.isClosing&&this.canReconnect(e.code)&&this.reconnectController.retryWithBackoff((()=>n(this,void 0,void 0,(function*(){this.startConnecting(!0)}))),null)||(this.isClosing=!1,this.isFirstMessageReceived&&this.forEachObserver((t=>{t.messagingSessionDidStop&&t.messagingSessionDidStop(e)})))}canReconnect(e){return 1001===e||1006===e||e>=1011&&e<=1014||e>4e3&&4002!==e&&4003!==e&&4401!==e}}},4323:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,c,n,i){this.userArn=e,this.messagingSessionId=t,this.endpointUrl=c,this.chimeClient=n,this.awsClient=i,this.reconnectTimeoutMs=1e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackoffMs=1e3,this.reconnectLongBackoffMs=5e3,this.messagingSessionId||(this.messagingSessionId=this.generateSessionId())}generateSessionId(){const e=new Uint32Array(1);return window.crypto.getRandomValues(e)[0].toString()}}},214:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(8890);class i{constructor(e){this._id=e}id(){return this._id}base(){return this._id?this._id.split(i.MODALITY_SEPARATOR)[0]:""}modality(){if(!this._id)return"";const e=this._id.split(i.MODALITY_SEPARATOR);return 2===e.length?e[1]:""}hasModality(e){return""!==e&&this.modality()===e}withModality(e){const t=new i(this.base()+i.MODALITY_SEPARATOR+e);return""===e||""===this.base()||new i(t._id).modality()!==e?new i(this.base()):t}}t.default=i,i.MODALITY_SEPARATOR=n.default.Modality[0],i.MODALITY_CONTENT=n.default.Modality.substr(1)},7500:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(7086),i=c(7797),a=c(3922),r=c(9416),o=c(289);t.default=class{constructor(e,t,c){this.signalingClient=e,this.intervalMs=t,this.logger=c,this.observerQueue=new Set,this.consecutivePongsUnaccountedFor=0,this.intervalScheduler=new a.default(this.intervalMs),this.pingId=0}addObserver(e){this.logger.info("adding a ping-pong observer"),this.observerQueue.add(e)}removeObserver(e){this.logger.info("removing a ping-pong observer"),this.observerQueue.delete(e)}forEachObserver(e){for(const t of this.observerQueue)i.default.nextTick((()=>{this.observerQueue.has(t)&&e(t)}))}start(){this.stop(),this.signalingClient.registerObserver(this),this.signalingClient.ready()&&this.startPingInterval()}stop(){this.stopPingInterval(),this.signalingClient.removeObserver(this)}startPingInterval(){this.intervalScheduler.start((()=>{this.ping()})),this.ping()}stopPingInterval(){this.intervalScheduler.stop(),this.pingId=0,this.consecutivePongsUnaccountedFor=0}ping(){this.consecutivePongsUnaccountedFor>0&&(this.logger.warn(`missed pong ${this.consecutivePongsUnaccountedFor} time(s)`),this.forEachObserver((e=>{n.default.of(e.didMissPongs).map((t=>t.bind(e)(this.consecutivePongsUnaccountedFor)))}))),this.consecutivePongsUnaccountedFor+=1,this.pingId=this.pingId+1&4294967295;const e=o.SdkPingPongFrame.create();e.pingId=this.pingId,e.type=o.SdkPingPongType.PING,this.pingTimestampLocalMs=this.signalingClient.pingPong(e),this.logger.debug((()=>`sent ping ${this.pingId}`))}pong(e){const t=o.SdkPingPongFrame.create();t.pingId=e,t.type=o.SdkPingPongType.PONG,this.signalingClient.pingPong(t)}handleSignalingClientEvent(e){switch(e.type){case r.default.WebSocketOpen:this.startPingInterval();break;case r.default.WebSocketFailed:case r.default.WebSocketError:this.logger.warn(`stopped pinging (${r.default[e.type]})`),this.stopPingInterval();break;case r.default.WebSocketClosing:case r.default.WebSocketClosed:this.logger.info(`stopped pinging (${r.default[e.type]})`),this.stopPingInterval();break;case r.default.ReceivedSignalFrame:if(e.message.type!==o.SdkSignalFrame.Type.PING_PONG)break;if(e.message.pingPong.type===o.SdkPingPongType.PONG){const t=e.message.pingPong.pingId;if(t!==this.pingId){this.logger.warn(`unexpected ping id ${t} (expected ${this.pingId})`);break}let c;if(this.consecutivePongsUnaccountedFor=0,"number"!=typeof e.message.timestampMs)break;c=e.message.timestampMs,this.logger.debug((()=>`received pong ${t} with timestamp ${c}`));const i=e.timestampMs-this.pingTimestampLocalMs,a=Math.round(c-i/2),r=this.pingTimestampLocalMs-a;this.logger.info(`local clock skew estimate=${r}ms from ping-pong time=${i}ms`),this.forEachObserver((e=>{n.default.of(e.didReceivePong).map((c=>c.bind(e)(t,r,i)))}))}else this.pong(e.message.pingPong.pingId)}}}},983:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(9825),i=c(9576);t.default=class{constructor(){this.state=new n.default}realtimeSetLocalAttendeeId(e,t){this.state.localAttendeeId=e,this.state.localExternalUserId=t}realtimeSetAttendeeIdPresence(e,t,c,n,i){try{t&&(this.state.attendeeIdToExternalUserId[e]=c);for(const a of this.state.attendeeIdChangesCallbacks)a(e,t,c,n,i)}catch(e){this.onError(e)}}realtimeSubscribeToAttendeeIdPresence(e){try{this.state.attendeeIdChangesCallbacks.push(e)}catch(e){this.onError(e)}}realtimeUnsubscribeToAttendeeIdPresence(e){try{const t=this.state.attendeeIdChangesCallbacks.indexOf(e);-1!==t&&this.state.attendeeIdChangesCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeSetLocalAudioInput(e){try{if(this.state.audioInput===e)return;this.setAudioInputEnabled(!1),this.state.audioInput=e,this.setAudioInputEnabled(!this.state.muted)}catch(e){this.onError(e)}}realtimeSetCanUnmuteLocalAudio(e){try{if(this.state.canUnmute===e)return;this.state.canUnmute=e;for(const t of this.state.setCanUnmuteLocalAudioCallbacks)t(e)}catch(e){this.onError(e)}}realtimeSubscribeToSetCanUnmuteLocalAudio(e){try{this.state.setCanUnmuteLocalAudioCallbacks.push(e)}catch(e){this.onError(e)}}realtimeUnsubscribeToSetCanUnmuteLocalAudio(e){try{const t=this.state.setCanUnmuteLocalAudioCallbacks.indexOf(e);-1!==t&&this.state.setCanUnmuteLocalAudioCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeCanUnmuteLocalAudio(){return this.state.canUnmute}realtimeMuteLocalAudio(){if(!this.state.muted)try{this.setAudioInputEnabled(!1),this.state.muted=!0,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId);for(const e of this.state.muteAndUnmuteLocalAudioCallbacks)e(!0)}catch(e){this.onError(e)}}realtimeUnmuteLocalAudio(){if(!this.state.muted)return!0;if(!this.state.canUnmute)return!1;try{this.setAudioInputEnabled(!0),this.state.muted=!1,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId);for(const e of this.state.muteAndUnmuteLocalAudioCallbacks)e(!1);return!0}catch(e){return this.onError(e),!1}}realtimeSubscribeToMuteAndUnmuteLocalAudio(e){try{this.state.muteAndUnmuteLocalAudioCallbacks.push(e)}catch(e){this.onError(e)}}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(e){try{const t=this.state.muteAndUnmuteLocalAudioCallbacks.indexOf(e);-1!==t&&this.state.muteAndUnmuteLocalAudioCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeIsLocalAudioMuted(){return this.state.muted}realtimeSubscribeToVolumeIndicator(e,t){try{this.state.volumeIndicatorCallbacks.hasOwnProperty(e)||(this.state.volumeIndicatorCallbacks[e]=[]),this.state.volumeIndicatorCallbacks[e].push(t),this.sendVolumeIndicatorChange(e,!0,!0,!0,this.state.attendeeIdToExternalUserId[e])}catch(e){this.onError(e)}}realtimeUnsubscribeFromVolumeIndicator(e,t){try{if(t){const c=this.state.volumeIndicatorCallbacks[e].indexOf(t);-1!==c&&this.state.volumeIndicatorCallbacks[e].splice(c,1)}else delete this.state.volumeIndicatorCallbacks[e]}catch(e){this.onError(e)}}realtimeUpdateVolumeIndicator(e,t,c,n,i){try{c=this.applyLocalMuteOverride(e,c);const a=this.getVolumeIndicatorState(e);let r=!1,o=!1,s=!1;null!==c&&a.muted!==c&&(a.muted=c,o=!0,a.muted&&0!==a.volume&&(a.volume=0,r=!0)),a.muted||null===t||(a.volume!==t&&(a.volume=t,r=!0),null===a.muted&&(a.muted=!1,o=!0)),null!==n&&a.signalStrength!==n&&(a.signalStrength=n,s=!0),this.sendVolumeIndicatorChange(e,r,o,s,i)}catch(e){this.onError(e)}}realtimeSubscribeToLocalSignalStrengthChange(e){try{if(this.state.localSignalStrengthChangeCallbacks.push(e),null===this.state.localAttendeeId)return;this.sendLocalSignalStrengthChange(this.state.localAttendeeId,!0)}catch(e){this.onError(e)}}realtimeUnsubscribeToLocalSignalStrengthChange(e){try{const t=this.state.localSignalStrengthChangeCallbacks.indexOf(e);-1!==t&&this.state.localSignalStrengthChangeCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeSubscribeToSendDataMessage(e){try{this.state.sendDataMessageCallbacks.push(e)}catch(e){this.onError(e)}}realtimeUnsubscribeFromSendDataMessage(e){try{const t=this.state.sendDataMessageCallbacks.indexOf(e);-1!==t&&this.state.sendDataMessageCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeSendDataMessage(e,t,c){try{for(const n of this.state.sendDataMessageCallbacks)n(e,t,c)}catch(e){this.onError(e)}}realtimeSubscribeToReceiveDataMessage(e,t){try{this.state.receiveDataMessageCallbacks.has(e)?this.state.receiveDataMessageCallbacks.get(e).push(t):this.state.receiveDataMessageCallbacks.set(e,[t])}catch(e){this.onError(e)}}realtimeUnsubscribeFromReceiveDataMessage(e){try{this.state.receiveDataMessageCallbacks.delete(e)}catch(e){this.onError(e)}}realtimeReceiveDataMessage(e){try{if(this.state.receiveDataMessageCallbacks.has(e.topic))for(const t of this.state.receiveDataMessageCallbacks.get(e.topic))t(e)}catch(e){this.onError(e)}}realtimeSubscribeToFatalError(e){try{this.state.fatalErrorCallbacks.push(e)}catch(e){this.onError(e)}}realtimeUnsubscribeToFatalError(e){try{const t=this.state.fatalErrorCallbacks.indexOf(e);-1!==t&&this.state.fatalErrorCallbacks.splice(t,1)}catch(e){this.onError(e)}}setAudioInputEnabled(e){if(this.state.audioInput)for(const t of this.state.audioInput.getTracks())t.enabled!==e&&(t.enabled=e)}applyLocalMuteOverride(e,t){const c=this.state.localAttendeeId,n=this.state.muted;return e!==c||null===this.state.audioInput?t:n}sendVolumeIndicatorChange(e,t,c,n,a){if(this.sendLocalSignalStrengthChange(e,n),!this.state.volumeIndicatorCallbacks.hasOwnProperty(e))return;const r=this.getVolumeIndicatorState(e),o=new i.default;if(t&&(o.volume=r.volume),c&&(o.muted=r.muted),n&&(o.signalStrength=r.signalStrength),!this.stateIsEmpty(o))for(const t of this.state.volumeIndicatorCallbacks[e])t(e,o.volume,o.muted,o.signalStrength,a)}sendLocalSignalStrengthChange(e,t){if(!t)return;if(e!==this.state.localAttendeeId)return;const c=this.getVolumeIndicatorState(e).signalStrength;if(null!==c)for(const e of this.state.localSignalStrengthChangeCallbacks)e(c)}getVolumeIndicatorState(e){return this.state.volumeIndicatorState.hasOwnProperty(e)||(this.state.volumeIndicatorState[e]=new i.default),this.state.volumeIndicatorState[e]}stateIsEmpty(e){return null===e.volume&&null===e.muted&&null===e.signalStrength}onError(e){try{for(const t of this.state.fatalErrorCallbacks)t(e)}catch(t){try{console.error(e),console.error(t)}catch(e){}}}}},5910:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.attendeeIndex=null,this.attendeesInFrame=null}}},9825:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.localAttendeeId=null,this.localExternalUserId=null,this.attendeeIdChangesCallbacks=[],this.canUnmute=!0,this.setCanUnmuteLocalAudioCallbacks=[],this.muted=!1,this.muteAndUnmuteLocalAudioCallbacks=[],this.audioInput=null,this.volumeIndicatorState={},this.attendeeIdToExternalUserId={},this.volumeIndicatorCallbacks={},this.localSignalStrengthChangeCallbacks=[],this.fatalErrorCallbacks=[],this.sendDataMessageCallbacks=[],this.receiveDataMessageCallbacks=new Map}}},9576:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.volume=null,this.muted=null,this.signalStrength=null}}},9141:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(4929);class i{constructor(e,t){this.reconnectTimeoutMs=e,this.backoffPolicy=t,this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this._isFirstConnection=!0,this.backoffTimer=null,this.backoffCancel=null,this.reset()}timeSpentReconnectingMs(){return this.firstConnectionAttempted?Date.now()-this.firstConnectionAttemptTimestampMs:0}hasPastReconnectDeadline(){return Date.now()-this.lastActiveTimestampMs>=this.reconnectTimeoutMs||this.timeSpentReconnectingMs()>=this.reconnectTimeoutMs}reset(){this.cancel(),this.shouldReconnect=!0,this.onlyRestartPeerConnection=!1,this.firstConnectionAttempted=!1,this.firstConnectionAttemptTimestampMs=0,this.lastActiveTimestampMs=1/0,this.backoffPolicy.reset()}startedConnectionAttempt(e){this._isFirstConnection=e,this.firstConnectionAttempted||(this.firstConnectionAttempted=!0,this.firstConnectionAttemptTimestampMs=Date.now())}hasStartedConnectionAttempt(){return this.firstConnectionAttempted}isFirstConnection(){return this._isFirstConnection}disableReconnect(){this.shouldReconnect=!1}enableRestartPeerConnection(){this.onlyRestartPeerConnection=!0}cancel(){this.disableReconnect(),this.backoffTimer&&(this.backoffTimer.stop(),this.backoffCancel&&(this.backoffCancel(),this.backoffCancel=null))}retryWithBackoff(e,t){const c=this.shouldReconnect&&!this.hasPastReconnectDeadline();return c&&(this.backoffCancel=t,this.backoffTimer=new n.default(this.backoffPolicy.nextBackoffAmountMs()),this.backoffTimer.start((()=>{this.backoffCancel=null,e()}))),c}shouldOnlyRestartPeerConnection(){return this.onlyRestartPeerConnection}clone(){return new i(this.reconnectTimeoutMs,this.backoffPolicy)}setLastActiveTimestampMs(e){this.lastActiveTimestampMs=e}}t.default=i},7797:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(4929);class i extends n.default{constructor(){super(0)}static nextTick(e){setTimeout(e,0)}}t.default=i},3922:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.intervalMs=e}start(e){this.stop(),this.timer=setInterval(e,this.intervalMs)}stop(){void 0!==this.timer&&(clearInterval(this.timer),this.timer=void 0)}running(){return void 0!==this.timer}}},4929:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.timeoutMs=e,this.timer=null}start(e){this.stop(),this.timer=setTimeout((()=>{clearTimeout(this.timer),e()}),this.timeoutMs)}stop(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)}}},7293:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(4076);class i{constructor(e){this.sdp=e}clone(){return new i(this.sdp)}static isRTPCandidate(e){const t=/candidate[:](\S+) (\d+)/g.exec(e);return null!==t&&"1"===t[2]}static linesToSDP(e){return new i(e.join(i.CRLF))}static candidateTypeFromString(e){switch(e){case n.default.Host:return n.default.Host;case n.default.ServerReflexive:return n.default.ServerReflexive;case n.default.PeerReflexive:return n.default.PeerReflexive;case n.default.Relay:return n.default.Relay}return null}static candidateType(e){const t=/a[=]candidate[:].* typ ([a-z]+) /g.exec(e);return null===t?null:i.candidateTypeFromString(t[1])}static splitLines(e){return e.trim().split("\n").map((e=>e.trim()))}static splitSections(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+i.CRLF))}static findActiveCameraSection(e){let t=0,c=!1;for(const n of e){if(/^m=video/.test(n)&&n.indexOf("sendrecv")>-1){c=!0;break}t++}return!1===c&&(t=-1),t}static parseSSRCMedia(e){const t=e.indexOf(" ");let c=0,n="",a="";c=i.extractSSRCFromAttributeLine(e);const r=e.indexOf(":",t);return r>-1?(n=e.substr(t+1,r-t-1),a=e.substr(r+1)):n=e.substr(t+1),[c,n,a]}static extractSSRCsFromFIDGroupLine(e){return/^a=ssrc-group:FID\s(.+)/.exec(e)[1]}static extractSSRCFromAttributeLine(e){const t=/^a=ssrc:([0-9]+)\s/.exec(e);return null===t?0:parseInt(t[1],10)}static matchPrefix(e,t){return i.splitLines(e).filter((e=>0===e.indexOf(t)))}lines(){return this.sdp.split(i.CRLF)}hasVideo(){return null!==/^m=video/gm.exec(this.sdp)}hasCandidates(){return null!==/a[=]candidate[:]/g.exec(this.sdp)}hasCandidatesForAllMLines(){return!(this.sdp.indexOf("c=IN IP4 0.0.0.0")>-1)}withBundleAudioVideo(){const e=this.lines(),t=[];for(const c of e){const e=c.replace(/^a=group:BUNDLE audio$/,"a=group:BUNDLE audio video");e===c?t.push(c):t.push(e)}return i.linesToSDP(t)}copyVideo(e){const t=e.split(i.CRLF),c=i.splitLines(this.sdp);let n=!1;for(const e of t)/^m=video/.test(e)?n=!0:/^m=/.test(e)&&(n=!1),n&&c.push(e);return i.linesToSDP(c)}withoutCandidateType(e){return i.linesToSDP(this.lines().filter((t=>i.candidateType(t)!==e)))}withoutServerReflexiveCandidates(){return this.withoutCandidateType(n.default.ServerReflexive)}withBandwidthRestriction(e,t){const c=this.lines(),n=[];for(const i of c)n.push(i),/^m=video/.test(i)&&(t?n.push("b=TIAS:"+1e3*e):n.push(`b=AS:${e}`));return i.linesToSDP(n)}withAudioMaxAverageBitrate(e){if(!e)return this.clone();e=Math.trunc(Math.min(Math.max(e,i.rfc7587LowestBitrate),i.rfc7587HighestBitrate));const t=this.lines(),c=[],n=/^a=rtpmap:\s*(\d+)\s+opus\/48000/;let a=!1,r=null;for(const i of t){if(i.startsWith("m=audio")&&(a=!0,r=null),i.startsWith("m=video")&&(a=!1,r=null),a){const e=n.exec(i);null!==e&&(r=`a=fmtp:${e[1]} `,a=!1)}if(r&&i.startsWith(r)){const t=i.slice(r.length).split(";"),n=[];for(const e of t)e.startsWith("maxaveragebitrate=")||n.push(e);n.push(`maxaveragebitrate=${e}`),c.push(r+n.join(";"))}else c.push(i)}return i.linesToSDP(c)}withUnifiedPlanFormat(){let e=this.sdp;return e.includes("mozilla")?this.clone():(e=e.replace("o=-","o=mozilla-chrome"),new i(e))}preferH264IfExists(){const e=this.sdp,t=i.splitSections(e);if(t.length<2)return new i(this.sdp);const c=[];for(let e=0;e{if(/^a=rtpmap:/.test(e)){const t=/^a=rtpmap:([0-9]+)\s/.exec(e);e.toLowerCase().includes("vp8")?n=parseInt(t[1],10):e.toLowerCase().includes("h264")&&(a=parseInt(t[1],10))}})),0!==n&&0!==a){const e=c[0].split(" ");let t=-1,i=-1;for(let c=3;c{const t=i.parseSSRCMedia(e);"cname"===t[1]?a=t[2]:"msid"===t[1]&&(r=t[2])}));const o=i.matchPrefix(c[n],"a=ssrc-group:FID ");if(""===a||""===r||o.length<1)return new i(this.sdp);const s=i.extractSSRCsFromFIDGroupLine(o[0]),l=c[n].trim().split(i.CRLF).filter((e=>0!==e.indexOf("a=ssrc:")&&0!==e.indexOf("a=ssrc-group:"))),u=[],[f,d]=s.split(" ").map((e=>parseInt(e,10)));let h=f,m=d;for(let t=0;tparseInt(e,10)));return r.toString()}videoSendSectionHasDifferentSSRC(e){const t=this.ssrcForVideoSendingSection(),c=e.ssrcForVideoSendingSection();return""!==t&&""!==c&&parseInt(t,10)!==parseInt(c,10)}}t.default=i,i.CRLF="\r\n",i.rfc7587LowestBitrate=6e3,i.rfc7587HighestBitrate=51e4},4076:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.SDPCandidateType=void 0,function(e){e.Host="host",e.ServerReflexive="srflx",e.PeerReflexive="prflx",e.Relay="relay"}(c=t.SDPCandidateType||(t.SDPCandidateType={})),t.default=c},9678:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(3860),i=c(6850),a=c(9553),r=c(3013);t.default=class{constructor(e){this.logger=e,this.currentState=a.SessionStateControllerState.NotConnected,this.deferredAction=null,this.deferredWork=null}perform(e,t){const c=this.currentState;if(c===a.SessionStateControllerState.NotConnected&&e===n.SessionStateControllerAction.Connect)this.transition(a.SessionStateControllerState.Connecting,e);else if(c===a.SessionStateControllerState.Connecting&&e===n.SessionStateControllerAction.Fail)this.transition(a.SessionStateControllerState.Disconnecting,e);else if(c===a.SessionStateControllerState.Connecting&&e===n.SessionStateControllerAction.FinishConnecting)this.transition(a.SessionStateControllerState.Connected,e);else if(c===a.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Disconnect)this.transition(a.SessionStateControllerState.Disconnecting,e);else if(c===a.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Reconnect)this.transition(a.SessionStateControllerState.Connecting,e);else if(c===a.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Fail)this.transition(a.SessionStateControllerState.Disconnecting,e);else if(c===a.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Update)this.transition(a.SessionStateControllerState.Updating,e);else if(c===a.SessionStateControllerState.Updating&&e===n.SessionStateControllerAction.Fail)this.transition(a.SessionStateControllerState.Disconnecting,e);else if(c===a.SessionStateControllerState.Updating&&e===n.SessionStateControllerAction.FinishUpdating)this.transition(a.SessionStateControllerState.Connected,e);else{if(c!==a.SessionStateControllerState.Disconnecting||e!==n.SessionStateControllerAction.FinishDisconnecting)return this.canDefer(e)?(this.logger.info(`deferring transition from ${a.SessionStateControllerState[this.currentState]} with ${n.SessionStateControllerAction[e]}`),this.deferAction(e,t),r.SessionStateControllerTransitionResult.DeferredTransition):(this.logger.warn(`no transition found from ${a.SessionStateControllerState[this.currentState]} with ${n.SessionStateControllerAction[e]}`),r.SessionStateControllerTransitionResult.NoTransitionAvailable);this.transition(a.SessionStateControllerState.NotConnected,e)}try{t()}catch(t){return this.logger.error(`error during state ${a.SessionStateControllerState[this.currentState]} with action ${n.SessionStateControllerAction[e]}: ${t}`),this.logger.info(`rolling back transition to ${a.SessionStateControllerState[c]}`),this.currentState=c,r.SessionStateControllerTransitionResult.TransitionFailed}return this.performDeferredAction(),r.SessionStateControllerTransitionResult.Transitioned}state(){return this.currentState}transition(e,t){this.logger.info(`transitioning from ${a.SessionStateControllerState[this.currentState]} to ${a.SessionStateControllerState[e]} with ${n.SessionStateControllerAction[t]}`),this.currentState=e}deferPriority(e){switch(e){case n.SessionStateControllerAction.Disconnect:return i.SessionStateControllerDeferPriority.VeryHigh;case n.SessionStateControllerAction.Fail:return i.SessionStateControllerDeferPriority.High;case n.SessionStateControllerAction.Reconnect:return i.SessionStateControllerDeferPriority.Medium;case n.SessionStateControllerAction.Update:return i.SessionStateControllerDeferPriority.Low;default:return i.SessionStateControllerDeferPriority.DoNotDefer}}deferAction(e,t){null!==this.deferredAction&&this.deferPriority(this.deferredAction)>this.deferPriority(e)||(this.deferredAction=e,this.deferredWork=t)}canDefer(e){return this.deferPriority(e)!==i.SessionStateControllerDeferPriority.DoNotDefer&&(this.currentState===a.SessionStateControllerState.Connecting||this.currentState===a.SessionStateControllerState.Updating)}performDeferredAction(){if(!this.deferredAction)return;const e=this.deferredAction,t=this.deferredWork;this.deferredAction=null,this.deferredWork=null,this.logger.info(`performing deferred action ${n.SessionStateControllerAction[e]}`),this.perform(e,t)!==r.SessionStateControllerTransitionResult.Transitioned&&this.logger.info(`unable to perform deferred action ${n.SessionStateControllerAction[e]} in state ${a.SessionStateControllerState[this.currentState]}`)}}},3860:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.SessionStateControllerAction=void 0,function(e){e[e.Connect=0]="Connect",e[e.FinishConnecting=1]="FinishConnecting",e[e.Update=2]="Update",e[e.FinishUpdating=3]="FinishUpdating",e[e.Reconnect=4]="Reconnect",e[e.Disconnect=5]="Disconnect",e[e.Fail=6]="Fail",e[e.FinishDisconnecting=7]="FinishDisconnecting"}(c=t.SessionStateControllerAction||(t.SessionStateControllerAction={})),t.default=c},6850:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.SessionStateControllerDeferPriority=void 0,function(e){e[e.DoNotDefer=0]="DoNotDefer",e[e.Low=1]="Low",e[e.Medium=2]="Medium",e[e.High=3]="High",e[e.VeryHigh=4]="VeryHigh"}(c=t.SessionStateControllerDeferPriority||(t.SessionStateControllerDeferPriority={})),t.default=c},9553:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.SessionStateControllerState=void 0,function(e){e[e.NotConnected=0]="NotConnected",e[e.Connecting=1]="Connecting",e[e.Connected=2]="Connected",e[e.Updating=3]="Updating",e[e.Disconnecting=4]="Disconnecting"}(c=t.SessionStateControllerState||(t.SessionStateControllerState={})),t.default=c},3013:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.SessionStateControllerTransitionResult=void 0,function(e){e[e.Transitioned=0]="Transitioned",e[e.NoTransitionAvailable=1]="NoTransitionAvailable",e[e.DeferredTransition=2]="DeferredTransition",e[e.TransitionFailed=3]="TransitionFailed"}(c=t.SessionStateControllerTransitionResult||(t.SessionStateControllerTransitionResult={})),t.default=c},1208:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(543),i=c(289),a=c(4046),r=c(7387),o=c(2902),s=c(9416);class l{constructor(e,t){this.webSocket=e,this.logger=t,this.unloadHandler=null,this.observerQueue=new Set,this.connectionRequestQueue=[],this.resetConnection(),this.logger.debug((()=>"signaling client init")),this.audioSessionId=this.generateNewAudioSessionId()}registerObserver(e){this.logger.debug((()=>"registering signaling client observer")),this.observerQueue.add(e)}removeObserver(e){this.logger.debug((()=>"removing signaling client observer")),this.observerQueue.delete(e)}openConnection(e){this.logger.info("adding connection request to queue: "+e.url()),this.connectionRequestQueue.push(e),this.closeConnection()}pingPong(e){this.logger.debug((()=>"sending ping"));const t=i.SdkSignalFrame.create();return t.type=i.SdkSignalFrame.Type.PING_PONG,t.pingPong=e,this.sendMessage(t),t.timestampMs}join(e){this.logger.info("sending join");const t=i.SdkJoinFrame.create();t.protocolVersion=2,t.maxNumOfVideos=e.maxVideos,t.flags=i.SdkJoinFlags.HAS_STREAM_UPDATE;const c=new n.default;c.supportsSenderSideBandwidthEstimation()&&(t.flags|=i.SdkJoinFlags.USE_SEND_SIDE_BWE),t.flags|=e.sendBitrates?i.SdkJoinFlags.SEND_BITRATES:0,t.clientDetails=i.SdkClientDetails.create({platformName:c.name(),platformVersion:c.version(),clientSource:a.default.sdkName,chimeSdkVersion:a.default.sdkVersion}),t.audioSessionId=this.audioSessionId;const r=i.SdkSignalFrame.create();r.type=i.SdkSignalFrame.Type.JOIN,r.join=t,this.sendMessage(r)}subscribe(e){const t=i.SdkSubscribeFrame.create();if(t.sendStreams=[],t.sdpOffer=e.sdpOffer,t.audioCheckin=e.audioCheckin,t.audioHost=e.audioHost,t.audioMuted=e.audioMuted,e.connectionTypeHasVideo&&(t.receiveStreamIds=e.receiveStreamIds),t.duplex=i.SdkStreamServiceType.RX,!e.audioCheckin){const c=i.SdkStreamDescriptor.create();c.mediaType=i.SdkStreamMediaType.AUDIO,c.trackLabel="AmazonChimeExpressAudio",c.attendeeId=e.attendeeId,c.streamId=1,c.groupId=1,c.framerate=15,c.maxBitrateKbps=600,c.avgBitrateBps=4e5,t.sendStreams.push(c)}if(e.localVideoEnabled){t.duplex=i.SdkStreamServiceType.DUPLEX;for(let c=0;c"sent leave"))}sendClientMetrics(e){const t=i.SdkSignalFrame.create();t.type=i.SdkSignalFrame.Type.CLIENT_METRIC,t.clientMetric=e,this.sendMessage(t)}sendDataMessage(e){const t=i.SdkSignalFrame.create();t.type=i.SdkSignalFrame.Type.DATA_MESSAGE,t.dataMessage=e,this.sendMessage(t)}closeConnection(){this.webSocket.readyState()!==r.default.None&&this.webSocket.readyState()!==r.default.Closed?(this.isClosing=!0,this.sendEvent(new o.default(this,s.default.WebSocketClosing,null)),this.webSocket.close(),this.deactivatePageUnloadHandler()):(this.logger.info("no existing connection needs closing"),this.serviceConnectionRequestQueue())}ready(){return this.webSocket.readyState()===r.default.Open&&!this.isClosing&&this.wasOpened}mute(e){const t=i.SdkSignalFrame.create();t.type=i.SdkSignalFrame.Type.AUDIO_CONTROL;const c=i.SdkAudioControlFrame.create();c.muted=e,t.audioControl=c,this.sendMessage(t)}pause(e){const t=i.SdkSignalFrame.create();t.type=i.SdkSignalFrame.Type.PAUSE,t.pause=i.SdkPauseResumeFrame.create(),t.pause.streamIds=e,this.sendMessage(t)}resume(e){const t=i.SdkSignalFrame.create();t.type=i.SdkSignalFrame.Type.RESUME,t.pause=i.SdkPauseResumeFrame.create(),t.pause.streamIds=e,this.sendMessage(t)}resetConnection(){this.webSocket.destroy(),this.wasOpened=!1}sendMessage(e){e.timestampMs=Date.now(),this.logger.debug((()=>`sending: ${JSON.stringify(e)}`));const t=this.prependWithFrameTypeRTC(i.SdkSignalFrame.encode(e).finish());if(this.ready()){if(!this.webSocket.send(t))return void this.sendEvent(new o.default(this,s.default.WebSocketSendMessageFailure,null));this.sendEvent(new o.default(this,s.default.WebSocketSentMessage,null))}else this.sendEvent(new o.default(this,s.default.WebSocketSkippedMessage,null))}receiveMessage(e){let t;try{t=i.SdkSignalFrame.decode(e)}catch(t){return this.logger.info(`failed to decode: ${e}`),void this.sendEvent(new o.default(this,s.default.ProtocolDecodeFailure,null))}this.logger.debug((()=>`received: ${JSON.stringify(t)}`)),this.webSocket.readyState()===r.default.Open?this.sendEvent(new o.default(this,s.default.ReceivedSignalFrame,t)):this.logger.info(`skipping notification of message since WebSocket is not open: ${JSON.stringify(t)}`)}stripFrameTypeRTC(e){const t=e[0];return t!==l.FRAME_TYPE_RTC&&2!==t&&this.logger.warn(`expected FrameTypeRTC for message but got ${t}`),e.slice(1)}prependWithFrameTypeRTC(e){const t=new Uint8Array(e.length+1);return t[0]=l.FRAME_TYPE_RTC,t.set(e,1),t}serviceConnectionRequestQueue(){if(0===this.connectionRequestQueue.length)return void this.logger.info("no connection requests to service");const e=this.connectionRequestQueue.shift();this.logger.info(`opening connection to ${e.url()}`),this.isClosing=!1,this.webSocket.create(e.url(),e.protocols()),this.setUpEventListeners(),this.sendEvent(new o.default(this,s.default.WebSocketConnecting,null))}sendEvent(e){switch(e.type){case s.default.WebSocketMessage:case s.default.ReceivedSignalFrame:case s.default.WebSocketSentMessage:this.logger.debug((()=>`notifying event: ${s.default[e.type]}`));break;case s.default.WebSocketSkippedMessage:this.logger.debug((()=>`notifying event: ${s.default[e.type]}, websocket state=${r.default[this.webSocket.readyState()]}`));break;default:this.logger.info(`notifying event: ${s.default[e.type]}`)}for(const t of this.observerQueue)t.handleSignalingClientEvent(e)}setUpEventListeners(){this.webSocket.addEventListener("open",(()=>{this.activatePageUnloadHandler(),this.wasOpened=!0,this.sendEvent(new o.default(this,s.default.WebSocketOpen,null))})),this.webSocket.addEventListener("message",(e=>{this.sendEvent(new o.default(this,s.default.WebSocketMessage,null)),this.receiveMessage(this.stripFrameTypeRTC(new Uint8Array(e.data)))})),this.webSocket.addEventListener("close",(e=>{this.deactivatePageUnloadHandler(),this.resetConnection(),this.sendEvent(new o.default(this,s.default.WebSocketClosed,null,e.code,e.reason)),this.serviceConnectionRequestQueue()})),this.webSocket.addEventListener("error",(()=>{!this.isClosing||this.wasOpened?this.wasOpened?(this.logger.error("received error while connected"),this.sendEvent(new o.default(this,s.default.WebSocketError,null))):(this.logger.error("failed to connect"),this.sendEvent(new o.default(this,s.default.WebSocketFailed,null))):this.logger.info("ignoring error closing signaling while connecting")}))}activatePageUnloadHandler(){this.unloadHandler=()=>{this.leave()};const e=c.g;e.window&&e.window.addEventListener&&window.addEventListener("unload",this.unloadHandler)}deactivatePageUnloadHandler(){const e=c.g;e.window&&e.window.addEventListener&&window.removeEventListener("unload",this.unloadHandler),this.unloadHandler=null}generateNewAudioSessionId(){const e=new Uint32Array(1);return window.crypto.getRandomValues(e)[0]}}t.default=l,l.FRAME_TYPE_RTC=5},3920:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t){this.signalingURL=e,this.joinToken=t}url(){return this.signalingURL+"?X-Chime-Control-Protocol-Version=3&X-Amzn-Chime-Send-Close-On-Error=1"}protocols(){return["_aws_wt_session",this.joinToken]}}},2902:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(9416);t.default=class{constructor(e,t,c,n,i){this.client=e,this.type=t,this.message=c,this.closeCode=n,this.closeReason=i,this.timestampMs=Date.now()}isConnectionTerminated(){switch(this.type){case n.default.WebSocketFailed:case n.default.WebSocketError:case n.default.WebSocketClosing:case n.default.WebSocketClosed:return!0;default:return!1}}}},9416:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.SignalingClientEventType=void 0,function(e){e[e.WebSocketConnecting=0]="WebSocketConnecting",e[e.WebSocketOpen=1]="WebSocketOpen",e[e.WebSocketError=2]="WebSocketError",e[e.WebSocketClosing=3]="WebSocketClosing",e[e.WebSocketClosed=4]="WebSocketClosed",e[e.WebSocketFailed=5]="WebSocketFailed",e[e.WebSocketMessage=6]="WebSocketMessage",e[e.WebSocketSendMessageFailure=7]="WebSocketSendMessageFailure",e[e.WebSocketSentMessage=8]="WebSocketSentMessage",e[e.ProtocolDecodeFailure=9]="ProtocolDecodeFailure",e[e.ReceivedSignalFrame=10]="ReceivedSignalFrame",e[e.WebSocketSkippedMessage=11]="WebSocketSkippedMessage"}(c=t.SignalingClientEventType||(t.SignalingClientEventType={})),t.default=c},2168:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t){this.maxVideos=e,this.sendBitrates=t}}},6729:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,c,n,i,a,r,o,s){this.attendeeId=e,this.sdpOffer=t,this.audioHost=c,this.audioMuted=n,this.audioCheckin=i,this.receiveStreamIds=a,this.localVideoEnabled=r,this.videoStreamDescriptions=o,this.connectionTypeHasVideo=s}}},289:(e,t,c)=>{"use strict";var n,i,a=c(2100),r=a.Reader,o=a.Writer,s=a.util,l=a.roots.default||(a.roots.default={});l.SdkSignalFrame=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3){case 1:n.timestampMs=e.uint64();break;case 2:n.type=e.int32();break;case 3:n.error=l.SdkErrorFrame.decode(e,e.uint32());break;case 4:n.join=l.SdkJoinFrame.decode(e,e.uint32());break;case 5:n.joinack=l.SdkJoinAckFrame.decode(e,e.uint32());break;case 6:n.sub=l.SdkSubscribeFrame.decode(e,e.uint32());break;case 7:n.suback=l.SdkSubscribeAckFrame.decode(e,e.uint32());break;case 8:n.index=l.SdkIndexFrame.decode(e,e.uint32());break;case 10:n.pause=l.SdkPauseResumeFrame.decode(e,e.uint32());break;case 11:n.leave=l.SdkLeaveFrame.decode(e,e.uint32());break;case 12:n.leaveAck=l.SdkLeaveAckFrame.decode(e,e.uint32());break;case 14:n.bitrates=l.SdkBitrateFrame.decode(e,e.uint32());break;case 17:n.audioControl=l.SdkAudioControlFrame.decode(e,e.uint32());break;case 18:n.audioMetadata=l.SdkAudioMetadataFrame.decode(e,e.uint32());break;case 19:n.audioStreamIdInfo=l.SdkAudioStreamIdInfoFrame.decode(e,e.uint32());break;case 20:n.pingPong=l.SdkPingPongFrame.decode(e,e.uint32());break;case 21:n.audioStatus=l.SdkAudioStatusFrame.decode(e,e.uint32());break;case 22:n.clientMetric=l.SdkClientMetricFrame.decode(e,e.uint32());break;case 23:n.dataMessage=l.SdkDataMessageFrame.decode(e,e.uint32());break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("timestampMs"))throw s.ProtocolError("missing required 'timestampMs'",{instance:n});if(!n.hasOwnProperty("type"))throw s.ProtocolError("missing required 'type'",{instance:n});return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(!(s.isInteger(e.timestampMs)||e.timestampMs&&s.isInteger(e.timestampMs.low)&&s.isInteger(e.timestampMs.high)))return"timestampMs: integer|Long expected";switch(e.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 7:case 8:case 9:case 10:case 13:case 16:case 17:case 18:case 19:case 20:case 21:case 22:}var t;return null!=e.error&&e.hasOwnProperty("error")&&(t=l.SdkErrorFrame.verify(e.error))?"error."+t:null!=e.join&&e.hasOwnProperty("join")&&(t=l.SdkJoinFrame.verify(e.join))?"join."+t:null!=e.joinack&&e.hasOwnProperty("joinack")&&(t=l.SdkJoinAckFrame.verify(e.joinack))?"joinack."+t:null!=e.sub&&e.hasOwnProperty("sub")&&(t=l.SdkSubscribeFrame.verify(e.sub))?"sub."+t:null!=e.suback&&e.hasOwnProperty("suback")&&(t=l.SdkSubscribeAckFrame.verify(e.suback))?"suback."+t:null!=e.index&&e.hasOwnProperty("index")&&(t=l.SdkIndexFrame.verify(e.index))?"index."+t:null!=e.pause&&e.hasOwnProperty("pause")&&(t=l.SdkPauseResumeFrame.verify(e.pause))?"pause."+t:null!=e.leave&&e.hasOwnProperty("leave")&&(t=l.SdkLeaveFrame.verify(e.leave))?"leave."+t:null!=e.leaveAck&&e.hasOwnProperty("leaveAck")&&(t=l.SdkLeaveAckFrame.verify(e.leaveAck))?"leaveAck."+t:null!=e.bitrates&&e.hasOwnProperty("bitrates")&&(t=l.SdkBitrateFrame.verify(e.bitrates))?"bitrates."+t:null!=e.audioControl&&e.hasOwnProperty("audioControl")&&(t=l.SdkAudioControlFrame.verify(e.audioControl))?"audioControl."+t:null!=e.audioMetadata&&e.hasOwnProperty("audioMetadata")&&(t=l.SdkAudioMetadataFrame.verify(e.audioMetadata))?"audioMetadata."+t:null!=e.audioStreamIdInfo&&e.hasOwnProperty("audioStreamIdInfo")&&(t=l.SdkAudioStreamIdInfoFrame.verify(e.audioStreamIdInfo))?"audioStreamIdInfo."+t:null!=e.pingPong&&e.hasOwnProperty("pingPong")&&(t=l.SdkPingPongFrame.verify(e.pingPong))?"pingPong."+t:null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&(t=l.SdkAudioStatusFrame.verify(e.audioStatus))?"audioStatus."+t:null!=e.clientMetric&&e.hasOwnProperty("clientMetric")&&(t=l.SdkClientMetricFrame.verify(e.clientMetric))?"clientMetric."+t:null!=e.dataMessage&&e.hasOwnProperty("dataMessage")&&(t=l.SdkDataMessageFrame.verify(e.dataMessage))?"dataMessage."+t:null},e.fromObject=function(e){if(e instanceof l.SdkSignalFrame)return e;var t=new l.SdkSignalFrame;switch(null!=e.timestampMs&&(s.Long?(t.timestampMs=s.Long.fromValue(e.timestampMs)).unsigned=!0:"string"==typeof e.timestampMs?t.timestampMs=parseInt(e.timestampMs,10):"number"==typeof e.timestampMs?t.timestampMs=e.timestampMs:"object"==typeof e.timestampMs&&(t.timestampMs=new s.LongBits(e.timestampMs.low>>>0,e.timestampMs.high>>>0).toNumber(!0))),e.type){case"JOIN":case 1:t.type=1;break;case"JOIN_ACK":case 2:t.type=2;break;case"SUBSCRIBE":case 3:t.type=3;break;case"SUBSCRIBE_ACK":case 4:t.type=4;break;case"INDEX":case 5:t.type=5;break;case"PAUSE":case 7:t.type=7;break;case"RESUME":case 8:t.type=8;break;case"LEAVE":case 9:t.type=9;break;case"LEAVE_ACK":case 10:t.type=10;break;case"BITRATES":case 13:t.type=13;break;case"AUDIO_CONTROL":case 16:t.type=16;break;case"AUDIO_METADATA":case 17:t.type=17;break;case"AUDIO_STREAM_ID_INFO":case 18:t.type=18;break;case"PING_PONG":case 19:t.type=19;break;case"AUDIO_STATUS":case 20:t.type=20;break;case"CLIENT_METRIC":case 21:t.type=21;break;case"DATA_MESSAGE":case 22:t.type=22}if(null!=e.error){if("object"!=typeof e.error)throw TypeError(".SdkSignalFrame.error: object expected");t.error=l.SdkErrorFrame.fromObject(e.error)}if(null!=e.join){if("object"!=typeof e.join)throw TypeError(".SdkSignalFrame.join: object expected");t.join=l.SdkJoinFrame.fromObject(e.join)}if(null!=e.joinack){if("object"!=typeof e.joinack)throw TypeError(".SdkSignalFrame.joinack: object expected");t.joinack=l.SdkJoinAckFrame.fromObject(e.joinack)}if(null!=e.sub){if("object"!=typeof e.sub)throw TypeError(".SdkSignalFrame.sub: object expected");t.sub=l.SdkSubscribeFrame.fromObject(e.sub)}if(null!=e.suback){if("object"!=typeof e.suback)throw TypeError(".SdkSignalFrame.suback: object expected");t.suback=l.SdkSubscribeAckFrame.fromObject(e.suback)}if(null!=e.index){if("object"!=typeof e.index)throw TypeError(".SdkSignalFrame.index: object expected");t.index=l.SdkIndexFrame.fromObject(e.index)}if(null!=e.pause){if("object"!=typeof e.pause)throw TypeError(".SdkSignalFrame.pause: object expected");t.pause=l.SdkPauseResumeFrame.fromObject(e.pause)}if(null!=e.leave){if("object"!=typeof e.leave)throw TypeError(".SdkSignalFrame.leave: object expected");t.leave=l.SdkLeaveFrame.fromObject(e.leave)}if(null!=e.leaveAck){if("object"!=typeof e.leaveAck)throw TypeError(".SdkSignalFrame.leaveAck: object expected");t.leaveAck=l.SdkLeaveAckFrame.fromObject(e.leaveAck)}if(null!=e.bitrates){if("object"!=typeof e.bitrates)throw TypeError(".SdkSignalFrame.bitrates: object expected");t.bitrates=l.SdkBitrateFrame.fromObject(e.bitrates)}if(null!=e.audioControl){if("object"!=typeof e.audioControl)throw TypeError(".SdkSignalFrame.audioControl: object expected");t.audioControl=l.SdkAudioControlFrame.fromObject(e.audioControl)}if(null!=e.audioMetadata){if("object"!=typeof e.audioMetadata)throw TypeError(".SdkSignalFrame.audioMetadata: object expected");t.audioMetadata=l.SdkAudioMetadataFrame.fromObject(e.audioMetadata)}if(null!=e.audioStreamIdInfo){if("object"!=typeof e.audioStreamIdInfo)throw TypeError(".SdkSignalFrame.audioStreamIdInfo: object expected");t.audioStreamIdInfo=l.SdkAudioStreamIdInfoFrame.fromObject(e.audioStreamIdInfo)}if(null!=e.pingPong){if("object"!=typeof e.pingPong)throw TypeError(".SdkSignalFrame.pingPong: object expected");t.pingPong=l.SdkPingPongFrame.fromObject(e.pingPong)}if(null!=e.audioStatus){if("object"!=typeof e.audioStatus)throw TypeError(".SdkSignalFrame.audioStatus: object expected");t.audioStatus=l.SdkAudioStatusFrame.fromObject(e.audioStatus)}if(null!=e.clientMetric){if("object"!=typeof e.clientMetric)throw TypeError(".SdkSignalFrame.clientMetric: object expected");t.clientMetric=l.SdkClientMetricFrame.fromObject(e.clientMetric)}if(null!=e.dataMessage){if("object"!=typeof e.dataMessage)throw TypeError(".SdkSignalFrame.dataMessage: object expected");t.dataMessage=l.SdkDataMessageFrame.fromObject(e.dataMessage)}return t},e.toObject=function(e,t){t||(t={});var c={};if(t.defaults){if(s.Long){var n=new s.Long(0,0,!0);c.timestampMs=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else c.timestampMs=t.longs===String?"0":0;c.type=t.enums===String?"JOIN":1,c.error=null,c.join=null,c.joinack=null,c.sub=null,c.suback=null,c.index=null,c.pause=null,c.leave=null,c.leaveAck=null,c.bitrates=null,c.audioControl=null,c.audioMetadata=null,c.audioStreamIdInfo=null,c.pingPong=null,c.audioStatus=null,c.clientMetric=null,c.dataMessage=null}return null!=e.timestampMs&&e.hasOwnProperty("timestampMs")&&("number"==typeof e.timestampMs?c.timestampMs=t.longs===String?String(e.timestampMs):e.timestampMs:c.timestampMs=t.longs===String?s.Long.prototype.toString.call(e.timestampMs):t.longs===Number?new s.LongBits(e.timestampMs.low>>>0,e.timestampMs.high>>>0).toNumber(!0):e.timestampMs),null!=e.type&&e.hasOwnProperty("type")&&(c.type=t.enums===String?l.SdkSignalFrame.Type[e.type]:e.type),null!=e.error&&e.hasOwnProperty("error")&&(c.error=l.SdkErrorFrame.toObject(e.error,t)),null!=e.join&&e.hasOwnProperty("join")&&(c.join=l.SdkJoinFrame.toObject(e.join,t)),null!=e.joinack&&e.hasOwnProperty("joinack")&&(c.joinack=l.SdkJoinAckFrame.toObject(e.joinack,t)),null!=e.sub&&e.hasOwnProperty("sub")&&(c.sub=l.SdkSubscribeFrame.toObject(e.sub,t)),null!=e.suback&&e.hasOwnProperty("suback")&&(c.suback=l.SdkSubscribeAckFrame.toObject(e.suback,t)),null!=e.index&&e.hasOwnProperty("index")&&(c.index=l.SdkIndexFrame.toObject(e.index,t)),null!=e.pause&&e.hasOwnProperty("pause")&&(c.pause=l.SdkPauseResumeFrame.toObject(e.pause,t)),null!=e.leave&&e.hasOwnProperty("leave")&&(c.leave=l.SdkLeaveFrame.toObject(e.leave,t)),null!=e.leaveAck&&e.hasOwnProperty("leaveAck")&&(c.leaveAck=l.SdkLeaveAckFrame.toObject(e.leaveAck,t)),null!=e.bitrates&&e.hasOwnProperty("bitrates")&&(c.bitrates=l.SdkBitrateFrame.toObject(e.bitrates,t)),null!=e.audioControl&&e.hasOwnProperty("audioControl")&&(c.audioControl=l.SdkAudioControlFrame.toObject(e.audioControl,t)),null!=e.audioMetadata&&e.hasOwnProperty("audioMetadata")&&(c.audioMetadata=l.SdkAudioMetadataFrame.toObject(e.audioMetadata,t)),null!=e.audioStreamIdInfo&&e.hasOwnProperty("audioStreamIdInfo")&&(c.audioStreamIdInfo=l.SdkAudioStreamIdInfoFrame.toObject(e.audioStreamIdInfo,t)),null!=e.pingPong&&e.hasOwnProperty("pingPong")&&(c.pingPong=l.SdkPingPongFrame.toObject(e.pingPong,t)),null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&(c.audioStatus=l.SdkAudioStatusFrame.toObject(e.audioStatus,t)),null!=e.clientMetric&&e.hasOwnProperty("clientMetric")&&(c.clientMetric=l.SdkClientMetricFrame.toObject(e.clientMetric,t)),null!=e.dataMessage&&e.hasOwnProperty("dataMessage")&&(c.dataMessage=l.SdkDataMessageFrame.toObject(e.dataMessage,t)),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e.Type=(t={},(c=Object.create(t))[t[1]="JOIN"]=1,c[t[2]="JOIN_ACK"]=2,c[t[3]="SUBSCRIBE"]=3,c[t[4]="SUBSCRIBE_ACK"]=4,c[t[5]="INDEX"]=5,c[t[7]="PAUSE"]=7,c[t[8]="RESUME"]=8,c[t[9]="LEAVE"]=9,c[t[10]="LEAVE_ACK"]=10,c[t[13]="BITRATES"]=13,c[t[16]="AUDIO_CONTROL"]=16,c[t[17]="AUDIO_METADATA"]=17,c[t[18]="AUDIO_STREAM_ID_INFO"]=18,c[t[19]="PING_PONG"]=19,c[t[20]="AUDIO_STATUS"]=20,c[t[21]="CLIENT_METRIC"]=21,c[t[22]="DATA_MESSAGE"]=22,c),e}(),l.SdkErrorFrame=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3){case 1:n.status=e.uint32();break;case 2:n.description=e.string();break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.status&&e.hasOwnProperty("status")&&!s.isInteger(e.status)?"status: integer expected":null!=e.description&&e.hasOwnProperty("description")&&!s.isString(e.description)?"description: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkErrorFrame)return e;var t=new l.SdkErrorFrame;return null!=e.status&&(t.status=e.status>>>0),null!=e.description&&(t.description=String(e.description)),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.status=0,c.description=""),null!=e.status&&e.hasOwnProperty("status")&&(c.status=e.status),null!=e.description&&e.hasOwnProperty("description")&&(c.description=e.description),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkJoinFlags=(n={},(i=Object.create(n))[n[1]="SEND_BITRATES"]=1,i[n[2]="HAS_STREAM_UPDATE"]=2,i[n[8]="USE_SEND_SIDE_BWE"]=8,i[n[16]="COMPLETE_VIDEO_SOURCES_LIST"]=16,i[n[32]="EXCLUDE_SELF_CONTENT_IN_INDEX"]=32,i),l.SdkClientDetails=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3){case 1:n.appVersionName=e.string();break;case 2:n.appVersionCode=e.string();break;case 3:n.deviceModel=e.string();break;case 4:n.deviceMake=e.string();break;case 5:n.platformName=e.string();break;case 6:n.platformVersion=e.string();break;case 7:n.clientSource=e.string();break;case 8:n.chimeSdkVersion=e.string();break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.appVersionName&&e.hasOwnProperty("appVersionName")&&!s.isString(e.appVersionName)?"appVersionName: string expected":null!=e.appVersionCode&&e.hasOwnProperty("appVersionCode")&&!s.isString(e.appVersionCode)?"appVersionCode: string expected":null!=e.deviceModel&&e.hasOwnProperty("deviceModel")&&!s.isString(e.deviceModel)?"deviceModel: string expected":null!=e.deviceMake&&e.hasOwnProperty("deviceMake")&&!s.isString(e.deviceMake)?"deviceMake: string expected":null!=e.platformName&&e.hasOwnProperty("platformName")&&!s.isString(e.platformName)?"platformName: string expected":null!=e.platformVersion&&e.hasOwnProperty("platformVersion")&&!s.isString(e.platformVersion)?"platformVersion: string expected":null!=e.clientSource&&e.hasOwnProperty("clientSource")&&!s.isString(e.clientSource)?"clientSource: string expected":null!=e.chimeSdkVersion&&e.hasOwnProperty("chimeSdkVersion")&&!s.isString(e.chimeSdkVersion)?"chimeSdkVersion: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkClientDetails)return e;var t=new l.SdkClientDetails;return null!=e.appVersionName&&(t.appVersionName=String(e.appVersionName)),null!=e.appVersionCode&&(t.appVersionCode=String(e.appVersionCode)),null!=e.deviceModel&&(t.deviceModel=String(e.deviceModel)),null!=e.deviceMake&&(t.deviceMake=String(e.deviceMake)),null!=e.platformName&&(t.platformName=String(e.platformName)),null!=e.platformVersion&&(t.platformVersion=String(e.platformVersion)),null!=e.clientSource&&(t.clientSource=String(e.clientSource)),null!=e.chimeSdkVersion&&(t.chimeSdkVersion=String(e.chimeSdkVersion)),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.appVersionName="",c.appVersionCode="",c.deviceModel="",c.deviceMake="",c.platformName="",c.platformVersion="",c.clientSource="",c.chimeSdkVersion=""),null!=e.appVersionName&&e.hasOwnProperty("appVersionName")&&(c.appVersionName=e.appVersionName),null!=e.appVersionCode&&e.hasOwnProperty("appVersionCode")&&(c.appVersionCode=e.appVersionCode),null!=e.deviceModel&&e.hasOwnProperty("deviceModel")&&(c.deviceModel=e.deviceModel),null!=e.deviceMake&&e.hasOwnProperty("deviceMake")&&(c.deviceMake=e.deviceMake),null!=e.platformName&&e.hasOwnProperty("platformName")&&(c.platformName=e.platformName),null!=e.platformVersion&&e.hasOwnProperty("platformVersion")&&(c.platformVersion=e.platformVersion),null!=e.clientSource&&e.hasOwnProperty("clientSource")&&(c.clientSource=e.clientSource),null!=e.chimeSdkVersion&&e.hasOwnProperty("chimeSdkVersion")&&(c.chimeSdkVersion=e.chimeSdkVersion),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkJoinFrame=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3){case 1:n.protocolVersion=e.uint32();break;case 2:n.maxNumOfVideos=e.uint32();break;case 3:n.flags=e.uint32();break;case 4:n.clientDetails=l.SdkClientDetails.decode(e,e.uint32());break;case 6:n.audioSessionId=e.uint64();break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.protocolVersion&&e.hasOwnProperty("protocolVersion")&&!s.isInteger(e.protocolVersion))return"protocolVersion: integer expected";if(null!=e.maxNumOfVideos&&e.hasOwnProperty("maxNumOfVideos")&&!s.isInteger(e.maxNumOfVideos))return"maxNumOfVideos: integer expected";if(null!=e.flags&&e.hasOwnProperty("flags")&&!s.isInteger(e.flags))return"flags: integer expected";if(null!=e.clientDetails&&e.hasOwnProperty("clientDetails")){var t=l.SdkClientDetails.verify(e.clientDetails);if(t)return"clientDetails."+t}return null!=e.audioSessionId&&e.hasOwnProperty("audioSessionId")&&!(s.isInteger(e.audioSessionId)||e.audioSessionId&&s.isInteger(e.audioSessionId.low)&&s.isInteger(e.audioSessionId.high))?"audioSessionId: integer|Long expected":null},e.fromObject=function(e){if(e instanceof l.SdkJoinFrame)return e;var t=new l.SdkJoinFrame;if(null!=e.protocolVersion&&(t.protocolVersion=e.protocolVersion>>>0),null!=e.maxNumOfVideos&&(t.maxNumOfVideos=e.maxNumOfVideos>>>0),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.clientDetails){if("object"!=typeof e.clientDetails)throw TypeError(".SdkJoinFrame.clientDetails: object expected");t.clientDetails=l.SdkClientDetails.fromObject(e.clientDetails)}return null!=e.audioSessionId&&(s.Long?(t.audioSessionId=s.Long.fromValue(e.audioSessionId)).unsigned=!0:"string"==typeof e.audioSessionId?t.audioSessionId=parseInt(e.audioSessionId,10):"number"==typeof e.audioSessionId?t.audioSessionId=e.audioSessionId:"object"==typeof e.audioSessionId&&(t.audioSessionId=new s.LongBits(e.audioSessionId.low>>>0,e.audioSessionId.high>>>0).toNumber(!0))),t},e.toObject=function(e,t){t||(t={});var c={};if(t.defaults)if(c.protocolVersion=2,c.maxNumOfVideos=8,c.flags=0,c.clientDetails=null,s.Long){var n=new s.Long(0,0,!0);c.audioSessionId=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else c.audioSessionId=t.longs===String?"0":0;return null!=e.protocolVersion&&e.hasOwnProperty("protocolVersion")&&(c.protocolVersion=e.protocolVersion),null!=e.maxNumOfVideos&&e.hasOwnProperty("maxNumOfVideos")&&(c.maxNumOfVideos=e.maxNumOfVideos),null!=e.flags&&e.hasOwnProperty("flags")&&(c.flags=e.flags),null!=e.clientDetails&&e.hasOwnProperty("clientDetails")&&(c.clientDetails=l.SdkClientDetails.toObject(e.clientDetails,t)),null!=e.audioSessionId&&e.hasOwnProperty("audioSessionId")&&("number"==typeof e.audioSessionId?c.audioSessionId=t.longs===String?String(e.audioSessionId):e.audioSessionId:c.audioSessionId=t.longs===String?s.Long.prototype.toString.call(e.audioSessionId):t.longs===Number?new s.LongBits(e.audioSessionId.low>>>0,e.audioSessionId.high>>>0).toNumber(!0):e.audioSessionId),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkJoinAckFrame=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3==1?n.turnCredentials=l.SdkTurnCredentials.decode(e,e.uint32()):e.skipType(7&i)}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.turnCredentials&&e.hasOwnProperty("turnCredentials")){var t=l.SdkTurnCredentials.verify(e.turnCredentials);if(t)return"turnCredentials."+t}return null},e.fromObject=function(e){if(e instanceof l.SdkJoinAckFrame)return e;var t=new l.SdkJoinAckFrame;if(null!=e.turnCredentials){if("object"!=typeof e.turnCredentials)throw TypeError(".SdkJoinAckFrame.turnCredentials: object expected");t.turnCredentials=l.SdkTurnCredentials.fromObject(e.turnCredentials)}return t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.turnCredentials=null),null!=e.turnCredentials&&e.hasOwnProperty("turnCredentials")&&(c.turnCredentials=l.SdkTurnCredentials.toObject(e.turnCredentials,t)),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkLeaveFrame=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3){case 1:n.duplex=e.int32();break;case 2:n.sendStreams&&n.sendStreams.length||(n.sendStreams=[]),n.sendStreams.push(l.SdkStreamDescriptor.decode(e,e.uint32()));break;case 3:if(n.receiveStreamIds&&n.receiveStreamIds.length||(n.receiveStreamIds=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>0}return null!=e.sdpOffer&&(t.sdpOffer=String(e.sdpOffer)),null!=e.audioHost&&(t.audioHost=String(e.audioHost)),null!=e.audioCheckin&&(t.audioCheckin=Boolean(e.audioCheckin)),null!=e.audioMuted&&(t.audioMuted=Boolean(e.audioMuted)),t},e.toObject=function(e,t){t||(t={});var c={};if((t.arrays||t.defaults)&&(c.sendStreams=[],c.receiveStreamIds=[]),t.defaults&&(c.duplex=t.enums===String?"RX":1,c.sdpOffer="",c.audioHost="",c.audioCheckin=!1,c.audioMuted=!1),null!=e.duplex&&e.hasOwnProperty("duplex")&&(c.duplex=t.enums===String?l.SdkStreamServiceType[e.duplex]:e.duplex),e.sendStreams&&e.sendStreams.length){c.sendStreams=[];for(var n=0;n>>3){case 1:n.duplex=e.int32();break;case 2:n.allocations&&n.allocations.length||(n.allocations=[]),n.allocations.push(l.SdkStreamAllocation.decode(e,e.uint32()));break;case 3:n.sdpAnswer=e.string();break;case 4:n.tracks&&n.tracks.length||(n.tracks=[]),n.tracks.push(l.SdkTrackMapping.decode(e,e.uint32()));break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.duplex&&e.hasOwnProperty("duplex"))switch(e.duplex){default:return"duplex: enum value expected";case 1:case 2:case 3:}if(null!=e.allocations&&e.hasOwnProperty("allocations")){if(!Array.isArray(e.allocations))return"allocations: array expected";for(var t=0;t>>3){case 1:n.atCapacity=e.bool();break;case 2:n.sources&&n.sources.length||(n.sources=[]),n.sources.push(l.SdkStreamDescriptor.decode(e,e.uint32()));break;case 3:if(n.pausedAtSourceIds&&n.pausedAtSourceIds.length||(n.pausedAtSourceIds=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>0}return null!=e.numParticipants&&(t.numParticipants=e.numParticipants>>>0),t},e.toObject=function(e,t){t||(t={});var c={};if((t.arrays||t.defaults)&&(c.sources=[],c.pausedAtSourceIds=[]),t.defaults&&(c.atCapacity=!1,c.numParticipants=0),null!=e.atCapacity&&e.hasOwnProperty("atCapacity")&&(c.atCapacity=e.atCapacity),e.sources&&e.sources.length){c.sources=[];for(var n=0;n>>3==1)if(n.streamIds&&n.streamIds.length||(n.streamIds=[]),2==(7&i))for(var a=e.uint32()+e.pos;e.pos>>0}return t},e.toObject=function(e,t){t||(t={});var c={};if((t.arrays||t.defaults)&&(c.streamIds=[]),e.streamIds&&e.streamIds.length){c.streamIds=[];for(var n=0;n>>3==1?(n.bitrates&&n.bitrates.length||(n.bitrates=[]),n.bitrates.push(l.SdkBitrate.decode(e,e.uint32()))):e.skipType(7&i)}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.bitrates&&e.hasOwnProperty("bitrates")){if(!Array.isArray(e.bitrates))return"bitrates: array expected";for(var t=0;t>>3){case 1:n.streamId=e.uint32();break;case 2:n.framerate=e.uint32();break;case 3:n.maxBitrateKbps=e.uint32();break;case 4:n.trackLabel=e.string();break;case 6:n.groupId=e.uint32();break;case 7:n.avgBitrateBps=e.uint32();break;case 8:n.attendeeId=e.string();break;case 9:n.mediaType=e.int32();break;case 10:n.externalUserId=e.string();break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.streamId&&e.hasOwnProperty("streamId")&&!s.isInteger(e.streamId))return"streamId: integer expected";if(null!=e.framerate&&e.hasOwnProperty("framerate")&&!s.isInteger(e.framerate))return"framerate: integer expected";if(null!=e.maxBitrateKbps&&e.hasOwnProperty("maxBitrateKbps")&&!s.isInteger(e.maxBitrateKbps))return"maxBitrateKbps: integer expected";if(null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!s.isString(e.trackLabel))return"trackLabel: string expected";if(null!=e.groupId&&e.hasOwnProperty("groupId")&&!s.isInteger(e.groupId))return"groupId: integer expected";if(null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&!s.isInteger(e.avgBitrateBps))return"avgBitrateBps: integer expected";if(null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!s.isString(e.attendeeId))return"attendeeId: string expected";if(null!=e.mediaType&&e.hasOwnProperty("mediaType"))switch(e.mediaType){default:return"mediaType: enum value expected";case 1:case 2:}return null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&!s.isString(e.externalUserId)?"externalUserId: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkStreamDescriptor)return e;var t=new l.SdkStreamDescriptor;switch(null!=e.streamId&&(t.streamId=e.streamId>>>0),null!=e.framerate&&(t.framerate=e.framerate>>>0),null!=e.maxBitrateKbps&&(t.maxBitrateKbps=e.maxBitrateKbps>>>0),null!=e.trackLabel&&(t.trackLabel=String(e.trackLabel)),null!=e.groupId&&(t.groupId=e.groupId>>>0),null!=e.avgBitrateBps&&(t.avgBitrateBps=e.avgBitrateBps>>>0),null!=e.attendeeId&&(t.attendeeId=String(e.attendeeId)),e.mediaType){case"AUDIO":case 1:t.mediaType=1;break;case"VIDEO":case 2:t.mediaType=2}return null!=e.externalUserId&&(t.externalUserId=String(e.externalUserId)),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.streamId=0,c.framerate=0,c.maxBitrateKbps=0,c.trackLabel="",c.groupId=0,c.avgBitrateBps=0,c.attendeeId="",c.mediaType=t.enums===String?"AUDIO":1,c.externalUserId=""),null!=e.streamId&&e.hasOwnProperty("streamId")&&(c.streamId=e.streamId),null!=e.framerate&&e.hasOwnProperty("framerate")&&(c.framerate=e.framerate),null!=e.maxBitrateKbps&&e.hasOwnProperty("maxBitrateKbps")&&(c.maxBitrateKbps=e.maxBitrateKbps),null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&(c.trackLabel=e.trackLabel),null!=e.groupId&&e.hasOwnProperty("groupId")&&(c.groupId=e.groupId),null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&(c.avgBitrateBps=e.avgBitrateBps),null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&(c.attendeeId=e.attendeeId),null!=e.mediaType&&e.hasOwnProperty("mediaType")&&(c.mediaType=t.enums===String?l.SdkStreamMediaType[e.mediaType]:e.mediaType),null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&(c.externalUserId=e.externalUserId),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkStreamAllocation=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3){case 1:n.trackLabel=e.string();break;case 2:n.streamId=e.uint32();break;case 3:n.groupId=e.uint32();break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!s.isString(e.trackLabel)?"trackLabel: string expected":null!=e.streamId&&e.hasOwnProperty("streamId")&&!s.isInteger(e.streamId)?"streamId: integer expected":null!=e.groupId&&e.hasOwnProperty("groupId")&&!s.isInteger(e.groupId)?"groupId: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkStreamAllocation)return e;var t=new l.SdkStreamAllocation;return null!=e.trackLabel&&(t.trackLabel=String(e.trackLabel)),null!=e.streamId&&(t.streamId=e.streamId>>>0),null!=e.groupId&&(t.groupId=e.groupId>>>0),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.trackLabel="",c.streamId=0,c.groupId=0),null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&(c.trackLabel=e.trackLabel),null!=e.streamId&&e.hasOwnProperty("streamId")&&(c.streamId=e.streamId),null!=e.groupId&&e.hasOwnProperty("groupId")&&(c.groupId=e.groupId),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkTrackMapping=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3){case 1:n.streamId=e.uint32();break;case 2:n.ssrc=e.uint32();break;case 3:n.trackLabel=e.string();break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.streamId&&e.hasOwnProperty("streamId")&&!s.isInteger(e.streamId)?"streamId: integer expected":null!=e.ssrc&&e.hasOwnProperty("ssrc")&&!s.isInteger(e.ssrc)?"ssrc: integer expected":null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!s.isString(e.trackLabel)?"trackLabel: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkTrackMapping)return e;var t=new l.SdkTrackMapping;return null!=e.streamId&&(t.streamId=e.streamId>>>0),null!=e.ssrc&&(t.ssrc=e.ssrc>>>0),null!=e.trackLabel&&(t.trackLabel=String(e.trackLabel)),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.streamId=0,c.ssrc=0,c.trackLabel=""),null!=e.streamId&&e.hasOwnProperty("streamId")&&(c.streamId=e.streamId),null!=e.ssrc&&e.hasOwnProperty("ssrc")&&(c.ssrc=e.ssrc),null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&(c.trackLabel=e.trackLabel),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkBitrate=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3){case 1:n.sourceStreamId=e.uint32();break;case 2:n.avgBitrateBps=e.uint32();break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.sourceStreamId&&e.hasOwnProperty("sourceStreamId")&&!s.isInteger(e.sourceStreamId)?"sourceStreamId: integer expected":null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&!s.isInteger(e.avgBitrateBps)?"avgBitrateBps: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkBitrate)return e;var t=new l.SdkBitrate;return null!=e.sourceStreamId&&(t.sourceStreamId=e.sourceStreamId>>>0),null!=e.avgBitrateBps&&(t.avgBitrateBps=e.avgBitrateBps>>>0),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.sourceStreamId=0,c.avgBitrateBps=0),null!=e.sourceStreamId&&e.hasOwnProperty("sourceStreamId")&&(c.sourceStreamId=e.sourceStreamId),null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&(c.avgBitrateBps=e.avgBitrateBps),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkAudioControlFrame=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3==1?n.muted=e.bool():e.skipType(7&i)}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.muted&&e.hasOwnProperty("muted")&&"boolean"!=typeof e.muted?"muted: boolean expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioControlFrame)return e;var t=new l.SdkAudioControlFrame;return null!=e.muted&&(t.muted=Boolean(e.muted)),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.muted=!1),null!=e.muted&&e.hasOwnProperty("muted")&&(c.muted=e.muted),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkAudioMetadataFrame=function(){function e(e){if(this.attendeeStates=[],e)for(var t=Object.keys(e),c=0;c>>3==1?(n.attendeeStates&&n.attendeeStates.length||(n.attendeeStates=[]),n.attendeeStates.push(l.SdkAudioAttendeeState.decode(e,e.uint32()))):e.skipType(7&i)}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attendeeStates&&e.hasOwnProperty("attendeeStates")){if(!Array.isArray(e.attendeeStates))return"attendeeStates: array expected";for(var t=0;t>>3){case 1:n.audioStreamId=e.uint32();break;case 2:n.volume=e.uint32();break;case 3:n.muted=e.bool();break;case 4:n.signalStrength=e.uint32();break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&!s.isInteger(e.audioStreamId)?"audioStreamId: integer expected":null!=e.volume&&e.hasOwnProperty("volume")&&!s.isInteger(e.volume)?"volume: integer expected":null!=e.muted&&e.hasOwnProperty("muted")&&"boolean"!=typeof e.muted?"muted: boolean expected":null!=e.signalStrength&&e.hasOwnProperty("signalStrength")&&!s.isInteger(e.signalStrength)?"signalStrength: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioAttendeeState)return e;var t=new l.SdkAudioAttendeeState;return null!=e.audioStreamId&&(t.audioStreamId=e.audioStreamId>>>0),null!=e.volume&&(t.volume=e.volume>>>0),null!=e.muted&&(t.muted=Boolean(e.muted)),null!=e.signalStrength&&(t.signalStrength=e.signalStrength>>>0),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.audioStreamId=0,c.volume=0,c.muted=!1,c.signalStrength=0),null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&(c.audioStreamId=e.audioStreamId),null!=e.volume&&e.hasOwnProperty("volume")&&(c.volume=e.volume),null!=e.muted&&e.hasOwnProperty("muted")&&(c.muted=e.muted),null!=e.signalStrength&&e.hasOwnProperty("signalStrength")&&(c.signalStrength=e.signalStrength),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkAudioStreamIdInfoFrame=function(){function e(e){if(this.streams=[],e)for(var t=Object.keys(e),c=0;c>>3==1?(n.streams&&n.streams.length||(n.streams=[]),n.streams.push(l.SdkAudioStreamIdInfo.decode(e,e.uint32()))):e.skipType(7&i)}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.streams&&e.hasOwnProperty("streams")){if(!Array.isArray(e.streams))return"streams: array expected";for(var t=0;t>>3){case 1:n.audioStreamId=e.uint32();break;case 2:n.attendeeId=e.string();break;case 3:n.muted=e.bool();break;case 4:n.externalUserId=e.string();break;case 5:n.dropped=e.bool();break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&!s.isInteger(e.audioStreamId)?"audioStreamId: integer expected":null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!s.isString(e.attendeeId)?"attendeeId: string expected":null!=e.muted&&e.hasOwnProperty("muted")&&"boolean"!=typeof e.muted?"muted: boolean expected":null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&!s.isString(e.externalUserId)?"externalUserId: string expected":null!=e.dropped&&e.hasOwnProperty("dropped")&&"boolean"!=typeof e.dropped?"dropped: boolean expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioStreamIdInfo)return e;var t=new l.SdkAudioStreamIdInfo;return null!=e.audioStreamId&&(t.audioStreamId=e.audioStreamId>>>0),null!=e.attendeeId&&(t.attendeeId=String(e.attendeeId)),null!=e.muted&&(t.muted=Boolean(e.muted)),null!=e.externalUserId&&(t.externalUserId=String(e.externalUserId)),null!=e.dropped&&(t.dropped=Boolean(e.dropped)),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.audioStreamId=0,c.attendeeId="",c.muted=!1,c.externalUserId="",c.dropped=!1),null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&(c.audioStreamId=e.audioStreamId),null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&(c.attendeeId=e.attendeeId),null!=e.muted&&e.hasOwnProperty("muted")&&(c.muted=e.muted),null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&(c.externalUserId=e.externalUserId),null!=e.dropped&&e.hasOwnProperty("dropped")&&(c.dropped=e.dropped),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkPingPongType=function(){var e={},t=Object.create(e);return t[e[1]="PING"]=1,t[e[2]="PONG"]=2,t}(),l.SdkPingPongFrame=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3){case 1:n.type=e.int32();break;case 2:n.pingId=e.uint32();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("type"))throw s.ProtocolError("missing required 'type'",{instance:n});if(!n.hasOwnProperty("pingId"))throw s.ProtocolError("missing required 'pingId'",{instance:n});return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";switch(e.type){default:return"type: enum value expected";case 1:case 2:}return s.isInteger(e.pingId)?null:"pingId: integer expected"},e.fromObject=function(e){if(e instanceof l.SdkPingPongFrame)return e;var t=new l.SdkPingPongFrame;switch(e.type){case"PING":case 1:t.type=1;break;case"PONG":case 2:t.type=2}return null!=e.pingId&&(t.pingId=e.pingId>>>0),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.type=t.enums===String?"PING":1,c.pingId=0),null!=e.type&&e.hasOwnProperty("type")&&(c.type=t.enums===String?l.SdkPingPongType[e.type]:e.type),null!=e.pingId&&e.hasOwnProperty("pingId")&&(c.pingId=e.pingId),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkAudioStatusFrame=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3==1?n.audioStatus=e.uint32():e.skipType(7&i)}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&!s.isInteger(e.audioStatus)?"audioStatus: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioStatusFrame)return e;var t=new l.SdkAudioStatusFrame;return null!=e.audioStatus&&(t.audioStatus=e.audioStatus>>>0),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.audioStatus=0),null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&(c.audioStatus=e.audioStatus),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkMetric=function(){function e(e){if(e)for(var t=Object.keys(e),c=0;c>>3){case 1:n.type=e.int32();break;case 2:n.value=e.double();break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.type&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 66:case 72:}return null!=e.value&&e.hasOwnProperty("value")&&"number"!=typeof e.value?"value: number expected":null},e.fromObject=function(e){if(e instanceof l.SdkMetric)return e;var t=new l.SdkMetric;switch(e.type){case"VIDEO_ACTUAL_ENCODER_BITRATE":case 1:t.type=1;break;case"VIDEO_AVAILABLE_SEND_BANDWIDTH":case 2:t.type=2;break;case"VIDEO_RETRANSMIT_BITRATE":case 3:t.type=3;break;case"VIDEO_AVAILABLE_RECEIVE_BANDWIDTH":case 4:t.type=4;break;case"VIDEO_TARGET_ENCODER_BITRATE":case 5:t.type=5;break;case"VIDEO_BUCKET_DELAY_MS":case 6:t.type=6;break;case"STUN_RTT_MS":case 7:t.type=7;break;case"SOCKET_DISCARDED_PPS":case 8:t.type=8;break;case"RTC_MIC_JITTER_MS":case 9:t.type=9;break;case"RTC_MIC_PPS":case 10:t.type=10;break;case"RTC_MIC_FRACTION_PACKET_LOST_PERCENT":case 11:t.type=11;break;case"RTC_MIC_BITRATE":case 12:t.type=12;break;case"RTC_MIC_RTT_MS":case 13:t.type=13;break;case"RTC_SPK_PPS":case 14:t.type=14;break;case"RTC_SPK_FRACTION_PACKET_LOST_PERCENT":case 15:t.type=15;break;case"RTC_SPK_JITTER_MS":case 16:t.type=16;break;case"RTC_SPK_FRACTION_DECODER_LOSS_PERCENT":case 17:t.type=17;break;case"RTC_SPK_BITRATE":case 18:t.type=18;break;case"RTC_SPK_CURRENT_DELAY_MS":case 19:t.type=19;break;case"RTC_SPK_JITTER_BUFFER_MS":case 20:t.type=20;break;case"VIDEO_SENT_RTT_MS":case 21:t.type=21;break;case"VIDEO_ENCODE_USAGE_PERCENT":case 22:t.type=22;break;case"VIDEO_NACKS_RECEIVED":case 23:t.type=23;break;case"VIDEO_PLIS_RECEIVED":case 24:t.type=24;break;case"VIDEO_AVERAGE_ENCODE_MS":case 25:t.type=25;break;case"VIDEO_INPUT_FPS":case 26:t.type=26;break;case"VIDEO_ENCODE_FPS":case 27:t.type=27;break;case"VIDEO_SENT_FPS":case 28:t.type=28;break;case"VIDEO_FIRS_RECEIVED":case 29:t.type=29;break;case"VIDEO_SENT_PPS":case 30:t.type=30;break;case"VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT":case 31:t.type=31;break;case"VIDEO_SENT_BITRATE":case 32:t.type=32;break;case"VIDEO_DROPPED_FPS":case 33:t.type=33;break;case"VIDEO_TARGET_DELAY_MS":case 34:t.type=34;break;case"VIDEO_DECODE_MS":case 35:t.type=35;break;case"VIDEO_OUTPUT_FPS":case 36:t.type=36;break;case"VIDEO_RECEIVED_PPS":case 37:t.type=37;break;case"VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT":case 38:t.type=38;break;case"VIDEO_RENDER_DELAY_MS":case 39:t.type=39;break;case"VIDEO_RECEIVED_FPS":case 40:t.type=40;break;case"VIDEO_DECODE_FPS":case 41:t.type=41;break;case"VIDEO_NACKS_SENT":case 42:t.type=42;break;case"VIDEO_FIRS_SENT":case 43:t.type=43;break;case"VIDEO_RECEIVED_BITRATE":case 44:t.type=44;break;case"VIDEO_CURRENT_DELAY_MS":case 45:t.type=45;break;case"VIDEO_JITTER_BUFFER_MS":case 46:t.type=46;break;case"VIDEO_DISCARDED_PPS":case 47:t.type=47;break;case"VIDEO_PLIS_SENT":case 48:t.type=48;break;case"VIDEO_RECEIVED_JITTER_MS":case 49:t.type=49;break;case"VIDEO_SENT_QP_SUM":case 66:t.type=66;break;case"VIDEO_RECEIVED_QP_SUM":case 72:t.type=72}return null!=e.value&&(t.value=Number(e.value)),t},e.toObject=function(e,t){t||(t={});var c={};return t.defaults&&(c.type=t.enums===String?"VIDEO_ACTUAL_ENCODER_BITRATE":1,c.value=0),null!=e.type&&e.hasOwnProperty("type")&&(c.type=t.enums===String?l.SdkMetric.Type[e.type]:e.type),null!=e.value&&e.hasOwnProperty("value")&&(c.value=t.json&&!isFinite(e.value)?String(e.value):e.value),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e.Type=function(){var e={},t=Object.create(e);return t[e[1]="VIDEO_ACTUAL_ENCODER_BITRATE"]=1,t[e[2]="VIDEO_AVAILABLE_SEND_BANDWIDTH"]=2,t[e[3]="VIDEO_RETRANSMIT_BITRATE"]=3,t[e[4]="VIDEO_AVAILABLE_RECEIVE_BANDWIDTH"]=4,t[e[5]="VIDEO_TARGET_ENCODER_BITRATE"]=5,t[e[6]="VIDEO_BUCKET_DELAY_MS"]=6,t[e[7]="STUN_RTT_MS"]=7,t[e[8]="SOCKET_DISCARDED_PPS"]=8,t[e[9]="RTC_MIC_JITTER_MS"]=9,t[e[10]="RTC_MIC_PPS"]=10,t[e[11]="RTC_MIC_FRACTION_PACKET_LOST_PERCENT"]=11,t[e[12]="RTC_MIC_BITRATE"]=12,t[e[13]="RTC_MIC_RTT_MS"]=13,t[e[14]="RTC_SPK_PPS"]=14,t[e[15]="RTC_SPK_FRACTION_PACKET_LOST_PERCENT"]=15,t[e[16]="RTC_SPK_JITTER_MS"]=16,t[e[17]="RTC_SPK_FRACTION_DECODER_LOSS_PERCENT"]=17,t[e[18]="RTC_SPK_BITRATE"]=18,t[e[19]="RTC_SPK_CURRENT_DELAY_MS"]=19,t[e[20]="RTC_SPK_JITTER_BUFFER_MS"]=20,t[e[21]="VIDEO_SENT_RTT_MS"]=21,t[e[22]="VIDEO_ENCODE_USAGE_PERCENT"]=22,t[e[23]="VIDEO_NACKS_RECEIVED"]=23,t[e[24]="VIDEO_PLIS_RECEIVED"]=24,t[e[25]="VIDEO_AVERAGE_ENCODE_MS"]=25,t[e[26]="VIDEO_INPUT_FPS"]=26,t[e[27]="VIDEO_ENCODE_FPS"]=27,t[e[28]="VIDEO_SENT_FPS"]=28,t[e[29]="VIDEO_FIRS_RECEIVED"]=29,t[e[30]="VIDEO_SENT_PPS"]=30,t[e[31]="VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT"]=31,t[e[32]="VIDEO_SENT_BITRATE"]=32,t[e[33]="VIDEO_DROPPED_FPS"]=33,t[e[34]="VIDEO_TARGET_DELAY_MS"]=34,t[e[35]="VIDEO_DECODE_MS"]=35,t[e[36]="VIDEO_OUTPUT_FPS"]=36,t[e[37]="VIDEO_RECEIVED_PPS"]=37,t[e[38]="VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT"]=38,t[e[39]="VIDEO_RENDER_DELAY_MS"]=39,t[e[40]="VIDEO_RECEIVED_FPS"]=40,t[e[41]="VIDEO_DECODE_FPS"]=41,t[e[42]="VIDEO_NACKS_SENT"]=42,t[e[43]="VIDEO_FIRS_SENT"]=43,t[e[44]="VIDEO_RECEIVED_BITRATE"]=44,t[e[45]="VIDEO_CURRENT_DELAY_MS"]=45,t[e[46]="VIDEO_JITTER_BUFFER_MS"]=46,t[e[47]="VIDEO_DISCARDED_PPS"]=47,t[e[48]="VIDEO_PLIS_SENT"]=48,t[e[49]="VIDEO_RECEIVED_JITTER_MS"]=49,t[e[66]="VIDEO_SENT_QP_SUM"]=66,t[e[72]="VIDEO_RECEIVED_QP_SUM"]=72,t}(),e}(),l.SdkStreamMetricFrame=function(){function e(e){if(this.metrics=[],e)for(var t=Object.keys(e),c=0;c>>3){case 3:n.streamId=e.uint32();break;case 4:n.groupId=e.uint32();break;case 5:n.metrics&&n.metrics.length||(n.metrics=[]),n.metrics.push(l.SdkMetric.decode(e,e.uint32()));break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.streamId&&e.hasOwnProperty("streamId")&&!s.isInteger(e.streamId))return"streamId: integer expected";if(null!=e.groupId&&e.hasOwnProperty("groupId")&&!s.isInteger(e.groupId))return"groupId: integer expected";if(null!=e.metrics&&e.hasOwnProperty("metrics")){if(!Array.isArray(e.metrics))return"metrics: array expected";for(var t=0;t>>0),null!=e.groupId&&(t.groupId=e.groupId>>>0),e.metrics){if(!Array.isArray(e.metrics))throw TypeError(".SdkStreamMetricFrame.metrics: array expected");t.metrics=[];for(var c=0;c>>3){case 1:n.globalMetrics&&n.globalMetrics.length||(n.globalMetrics=[]),n.globalMetrics.push(l.SdkMetric.decode(e,e.uint32()));break;case 2:n.streamMetricFrames&&n.streamMetricFrames.length||(n.streamMetricFrames=[]),n.streamMetricFrames.push(l.SdkStreamMetricFrame.decode(e,e.uint32()));break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.globalMetrics&&e.hasOwnProperty("globalMetrics")){if(!Array.isArray(e.globalMetrics))return"globalMetrics: array expected";for(var t=0;t>>3==1?(n.messages&&n.messages.length||(n.messages=[]),n.messages.push(l.SdkDataMessagePayload.decode(e,e.uint32()))):e.skipType(7&i)}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.messages&&e.hasOwnProperty("messages")){if(!Array.isArray(e.messages))return"messages: array expected";for(var t=0;t>>3){case 1:n.topic=e.string();break;case 2:n.data=e.bytes();break;case 3:n.lifetimeMs=e.uint32();break;case 4:n.senderAttendeeId=e.string();break;case 5:n.ingestTimeNs=e.int64();break;case 6:n.senderExternalUserId=e.string();break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.topic&&e.hasOwnProperty("topic")&&!s.isString(e.topic)?"topic: string expected":null!=e.data&&e.hasOwnProperty("data")&&!(e.data&&"number"==typeof e.data.length||s.isString(e.data))?"data: buffer expected":null!=e.lifetimeMs&&e.hasOwnProperty("lifetimeMs")&&!s.isInteger(e.lifetimeMs)?"lifetimeMs: integer expected":null!=e.senderAttendeeId&&e.hasOwnProperty("senderAttendeeId")&&!s.isString(e.senderAttendeeId)?"senderAttendeeId: string expected":null!=e.ingestTimeNs&&e.hasOwnProperty("ingestTimeNs")&&!(s.isInteger(e.ingestTimeNs)||e.ingestTimeNs&&s.isInteger(e.ingestTimeNs.low)&&s.isInteger(e.ingestTimeNs.high))?"ingestTimeNs: integer|Long expected":null!=e.senderExternalUserId&&e.hasOwnProperty("senderExternalUserId")&&!s.isString(e.senderExternalUserId)?"senderExternalUserId: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkDataMessagePayload)return e;var t=new l.SdkDataMessagePayload;return null!=e.topic&&(t.topic=String(e.topic)),null!=e.data&&("string"==typeof e.data?s.base64.decode(e.data,t.data=s.newBuffer(s.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.lifetimeMs&&(t.lifetimeMs=e.lifetimeMs>>>0),null!=e.senderAttendeeId&&(t.senderAttendeeId=String(e.senderAttendeeId)),null!=e.ingestTimeNs&&(s.Long?(t.ingestTimeNs=s.Long.fromValue(e.ingestTimeNs)).unsigned=!1:"string"==typeof e.ingestTimeNs?t.ingestTimeNs=parseInt(e.ingestTimeNs,10):"number"==typeof e.ingestTimeNs?t.ingestTimeNs=e.ingestTimeNs:"object"==typeof e.ingestTimeNs&&(t.ingestTimeNs=new s.LongBits(e.ingestTimeNs.low>>>0,e.ingestTimeNs.high>>>0).toNumber())),null!=e.senderExternalUserId&&(t.senderExternalUserId=String(e.senderExternalUserId)),t},e.toObject=function(e,t){t||(t={});var c={};if(t.defaults){if(c.topic="",t.bytes===String?c.data="":(c.data=[],t.bytes!==Array&&(c.data=s.newBuffer(c.data))),c.lifetimeMs=0,c.senderAttendeeId="",s.Long){var n=new s.Long(0,0,!1);c.ingestTimeNs=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else c.ingestTimeNs=t.longs===String?"0":0;c.senderExternalUserId=""}return null!=e.topic&&e.hasOwnProperty("topic")&&(c.topic=e.topic),null!=e.data&&e.hasOwnProperty("data")&&(c.data=t.bytes===String?s.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),null!=e.lifetimeMs&&e.hasOwnProperty("lifetimeMs")&&(c.lifetimeMs=e.lifetimeMs),null!=e.senderAttendeeId&&e.hasOwnProperty("senderAttendeeId")&&(c.senderAttendeeId=e.senderAttendeeId),null!=e.ingestTimeNs&&e.hasOwnProperty("ingestTimeNs")&&("number"==typeof e.ingestTimeNs?c.ingestTimeNs=t.longs===String?String(e.ingestTimeNs):e.ingestTimeNs:c.ingestTimeNs=t.longs===String?s.Long.prototype.toString.call(e.ingestTimeNs):t.longs===Number?new s.LongBits(e.ingestTimeNs.low>>>0,e.ingestTimeNs.high>>>0).toNumber():e.ingestTimeNs),null!=e.senderExternalUserId&&e.hasOwnProperty("senderExternalUserId")&&(c.senderExternalUserId=e.senderExternalUserId),c},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkTurnCredentials=function(){function e(e){if(this.uris=[],e)for(var t=Object.keys(e),c=0;c>>3){case 1:n.username=e.string();break;case 2:n.password=e.string();break;case 3:n.ttl=e.uint32();break;case 4:n.uris&&n.uris.length||(n.uris=[]),n.uris.push(e.string());break;default:e.skipType(7&i)}}return n},e.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.username&&e.hasOwnProperty("username")&&!s.isString(e.username))return"username: string expected";if(null!=e.password&&e.hasOwnProperty("password")&&!s.isString(e.password))return"password: string expected";if(null!=e.ttl&&e.hasOwnProperty("ttl")&&!s.isInteger(e.ttl))return"ttl: integer expected";if(null!=e.uris&&e.hasOwnProperty("uris")){if(!Array.isArray(e.uris))return"uris: array expected";for(var t=0;t>>0),e.uris){if(!Array.isArray(e.uris))throw TypeError(".SdkTurnCredentials.uris: array expected");t.uris=[];for(var c=0;c{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(4046);t.default=class{constructor(e,t){this.chimeClient=e,this.awsClient=t}makeTwoDigits(e){return e>9?e.toString():"0"+e.toString()}getDateTimeString(){const e=new Date;return e.getUTCFullYear()+this.makeTwoDigits(e.getUTCMonth()+1)+this.makeTwoDigits(e.getUTCDate())+"T"+this.makeTwoDigits(e.getUTCHours())+this.makeTwoDigits(e.getUTCMinutes())+this.makeTwoDigits(e.getUTCSeconds())+"Z"}getDateString(e){return e.substring(0,e.indexOf("T"))}getSignatureKey(e,t,c,n){const i=this.awsClient.util.crypto.hmac("AWS4"+e,t,"buffer"),a=this.awsClient.util.crypto.hmac(i,c,"buffer"),r=this.awsClient.util.crypto.hmac(a,n,"buffer");return this.awsClient.util.crypto.hmac(r,"aws4_request","buffer")}signURL(e,t,c,i,a,r,o){const s=this.getDateTimeString(),l=this.getDateString(s),u=this.chimeClient.config.region,f="host:"+i.toLowerCase()+"\n",d=l+"/"+u+"/"+c+"/aws4_request",h=this.chimeClient.config.credentials;let m=new Map;m.set("X-Amz-Algorithm",["AWS4-HMAC-SHA256"]),m.set("X-Amz-Credential",[encodeURIComponent(h.accessKeyId+"/"+d)]),m.set("X-Amz-Date",[s]),m.set("X-Amz-Expires",["10"]),m.set("X-Amz-SignedHeaders",["host"]),h.sessionToken&&m.set("X-Amz-Security-Token",[encodeURIComponent(h.sessionToken)]),m.set(n.default.X_AMZN_VERSION,[encodeURIComponent(n.default.sdkVersion)]),m.set(n.default.X_AMZN_USER_AGENT,[encodeURIComponent(n.default.sdkUserAgentLowResolution)]),null==o||o.forEach(((e,t)=>{const c=encodeURIComponent(t);e.sort().forEach((e=>{m.has(c)||m.set(c,[]),m.get(c).push(encodeURIComponent(e))}))}));let p="";m=new Map([...m.entries()].sort()),m.forEach(((e,t)=>{e.forEach((e=>{p.length&&(p+="&"),p+=t+"="+e}))}));const v=e+"\n"+a+"\n"+p+"\n"+f+"\nhost\n"+this.awsClient.util.crypto.sha256(r,"hex"),g="AWS4-HMAC-SHA256\n"+s+"\n"+l+"/"+u+"/"+c+"/aws4_request\n"+this.awsClient.util.crypto.sha256(v,"hex"),b=this.getSignatureKey(h.secretAccessKey,l,u,c),z=this.awsClient.util.crypto.hmac(b,g,"hex");return t+"://"+i+a+"?"+p+"&X-Amz-Signature="+z}}},7606:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.SimulcastLayers=void 0,function(e){e[e.Low=0]="Low",e[e.LowAndMedium=1]="LowAndMedium",e[e.LowAndHigh=2]="LowAndHigh",e[e.Medium=3]="Medium",e[e.MediumAndHigh=4]="MediumAndHigh",e[e.High=5]="High"}(c=t.SimulcastLayers||(t.SimulcastLayers={})),t.default=c},9880:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.AudioLogEvent=void 0,function(e){e[e.DeviceChanged=0]="DeviceChanged",e[e.MutedLocal=1]="MutedLocal",e[e.UnmutedLocal=2]="UnmutedLocal",e[e.Connected=3]="Connected",e[e.ConnectFailed=4]="ConnectFailed",e[e.RedmicStartLoss=5]="RedmicStartLoss",e[e.RedmicEndLoss=6]="RedmicEndLoss"}(c=t.AudioLogEvent||(t.AudioLogEvent={})),t.default=c},9636:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(6196),i=c(9496),a=c(6893),r=c(2811),o=c(7086),s=c(7604),l=c(1296),u=c(3922),f=c(289),d=c(9880),h=c(155);class m{constructor(e,t,c,n=m.INTERVAL_MS){this.audioVideoController=e,this.logger=t,this.browserBehavior=c,this.interval=n,this.intervalScheduler=null,this.metricsAddTime=(e,t,c)=>{},this.metricsLogEvent=(e,t)=>{}}toAttribute(e){return this.toSuffix(e).substring(1)}toSuffix(e){return e.toLowerCase()===e?`_${e}`:e.toUpperCase()===e?`_${e.toLowerCase()}`:e.replace(/([A-Z][a-z]+)/g,(function(e){return`_${e}`})).replace(/([A-Z][A-Z]+)/g,(function(e){return`_${e}`})).toLowerCase()}logLatency(e,t,c){const n=this.toSuffix(e);this.logEventTime("meeting"+n,t,c)}logStateTimeout(e,t){const c=this.toSuffix(e);this.logEvent("meeting_session_state_timeout",Object.assign(Object.assign({},t),{state:`state${c}`}))}logAudioEvent(e,t){const c="audio"+this.toSuffix(d.default[e]);this.logEvent(c,t)}logVideoEvent(e,t){const c="video"+this.toSuffix(h.default[e]);this.logEvent(c,t)}logEventTime(e,t,c={}){const n=Object.assign(Object.assign({},c),{call_id:this.audioVideoController.configuration.meetingId,client_type:m.CLIENT_TYPE,metric_type:"latency"});this.logger.debug((()=>`[DefaultStatsCollector] ${e}: ${JSON.stringify(n)}`)),this.metricsAddTime(e,t,n)}logMeetingSessionStatus(e){const t=`${e.statusCode()}`;this.logEvent(t);const c={status:t,status_code:`${e.statusCode()}`};this.logEvent("meeting_session_status",c),e.isTerminal()&&this.logEvent("meeting_session_stopped",c),e.isAudioConnectionFailure()&&this.logEvent("meeting_session_audio_failed",c),e.isFailure()&&this.logEvent("meeting_session_failed",c)}logLifecycleEvent(e,t){const c={lifecycle_event:`lifecycle${this.toSuffix(s.default[e])}`,lifecycle_event_code:`${e}`,lifecycle_event_condition:`condition${this.toSuffix(l.default[t])}`,lifecycle_event_condition_code:`${t}`};this.logEvent("meeting_session_lifecycle",c)}logEvent(e,t={}){const c=Object.assign(Object.assign({},t),{call_id:this.audioVideoController.configuration.meetingId,client_type:m.CLIENT_TYPE});this.logger.debug((()=>`[DefaultStatsCollector] ${e}: ${JSON.stringify(c)}`)),this.metricsLogEvent(e,c)}start(e,t,c){return!this.intervalScheduler&&(this.logger.info("Starting DefaultStatsCollector"),this.signalingClient=e,this.videoStreamIndex=t,this.clientMetricReport=c||new a.default(this.logger),this.intervalScheduler=new u.default(this.interval),this.intervalScheduler.start((()=>{this.getStatsWrapper()})),!0)}stop(){this.logger.info("Stopping DefaultStatsCollector"),this.intervalScheduler&&this.intervalScheduler.stop(),this.intervalScheduler=null}updateMetricValues(e,t){const c=t?this.clientMetricReport.streamMetricReports[Number(e.ssrc)]:this.clientMetricReport.globalMetricReport;let n;n=t?this.clientMetricReport.getMetricMap(c.mediaType,c.direction):this.clientMetricReport.getMetricMap();for(const t in e)t in n&&(c.previousMetrics[t]=c.currentMetrics[t],c.currentMetrics[t]=e[t])}processRawMetricReports(e){this.clientMetricReport.currentSsrcs={};const t=Date.now();for(const t of e){const e=this.isStreamRawMetricReport(t.type);if(e){if(!this.clientMetricReport.streamMetricReports[Number(t.ssrc)]){const e=new r.default;e.mediaType=this.getMediaType(t),e.direction=this.getDirectionType(t),this.videoStreamIndex.allStreams().empty()||(e.streamId=this.videoStreamIndex.streamIdForSSRC(Number(t.ssrc))),this.clientMetricReport.streamMetricReports[Number(t.ssrc)]=e}this.clientMetricReport.currentSsrcs[Number(t.ssrc)]=1}this.updateMetricValues(t,e)}this.clientMetricReport.removeDestroyedSsrcs(),this.clientMetricReport.previousTimestampMs=this.clientMetricReport.currentTimestampMs,this.clientMetricReport.currentTimestampMs=t,this.clientMetricReport.print()}addMetricFrame(e,t,c,n){const i=c.type,a=c.transform,r=c.source,o=t.streamMetricFrames.length,s=t.streamMetricFrames[o-1];if(i){const c=f.SdkMetric.create();c.type=i,c.value=a(r||e,n),n?s.metrics.push(c):t.globalMetrics.push(c)}}addGlobalMetricsToProtobuf(e){const t=this.clientMetricReport.getMetricMap();for(const c in this.clientMetricReport.globalMetricReport.currentMetrics)this.addMetricFrame(c,e,t[c])}addStreamMetricsToProtobuf(e){for(const t in this.clientMetricReport.streamMetricReports){const c=this.clientMetricReport.streamMetricReports[t],n=f.SdkStreamMetricFrame.create();n.streamId=c.streamId,n.metrics=[],e.streamMetricFrames.push(n);const i=this.clientMetricReport.getMetricMap(c.mediaType,c.direction);for(const n in c.currentMetrics)this.addMetricFrame(n,e,i[n],Number(t))}}makeClientMetricProtobuf(){const e=f.SdkClientMetricFrame.create();return e.globalMetrics=[],e.streamMetricFrames=[],this.addGlobalMetricsToProtobuf(e),this.addStreamMetricsToProtobuf(e),e}sendClientMetricProtobuf(e){this.signalingClient.sendClientMetrics(e)}isStreamRawMetricReport(e){return"ssrc"===e||"inbound-rtp"===e||"outbound-rtp"===e}getMediaType(e){return"audio"===e.mediaType?i.default.AUDIO:i.default.VIDEO}getDirectionType(e){return-1!==e.id.toLowerCase().indexOf("send")||-1!==e.id.toLowerCase().indexOf("outbound")?n.default.UPSTREAM:n.default.DOWNSTREAM}isValidChromeRawMetric(e){return this.browserBehavior.hasChromiumWebRTC()&&("ssrc"===e.type||"VideoBwe"===e.type||"googCandidatePair"===e.type&&"true"===e.googWritable&&"true"===e.googReadable)}isValidStandardRawMetric(e){const t="inbound-rtp"===e.type||"outbound-rtp"===e.type||"candidate-pair"===e.type&&"succeeded"===e.state;return this.browserBehavior.hasFirefoxWebRTC()?-1===this.compareMajorVersion(m.FIREFOX_UPDATED_GET_STATS_VERSION)?t:t&&!1===e.isRemote:t}isValidSsrc(e){let t=!0;return this.isStreamRawMetricReport(e.type)&&this.getDirectionType(e)===n.default.DOWNSTREAM&&this.getMediaType(e)===i.default.VIDEO&&(t=this.videoStreamIndex.streamIdForSSRC(Number(e.ssrc))>0),t}isValidRawMetricReport(e){return(this.isValidChromeRawMetric(e)||this.isValidStandardRawMetric(e))&&this.isValidSsrc(e)}filterRawMetricReports(e){const t=[];for(const c of e)this.isValidRawMetricReport(c)&&t.push(c);return t}handleRawMetricReports(e){const t=this.filterRawMetricReports(e);this.logger.debug((()=>`Filtered raw metrics : ${JSON.stringify(t)}`)),this.processRawMetricReports(t);const c=this.makeClientMetricProtobuf();this.sendClientMetricProtobuf(c),this.audioVideoController.forEachObserver((e=>{o.default.of(e.metricsDidReceive).map((t=>t.bind(e)(this.clientMetricReport.clone())))}))}getStatsWrapper(){if(!this.audioVideoController.rtcPeerConnection)return;const e=[];this.browserBehavior.requiresPromiseBasedWebRTCGetStats()?this.audioVideoController.rtcPeerConnection.getStats().then((t=>{t.forEach((t=>{e.push(t)})),this.handleRawMetricReports(e)})).catch((e=>{this.logger.error(e.message)})):this.audioVideoController.rtcPeerConnection.getStats((t=>{t.result().forEach((t=>{const c={};t.names().forEach((e=>{c[e]=t.stat(e)})),c.id=t.id,c.type=t.type,c.timestamp=t.timestamp,e.push(c)})),this.handleRawMetricReports(e)}),(e=>{this.logger.error(e.message)}))}compareMajorVersion(e){const t=parseInt(this.browserBehavior.version().split(".")[0]),c=parseInt(e.split(".")[0]);return c===t?0:c>t?1:-1}}t.default=m,m.INTERVAL_MS=1e3,m.FIREFOX_UPDATED_GET_STATS_VERSION="66.0.0",m.CLIENT_TYPE="amazon-chime-sdk-js"},155:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.VideoLogEvent=void 0,function(e){e[e.InputAttached=0]="InputAttached",e[e.SendingFailed=1]="SendingFailed",e[e.SendingSuccess=2]="SendingSuccess"}(c=t.VideoLogEvent||(t.VideoLogEvent={})),t.default=c},8358:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(155),a=c(1789);class r extends a.default{constructor(e){super(e.logger),this.context=e,this.taskName="AttachMediaInputTask"}run(){return n(this,void 0,void 0,(function*(){const e=this.context.transceiverController;e.setPeer(this.context.peer),e.setupLocalTransceivers();const t=this.context.activeAudioInput;if(t){const c=t.getAudioTracks();if(this.context.browserBehavior.requiresUnifiedPlan())this.context.logger.info("attaching audio track to peer connection (unified-plan)"),yield e.setAudioInput(c.length?c[0]:null);else{this.context.logger.info("attaching audio track to peer connection (plan-b)");const e=this.context.peer.getSenders();t.getAudioTracks().forEach((c=>{e.find((e=>e.track.id===c.id))||(this.context.localAudioSender=this.context.peer.addTrack(c,t))}))}}else yield e.setAudioInput(null),this.context.logger.warn("no audio track");const c=this.context.activeVideoInput;if(c){const t=c.getVideoTracks(),n=t.length?t[0]:null;if(this.context.browserBehavior.requiresUnifiedPlan()){if(this.context.logger.info("attaching video track to peer connection (unified-plan)"),yield e.setVideoInput(n),this.context.enableSimulcast&&this.context.videoUplinkBandwidthPolicy){const t=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();e.setEncodingParameters(t)}}else this.context.logger.info("attaching video track to peer connection (plan-b)"),this.context.peer.getSenders().find((e=>e.track&&e.track.id===t[0].id))||(this.context.localVideoSender&&(this.context.peer.removeTrack(this.context.localVideoSender),this.context.localVideoSender=null),this.context.localVideoSender=this.context.peer.addTrack(t[0],c));n&&(this.context.statsCollector.logVideoEvent(i.default.InputAttached,this.context.videoDeviceInformation),this.context.videoInputAttachedTimestampMs=Date.now())}else yield e.setVideoInput(null),this.context.logger.info("no video track"),this.context.localVideoSender&&(this.context.logger.info("removing track from peer"),this.context.peer.removeTrack(this.context.localVideoSender),this.context.localVideoSender=null);this.context.videoSubscriptions=e.updateVideoTransceivers(this.context.videoStreamIndex,this.context.videosToReceive)}))}}t.default=r},1789:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(4456);t.default=class{constructor(e){this.logger=e,this.taskName="BaseTask",this.parentTask=null,this.status=i.default.IDLE,this.run=this.baseRun.bind(this,this.run),this.cancel=this.baseCancel.bind(this,this.cancel)}cancel(){}name(){return this.parentTask?`${this.parentTask.name()}/${this.taskName}`:this.taskName}setParent(e){this.parentTask=e}getStatus(){return this.status}logAndThrow(e){throw this.logger.info(e),new Error(e)}baseRun(e){return n(this,void 0,void 0,(function*(){try{const t=Date.now();switch(this.logger.info(`running task ${this.name()}`),this.status){case i.default.RUNNING:this.logAndThrow(`${this.name()} is already running`);case i.default.CANCELED:this.logAndThrow(`${this.name()} was canceled before running`);case i.default.FINISHED:this.logAndThrow(`${this.name()} was already finished`)}this.status=i.default.RUNNING,yield e.call(this),this.logger.info(`${this.name()} took ${Math.round(Date.now()-t)} ms`)}catch(e){throw e}finally{this.status!==i.default.CANCELED&&(this.status=i.default.FINISHED)}}))}baseCancel(e){this.status!==i.default.CANCELED&&this.status!==i.default.FINISHED&&(this.logger.info(`canceling task ${this.name()}`),this.status=i.default.CANCELED,e.call(this))}}},3216:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(1789);class a extends i.default{constructor(e){super(e.logger),this.context=e,this.taskName="CleanRestartedSessionTask"}run(){return n(this,void 0,void 0,(function*(){this.context.peer&&this.context.peer.close(),this.context.transceiverController.reset(),this.context.localVideoSender=null,this.context.peer=null,this.context.videoDownlinkBandwidthPolicy.reset(),this.context.iceCandidateHandler=null,this.context.iceCandidates=[],this.context.previousSdpOffer=null}))}}t.default=a},7408:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(9416),a=c(1789);class r extends a.default{constructor(e){super(e.logger),this.context=e,this.taskName="CleanStoppedSessionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){try{this.context.signalingClient.ready()&&(this.context.signalingClient.closeConnection(),yield this.receiveWebSocketClosedEvent())}catch(e){throw e}finally{for(const e of this.context.removableObservers)e.removeObserver();this.context.statsCollector.stop(),this.context.statsCollector=null,this.context.connectionMonitor.stop(),this.context.connectionMonitor=null,this.context.peer&&this.context.peer.close(),this.context.peer=null,this.context.localVideoSender=null,this.context.sdpAnswer=null,this.context.sdpOfferInit=null,this.context.indexFrame=null,this.context.videoDownlinkBandwidthPolicy.reset(),this.context.iceCandidateHandler=null,this.context.iceCandidates=[],this.context.turnCredentials=null,this.context.videoSubscriptions=null,this.context.transceiverController.reset(),this.context.mediaStreamBroker.releaseMediaStream(this.context.activeAudioInput),this.context.activeAudioInput=null,this.context.mediaStreamBroker.releaseMediaStream(this.context.activeVideoInput),this.context.activeVideoInput=null,this.context.realtimeController.realtimeSetLocalAudioInput(null);const e=this.context.videoTileController.getLocalVideoTile();e&&e.bindVideoStream("",!0,null,null,null,null),this.context.videoTileController.removeAllVideoTiles()}}))}receiveWebSocketClosedEvent(){return new Promise(((e,t)=>{const c=new class{constructor(e){this.signalingClient=e}cancel(){this.signalingClient.removeObserver(this),t(new Error("CleanStoppedSessionTask got canceled while waiting for the WebSocket closed event"))}handleSignalingClientEvent(t){t.type===i.default.WebSocketClosed&&(this.signalingClient.removeObserver(this),e())}}(this.context.signalingClient);this.taskCanceler=c,this.context.signalingClient.registerObserver(c)}))}}t.default=r},5054:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(1789);class a extends i.default{constructor(e){super(e.logger),this.context=e,this.taskName="CreatePeerConnectionTask",this.removeTrackAddedEventListener=null,this.removeTrackRemovedEventListeners={},this.trackEvents=["ended","mute","unmute","isolationchange","overconstrained"],this.removeVideoTrackEventListeners={},this.trackAddedHandler=e=>{const t=e.track;if(this.context.logger.info(`received track event: kind=${t.kind} id=${t.id} label=${t.label}`),e.transceiver&&"inactive"===e.transceiver.currentDirection)return;if(0===e.streams.length)return void this.context.logger.warn("Track event but no stream");const c=e.streams[0];"audio"===t.kind?this.context.audioMixController.bindAudioStream(c):"video"!==t.kind||this.trackIsVideoInput(t)||this.addRemoteVideoTrack(t,c)}}removeObserver(){this.removeTrackAddedEventListener&&this.removeTrackAddedEventListener();for(const e in this.removeTrackRemovedEventListeners)this.removeTrackRemovedEventListeners[e]()}addPeerConnectionEventLogger(){const e=this.context.peer;e.addEventListener("connectionstatechange",(()=>{this.context.logger.info(`peer connection state changed: ${e.connectionState}`)})),e.addEventListener("negotiationneeded",(()=>{this.context.logger.info("peer connection negotiation is needed")})),e.addEventListener("icegatheringstatechange",(()=>{this.context.logger.info(`peer connection ice gathering state changed: ${e.iceGatheringState}`)})),e.addEventListener("icecandidate",(e=>{this.context.logger.info(`peer connection ice candidate: ${e.candidate?e.candidate.candidate:"(null)"}`)})),e.addEventListener("iceconnectionstatechange",(()=>{this.context.logger.info(`peer connection ice connection state changed: ${e.iceConnectionState}`)}))}run(){return n(this,void 0,void 0,(function*(){this.context.removableObservers.push(this);const e=this.context.turnCredentials&&this.context.turnCredentials.uris.length>0?{iceServers:[{urls:this.context.turnCredentials.uris,username:this.context.turnCredentials.username,credential:this.context.turnCredentials.password,credentialType:"password"}],iceTransportPolicy:"relay"}:{};e.bundlePolicy=this.context.browserBehavior.requiresBundlePolicy(),e.sdpSemantics=this.context.browserBehavior.requiresUnifiedPlan()?"unified-plan":"plan-b",this.logger.info(`SDP semantics are ${e.sdpSemantics}`),this.context.peer?this.context.logger.info("reusing peer connection"):(this.context.logger.info("creating new peer connection"),this.context.peer=new RTCPeerConnection(e,{optional:[{googHighStartBitrate:0},{googCpuOveruseDetection:!1},{googCpuOveruseEncodeUsage:!1},{googCpuUnderuseThreshold:55},{googCpuOveruseThreshold:150},{googCombinedAudioVideoBwe:!0}]}),this.addPeerConnectionEventLogger()),this.removeTrackAddedEventListener=()=>{this.context.peer&&this.context.peer.removeEventListener("track",this.trackAddedHandler),this.removeTrackAddedEventListener=null},this.context.peer.addEventListener("track",this.trackAddedHandler)}))}trackIsVideoInput(e){if(this.context.transceiverController.useTransceivers())return this.logger.debug((()=>"getting video track type (unified-plan)")),this.context.transceiverController.trackIsVideoInput(e);if(this.logger.debug((()=>"getting video track type (plan-b)")),this.context.activeVideoInput){const t=this.context.activeVideoInput.getVideoTracks();if(t&&t.length>0&&t[0].id===e.id)return!0}return!1}addRemoteVideoTrack(e,t){let c=t.id;this.context.browserBehavior.requiresUnifiedPlan()||(t=new MediaStream([e]),c=e.id);const n=this.context.videoStreamIndex.attendeeIdForTrack(c);if(this.context.videoTileController.haveVideoTileForAttendeeId(n))return void this.context.logger.info(`Not adding remote track. Already have tile for attendeeId: ${n}`);const i=this.context.videoTileController.addVideoTile();let a,r,o=this.context.videoStreamIndex.streamIdForTrack(c);void 0===o&&(this.logger.warn(`stream not found for tile=${i.id()} track=${c}`),o=null);for(let c=0;c{this.context.logger.info(`received the ${n} event for tile=${i.id()} id=${e.id} streamId=${o}`),"ended"===n&&this.context.browserBehavior.requiresUnifiedPlan()&&this.removeRemoteVideoTrack(e,i.state())};t.addEventListener(n,c),this.removeVideoTrackEventListeners[e.id]||(this.removeVideoTrackEventListeners[e.id]=[]),this.removeVideoTrackEventListeners[e.id].push((()=>{t.removeEventListener(n,c)}))}}if(e.getSettings){const t=e.getSettings();a=t.width,r=t.height}else{const t=e.getCapabilities();a=t.width,r=t.height}const s=this.context.videoStreamIndex.externalUserIdForTrack(c);i.bindVideoStream(n,!1,t,a,r,o,s),this.logger.info(`video track added, created tile=${i.id()} track=${c} streamId=${o}`);let l="removetrack",u=t;this.context.browserBehavior.requiresUnifiedPlan()||(this.logger.debug((()=>"updating end event and target track (plan-b)")),l="ended",u=e);const f=()=>this.removeRemoteVideoTrack(e,i.state());this.removeTrackRemovedEventListeners[e.id]=()=>{u.removeEventListener(l,f),delete this.removeTrackRemovedEventListeners[e.id]},u.addEventListener(l,f)}removeRemoteVideoTrack(e,t){if(this.removeTrackRemovedEventListeners.hasOwnProperty(e.id)){this.removeTrackRemovedEventListeners[e.id]();for(const t of this.removeVideoTrackEventListeners[e.id])t();delete this.removeVideoTrackEventListeners[e.id]}this.logger.info(`video track ended, removing tile=${t.tileId} id=${e.id} stream=${t.streamId}`),t.streamId?this.context.videosPaused.remove(t.streamId):this.logger.warn(`no stream found for tile=${t.tileId}`),this.context.videoTileController.removeVideoTile(t.tileId)}}t.default=a,a.REMOVE_HANDLER_INTERVAL_MS=1e4},1129:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(5687),a=c(7293),r=c(1789);class o extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="CreateSDPTask"}cancel(){if(this.cancelPromise){const e=new Error(`canceling ${this.name()}`);this.cancelPromise(e),delete this.cancelPromise}}sessionUsesAudio(){return!0}sessionUsesVideo(){let e;e=this.context.transceiverController.useTransceivers()?this.context.transceiverController.hasVideoInput():this.context.videoTileController.hasStartedLocalVideoTile();const t=!!this.context.videosToReceive&&!this.context.videosToReceive.empty(),c=e||t;return this.context.logger.info(`uses video: ${c} (enabled: true, sending: ${e}, receiving: ${t})`),c}run(){return n(this,void 0,void 0,(function*(){const e={offerToReceiveAudio:this.sessionUsesAudio(),offerToReceiveVideo:this.sessionUsesVideo()};this.logger.info(`peer connection offerOptions: ${JSON.stringify(e)}`),yield new Promise(((t,c)=>n(this,void 0,void 0,(function*(){this.cancelPromise=e=>{c(e)};try{if(this.context.sdpOfferInit=yield this.context.peer.createOffer(e),this.context.logger.info("peer connection created offer"),this.context.previousSdpOffer&&new a.default(this.context.sdpOfferInit.sdp).videoSendSectionHasDifferentSSRC(this.context.previousSdpOffer)){const e=new Error(`canceling ${this.name()} due to the meeting status code: ${i.default.IncompatibleSDP}`);return this.context.previousSdpOffer=null,void c(e)}t()}catch(e){c(e)}finally{delete this.cancelPromise}}))))}))}}t.default=o},6240:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(5687),a=c(7293),r=c(1789);class o extends r.default{constructor(e,t=o.CHROME_VPN_TIMEOUT_MS){super(e.logger),this.context=e,this.chromeVpnTimeoutMs=t,this.taskName="FinishGatheringICECandidatesTask"}removeEventListener(){this.context.peer&&(this.context.peer.removeEventListener("icecandidate",this.context.iceCandidateHandler),this.context.turnCredentials||this.context.peer.removeEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler))}cancel(){let e;this.context.browserBehavior.requiresIceCandidateGatheringTimeoutWorkaround()&&this.chromeVpnTimeoutMsthis.chromeVpnTimeoutMs&&(e=new Error(`canceling ${this.name()} due to the meeting status code: ${i.default.ICEGatheringTimeoutWorkaround}`)),this.cancelPromise&&(e=e||new Error(`canceling ${this.name()}`),this.cancelPromise(e),delete this.cancelPromise)}run(){return n(this,void 0,void 0,(function*(){if(this.context.peer||this.logAndThrow("session does not have peer connection; bypass ice gathering"),this.context.browserBehavior.requiresCheckForSdpConnectionAttributes()){if(new a.default(this.context.peer.localDescription.sdp).hasCandidatesForAllMLines())return void this.context.logger.info(`ice gathering already complete; bypass gathering, current local description ${this.context.peer.localDescription.sdp}`)}else this.context.logger.info(`iOS device does not require checking for connection attributes in SDP, current local description ${this.context.peer.localDescription.sdp}`);if(!this.context.browserBehavior.hasFirefoxWebRTC()&&"complete"!==this.context.peer.iceGatheringState||!new a.default(this.context.peer.localDescription.sdp).hasCandidates())try{yield new Promise(((e,t)=>{this.cancelPromise=e=>{this.removeEventListener(),t(e)},this.context.turnCredentials||(this.context.iceGatheringStateEventHandler=()=>{if("complete"===this.context.peer.iceGatheringState)return this.removeEventListener(),e(),void delete this.cancelPromise},this.context.peer.addEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler)),this.context.iceCandidateHandler=c=>{if(this.context.logger.info(`ice candidate: ${c.candidate?c.candidate.candidate:"(null)"} state: ${this.context.peer.iceGatheringState}`),c.candidate&&(a.default.isRTPCandidate(c.candidate.candidate)&&this.context.iceCandidates.push(c.candidate),this.context.turnCredentials&&this.context.iceCandidates.length>=1))return this.context.logger.info("gathered at least one relay candidate"),this.removeEventListener(),e(),void delete this.cancelPromise;"complete"===this.context.peer.iceGatheringState&&(this.context.logger.info("done gathering ice candidates"),this.removeEventListener(),new a.default(this.context.peer.localDescription.sdp).hasCandidates()&&0!==this.context.iceCandidates.length?(e(),delete this.cancelPromise):(t(new Error("no ice candidates were gathered")),delete this.cancelPromise))},this.context.peer.addEventListener("icecandidate",this.context.iceCandidateHandler),this.startTimestampMs=Date.now()}))}catch(e){throw e}finally{this.startTimestampMs&&(this.context.iceGatheringDurationMs=Math.round(Date.now()-this.startTimestampMs))}else this.context.logger.info("ice gathering state is complete and candidates are in SDP; bypass gathering")}))}}t.default=o,o.CHROME_VPN_TIMEOUT_MS=5e3},1960:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(3789),a=c(5687),r=c(7215),o=c(9416),s=c(2168),l=c(289),u=c(1789);class f extends u.default{constructor(e){super(e.logger),this.context=e,this.taskName="JoinAndReceiveIndexTask",this.taskCanceler=null,this.maxVideos=16}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){const e=yield new Promise(((e,t)=>{const c=this.context;c.turnCredentials=null;const n=new class{constructor(e){this.signalingClient=e}cancel(){this.signalingClient.removeObserver(this),t(new Error("JoinAndReceiveIndexTask got canceled while waiting for SdkIndexFrame"))}handleSignalingClientEvent(t){if(t.type===o.default.WebSocketClosed){c.logger.warn(`signaling connection closed by server with code ${t.closeCode} and reason: ${t.closeReason}`);let e=a.default.SignalingBadRequest;return 4410===t.closeCode?(c.logger.warn("the meeting cannot be joined because it is has been ended"),e=a.default.MeetingEnded):t.closeCode>=4500&&t.closeCode<4600&&(e=a.default.SignalingInternalServerError),void c.audioVideoController.handleMeetingSessionStatus(new i.default(e),null)}if(t.type!==o.default.ReceivedSignalFrame)return;if(t.message.type===l.SdkSignalFrame.Type.JOIN_ACK){const e=t.message.joinack;return void(e&&e.turnCredentials?(c.turnCredentials=new r.default,c.turnCredentials.username=e.turnCredentials.username,c.turnCredentials.password=e.turnCredentials.password,c.turnCredentials.ttl=e.turnCredentials.ttl,c.turnCredentials.uris=e.turnCredentials.uris.map((e=>c.meetingSessionConfiguration.urls.urlRewriter(e))).filter((e=>!!e))):c.logger.error("missing TURN credentials in JoinAckFrame"))}if(t.message.type!==l.SdkSignalFrame.Type.INDEX)return;this.signalingClient.removeObserver(this);const n=t.message.index;e(n)}}(this.context.signalingClient);this.context.signalingClient.registerObserver(n),this.taskCanceler=n,this.context.signalingClient.join(new s.default(this.maxVideos,!0))}));this.context.logger.info(`received first index ${JSON.stringify(e)}`),this.context.indexFrame=e}))}}t.default=f},6180:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(9416),a=c(289),r=c(1789);class o extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="LeaveAndReceiveLeaveAckTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){this.context.signalingClient.ready()&&(this.context.signalingClient.leave(),this.context.logger.info("sent leave"),yield this.receiveLeaveAck())}))}receiveLeaveAck(){return new Promise(((e,t)=>{const c=new class{constructor(e,t){this.signalingClient=e,this.logger=t}cancel(){this.signalingClient.removeObserver(this),t(new Error("LeaveAndReceiveLeaveAckTask got canceled while waiting for IndexFrame"))}handleSignalingClientEvent(t){if(t.isConnectionTerminated())return this.signalingClient.removeObserver(this),this.logger.info("LeaveAndReceiveLeaveAckTask connection terminated"),void e();t.type===i.default.ReceivedSignalFrame&&t.message.type===a.SdkSignalFrame.Type.LEAVE_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("got leave ack"),e())}}(this.context.signalingClient,this.context.logger);this.taskCanceler=c,this.context.signalingClient.registerObserver(c)}))}}t.default=o},2748:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(9416),a=c(289),r=c(1789);class o extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="ListenForVolumeIndicatorsTask",this.realtimeMuteAndUnmuteHandler=e=>{this.context.signalingClient.mute(e)}}run(){return n(this,void 0,void 0,(function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler)}))}removeObserver(){this.context.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(e){if(e.type===i.default.ReceivedSignalFrame)if(e.message.type===a.SdkSignalFrame.Type.AUDIO_STREAM_ID_INFO){const t=e.message.audioStreamIdInfo;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioStreamIdInfo(t)}else if(e.message.type===a.SdkSignalFrame.Type.AUDIO_METADATA){const t=e.message.audioMetadata;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioMetadata(t)}}}t.default=o},1981:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(6196),a=c(9496),r=c(2770),o=c(9708),s=c(1922),l=c(7086),u=c(3789),f=c(5687),d=c(9416),h=c(9880),m=c(155),p=c(1789);class v extends p.default{constructor(e,t,c){super(e.logger),this.context=e,this.initialConnectionHealthData=c,this.taskName="MonitorTask",this.prevSignalStrength=1,this.currentVideoDownlinkBandwidthEstimationKbps=1e4,this.currentAvailableStreamAvgBitrates=null,this.hasSignalingError=!1,this.presenceHandlerCalled=!1,this.checkAndSendWeakSignalEvent=e=>{const t=e<1,c=this.prevSignalStrength<1,n=t?c?null:h.default.RedmicStartLoss:c?h.default.RedmicEndLoss:null;n&&this.context.statsCollector.logAudioEvent(n),this.prevSignalStrength=e},this.realtimeFatalErrorCallback=e=>{this.logger.error(`realtime error: ${e}: ${e.stack}`),this.context.audioVideoController.handleMeetingSessionStatus(new u.default(f.default.RealtimeApiFailed),e)},this.realtimeAttendeeIdPresenceHandler=(e,t)=>{this.context.meetingSessionConfiguration.credentials.attendeeId===e&&t&&!this.presenceHandlerCalled&&(this.presenceHandlerCalled=!0,this.context.attendeePresenceDurationMs=Date.now()-this.context.startAudioVideoTimestamp,this.context.eventController&&this.context.eventController.publishEvent("attendeePresenceReceived",{attendeePresenceDurationMs:this.context.attendeePresenceDurationMs}))},this.reconnectionHealthPolicy=new o.default(e.logger,Object.assign({},t),this.initialConnectionHealthData.clone()),this.unusableAudioWarningHealthPolicy=new s.default(Object.assign({},t),this.initialConnectionHealthData.clone())}removeObserver(){this.context.audioVideoController.removeObserver(this),this.context.realtimeController.realtimeUnsubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.signalingClient.removeObserver(this)}run(){return n(this,void 0,void 0,(function*(){this.context.removableObservers.push(this),this.context.audioVideoController.addObserver(this),this.context.realtimeController.realtimeSubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.connectionMonitor.start(),this.context.statsCollector.start(this.context.signalingClient,this.context.videoStreamIndex),this.context.signalingClient.registerObserver(this)}))}videoTileDidUpdate(e){this.context.maxVideoTileCount=Math.max(this.context.maxVideoTileCount,this.context.videoTileController.getAllVideoTiles().length)}videoSendHealthDidChange(e,t){if(0===this.context.videoInputAttachedTimestampMs||!this.context.videoTileController.hasStartedLocalVideoTile()||!this.context.lastKnownVideoAvailability.canStartLocalVideo)return;const c=null!==this.context.activeVideoInput?this.context.activeVideoInput.getTracks():null;if(!c||!c[0])return;const n=Date.now()-this.context.videoInputAttachedTimestampMs;t>0||e>0?(this.context.statsCollector.logVideoEvent(m.default.SendingSuccess,this.context.videoDeviceInformation),this.context.statsCollector.logLatency("video_start_sending",n,this.context.videoDeviceInformation),this.context.videoInputAttachedTimestampMs=0):n>v.DEFAULT_TIMEOUT_FOR_START_SENDING_VIDEO_MS&&(this.context.statsCollector.logVideoEvent(m.default.SendingFailed,this.context.videoDeviceInformation),this.context.videoInputAttachedTimestampMs=0)}videoReceiveBandwidthDidChange(e,t){this.logger.debug((()=>`receiving bandwidth changed from prev=${t} Kbps to curr=${e} Kbps`)),this.currentVideoDownlinkBandwidthEstimationKbps=e}checkResubscribe(e){const t=e.getObservableMetrics();if(!t)return!1;const c=t.availableSendBandwidth||t.availableOutgoingBitrate,n=t.nackCountReceivedPerSecond||t.googNackCountReceivedPerSecond;let i=!1;this.context.videoDownlinkBandwidthPolicy.updateMetrics(e);const a=this.context.videoDownlinkBandwidthPolicy.wantsResubscribe();if(i=i||a,a&&(this.context.videosToReceive=this.context.videoDownlinkBandwidthPolicy.chooseSubscriptions(),this.logger.info(`trigger resubscribe for down=${a}; videosToReceive=[${this.context.videosToReceive.array()}]`)),this.context.videoTileController.hasStartedLocalVideoTile()){this.context.videoUplinkBandwidthPolicy.updateConnectionMetric({uplinkKbps:c/1e3,nackCountPerSecond:n});const e=this.context.videoUplinkBandwidthPolicy.wantsResubscribe();i=i||e,e&&(this.logger.info(`trigger resubscribe for up=${e}; videosToReceive=[${this.context.videosToReceive.array()}]`),this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters(),this.context.videoUplinkBandwidthPolicy.chooseMediaTrackConstraints())}return i}metricsDidReceive(e){const t=e;if(!t)return;if(this.checkResubscribe(e)&&this.context.audioVideoController.update(),!this.currentAvailableStreamAvgBitrates)return;const c=t.streamMetricReports;if(!c)return;const n=new Map,o=new Map;for(const e in c)c[e].mediaType===a.default.VIDEO&&c[e].direction===i.default.DOWNSTREAM&&n.set(c[e].streamId,c[e]);let s=!1;for(const e of this.currentAvailableStreamAvgBitrates.bitrates)if(n.has(e.sourceStreamId)){const t=n.get(e.sourceStreamId),c=this.context.videoStreamIndex.attendeeIdForStreamId(e.sourceStreamId);if(!c)continue;const i=new r.default,a=t.previousMetrics.bytesReceived,l=t.currentMetrics.bytesReceived;if(!a||!l)continue;const u=8*(l-a)/1e3;i.expectedAverageBitrateKbps=e.avgBitrateBps/1e3,i.receivedAverageBitrateKbps=u,i.attendeeId=c,u"Downlink video streams are not receiving enough data")),this.context.audioVideoController.forEachObserver((e=>{l.default.of(e.videoNotReceivingEnoughData).map((t=>t.bind(e)(Array.from(o.values()))))})))}connectionHealthDidChange(e){var t;0===e.consecutiveMissedPongs&&this.context.reconnectController&&this.context.reconnectController.setLastActiveTimestampMs(Date.now()),this.reconnectionHealthPolicy.update(e);const c=this.reconnectionHealthPolicy.healthIfChanged();null!==c&&(this.logger.info(`reconnection health is now: ${c}`),0===c&&this.context.audioVideoController.handleMeetingSessionStatus(new u.default(f.default.ConnectionHealthReconnect),null)),this.unusableAudioWarningHealthPolicy.update(e);const n=this.unusableAudioWarningHealthPolicy.healthIfChanged();null!==n&&(this.logger.info(`unusable audio warning is now: ${n}`),0===n?(this.context.poorConnectionCount+=1,null===(t=this.context.eventController)||void 0===t||t.pushMeetingState("receivingAudioDropped"),this.context.videoTileController.haveVideoTilesWithStreams()?this.context.audioVideoController.forEachObserver((e=>{l.default.of(e.connectionDidSuggestStopVideo).map((t=>t.bind(e)()))})):this.context.audioVideoController.forEachObserver((e=>{l.default.of(e.connectionDidBecomePoor).map((t=>t.bind(e)()))}))):this.context.audioVideoController.forEachObserver((e=>{l.default.of(e.connectionDidBecomeGood).map((t=>t.bind(e)()))})))}handleBitrateFrame(e){const t=this.context.videoSubscriptions||[];let c=0;this.currentAvailableStreamAvgBitrates=e,this.logger.debug((()=>`simulcast: bitrates from server ${JSON.stringify(e)}`));for(const n of e.bitrates)-1!==t.indexOf(n.sourceStreamId)&&(c+=n.avgBitrateBps);c/=1e3,this.currentVideoDownlinkBandwidthEstimationKbps*v.DEFAULT_DOWNLINK_CALLRATE_OVERSHOOT_FACTOR{l.default.of(e.estimatedDownlinkBandwidthLessThanRequired).map((t=>t.bind(e)(this.currentVideoDownlinkBandwidthEstimationKbps,c)))})))}handleSignalingClientEvent(e){var t;if(e.type===d.default.WebSocketClosed&&(4410===e.closeCode||e.closeCode>=4500&&e.closeCode<4600)||e.type===d.default.WebSocketError||e.type===d.default.WebSocketFailed?this.hasSignalingError||(null===(t=this.context.eventController)||void 0===t||t.pushMeetingState("signalingDropped"),this.hasSignalingError=!0):e.type===d.default.WebSocketOpen&&(this.hasSignalingError=!1),e.type===d.default.ReceivedSignalFrame){if(e.message.bitrates){const t=e.message.bitrates;this.context.videoStreamIndex.integrateBitratesFrame(t),this.context.videoDownlinkBandwidthPolicy.updateIndex(this.context.videoStreamIndex),this.handleBitrateFrame(e.message.bitrates)}const t=u.default.fromSignalFrame(e.message);t.statusCode()!==f.default.OK&&this.context.audioVideoController.handleMeetingSessionStatus(t,null)}}}t.default=v,v.DEFAULT_TIMEOUT_FOR_START_SENDING_VIDEO_MS=3e4,v.DEFAULT_DOWNLINK_CALLRATE_OVERSHOOT_FACTOR=1.5,v.DEFAULT_DOWNLINK_CALLRATE_UNDERSHOOT_FACTOR=.5},8831:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{cancel(){}name(){return"NoOpTask"}run(){}setParent(e){}}},4543:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(3920),a=c(9416),r=c(1789);class o extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="OpenSignalingConnectionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){const e=this.context.meetingSessionConfiguration;this.context.signalingClient.openConnection(new i.default(e.urls.signalingURL,e.credentials.joinToken));const t=Date.now();try{yield new Promise(((e,t)=>{const c=new class{constructor(e){this.signalingClient=e}cancel(){this.signalingClient.removeObserver(this),t(new Error("OpenSignalingConnectionTask got canceled while waiting to open signaling connection"))}handleSignalingClientEvent(c){switch(c.type){case a.default.WebSocketOpen:this.signalingClient.removeObserver(this),e();break;case a.default.WebSocketFailed:this.signalingClient.removeObserver(this),t(new Error("WebSocket connection failed"))}}}(this.context.signalingClient);this.context.signalingClient.registerObserver(c),this.taskCanceler=c}))}catch(e){throw e}finally{this.context.signalingOpenDurationMs=Math.round(Date.now()-t)}}))}}t.default=o},8556:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(1789);class a extends i.default{constructor(e,t,c){super(e),this.taskName=t,this.tasksToRunParallel=c;for(const e of c)e.setParent(this)}cancel(){for(const e of this.tasksToRunParallel)this.logger.info(`canceling parallel group task ${this.name()} subtask ${e.name()}`),e.cancel()}run(){return n(this,void 0,void 0,(function*(){const e=[];for(const t of this.tasksToRunParallel)this.logger.info(`parallel group task ${this.name()} running subtask ${t.name()}`),e.push(t.run());const t=[];for(let c=0;c0){const e=t.join(", ");this.logAndThrow(`parallel group task ${this.name()} failed for tasks: ${e}`)}this.logger.info(`parallel group task ${this.name()} completed`)}))}}t.default=a},1209:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(1789);class a extends i.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveAudioInputTask"}run(){return n(this,void 0,void 0,(function*(){if(this.context.activeAudioInput)return void this.context.logger.info("an active audio input exists");let e=null;try{e=yield this.context.mediaStreamBroker.acquireAudioInputStream()}catch(e){this.context.logger.warn("could not acquire audio input from current device")}e?(this.context.activeAudioInput=e,this.context.realtimeController.realtimeSetLocalAudioInput(e)):this.context.logger.warn("an audio input is not available")}))}}t.default=a},5547:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(5687),a=c(7215),r=c(214),o=c(4046),s=c(1789);class l extends s.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveTURNCredentialsTask",this.url=e.meetingSessionConfiguration.urls.turnControlURL,this.meetingId=e.meetingSessionConfiguration.meetingId,this.joinToken=e.meetingSessionConfiguration.credentials.joinToken}cancel(){if(this.cancelPromise){const e=new Error(`canceling ${this.name()}`);this.cancelPromise(e),delete this.cancelPromise}}run(){return n(this,void 0,void 0,(function*(){if(this.context.turnCredentials)return void this.context.logger.info("TURN credentials available, skipping credentials fetch");if(this.context.logger.error("missing TURN credentials - falling back to fetch"),!this.url)return void this.context.logger.info("TURN control url not supplied, skipping credentials fetch");const e={method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json","X-Chime-Auth-Token":"_aws_wt_session="+new r.default(this.joinToken).base()},redirect:"follow",referrer:"no-referrer",body:JSON.stringify({meetingId:this.meetingId})};this.context.logger.info(`requesting TURN credentials from ${this.url}`);const t=yield new Promise(((t,c)=>n(this,void 0,void 0,(function*(){this.cancelPromise=e=>{c(e)};try{const n=yield fetch(o.default.urlWithVersion(this.url),e);if(this.context.logger.info("received TURN credentials"),n.status&&403===n.status)return void c(new Error(`canceling ${this.name()} due to the meeting status code: ${i.default.TURNCredentialsForbidden}`));if(n.status&&404===n.status)return void c(new Error(`canceling ${this.name()} due to the meeting status code: ${i.default.MeetingEnded}`));t(yield n.json())}catch(e){c(e)}finally{delete this.cancelPromise}}))));this.context.turnCredentials=new a.default,this.context.turnCredentials.password=t.password,this.context.turnCredentials.ttl=t.ttl,this.context.turnCredentials.uris=t.uris.map((e=>this.context.meetingSessionConfiguration.urls.urlRewriter(e))).filter((e=>!!e)),this.context.turnCredentials.username=t.username}))}}t.default=l},120:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(289),a=c(1789);class r extends a.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveVideoInputTask"}run(){return n(this,void 0,void 0,(function*(){const e=this.context.videoDuplexMode===i.SdkStreamServiceType.RX||this.context.videoDuplexMode===i.SdkStreamServiceType.DUPLEX;if(this.context.videoTileController.hasStartedLocalVideoTile()?this.context.videoDuplexMode=e?i.SdkStreamServiceType.DUPLEX:i.SdkStreamServiceType.TX:this.context.videoDuplexMode=e?i.SdkStreamServiceType.RX:0,this.context.videoCaptureAndEncodeParameter=this.context.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters(),!this.context.videoTileController.hasStartedLocalVideoTile())return this.context.logger.info("has not started local video tile"),void(this.context.activeVideoInput&&this.stopVideoInput());const t=this.context.videoTileController.getLocalVideoTile();let c=null;try{c=yield this.context.mediaStreamBroker.acquireVideoInputStream()}catch(e){this.context.logger.warn("could not acquire video input from current device")}if(this.context.enableSimulcast){const e=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();this.context.videoStreamIndex.integrateUplinkPolicyDecision(Array.from(e.values()))}if(this.context.activeVideoInput=c,c){const n=c.getVideoTracks(),i=this.context.meetingSessionConfiguration.credentials.attendeeId,a=n[0].getSettings();if(this.context.enableSimulcast){const t=this.context.videoUplinkBandwidthPolicy.chooseMediaTrackConstraints();this.context.logger.info(`simulcast: choose constraint ${JSON.stringify(t)}`);try{yield n[0].applyConstraints(t)}catch(e){this.context.logger.info("simulcast: pass video without more constraint")}}const r=this.context.audioVideoController.configuration.credentials.externalUserId;t.bindVideoStream(i,!0,c,a.width,a.height,null,r);for(let e=0;e{const c=new r.default(e.attendeeId);return!(c.base()===t&&c.hasModality(r.default.MODALITY_CONTENT))}));const{videoStreamIndex:c,videoDownlinkBandwidthPolicy:n,videoUplinkBandwidthPolicy:a}=this.context,o=c.allVideoSendingSourcesExcludingSelf(t);c.integrateIndexFrame(e),n.updateIndex(c),a.updateIndex(c),this.resubscribe(n,a),this.updateVideoAvailability(e),this.handleIndexVideosPausedAtSource();const s=c.allVideoSendingSourcesExcludingSelf(t);this.areVideoSourcesEqual(o,s)||this.context.audioVideoController.forEachObserver((e=>{i.default.of(e.remoteVideoSourcesDidChange).map((t=>t.bind(e)(s)))}))}areVideoSourcesEqual(e,t){if(e.length!==t.length)return!1;const c=(e,t)=>e.attendee.attendeeId.localeCompare(t.attendee.attendeeId),n=[...e].sort(c),i=[...t].sort(c);for(let e=0;e{i.default.of(e.videoAvailabilityDidChange).map((c=>c.bind(e)(t.clone())))})))}handleIndexVideosPausedAtSource(){const e=this.context.videoStreamIndex.streamsPausedAtSource();for(const t of this.context.videoTileController.getAllVideoTiles()){const c=t.state();e.contain(c.streamId)?t.markPoorConnection()&&this.logger.info(`marks the tile ${c.tileId} as having a poor connection`):t.unmarkPoorConnection()&&this.logger.info(`unmarks the tile ${c.tileId} as having a poor connection`)}}}t.default=u},4191:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(1789);class i extends n.default{constructor(e,t,c="RunnableTask"){super(e),this.fn=t,this.taskName=c}run(){return this.fn().then((()=>{}))}}t.default=i},9485:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(1018),a=c(9416),r=c(289),o=c(1789);class s extends o.default{constructor(e){super(e.logger),this.context=e,this.taskName="SendAndReceiveDataMessagesTask",this.sendDataMessageHandler=(e,t,c)=>{if(!this.context.signalingClient.ready())throw new Error("Signaling client is not ready");{let n;n=t instanceof Uint8Array?t:"string"==typeof t?(new TextEncoder).encode(t):(new TextEncoder).encode(JSON.stringify(t)),this.validateDataMessage(e,n,c);const i=r.SdkDataMessagePayload.create();i.topic=e,i.lifetimeMs=c,i.data=n;const a=r.SdkDataMessageFrame.create();a.messages=[i],this.context.signalingClient.sendDataMessage(a)}}}run(){return n(this,void 0,void 0,(function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToSendDataMessage(this.sendDataMessageHandler)}))}removeObserver(){this.context.realtimeController.realtimeUnsubscribeFromSendDataMessage(this.sendDataMessageHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(e){if(e.type===a.default.ReceivedSignalFrame&&e.message.type===r.SdkSignalFrame.Type.DATA_MESSAGE)for(const t of e.message.dataMessage.messages){const e=new i.default(t.ingestTimeNs/1e6,t.topic,t.data,t.senderAttendeeId,t.senderExternalUserId,0===t.ingestTimeNs);this.context.realtimeController.realtimeReceiveDataMessage(e)}}validateDataMessage(e,t,c){if(!s.TOPIC_REGEX.test(e))throw new Error("Invalid topic");if(t.length>s.DATA_SIZE)throw new Error("Data size has to be less than 2048 bytes");if(c&&c<0)throw new Error("The life time of the message has to be non negative")}}t.default=s,s.TOPIC_REGEX=new RegExp(/^[a-zA-Z0-9_-]{1,36}$/),s.DATA_SIZE=2048},7079:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(1789),a=c(4456);class r extends i.default{constructor(e,t,c){super(e),this.taskName=t,this.tasksToRunSerially=c,this.currentTask=null;for(const e of c)e.setParent(this)}cancel(){this.currentTask&&(this.logger.info(`canceling serial group task ${this.name()} subtask ${this.currentTask.name()}`),this.currentTask.cancel())}run(){return n(this,void 0,void 0,(function*(){for(const e of this.tasksToRunSerially){this.getStatus()===a.default.CANCELED&&this.logAndThrow(`serial group task ${this.name()} was canceled`);try{this.logger.info(`serial group task ${this.name()} running subtask ${e.name()}`),this.currentTask=e,yield e.run(),this.logger.info(`serial group task ${this.name()} completed subtask ${e.name()}`)}catch(e){this.logAndThrow(`serial group task ${this.name()} was canceled due to subtask ${this.currentTask.name()} error: ${e.message}`)}finally{this.currentTask=null}}this.logger.info(`serial group task ${this.name()} completed`)}))}}t.default=r},4833:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(1789);class a extends i.default{constructor(e){super(e.logger),this.context=e,this.taskName="SetLocalDescriptionTask"}cancel(){if(this.cancelPromise){const e=new Error(`canceling ${this.name()}`);this.cancelPromise(e),delete this.cancelPromise}}run(){return n(this,void 0,void 0,(function*(){const e=this.context.peer,t=this.context.sdpOfferInit;this.logger.debug((()=>`local description is >>>${t.sdp}<<<`)),yield new Promise(((c,i)=>n(this,void 0,void 0,(function*(){this.cancelPromise=e=>{i(e)};try{yield e.setLocalDescription(t),c()}catch(e){i(e)}finally{delete this.cancelPromise}})))),this.context.logger.info("set local description")}))}}t.default=a},5275:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(543),a=c(7293),r=c(1789);class o extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="SetRemoteDescriptionTask"}cancel(){this.cancelICEPromise&&this.cancelICEPromise()}run(){return n(this,void 0,void 0,(function*(){this.context.peer||this.logAndThrow("session does not have peer connection; bypass set remote description");let e=this.context.sdpAnswer;if(e=new a.default(e).withoutServerReflexiveCandidates().sdp,this.context.audioProfile&&(e=new a.default(e).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp),!this.context.browserBehavior.requiresUnifiedPlan()&&(this.logger.info("checking for no videos (plan-b)"),this.context.videosToReceive.empty()&&this.context.peer.remoteDescription)){this.logger.info("have no videos and have remote description (plan-b)");const t=this.context.peer.localDescription.sdp,c=e;let n=c;const i=new a.default(t);if(i.hasVideo()){this.logger.info(`offer has video (plan-b): >>>${i.sdp}<<<`);const e=new a.default(c);this.logger.info(`existing answer (plan-b): >>>${e.sdp}<<<`),e.hasVideo()||(this.logger.info(`copying inactive video from offer into answer (plan-b); sdp answer before is >>>${c}<<<`),n=e.copyVideo(t).sdp)}e=n}(new i.default).requiresSortCodecPreferencesForSdpAnswer()&&(e=new a.default(e).preferH264IfExists().sdp),this.logger.info(`processed remote description is >>>${e}<<<`);const t={type:"answer",sdp:e,toJSON:null};try{yield this.createICEConnectionCompletedPromise(t)}catch(e){throw e}}))}createICEConnectionCompletedPromise(e){return new Promise(((t,c)=>n(this,void 0,void 0,(function*(){const n=()=>{"connected"!==this.context.peer.iceConnectionState&&"completed"!==this.context.peer.iceConnectionState||(this.context.peer.removeEventListener("iceconnectionstatechange",n),t())};this.cancelICEPromise=()=>{this.context.peer&&this.context.peer.removeEventListener("iceconnectionstatechange",n),c(new Error(`${this.name()} got canceled while waiting for the ICE connection state`))},this.context.peer.addEventListener("iceconnectionstatechange",n);try{yield this.context.peer.setRemoteDescription(e),this.logger.info("set remote description, waiting for ICE connection"),n()}catch(e){c(e)}}))))}}t.default=o},5924:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(7293),a=c(9416),r=c(6729),o=c(289),s=c(1789);class l extends s.default{constructor(e){super(e.logger),this.context=e,this.taskName="SubscribeAndReceiveSubscribeAckTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){let e="";if(this.context.peer&&this.context.peer.localDescription&&(e=this.context.browserBehavior.requiresUnifiedPlanMunging()?new i.default(this.context.peer.localDescription.sdp).withUnifiedPlanFormat().sdp:this.context.peer.localDescription.sdp),!this.context.enableSimulcast){let e=0,t=0;this.context.videoCaptureAndEncodeParameter&&(e=this.context.videoCaptureAndEncodeParameter.captureFrameRate(),t=this.context.videoCaptureAndEncodeParameter.encodeBitrates()[0]);const c={rid:"hi",maxBitrate:1e3*t,maxFramerate:e,active:!0};this.context.videoStreamIndex.integrateUplinkPolicyDecision([c])}this.context.videoStreamIndex.subscribeFrameSent();const t=this.context.videoDuplexMode===o.SdkStreamServiceType.TX||this.context.videoDuplexMode===o.SdkStreamServiceType.DUPLEX;this.context.previousSdpOffer=new i.default(e);const c=new r.default(this.context.meetingSessionConfiguration.credentials.attendeeId,e,this.context.meetingSessionConfiguration.urls.audioHostURL,this.context.realtimeController.realtimeIsLocalAudioMuted(),!1,this.context.videoSubscriptions,t,this.context.videoStreamIndex.localStreamDescriptions(),!0);this.context.logger.info(`sending subscribe: ${JSON.stringify(c)}`),this.context.signalingClient.subscribe(c);const n=yield this.receiveSubscribeAck();this.context.logger.info(`got subscribe ack: ${JSON.stringify(n)}`),this.context.sdpAnswer=n.sdpAnswer,this.context.videoStreamIndex.integrateSubscribeAckFrame(n)}))}receiveSubscribeAck(){return new Promise(((e,t)=>{const c=new class{constructor(e){this.signalingClient=e}cancel(){this.signalingClient.removeObserver(this),t(new Error("SubscribeAndReceiveSubscribeAckTask got canceled while waiting for SdkSubscribeAckFrame"))}handleSignalingClientEvent(t){if(t.type!==a.default.ReceivedSignalFrame||t.message.type!==o.SdkSignalFrame.Type.SUBSCRIBE_ACK)return;this.signalingClient.removeObserver(this);const c=t.message.suback;e(c)}}(this.context.signalingClient);this.context.signalingClient.registerObserver(c),this.taskCanceler=c}))}}t.default=l},4456:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.IDLE="IDLE",e.RUNNING="RUNNING",e.CANCELED="CANCELED",e.FINISHED="FINISHED"}(c||(c={})),t.default=c},250:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(4929),a=c(1789);class r extends a.default{constructor(e,t,c){super(e),this.taskToRunBeforeTimeout=t,this.timeoutMs=c,this.taskName=`Timeout${this.timeoutMs}ms`,t.setParent(this)}cancel(){this.logger.info(`canceling timeout task ${this.name()} subtask ${this.taskToRunBeforeTimeout}`),this.taskToRunBeforeTimeout.cancel()}run(){return n(this,void 0,void 0,(function*(){const e=new i.default(this.timeoutMs);e.start((()=>{this.logger.info(`timeout reached for task ${this.name()}`),this.taskToRunBeforeTimeout.cancel()}));try{yield this.taskToRunBeforeTimeout.run()}finally{e.stop()}this.logger.info(`timeout task ${this.name()} completed`)}))}}t.default=r},6171:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(5687),a=c(1789);class r extends a.default{constructor(e){super(e.logger),this.context=e,this.taskName="WaitForAttendeePresenceTask"}cancel(){if(this.cancelPromise){const e=new Error(`canceling ${this.name()} due to the meeting status code: ${i.default.NoAttendeePresent}`);this.cancelPromise(e),delete this.cancelPromise}}run(){return n(this,void 0,void 0,(function*(){const e=this.context.meetingSessionConfiguration.credentials.attendeeId;return new Promise(((t,c)=>{const n=(c,i,a,r,o)=>{e===c&&i&&(this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(n),t(),delete this.cancelPromise)};this.cancelPromise=e=>{this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(n),c(e)},this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(n)}))}))}}t.default=r},365:function(e,t){"use strict";var c=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(e,t){this.logger=e,this.browserBehavior=t,this._localCameraTransceiver=null,this._localAudioTransceiver=null,this.videoSubscriptions=[],this.defaultMediaStream=null,this.peer=null}setEncodingParameters(e){}static setVideoSendingBitrateKbpsForSender(e,t,n){return c(this,void 0,void 0,(function*(){if(!e||t<=0)return;const c=e.getParameters();c.encodings||(c.encodings=[{}]);for(const e of c.encodings)e.maxBitrate=1e3*t;yield e.setParameters(c)}))}static replaceAudioTrackForSender(e,t){return c(this,void 0,void 0,(function*(){return!!e&&(yield e.replaceTrack(t),!0)}))}localAudioTransceiver(){return this._localAudioTransceiver}localVideoTransceiver(){return this._localCameraTransceiver}setVideoSendingBitrateKbps(e){return c(this,void 0,void 0,(function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;const t=this._localCameraTransceiver.sender;yield n.setVideoSendingBitrateKbpsForSender(t,e,this.logger)}))}setPeer(e){this.peer=e}reset(){this._localCameraTransceiver=null,this._localAudioTransceiver=null,this.videoSubscriptions=[],this.defaultMediaStream=null,this.peer=null}useTransceivers(){return!(!this.peer||!this.browserBehavior.requiresUnifiedPlan())&&void 0!==this.peer.getTransceivers}hasVideoInput(){return!(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)}trackIsVideoInput(e){return!!this._localCameraTransceiver&&(e===this._localCameraTransceiver.sender.track||e===this._localCameraTransceiver.receiver.track)}setupLocalTransceivers(){this.useTransceivers()&&(this.defaultMediaStream||"undefined"==typeof MediaStream||(this.defaultMediaStream=new MediaStream),this._localAudioTransceiver||(this._localAudioTransceiver=this.peer.addTransceiver("audio",{direction:"inactive",streams:[this.defaultMediaStream]})),this._localCameraTransceiver||(this._localCameraTransceiver=this.peer.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream]})))}replaceAudioTrack(e){return c(this,void 0,void 0,(function*(){return this._localAudioTransceiver&&"sendrecv"===this._localAudioTransceiver.direction?(yield this._localAudioTransceiver.sender.replaceTrack(e),!0):(this.logger.info("audio transceiver direction is not set up or not activated"),!1)}))}setAudioInput(e){return c(this,void 0,void 0,(function*(){yield this.setTransceiverInput(this._localAudioTransceiver,e)}))}setVideoInput(e){return c(this,void 0,void 0,(function*(){yield this.setTransceiverInput(this._localCameraTransceiver,e)}))}updateVideoTransceivers(e,t){if(!this.useTransceivers())return t.array();const c=this.peer.getTransceivers();return this.videoSubscriptions=[0],t=t.clone(),this.updateTransceivers(c,e,t),this.logger.debug((()=>this.debugDumpTransceivers())),this.videoSubscriptions}updateTransceivers(e,t,c){const n=c.array();let i=1;for(const c of e)if(c!==this._localCameraTransceiver&&this.transceiverIsVideo(c)){if(this.videoSubscriptions[i]=0,"inactive"!==c.direction){const e=t.streamIdForTrack("v_"+c.mid);if(void 0!==e)for(const[a,r]of n.entries())if(t.StreamIdsInSameGroup(e,r)){c.direction="recvonly",this.videoSubscriptions[i]=r,n.splice(a,1);break}}i+=1}i=1;for(const t of e)if(t!==this._localCameraTransceiver&&this.transceiverIsVideo(t)){if("inactive"===t.direction&&n.length>0){t.direction="recvonly";const e=n.shift();this.videoSubscriptions[i]=e}else 0===this.videoSubscriptions[i]&&(t.direction="inactive");i+=1}for(const e of n){const t=this.peer.addTransceiver("video",{direction:"recvonly",streams:[this.defaultMediaStream]});this.videoSubscriptions.push(e),this.logger.info(`adding transceiver mid: ${t.mid} subscription: ${e} direction: recvonly`)}}transceiverIsVideo(e){return e.receiver&&e.receiver.track&&"video"===e.receiver.track.kind||e.sender&&e.sender.track&&"video"===e.sender.track.kind}debugDumpTransceivers(){let e="",t=0;for(const c of this.peer.getTransceivers())this.transceiverIsVideo(c)&&(e+=`transceiver index=${t} mid=${c.mid} subscription=${this.videoSubscriptions[t]} direction=${c.direction}\n`,t+=1);return e}setTransceiverInput(e,t){return c(this,void 0,void 0,(function*(){e&&(e.direction=t?"sendrecv":"inactive",yield e.sender.replaceTrack(t))}))}}t.default=n},5785:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(365);class a extends i.default{constructor(e,t){super(e,t),this.videoQualityControlParameterMap=new Map;let c=4;for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(543),i=c(2336);class a{static get sdkName(){return"amazon-chime-sdk-js"}static get sdkVersion(){return i.default.semverString}static get buildSHA(){return i.default.hash.substr(1)}static get sdkUserAgentLowResolution(){const e=new n.default;return`${e.name()}-${e.majorVersion()}`}static urlWithVersion(e){const t=new URL(e);return t.searchParams.append(a.X_AMZN_VERSION,a.sdkVersion),t.searchParams.append(a.X_AMZN_USER_AGENT,a.sdkUserAgentLowResolution),t.toString()}}t.default=a,a.X_AMZN_VERSION="X-Amzn-Version",a.X_AMZN_USER_AGENT="X-Amzn-User-Agent"},2336:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={hash:"13ff6f2",raw:"v2.7.0",semverString:"2.7.0"}},1133:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class c{constructor(e,t,c,n,i){this.cameraWidth=e,this.cameraHeight=t,this.cameraFrameRate=c,this.maxEncodeBitrateKbps=n,this.isSimulcast=i}equal(e){let t=e.captureWidth()===this.cameraWidth&&e.captureHeight()===this.cameraHeight&&e.captureFrameRate()===this.cameraFrameRate&&e.encodeBitrates().length===this.encodeBitrates().length&&e.encodeWidths().length===this.encodeWidths().length&&e.encodeHeights().length===this.encodeHeights().length;if(t)for(let c=0;c{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(1508);t.default=class{constructor(e){this.selfAttendeeId=e,this.reset()}reset(){this.optimalReceiveSet=new n.default,this.subscribedReceiveSet=new n.default}updateIndex(e){this.optimalReceiveSet=this.calculateOptimalReceiveSet(e)}updateMetrics(e){}wantsResubscribe(){return!this.subscribedReceiveSet.equal(this.optimalReceiveSet)}chooseSubscriptions(){return this.subscribedReceiveSet=this.optimalReceiveSet.clone(),this.subscribedReceiveSet.clone()}calculateOptimalReceiveSet(e){return e.highestQualityStreamFromEachGroupExcludingSelf(this.selfAttendeeId)}}},5319:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(1508);t.default=class{reset(){}updateIndex(e){}updateMetrics(e){}wantsResubscribe(){return!1}chooseSubscriptions(){return new n.default}}},2880:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(6196),i=c(8890),a=c(1508);class r{constructor(){this.bandwidthEstimateKbps=0,this.usedBandwidthKbps=0,this.packetsLost=0,this.nackCount=0,this.rttMs=0}}class o{constructor(e,t){this.logger=e,this.tileController=t,this.reset()}reset(){this.optimalReceiveSet=new a.default,this.subscribedReceiveSet=new a.default,this.logCount=0,this.startupPeriod=!0,this.usingPrevTargetRate=!1,this.rateProbeState="Not Probing",this.timeFirstEstimate=0,this.lastUpgradeRateKbps=0,this.timeBeforeAllowSubscribeMs=o.MIN_TIME_BETWEEN_SUBSCRIBE,this.timeLastProbe=Date.now(),this.timeBeforeAllowProbeMs=o.MIN_TIME_BETWEEN_PROBE,this.downlinkStats=new r,this.prevDownlinkStats=new r}updateIndex(e){this.videoIndex=e}updateMetrics(e){if(this.videoIndex.allStreams().empty())return;this.prevDownlinkStats=this.downlinkStats,this.downlinkStats=new r;const t=e.getObservableMetrics();this.downlinkStats.bandwidthEstimateKbps=t.availableReceiveBandwidth/1e3;for(const t in e.streamMetricReports){const c=Number(t);e.streamMetricReports[c].direction===n.default.DOWNSTREAM&&(e.streamMetricReports[c].currentMetrics.hasOwnProperty("googNacksSent")&&e.streamMetricReports[c].currentMetrics.hasOwnProperty("googFrameRateReceived")&&(this.downlinkStats.nackCount+=e.countPerSecond("googNacksSent",c)),e.streamMetricReports[c].currentMetrics.hasOwnProperty("packetsLost")&&e.streamMetricReports[c].currentMetrics.hasOwnProperty("googFrameRateReceived")&&(this.downlinkStats.packetsLost+=e.countPerSecond("packetsLost",c)),e.streamMetricReports[c].currentMetrics.hasOwnProperty("bytesReceived")&&(this.downlinkStats.usedBandwidthKbps+=e.bitsPerSecond("bytesReceived",c)/1e3))}}wantsResubscribe(){return this.optimalReceiveSet=this.calculateOptimalReceiveSet(),!this.subscribedReceiveSet.equal(this.optimalReceiveSet)}chooseSubscriptions(){return this.subscribedReceiveSet.equal(this.optimalReceiveSet)||(this.timeLastSubscribe=Date.now()),this.subscribedReceiveSet=this.optimalReceiveSet.clone(),this.logger.info("bwe: chooseSubscriptions "+JSON.stringify(this.subscribedReceiveSet)),this.subscribedReceiveSet.clone()}calculateOptimalReceiveSet(){const e=new a.default,t=this.rateProbeState,c=this.videoIndex.remoteStreamDescriptions();if(0===c.length)return e;const n=new a.default;this.handlePausedStreams(e,n,c);const r=this.availStreamsSameAsLast(c);if(!this.startupPeriod&&r&&Date.now()-this.timeLastSubscribee.maxBitrateKbps===t.maxBitrateKbps?e.streamId-t.streamId:e.maxBitrateKbps-t.maxBitrateKbps));for(const e of c)(0===e.avgBitrateKbps||e.avgBitrateKbps>e.maxBitrateKbps)&&(e.attendeeId.endsWith(i.default.Modality)&&e.maxBitrateKbps<100?e.maxBitrateKbps=e.avgBitrateKbps:e.avgBitrateKbps=e.maxBitrateKbps);const l=this.determineTargetRate(c);let u,f=0,d=0;d+=this.chooseContent(s,c);for(const e of c)0!==e.avgBitrateKbps&&-1===s.findIndex((t=>t.groupId===e.groupId))&&(d+e.avgBitrateKbps<=l?(s.push(e),d+=e.avgBitrateKbps):0===f&&(f=e.avgBitrateKbps,u=e));let h=!0;for(;h;)h=!1,s.forEach(((e,t)=>{for(const n of c)if(n.groupId===e.groupId&&n.streamId!==e.streamId&&n.avgBitrateKbps>e.avgBitrateKbps){const c=n.avgBitrateKbps-e.avgBitrateKbps;d+c<=l?(d+=c,s[t]=n,h=!0):0===f&&(f=c,u=n)}}));let m=0;!this.startupPeriod&&r&&0!==f?m="Probing"===this.rateProbeState?this.handleProbe(s,n,l,c):this.maybeOverrideOrProbe(s,n,l,d,f,u):(this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0);let p=this.policyStateLogStr(c,l);if(this.logCount%15!=0&&this.rateProbeState===t||(this.logger.info(p),this.logCount=0,p=""),this.logCount++,this.prevTargetRateKbps=l,this.prevRemoteInfos=c,1===m)return this.logger.info("bwe: keepSameSubscriptions"),p.length>0&&this.logger.info(p),this.optimalReceiveSet;if(2===m){const e=this.calculateSubscribeRate(c,this.preProbeReceiveSet);return this.logger.info("bwe: Use Pre-Probe subscription subscribedRate:"+e),this.preProbeReceiveSet}for(const t of s)e.add(t.streamId);if(!this.optimalReceiveSet.equal(e)){p.length>0&&this.logger.info(p);const t=this.calculateSubscribeRate(c,e);this.logger.info(`bwe: new streamSelection: ${JSON.stringify(e)} subscribedRate:${t}`)}return e}determineTargetRate(e){let t=0,c=Number.MAX_VALUE;for(const t of e)0!==t.avgBitrateKbps&&t.avgBitrateKbpso.DEFAULT_BANDWIDTH_KBPS||this.downlinkStats.packetsLost>0||n-this.timeFirstEstimate>o.STARTUP_PERIOD_MS&&this.downlinkStats.bandwidthEstimateKbps<=this.prevDownlinkStats.bandwidthEstimateKbps)&&(this.startupPeriod=!1,this.prevTargetRateKbps=this.downlinkStats.bandwidthEstimateKbps),t=this.startupPeriod?o.DEFAULT_BANDWIDTH_KBPS:this.downlinkStats.bandwidthEstimateKbps):t=0===this.timeFirstEstimate?o.DEFAULT_BANDWIDTH_KBPS:this.prevTargetRateKbps,t=Math.max(c,t),!this.startupPeriod&&(this.usingPrevTargetRate&&this.downlinkStats.bandwidthEstimateKbps"bwe: ValidateRate: Using Previous rate "+this.prevTargetRateKbps)),this.usingPrevTargetRate=!0,t=this.prevTargetRateKbps):this.usingPrevTargetRate=!1,t}setProbeState(e){if(this.rateProbeState===e)return;const t=Date.now();switch(e){case"Not Probing":this.timeProbePendingStart=0;break;case"Probe Pending":if(!(0===this.timeLastProbe||t-this.timeLastProbe>o.MIN_TIME_BETWEEN_PROBE))return!1;this.timeProbePendingStart=t;break;case"Probing":if(!(t-this.timeProbePendingStart>this.timeBeforeAllowProbeMs))return!1;this.timeLastProbe=t,this.preProbeReceiveSet=this.subscribedReceiveSet,this.timeBeforeAllowProbeMs=Math.min(2*this.timeBeforeAllowProbeMs,o.MAX_HOLD_MS_BEFORE_PROBE)}return this.logger.info("bwe: setProbeState to "+e+" from "+this.rateProbeState),this.rateProbeState=e,!0}upgradeToStream(e,t){for(let c=0;co.MAX_ALLOWED_PROBE_TIME_MS)return this.logger.info("bwe: Canceling probe due to timeout"),this.setProbeState("Not Probing"),0;if(this.downlinkStats.packetsLost>0)return this.setProbeState("Not Probing"),this.timeBeforeAllowSubscribeMs=3*o.MIN_TIME_BETWEEN_SUBSCRIBE,2;const i=this.calculateSubscribeRate(n,this.optimalReceiveSet);if(this.chosenStreamsSameAsLast(e,t)||c>i){let t=0;for(const c of e)t+=c.avgBitrateKbps;if(c>t)return this.setProbeState("Not Probing"),this.timeBeforeAllowProbeMs=o.MIN_TIME_BETWEEN_PROBE,0}return 1}maybeOverrideOrProbe(e,t,c,n,i,a){const r=this.chosenStreamsSameAsLast(e,t);let s=0;const l=Date.now(),u=n*(n>o.LOW_BITRATE_THRESHOLD_KBPS?o.TARGET_RATE_CHANGE_TRIGGER_PERCENT:2*o.TARGET_RATE_CHANGE_TRIGGER_PERCENT)/100;if(!r&&Math.abs(n-this.prevTargetRateKbps)this.prevDownlinkStats.packetsLost)return this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0,s;if(r||s)switch(this.rateProbeState){case"Not Probing":this.setProbeState("Probe Pending");break;case"Probe Pending":l-this.timeProbePendingStart>this.timeBeforeAllowProbeMs&&this.setProbeState("Probing")&&(this.timeBeforeAllowSubscribeMs=800,this.upgradeToStream(e,a),s=0);break;default:this.logger.info("bwe: MaybeOverrideOrProbe: Unhandled condition "+this.rateProbeState)}else this.setProbeState("Not Probing"),n+u>c+i&&(this.logger.info("bwe: MaybeOverrideOrProbe: Upgrade since we are within threshold"),this.upgradeToStream(e,a));return s}calculateSubscribeRate(e,t){let c=0;for(const n of t.array()){const t=e.find((e=>e.streamId===n));void 0!==t&&(c+=t.maxBitrateKbps)}return c}handlePausedStreams(e,t,c){const n=this.tileController.getAllRemoteVideoTiles();for(let i=0;ie.groupId===t.groupId&&e.streamId===t.streamId&&e.maxBitrateKbps===t.maxBitrateKbps)))return!1;return!0}chosenStreamsSameAsLast(e,t){const c=this.optimalReceiveSet.array();for(const n of c)if(!t.contain(n)&&-1===e.findIndex((e=>e.streamId===n)))return!1;return!0}policyStateLogStr(e,t){const c={targetBitrate:t,subscribedRate:this.calculateSubscribeRate(e,this.optimalReceiveSet),probeState:this.rateProbeState,startupPeriod:this.startupPeriod};let n="remoteInfos: [";for(const t of e)n+=`{grpId:${t.groupId} strId:${t.streamId} maxBr:${t.maxBitrateKbps} avgBr:${t.avgBitrateKbps}}, `;return n+="]",`bwe: optimalReceiveSet ${JSON.stringify(c)}\nbwe: prev ${JSON.stringify(this.prevDownlinkStats)}\nbwe: now ${JSON.stringify(this.downlinkStats)}\nbwe: ${n}`}}t.default=o,o.DEFAULT_BANDWIDTH_KBPS=2800,o.STARTUP_PERIOD_MS=6e3,o.LARGE_RATE_CHANGE_TRIGGER_PERCENT=20,o.TARGET_RATE_CHANGE_TRIGGER_PERCENT=15,o.LOW_BITRATE_THRESHOLD_KBPS=300,o.MIN_TIME_BETWEEN_PROBE=5e3,o.MIN_TIME_BETWEEN_SUBSCRIBE=2e3,o.MAX_HOLD_MS_BEFORE_PROBE=6e4,o.MAX_ALLOWED_PROBE_TIME_MS=6e4},3663:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{create(){return{clientWidth:400,clientHeight:300,width:400,height:300,videoWidth:400,videoHeight:300,style:{transform:""},hasAttribute:()=>!1,removeAttribute:()=>{},setAttribute:()=>{},srcObject:!1,pause:()=>{},play:()=>Promise.resolve()}}}},9807:function(e,t){"use strict";var c=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.canvas=e,this.destroyed=!1}destroy(){this.canvas=null,this.destroyed=!0}asCanvasImageSource(){return c(this,void 0,void 0,(function*(){return this.destroyed?Promise.reject("canvas buffer is destroyed"):Promise.resolve(this.canvas)}))}asCanvasElement(){return this.canvas}}},8919:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(9807);t.default=class{constructor(e,t){this.logger=e,this.stages=t,this.fr=15,this.outputMediaStream=new MediaStream,this.videoInput=document.createElement("video"),this.canvasOutput=document.createElement("canvas"),this.outputCtx=this.canvasOutput.getContext("2d"),this.canvasInput=document.createElement("canvas"),this.inputCtx=this.canvasInput.getContext("2d"),this.inputVideoStream=null,this.sourceBuffers=[],this.destBuffers=[],this.observers=new Set,this.hasStarted=!1,this.process=e=>n(this,void 0,void 0,(function*(){if(!this.inputVideoStream)return;const e=performance.now();this.videoInput.videoWidth&&(this.canvasInput.width!==this.videoInput.videoWidth&&(this.canvasInput.width=this.videoInput.videoWidth,this.canvasInput.height=this.videoInput.videoHeight,this.sourceBuffers[0].height=this.canvasInput.height,this.sourceBuffers[0].width=this.canvasInput.width,this.sourceBuffers[0].framerate=this.framerate),this.inputCtx.drawImage(this.videoInput,0,0));let t,c=[];c.push(this.sourceBuffers[0]);try{for(const e of this.processors)c=yield e.process(c)}catch(e){return void this.forEachObserver((e=>{e.processingDidFailToStart&&e.processingDidFailToStart()}))}this.destBuffers=c;try{t=yield this.destBuffers[0].asCanvasImageSource()}catch(e){return void(this.inputVideoStream&&(this.logger.info("buffers are destroyed and pipeline could not start"),this.forEachObserver((e=>{e.processingDidFailToStart&&e.processingDidFailToStart()}))))}const n=t.width,i=t.height;0!==n&&0!==i&&(this.canvasOutput.width!==n&&this.canvasOutput.height!==i&&(this.canvasOutput.width=n,this.canvasOutput.height=i),this.outputCtx.drawImage(t,0,0,n,i,0,0,n,i),this.hasStarted||(this.hasStarted=!0,this.forEachObserver((e=>{e.processingDidStart&&e.processingDidStart()}))));const a=performance.now()-e,r=2e3/this.framerate-a,o=Math.max(0,1e3/this.framerate-a);r<=0&&this.forEachObserver((e=>{e.processingLatencyTooHigh&&e.processingLatencyTooHigh(a)})),this.lastTimeOut=setTimeout(this.process,o)}))}destroy(){if(this.stop(),this.stages)for(const e of this.stages)e.destroy()}get framerate(){return this.fr}set framerate(e){this.fr=e<0?15:e}stop(){if(this.videoInput.removeEventListener("loadedmetadata",this.process),this.videoInput.srcObject=null,this.destroyInputMediaStreamAndBuffers(),this.outputMediaStream)for(const e of this.outputMediaStream.getVideoTracks())e.stop();this.lastTimeOut&&(clearTimeout(this.lastTimeOut),this.lastTimeOut=void 0),this.hasStarted&&(this.hasStarted=!1,this.forEachObserver((e=>{e.processingDidStop&&e.processingDidStop()})))}addObserver(e){this.observers.add(e)}removeObserver(e){this.observers.delete(e)}getInputMediaStream(){return n(this,void 0,void 0,(function*(){return this.inputVideoStream}))}getActiveOutputMediaStream(){return this.outputMediaStream&&this.outputMediaStream.active?this.outputMediaStream:this.outputMediaStream=this.canvasOutput.captureStream(this.framerate)}setInputMediaStream(e){return n(this,void 0,void 0,(function*(){if(!e)return void this.stop();if(0===e.getVideoTracks().length)return void this.logger.error("No video tracks in input media stream, ignoring");this.inputVideoStream=e;const t=this.inputVideoStream.getVideoTracks()[0].getSettings();this.logger.info(`processing pipeline input stream settings ${t}`),this.canvasOutput.width=t.width,this.canvasOutput.height=t.height,this.videoInput.addEventListener("loadedmetadata",this.process),this.videoInput.srcObject=this.inputVideoStream,this.videoInput.setAttribute("playsinline","true");const c=new i.default(this.canvasInput);this.sourceBuffers.push(c),this.videoInput.load(),yield this.videoInput.play()}))}set processors(e){this.stages=e}get processors(){return this.stages}forEachObserver(e){for(const t of this.observers)setTimeout((()=>{e(t)}),0)}destroyInputMediaStreamAndBuffers(){if(this.inputVideoStream)for(const e of this.inputVideoStream.getTracks())e.stop();this.inputVideoStream=null;for(const e of this.sourceBuffers)e.destroy();this.sourceBuffers=[]}}},7673:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(543),a=c(8919);class r{constructor(e,t,c,n=new i.default){this.logger=e,this.device=t,this.processors=c,this.browserBehavior=n,this.observers=new Set,this.pipe=new a.default(this.logger,this.processors),this.pipe.addObserver(this)}get outputMediaStream(){return this.pipe.outputMediaStream}chooseNewInnerDevice(e){const t=new r(this.logger,e,this.processors,this.browserBehavior);return t.pipe=this.pipe,t}getInnerDevice(){return this.device}intrinsicDevice(){return n(this,void 0,void 0,(function*(){const e={};return this.device?"string"==typeof this.device?(this.browserBehavior.requiresNoExactMediaStreamConstraints()?e.deviceId=this.device:e.deviceId={exact:this.device},e):this.device.id?this.device:Object.assign(Object.assign({},this.device),e):e}))}transformStream(e){return n(this,void 0,void 0,(function*(){return yield this.pipe.setInputMediaStream(e),this.inputMediaStream=e,this.pipe.getActiveOutputMediaStream()}))}onOutputStreamDisconnect(){this.logger.info("DefaultVideoTransformDevice: detach stopping input media stream");const e=this.device&&this.device.id;if(this.pipe.stop(),!e&&this.inputMediaStream)for(const e of this.inputMediaStream.getVideoTracks())e.stop()}stop(){return n(this,void 0,void 0,(function*(){if(this.inputMediaStream)for(const e of this.inputMediaStream.getVideoTracks())e.stop();this.pipe.destroy(),this.inputMediaStream=null}))}addObserver(e){this.observers.add(e)}removeObserver(e){this.observers.add(e)}processingDidStart(){this.logger.info("video transform device processing started"),this.forEachObserver((e=>{e.processingDidStart&&e.processingDidStart()}))}processingLatencyTooHigh(e){this.forEachObserver((t=>{t.processingLatencyTooHigh&&t.processingLatencyTooHigh(e)}))}processingDidFailToStart(){this.logger.info("video transform device processing failed to start"),this.forEachObserver((e=>{e.processingDidFailToStart&&e.processingDidFailToStart()}))}processingDidStop(){this.logger.info("video transform device processing stopped"),this.forEachObserver((e=>{e.processingDidStop&&e.processingDidStop()}))}forEachObserver(e){for(const t of this.observers)setTimeout((()=>{e(t)}),0)}}t.default=r},2801:function(e,t){"use strict";var c=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{process(e){return c(this,void 0,void 0,(function*(){return e}))}destroy(){return c(this,void 0,void 0,(function*(){}))}}},60:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},1508:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class c{constructor(e){this.ids=new Set(e)}add(e){this.ids.add(e)}array(){return Array.from(this.ids.values()).sort(((e,t)=>e-t))}contain(e){return this.ids.has(e)}empty(){return 0===this.ids.size}size(){return this.ids.size}equal(e){if(!e)return 0===this.ids.size;const t=this.array(),c=e.array();if(t.length!==c.length)return!1;for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(289),i=c(1508),a=c(6876);t.default=class{constructor(e){this.logger=e,this.currentIndex=null,this.indexForSubscribe=null,this.currentSubscribeAck=null,this.subscribeTrackToStreamMap=null,this.subscribeStreamToAttendeeMap=null,this.subscribeStreamToExternalUserIdMap=null,this.subscribeSsrcToStreamMap=null,this.streamToAttendeeMap=null,this.streamToExternalUserIdMap=null,this.videoStreamDescription=new a.default,this.videoStreamDescription.trackLabel="AmazonChimeExpressVideo",this.videoStreamDescription.streamId=2,this.videoStreamDescription.groupId=2}localStreamDescriptions(){return[this.videoStreamDescription.clone()]}remoteStreamDescriptions(){if(!this.currentIndex||!this.currentIndex.sources)return[];const e=[];return this.currentIndex.sources.forEach((t=>{const c=new a.default;c.attendeeId=t.attendeeId,c.groupId=t.groupId,c.streamId=t.streamId,c.maxBitrateKbps=t.maxBitrateKbps,c.avgBitrateKbps=Math.floor(t.avgBitrateBps/1e3),e.push(c)})),e}integrateUplinkPolicyDecision(e){if(e&&e.length){const t=e[0];this.videoStreamDescription.maxBitrateKbps=t.maxBitrate/1e3,this.videoStreamDescription.maxFrameRate=t.maxFramerate}}integrateIndexFrame(e){this.currentIndex=e;const t=new Map;let c=!1;for(const n of e.sources){if(!t.has(n.attendeeId)){t.set(n.attendeeId,n.groupId);continue}const e=t.get(n.attendeeId);et.get(e.attendeeId)===e.groupId))),this.streamToAttendeeMap=null,this.streamToExternalUserIdMap=null}subscribeFrameSent(){this.indexForSubscribe=this.currentIndex}integrateSubscribeAckFrame(e){this.currentSubscribeAck=e,this.subscribeTrackToStreamMap=this.buildTrackToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToStreamMap=this.buildSSRCToStreamMap(this.currentSubscribeAck),this.subscribeStreamToAttendeeMap=this.buildStreamToAttendeeMap(this.indexForSubscribe),this.subscribeStreamToExternalUserIdMap=this.buildStreamExternalUserIdMap(this.indexForSubscribe)}integrateBitratesFrame(e){if(this.currentIndex)for(const t of e.bitrates){const e=this.currentIndex.sources.find((e=>e.streamId===t.sourceStreamId));void 0!==e&&(e.avgBitrateBps=t.avgBitrateBps)}}allStreams(){const e=new i.default;if(this.currentIndex)for(const t of this.currentIndex.sources)e.add(t.streamId);return e}allVideoSendingSourcesExcludingSelf(e){const t=[],c=new Set;if(this.currentIndex&&this.currentIndex.sources&&this.currentIndex.sources.length)for(const i of this.currentIndex.sources){const{attendeeId:a,externalUserId:r,mediaType:o}=i;a!==e&&o===n.SdkStreamMediaType.VIDEO&&(c.has(a)||(t.push({attendee:{attendeeId:a,externalUserId:r}}),c.add(a)))}return t}streamSelectionUnderBandwidthConstraint(e,t,c,a){const r=new Set;if(this.currentIndex)for(const i of this.currentIndex.sources)i.attendeeId!==e&&i.mediaType===n.SdkStreamMediaType.VIDEO&&(t.has(i.attendeeId)||c.has(i.attendeeId)||r.add(i.attendeeId));const o=this.buildAttendeeToSortedStreamDescriptorMapExcludingSelf(e),s=new Map;let l=0;o.forEach(((e,t)=>{s.set(t,e[0]),l+=e[0].maxBitrateKbps})),l=this.trySelectHighBitrateForAttendees(o,t,l,a,s),this.trySelectHighBitrateForAttendees(o,r,l,a,s);const u=new i.default;for(const e of s.values())u.add(e.streamId);return u}highestQualityStreamFromEachGroupExcludingSelf(e){const t=new i.default;if(this.currentIndex){const c=new Map;for(const t of this.currentIndex.sources)t.attendeeId!==e&&t.mediaType===n.SdkStreamMediaType.VIDEO&&(!c.has(t.groupId)||t.maxBitrateKbps>c.get(t.groupId).maxBitrateKbps)&&c.set(t.groupId,t);for(const e of c.values())t.add(e.streamId)}return t}numberOfVideoPublishingParticipantsExcludingSelf(e){return this.highestQualityStreamFromEachGroupExcludingSelf(e).array().length}numberOfParticipants(){return this.currentIndex.numParticipants?this.currentIndex.numParticipants:-1}attendeeIdForTrack(e){const t=this.streamIdForTrack(e);return void 0!==t&&this.subscribeStreamToAttendeeMap?this.subscribeStreamToAttendeeMap.get(t)||(this.logger.info(`track ${e} (stream ${t}) does not correspond to a known attendee`),""):(this.logger.warn(`no attendee found for track ${e}`),"")}externalUserIdForTrack(e){const t=this.streamIdForTrack(e);return void 0!==t&&this.subscribeStreamToExternalUserIdMap?this.subscribeStreamToExternalUserIdMap.get(t)||(this.logger.info(`track ${e} (stream ${t}) does not correspond to a known externalUserId`),""):(this.logger.warn(`no external user id found for track ${e}`),"")}attendeeIdForStreamId(e){if(!this.streamToAttendeeMap){if(!this.currentIndex)return"";this.streamToAttendeeMap=this.buildStreamToAttendeeMap(this.currentIndex)}return this.streamToAttendeeMap.get(e)||(this.logger.info(`stream ${e}) does not correspond to a known attendee`),"")}groupIdForStreamId(e){for(const t of this.currentIndex.sources)if(t.streamId===e)return t.groupId;if(this.indexForSubscribe)for(const t of this.indexForSubscribe.sources)if(t.streamId===e)return t.groupId}StreamIdsInSameGroup(e,t){return this.groupIdForStreamId(e)===this.groupIdForStreamId(t)}streamIdForTrack(e){if(this.subscribeTrackToStreamMap)return this.subscribeTrackToStreamMap.get(e)}streamIdForSSRC(e){if(this.subscribeSsrcToStreamMap)return this.subscribeSsrcToStreamMap.get(e)}streamsPausedAtSource(){const e=new i.default;if(this.currentIndex)for(const t of this.currentIndex.pausedAtSourceIds)e.add(t);return e}buildTrackToStreamMap(e){const t=new Map;this.logger.debug((()=>`trackMap ${JSON.stringify(e.tracks)}`));for(const c of e.tracks)c.trackLabel.length>0&&c.streamId>0&&t.set(c.trackLabel,c.streamId);return t}buildSSRCToStreamMap(e){const t=new Map;this.logger.debug((()=>`ssrcMap ${JSON.stringify(e.tracks)}`));for(const c of e.tracks)c.trackLabel.length>0&&c.streamId>0&&t.set(c.ssrc,c.streamId);return t}buildStreamToAttendeeMap(e){const t=new Map;if(e)for(const c of e.sources)t.set(c.streamId,c.attendeeId);return t}buildStreamExternalUserIdMap(e){const t=new Map;if(e)for(const c of e.sources)c.externalUserId&&t.set(c.streamId,c.externalUserId);return t}trySelectHighBitrateForAttendees(e,t,c,n,i){for(const a of t){if(c>=n)break;if(e.has(a)){const t=e.get(a);for(const e of t.reverse())if(c-i.get(a).maxBitrateKbps+e.maxBitrateKbps{e.sort(((e,t)=>e.maxBitrateKbps>t.maxBitrateKbps?1:e.maxBitrateKbps{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(289),i=c(1318),a=c(6876);class r extends i.default{constructor(e){super(e),this.streamIdToBitrateKbpsMap=new Map,this._localStreamInfos=[],this._lastBitRateMsgTime=Date.now()}localStreamDescriptions(){const e=[];return this._localStreamInfos.forEach((t=>{e.push(t.clone())})),e}integrateUplinkPolicyDecision(e){let t=!0,c=0;for(let n=0;n0&&(this._localStreamInfos[c].timeEnabled=Date.now()),this._localStreamInfos[c].maxBitrateKbps=i,this._localStreamInfos[c].maxFrameRate=r,this._localStreamInfos[c].disabledByUplinkPolicy=0===i,!0===this._localStreamInfos[c].disabledByUplinkPolicy&&(this._localStreamInfos[c].disabledByWebRTC=!1),c++;else{t=!1;const e=new a.default;e.maxBitrateKbps=i,e.maxFrameRate=r,e.disabledByUplinkPolicy=0===i,0!==i&&(e.timeEnabled=Date.now()),this._localStreamInfos.push(e),c++}}t&&this._localStreamInfos.splice(c)}integrateBitratesFrame(e){super.integrateBitratesFrame(e);const t=new Set,c=new Set(this.streamIdToBitrateKbpsMap.keys());for(const c of e.bitrates)t.add(c.sourceStreamId),this.streamIdToBitrateKbpsMap.set(c.sourceStreamId,Math.trunc(c.avgBitrateBps/1e3));for(const e of c)t.has(e)||(this.streamIdToBitrateKbpsMap.get(e)===r.UNSEEN_STREAM_BITRATE?this.streamIdToBitrateKbpsMap.set(e,r.RECENTLY_INACTIVE_STREAM_BITRATE):this.streamIdToBitrateKbpsMap.set(e,r.NOT_SENDING_STREAM_BITRATE));for(let e=0;er.BitratesMsgFrequencyMs&&(this._localStreamInfos[e].disabledByWebRTC=!0):this._lastBitRateMsgTime-this._localStreamInfos[e].timeEnabled>r.BitratesMsgFrequencyMs&&(this._localStreamInfos[e].disabledByWebRTC=!0))}this._lastBitRateMsgTime=Date.now(),this.logLocalStreamDescriptions()}logLocalStreamDescriptions(){let e="";for(const t of this._localStreamInfos)e+=`streamId=${t.streamId} maxBitrate=${t.maxBitrateKbps} disabledByWebRTC=${t.disabledByWebRTC} disabledByUplink=${t.disabledByUplinkPolicy}\n`;this.logger.debug((()=>e))}integrateIndexFrame(e){super.integrateIndexFrame(e);const t=new Set,c=new Set(this.streamIdToBitrateKbpsMap.keys());for(const e of this.currentIndex.sources)e.mediaType===n.SdkStreamMediaType.VIDEO&&(t.add(e.streamId),this.streamIdToBitrateKbpsMap.has(e.streamId)||this.streamIdToBitrateKbpsMap.set(e.streamId,r.UNSEEN_STREAM_BITRATE));for(const e of c)t.has(e)||this.streamIdToBitrateKbpsMap.delete(e)}integrateSubscribeAckFrame(e){if(super.integrateSubscribeAckFrame(e),!e.allocations||void 0===e.allocations)return;let t=0;for(const c of e.allocations){if(this._localStreamInfos.length{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(289);class i{constructor(e,t,c,n,i){this.attendeeId="",this.groupId=0,this.streamId=0,this.ssrc=0,this.trackLabel="",this.maxBitrateKbps=0,this.avgBitrateKbps=0,this.maxFrameRate=0,this.timeEnabled=0,this.disabledByWebRTC=!1,this.disabledByUplinkPolicy=!1,this.attendeeId=e,this.groupId=t,this.streamId=c,this.maxBitrateKbps=n,this.avgBitrateKbps=i}clone(){const e=new i;return e.attendeeId=this.attendeeId,e.groupId=this.groupId,e.streamId=this.streamId,e.ssrc=this.ssrc,e.trackLabel=this.trackLabel,e.maxBitrateKbps=this.maxBitrateKbps,e.avgBitrateKbps=this.avgBitrateKbps,e.maxFrameRate=this.maxFrameRate,e.timeEnabled=this.timeEnabled,e.disabledByWebRTC=this.disabledByWebRTC,e.disabledByUplinkPolicy=this.disabledByUplinkPolicy,e}toStreamDescriptor(){const e=n.SdkStreamDescriptor.create();return e.mediaType=n.SdkStreamMediaType.VIDEO,e.trackLabel=this.trackLabel,e.attendeeId=this.attendeeId,e.streamId=this.streamId,e.groupId=this.groupId,e.framerate=this.maxFrameRate,e.maxBitrateKbps=this.disabledByUplinkPolicy||this.disabledByWebRTC?0:this.maxBitrateKbps,e.avgBitrateBps=this.avgBitrateKbps,e}}t.default=i},3327:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(543),a=c(214),r=c(7797),o=c(7804);class s{constructor(e,t,c,n){this.tileController=c,this.devicePixelRatioMonitor=n,this.tileState=new o.default,this.tileState.tileId=e,this.tileState.localTile=t,this.devicePixelRatioMonitor.registerObserver(this)}static connectVideoStreamToVideoElement(e,t,c){const a=c&&"environment"!==e.getVideoTracks()[0].getSettings().facingMode?"rotateY(180deg)":"";s.setVideoElementFlag(t,"disablePictureInPicture",c),s.setVideoElementFlag(t,"disableRemotePlayback",c),t.style.transform!==a&&(t.style.transform=a),t.hasAttribute("controls")&&t.removeAttribute("controls"),t.hasAttribute("autoplay")||t.setAttribute("autoplay","true"),t.hasAttribute("playsinline")||t.setAttribute("playsinline","true"),t.hasAttribute("muted")||(t.setAttribute("muted","true"),t.muted=!0),t.srcObject!==e&&(t.srcObject=e),(new i.default).requiresVideoElementWorkaround()&&r.default.nextTick((()=>n(this,void 0,void 0,(function*(){try{yield t.play()}catch(e){}}))))}static disconnectVideoStreamFromVideoElement(e,t){if(e)if(t)e.srcObject=null,e.style.transform="";else{if(!e.srcObject)return;e.pause(),e.style.transform="",s.setVideoElementFlag(e,"disablePictureInPicture",!1),s.setVideoElementFlag(e,"disableRemotePlayback",!1);const t=e.srcObject,c=t.getTracks();for(const e of c)e.stop(),t.removeTrack(e);(new i.default).requiresVideoElementWorkaround()?r.default.nextTick((()=>{e.srcObject=null})):e.srcObject=null}}destroy(){this.devicePixelRatioMonitor.removeObserver(this),this.tileState.boundVideoElement&&this.tileState.boundVideoElement.srcObject===this.tileState.boundVideoStream&&s.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,!1),this.tileState=new o.default}devicePixelRatioChanged(e){this.tileState.devicePixelRatio=e,this.sendTileStateUpdate()}id(){return this.tileState.tileId}state(){return this.tileState.clone()}stateRef(){return this.tileState}bindVideoStream(e,t,c,n,i,r,o){let s=!1;this.tileState.boundAttendeeId!==e&&(this.tileState.boundAttendeeId=e,new a.default(e).hasModality(a.default.MODALITY_CONTENT)&&(this.tileState.isContent=!0),s=!0),this.tileState.boundExternalUserId!==o&&(this.tileState.boundExternalUserId=o,s=!0),this.tileState.localTile!==t&&(this.tileState.localTile=t,s=!0),this.tileState.boundVideoStream!==c&&(this.tileState.boundVideoStream=c,s=!0),this.tileState.videoStreamContentWidth!==n&&(this.tileState.videoStreamContentWidth=n,s=!0),this.tileState.videoStreamContentHeight!==i&&(this.tileState.videoStreamContentHeight=i,s=!0),this.tileState.streamId!==r&&(this.tileState.streamId=r,s=!0),s&&this.sendTileStateUpdate()}bindVideoElement(e){let t=!1;this.tileState.boundVideoElement!==e&&(this.tileState.boundVideoElement=e,t=!0),null!==this.tileState.boundVideoElement?(this.tileState.videoElementCSSWidthPixels!==e.clientWidth&&(this.tileState.videoElementCSSWidthPixels=e.clientWidth,t=!0),this.tileState.videoElementCSSHeightPixels!==e.clientHeight&&(this.tileState.videoElementCSSHeightPixels=e.clientHeight,t=!0)):(this.tileState.videoElementCSSWidthPixels=null,this.tileState.videoElementCSSHeightPixels=null),t&&this.sendTileStateUpdate()}pause(){this.tileState.paused||(this.tileState.paused=!0,this.sendTileStateUpdate())}unpause(){this.tileState.paused&&(this.tileState.paused=!1,this.sendTileStateUpdate())}markPoorConnection(){return!this.tileState.poorConnection&&(this.tileState.poorConnection=!0,this.sendTileStateUpdate(),!0)}unmarkPoorConnection(){return!!this.tileState.poorConnection&&(this.tileState.poorConnection=!1,this.sendTileStateUpdate(),!0)}capture(){if(!this.tileState.active)return null;const e=document.createElement("canvas"),t=this.tileState.boundVideoElement;e.width=t.videoWidth||t.width,e.height=t.videoHeight||t.height;const c=e.getContext("2d");return c.drawImage(t,0,0,e.width,e.height),c.getImageData(0,0,e.width,e.height)}sendTileStateUpdate(){this.updateActiveState(),this.updateVideoStreamOnVideoElement(),this.updateVideoElementPhysicalPixels(),this.tileController.sendTileStateUpdate(this.state())}updateActiveState(){this.tileState.active=!(this.tileState.paused||this.tileState.poorConnection||!this.tileState.boundAttendeeId||!this.tileState.boundVideoElement||!this.tileState.boundVideoStream)}updateVideoElementPhysicalPixels(){"number"==typeof this.tileState.videoElementCSSWidthPixels&&"number"==typeof this.tileState.videoElementCSSHeightPixels?(this.tileState.videoElementPhysicalWidthPixels=this.tileState.devicePixelRatio*this.tileState.videoElementCSSWidthPixels,this.tileState.videoElementPhysicalHeightPixels=this.tileState.devicePixelRatio*this.tileState.videoElementCSSHeightPixels):(this.tileState.videoElementPhysicalWidthPixels=null,this.tileState.videoElementPhysicalHeightPixels=null)}updateVideoStreamOnVideoElement(){this.tileState.active?s.connectVideoStreamToVideoElement(this.tileState.boundVideoStream,this.tileState.boundVideoElement,this.tileState.localTile):s.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,this.tileState.paused)}static setVideoElementFlag(e,t,c){t in e&&(e[t]=c)}}t.default=s},7804:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class c{constructor(){this.tileId=null,this.localTile=!1,this.localTileStarted=!1,this.isContent=!1,this.active=!1,this.paused=!1,this.poorConnection=!1,this.boundAttendeeId=null,this.boundExternalUserId=null,this.boundVideoStream=null,this.boundVideoElement=null,this.nameplate=null,this.videoStreamContentWidth=null,this.videoStreamContentHeight=null,this.videoElementCSSWidthPixels=null,this.videoElementCSSHeightPixels=null,this.devicePixelRatio=0,this.videoElementPhysicalWidthPixels=null,this.videoElementPhysicalHeightPixels=null,this.streamId=null}clone(){const e=new c;return e.tileId=this.tileId,e.localTile=this.localTile,e.isContent=this.isContent,e.active=this.active,e.paused=this.paused,e.poorConnection=this.poorConnection,e.boundAttendeeId=this.boundAttendeeId,e.boundExternalUserId=this.boundExternalUserId,e.boundVideoStream=this.boundVideoStream,e.boundVideoElement=this.boundVideoElement,e.nameplate=this.nameplate,e.videoStreamContentWidth=this.videoStreamContentWidth,e.videoStreamContentHeight=this.videoStreamContentHeight,e.videoElementCSSWidthPixels=this.videoElementCSSWidthPixels,e.videoElementCSSHeightPixels=this.videoElementCSSHeightPixels,e.devicePixelRatio=this.devicePixelRatio,e.videoElementPhysicalWidthPixels=this.videoElementPhysicalWidthPixels,e.videoElementPhysicalHeightPixels=this.videoElementPhysicalHeightPixels,e.streamId=this.streamId,e}}t.default=c},2958:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(8236),a=c(9190),r=c(7086);t.default=class{constructor(e,t,c){this.tileFactory=e,this.audioVideoController=t,this.logger=c,this.tileMap=new Map,this.nextTileId=1,this.currentLocalTile=null,this.currentPausedTilesByIds=new Set}createDevicePixelRatioMonitorIfNeeded(){this.devicePixelRatioMonitor||(this.devicePixelRatioMonitor=new i.default(new a.default,this.logger))}discardDevicePixelRatioMonitorIfNotNeeded(){return n(this,void 0,void 0,(function*(){if(this.tileMap.size||!this.devicePixelRatioMonitor)return;const e=this.devicePixelRatioMonitor;return this.devicePixelRatioMonitor=void 0,e.destroy()}))}bindVideoElement(e,t){const c=this.getVideoTile(e);null!==c?c.bindVideoElement(t):this.logger.warn(`Ignoring video element binding for unknown tile id ${e}`)}unbindVideoElement(e){this.bindVideoElement(e,null)}startLocalVideoTile(){const e=this.findOrCreateLocalVideoTile();return this.currentLocalTile.stateRef().localTileStarted=!0,this.audioVideoController.update(),e.id()}stopLocalVideoTile(){this.currentLocalTile&&(this.currentLocalTile.stateRef().localTileStarted=!1,this.currentLocalTile.bindVideoStream(this.audioVideoController.configuration.credentials.attendeeId,!0,null,null,null,null,this.audioVideoController.configuration.credentials.externalUserId),this.audioVideoController.update())}hasStartedLocalVideoTile(){return!(!this.currentLocalTile||!this.currentLocalTile.stateRef().localTileStarted)}removeLocalVideoTile(){this.currentLocalTile&&this.removeVideoTile(this.currentLocalTile.id())}getLocalVideoTile(){return this.currentLocalTile}pauseVideoTile(e){const t=this.getVideoTile(e);t&&(this.currentPausedTilesByIds.has(e)||(this.audioVideoController.pauseReceivingStream(t.stateRef().streamId),this.currentPausedTilesByIds.add(e)),t.pause())}unpauseVideoTile(e){const t=this.getVideoTile(e);t&&(this.currentPausedTilesByIds.has(e)&&(this.audioVideoController.resumeReceivingStream(t.stateRef().streamId),this.currentPausedTilesByIds.delete(e)),t.unpause())}getVideoTile(e){return this.tileMap.has(e)?this.tileMap.get(e):null}getVideoTileArea(e){const t=e.state();let c=0,n=0;return t.boundVideoElement&&(c=t.boundVideoElement.clientHeight*t.devicePixelRatio,n=t.boundVideoElement.clientWidth*t.devicePixelRatio),c*n}getAllRemoteVideoTiles(){const e=new Array;return this.tileMap.forEach(((t,c)=>{this.currentLocalTile&&c===this.currentLocalTile.id()||e.push(t)})),e}getAllVideoTiles(){return Array.from(this.tileMap.values())}addVideoTile(e=!1){const t=this.nextTileId;this.nextTileId+=1,this.createDevicePixelRatioMonitorIfNeeded();const c=this.tileFactory.makeTile(t,e,this,this.devicePixelRatioMonitor);return this.tileMap.set(t,c),c}removeVideoTile(e){if(!this.tileMap.has(e))return;const t=this.tileMap.get(e);this.currentLocalTile===t&&(this.currentLocalTile=null),t.destroy(),this.tileMap.delete(e),this.audioVideoController.forEachObserver((t=>{r.default.of(t.videoTileWasRemoved).map((c=>c.bind(t)(e)))})),this.discardDevicePixelRatioMonitorIfNotNeeded()}removeVideoTilesByAttendeeId(e){const t=[];for(const c of this.getAllVideoTiles()){const n=c.state();n.boundAttendeeId===e&&(this.removeVideoTile(n.tileId),t.push(n.tileId))}return t}removeAllVideoTiles(){const e=Array.from(this.tileMap.keys());for(const t of e)this.removeVideoTile(t)}sendTileStateUpdate(e){this.audioVideoController.forEachObserver((t=>{r.default.of(t.videoTileDidUpdate).map((c=>c.bind(t)(e)))}))}haveVideoTilesWithStreams(){for(const e of this.getAllVideoTiles())if(e.state().boundVideoStream)return!0;return!1}haveVideoTileForAttendeeId(e){for(const t of this.getAllVideoTiles())if(t.state().boundAttendeeId===e)return!0;return!1}captureVideoTile(e){const t=this.getVideoTile(e);return t?t.capture():null}findOrCreateLocalVideoTile(){return this.currentLocalTile||(this.currentLocalTile=this.addVideoTile(!0),this.currentLocalTile.bindVideoStream(this.audioVideoController.configuration.credentials.attendeeId,!0,null,null,null,null,this.audioVideoController.configuration.credentials.externalUserId)),this.currentLocalTile}}},4922:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(3327);t.default=class{makeTile(e,t,c,i){return new n.default(e,t,c,i)}}},9394:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},4450:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(7086),i=c(7797),a=c(7606),r=c(5785),o=c(1133),s=c(9394);class l{constructor(e,t){this.selfAttendeeId=e,this.logger=t,this.numSenders=0,this.numParticipants=-1,this.newQualityMap=new Map,this.currentQualityMap=new Map,this.newActiveStreams=1,this.currentActiveStreams=1,this.lastUplinkBandwidthKbps=l.defaultUplinkBandwidthKbps,this.startTimeMs=0,this.lastUpdatedMs=Date.now(),this.videoIndex=null,this.currLocalDescriptions=[],this.nextLocalDescriptions=[],this.observerQueue=new Set,this.optimalParameters=new o.default(0,0,0,0,!0),this.parametersInEffect=new o.default(0,0,0,0,!0),this.lastUplinkBandwidthKbps=l.defaultUplinkBandwidthKbps,this.currentQualityMap=this.fillEncodingParamWithBitrates([300,0,1200]),this.newQualityMap=this.fillEncodingParamWithBitrates([300,0,1200])}updateConnectionMetric({uplinkKbps:e=0}){if(isNaN(e))return;0===this.startTimeMs&&(this.startTimeMs=Date.now()),Date.now()-this.startTimeMs`simulcast: uplink policy update metrics ${this.lastUplinkBandwidthKbps}`));let t=l.holdDownDurationMs;3===this.currentActiveStreams?t=2*l.holdDownDurationMs:(2===this.currentActiveStreams&&e<=l.kMidDisabledRate||1===this.currentActiveStreams&&e<=l.kHiDisabledRate)&&(t=l.holdDownDurationMs/2),Date.now()=c||this.lastUplinkBandwidthKbps<=n){this.numParticipants>=0&&this.numParticipants<=2?(this.newActiveStreams=0,t[0].maxBitrateKbps=0,t[1].maxBitrateKbps=0,t[2].maxBitrateKbps=1200):this.numSenders<=4&&this.lastUplinkBandwidthKbps>=l.kHiDisabledRate?(this.newActiveStreams=1,t[0].maxBitrateKbps=300,t[1].maxBitrateKbps=0,t[2].maxBitrateKbps=1200):this.lastUplinkBandwidthKbps>=l.kMidDisabledRate?(this.newActiveStreams=2,t[0].maxBitrateKbps=this.lastUplinkBandwidthKbps>=350?200:150,t[1].maxBitrateKbps=this.numSenders<=6?600:350,t[2].maxBitrateKbps=0):(this.newActiveStreams=3,t[0].maxBitrateKbps=300,t[1].maxBitrateKbps=0,t[2].maxBitrateKbps=0);const e=t.map(((e,t,c)=>e.maxBitrateKbps));this.newQualityMap=this.fillEncodingParamWithBitrates(e),this.encodingParametersEqual()||this.logger.info(`simulcast: policy:calculateEncodingParameters bw:${this.lastUplinkBandwidthKbps} numSources:${this.numSenders} numClients:${this.numParticipants} newQualityMap: ${this.getQualityMapString(this.newQualityMap)}`)}return this.newQualityMap}chooseMediaTrackConstraints(){return{width:{ideal:1280},height:{ideal:768},frameRate:{ideal:15}}}chooseEncodingParameters(){return this.currentQualityMap=this.newQualityMap,this.currentActiveStreams=this.newActiveStreams,this.activeStreamsToPublish!==this.newActiveStreams&&(this.activeStreamsToPublish=this.newActiveStreams,this.publishEncodingSimulcastLayer()),this.currentQualityMap}updateIndex(e){const t=e.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+1,c=e.numberOfParticipants(),n=t!==this.numSenders,i=c>2&&this.numParticipants<=2||c<=2&&this.numParticipants>2;this.numSenders=t,this.numParticipants=c,this.optimalParameters=new o.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1),this.videoIndex=e,this.newQualityMap=this.calculateEncodingParameters(n||i)}wantsResubscribe(){let e=!this.encodingParametersEqual();this.nextLocalDescriptions=this.videoIndex.localStreamDescriptions();for(let t=0;te.streamId===c));-1!==n&&this.nextLocalDescriptions[t].disabledByWebRTC!==this.currLocalDescriptions[n].disabledByWebRTC&&(e=!0)}}return e&&(this.lastUpdatedMs=Date.now()),this.currLocalDescriptions=this.nextLocalDescriptions,e}compareEncodingParameter(e,t){return JSON.stringify(e)===JSON.stringify(t)}encodingParametersEqual(){let e=!1;for(const t of r.default.NAME_ARR_ASCENDING)if(e=e||!this.compareEncodingParameter(this.newQualityMap.get(t),this.currentQualityMap.get(t)),e)break;return!e}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}captureWidth(){return 1280}captureHeight(){return 768}captureFrameRate(){return 15}maxBandwidthKbps(){return 1400}setIdealMaxBandwidthKbps(e){}setHasBandwidthPriority(e){}fillEncodingParamWithBitrates(e){const t=new Map,c=r.default.NAME_ARR_ASCENDING,n=e;let i=4;for(let e=0;e0,scaleResolutionDownBy:i,maxBitrate:1e3*n[e]}),i/=2}return t}getQualityMapString(e){let t="";const c=this.videoIndex.localStreamDescriptions();return 3===c.length&&e.forEach((e=>{let n=!1;n="low"===e.rid?c[0].disabledByWebRTC:"mid"===e.rid?c[1].disabledByWebRTC:c[2].disabledByWebRTC,t+=`{ rid: ${e.rid} active:${e.active} disabledByWebRTC: ${n} maxBitrate:${e.maxBitrate}}`})),t}getEncodingSimulcastLayer(e){switch(e){case 0:return a.default.High;case 1:return a.default.LowAndHigh;case 2:return a.default.LowAndMedium;case 3:return a.default.Low}}publishEncodingSimulcastLayer(){const e=this.getEncodingSimulcastLayer(this.activeStreamsToPublish);this.forEachObserver((t=>{n.default.of(t.encodingSimulcastLayersDidChange).map((c=>c.bind(t)(e)))}))}addObserver(e){this.logger.info("adding simulcast uplink observer"),this.observerQueue.add(e)}removeObserver(e){this.logger.info("removing simulcast uplink observer"),this.observerQueue.delete(e)}forEachObserver(e){for(const t of this.observerQueue)i.default.nextTick((()=>{this.observerQueue.has(t)&&e(t)}))}}t.default=l,l.defaultUplinkBandwidthKbps=1200,l.startupDurationMs=6e3,l.holdDownDurationMs=4e3,l.defaultMaxFrameRate=15,l.kHiDisabledRate=700,l.kMidDisabledRate=240},4442:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(1133);t.default=class{constructor(e){this.selfAttendeeId=e,this.numParticipants=0,this.idealMaxBandwidthKbps=1400,this.hasBandwidthPriority=!1,this.optimalParameters=new n.default(0,0,0,0,!1),this.parametersInEffect=new n.default(0,0,0,0,!1)}updateConnectionMetric(e){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(e){this.numParticipants=e.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+1,this.optimalParameters=new n.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1)}wantsResubscribe(){return!this.parametersInEffect.equal(this.optimalParameters)}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}captureWidth(){let e=640;return this.numParticipants>4&&(e=320),e}captureHeight(){let e=384;return this.numParticipants>4&&(e=192),e}captureFrameRate(){return 15}maxBandwidthKbps(){if(this.hasBandwidthPriority)return Math.trunc(this.idealMaxBandwidthKbps);let e=0;return e=this.numParticipants<=2?this.idealMaxBandwidthKbps:this.numParticipants<=4?2*this.idealMaxBandwidthKbps/3:(544/11+14880/(11*this.numParticipants))/600*this.idealMaxBandwidthKbps,Math.trunc(e)}setIdealMaxBandwidthKbps(e){this.idealMaxBandwidthKbps=e}setHasBandwidthPriority(e){this.hasBandwidthPriority=e}}},657:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(1133);t.default=class{constructor(){}updateConnectionMetric(e){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(e){}wantsResubscribe(){return!1}chooseCaptureAndEncodeParameters(){return new n.default(0,0,0,0,!1)}maxBandwidthKbps(){return 0}setIdealMaxBandwidthKbps(e){}setHasBandwidthPriority(e){}}},3928:(e,t)=>{"use strict";function c(e){return e.map((e=>"object"==typeof e?JSON.stringify(e):`${e}`)).join(" ")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.base=e}debug(...e){this.base.debug(c(e))}info(...e){this.base.info(c(e))}warn(...e){this.base.warn(c(e))}error(...e){this.base.error(c(e))}}},2497:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VoiceFocusDeviceTransformer=void 0;const i=c(6035),a=c(4046),r=c(3928),o=c(8878),s=c(851);class l{constructor(e,{preload:t=!0,logger:c,fetchBehavior:n=l.defaultFetchBehavior()},i){this.spec=e,this.supported=!0,this.logger=c,this.vfLogger=c?new r.default(c):void 0,this.preload=t,this.fetchBehavior=n,this.spec=l.augmentSpec(this.spec),i&&(this.configuration=Promise.resolve(i))}static isSupported(e,t){const c={fetchBehavior:l.defaultFetchBehavior(),logger:(null==t?void 0:t.logger)?new r.default(t.logger):void 0};return i.VoiceFocus.isSupported(l.augmentSpec(e),c)}static create(e={},t={},c){return n(this,void 0,void 0,(function*(){const n=new l(e,t,c);return yield n.init(),n}))}static configure(e={},t={}){return n(this,void 0,void 0,(function*(){return new l(e,t,void 0).configure(!0)}))}getConfiguration(){return this.configuration}isSupported(){return this.supported}createTransformDevice(e,t){return n(this,void 0,void 0,(function*(){if(this.supported)try{const c=!0,[n,i]=yield this.allocateVoiceFocus(c);return new o.default(e,n,i,t)}catch(e){return}}))}static augmentSpec(e){return e&&(e.assetGroup||e.revisionID)?e:Object.assign(Object.assign({},e),{assetGroup:l.currentSDKAssetGroup()})}configure(e=!1){return n(this,void 0,void 0,(function*(){const t={fetchBehavior:this.fetchBehavior,preResolve:e,logger:this.vfLogger};return i.VoiceFocus.configure(this.spec,t)}))}init(){var e;return n(this,void 0,void 0,(function*(){this.configuration||(this.configuration=this.configure());const t=yield this.configuration;if(t.supported){this.pendingVoiceFocus=this.createVoiceFocus(t,this.preload);try{yield this.pendingVoiceFocus}catch(t){null===(e=this.logger)||void 0===e||e.error(`Unable to initialize Amazon Voice Focus: ${t}`),this.supported=!1}}else this.supported=!1}))}createVoiceFocus(e,t){return n(this,void 0,void 0,(function*(){const c=new s.default;return[yield i.VoiceFocus.init(e,{delegate:c,preload:t,logger:this.vfLogger}),c]}))}allocateVoiceFocus(e){return n(this,void 0,void 0,(function*(){if(!this.supported)throw new Error("Not supported.");if(this.pendingVoiceFocus){const e=this.pendingVoiceFocus;return this.pendingVoiceFocus=void 0,e}return this.createVoiceFocus(yield this.configuration,e)}))}static majorVersion(){return a.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|[1-9][0-9]*)/)[0]}static majorMinorVersion(){return a.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|(?:[1-9][0-9]*))\.(?:0|[1-9][0-9]*)/)[0]}static currentSDKAssetGroup(){const e=this.majorVersion();return e?`sdk-${e}`:"stable-v1"}static defaultFetchBehavior(){const e=l.majorMinorVersion()||"unknown",t=a.default.sdkUserAgentLowResolution;return{escapedQueryString:`sdk=${encodeURIComponent(e)}&ua=${encodeURIComponent(t)}`}}}t.VoiceFocusDeviceTransformer=l,t.default=l},8878:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(543);class a{constructor(e,t,c,n,a=!1,r=void 0,o=new i.default){this.device=e,this.voiceFocus=t,this.delegate=c,this.nodeOptions=n,this.failed=a,this.node=r,this.browserBehavior=o}getInnerDevice(){return this.device}mute(e){return n(this,void 0,void 0,(function*(){this.node&&(e?yield this.node.disable():yield this.node.enable())}))}stop(){return n(this,void 0,void 0,(function*(){this.node&&(this.node.disconnect(),yield this.node.stop())}))}chooseNewInnerDevice(e){return n(this,void 0,void 0,(function*(){return this.device!==e||"default"===(t=e)||t&&"object"==typeof t&&("deviceId"in t&&"default"===t.deviceId||"id"in t&&"default"===t.id)?new a(e,this.voiceFocus,this.delegate,this.nodeOptions,this.failed,this.node,this.browserBehavior):this;var t}))}intrinsicDevice(){return n(this,void 0,void 0,(function*(){if(this.failed)return this.device;const e={echoCancellation:!0,googEchoCancellation:!0,googEchoCancellation2:!0,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googNoiseSuppression2:!1};let t;return t=!this.nodeOptions||void 0===this.nodeOptions.agc||this.nodeOptions.agc.useBuiltInAGC,e.autoGainControl=t,e.googAutoGainControl=t,e.googAutoGainControl2=t,this.device?"string"==typeof this.device?(this.browserBehavior.requiresNoExactMediaStreamConstraints()?e.deviceId=this.device:e.deviceId={exact:this.device},e):this.device.id?this.device:Object.assign(Object.assign({},this.device),e):e}))}createAudioNode(e){var t,c;return n(this,void 0,void 0,(function*(){if((null===(t=this.node)||void 0===t?void 0:t.context)===e)return{start:this.node,end:this.node};const n=Object.assign({enabled:!0,agc:{useVoiceFocusAGC:!1}},this.nodeOptions);try{return null===(c=this.node)||void 0===c||c.disconnect(),this.node=yield this.voiceFocus.createNode(e,n),{start:this.node,end:this.node}}catch(e){throw this.failed=!0,this.delegate.onFallback(this,e),e}}))}addObserver(e){this.delegate.addObserver(e)}removeObserver(e){this.delegate.removeObserver(e)}}t.default=a},851:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.observers=new Set}addObserver(e){this.observers.add(e)}removeObserver(e){this.observers.delete(e)}onFallback(e,t){var c;for(const n of this.observers)null===(c=n.voiceFocusFellBackToInnerStream)||void 0===c||c.call(n,e,t)}onCPUWarning(){var e;for(const t of this.observers)null===(e=t.voiceFocusInsufficientResources)||void 0===e||e.call(t)}}},9751:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class c{constructor(e,t,c,n){this.logger=e,this.realtimeController=t,this.minVolumeDecibels=c,this.maxVolumeDecibels=n,this.streamIdToAttendeeId={},this.streamIdToExternalUserId={},this.warnedAboutMissingStreamIdMapping={},this.attendeeIdToStreamId={},this.sessionReconnected=!1}onReconnect(){this.sessionReconnected=!0}sendRealtimeUpdatesForAudioStreamIdInfo(e){let t=0;for(const c of e.streams){const n=!!c.attendeeId,i=!!c.externalUserId,a=c.hasOwnProperty("muted"),r=!!c.dropped;if(n){this.attendeeIdToStreamId[c.attendeeId]&&this.attendeeIdToStreamId[c.attendeeId]c.audioStreamId&&this.streamIdToAttendeeId[t]===n){a=!0;break}}a||this.realtimeController.realtimeSetAttendeeIdPresence(n,!1,i,r,{attendeeIndex:t++,attendeesInFrame:e.streams.length})}}}this.sessionReconnected&&(this.cleanUpState(e),this.sessionReconnected=!1)}cleanUpState(e){const t=Object.values(this.streamIdToAttendeeId),c=e.streams.map((e=>e.attendeeId)),n=t.filter((e=>!c.includes(e)));for(const[e,t]of n.entries()){const c=this.attendeeIdToStreamId[t],n=this.streamIdToExternalUserId[c];delete this.streamIdToAttendeeId[c],delete this.streamIdToExternalUserId[c],delete this.warnedAboutMissingStreamIdMapping[c],delete this.attendeeIdToStreamId[t],this.realtimeController.realtimeSetAttendeeIdPresence(t,!1,n,!1,{attendeeIndex:e,attendeesInFrame:t.length})}}sendRealtimeUpdatesForAudioMetadata(e){let t=null,c=null;for(const n of e.attendeeStates){const e=this.attendeeIdForStreamId(n.audioStreamId);n.hasOwnProperty("volume")&&(null===t&&(t={}),null!==e&&(t[e]=this.normalizedVolume(n))),n.hasOwnProperty("signalStrength")&&(null===c&&(c={}),null!==e&&(c[e]=this.normalizedSignalStrength(n)))}this.applyRealtimeUpdatesForAudioMetadata(t,c)}normalizedVolume(e){const t=1-(-e.volume-this.maxVolumeDecibels)/(this.minVolumeDecibels-this.maxVolumeDecibels);return Math.min(Math.max(t,0),1)}normalizedSignalStrength(e){const t=e.signalStrength/c.MAX_SIGNAL_STRENGTH_LEVELS;return Math.min(Math.max(t,0),1)}applyRealtimeUpdatesForAudioMetadata(e,t){for(const n in this.streamIdToAttendeeId){const i=this.streamIdToAttendeeId[n],a=this.streamIdToExternalUserId[n];let r=null,o=null;null!==e&&(r=e.hasOwnProperty(i)?e[i]:c.IMPLICIT_VOLUME),null!==t&&(o=t.hasOwnProperty(i)?t[i]:c.IMPLICIT_SIGNAL_STRENGTH),null===r&&null===o||this.realtimeController.realtimeUpdateVolumeIndicator(i,r,null,o,a)}}attendeeIdForStreamId(e){return 0===e?null:this.streamIdToAttendeeId[e]||(this.warnedAboutMissingStreamIdMapping[e]||(this.warnedAboutMissingStreamIdMapping[e]=!0,this.logger.warn(`volume indicator stream id ${e} seen before being defined`)),null)}}t.default=c,c.MAX_SIGNAL_STRENGTH_LEVELS=2,c.IMPLICIT_VOLUME=0,c.IMPLICIT_SIGNAL_STRENGTH=1},7631:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=c(4046),i=c(7387);t.default=class{constructor(e){this.logger=e}create(e,t,c){this.connection=new WebSocket(c?e:n.default.urlWithVersion(e),t),this.connection.binaryType="arraybuffer"}send(e){try{return e instanceof Uint8Array?this.connection.send(e.buffer):this.connection.send(e),!0}catch(e){return this.logger.debug((()=>`send error: ${e.message}, websocket state=${i.default[this.readyState()]}`)),!1}}close(e,t){this.connection.close(e,t)}destroy(){this.connection=null}addEventListener(e,t){this.connection.addEventListener(e,t)}readyState(){if(!this.connection)return i.default.None;switch(this.connection.readyState){case WebSocket.CONNECTING:return i.default.Connecting;case WebSocket.OPEN:return i.default.Open;case WebSocket.CLOSING:return i.default.Closing;case WebSocket.CLOSED:return i.default.Closed}}}},7387:(e,t)=>{"use strict";var c;Object.defineProperty(t,"__esModule",{value:!0}),t.WebSocketReadyState=void 0,function(e){e[e.None=0]="None",e[e.Connecting=1]="Connecting",e[e.Open=2]="Open",e[e.Closing=3]="Closing",e[e.Closed=4]="Closed"}(c=t.WebSocketReadyState||(t.WebSocketReadyState={})),t.default=c},5995:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.decideModel=t.measureAndDecideExecutionApproach=void 0;const i=c(5021),a=c(9424),r={wasm:{noSupport:.07,inline:{c100:1,c50:.36,c20:.16,c10:.07},worker:{c100:.5,c50:.18,c20:.08,c10:.06}},simd:{noSupport:.1,inline:{c100:1,c50:.43,c20:.3,c10:.2},worker:{c100:.5,c50:.21,c20:.15,c10:.1}}};class o{constructor(e,t){this.fetchConfig=e,this.logger=t;const c=`${e.paths.workers}estimator-v1.js`;this.fetchBehavior={headers:e.headers,escapedQueryString:e.escapedQueryString},this.worker=i.loadWorker(c,"VoiceFocusEstimator",this.fetchBehavior,t)}roundtrip(e,t,c){return new Promise(((n,i)=>{this.worker.then((i=>{let a;a=e=>{const{message:r,key:o}=e.data;r===t&&o===c&&(i.removeEventListener("message",a),n(e.data))},i.addEventListener("message",a),i.postMessage(e)})).catch((e=>{var t;null===(t=this.logger)||void 0===t||t.error("Failed to load worker.",e),i(e)}))}))}supportsSIMD(e){const t="simd",c=e||`${this.fetchConfig.paths.wasm}simd-v1.wasm`,n={message:"supports-simd",fetchBehavior:this.fetchBehavior,path:c,key:t};return this.roundtrip(n,"simd-support",t).then((e=>e.supports))}measure(e,t){const c=`${this.fetchConfig.paths.wasm}bench-v1.wasm`,n=`${this.fetchConfig.paths.wasm}bench-v1_simd.wasm`,i=e?n:c,a=`bench:${e}`,r={message:"measure",fetchBehavior:this.fetchBehavior,budget:t,path:i,key:a};return this.roundtrip(r,"measurement",a).then((e=>{if(e.measurement)return e.measurement;throw new Error("Failed to measure.")}))}stop(){this.worker.then((e=>{var t;null===(t=this.logger)||void 0===t||t.debug("Stopping estimator worker."),e.terminate()})).catch((e=>{}))}}const s=(e,t,c,i)=>n(void 0,void 0,void 0,(function*(){const n={supportsSIMD:e,supportsSAB:a.supportsSharedArrayBuffer(globalThis,window,c),duration:-1};if(e)return null==c||c.info("Supports SIMD: true (force)"),n;const r=!i,s=i||new o(t,c);try{const t=!a.isOldChrome(window,c)&&(yield s.supportsSIMD());return null==c||c.info(`Supports SIMD: ${t} (force: ${e})`),n.supportsSIMD=t,n}finally{r&&s.stop()}}));t.measureAndDecideExecutionApproach=(e,t,c,i=r)=>n(void 0,void 0,void 0,(function*(){let l=e.executionPreference;const{usagePreference:u,variantPreference:f,simdPreference:d,estimatorBudget:h,executionQuantaPreference:m}=e;"interactivity"===u&&"inline"!==l&&(null==c||c.debug(`Overriding execution preference ${l} to reflect interactivity preference.`),l="inline");const p="force"===d,v="auto"!==f,g="auto"!==l;let b;try{b=v&&g?yield s(p,t,c):yield((e,t,c,i)=>n(void 0,void 0,void 0,(function*(){const n=new o(t,i);try{const a=yield s(e,t,i,n);if(a.supportsSIMD)try{return a.duration=yield n.measure(!0,c),null==i||i.info("SIMD timing:",a.duration),a}catch(e){null==i||i.warn("Failed SIMD estimation; falling back to non-SIMD."),a.supportsSIMD=!1}return a.duration=yield n.measure(!1,c),null==i||i.info("No-SIMD timing:",a.duration),a}catch(e){throw null==i||i.error("Could not feature check.",e),e}finally{n.stop()}})))(p,t,h,c)}catch(e){throw null==c||c.error("Could not load estimator.",e),new Error("Could not load Voice Focus estimator.")}return(({supportsSIMD:e,supportsSAB:t,duration:c,executionPreference:n="auto",simdPreference:i,variantPreference:o="auto",usagePreference:s,executionQuantaPreference:l=3},u=r,f)=>{const d="force"===i||"disable"!==i&&e,h=-1!==c,m=h?(d?2.5:2.63)/c:0,p=d?u.simd:u.wasm,v=h?((e,t)=>1===e?.6:"quality"===t?.65*e:.5*e)(l,s)*m:0,g=h?.7*m:0,b=e=>({supported:!1,reason:e});if(h){if(m({supported:!0,useSIMD:d,processor:e,executionApproach:t,variant:c,executionQuanta:"inline"===t?l:void 0}),C=(e,t,c)=>"auto"!==t?!h||e>c[t]?t:"failed":e>c.c100?"c100":e>c.c50?"c50":e>c.c20?"c20":e>c.c10?"c10":"failed",M=e=>{switch(e||"auto"){case"auto":{let e=M("inline"),t=M("worker");return null==f||f.debug(`Reducing auto preference: ${JSON.stringify(e)} vs ${JSON.stringify(t)}`),!1===e.supported||!1===t.supported?t:e.variant===t.variant||"c50"===e.variant?e:t}case"worker":return a.supportsSharedArrayBuffer(globalThis,window,f)?M("worker-sab"):M("worker-postMessage");case"inline":{const e=C(v,o,p.inline);return"failed"===e?b(`Performance score ${v} not sufficient for inline use with variant preference ${o}.`):z("voicefocus-inline-processor","inline",e)}case"worker-sab":{if(!t){const e="Requested worker-sab but no SharedArrayBuffer support.";return null==f||f.warn(e),{supported:!1,reason:e}}const e=C(g,o,p.worker);return"failed"===e?b(`Performance score ${g} not sufficient for worker use with variant preference ${o}.`):z("voicefocus-worker-sab-processor","worker-sab",e)}case"worker-postMessage":{const e=C(g,o,p.worker);return"failed"===e?b(`Performance score ${g} not sufficient for worker use.`):z("voicefocus-worker-postMessage-processor","worker-postMessage",e)}}};return M(n)})(Object.assign(Object.assign({},b),{simdPreference:d,executionPreference:l,variantPreference:f,usagePreference:u,executionQuantaPreference:m}),i,c)})),t.decideModel=({category:e,name:t,variant:c,simd:n,url:i})=>`${e}-${t}-${c}-v1${n?"_simd":""}`},623:(e,t)=>{"use strict";function c(e,t,c){if(!c)return fetch(e,t);const a=i(e,c),r=n(t,c);return fetch(a,r)}function n(e,t){return(null==t?void 0:t.headers)?e?Object.assign(Object.assign({},e),{headers:Object.assign(Object.assign({},e.headers||{}),t.headers)}):{headers:t.headers}:e}function i(e,t){if(!(null==t?void 0:t.escapedQueryString))return e;const c=-1!==e.lastIndexOf("?");return`${e}${c?"&":"?"}${t.escapedQueryString}`}Object.defineProperty(t,"__esModule",{value:!0}),t.isValidRevisionID=t.isValidAssetGroup=t.resolveURL=t.addQueryParams=t.withQueryString=t.withRequestHeaders=t.fetchWithBehavior=void 0,t.fetchWithBehavior=c,t.withRequestHeaders=n,t.withQueryString=i,t.addQueryParams=function(e,t){const c=Object.keys(t);if(!c.length)return e;const n=new URLSearchParams(null==e?void 0:e.escapedQueryString);for(const e of c)n.append(e,t[e]);return Object.assign(Object.assign({},e),{escapedQueryString:n.toString()})};const a={method:"HEAD",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"origin"};t.resolveURL=function(e,t){return c(e,a,t).then((t=>t.redirected?t.url:e))},t.isValidAssetGroup=function(e){return!!e&&/^[-.a-zA-Z0-9]+$/.test(e)},t.isValidRevisionID=function(e){return!!e&&/^[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{22}$/.test(e)}},5021:(e,t,c)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadWorker=void 0;const n=c(623),i={method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"};t.loadWorker=(e,t,c,a)=>{null==a||a.debug(`Loading ${t} worker from ${e}.`);let r=!1;try{r=self.origin===new URL(e).origin}catch(e){null==a||a.error("Could not compare origins.",e)}if(r){const i=n.withQueryString(e,c);return Promise.resolve(new Worker(i,{name:t}))}return n.fetchWithBehavior(e,i,c).then((e=>{if(e.ok)return e.blob().then((e=>new Worker(window.URL.createObjectURL(e))));throw new Error("Fetch failed.")}))}},9424:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isOldChrome=t.supportsWASMStreaming=t.supportsSharedArrayBuffer=t.supportsWASM=t.supportsAudioWorklet=t.supportsWorker=t.supportsVoiceFocusWorker=t.supportsWASMPostMessage=t.isSafari=void 0;const i=c(5021);t.isSafari=(e=globalThis)=>{const t=e.navigator.userAgent,c=t.match(/Safari\//),n=t.match(/Chrom(?:e|ium)\//);return!(!c||n)},t.supportsWASMPostMessage=(e=globalThis)=>!t.isSafari(e),t.supportsVoiceFocusWorker=(e=globalThis,c,a)=>n(void 0,void 0,void 0,(function*(){if(!t.supportsWorker(e,a))return!1;const n=`${c.paths.workers}worker-v1.js`;try{const e=yield i.loadWorker(n,"VoiceFocusTestWorker",c,a);try{e.terminate()}catch(e){null==a||a.debug("Failed to terminate worker.",e)}return!0}catch(e){return null==a||a.info("Failed to fetch and instantiate test worker",e),!1}})),t.supportsWorker=(e=globalThis,t)=>{try{return!!e.Worker}catch(e){return null==t||t.info("Does not support Worker",e),!1}},t.supportsAudioWorklet=(e=globalThis,t)=>{try{return!!e.AudioWorklet&&!!e.AudioWorkletNode}catch(e){return null==t||t.info("Does not support Audio Worklet",e),!1}},t.supportsWASM=(e=globalThis,t)=>{try{return!(!e.WebAssembly||!e.WebAssembly.compile&&!e.WebAssembly.compileStreaming)}catch(e){return null==t||t.info("Does not support WASM",e),!1}},t.supportsSharedArrayBuffer=(e=globalThis,t=globalThis,c)=>{try{return!(!e.SharedArrayBuffer||!t.chrome&&!e.crossOriginIsolated)}catch(e){return null==c||c.info("Does not support SharedArrayBuffer."),!1}},t.supportsWASMStreaming=(e=globalThis,t)=>{var c;try{return!!(null===(c=e.WebAssembly)||void 0===c?void 0:c.compileStreaming)}catch(e){return null==t||t.info("Does not support WASM streaming compilation",e),!1}},t.isOldChrome=(e=globalThis,t)=>{try{if(!e.chrome)return!1}catch(e){}const c=e.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/);return c?parseInt(c[1],10)<90&&(null==t||t.debug(`Chrome ${c[1]} has incomplete SIMD support.`),!0):(null==t||t.debug("Unknown Chrome version."),!0)}},103:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VoiceFocusAudioWorkletNode=void 0;class c extends("undefined"!=typeof globalThis&&globalThis.AudioWorkletNode||class{}){}t.VoiceFocusAudioWorkletNode=c},6035:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getAudioInput=t.createAudioContext=t.VoiceFocus=void 0;const i=c(5995),a=c(623),r=c(5021),o=c(9424),s=c(2633),l=c(1678),u=c(271),f={useVoiceFocusAGC:!1,useBuiltInAGC:!0},d="stable-v1",h="https://static.sdkassets.chime.aws/",m={processors:`${h}processors/`,workers:`${h}workers/`,wasm:`${h}wasm/`,models:`${h}wasm/`},p={latencyHint:0},v={channelCount:1,echoCancellation:!0,googEchoCancellation:!0,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googTypingNoiseDetection:!1},g=Object.assign(Object.assign({},v),{autoGainControl:!0,googAutoGainControl:!0,googAutoGainControl2:!0}),b=Object.assign(Object.assign({},v),{autoGainControl:!1,googAutoGainControl:!1,googAutoGainControl2:!1}),z={"voicefocus-worker-sab-processor":{file:"worklet-worker-sab-processor-v1.js",node:l.default},"voicefocus-worker-postMessage-processor":{file:"worklet-worker-postMessage-processor-v1.js",node:u.default},"voicefocus-inline-processor":{file:"worklet-inline-processor-v1.js",node:s.default}},C=(e,t)=>{if(void 0!==e&&!a.isValidAssetGroup(e))throw new Error(`Invalid asset group ${e}`);if(void 0!==t&&!a.isValidRevisionID(t))throw new Error(`Invalid revision ID ${t}`)},M=(e,t)=>`${t.models}${i.decideModel(e)}.wasm`;class S{constructor(e,t,c,n,i){this.processorURL=t,this.nodeConstructor=c,this.nodeOptions=n,this.executionQuanta=i,this.internal={worker:e,nodeOptions:n}}static isSupported(e,t){const{fetchBehavior:c,logger:n}=t||{};if("undefined"==typeof globalThis)return null==n||n.debug("Browser does not have globalThis."),Promise.resolve(!1);if(!o.supportsAudioWorklet(globalThis,n))return null==n||n.debug("Browser does not support Audio Worklet."),Promise.resolve(!1);if(!o.supportsWASM(globalThis,n))return null==n||n.debug("Browser does not support WASM."),Promise.resolve(!1);o.supportsWASMStreaming(globalThis,n)||null==n||n.debug("Browser does not support streaming WASM compilation.");const{assetGroup:i=d,revisionID:r,paths:s=m}=e||{};C(i,r);const l=r?{revisionID:r}:{assetGroup:i},u=a.addQueryParams(c,l),f=Object.assign(Object.assign({},u),{paths:s});return o.supportsVoiceFocusWorker(globalThis,f,n)}static mungeExecutionPreference(e,t){const c=void 0===e||"auto"===e;if(o.isSafari(globalThis)){if(c||"inline"===e)return"inline";if(!c)throw new Error(`Unsupported execution preference ${e}`)}if("worker-sab"===e&&!o.supportsSharedArrayBuffer(globalThis,globalThis,t))throw new Error(`Unsupported execution preference ${e}`);return e||"auto"}static configure(e,t){return n(this,void 0,void 0,(function*(){const{fetchBehavior:c,preResolve:n,logger:r}=t||{},{category:o="voicefocus",name:s="default",variant:l="auto",assetGroup:u=d,revisionID:f,simd:h="detect",executionPreference:p="auto",executionQuantaPreference:v,usagePreference:g="interactivity",estimatorBudget:b=100,paths:z=m,thresholds:S}=e||{};if(null==r||r.debug("Configuring Voice Focus with spec",e),void 0!==o&&"voicefocus"!==o)throw new Error(`Unrecognized category ${o}`);if(void 0!==s&&"default"!==s)throw new Error(`Unrecognized feature name ${s}`);if(void 0!==l&&!["auto","c100","c50","c20","c10"].includes(l))throw new Error(`Unrecognized feature variant ${l}`);if(void 0!==v&&![1,2,3].includes(v))throw new Error(`Unrecognized execution quanta preference ${v}`);if(C(u,f),void 0!==h&&!["detect","force","disable"].includes(h))throw new Error(`Unrecognized SIMD option ${h}`);if(void 0!==p&&!["auto","inline","worker","worker-sab","worker-postMessage"].includes(p))throw new Error(`Unrecognized execution preference ${p}`);if(void 0!==g&&!["quality","interactivity"].includes(g))throw new Error(`Unrecognized usage preference ${g}`);const V={executionPreference:this.mungeExecutionPreference(p,r),usagePreference:g,executionQuantaPreference:v,variantPreference:l,simdPreference:h,estimatorBudget:b},y=f?{revisionID:f}:{assetGroup:u},H=a.addQueryParams(c,y),w=Object.assign({paths:z},H),x=yield i.measureAndDecideExecutionApproach(V,w,r,S);if(!1===x.supported)return{supported:!1,reason:x.reason};null==r||r.info("Decided execution approach",x);const{useSIMD:L,processor:k,variant:N,executionQuanta:E}=x,A={category:o||"voicefocus",name:s||"default",variant:N,simd:L};if(n){const e=M(A,z);A.url=yield a.resolveURL(e,H)}return{fetchConfig:w,model:A,processor:k,executionQuanta:E,supported:!0}}))}static init(e,{delegate:t,preload:c=!0,logger:i}){return n(this,void 0,void 0,(function*(){if(!1===e.supported)throw new Error("Voice Focus not supported. Reason: "+e.reason);const{model:n,processor:a,fetchConfig:s,executionQuanta:l}=e,{simd:u}=n,{paths:f}=s;if("voicefocus-inline-processor"!==a&&"voicefocus-worker-postMessage-processor"!==a&&"voicefocus-worker-sab-processor"!==a)throw new Error(`Unknown processor ${a}`);const d=n.url||M(n,f);null==i||i.debug(`Using model URL ${d}.`);const h=`${f.wasm}audio_buffer-v1${u?"_simd":""}.wasm`,m=`${f.wasm}resampler-v1${u?"_simd":""}.wasm`,p=`${f.workers}worker-v1.js`,{file:v,node:g}=z[a],b=`${f.processors}${v}`,C=yield r.loadWorker(p,"VoiceFocusWorker",s,i);if(c){null==i||i.debug("Preloading",d);let e=o.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";C.postMessage({message:e,preload:!0,key:"model",fetchBehavior:s,path:d})}const V=new S(C,b,g,{processor:a,worker:C,audioBufferURL:h,resamplerURL:m,fetchBehavior:s,modelURL:d,delegate:t},l);return Promise.resolve(V)}))}createNode(e,t){var c;const{voiceFocusSampleRate:n=(16e3===e.sampleRate?16e3:48e3),enabled:i=!0,agc:r=f}=t||{},o={voiceFocusSampleRate:n,enabled:i,sendBufferCount:10,prefill:6,agc:r,executionQuanta:this.executionQuanta},s=a.withQueryString(this.processorURL,null===(c=this.nodeOptions)||void 0===c?void 0:c.fetchBehavior);return e.audioWorklet.addModule(s).then((()=>new this.nodeConstructor(e,Object.assign(Object.assign({},this.nodeOptions),{processorOptions:o}))))}applyToStream(e,t,c){return n(this,void 0,void 0,(function*(){const n=t.createMediaStreamSource(e),i=yield this.applyToSourceNode(n,t,c),a=t.createMediaStreamDestination();return i.connect(a),{node:i,source:n,destination:a,stream:a.stream}}))}applyToSourceNode(e,t,c){return n(this,void 0,void 0,(function*(){const n=yield this.createNode(t,c);return e.connect(n),n}))}}t.VoiceFocus=S,t.createAudioContext=(e=p)=>new(window.AudioContext||window.webkitAudioContext)(e),t.getAudioInput=(e,t,c)=>n(void 0,void 0,void 0,(function*(){var n,i;const{constraints:a,spec:r,delegate:o,preload:s=!0,options:l}=t,{logger:u}=c,d=yield S.configure(r,c);if(!d.supported)return null===(n=c.logger)||void 0===n||n.warn("Voice Focus not supported; returning standard stream."),window.navigator.mediaDevices.getUserMedia(a);const h=yield S.init(d,{delegate:o,preload:s,logger:u}),m=(null===(i=t.options)||void 0===i?void 0:i.agc)||f,p=yield window.navigator.mediaDevices.getUserMedia(((e,t)=>{let c;if(c=t.useBuiltInAGC?g:b,!e)return{audio:c};if(!e.audio)return e;if(e.video)throw new Error("Not adding Voice Focus to multi-device getUserMedia call.");return Object.assign(Object.assign({},e),{audio:!0===e.audio?c:Object.assign(Object.assign({},e.audio),c)})})(a,m));return h.applyToStream(p,e,l).then((e=>e.stream))}))},2633:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(9424),a=c(103);class r extends a.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t);const{modelURL:c,worker:n,fetchBehavior:a,logger:r}=t;this.logger=r,this.port.onmessage=this.onProcessorMessage.bind(this),r&&r.debug("VoiceFocusInlineNode:",c),this.worker=n,this.worker.onmessage=this.onWorkerMessage.bind(this);const o=i.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:o,key:"model",fetchBehavior:a,path:c})}onModuleBufferLoaded(e,t){this.port.postMessage({message:"module-buffer",buffer:e,key:t})}onModuleLoaded(e,t){this.port.postMessage({message:"module",module:e,key:t})}enable(){return n(this,void 0,void 0,(function*(){this.port.postMessage({message:"enable"})}))}disable(){return n(this,void 0,void 0,(function*(){this.port.postMessage({message:"disable"})}))}stop(){return n(this,void 0,void 0,(function*(){this.port.postMessage({message:"stop"}),this.disconnect()}))}onProcessorMessage(e){var t;"cpu"===e.data.message||null===(t=this.logger)||void 0===t||t.debug("Ignoring processor message.")}onWorkerMessage(e){const t=e.data;switch(t.message){case"module-buffer":if(!t.buffer||!t.key)return;this.onModuleBufferLoaded(t.buffer,t.key);break;case"module":if(!t.module||!t.key)return;this.onModuleLoaded(t.module,t.key);break;case"stopped":this.worker&&this.worker.terminate();break;default:return}}}t.default=r},271:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(9424),a=c(103);class r extends a.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t);const{modelURL:c,audioBufferURL:n,worker:a,fetchBehavior:r,delegate:o}=t;this.delegate=o,this.worker=a,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this),this.worker.postMessage({message:"init",approach:"postMessage",frames:16e3===e.sampleRate?160:480,enabled:t.processorOptions.enabled,agc:t.processorOptions.agc,fetchBehavior:r,model:c});const s=i.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:s,key:"buffer",fetchBehavior:r,path:n})}enable(){return n(this,void 0,void 0,(function*(){this.worker.postMessage({message:"enable"})}))}disable(){return n(this,void 0,void 0,(function*(){this.worker.postMessage({message:"disable"})}))}stop(){return n(this,void 0,void 0,(function*(){try{this.worker.postMessage({message:"stop"})}catch(e){}this.disconnect()}))}onWorkerMessage(e){var t;const c=e.data;switch(c.message){case"ready":this.port.postMessage({message:"ready",shared:c.shared},c.shared?Object.values(c.shared):[]);break;case"data":if(!c.buffer)return;this.port.postMessage({message:"data",buffer:c.buffer},[c.buffer]);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(c);break;case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;default:return}}onProcessorMessage(e){var t;const c=e.data;switch(c.message){case"data":if(!c.buffer)return;this.worker.postMessage({message:"data",buffer:c.buffer},[c.buffer]);break;case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(c);break;default:return}}}t.default=r},1678:function(e,t,c){"use strict";var n=this&&this.__awaiter||function(e,t,c,n){return new(c||(c=Promise))((function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function o(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof c?t:new c((function(e){e(t)}))).then(r,o)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=c(9424),a=c(103);class r extends a.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t);const{modelURL:c,resamplerURL:n,worker:a,fetchBehavior:r,delegate:o}=t;this.delegate=o,this.worker=a,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this),this.worker.postMessage({message:"init",approach:"sab",frames:16e3===e.sampleRate?160:480,enabled:t.processorOptions.enabled,model:c});const s=i.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:s,key:"resampler",fetchBehavior:r,path:n})}enable(){return n(this,void 0,void 0,(function*(){this.state?(Atomics.store(this.state,1,1),Atomics.notify(this.state,0,1)):this.worker.postMessage({message:"enable"})}))}disable(){return n(this,void 0,void 0,(function*(){this.state?(Atomics.store(this.state,1,0),Atomics.notify(this.state,0,1)):this.worker.postMessage({message:"disable"})}))}stop(){return n(this,void 0,void 0,(function*(){if(this.state)Atomics.store(this.state,1,2),Atomics.notify(this.state,0,1);else try{this.worker.postMessage({message:"stop"})}catch(e){}this.disconnect()}))}onWorkerMessage(e){var t;const c=e.data;switch(c.message){case"ready":if(!c.shared)throw new Error("No shared state.");this.state=new Int32Array(c.shared.state),this.port.postMessage(c);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(c);break;case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;default:return}}onProcessorMessage(e){var t;const c=e.data;switch(c.message){case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(c)}}}t.default=r},9742:(e,t)=>{"use strict";t.byteLength=function(e){var t=o(e),c=t[0],n=t[1];return 3*(c+n)/4-n},t.toByteArray=function(e){var t,c,a=o(e),r=a[0],s=a[1],l=new i(function(e,t,c){return 3*(t+c)/4-c}(0,r,s)),u=0,f=s>0?r-4:r;for(c=0;c>16&255,l[u++]=t>>8&255,l[u++]=255&t;return 2===s&&(t=n[e.charCodeAt(c)]<<2|n[e.charCodeAt(c+1)]>>4,l[u++]=255&t),1===s&&(t=n[e.charCodeAt(c)]<<10|n[e.charCodeAt(c+1)]<<4|n[e.charCodeAt(c+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],r=16383,o=0,l=n-i;ol?l:o+r));return 1===i?(t=e[n-1],a.push(c[t>>2]+c[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(c[t>>10]+c[t>>4&63]+c[t<<2&63]+"=")),a.join("")};for(var c=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0;r<64;++r)c[r]=a[r],n[a.charCodeAt(r)]=r;function o(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var c=e.indexOf("=");return-1===c&&(c=t),[c,c===t?0:4-c%4]}function s(e,t,n){for(var i,a,r=[],o=t;o>18&63]+c[a>>12&63]+c[a>>6&63]+c[63&a]);return r.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},8764:(e,t,c)=>{"use strict";const n=c(9742),i=c(645),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=s,t.h2=50;const r=2147483647;function o(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,c){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return f(e)}return l(e,t,c)}function l(e,t,c){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const c=0|p(e,t);let n=o(c);const i=n.write(e,t);return i!==c&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return h(e,t,c);if("undefined"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return h(e,t,c);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,c);const i=function(e){if(s.isBuffer(e)){const t=0|m(e.length),c=o(t);return 0===c.length||e.copy(c,0,0,t),c}return void 0!==e.length?"number"!=typeof e.length||Q(e.length)?o(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function f(e){return u(e),o(e<0?0:0|m(e))}function d(e){const t=e.length<0?0:0|m(e.length),c=o(t);for(let n=0;n=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const c=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===c)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return G(e).length;default:if(i)return n?-1:$(e).length;t=(""+t).toLowerCase(),i=!0}}function v(e,t,c){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===c||c>this.length)&&(c=this.length),c<=0)return"";if((c>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,c);case"utf8":case"utf-8":return w(this,t,c);case"ascii":return L(this,t,c);case"latin1":case"binary":return k(this,t,c);case"base64":return H(this,t,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,c);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,c){const n=e[t];e[t]=e[c],e[c]=n}function b(e,t,c,n,i){if(0===e.length)return-1;if("string"==typeof c?(n=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),Q(c=+c)&&(c=i?0:e.length-1),c<0&&(c=e.length+c),c>=e.length){if(i)return-1;c=e.length-1}else if(c<0){if(!i)return-1;c=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:z(e,t,c,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,c):Uint8Array.prototype.lastIndexOf.call(e,t,c):z(e,[t],c,n,i);throw new TypeError("val must be string, number or Buffer")}function z(e,t,c,n,i){let a,r=1,o=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;r=2,o/=2,s/=2,c/=2}function l(e,t){return 1===r?e[t]:e.readUInt16BE(t*r)}if(i){let n=-1;for(a=c;ao&&(c=o-s),a=c;a>=0;a--){let c=!0;for(let n=0;ni&&(n=i):n=i;const a=t.length;let r;for(n>a/2&&(n=a/2),r=0;r>8,i=c%256,a.push(i),a.push(n);return a}(t,e.length-c),e,c,n)}function H(e,t,c){return 0===t&&c===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,c))}function w(e,t,c){c=Math.min(e.length,c);const n=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+r<=c){let c,n,o,s;switch(r){case 1:t<128&&(a=t);break;case 2:c=e[i+1],128==(192&c)&&(s=(31&t)<<6|63&c,s>127&&(a=s));break;case 3:c=e[i+1],n=e[i+2],128==(192&c)&&128==(192&n)&&(s=(15&t)<<12|(63&c)<<6|63&n,s>2047&&(s<55296||s>57343)&&(a=s));break;case 4:c=e[i+1],n=e[i+2],o=e[i+3],128==(192&c)&&128==(192&n)&&128==(192&o)&&(s=(15&t)<<18|(63&c)<<12|(63&n)<<6|63&o,s>65535&&s<1114112&&(a=s))}}null===a?(a=65533,r=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=r}return function(e){const t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);let c="",n=0;for(;nn.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!s.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tc&&(e+=" ... "),""},a&&(s.prototype[a]=s.prototype.inspect),s.prototype.compare=function(e,t,c,n,i){if(Z(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===c&&(c=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||c>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=c)return 0;if(n>=i)return-1;if(t>=c)return 1;if(this===e)return 0;let a=(i>>>=0)-(n>>>=0),r=(c>>>=0)-(t>>>=0);const o=Math.min(a,r),l=this.slice(n,i),u=e.slice(t,c);for(let e=0;e>>=0,isFinite(c)?(c>>>=0,void 0===n&&(n="utf8")):(n=c,c=void 0)}const i=this.length-t;if((void 0===c||c>i)&&(c=i),e.length>0&&(c<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return C(this,e,t,c);case"utf8":case"utf-8":return M(this,e,t,c);case"ascii":case"latin1":case"binary":return S(this,e,t,c);case"base64":return V(this,e,t,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,e,t,c);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function L(e,t,c){let n="";c=Math.min(e.length,c);for(let i=t;in)&&(c=n);let i="";for(let n=t;nc)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,c,n,i,a){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function T(e,t,c,n,i){j(t,n,i,e,c,7);let a=Number(t&BigInt(4294967295));e[c++]=a,a>>=8,e[c++]=a,a>>=8,e[c++]=a,a>>=8,e[c++]=a;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[c++]=r,r>>=8,e[c++]=r,r>>=8,e[c++]=r,r>>=8,e[c++]=r,c}function _(e,t,c,n,i){j(t,n,i,e,c,7);let a=Number(t&BigInt(4294967295));e[c+7]=a,a>>=8,e[c+6]=a,a>>=8,e[c+5]=a,a>>=8,e[c+4]=a;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[c+3]=r,r>>=8,e[c+2]=r,r>>=8,e[c+1]=r,r>>=8,e[c]=r,c+8}function O(e,t,c,n,i,a){if(c+n>e.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function P(e,t,c,n,a){return t=+t,c>>>=0,a||O(e,0,c,4),i.write(e,t,c,n,23,4),c+4}function D(e,t,c,n,a){return t=+t,c>>>=0,a||O(e,0,c,8),i.write(e,t,c,n,52,8),c+8}s.prototype.slice=function(e,t){const c=this.length;(e=~~e)<0?(e+=c)<0&&(e=0):e>c&&(e=c),(t=void 0===t?c:~~t)<0?(t+=c)<0&&(t=0):t>c&&(t=c),t>>=0,t>>>=0,c||A(e,t,this.length);let n=this[e],i=1,a=0;for(;++a>>=0,t>>>=0,c||A(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=X((function(e){U(e>>>=0,"offset");const t=this[e],c=this[e+7];void 0!==t&&void 0!==c||q(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+c*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const t=this[e],c=this[e+7];void 0!==t&&void 0!==c||q(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+c;return(BigInt(n)<>>=0,t>>>=0,c||A(e,t,this.length);let n=this[e],i=1,a=0;for(;++a=i&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,c){e>>>=0,t>>>=0,c||A(e,t,this.length);let n=t,i=1,a=this[e+--n];for(;n>0&&(i*=256);)a+=this[e+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);const c=this[e]|this[e+1]<<8;return 32768&c?4294901760|c:c},s.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);const c=this[e+1]|this[e]<<8;return 32768&c?4294901760|c:c},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=X((function(e){U(e>>>=0,"offset");const t=this[e],c=this[e+7];void 0!==t&&void 0!==c||q(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(c<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],c=this[e+7];void 0!==t&&void 0!==c||q(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||A(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,c,n){e=+e,t>>>=0,c>>>=0,n||I(this,e,t,c,Math.pow(2,8*c)-1,0);let i=1,a=0;for(this[t]=255&e;++a>>=0,c>>>=0,n||I(this,e,t,c,Math.pow(2,8*c)-1,0);let i=c-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+c},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,c){return e=+e,t>>>=0,c||I(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,c){return e=+e,t>>>=0,c||I(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,c){return e=+e,t>>>=0,c||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,c){return e=+e,t>>>=0,c||I(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,c){return e=+e,t>>>=0,c||I(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigUInt64LE=X((function(e,t=0){return T(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=X((function(e,t=0){return _(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(e,t,c,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*c-1);I(this,e,t,c,n-1,-n)}let i=0,a=1,r=0;for(this[t]=255&e;++i>0)-r&255;return t+c},s.prototype.writeIntBE=function(e,t,c,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*c-1);I(this,e,t,c,n-1,-n)}let i=c-1,a=1,r=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===r&&0!==this[t+i+1]&&(r=1),this[t+i]=(e/a>>0)-r&255;return t+c},s.prototype.writeInt8=function(e,t,c){return e=+e,t>>>=0,c||I(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,c){return e=+e,t>>>=0,c||I(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,c){return e=+e,t>>>=0,c||I(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,c){return e=+e,t>>>=0,c||I(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,c){return e=+e,t>>>=0,c||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeBigInt64LE=X((function(e,t=0){return T(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=X((function(e,t=0){return _(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(e,t,c){return P(this,e,t,!0,c)},s.prototype.writeFloatBE=function(e,t,c){return P(this,e,t,!1,c)},s.prototype.writeDoubleLE=function(e,t,c){return D(this,e,t,!0,c)},s.prototype.writeDoubleBE=function(e,t,c){return D(this,e,t,!1,c)},s.prototype.copy=function(e,t,c,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(c||(c=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,c=void 0===c?this.length:c>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;c-=3)t=`_${e.slice(c-3,c)}${t}`;return`${e.slice(0,c)}${t}`}function j(e,t,c,n,i,a){if(e>c||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(a+1)}${n}`:`>= -(2${n} ** ${8*(a+1)-1}${n}) and < 2 ** ${8*(a+1)-1}${n}`:`>= ${t}${n} and <= ${c}${n}`,new R.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,c){U(t,"offset"),void 0!==e[t]&&void 0!==e[t+c]||q(t,e.length-(c+1))}(n,i,a)}function U(e,t){if("number"!=typeof e)throw new R.ERR_INVALID_ARG_TYPE(t,"number",e)}function q(e,t,c){if(Math.floor(e)!==e)throw U(e,c),new R.ERR_OUT_OF_RANGE(c||"offset","an integer",e);if(t<0)throw new R.ERR_BUFFER_OUT_OF_BOUNDS;throw new R.ERR_OUT_OF_RANGE(c||"offset",`>= ${c?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,c){let n=`The value of "${e}" is out of range.`,i=c;return Number.isInteger(c)&&Math.abs(c)>2**32?i=B(String(c)):"bigint"==typeof c&&(i=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(i=B(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function $(e,t){let c;t=t||1/0;const n=e.length;let i=null;const a=[];for(let r=0;r55295&&c<57344){if(!i){if(c>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(r+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=c;continue}if(c<56320){(t-=3)>-1&&a.push(239,191,189),i=c;continue}c=65536+(i-55296<<10|c-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,c<128){if((t-=1)<0)break;a.push(c)}else if(c<2048){if((t-=2)<0)break;a.push(c>>6|192,63&c|128)}else if(c<65536){if((t-=3)<0)break;a.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return a}function G(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,c,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+c]=e[i];return i}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Q(e){return e!=e}const J=function(){const e="0123456789abcdef",t=new Array(256);for(let c=0;c<16;++c){const n=16*c;for(let i=0;i<16;++i)t[n+i]=e[c]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Y:e}function Y(){throw new Error("BigInt not supported")}},3631:(e,t,c)=>{"use strict";c.r(t),c.d(t,{BotInfo:()=>o,BrowserInfo:()=>i,NodeInfo:()=>a,ReactNativeInfo:()=>s,SearchBotDeviceInfo:()=>r,browserName:()=>p,detect:()=>h,detectOS:()=>g,getNodeVersion:()=>b,parseUserAgent:()=>v});var n=function(e,t,c){if(c||2===arguments.length)for(var n,i=0,a=t.length;i{t.read=function(e,t,c,n,i){var a,r,o=8*i-n-1,s=(1<>1,u=-7,f=c?i-1:0,d=c?-1:1,h=e[t+f];for(f+=d,a=h&(1<<-u)-1,h>>=-u,u+=o;u>0;a=256*a+e[t+f],f+=d,u-=8);for(r=a&(1<<-u)-1,a>>=-u,u+=n;u>0;r=256*r+e[t+f],f+=d,u-=8);if(0===a)a=1-l;else{if(a===s)return r?NaN:1/0*(h?-1:1);r+=Math.pow(2,n),a-=l}return(h?-1:1)*r*Math.pow(2,a-n)},t.write=function(e,t,c,n,i,a){var r,o,s,l=8*a-i-1,u=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:a-1,m=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,r=u):(r=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-r))<1&&(r--,s*=2),(t+=r+f>=1?d/s:d*Math.pow(2,1-f))*s>=2&&(r++,s/=2),r+f>=u?(o=0,r=u):r+f>=1?(o=(t*s-1)*Math.pow(2,i),r+=f):(o=t*Math.pow(2,f-1)*Math.pow(2,i),r=0));i>=8;e[c+h]=255&o,h+=m,o/=256,i-=8);for(r=r<0;e[c+h]=255&r,h+=m,r/=256,l-=8);e[c+h-m]|=128*p}},9483:(e,t,c)=>{e.exports=function e(t,c,n){function i(r,o){if(!c[r]){if(!t[r]){if(a)return a(r,!0);var s=new Error("Cannot find module '"+r+"'");throw s.code="MODULE_NOT_FOUND",s}var l=c[r]={exports:{}};t[r][0].call(l.exports,(function(e){return i(t[r][1][e]||e)}),l,l.exports,e,t,c,n)}return c[r].exports}for(var a=void 0,r=0;r=43)}})).catch((function(){return!1}))}(e).then((function(e){return d=e}))}function z(e){var t=h[e.name],c={};c.promise=new r((function(e,t){c.resolve=e,c.reject=t})),t.deferredOperations.push(c),t.dbReady?t.dbReady=t.dbReady.then((function(){return c.promise})):t.dbReady=c.promise}function C(e){var t=h[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function M(e,t){var c=h[e.name].deferredOperations.pop();if(c)return c.reject(t),c.promise}function S(e,t){return new r((function(c,n){if(h[e.name]=h[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return c(e.db);z(e),e.db.close()}var a=[e.name];t&&a.push(e.version);var r=i.open.apply(i,a);t&&(r.onupgradeneeded=function(t){var c=r.result;try{c.createObjectStore(e.storeName),t.oldVersion<=1&&c.createObjectStore(f)}catch(c){if("ConstraintError"!==c.name)throw c;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),r.onerror=function(e){e.preventDefault(),n(r.error)},r.onsuccess=function(){var t=r.result;t.onversionchange=function(e){e.target.close()},c(t),C(e)}}))}function V(e){return S(e,!1)}function y(e){return S(e,!0)}function H(e,t){if(!e.db)return!0;var c=!e.db.objectStoreNames.contains(e.storeName),n=e.versione.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||c){if(c){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function w(e){return a([g(atob(e.data))],{type:e.type})}function x(e){return e&&e.__local_forage_encoded_blob}function L(e){var t=this,c=t._initReady().then((function(){var e=h[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return s(c,e,e),c}function k(e,t,c,n){void 0===n&&(n=1);try{var i=e.db.transaction(e.storeName,t);c(null,i)}catch(i){if(n>0&&(!e.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return r.resolve().then((function(){if(!e.db||"NotFoundError"===i.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),y(e)})).then((function(){return function(e){z(e);for(var t=h[e.name],c=t.forages,n=0;n>4,u[s++]=(15&n)<<4|i>>2,u[s++]=(3&i)<<6|63&a;return l}function G(e){var t,c=new Uint8Array(e),n="";for(t=0;t>2],n+=E[(3&c[t])<<4|c[t+1]>>4],n+=E[(15&c[t+1])<<2|c[t+2]>>6],n+=E[63&c[t+2]];return c.length%3==2?n=n.substring(0,n.length-1)+"=":c.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var K={serialize:function(e,t){var c="";if(e&&(c=W.call(e)),e&&("[object ArrayBuffer]"===c||e.buffer&&"[object ArrayBuffer]"===W.call(e.buffer))){var n,i=I;e instanceof ArrayBuffer?(n=e,i+=T):(n=e.buffer,"[object Int8Array]"===c?i+=O:"[object Uint8Array]"===c?i+=P:"[object Uint8ClampedArray]"===c?i+=D:"[object Int16Array]"===c?i+=R:"[object Uint16Array]"===c?i+=B:"[object Int32Array]"===c?i+=F:"[object Uint32Array]"===c?i+=j:"[object Float32Array]"===c?i+=U:"[object Float64Array]"===c?i+=q:t(new Error("Failed to get type for BinaryArray"))),t(i+G(n))}else if("[object Blob]"===c){var a=new FileReader;a.onload=function(){var c="~~local_forage_type~"+e.type+"~"+G(this.result);t(I+_+c)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(c){console.error("Couldn't convert value into a JSON string: ",e),t(null,c)}},deserialize:function(e){if(e.substring(0,9)!==I)return JSON.parse(e);var t,c=e.substring(13),n=e.substring(9,13);if(n===_&&A.test(c)){var i=c.match(A);t=i[1],c=c.substring(i[0].length)}var r=$(c);switch(n){case T:return r;case _:return a([r],{type:t});case O:return new Int8Array(r);case P:return new Uint8Array(r);case D:return new Uint8ClampedArray(r);case R:return new Int16Array(r);case B:return new Uint16Array(r);case F:return new Int32Array(r);case j:return new Uint32Array(r);case U:return new Float32Array(r);case q:return new Float64Array(r);default:throw new Error("Unkown type: "+n)}},stringToBuffer:$,bufferToString:G};function Z(e,t,c,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],c,n)}function Q(e,t,c,n,i,a){e.executeSql(c,n,i,(function(e,r){r.code===r.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,o){o.rows.length?a(e,r):Z(e,t,(function(){e.executeSql(c,n,i,a)}),a)}),a):a(e,r)}),a)}function J(e,t,c,n){var i=this;e=l(e);var a=new r((function(a,r){i.ready().then((function(){void 0===t&&(t=null);var o=t,s=i._dbInfo;s.serializer.serialize(t,(function(t,l){l?r(l):s.db.transaction((function(c){Q(c,s,"INSERT OR REPLACE INTO "+s.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){a(o)}),(function(e,t){r(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void a(J.apply(i,[e,o,c,n-1]));r(t)}}))}))})).catch(r)}));return o(a,c),a}var X={_driver:"webSQLStorage",_initStorage:function(e){var t=this,c={db:null};if(e)for(var n in e)c[n]="string"!=typeof e[n]?e[n].toString():e[n];var i=new r((function(e,n){try{c.db=openDatabase(c.name,String(c.version),c.description,c.size)}catch(e){return n(e)}c.db.transaction((function(i){Z(i,c,(function(){t._dbInfo=c,e()}),(function(e,t){n(t)}))}),n)}));return c.serializer=K,i},_support:"function"==typeof openDatabase,iterate:function(e,t){var c=this,n=new r((function(t,n){c.ready().then((function(){var i=c._dbInfo;i.db.transaction((function(c){Q(c,i,"SELECT * FROM "+i.storeName,[],(function(c,n){for(var a=n.rows,r=a.length,o=0;o '__WebKitDatabaseInfoTable__'",[],(function(c,n){for(var i=[],a=0;a0?(this._dbInfo=t,t.serializer=K,r.resolve()):r.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var c=this,n=c.ready().then((function(){for(var t=c._dbInfo,n=t.keyPrefix,i=n.length,a=localStorage.length,r=1,o=0;o=0;c--){var n=localStorage.key(c);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return o(c,e),c},length:function(e){var t=this.keys().then((function(e){return e.length}));return o(t,e),t},key:function(e,t){var c=this,n=c.ready().then((function(){var t,n=c._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}));return o(n,t),n},keys:function(e){var t=this,c=t.ready().then((function(){for(var e=t._dbInfo,c=localStorage.length,n=[],i=0;i=0;t--){var c=localStorage.key(t);0===c.indexOf(e)&&localStorage.removeItem(c)}})):r.reject("Invalid arguments"),o(n,t),n}},te=function(e,t){for(var c=e.length,n=0;n{"use strict";e.exports=c(9482)},9482:(e,t,c)=>{"use strict";var n=t;function i(){n.Reader._configure(n.BufferReader),n.util._configure()}n.build="minimal",n.Writer=c(1173),n.BufferWriter=c(3155),n.Reader=c(1408),n.BufferReader=c(593),n.util=c(9693),n.rpc=c(5994),n.roots=c(5350),n.configure=i,n.Writer._configure(n.BufferWriter),i()},1408:(e,t,c)=>{"use strict";e.exports=s;var n,i=c(9693),a=i.LongBits,r=i.utf8;function o(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function s(e){this.buf=e,this.pos=0,this.len=e.length}var l,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new s(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new s(e);throw Error("illegal buffer")};function f(){var e=new a(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw o(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw o(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw o(this,8);return new a(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}s.create=i.Buffer?function(e){return(s.create=function(e){return i.Buffer.isBuffer(e)?new n(e):u(e)})(e)}:u,s.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,s.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return l}),s.prototype.int32=function(){return 0|this.uint32()},s.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},s.prototype.bool=function(){return 0!==this.uint32()},s.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return d(this.buf,this.pos+=4)},s.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return 0|d(this.buf,this.pos+=4)},s.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},s.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},s.prototype.bytes=function(){var e=this.uint32(),t=this.pos,c=this.pos+e;if(c>this.len)throw o(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,c):t===c?new this.buf.constructor(0):this._slice.call(this.buf,t,c)},s.prototype.string=function(){var e=this.bytes();return r.read(e,0,e.length)},s.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw o(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw o(this)}while(128&this.buf[this.pos++]);return this},s.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},s._configure=function(e){n=e;var t=i.Long?"toLong":"toNumber";i.merge(s.prototype,{int64:function(){return f.call(this)[t](!1)},uint64:function(){return f.call(this)[t](!0)},sint64:function(){return f.call(this).zzDecode()[t](!1)},fixed64:function(){return h.call(this)[t](!0)},sfixed64:function(){return h.call(this)[t](!1)}})}},593:(e,t,c)=>{"use strict";e.exports=a;var n=c(1408);(a.prototype=Object.create(n.prototype)).constructor=a;var i=c(9693);function a(e){n.call(this,e)}i.Buffer&&(a.prototype._slice=i.Buffer.prototype.slice),a.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))}},5350:e=>{"use strict";e.exports={}},5994:(e,t,c)=>{"use strict";t.Service=c(7948)},7948:(e,t,c)=>{"use strict";e.exports=i;var n=c(9693);function i(e,t,c){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(c)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,c,i,a,r){if(!a)throw TypeError("request must be specified");var o=this;if(!r)return n.asPromise(e,o,t,c,i,a);if(o.rpcImpl)try{return o.rpcImpl(t,c[o.requestDelimited?"encodeDelimited":"encode"](a).finish(),(function(e,c){if(e)return o.emit("error",e,t),r(e);if(null!==c){if(!(c instanceof i))try{c=i[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(e){return o.emit("error",e,t),r(e)}return o.emit("data",c,t),r(null,c)}o.end(!0)}))}catch(e){return o.emit("error",e,t),void setTimeout((function(){r(e)}),0)}else setTimeout((function(){r(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(e,t,c)=>{"use strict";e.exports=i;var n=c(9693);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var a=i.zero=new i(0,0);a.toNumber=function(){return 0},a.zzEncode=a.zzDecode=function(){return this},a.length=function(){return 1};var r=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return a;var t=e<0;t&&(e=-e);var c=e>>>0,n=(e-c)/4294967296>>>0;return t&&(n=~n>>>0,c=~c>>>0,++c>4294967295&&(c=0,++n>4294967295&&(n=0))),new i(c,n)},i.from=function(e){if("number"==typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):a},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,c=~this.hi>>>0;return t||(c=c+1>>>0),-(t+4294967296*c)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var o=String.prototype.charCodeAt;i.fromHash=function(e){return e===r?a:new i((o.call(e,0)|o.call(e,1)<<8|o.call(e,2)<<16|o.call(e,3)<<24)>>>0,(o.call(e,4)|o.call(e,5)<<8|o.call(e,6)<<16|o.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return 0===c?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:c<128?9:10}},9693:function(e,t,c){"use strict";var n=t;function i(e,t,c){for(var n=Object.keys(t),i=0;i0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var c=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(c.lo,c.hi,t):c.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=a,n.ProtocolError=a("ProtocolError"),n.oneOfGetter=function(e){for(var t={},c=0;c-1;--c)if(1===t[e[c]]&&void 0!==this[e[c]]&&null!==this[e[c]])return e[c]}},n.oneOfSetter=function(e){return function(t){for(var c=0;c{"use strict";e.exports=f;var n,i=c(9693),a=i.LongBits,r=i.base64,o=i.utf8;function s(e,t,c){this.fn=e,this.len=t,this.next=void 0,this.val=c}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function f(){this.len=0,this.head=new s(l,0,0),this.tail=this.head,this.states=null}function d(e,t,c){t[c]=255&e}function h(e,t){this.len=e,this.next=void 0,this.val=t}function m(e,t,c){for(;e.hi;)t[c++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[c++]=127&e.lo|128,e.lo=e.lo>>>7;t[c++]=e.lo}function p(e,t,c){t[c]=255&e,t[c+1]=e>>>8&255,t[c+2]=e>>>16&255,t[c+3]=e>>>24}f.create=i.Buffer?function(){return(f.create=function(){return new n})()}:function(){return new f},f.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(f.alloc=i.pool(f.alloc,i.Array.prototype.subarray)),f.prototype._push=function(e,t,c){return this.tail=this.tail.next=new s(e,t,c),this.len+=t,this},h.prototype=Object.create(s.prototype),h.prototype.fn=function(e,t,c){for(;e>127;)t[c++]=127&e|128,e>>>=7;t[c]=e},f.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new h((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},f.prototype.int32=function(e){return e<0?this._push(m,10,a.fromNumber(e)):this.uint32(e)},f.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},f.prototype.uint64=function(e){var t=a.from(e);return this._push(m,t.length(),t)},f.prototype.int64=f.prototype.uint64,f.prototype.sint64=function(e){var t=a.from(e).zzEncode();return this._push(m,t.length(),t)},f.prototype.bool=function(e){return this._push(d,1,e?1:0)},f.prototype.fixed32=function(e){return this._push(p,4,e>>>0)},f.prototype.sfixed32=f.prototype.fixed32,f.prototype.fixed64=function(e){var t=a.from(e);return this._push(p,4,t.lo)._push(p,4,t.hi)},f.prototype.sfixed64=f.prototype.fixed64,f.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},f.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var v=i.Array.prototype.set?function(e,t,c){t.set(e,c)}:function(e,t,c){for(var n=0;n>>0;if(!t)return this._push(d,1,0);if(i.isString(e)){var c=f.alloc(t=r.length(e));r.decode(e,c,0),e=c}return this.uint32(t)._push(v,t,e)},f.prototype.string=function(e){var t=o.length(e);return t?this.uint32(t)._push(o.write,t,e):this._push(d,1,0)},f.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new s(l,0,0),this.len=0,this},f.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new s(l,0,0),this.len=0),this},f.prototype.ldelim=function(){var e=this.head,t=this.tail,c=this.len;return this.reset().uint32(c),c&&(this.tail.next=e.next,this.tail=t,this.len+=c),this},f.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),c=0;e;)e.fn(e.val,t,c),c+=e.len,e=e.next;return t},f._configure=function(e){n=e}},3155:(e,t,c)=>{"use strict";e.exports=r;var n=c(1173);(r.prototype=Object.create(n.prototype)).constructor=r;var i=c(9693),a=i.Buffer;function r(){n.call(this)}r.alloc=function(e){return(r.alloc=i._Buffer_allocUnsafe)(e)};var o=a&&a.prototype instanceof Uint8Array&&"set"===a.prototype.set.name?function(e,t,c){t.set(e,c)}:function(e,t,c){if(e.copy)e.copy(t,c,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(o,t,e),this},r.prototype.string=function(e){var t=a.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this}},2238:function(e,t,c){var n;!function(i,a){"use strict";var r="function",o="undefined",s="object",l="string",u="major",f="model",d="name",h="type",m="vendor",p="version",v="architecture",g="console",b="mobile",z="tablet",C="smarttv",M="wearable",S="embedded",V="Amazon",y="Apple",H="ASUS",w="BlackBerry",x="Browser",L="Chrome",k="Firefox",N="Google",E="Huawei",A="LG",I="Microsoft",T="Motorola",_="Opera",O="Samsung",P="Sharp",D="Sony",R="Xiaomi",F="Zebra",B="Facebook",j="Chromium OS",U="Mac OS",q=function(e){for(var t={},c=0;c0?2===o.length?typeof o[1]==r?this[o[0]]=o[1].call(this,u):this[o[0]]=o[1]:3===o.length?typeof o[1]!==r||o[1].exec&&o[1].test?this[o[0]]=u?u.replace(o[1],o[2]):a:this[o[0]]=u?o[1].call(this,u,o[2]):a:4===o.length&&(this[o[0]]=u?o[3].call(this,u.replace(o[1],o[2])):a):this[o]=u||a;f+=2}},Z=function(e,t){for(var c in t)if(typeof t[c]===s&&t[c].length>0){for(var n=0;n2&&(e[f]="iPad",e[h]=z),e},this.getEngine=function(){var e={};return e[d]=a,e[p]=a,K.call(e,n,C.engine),e},this.getOS=function(){var e={};return e[d]=a,e[p]=a,K.call(e,n,C.os),M&&!e[d]&&g&&"Unknown"!=g.platform&&(e[d]=g.platform.replace(/chrome os/i,j).replace(/macos/i,U)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===l&&e.length>350?G(e,350):e,this},this.setUA(n),this};X.VERSION="0.7.35",X.BROWSER=q([d,p,u]),X.CPU=q([v]),X.DEVICE=q([f,m,h,g,b,C,z,M,S]),X.ENGINE=X.OS=q([d,p]),typeof t!==o?(e.exports&&(t=e.exports=X),t.UAParser=X):c.amdO?(n=function(){return X}.call(t,c,t,e))===a||(e.exports=n):typeof i!==o&&(i.UAParser=X);var Y=typeof i!==o&&(i.jQuery||i.Zepto);if(Y&&!Y.ua){var ee=new X;Y.ua=ee.getResult(),Y.ua.get=function(){return ee.getUA()},Y.ua.set=function(e){ee.setUA(e);var t=ee.getResult();for(var c in t)Y.ua[c]=t[c]}}}("object"==typeof window?window:this)},8156:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__8156__}},__webpack_module_cache__={};function __nested_webpack_require_546419__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var c=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(c.exports,c,c.exports,__nested_webpack_require_546419__),c.exports}__nested_webpack_require_546419__.amdO={},__nested_webpack_require_546419__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __nested_webpack_require_546419__.d(t,{a:t}),t},__nested_webpack_require_546419__.d=(e,t)=>{for(var c in t)__nested_webpack_require_546419__.o(t,c)&&!__nested_webpack_require_546419__.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:t[c]})},__nested_webpack_require_546419__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__nested_webpack_require_546419__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__nested_webpack_require_546419__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __nested_webpack_exports__={};return(()=>{"use strict";__nested_webpack_require_546419__.r(__nested_webpack_exports__),__nested_webpack_require_546419__.d(__nested_webpack_exports__,{CrossFadeOverlapSize:()=>i,DefaultClientSettng:()=>m,DefaultServerSetting:()=>l,DiffMethod:()=>r,DownSamplingMode:()=>d,F0Detector:()=>a,INDEXEDDB_DB_APP_NAME:()=>v,INDEXEDDB_DB_NAME:()=>g,INDEXEDDB_KEY_CLIENT:()=>b,INDEXEDDB_KEY_MODEL_DATA:()=>C,INDEXEDDB_KEY_SERVER:()=>z,InputSampleRate:()=>c,ModelAssetName:()=>it,ModelFileKind:()=>at,ModelLoadException:()=>M,ModelSamplingRate:()=>n,Protocol:()=>u,RVCModelType:()=>o,SampleRate:()=>h,SendingSampleRate:()=>f,ServerSettingKey:()=>s,VOICE_CHANGER_CLIENT_EXCEPTION:()=>p,VoiceChangerClient:()=>Ye,VoiceChangerType:()=>t,createDummyMediaStream:()=>Ge,fileSelector:()=>Ke,fileSelectorAsDataURL:()=>Ze,useClient:()=>st,useIndexedDB:()=>nt,useServerSetting:()=>rt,validateUrl:()=>Qe});var e={};__nested_webpack_require_546419__.r(e),__nested_webpack_require_546419__.d(e,{Decoder:()=>Te,Encoder:()=>Ae,PacketType:()=>Ee,protocol:()=>Ne});const t={MMVCv15:"MMVCv15",MMVCv13:"MMVCv13","so-vits-svc-40":"so-vits-svc-40","DDSP-SVC":"DDSP-SVC",RVC:"RVC"},c={48e3:48e3,44100:44100,24e3:24e3},n={48e3:48e3,4e4:4e4,32e3:32e3},i={1024:1024,2048:2048,4096:4096},a={dio:"dio",harvest:"harvest",crepe:"crepe",crepe_full:"crepe_full",crepe_tiny:"crepe_tiny"},r={pndm:"pndm","dpm-solver":"dpm-solver"},o={pyTorchRVC:"pyTorchRVC",pyTorchRVCNono:"pyTorchRVCNono",pyTorchRVCv2:"pyTorchRVCv2",pyTorchRVCv2Nono:"pyTorchRVCv2Nono",pyTorchWebUI:"pyTorchWebUI",pyTorchWebUINono:"pyTorchWebUINono",onnxRVC:"onnxRVC",onnxRVCNono:"onnxRVCNono"},s={srcId:"srcId",dstId:"dstId",gpu:"gpu",crossFadeOffsetRate:"crossFadeOffsetRate",crossFadeEndRate:"crossFadeEndRate",crossFadeOverlapSize:"crossFadeOverlapSize",framework:"framework",onnxExecutionProvider:"onnxExecutionProvider",f0Factor:"f0Factor",f0Detector:"f0Detector",recordIO:"recordIO",enableServerAudio:"enableServerAudio",serverAudioStated:"serverAudioStated",serverAudioSampleRate:"serverAudioSampleRate",serverInputAudioSampleRate:"serverInputAudioSampleRate",serverOutputAudioSampleRate:"serverOutputAudioSampleRate",serverMonitorAudioSampleRate:"serverMonitorAudioSampleRate",serverInputAudioBufferSize:"serverInputAudioBufferSize",serverOutputAudioBufferSize:"serverOutputAudioBufferSize",serverInputDeviceId:"serverInputDeviceId",serverOutputDeviceId:"serverOutputDeviceId",serverMonitorDeviceId:"serverMonitorDeviceId",serverReadChunkSize:"serverReadChunkSize",serverInputAudioGain:"serverInputAudioGain",serverOutputAudioGain:"serverOutputAudioGain",tran:"tran",noiseScale:"noiseScale",predictF0:"predictF0",silentThreshold:"silentThreshold",extraConvertSize:"extraConvertSize",clusterInferRatio:"clusterInferRatio",indexRatio:"indexRatio",protect:"protect",rvcQuality:"rvcQuality",modelSamplingRate:"modelSamplingRate",silenceFront:"silenceFront",modelSlotIndex:"modelSlotIndex",useEnhancer:"useEnhancer",useDiff:"useDiff",diffMethod:"diffMethod",useDiffSilence:"useDiffSilence",diffAcc:"diffAcc",diffSpkId:"diffSpkId",kStep:"kStep",threshold:"threshold",inputSampleRate:"inputSampleRate",enableDirectML:"enableDirectML"},l={inputSampleRate:48e3,crossFadeOffsetRate:0,crossFadeEndRate:1,crossFadeOverlapSize:i[1024],recordIO:0,enableServerAudio:0,serverAudioStated:0,serverAudioSampleRate:48e3,serverInputAudioSampleRate:48e3,serverOutputAudioSampleRate:48e3,serverMonitorAudioSampleRate:48e3,serverInputAudioBufferSize:24576,serverOutputAudioBufferSize:24576,serverInputDeviceId:-1,serverOutputDeviceId:-1,serverMonitorDeviceId:-1,serverReadChunkSize:256,serverInputAudioGain:1,serverOutputAudioGain:1,srcId:0,dstId:1,gpu:0,f0Factor:1,f0Detector:a.dio,tran:0,noiseScale:0,predictF0:0,silentThreshold:0,extraConvertSize:0,clusterInferRatio:0,indexRatio:0,protect:.5,rvcQuality:0,modelSamplingRate:48e3,silenceFront:1,modelSlotIndex:0,sampleModels:[],gpus:[],useEnhancer:0,useDiff:1,diffMethod:"dpm-solver",useDiffSilence:0,diffAcc:20,diffSpkId:1,kStep:120,threshold:-45,enableDirectML:0,status:"ok",modelSlots:[],serverAudioInputDevices:[],serverAudioOutputDevices:[],maxInputLength:262144},u={sio:"sio",rest:"rest"},f={48e3:48e3,44100:44100,24e3:24e3},d={decimate:"decimate",average:"average"},h={48e3:48e3},m={workletSetting:{numTrancateTreshold:100,volTrancateThreshold:5e-4,volTrancateLength:32},workletNodeSetting:{serverUrl:"",protocol:"sio",sendingSampleRate:48e3,inputChunkNum:48,downSamplingMode:"average"},voiceChangerClientSetting:{audioInput:null,sampleRate:48e3,echoCancel:!1,noiseSuppression:!1,noiseSuppression2:!1,inputGain:1,outputGain:1}},p={ERR_SIO_CONNECT_FAILED:"ERR_SIO_CONNECT_FAILED",ERR_SIO_INVALID_RESPONSE:"ERR_SIO_INVALID_RESPONSE",ERR_REST_INVALID_RESPONSE:"ERR_REST_INVALID_RESPONSE",ERR_MIC_STREAM_NOT_INITIALIZED:"ERR_MIC_STREAM_NOT_INITIALIZED"},v="INDEXEDDB_KEY_VOICE_CHANGER",g="INDEXEDDB_KEY_VOICE_CHANGER_DB",b="INDEXEDDB_KEY_VOICE_CHANGER_LIB_CLIENT",z="INDEXEDDB_KEY_VOICE_CHANGER_LIB_SERVER",C="INDEXEDDB_KEY_VOICE_CHANGER_LIB_MODEL_DATA";class M extends Error{constructor(e){super(`Model Load Exception:${e}`),this.causeFileType="",this.causeFileType=e,this.name=this.constructor.name,Error.captureStackTrace(this)}}const S=Object.create(null);S.open="0",S.close="1",S.ping="2",S.pong="3",S.message="4",S.upgrade="5",S.noop="6";const V=Object.create(null);Object.keys(S).forEach((e=>{V[S[e]]=e}));const y={type:"error",data:"parser error"},H="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),w="function"==typeof ArrayBuffer,x=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,L=({type:e,data:t},c,n)=>H&&t instanceof Blob?c?n(t):k(t,n):w&&(t instanceof ArrayBuffer||x(t))?c?n(t):k(new Blob([t]),n):n(S[e]+(t||"")),k=(e,t)=>{const c=new FileReader;return c.onload=function(){const e=c.result.split(",")[1];t("b"+(e||""))},c.readAsDataURL(e)};function N(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let E;function A(e,t){return H&&e.data instanceof Blob?e.data.arrayBuffer().then(N).then(t):w&&(e.data instanceof ArrayBuffer||x(e.data))?t(N(e.data)):void L(e,!1,(e=>{E||(E=new TextEncoder),t(E.encode(e))}))}const I="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)I["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(e)]=e;const T="function"==typeof ArrayBuffer,_=(e,t)=>{if("string"!=typeof e)return{type:"message",data:P(e,t)};const c=e.charAt(0);return"b"===c?{type:"message",data:O(e.substring(1),t)}:V[c]?e.length>1?{type:V[c],data:e.substring(1)}:{type:V[c]}:y},O=(e,t)=>{if(T){const c=(e=>{let t,c,n,i,a,r=.75*e.length,o=e.length,s=0;"="===e[e.length-1]&&(r--,"="===e[e.length-2]&&r--);const l=new ArrayBuffer(r),u=new Uint8Array(l);for(t=0;t>4,u[s++]=(15&n)<<4|i>>2,u[s++]=(3&i)<<6|63&a;return l})(e);return P(c,t)}return{base64:!0,data:e}},P=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,D=String.fromCharCode(30);let R;function F(e){if(e)return function(e){for(var t in F.prototype)e[t]=F.prototype[t];return e}(e)}F.prototype.on=F.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},F.prototype.once=function(e,t){function c(){this.off(e,c),t.apply(this,arguments)}return c.fn=t,this.on(e,c),this},F.prototype.off=F.prototype.removeListener=F.prototype.removeAllListeners=F.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i(e.hasOwnProperty(c)&&(t[c]=e[c]),t)),{})}const U=B.setTimeout,q=B.clearTimeout;function W(e,t){t.useNativeTimers?(e.setTimeoutFn=U.bind(B),e.clearTimeoutFn=q.bind(B)):(e.setTimeoutFn=B.setTimeout.bind(B),e.clearTimeoutFn=B.clearTimeout.bind(B))}class $ extends Error{constructor(e,t,c){super(e),this.description=t,this.context=c,this.type="TransportError"}}class G extends F{constructor(e){super(),this.writable=!1,W(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,c){return super.emitReserved("error",new $(e,t,c)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=_(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let c in e)e.hasOwnProperty(c)&&(t.length&&(t+="&"),t+=encodeURIComponent(c)+"="+encodeURIComponent(e[c]));return t}(e);return t.length?"?"+t:""}}const K="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Z=64,Q={};let J,X=0,Y=0;function ee(e){let t="";do{t=K[e%Z]+t,e=Math.floor(e/Z)}while(e>0);return t}function te(){const e=ee(+new Date);return e!==J?(X=0,J=e):e+"."+ee(X++)}for(;Y{var e;3===c.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(c)),4===c.readyState&&(200===c.status||1223===c.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof c.status?c.status:0)}),0))},c.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=oe.requestsCount++,oe.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=ae,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete oe.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function se(){for(let e in oe.requests)oe.requests.hasOwnProperty(e)&&oe.requests[e].abort()}oe.requestsCount=0,oe.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",se):"function"==typeof addEventListener&&addEventListener("onpagehide"in B?"pagehide":"unload",se,!1));const le="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),ue=B.WebSocket||B.MozWebSocket;__nested_webpack_require_546419__(8764).lW;const fe="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();function de(e,t){return"message"===e.type&&"string"!=typeof e.data&&t[0]>=48&&t[0]<=54}const he={websocket:class extends G{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,c=fe?{}:j(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(c.headers=this.opts.extraHeaders);try{this.ws=fe?new ue(e,t,c):t?new ue(e,t):new ue(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.ws.send(e)}catch(e){}n&&le((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=te()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!ue}},webtransport:class extends G{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((e=>{const t=e.readable.getReader();let c;this.writer=e.writable.getWriter();const n=()=>{t.read().then((({done:e,value:t})=>{e||(c||1!==t.byteLength||54!==t[0]?(this.onPacket(function(e,t,c){R||(R=new TextDecoder);const n=t||e[0]<48||e[0]>54;return _(n?e:R.decode(e),"arraybuffer")}(t,c)),c=!1):c=!0,n())})).catch((e=>{}))};n();const i=this.query.sid?`0{"sid":"${this.query.sid}"}`:"0";this.writer.write((new TextEncoder).encode(i)).then((()=>this.onOpen()))}))})))}write(e){this.writable=!1;for(let t=0;t{de(c,e)&&this.writer.write(Uint8Array.of(54)),this.writer.write(e).then((()=>{n&&le((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}))}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends G{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let c=location.port;c||(c=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||c!==e.port}const t=e&&e.forceBase64;this.supportsBinary=re&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const c=e.split(D),n=[];for(let e=0;e{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const c=e.length,n=new Array(c);let i=0;e.forEach(((e,a)=>{L(e,!1,(e=>{n[a]=e,++i===c&&t(n.join(D))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=te()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new oe(this.uri(),e)}doWrite(e,t){const c=this.request({method:"POST",data:e});c.on("success",t),c.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},me=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,pe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ve(e){const t=e,c=e.indexOf("["),n=e.indexOf("]");-1!=c&&-1!=n&&(e=e.substring(0,c)+e.substring(c,n).replace(/:/g,";")+e.substring(n,e.length));let i=me.exec(e||""),a={},r=14;for(;r--;)a[pe[r]]=i[r]||"";return-1!=c&&-1!=n&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=function(e,t){const c=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||c.splice(0,1),"/"==t.slice(-1)&&c.splice(c.length-1,1),c}(0,a.path),a.queryKey=function(e,t){const c={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,n){t&&(c[t]=n)})),c}(0,a.query),a}class ge extends F{constructor(e,t={}){super(),this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=ve(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=ve(t.host).host),W(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},c=e.split("&");for(let e=0,n=c.length;e{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const c=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new he[e](c)}open(){let e;if(this.opts.rememberUpgrade&&ge.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(e){let t=this.createTransport(e),c=!1;ge.priorWebsocketSuccess=!1;const n=()=>{c||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!c)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;ge.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{c||"closed"!==this.readyState&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function i(){c||(c=!0,l(),t.close(),t=null)}const a=e=>{const c=new Error("probe error: "+e);c.transport=t.name,i(),this.emitReserved("upgradeError",c)};function r(){a("transport closed")}function o(){a("socket closed")}function s(e){t&&e.name!==t.name&&i()}const l=()=>{t.removeListener("open",n),t.removeListener("error",a),t.removeListener("close",r),this.off("close",o),this.off("upgrading",s)};t.once("open",n),t.once("error",a),t.once("close",r),this.once("close",o),this.once("upgrading",s),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{c||t.open()}),200):t.open()}onOpen(){if(this.readyState="open",ge.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let c=0;c=57344?c+=3:(n++,c+=4);return c}(t):Math.ceil(1.33*(t.byteLength||t.size))),c>0&&e>this.maxPayload)return this.writeBuffer.slice(0,c);e+=2}var t;return this.writeBuffer}write(e,t,c){return this.sendPacket("message",e,t,c),this}send(e,t,c){return this.sendPacket("message",e,t,c),this}sendPacket(e,t,c,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof c&&(n=c,c=null),"closing"===this.readyState||"closed"===this.readyState)return;(c=c||{}).compress=!1!==c.compress;const i={type:e,data:t,options:c};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},c=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?c():e()})):this.upgrading?c():e()),this}onError(e){ge.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let c=0;const n=e.length;for(;c"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Ce=Object.prototype.toString,Me="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Ce.call(Blob),Se="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===Ce.call(File);function Ve(e){return be&&(e instanceof ArrayBuffer||ze(e))||Me&&e instanceof Blob||Se&&e instanceof File}function ye(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,c=e.length;t=0&&e.num{delete this.acks[e];for(let t=0;t{this.io.clearTimeoutFn(i),t.apply(this,[null,...e])}}emitWithAck(e,...t){const c=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((n,i)=>{t.push(((e,t)=>c?e?i(e):n(t):n(e))),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const c={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...n)=>{if(c===this._queue[0])return null!==e?c.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...n)),c.pending=!1,this._drainQueue()})),this._queue.push(c),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ee.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ee.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ee.EVENT:case Ee.BINARY_EVENT:this.onevent(e);break;case Ee.ACK:case Ee.BINARY_ACK:this.onack(e);break;case Ee.DISCONNECT:this.ondisconnect();break;case Ee.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const c of t)c.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let c=!1;return function(...n){c||(c=!0,t.packet({type:Ee.ACK,id:e,data:n}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ee.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let c=0;c0&&e.jitter<=1?e.jitter:0,this.attempts=0}Re.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),c=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-c:e+c}return 0|Math.min(e,this.max)},Re.prototype.reset=function(){this.attempts=0},Re.prototype.setMin=function(e){this.ms=e},Re.prototype.setMax=function(e){this.max=e},Re.prototype.setJitter=function(e){this.jitter=e};class Fe extends F{constructor(t,c){var n;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(c=t,t=void 0),(c=c||{}).path=c.path||"/socket.io",this.opts=c,W(this,c),this.reconnection(!1!==c.reconnection),this.reconnectionAttempts(c.reconnectionAttempts||1/0),this.reconnectionDelay(c.reconnectionDelay||1e3),this.reconnectionDelayMax(c.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=c.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Re({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==c.timeout?2e4:c.timeout),this._readyState="closed",this.uri=t;const i=c.parser||e;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==c.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new ge(this.uri,this.opts);const t=this.engine,c=this;this._readyState="opening",this.skipReconnect=!1;const n=Oe(t,"open",(function(){c.onopen(),e&&e()})),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},a=Oe(t,"error",i);if(!1!==this._timeout){const e=this._timeout,c=this.setTimeoutFn((()=>{n(),i(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&c.unref(),this.subs.push((()=>{this.clearTimeoutFn(c)}))}return this.subs.push(n),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Oe(e,"ping",this.onping.bind(this)),Oe(e,"data",this.ondata.bind(this)),Oe(e,"error",this.onerror.bind(this)),Oe(e,"close",this.onclose.bind(this)),Oe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){le((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let c=this.nsps[e];return c?this._autoConnect&&!c.active&&c.connect():(c=new De(this,e,t),this.nsps[e]=c),c}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let c=0;ce())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const c=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&c.unref(),this.subs.push((()=>{this.clearTimeoutFn(c)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Be={};function je(e,t){"object"==typeof e&&(t=e,e=void 0);const c=function(e,t="",c){let n=e;c=c||"undefined"!=typeof location&&location,null==e&&(e=c.protocol+"//"+c.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?c.protocol+e:c.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==c?c.protocol+"//"+e:"https://"+e),n=ve(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const i=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port+t,n.href=n.protocol+"://"+i+(c&&c.port===n.port?"":":"+n.port),n}(e,(t=t||{}).path||"/socket.io"),n=c.source,i=c.id,a=c.path,r=Be[i]&&a in Be[i].nsps;let o;return t.forceNew||t["force new connection"]||!1===t.multiplex||r?o=new Fe(n,t):(Be[i]||(Be[i]=new Fe(n,t)),o=Be[i]),c.query&&!t.query&&(t.query=c.queryKey),o.socket(c.path,t)}Object.assign(je,{Manager:Fe,Socket:De,io:je,connect:je});var Ue=__nested_webpack_require_546419__(8764).lW;class qe extends AudioWorkletNode{constructor(e,t){super(e,"voice-changer-worklet-processor"),this.setting=m.workletNodeSetting,this.requestChunks=[],this.socket=null,this.bufferStart=0,this.isOutputRecording=!1,this.recordingOutputChunk=[],this.outputNode=null,this.startPromiseResolve=null,this.stopPromiseResolve=null,this.setOutputNode=e=>{this.outputNode=e},this.updateSetting=e=>{console.log("[WorkletNode] Updating WorkletNode Setting,",this.setting,e);let t=!1;this.setting.serverUrl==e.serverUrl&&this.setting.protocol==e.protocol||(t=!0),this.setting=e,t&&this.createSocketIO()},this.getSettings=()=>this.setting,this.getSocketId=()=>this.socket?.id,this.createSocketIO=()=>{this.socket&&this.socket.close(),"sio"===this.setting.protocol&&(this.socket=je(this.setting.serverUrl+"/test"),this.socket.on("connect_error",(e=>{this.listener.notifyException(p.ERR_SIO_CONNECT_FAILED,`[SIO] rconnection failed ${e}`)})),this.socket.on("connect",(()=>{console.log(`[SIO] connect to ${this.setting.serverUrl}`),console.log(`[SIO] ${this.socket?.id}`)})),this.socket.on("close",(function(e){console.log(`[SIO] close ${e.id}`)})),this.socket.on("message",(e=>{console.log("message:",e)})),this.socket.on("response",(e=>{const t=Date.now()-e[0],c=e[1],n=e[2];0!=e[0]?c.byteLength<256?this.listener.notifyException(p.ERR_SIO_INVALID_RESPONSE,`[SIO] recevied data is too short ${c.byteLength}`):(null!=this.outputNode?this.outputNode.postReceivedVoice(e[1]):this.postReceivedVoice(e[1]),this.listener.notifyResponseTime(t,n)):this.listener.notifyResponseTime(Math.round(1e3*n[0]),n.slice(1,4))})))},this.postReceivedVoice=e=>{const t=new Int16Array(e),c=new Float32Array(t.length);t.forEach(((e,t)=>{const n=e>=32768?-(65536-e)/32768:e/32767;c[t]=n}));let n=null;if(48e3==this.setting.sendingSampleRate)n=c;else{n=new Float32Array(2*c.length);for(let e=0;e{const t=Date.now();if("sio"===this.setting.protocol){if(!this.socket)return void console.warn("sio is not initialized");this.socket.emit("request_message",[t,e.buffer])}else{const c=await We(this.setting.serverUrl+"/test",t,e.buffer);c.byteLength<256?this.listener.notifyException(p.ERR_REST_INVALID_RESPONSE,`[REST] recevied data is too short ${c.byteLength}`):(null!=this.outputNode?this.outputNode.postReceivedVoice(c):this.postReceivedVoice(c),this.listener.notifyResponseTime(Date.now()-t))}},this.configure=e=>{const t={requestType:"config",voice:new Float32Array(1),numTrancateTreshold:e.numTrancateTreshold,volTrancateThreshold:e.volTrancateThreshold,volTrancateLength:e.volTrancateLength};this.port.postMessage(t)},this.start=async()=>{const e=new Promise((e=>{this.startPromiseResolve=e})),t={requestType:"start",voice:new Float32Array(1),numTrancateTreshold:0,volTrancateThreshold:0,volTrancateLength:0};this.port.postMessage(t),await e},this.stop=async()=>{const e=new Promise((e=>{this.stopPromiseResolve=e})),t={requestType:"stop",voice:new Float32Array(1),numTrancateTreshold:0,volTrancateThreshold:0,volTrancateLength:0};this.port.postMessage(t),await e},this.trancateBuffer=()=>{const e={requestType:"trancateBuffer",voice:new Float32Array(1),numTrancateTreshold:0,volTrancateThreshold:0,volTrancateLength:0};this.port.postMessage(e)},this.startOutputRecording=()=>{this.recordingOutputChunk=[],this.isOutputRecording=!0},this.stopOutputRecording=()=>{this.isOutputRecording=!1;const e=this.recordingOutputChunk.reduce(((e,t)=>e+t.length),0),t=new Float32Array(e);let c=0;for(let e=0;et)throw"downsampling rate show be smaller than original sample rate";const n=t/c,i=Math.round(e.length/n),a=new Float32Array(i);let r=0,o=0;for(;re+t.byteLength),0),r=new Uint8Array(a);this.requestChunks.reduce(((e,t)=>(r.set(new Uint8Array(t),e),e+t.byteLength)),0),this.sendBuffer(r),this.requestChunks=[],this.listener.notifySendBufferingTime(Date.now()-this.bufferStart),this.bufferStart=Date.now()}else console.warn(`[worklet_node][voice-changer-worklet-processor] unknown response ${e.data.responseType}`,e.data)}}const We=async(e,t,c)=>{const n={timestamp:t,buffer:Ue.from(c).toString("base64")},i=JSON.stringify(n),a=await fetch(`${e}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:i});try{const e=(await a.json()).changedVoiceBase64,t=Ue.from(e,"base64"),c=new ArrayBuffer(t.length),n=new Uint8Array(c);for(let e=0;e{const t=e.createMediaStreamDestination(),c=e.createGain();c.gain.value=0,c.connect(t);const n=e.createOscillator();return n.frequency.value=440,n.connect(c),n.start(),t.stream},Ke=async e=>{const t=document.createElement("input");t.type="file";const c=new Promise(((c,n)=>{t.onchange=t=>{if(t.target instanceof HTMLInputElement==0)return console.log("invalid target!",t.target),n("invalid target"),null;const i=t.target;return i.files&&0!=i.files.length?""!=e&&i.files[0].type.match(e)?(n(`not target file type ${i.files[0].type}`),null):(c(i.files[0]),null):(n("no file selected"),null)},t.click()}));return await c},Ze=async e=>{const t=await Ke(e);return t?await new Promise((e=>{const c=new FileReader;c.onload=()=>{console.log("load data",c.result),e(c.result)},c.readAsDataURL(t)})):t},Qe=e=>e?.endsWith("/")?e.substring(0,e.length-1):e;class Je{constructor(){this.serverUrl="",this.setServerUrl=e=>{this.serverUrl=e,console.log(`[ServerConfigurator] Server URL: ${this.serverUrl}`)},this.getSettings=async()=>{const e=this.serverUrl+"/info";return await new Promise((t=>{const c=new Request(e,{method:"GET"});fetch(c).then((async e=>{const c=await e.json();t(c)}))}))},this.getPerformance=async()=>{const e=this.serverUrl+"/performance";return await new Promise((t=>{const c=new Request(e,{method:"GET"});fetch(c).then((async e=>{const c=await e.json();t(c)}))}))},this.updateSettings=async(e,t)=>{const c=this.serverUrl+"/update_settings";return await new Promise((async n=>{const i=new FormData;i.append("key",e),i.append("val",t);const a=new Request(c,{method:"POST",body:i});n(await(await fetch(a)).json())}))},this.uploadFile2=async(e,t,c)=>{const n=this.serverUrl+"/upload_file";c(0,!1);const i=1048576;let a=0;const r=t.size,o=e+t.name,s=Math.ceil(r/i);for(;;){const e=[];for(let c=0;c<10&&!(a*i>=r);c++){const c=t.slice(a*i,(a+1)*i),r=new Promise((e=>{const t=new FormData;t.append("file",new Blob([c])),t.append("filename",`${o}_${a}`);const i=new Request(n,{method:"POST",body:t});fetch(i).then((async t=>{e()}))}));a+=1,e.push(r)}if(await Promise.all(e),a*i>=r)break;c(Math.floor(a/(s+1)*100),!1)}return s},this.uploadFile=async(e,t,c)=>{const n=this.serverUrl+"/upload_file";c(0,!1);const i=1048576,a=[];let r=0;for(let t=0;t{const i=new FormData;i.append("file",new Blob([c.chunk])),i.append("filename",`${t}_${c.hash}`);const a=new Request(n,{method:"POST",body:i});fetch(a).then((async t=>{e()}))}));e.push(i)}if(await Promise.all(e),0==a.length)break;c(Math.floor((o-a.length)/(o+1)*100),!1)}return o},this.concatUploadedFile=async(e,t)=>{const c=this.serverUrl+"/concat_uploaded_file";await new Promise((n=>{const i=new FormData;i.append("filename",e),i.append("filenameChunkNum",""+t);const a=new Request(c,{method:"POST",body:i});fetch(a).then((async e=>{console.log(await e.text()),n()}))}))},this.loadModel=async(e,t,c="{}")=>{null!=t&&null!=t||(console.warn("isHalf is invalid value",t),t=!1);const n=this.serverUrl+"/load_model",i=new Promise((async i=>{const a=new FormData;a.append("slot",""+e),a.append("isHalf",""+t),a.append("params",c);const r=new Request(n,{method:"POST",body:a});i(await(await fetch(r)).json())}));return await i},this.uploadAssets=async e=>{const t=this.serverUrl+"/upload_model_assets",c=new Promise((async c=>{const n=new FormData;n.append("params",e);const i=new Request(t,{method:"POST",body:n});c(await(await fetch(i)).json())}));return await c},this.getModelType=async()=>{const e=this.serverUrl+"/model_type",t=new Promise((async t=>{const c=new Request(e,{method:"GET"});t(await(await fetch(c)).json())}));return await t},this.export2onnx=async()=>{const e=this.serverUrl+"/onnx",t=new Promise((async t=>{const c=new Request(e,{method:"GET"});t(await(await fetch(c)).json())}));return await t},this.mergeModel=async e=>{const t=this.serverUrl+"/merge_model",c=new Promise((async c=>{const n=new FormData;n.append("request",JSON.stringify(e));const i=new Request(t,{method:"POST",body:n}),a=await(await fetch(i)).json();console.log("RESPONSE",a),c(a)}));return await c},this.updateModelDefault=async()=>{const e=this.serverUrl+"/update_model_default",t=new Promise((async t=>{const c=new Request(e,{method:"POST"}),n=await(await fetch(c)).json();console.log("RESPONSE",n),t(n)}));return await t},this.updateModelInfo=async(e,t,c)=>{const n=this.serverUrl+"/update_model_info",i={slot:e,key:t,val:c},a=new Promise((async e=>{const t=new FormData;t.append("newData",JSON.stringify(i));const c=new Request(n,{method:"POST",body:t}),a=await(await fetch(c)).json();console.log("RESPONSE",a),e(a)}));return await a}}}class Xe{constructor(){this._resolvers=[],this._promises=[]}_add(){this._promises.push(new Promise((e=>{this._resolvers.push(e)})))}enqueue(e){0==this._resolvers.length&&this._add(),this._resolvers.shift()(e)}dequeue(){return 0==this._promises.length&&this._add(),this._promises.shift()}isEmpty(){return 0==this._promises.length}isBlocked(){return 0!=this._resolvers.length}get length(){return this._promises.length-this._resolvers.length}}class Ye{constructor(e,t,c){this.vfEnable=!1,this.vf=null,this.currentDevice=null,this.currentMediaStream=null,this.currentMediaStreamAudioSourceNode=null,this.inputGainNode=null,this.outputGainNode=null,this._isVoiceChanging=!1,this.setting=m.voiceChangerClientSetting,this.sslCertified=[],this.sem=new Xe,this.lock=async()=>await this.sem.dequeue(),this.unlock=e=>{this.sem.enqueue(e+1)},this.isInitialized=async()=>(this.promiseForInitialize&&await this.promiseForInitialize,!0),this.setup=async()=>{const e=await this.lock();if(console.log(`Input Setup=> echo: ${this.setting.echoCancel}, noise1: ${this.setting.noiseSuppression}, noise2: ${this.setting.noiseSuppression2}`),!this.vcInNode)throw console.warn("vc node is not initialized."),"vc node is not initialized.";if(this.currentMediaStream&&(this.currentMediaStream.getTracks().forEach((e=>{e.stop()})),this.currentMediaStream=null),!this.setting.audioInput)return console.log(`Input Setup=> client mic is disabled. ${this.setting.audioInput}`),this.vcInNode.stop(),void await this.unlock(e);if("string"==typeof this.setting.audioInput)try{"none"==this.setting.audioInput?this.currentMediaStream=Ge(this.ctx):this.currentMediaStream=await navigator.mediaDevices.getUserMedia({audio:{deviceId:this.setting.audioInput,channelCount:1,sampleRate:this.setting.sampleRate,sampleSize:16,autoGainControl:!1,echoCancellation:this.setting.echoCancel,noiseSuppression:this.setting.noiseSuppression}})}catch(t){throw console.warn(t),this.vcInNode.stop(),await this.unlock(e),t}else this.currentMediaStream=this.setting.audioInput;if(this.currentMediaStreamAudioSourceNode=this.ctx.createMediaStreamSource(this.currentMediaStream),this.inputGainNode=this.ctx.createGain(),this.inputGainNode.gain.value=this.setting.inputGain,this.currentMediaStreamAudioSourceNode.connect(this.inputGainNode),this.currentDevice&&this.setting.noiseSuppression2){this.currentDevice.chooseNewInnerDevice(this.currentMediaStream);const e=await this.currentDevice.createAudioNode(this.ctx);this.inputGainNode.connect(e.start),e.end.connect(this.vcInNode)}else this.inputGainNode.connect(this.vcInNode);this.vcInNode.setOutputNode(this.vcOutNode),console.log("Input Setup=> success"),await this.unlock(e)},this.start=async()=>{await this.vcInNode.start(),this._isVoiceChanging=!0},this.stop=async()=>{await this.vcInNode.stop(),this._isVoiceChanging=!1},this.setServerUrl=(e,t=!1)=>{const c=Qe(e);c!=`${location.protocol}//${location.host}`&&0!=c.length&&"https:"==location.protocol&&0==this.sslCertified.includes(c)&&t&&(window.confirm("MMVC Server is different from this page's origin. Open tab to open ssl connection. OK? (You can close the opened tab after ssl connection succeed.)")?(window.open(c,"_blank"),this.sslCertified.push(c)):alert("Your voice conversion may fail...")),this.vcInNode.updateSetting({...this.vcInNode.getSettings(),serverUrl:c}),this.configurator.setServerUrl(c)},this.updateClientSetting=async e=>{let t=!1;this.setting.audioInput==e.audioInput&&this.setting.echoCancel==e.echoCancel&&this.setting.noiseSuppression==e.noiseSuppression&&this.setting.noiseSuppression2==e.noiseSuppression2&&this.setting.sampleRate==e.sampleRate||(t=!0),this.setting.inputGain!=e.inputGain&&this.setInputGain(e.inputGain),this.setting.outputGain!=e.outputGain&&this.setOutputGain(e.outputGain),this.setting=e,t&&await this.setup()},this.setInputGain=e=>{this.setting.inputGain=e,this.inputGainNode&&(this.inputGainNode.gain.value=e)},this.setOutputGain=e=>{this.outputGainNode&&(this.outputGainNode.gain.value=e)},this.getModelType=()=>this.configurator.getModelType(),this.getOnnx=async()=>this.configurator.export2onnx(),this.mergeModel=async e=>this.configurator.mergeModel(e),this.updateModelDefault=async()=>this.configurator.updateModelDefault(),this.updateModelInfo=async(e,t,c)=>this.configurator.updateModelInfo(e,t,c),this.updateServerSettings=(e,t)=>this.configurator.updateSettings(e,t),this.uploadFile=(e,t,c)=>this.configurator.uploadFile(e,t,c),this.uploadFile2=(e,t,c)=>this.configurator.uploadFile2(e,t,c),this.concatUploadedFile=(e,t)=>this.configurator.concatUploadedFile(e,t),this.loadModel=(e,t,c)=>this.configurator.loadModel(e,t,c),this.uploadAssets=e=>this.configurator.uploadAssets(e),this.configureWorklet=e=>{this.vcInNode.configure(e),this.vcOutNode.configure(e)},this.startOutputRecording=()=>{this.vcOutNode.startOutputRecording()},this.stopOutputRecording=()=>this.vcOutNode.stopOutputRecording(),this.trancateBuffer=()=>{this.vcOutNode.trancateBuffer()},this.updateWorkletNodeSetting=e=>{this.vcInNode.updateSetting(e),this.vcOutNode.updateSetting(e)},this.getClientSettings=()=>this.vcInNode.getSettings(),this.getServerSettings=()=>this.configurator.getSettings(),this.getPerformance=()=>this.configurator.getPerformance(),this.getSocketId=()=>this.vcInNode.getSocketId(),this.sem.enqueue(0),this.configurator=new Je,this.ctx=e,this.vfEnable=t,this.promiseForInitialize=new Promise((async e=>{const t=URL.createObjectURL(new Blob(['(()=>{"use strict";class e extends AudioWorkletProcessor{constructor(){super(),this.BLOCK_SIZE=128,this.initialized=!1,this.volume=0,this.numTrancateTreshold=150,this.isRecording=!1,this.playBuffer=[],this.calcVol=(e,t)=>{const s=e.reduce(((e,t)=>e+t*t),0),r=Math.sqrt(s/e.length);return Math.max(r,.95*t)},this.trancateBuffer=()=>{for(console.log("[worklet] Buffer truncated");this.playBuffer.length>2;)this.playBuffer.shift()},this.pushData=e=>{const t={responseType:"inputData",inputData:e};this.port.postMessage(t)},this.initialized=!0,this.port.onmessage=this.handleMessage.bind(this)}handleMessage(e){const t=e.data;if("config"===t.requestType)return this.numTrancateTreshold=t.numTrancateTreshold,void console.log("[worklet] worklet configured",t);if("start"===t.requestType){if(this.isRecording)return void console.warn("[worklet] recoring is already started");this.isRecording=!0;const e={responseType:"start_ok"};return void this.port.postMessage(e)}if("stop"===t.requestType){if(!this.isRecording)return void console.warn("[worklet] recoring is not started");this.isRecording=!1;const e={responseType:"stop_ok"};return void this.port.postMessage(e)}if("trancateBuffer"===t.requestType)return void this.trancateBuffer();this.playBuffer.length>this.numTrancateTreshold&&this.trancateBuffer();const s=t.voice,r=s.length/this.BLOCK_SIZE;for(let e=0;e0&&e[0].length>0&&this.pushData(e[0][0]),0===this.playBuffer.length)return!0;let r=this.playBuffer.shift();if(r){this.volume=this.calcVol(r,this.volume);const e={responseType:"volume",volume:this.volume};this.port.postMessage(e),t[0][0].set(r),2==t[0].length&&t[0][1].set(r)}return!0}}registerProcessor("voice-changer-worklet-processor",e)})();'],{type:"text/javascript"}));try{this.vcInNode=new qe(this.ctx,c)}catch(e){await this.ctx.audioWorklet.addModule(t),this.vcInNode=new qe(this.ctx,c)}const n=new AudioContext({sampleRate:48e3});console.log("audio out:",n);try{this.vcOutNode=new qe(n,c)}catch(e){await n.audioWorklet.addModule(t),this.vcOutNode=new qe(n,c)}if(this.currentMediaStreamAudioDestinationNode=n.createMediaStreamDestination(),this.outputGainNode=n.createGain(),this.outputGainNode.gain.value=this.setting.outputGain,this.vcOutNode.connect(this.outputGainNode),this.outputGainNode.connect(this.currentMediaStreamAudioDestinationNode),this.vfEnable){this.vf=await $e.mz.create({variant:"c20"});const e=Ge(this.ctx);this.currentDevice=await this.vf.createTransformDevice(e)||null}e()}))}get stream(){return this.currentMediaStreamAudioDestinationNode.stream}get isVoiceChanging(){return this._isVoiceChanging}}var et=__nested_webpack_require_546419__(8156),tt=__nested_webpack_require_546419__(9483),ct=__nested_webpack_require_546419__.n(tt);const nt=e=>{const t=e.clientType||"default";ct().config({driver:ct().INDEXEDDB,name:v,version:1,storeName:`${g}`,description:"appStorage"});const c=(0,et.useMemo)((()=>async(e,c)=>{const n=`${t}_${e}`;await ct().setItem(n,c)}),[e.clientType]);return{dummy:"",setItem:c,getItem:(0,et.useMemo)((()=>async e=>{const c=`${t}_${e}`;return await ct().getItem(c)}),[e.clientType]),removeItem:(0,et.useMemo)((()=>async e=>{const c=`${t}_${e}`;return console.log("remove key:",c),await ct().removeItem(c)}),[e.clientType]),removeDB:(0,et.useMemo)((()=>async()=>{const e=await ct().keys();for(const t of e)console.log("remove key:",t),await ct().removeItem(t)}),[e.clientType])}},it={iconFile:"iconFile"},at={mmvcv13Config:"mmvcv13Config",mmvcv13Model:"mmvcv13Model",mmvcv15Config:"mmvcv15Config",mmvcv15Model:"mmvcv15Model",mmvcv15Correspondence:"mmvcv15Correspondence",soVitsSvc40Config:"soVitsSvc40Config",soVitsSvc40Model:"soVitsSvc40Model",soVitsSvc40Cluster:"soVitsSvc40Cluster",rvcModel:"rvcModel",rvcIndex:"rvcIndex",ddspSvcModel:"ddspSvcModel",ddspSvcModelConfig:"ddspSvcModelConfig",ddspSvcDiffusion:"ddspSvcDiffusion",ddspSvcDiffusionConfig:"ddspSvcDiffusionConfig"},rt=e=>{const[t,c]=(0,et.useState)(l),n=(0,et.useMemo)((()=>async n=>{if(e.voiceChangerClient)for(let i=0;iasync(t,c,n="")=>{if(!e.voiceChangerClient)return;const i=await e.voiceChangerClient.uploadFile2(n,t,c),a=await e.voiceChangerClient.concatUploadedFile(n+t.name,i);console.log("uploaded",i,a)}),[e.voiceChangerClient]),f=(0,et.useMemo)((()=>async t=>{if(!e.voiceChangerClient)return;if(a(0),o(!0),0==t.isSampleMode){const e=1/t.files.length;for(let c=0;c{a(t*e+n)}),t.files[c].dir)}}const c={...t,files:t.files.map((e=>({name:e.file.name,kind:e.kind,dir:e.dir})))},n=e.voiceChangerClient.loadModel(0,!1,JSON.stringify(c));await n,a(0),o(!1),h()}),[e.voiceChangerClient]),d=(0,et.useMemo)((()=>async(t,c,n)=>{if(!e.voiceChangerClient)return;await u(n,((e,t)=>{console.log(e,t)}));const i={slot:t,name:c,file:n.name};await e.voiceChangerClient.uploadAssets(JSON.stringify(i)),h()}),[e.voiceChangerClient]),h=(0,et.useMemo)((()=>async()=>{if(!e.voiceChangerClient)return;const t=await e.voiceChangerClient.getServerSettings();c(t)}),[e.voiceChangerClient]);return{serverSetting:t,updateServerSettings:n,reloadServerInfo:h,uploadModel:f,uploadProgress:i,isUploading:r,getOnnx:async()=>e.voiceChangerClient.getOnnx(),mergeModel:async t=>{const n=await e.voiceChangerClient.mergeModel(t);return c(n),n},updateModelDefault:async()=>{const t=await e.voiceChangerClient.updateModelDefault();return c(t),t},updateModelInfo:async(t,n,i)=>{const a=await e.voiceChangerClient.updateModelInfo(t,n,i);return c(a),a},uploadAssets:d}},ot={responseTime:0,preprocessTime:0,mainprocessTime:0,postprocessTime:0},st=e=>{const[t,c]=(0,et.useState)(!1),[n,i]=(0,et.useState)(m),a=(0,et.useRef)(null),[r,o]=(0,et.useState)(a.current),s=(0,et.useRef)(),l=(0,et.useMemo)((()=>new Promise((e=>{s.current=e}))),[]),u=(e=>{const[t,c]=(0,et.useState)(e.voiceChangerClientSetting);return(0,et.useEffect)((()=>{(async()=>{if(e.voiceChangerClient)for(let n in e.voiceChangerClientSetting)if(t[n]!=e.voiceChangerClientSetting[n]){c(e.voiceChangerClientSetting),await e.voiceChangerClient.updateClientSetting(e.voiceChangerClientSetting);break}})()}),[e.voiceChangerClient,e.voiceChangerClientSetting]),{setServerUrl:(0,et.useMemo)((()=>t=>{e.voiceChangerClient&&e.voiceChangerClient.setServerUrl(t,!0)}),[e.voiceChangerClient]),start:(0,et.useMemo)((()=>async()=>{e.voiceChangerClient&&await e.voiceChangerClient.start()}),[e.voiceChangerClient]),stop:(0,et.useMemo)((()=>async()=>{e.voiceChangerClient&&await e.voiceChangerClient.stop()}),[e.voiceChangerClient]),reloadClientSetting:(0,et.useMemo)((()=>async()=>{e.voiceChangerClient&&await e.voiceChangerClient.getClientSettings()}),[e.voiceChangerClient])}})({voiceChangerClient:r,voiceChangerClientSetting:n.voiceChangerClientSetting}),f=(e=>{const[t,c]=(0,et.useState)(e.workletNodeSetting);return(0,et.useEffect)((()=>{if(e.voiceChangerClient)for(let n in e.workletNodeSetting)if(t[n]!=e.workletNodeSetting[n]){c(e.workletNodeSetting),e.voiceChangerClient.updateWorkletNodeSetting(e.workletNodeSetting);break}}),[e.voiceChangerClient,e.workletNodeSetting]),{startOutputRecording:(0,et.useMemo)((()=>()=>{e.voiceChangerClient&&e.voiceChangerClient.startOutputRecording()}),[e.voiceChangerClient]),stopOutputRecording:(0,et.useMemo)((()=>async()=>e.voiceChangerClient?e.voiceChangerClient.stopOutputRecording():new Float32Array),[e.voiceChangerClient]),trancateBuffer:(0,et.useMemo)((()=>async()=>{e.voiceChangerClient&&e.voiceChangerClient.trancateBuffer()}),[e.voiceChangerClient])}})({voiceChangerClient:r,workletNodeSetting:n.workletNodeSetting});(e=>{const[t,c]=(0,et.useState)(e.workletSetting);(0,et.useEffect)((()=>{e.voiceChangerClient&&e.voiceChangerClient.configureWorklet(t)}),[e.voiceChangerClient,e.workletSetting])})({voiceChangerClient:r,workletSetting:n.workletSetting});const d=rt({voiceChangerClient:r}),h=nt({clientType:null}),[p,v]=(0,et.useState)(0),[g,b]=(0,et.useState)(ot),[z,C]=(0,et.useState)(0),[M,S]=(0,et.useState)(0),V=(0,et.useMemo)((()=>a.current?async()=>{if(a.current){const e=await a.current.getPerformance(),t=e[0],c=e[1],n=e[2],i=e[3];b({responseTime:t,preprocessTime:c,mainprocessTime:n,postprocessTime:i})}else b({responseTime:0,preprocessTime:0,mainprocessTime:0,postprocessTime:0})}:null),[a.current]),y=(0,et.useRef)(0),{setItem:H,getItem:w}=nt({clientType:null}),x=e=>{const t={...e};t.voiceChangerClientSetting={...t.voiceChangerClientSetting},"string"!=typeof t.voiceChangerClientSetting.audioInput&&(t.voiceChangerClientSetting.audioInput="none"),H("clientSetting",t),i(e)};(0,et.useEffect)((()=>{r&&(async()=>{const e=await w("clientSetting");e&&(i(e),d.reloadServerInfo())})()}),[r]),(0,et.useEffect)((()=>{(async()=>{if(!e.audioContext)return;const t=new Ye(e.audioContext,!0,{notifySendBufferingTime:e=>{v(e)},notifyResponseTime:(e,t)=>{const c=e,n=t?Math.ceil(1e3*t[0]):0,i=t?Math.ceil(1e3*t[1]):0,a=t?Math.ceil(1e3*t[2]):0;b({responseTime:c,preprocessTime:n,mainprocessTime:i,postprocessTime:a})},notifyException:e=>{e.length>0&&(console.log(`error:${e}`),y.current+=1,S(y.current))},notifyVolume:e=>{C(e)}});await t.isInitialized(),a.current=t,o(a.current),console.log("[useClient] client initialized"),s.current(),c(!0)})()}),[e.audioContext]);const L=(0,et.useMemo)((()=>async()=>{await l,await u.reloadClientSetting(),await d.reloadServerInfo()}),[u.reloadClientSetting,d.reloadServerInfo]);return{initialized:t,setting:n,setVoiceChangerClientSetting:e=>{n.voiceChangerClientSetting=e,console.log("setting.voiceChangerClientSetting",n.voiceChangerClientSetting),x({...n})},setServerUrl:u.setServerUrl,start:u.start,stop:u.stop,reloadClientSetting:u.reloadClientSetting,setWorkletNodeSetting:e=>{n.workletNodeSetting=e,console.log("setting.workletNodeSetting",n.workletNodeSetting),x({...n})},startOutputRecording:f.startOutputRecording,stopOutputRecording:f.stopOutputRecording,trancateBuffer:f.trancateBuffer,setWorkletSetting:e=>{n.workletSetting=e,console.log("setting.workletSetting",n.workletSetting),x({...n})},serverSetting:d,indexedDBState:h,bufferingTime:p,volume:z,performance:g,updatePerformance:V,getInfo:L,clearSetting:async()=>{},setAudioOutputElementId:e=>{if(!a.current)return void console.warn("[voiceChangerClient] is not ready for set audio output.");const t=document.getElementById(e);t.paused&&(t.srcObject=a.current.stream,t.play())},ioErrorCount:M,resetIoErrorCount:()=>{y.current=0,S(y.current)}}}})(),__nested_webpack_exports__})(),module.exports=t(__webpack_require__(294))},870:(e,t,c)=>{"use strict";c.d(t,{Z:()=>o});var n=c(81),i=c.n(n),a=c(645),r=c.n(a)()(i());r.push([e.id,"/* 前提条件 */\n\n.rotate-button-container {\n height: var(--header-height);\n width: var(--header-height);\n position: relative;\n}\n.rotate-button {\n display: none;\n}\n.rotate-button ~ .rotate-lable {\n padding: 2px;\n position: absolute;\n transition: all 0.3s;\n cursor: pointer;\n height: var(--header-height);\n width: var(--header-height);\n}\n.rotate-button ~ .rotate-lable > * {\n width: 100%;\n height: 100%;\n float: left;\n transition: all 0.3s;\n}\n.rotate-button ~ .rotate-lable > * .spin-on {\n width: 100%;\n height: 100%;\n display: none;\n }\n.rotate-button ~ .rotate-lable > * .spin-off {\n width: 100%;\n height: 100%;\n display: blcok;\n }\n.rotate-button ~ .rotate-lable > .colored {\n color: rgba(200, 200, 200, 0.8);\n background: rgba(0, 0, 0, 1);\n transition: all 0.3s;\n}\n.rotate-button ~ .rotate-lable > .colored .spin-on {\n display: none;\n }\n.rotate-button ~ .rotate-lable > .colored .spin-off {\n display: block;\n }\n.rotate-button:checked ~ .rotate-lable > .colored {\n color: rgba(50, 240, 50, 0.8);\n background: rgba(60, 60, 60, 1);\n transition: all 0.3s;\n}\n.rotate-button:checked ~ .rotate-lable > .colored .spin-on {\n display: block;\n }\n.rotate-button:checked ~ .rotate-lable > .colored .spin-off {\n display: none;\n }\n\n.rotate-button:checked ~ .rotate-lable > .spinner {\n width: 100%;\n height: 100%;\n transform: rotate(180deg);\n transition: all 0.3s;\n box-sizing: border-box;\n}\n\n.rotate-button:checked ~ .rotate-lable > .spinner .spin-on {\n display: block;\n }\n\n.rotate-button:checked ~ .rotate-lable > .spinner .spin-off {\n display: none;\n }\n",""]);const o=r},90:(e,t,c)=>{"use strict";c.d(t,{Z:()=>u});var n=c(81),i=c.n(n),a=c(645),r=c.n(a),o=c(870),s=c(513),l=r()(i());l.push([e.id,"@import url(https://fonts.googleapis.com/css2?family=Chicle&family=Poppins:ital,wght@0,200;0,400;0,600;1,200;1,400;1,600&display=swap);"]),l.push([e.id,"@import url(https://fonts.googleapis.com/css2?family=Yusei+Magic&display=swap);"]),l.i(o.Z),l.i(s.Z),l.push([e.id,':root {\n --text-color: #333;\n --company-color1: rgba(64, 119, 187, 1);\n --company-color2: rgba(29, 47, 78, 1);\n --company-color3: rgba(255, 255, 255, 1);\n --company-color1-alpha: rgba(64, 119, 187, 0.3);\n --company-color2-alpha: rgba(29, 47, 78, 0.3);\n --company-color3-alpha: rgba(255, 255, 255, 0.3);\n --global-shadow-color: rgba(0, 0, 0, 0.4);\n\n --sidebar-transition-time: 0.2s;\n --sidebar-transition-time-quick: 0.1s;\n --sidebar-transition-animation: ease-in-out;\n\n --header-height: 1.5rem;\n --right-sidebar-width: 320px;\n\n --dialog-border-color: rgba(100, 100, 100, 1);\n --dialog-shadow-color: rgba(0, 0, 0, 0.3);\n --dialog-background-color: rgba(255, 255, 255, 1);\n --dialog-primary-color: rgba(19, 70, 209, 1);\n --dialog-active-color: rgba(40, 70, 209, 1);\n --dialog-input-border-color: rgba(200, 200, 200, 1);\n --dialog-submit-button-color: rgba(180, 190, 230, 1);\n --dialog-cancel-button-color: rgba(235, 80, 80, 1);\n\n --body-video-seeker-height: 3rem;\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: "Poppins", sans-serif;\n}\nhtml {\n font-size: 16px;\n}\nbody {\n height: 100%;\n width: 100%;\n overflow-y: scroll;\n overflow-x: hidden;\n color: var(--text-color);\n /* background: linear-gradient(45deg, var(--company-color1) 0, 5%, var(--company-color2) 5% 10%, var(--company-color3) 10% 80%, var(--company-color1) 80% 85%, var(--company-color2) 85% 100%); */\n background: linear-gradient(45deg, var(--company-color1) 0, 1%, var(--company-color2) 1% 5%, var(--company-color3) 5% 90%, var(--company-color1) 90% 95%, var(--company-color2) 95% 100%);\n}\n#app {\n height: 100%;\n width: 100%;\n}\n.first-gesture {\n background: rgba(200, 0, 0, 0.2);\n width: 100%;\n height: 100%;\n position: absolute;\n}\n\n/* Main + Section Partition*/\n.main-body {\n height: 100%;\n width: 100%;\n padding: 2rem;\n font-family: "Yusei Magic", sans-serif;\n display: flex;\n flex-direction: column;\n font-size: 1rem;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n/* Title */\n.main-body .top-title .title {\n font-size: 3rem;\n }\n.main-body .top-title .top-title-version {\n margin-left: 2rem;\n font-size: 1.2rem;\n background: linear-gradient(transparent 60%, yellow 30%);\n }\n.main-body .top-title .top-title-version-number {\n margin-left: 0.3rem;\n font-size: 0.8rem;\n }\n.main-body .top-title .belongings {\n margin-left: 1rem;\n margin-right: 1rem;\n }\n.main-body .top-title .belongings .link {\n margin-left: 1rem;\n font-weight: 700;\n text-decoration: underline;\n }\n/* Partition */\n.main-body .partition {\n width: 100%;\n }\n.main-body .partition .partition-header {\n font-weight: 700;\n color: rgb(71, 69, 69);\n display: flex;\n }\n.main-body .partition .partition-header .caret {\n width: 2rem;\n }\n.main-body .partition .partition-header .title {\n font-size: 1.1rem;\n }\n.main-body .partition .partition-header .belongings {\n font-weight: 400;\n font-size: 0.8rem;\n display: flex;\n flex-direction: row;\n align-items: flex-end;\n margin-left: 10px;\n }\n.main-body .partition .partition-header .belongings .belongings-checkbox {\n margin-bottom: 3px;\n }\n.main-body .partition .partition-content {\n position: static;\n overflow-y: hidden;\n }\n.main-body .partition .row-split {\n }\n.state-control-checkbox:checked + .partition .partition-content {\n max-height: 700px;\n background: rgba(255, 255, 255, 0.3);\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n}\n.state-control-checkbox + .partition .partition-content {\n max-height: 0px;\n background: rgba(233, 233, 255, 0.3);\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n}\n/* ROW */\n\n.split-8-2 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.split-8-2 > div:nth-child(1) {\n left: 0px;\n width: 80%;\n }\n\n.split-8-2 > div:nth-child(2) {\n left: 80%;\n width: 20%;\n }\n.split-6-4 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-6-4 > div:nth-child(1) {\n left: 0px;\n width: 60%;\n }\n.split-6-4 > div:nth-child(2) {\n left: 60%;\n width: 40%;\n }\n.split-5-5 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-5-5 > div:nth-child(1) {\n left: 0px;\n width: 50%;\n }\n.split-5-5 > div:nth-child(2) {\n left: 50%;\n width: 50%;\n }\n.split-4-6 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-4-6 > div:nth-child(1) {\n left: 0px;\n width: 40%;\n }\n.split-4-6 > div:nth-child(2) {\n left: 40%;\n width: 60%;\n }\n.split-3-7 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-3-7 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.split-3-7 > div:nth-child(2) {\n left: 30%;\n width: 70%;\n }\n\n.split-2-8 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.split-2-8 > div:nth-child(1) {\n left: 0px;\n width: 20%;\n }\n\n.split-2-8 > div:nth-child(2) {\n left: 20%;\n width: 80%;\n }\n\n.split-1-8-1 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.split-1-8-1 > div:nth-child(1) {\n left: 0px;\n width: 10%;\n }\n\n.split-1-8-1 > div:nth-child(2) {\n left: 10%;\n width: 80%;\n }\n\n.split-1-8-1 > div:nth-child(3) {\n left: 90%;\n width: 10%;\n }\n.split-2-2-6 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-2-2-6 > div:nth-child(1) {\n left: 0px;\n width: 20%;\n }\n.split-2-2-6 > div:nth-child(2) {\n left: 20%;\n width: 20%;\n }\n.split-2-2-6 > div:nth-child(3) {\n left: 40%;\n width: 60%;\n }\n.split-3-3-4 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-3-3-4 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.split-3-3-4 > div:nth-child(2) {\n left: 30%;\n width: 30%;\n }\n.split-3-3-4 > div:nth-child(3) {\n left: 60%;\n width: 40%;\n }\n\n.split-3-4-3 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.split-3-4-3 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n\n.split-3-4-3 > div:nth-child(2) {\n left: 30%;\n width: 40%;\n }\n\n.split-3-4-3 > div:nth-child(3) {\n left: 70%;\n width: 30%;\n }\n.split-2-5-3 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-2-5-3 > div:nth-child(1) {\n left: 0px;\n width: 20%;\n }\n.split-2-5-3 > div:nth-child(2) {\n left: 20%;\n width: 50%;\n }\n.split-2-5-3 > div:nth-child(3) {\n left: 70%;\n width: 30%;\n }\n.split-4-4-2 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-4-4-2 > div:nth-child(1) {\n left: 0px;\n width: 40%;\n }\n.split-4-4-2 > div:nth-child(2) {\n left: 40%;\n width: 40%;\n }\n.split-4-4-2 > div:nth-child(3) {\n left: 80%;\n width: 20%;\n }\n.split-1-4-4-1 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-1-4-4-1 > div:nth-child(1) {\n left: 0px;\n width: 10%;\n }\n.split-1-4-4-1 > div:nth-child(2) {\n left: 10%;\n width: 40%;\n }\n.split-1-4-4-1 > div:nth-child(3) {\n left: 50%;\n width: 40%;\n }\n.split-1-4-4-1 > div:nth-child(4) {\n left: 90%;\n width: 10%;\n }\n\n.split-3-2-2-3 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.split-3-2-2-3 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n\n.split-3-2-2-3 > div:nth-child(2) {\n left: 30%;\n width: 20%;\n }\n\n.split-3-2-2-3 > div:nth-child(3) {\n left: 50%;\n width: 20%;\n }\n\n.split-3-2-2-3 > div:nth-child(4) {\n left: 70%;\n width: 30%;\n }\n.split-3-2-3-2 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-3-2-3-2 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.split-3-2-3-2 > div:nth-child(2) {\n left: 30%;\n width: 20%;\n }\n.split-3-2-3-2 > div:nth-child(3) {\n left: 50%;\n width: 30%;\n }\n.split-3-2-3-2 > div:nth-child(4) {\n left: 80%;\n width: 20%;\n }\n.split-3-1-2-4 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-3-1-2-4 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.split-3-1-2-4 > div:nth-child(2) {\n left: 30%;\n width: 10%;\n }\n.split-3-1-2-4 > div:nth-child(3) {\n left: 40%;\n width: 20%;\n }\n.split-3-1-2-4 > div:nth-child(4) {\n left: 60%;\n width: 40%;\n }\n.split-3-2-1-4 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-3-2-1-4 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.split-3-2-1-4 > div:nth-child(2) {\n left: 30%;\n width: 20%;\n }\n.split-3-2-1-4 > div:nth-child(3) {\n left: 50%;\n width: 10%;\n }\n.split-3-2-1-4 > div:nth-child(4) {\n left: 60%;\n width: 40%;\n }\n.split-3-2-2-2-1 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-3-2-2-2-1 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.split-3-2-2-2-1 > div:nth-child(2) {\n left: 30%;\n width: 20%;\n }\n.split-3-2-2-2-1 > div:nth-child(3) {\n left: 50%;\n width: 20%;\n }\n.split-3-2-2-2-1 > div:nth-child(4) {\n left: 70%;\n width: 20%;\n }\n.split-3-2-2-2-1 > div:nth-child(5) {\n left: 90%;\n width: 10%;\n }\n.split-3-1-1-1-4 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-3-1-1-1-4 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.split-3-1-1-1-4 > div:nth-child(2) {\n left: 30%;\n width: 10%;\n }\n.split-3-1-1-1-4 > div:nth-child(3) {\n left: 40%;\n width: 10%;\n }\n.split-3-1-1-1-4 > div:nth-child(4) {\n left: 50%;\n width: 10%;\n }\n.split-3-1-1-1-4 > div:nth-child(5) {\n left: 60%;\n width: 40%;\n }\n.w20 {\n width: 20%;\n}\n.bold {\n font-weight: 700;\n}\n.w40 {\n width: 40%;\n}\n\n.underline {\n border-bottom: 3px solid #333;\n}\n.left-padding-05 {\n padding-left: 0.5rem;\n}\n.left-padding-1 {\n padding-left: 1rem;\n}\n.left-padding-2 {\n padding-left: 2rem;\n}\n.left-margin-1 {\n margin-left: 1rem;\n}\n.left-margin-2 {\n margin-left: 2rem;\n}\n.highlight {\n background-color: rgba(200, 200, 255, 0.3);\n}\n.guided {\n /* background-color: rgba(9, 133, 67, 0.3); */\n background-color: rgba(159, 165, 162, 0.1);\n /* border-bottom: 1px solid rgba(9, 133, 67, 0.3); */\n}\n\n.divider {\n height: 0.8rem;\n /* background-color: rgba(16, 210, 113, 0.1); */\n background-color: rgba(31, 42, 36, 0.1);\n}\n\n.body-section-title {\n font-size: 1.5rem;\n color: rgb(51, 49, 49);\n}\n.body-sub-section-title {\n font-size: 1.1rem;\n font-weight: 700;\n color: rgb(3, 53, 12);\n}\n\n.body-item-title {\n color: rgb(51, 99, 49);\n display: flex;\n}\n.body-item-text {\n color: rgb(30, 30, 30);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.body-item-text .body-item-text-item {\n padding-left: 1rem;\n }\n.body-item-text-small {\n color: rgb(30, 30, 30);\n font-size: 0.7rem;\n}\n.body-item-text-em {\n color: rgb(250, 30, 30);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-weight: 700;\n}\n\n.body-input-container {\n display: flex;\n}\n.body-item-input {\n width: 60%;\n}\n.body-item-input-slider {\n width: 60%;\n}\n.body-item-input-slider-label {\n margin-right: 1rem;\n}\n.body-item-input-slider-val {\n margin-left: 1rem;\n}\n.body-item-input-slider-2nd {\n width: 60%;\n accent-color: #33f;\n}\n\n.body-button-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n\n.body-button-container > div {\n margin-left: 5px;\n margin-right: 5px;\n padding-left: 20px;\n padding-right: 20px;\n }\n\n.body-button-container .body-button {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n cursor: pointer;\n vertical-align: middle;\n text-align: center;\n }\n\n.body-button-container .body-button:hover {\n border: solid 1px #000;\n }\n\n.body-button-container .body-button-disabled {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n vertical-align: middle;\n background: #ddd;\n }\n\n.body-button-container .body-button-active {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #333;\n border-radius: 2px;\n background: #ada;\n }\n\n.body-button-container .body-button-stanby {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n background: #aba;\n cursor: pointer;\n }\n\n.body-button-container .body-button-stanby:hover {\n border: solid 1px #000;\n }\n\n.body-button-container-space-around {\n justify-content: space-around;\n}\n\n.body-select {\n color: rgb(30, 30, 30);\n max-width: 100%;\n}\n\n.body-select-50 {\n color: rgb(30, 30, 30);\n max-width: 50%;\n height: 1.5rem;\n}\n.select-option-red {\n color: #f66;\n font-weight: 700;\n}\n\n.body-image-container,\n.body-wav-container {\n display: flex;\n width: 100%;\n}\n\n.body-image-container .body-image-container-title,\n .body-image-container .body-wav-container-title,\n .body-wav-container .body-image-container-title,\n .body-wav-container .body-wav-container-title {\n width: 20%;\n }\n\n.body-image-container .body-image-container-img,\n .body-image-container .body-wav-container-wav,\n .body-wav-container .body-image-container-img,\n .body-wav-container .body-wav-container-wav {\n width: 80%;\n }\n\n.donate-img {\n border-radius: 35px;\n height: 1.5rem;\n}\n\n/* Dialog */\n.dialog-container,\n.dialog-container2 {\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100vw;\n height: 100vh;\n z-index: -1;\n display: none;\n}\n.dialog-container .dialog-frame, .dialog-container2 .dialog-frame {\n color: var(--company-color2);\n width: 40rem;\n max-height: 80vh;\n border: 2px solid var(--dialog-border-color);\n border-radius: 20px;\n flex-direction: column;\n align-items: center;\n box-shadow: 5px 5px 5px var(--dialog-shadow-color);\n background: var(--dialog-background-color);\n overflow: hidden;\n display: flex;\n }\n.dialog-container .dialog-frame .dialog-title, .dialog-container2 .dialog-frame .dialog-title {\n margin-top: 20px;\n background: var(--company-color2);\n color: #fff;\n width: 100%;\n text-align: center;\n }\n.dialog-container .dialog-frame .dialog-content, .dialog-container2 .dialog-frame .dialog-content {\n width: 90%;\n }\n.dialog-container .dialog-frame .dialog-content .dialog-application-title, .dialog-container2 .dialog-frame .dialog-content .dialog-application-title {\n font-family: "Chicle", cursive;\n font-size: 3rem;\n text-align: center;\n }\n.dialog-container .dialog-frame .dialog-content .dialog-content-part, .dialog-container2 .dialog-frame .dialog-content .dialog-content-part {\n margin-top: 1rem;\n margin-bottom: 1rem;\n }\n.dialog-container .dialog-frame .dialog-content .input-text-container, .dialog-container2 .dialog-frame .dialog-content .input-text-container {\n display: flex;\n flex-direction: row;\n margin: 20px;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content, .dialog-container2 .dialog-frame .dialog-fixed-size-content {\n width: 90%;\n max-height: 70vh;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-header,\n .dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-header,\n .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-header,\n .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-header {\n font-weight: 700;\n margin: 5px 5px 5px 5px;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-header .model-slot-header-button,\n .dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-header .file-uploader-header-button,\n .dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-header .model-slot-header-button,\n .dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-header .file-uploader-header-button,\n .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-header .model-slot-header-button,\n .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-header .file-uploader-header-button,\n .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-header .model-slot-header-button,\n .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-header .file-uploader-header-button {\n font-weight: 400;\n font-size: 0.8rem;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n cursor: pointer;\n vertical-align: middle;\n text-align: center;\n padding: 1px 5px 1px 5px;\n margin-left: 1rem;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-header .model-slot-header-button:hover, .dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-header .file-uploader-header-button:hover, .dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-header .model-slot-header-button:hover, .dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-header .file-uploader-header-button:hover, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-header .model-slot-header-button:hover, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-header .file-uploader-header-button:hover, .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-header .model-slot-header-button:hover, .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-header .file-uploader-header-button:hover {\n border: solid 1px #000;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container {\n max-height: 60vh;\n width: 100%;\n overflow-y: scroll;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot {\n height: 5rem;\n display: flex;\n flex-direction: row;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-icon, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-icon {\n width: 5rem;\n height: 5rem;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-icon-pointable, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-icon-pointable {\n width: 5rem;\n height: 5rem;\n cursor: pointer;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail {\n display: flex;\n flex-direction: column;\n font-size: 0.8rem;\n border-bottom: solid 1px #aaa;\n width: 80%;\n overflow-y: scroll;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail::-webkit-scrollbar, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail::-webkit-scrollbar {\n width: 10px;\n height: 10px;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail::-webkit-scrollbar-track, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail::-webkit-scrollbar-track {\n background-color: #eee;\n border-radius: 3px;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail::-webkit-scrollbar-thumb, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail::-webkit-scrollbar-thumb {\n background: #f7cfec80;\n border-radius: 3px;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row {\n display: flex;\n flex-direction: row;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-label, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-label {\n width: 20%;\n white-space: nowrap;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-value, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-value {\n width: 55%;\n white-space: nowrap;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-value-download, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-value-download {\n width: 55%;\n white-space: nowrap;\n cursor: pointer;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-value-pointable, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-value-pointable {\n width: 55%;\n white-space: nowrap;\n cursor: pointer;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-value-edit, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-value-edit {\n width: 55%;\n font-weight: 700;\n color: #f00;\n white-space: nowrap;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-button, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-detail .model-slot-detail-row .model-slot-detail-row-button {\n width: 15%;\n height: 90%;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-buttons, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-buttons {\n display: flex;\n flex-direction: column;\n border-bottom: solid 1px #a00;\n width: 20%;\n font-size: 0.8rem;\n padding: 4px;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n cursor: pointer;\n vertical-align: middle;\n text-align: center;\n padding: 1px;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button:hover, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button:hover {\n border: solid 1px #000;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button-disabled, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button-disabled {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n vertical-align: middle;\n background: #ddd;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button-active, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button-active {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #333;\n border-radius: 2px;\n background: #ada;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button-stanby, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button-stanby {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n background: #aba;\n cursor: pointer;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button-stanby:hover, .dialog-container2 .dialog-frame .dialog-fixed-size-content .model-slot-container .model-slot .model-slot-button-stanby:hover {\n border: solid 1px #000;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-voice-changer-select,\n .dialog-container .dialog-frame .dialog-fixed-size-content .edit-model-slot-title,\n .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-voice-changer-select,\n .dialog-container2 .dialog-frame .dialog-fixed-size-content .edit-model-slot-title {\n font-size: 1rem;\n padding-left: 0.5rem;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container, .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container {\n font-size: 0.9rem;\n padding-left: 1rem;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container .file-uploader-file-select-row, .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container .file-uploader-file-select-row {\n display: flex;\n flex-direction: row;\n margin: 0.2rem;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container .file-uploader-file-select-row .file-uploader-file-select-row-label, .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container .file-uploader-file-select-row .file-uploader-file-select-row-label {\n width: 5rem;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container .file-uploader-file-select-row .file-uploader-file-select-row-value, .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container .file-uploader-file-select-row .file-uploader-file-select-row-value {\n width: 20rem;\n color: #f00;\n white-space: nowrap;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container .file-uploader-file-select-row .file-uploader-file-select-row-button, .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container .file-uploader-file-select-row .file-uploader-file-select-row-button {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n cursor: pointer;\n vertical-align: middle;\n text-align: center;\n padding: 1px;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container .file-uploader-file-select-row .file-uploader-file-select-row-button:hover, .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-container .file-uploader-file-select-row .file-uploader-file-select-row-button:hover {\n border: solid 1px #000;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-upload-button-container, .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-upload-button-container {\n display: flex;\n flex-direction: row;\n margin-top: 1rem;\n margin-bottom: 0.5rem;\n justify-content: center;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-upload-button-container .file-uploader-file-select-upload-button, .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-upload-button-container .file-uploader-file-select-upload-button {\n /* width: 12rem; */\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n cursor: pointer;\n vertical-align: middle;\n text-align: center;\n padding: 1px 10px 1px 10px;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-upload-button-container .file-uploader-file-select-upload-button:hover, .dialog-container2 .dialog-frame .dialog-fixed-size-content .file-uploader-file-select-upload-button-container .file-uploader-file-select-upload-button:hover {\n border: solid 1px #000;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .edit-model-slot-row, .dialog-container2 .dialog-frame .dialog-fixed-size-content .edit-model-slot-row {\n display: flex;\n flex-direction: row;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-title, .dialog-container2 .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-title {\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers, .dialog-container2 .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers {\n display: flex;\n flex-direction: row;\n margin: 0px 0px 0px 1rem;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers .edit-model-slot-speakers-id-label,\n .dialog-container .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers .edit-model-slot-speakers-name-label,\n .dialog-container2 .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers .edit-model-slot-speakers-id-label,\n .dialog-container2 .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers .edit-model-slot-speakers-name-label {\n margin: 0px 0px 0px 0.5rem;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers .edit-model-slot-speakers-buttons, .dialog-container2 .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers .edit-model-slot-speakers-buttons {\n margin: 0px 0px 0px 0.5rem;\n display: flex;\n flex-direction: row;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers .edit-model-slot-speakers-buttons .edit-model-slot-speakers-button, .dialog-container2 .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers .edit-model-slot-speakers-buttons .edit-model-slot-speakers-button {\n margin: 0px 0.5rem 0px 0.5rem;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n cursor: pointer;\n vertical-align: middle;\n text-align: center;\n padding: 0px 10px 0px 10px;\n }\n.dialog-container .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers .edit-model-slot-speakers-buttons .edit-model-slot-speakers-button:hover, .dialog-container2 .dialog-frame .dialog-fixed-size-content .edit-model-slot-row .edit-model-slot-speakers .edit-model-slot-speakers-buttons .edit-model-slot-speakers-button:hover {\n border: solid 1px #000;\n }\n.dialog-container-show {\n display: flex;\n}\n\n.state-control-checkbox:checked ~ .dialog-container {\n background: rgba(200, 200, 200, 0.4);\n animation-name: dialog-show;\n animation-duration: 0.4s;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n animation-direction: normal;\n}\n.state-control-checkbox ~ .dialog-container {\n background: rgba(100, 100, 100, 0.4);\n animation-name: dialog-hide;\n animation-duration: 0.4s;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n animation-direction: normal;\n}\n.state-control-checkbox:checked + .dialog-frame {\n display: flex;\n}\n.state-control-checkbox + .dialog-frame {\n display: none;\n}\n\n@keyframes dialog-hide {\n from {\n opacity: 1;\n z-index: 200;\n }\n 90% {\n opacity: 0;\n z-index: -1;\n }\n to {\n opacity: 0;\n z-index: -1;\n }\n}\n\n@keyframes dialog-show {\n from {\n opacity: 0;\n z-index: -1;\n }\n 10% {\n z-index: 200;\n }\n to {\n opacity: 1;\n z-index: 200;\n }\n}\n\n.state-control-checkbox:checked ~ .dialog-container2 {\n background: rgba(200, 200, 200, 0.4);\n animation-name: dialog-show2;\n animation-duration: 0.4s;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n animation-direction: normal;\n}\n.state-control-checkbox ~ .dialog-container2 {\n background: rgba(100, 100, 100, 0.4);\n animation-name: dialog-hide2;\n animation-duration: 0.4s;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n animation-direction: normal;\n}\n/* .state-control-checkbox:checked + .dialog-frame {\n display: flex;\n}\n.state-control-checkbox + .dialog-frame {\n display: none;\n} */\n\n@keyframes dialog-hide2 {\n from {\n opacity: 1;\n z-index: 400;\n }\n 90% {\n opacity: 0;\n z-index: -1;\n }\n to {\n opacity: 0;\n z-index: -1;\n }\n}\n\n@keyframes dialog-show2 {\n from {\n opacity: 0;\n z-index: -1;\n }\n 10% {\n z-index: 400;\n }\n to {\n opacity: 1;\n z-index: 400;\n }\n}\n\n.tooltip-text {\n display: none;\n position: absolute;\n padding: 4px;\n font-size: 0.7rem;\n line-height: 2rem;\n color: #ddd;\n border-radius: 5px;\n background: #444;\n /* width: 100px; */\n}\n.tooltip-text-100px {\n width: 100px;\n}\n.tooltip-text-thin {\n line-height: 1rem;\n}\n.tooltip-text-right {\n line-height: 1rem;\n}\n.tooltip-text:before {\n content: "";\n position: absolute;\n top: -1.4rem;\n border: 12px solid transparent;\n border-top: 16px solid #444;\n margin-left: 0rem;\n transform: rotateZ(180deg);\n}\n.tooltip:hover .tooltip-text {\n display: inline-block;\n top: 30px;\n left: 0px;\n}\n.tooltip:hover .tooltip-text-lower {\n display: inline-block;\n top: 60px;\n left: 0px;\n}\n\n.tooltip {\n position: relative;\n cursor: pointer;\n display: inline-block;\n}\n\n/* ################## */\n.merge-field-container {\n display: flex;\n flex-direction: column;\n}\n.merge-field-container .merge-field {\n display: flex;\n flex-direction: row;\n }\n.merge-field-container .merge-field .merge-field-elem {\n padding-left: 5px;\n }\n.merge-field-container .merge-field .red {\n color: #f00;\n }\n.merge-field-container .merge-field .purple {\n color: #33f;\n }\n.merge-field-container .merge-field .grey-bold {\n color: #555;\n font-weight: 800;\n }\n.model-slot-area {\n display: inline-block;\n background: var(--company-color2);\n border-radius: 10px;\n padding: 20px;\n}\n.model-slot-area .model-slot-panel {\n display: flex;\n flex-direction: row;\n gap: 5px;\n }\n.model-slot-area .model-slot-panel .model-slot-tiles-container {\n display: flex;\n flex-direction: row;\n gap: 2px;\n flex-wrap: wrap;\n /* width: calc(30rem + 40px + 10px); */\n }\n.model-slot-area .model-slot-panel .model-slot-buttons {\n display: flex;\n flex-direction: column-reverse;\n }\n.model-slot-area .model-slot-panel .model-slot-buttons .model-slot-button {\n border: solid 2px #999;\n color: white;\n font-size: 0.8rem;\n border-radius: 2px;\n background: #333;\n cursor: pointer;\n padding: 5px;\n }\n.model-slot-area .model-slot-panel .model-slot-buttons .model-slot-button:hover {\n border: solid 2px #faa;\n }\n.model-slot-tile-container,\n.model-slot-tile-container-selected {\n width: 6rem;\n height: 6rem;\n border-radius: 2px;\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n.model-slot-tile-container-selected {\n background: #43030c;\n}\n.model-slot-tile-container:hover {\n background: #43030c;\n}\n\n.model-slot-tile-icon-div {\n width: 5rem;\n height: 5rem;\n padding-top: 4px;\n position: relative;\n}\n.model-slot-tile-icon {\n width: 5rem;\n height: 5rem;\n -o-object-fit: contain;\n object-fit: contain;\n border-radius: 10px;\n position: absolute;\n}\n.model-slot-tile-vctype {\n position: absolute;\n font-size: 0.6rem;\n font-weight: 800;\n top: 5px;\n left: 2px;\n background: RGBA(10, 200, 100, 0.6);\n border-radius: 5px;\n padding: 0px 2px 0px 2px;\n}\n.model-slot-tile-icon-no-entry {\n color: gray;\n position: absolute;\n top: 2rem;\n}\n.model-slot-tile-dscription {\n font-size: 0.7rem;\n font-weight: 700;\n color: navajowhite;\n padding-top: 4px;\n}\n\n.character-area {\n display: flex;\n gap: 5px;\n padding: 20px;\n}\n\n.character-area .portrait-area {\n width: 20rem;\n height: 20rem;\n }\n\n.character-area .portrait-area .portrait-container {\n position: relative;\n width: 20rem;\n height: 20rem;\n }\n\n.character-area .portrait-area .portrait-container .portrait {\n width: 20rem;\n height: 20rem;\n -o-object-fit: contain;\n object-fit: contain;\n border-radius: 10px;\n position: absolute;\n }\n\n.character-area .portrait-area .portrait-container .portrait-area-status {\n width: 5rem;\n background: rgba(100, 100, 100, 0.5);\n color: white;\n position: absolute;\n padding: 0px 0px 0px 3px;\n font-size: 0.7rem;\n left: 5px;\n top: 5px;\n border-radius: 2px;\n }\n\n.character-area .portrait-area .portrait-container .portrait-area-status .portrait-area-status-vctype {\n font-weight: 800;\n color: #866;\n }\n\n.character-area .portrait-area .portrait-container .portrait-area-terms-of-use {\n width: 5rem;\n background: rgba(100, 100, 100, 0.5);\n color: white;\n position: absolute;\n paddig: 2px;\n font-size: 0.7rem;\n right: 5px;\n bottom: 5px;\n }\n\n.character-area .portrait-area .portrait-container .portrait-area-terms-of-use .portrait-area-terms-of-use-link {\n color: white;\n }\n\n.character-area .character-area-control-area {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n\n.character-area .character-area-control-area .character-area-control {\n display: flex;\n gap: 3px;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-buttons {\n display: flex;\n flex-direction: row;\n gap: 10px;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-buttons .character-area-control-button-active {\n width: 5rem;\n border: solid 1px #333;\n border-radius: 2px;\n background: #ada;\n font-weight: 700;\n text-align: center;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-buttons .character-area-control-button-stanby {\n width: 5rem;\n border: solid 1px #999;\n border-radius: 2px;\n background: #aba;\n cursor: pointer;\n font-weight: 700;\n text-align: center;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-buttons .character-area-control-button-stanby:hover {\n border: solid 1px #000;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-title {\n width: 4rem;\n font-weight: 700;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-field {\n /* width: 20rem; */\n display: flex;\n flex-direction: column;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-field .character-area-slider-control {\n display: flex;\n flex-direction: row;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-field .character-area-slider-control .character-area-slider-control-kind {\n width: 2rem;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-field .character-area-slider-control .character-area-slider-control-slider {\n width: 10rem;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-field .character-area-slider-control .character-area-slider-control-val {\n width: 3rem;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-field .character-area-slider-control .character-area-slider-control-text {\n padding: 0px 1px 0px 1px;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-field .character-area-buttons {\n display: flex;\n flex-direction: row;\n gap: 5px;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-field .character-area-buttons .character-area-button {\n border: solid 2px #999;\n color: white;\n font-size: 0.8rem;\n border-radius: 2px;\n background: #666;\n cursor: pointer;\n padding: 5px;\n }\n\n.character-area .character-area-control-area .character-area-control .character-area-control-field .character-area-buttons .character-area-button:hover {\n border: solid 2px #faa;\n }\n\n/* audio::-webkit-media-controls-play-button,\naudio::-webkit-media-controls-panel {\n background-color: #ff0;\n height: 1rem;\n}\naudio::-webkit-media-controls-enclosure {\n max-height: 1rem;\n}\naudio::-webkit-media-controls {\n justify-content: start;\n}\naudio::-webkit-media-controls-overlay-enclosure{\n height: 1rem;\n} */\n\n.config-area {\n display: flex;\n gap: 5px;\n padding: 20px;\n}\n\n.config-area .config-sub-area {\n display: flex;\n flex-direction: column;\n gap: 3px;\n }\n\n.config-area .config-sub-area .config-sub-area-control {\n display: flex;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-title {\n width: 5rem;\n font-weight: 700;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-title-long {\n width: 20rem;\n font-weight: 700;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field {\n width: 15rem;\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-noise-container {\n display: flex;\n gap: 10px;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-noise-container .config-sub-area-noise-checkbox-container {\n display: flex;\n gap: 5px;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-slider-control {\n display: flex;\n flex-direction: row;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-slider-control .config-sub-area-slider-control-kind {\n width: 1rem;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-slider-control .config-sub-area-slider-control-slider {\n width: 10rem;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-slider-control .config-sub-area-slider-control-val {\n width: 3rem;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-buttons {\n display: flex;\n flex-direction: row;\n gap: 5px;\n align-items: center;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-buttons .config-sub-area-button {\n border: solid 2px #999;\n color: white;\n background: #666;\n\n cursor: pointer;\n\n font-size: 0.8rem;\n border-radius: 5px;\n height: 1.2rem;\n padding-left: 2px;\n padding-right: 2px;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-buttons .config-sub-area-button:hover {\n border: solid 2px #faa;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-buttons .config-sub-area-button-active {\n border: solid 2px #999;\n color: white;\n background: #844;\n\n cursor: pointer;\n\n font-size: 0.8rem;\n border-radius: 5px;\n height: 1.2rem;\n padding-left: 2px;\n padding-right: 2px;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-control-field-auido-io {\n display: flex;\n flex-direction: row;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-control-field-auido-io .config-sub-area-control-field-auido-io-filter {\n max-width: 30%;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-control-field-auido-io .config-sub-area-control-field-auido-io-select {\n max-width: 70%;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-control-field-wav-file {\n display: flex;\n flex-direction: row;\n gap: 5px;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-control-field-wav-file .config-sub-area-control-field-wav-file-audio-container {\n height: 1rem;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-control-field-wav-file .config-sub-area-control-field-wav-file-audio-container .config-sub-area-control-field-wav-file-audio {\n height: 1rem;\n width: 15rem;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-control-field-wav-file .config-sub-area-control-field-wav-file-folder {\n height: 1rem;\n width: 1rem;\n cursor: pointer;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-control-field-wav-file .config-sub-area-control-field-wav-file-echoback-button {\n border: solid 1px #333;\n background: #fff;\n font-size: 0.8rem;\n border-radius: 5px;\n height: 1.2rem;\n padding-left: 2px;\n padding-right: 2px;\n cursor: pointer;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field .config-sub-area-control-field-wav-file .config-sub-area-control-field-wav-file-echoback-button-active {\n font-size: 0.8rem;\n border: solid 1px #333;\n border-radius: 5px;\n background: #ada;\n height: 1.2rem;\n padding-left: 2px;\n padding-right: 2px;\n cursor: pointer;\n }\n\n.config-area .config-sub-area .config-sub-area-control .config-sub-area-control-field-long {\n width: 30rem;\n }\n\n.headerArea {\n display: flex;\n flex-direction: column;\n}\n\n.headerArea .title1 {\n display: flex;\n flex-direction: row;\n gap: 5px;\n align-items: flex-end;\n }\n\n.headerArea .title1 .title {\n font-size: 1.8rem;\n font-weight: 700;\n color: #333;\n text-shadow: 0 0 2px #333;\n }\n\n.headerArea .title1 .title-version {\n font-size: 0.9rem;\n }\n\n.headerArea .title1 .title-version-number {\n font-size: 0.7rem;\n }\n\n.headerArea .icons {\n display: flex;\n flex-direction: row;\n gap: 20px;\n }\n\n.headerArea .icons .belongings {\n display: flex;\n flex-direction: row;\n gap: 3px;\n }\n\n.headerArea .icons .belongings .belongings-button {\n border: solid 2px #999;\n color: white;\n font-size: 0.8rem;\n border-radius: 5px;\n background: #666;\n cursor: pointer;\n padding: 5px;\n height: 1.7rem;\n top: -2px;\n }\n\n.headerArea .icons .belongings .belongings-button:hover {\n border: solid 2px #cc6;\n }\n\n.advanced-setting-container {\n display: flex;\n flex-direction: column;\n gap: 5px;\n margin: 10px;\n}\n\n.advanced-setting-container .advanced-setting-container-row {\n display: flex;\n flex-direction: row;\n gap: 5px;\n }\n\n.advanced-setting-container .advanced-setting-container-row .advanced-setting-container-row-title {\n width: 7rem;\n font-weight: 700;\n font-size: 0.9rem;\n }\n\n.advanced-setting-container .advanced-setting-container-row .advanced-setting-container-row-field {\n width: 15rem;\n font-size: 0.9rem;\n }\n\n.advanced-setting-container .advanced-setting-container-row .advanced-setting-container-row-field .advanced-setting-container-row-field-crossfade-container {\n display: flex;\n flex-direction: row;\n gap: 5px;\n width: 10rem;\n }\n\n.advanced-setting-container .advanced-setting-container-row .advanced-setting-container-row-field .advanced-setting-container-row-field-crossfade-container > div {\n display: flex;\n flex-direction: row;\n gap: 3px;\n }\n\n.advanced-setting-container .advanced-setting-container-row .advanced-setting-container-row-field .advanced-setting-container-row-field-crossfade-container > div > div:nth-child(1) {\n color: #333;\n }\n\n.advanced-setting-container .advanced-setting-container-row .advanced-setting-container-row-field .advanced-setting-container-row-field-crossfade-container > div > div:nth-child(2) {\n }\n.get-server-information-container {\n margin: 10px;\n}\n.get-server-information-container .get-server-information-text-area {\n width: 100%;\n height: 20rem;\n }\n.merge-lab-container {\n display: flex;\n flex-direction: column;\n margin: 10px;\n gap: 10px;\n}\n.merge-lab-container .merge-lab-type-filter {\n display: flex;\n flex-direction: row;\n }\n.merge-lab-container .merge-lab-type-filter > div:nth-child(1) {\n width: 50%;\n }\n.merge-lab-container .merge-lab-type-filter > div:nth-child(2) {\n width: 50%;\n }\n.merge-lab-container .merge-lab-manipulator {\n display: flex;\n flex-direction: row;\n }\n.merge-lab-container .merge-lab-manipulator .merge-lab-model-list {\n width: 70%;\n }\n.merge-lab-container .merge-lab-manipulator .merge-lab-model-list .merge-lab-model-item {\n display: flex;\n flex-direction: row;\n }\n.merge-lab-container .merge-lab-manipulator .merge-lab-model-list .merge-lab-model-item > div:nth-child(1) {\n width: 50%;\n }\n.merge-lab-container .merge-lab-manipulator .merge-lab-model-list .merge-lab-model-item > div:nth-child(2) {\n width: 50%;\n }\n.merge-lab-container .merge-lab-manipulator .merge-lab-merge-buttons {\n display: flex;\n flex-direction: column-reverse;\n width: 30%;\n }\n.merge-lab-container .merge-lab-manipulator .merge-lab-merge-buttons .merge-lab-merge-button {\n border: solid 2px #ddd;\n color: black;\n font-size: 0.8rem;\n border-radius: 5px;\n background: #eee;\n cursor: pointer;\n padding: 5px;\n height: 1.7rem;\n text-align: center;\n }\n.merge-lab-container .merge-lab-manipulator .merge-lab-merge-buttons .merge-lab-merge-button:hover {\n border: solid 2px #aaa;\n }\n.merge-lab-container .merge-lab-manipulator .merge-lab-merge-buttons .merge-lab-merge-buttons-notice {\n font-size: 0.7rem;\n font-weight: 700;\n color: #333;\n text-align: center;\n }\n',""]);const u=l},513:(e,t,c)=>{"use strict";c.d(t,{Z:()=>o});var n=c(81),i=c.n(n),a=c(645),r=c.n(a)()(i());r.push([e.id,".error-container {\n margin: 2rem;\n}\n .error-container .top-error-message {\n color: #44a;\n font-size: 2rem;\n font-weight: 100;\n }\n .error-container .top-error-description {\n color: #444;\n font-size: 1rem;\n font-weight: 100;\n }\n .error-container .error-detail {\n margin-top: 2rem;\n padding: 1rem;\n border: 1px solid;\n }\n .error-container .error-detail .error-name {\n font-weight: 700;\n }\n .error-container .error-detail .error-message {\n margin-top: 0.5rem;\n }\n .error-container .error-detail .error-info-container {\n margin-top: 0.5rem;\n font-size: 0.8rem;\n }\n .error-container .error-detail .error-info-container .error-info-line {\n }\n",""]);const o=r},645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var c="",n=void 0!==t[5];return t[4]&&(c+="@supports (".concat(t[4],") {")),t[2]&&(c+="@media ".concat(t[2]," {")),n&&(c+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),c+=e(t),n&&(c+="}"),t[2]&&(c+="}"),t[4]&&(c+="}"),c})).join("")},t.i=function(e,c,n,i,a){"string"==typeof e&&(e=[[null,e,void 0]]);var r={};if(n)for(var o=0;o0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=a),c&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=c):u[2]=c),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},81:e=>{"use strict";e.exports=function(e){return e[1]}},448:(e,t,c)=>{"use strict";var n=c(294),i=c(840);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,c=1;c