vendor: 3,907 bytes, line 1
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1602],{34537:function(e){"use strict";e.exports=function(e,t){var i=new Array(arguments.length-1),n=0,s=2,o=!0;for(;s<arguments.length;)i[n++]=arguments[s++];return new Promise((function(s,r){i[n]=function(e){if(o)if(o=!1,e)r(e);else{for(var t=new Array(arguments.length-1),i=0;i<t.length;)t[i++]=arguments[i];s.apply(null,t)}};try{e.apply(t||null,i)}catch(a){o&&(o=!1,r(a))}}))}},97419:function(e,t){"use strict";var i=t;i.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&"="===e.charAt(t);)++i;return Math.ceil(3*e.length)/4-i};for(var n=new Array(64),s=new Array(123),o=0;o<64;)s[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;i.encode=function(e,t,i){for(var s,o=null,r=[],a=0,d=0;t<i;){var c=e[t++];switch(d){case 0:r[a++]=n[c>>2],s=(3&c)<<4,d=1;break;case 1:r[a++]=n[s|c>>4],s=(15&c)<<2,d=2;break;case 2:r[a++]=n[s|c>>6],r[a++]=n[63&c],d=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,r)),a=0)}return d&&(r[a++]=n[s],r[a++]=61,1===d&&(r[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,r.slice(0,a))),o.join("")):String.fromCharCode.apply(String,r.slice(0,a))};var r="invalid encoding";i.decode=function(e,t,i){for(var n,o=i,a=0,d=0;d<e.length;){var c=e.charCodeAt(d++);if(61===c&&a>1)break;if(void 0===(c=s[c]))throw Error(r);switch(a){case 0:n=c,a=1;break;case 1:t[i++]=n<<2|(48&c)>>4,n=c,a=2;break;case 2:t[i++]=(15&n)<<4|(60&c)>>2,n=c,a=3;break;case 3:t[i++]=(3&n)<<6|c,a=0}}if(1===a)throw Error(r);return i-o},i.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},19211:function(e){"use strict";function t(){this._listeners=Object.create(null)}e.exports=t,t.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners=Object.create(null);else if(void 0===t)this._listeners[e]=[];else{var i=this._listeners[e];if(!i)return this;for(var n=0;n<i.length;)i[n].fn===t?i.splice(n,1):++n}return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var i=[],n=1;n<arguments.length;)i.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,i)}return this}},10945:function(e){"use strict";function t(e){return"undefined"!==typeof Float32Array?function(){var t=new Float32Array([-0]),i=new Uint8Array(t.buffer),n=128===i[3];function s(e,n,s){t[0]=e,n[s]=i[0],n[s+1]=i[1],n[s+2]=i[2],n[s+3]=i[3]}function o(e,n,s){t[0]=e,n[s]=i[3],n[s+1]=i[2],n[s+2]=i[1],n[s+3]=i[0]}function r(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],t[0]}function a(e,n){return i[3]=e[n],i[2]=e[n+1],i[1]=e[n+2],i[0]=e[n+3],t[0]}e.writeFloatLE=n?s:o,e.writeFloatBE=n?o:s,e.readFloatLE=n?r:a,e.readFloatBE=n?a:r}():function(){function t(e,t,i,n){var s=t<0?1:0;if(s&&(t=-t),0===t)e(1/t>0?0:2147483648,i,n);else if(isNaN(t))e(2143289344,i,n);else if(t>34028234663852886e22)e((s<<31|2139095040)>>>0,i,n);else if(t<11754943508222875e-54)e((s<<31|Math.round(t/1401298464324817e-60))>>>0,i,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((s<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,i,n)}}function r(e,t,i){var n=e(t,i),s=2*(n>>31)+1,o=n>>>23&255,r=8388607&n;return 255===o?r?NaN:s*(1/0):0===o?1401298464324817e-60*s*r:s*Math.pow(2,o-150)*(r+8388608)}e.writeFloatLE=t.bind(null,i),e.writeFloatBE=t.bind(null,n),e.readFloatLE=r.bind(null,s),e.readFloatBE=r.bind(null,o)}(),"undefined"!==typeof Float64Array?function(){var t=new Float64Array([-0]),i=new Uint8Array(t.buffer),n=128===i[7];function s(e,n,s){t[0]=e,n[s]=i[0],n[s+1]=i[1],n[s+2]=i[2],n[s+3]=i[3],n[s+4]=i[4],n[s+5]=i[5],n[s+6]=i[6],n[s+7]=i[7]}function o(e,n,s){t[0]=e,n[s]=i[7],n[s+1]=i[6],n[s+2]=i[5],n[s+3]=i[4],n[s+4]=i[3],n[s+5]=i[2],n[s+6]=i[1],n[s+7]=i[0]}function r(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],i[4]=e[n+4],i[5]=e[n+5],i[
16]=e[n+6],i[7]=e[n+7],t[0]}function a(e,n){return i[7]=e[n],i[6]=e[n+1],i[5]=e[n+2],i[4]=e[n+3],i[3]=e[n+4],i[2]=e[n+5],i[1]=e[n+6],i[0]=e[n+7],t[0]}e.writeDoubleLE=n?s:o,e.writeDoubleBE=n?o:s,e.readDoubleLE=n?r:a,e.readDoubleBE=n?a:r}():function(){function t(e,t,i,n,s,o){var r=n<0?1:0;if(r&&(n=-n),0===n)e(0,s,o+t),e(1/n>0?0:2147483648,s,o+i);else if(isNaN(n))e(0,s,o+t),e(2146959360,s,o+i);else if(n>17976931348623157e292)e(0,s,o+t),e((r<<31|2146435072)>>>0,s,o+i);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,s,o+t),e((r<<31|a/4294967296)>>>0,s,o+i);else{var d=Math.floor(Math.log(n)/Math.LN2);1024===d&&(d=1023),e(4503599627370496*(a=n*Math.pow(2,-d))>>>0,s,o+t),e((r<<31|d+1023<<20|1048576*a&1048575)>>>0,s,o+i)}}}function r(e,t,i,n,s){var o=e(n,s+t),r=e(n,s+i),a=2*(r>>31)+1,d=r>>>20&2047,c=4294967296*(1048575&r)+o;return 2047===d?c?NaN:a*(1/0):0===d?5e-324*a*c:a*Math.pow(2,d-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,i,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=r.bind(null,s,0,4),e.readDoubleBE=r.bind(null,o,4,0)}(),e}function i(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}function n(e,t,i){t[i]=e>>>24,t[i+1]=e>>>16&255,t[i+2]=e>>>8&255,t[i+3]=255&e}function s(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},67199:function(e,t,i){"use strict";e.exports=function(e){try{0;var t=i(30822)(e);return t&&(t.length||Object.keys(t).length)?t:null}catch(n){return null}}},76662:function(e){"use strict";e.exports=function(e,t,i){var n=i||8192,s=n>>>1,o=null,r=n;return function(i){if(i<1||i>s)return e(i);r+i>n&&(o=e(n),r=0);var a=t.call(o,r,r+=i);return 7&r&&(r=1+(7|r)),a}}},94997:function(e,t){"use strict";var i=t,n=65533;i.length=function(e){for(var t=0,i=0,n=0;n<e.length;++n)(i=e.charCodeAt(n))<128?t+=1:i<2048?t+=2:55296===(64512&i)&&56320===(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},i.read=function(e,t,i){if(i-t<1)return"";for(var s,o,r,a,d=null,c=[],l=0;t<i;)(s=e[t++])<=127?c[l++]=s:s>=192&&s<224?(r=(31&s)<<6|63&e[t++],c[l++]=r>=128?r:n):s>=224&&s<240?(a=(15&s)<<12|(63&e[t++])<<6|63&e[t++],c[l++]=a>=2048?a:n):s>=240&&((o=(7&s)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])<65536||o>1114111?c[l++]=n:(o-=65536,c[l++]=55296+(o>>10),c[l++]=56320+(1023&o))),l>8191&&((d||(d=[])).push(String.fromCharCode.apply(String,c.slice(0,l))),l=0);return d?(l&&d.push(String.fromCharCode.apply(String,c.slice(0,l))),d.join("")):String.fromCharCode.apply(String,c.slice(0,l))},i.write=function(e,t,i){for(var n,s,o=i,r=0;r<e.length;++r)(n=e.charCodeAt(r))<128?t[i++]=n:n<2048?(t[i++]=n>>6|192,t[i++]=63&n|128):55296===(64512&n)&&56320===(64512&(s=e.charCodeAt(r+1)))?(n=65536+((1023&n)<<10)+(1023&s),++r,t[i++]=n>>18|240,t[i++]=n>>12&63|128,t[i++]=n>>6&63|128,t[i++]=63&n|128):(t[i++]=n>>12|224,t[i++]=n>>6&63|128,t[i++]=63&n|128);return i-o}},78320:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(23922);t.default=class{constructor(e,t,i,n=1e3,s=200){this.realtimeController=e,this.selfAttendeeId=t,this.hasBandwidthPriorityCallback=i,this.waitIntervalMs=n,this.updateIntervalMs=s,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,i){if(!this.needUpdate(i))return;const n=[],s=Object.keys(this.speakerScores);for(let a=0;a<s.length;a++){const e=s[a];n.push({attendeeId:e,activeScore:this.speakerScores[e]})}const o=n.sort(((e,t)=>t.activeScore-e.activeScore)).filter((function(e){return e.activeScore>0})).map((function(e){return e.attendeeId}));this.activeSpeakers=o,t(o);const r=o.length>0&&o[0]===this.selfAttendeeId&&e.prioritizeVideoSendBandwidthForActiveSpeaker();this.hasBandwidthPriority!==r&&(this.hasBandwidthPriority=r,this.hasBandwidthPriorityCallback(r))}updateScore(e,t,i,n,s){const o=e.calculateScore(i,n,s);this.speakerScores[i]!==o&&(this.speakerScores[i]=o,this.mostRecentUpdateTimestamp[i]=Date.now(),this.updateActiveSpeakers(e,t,i))}subscribe(e,t,i,n){const o=(i,n)=>{if(!n)return this.speakerScores[i]=0,this.mostRecentUpdateTimestamp[i]=Date.now(),void this.updateActiveSpeakers(e,t,i);this.realtimeController.realtimeSubscribeToVolumeIndicator(i,((i,n,s,o)=>{this.mostRecentUpdateTimestamp[i]=Date.now(),null!==s&&(this.speakerMuteState[i]=s),this.updateScore(e,t,i,n,s)}))};this.detectorCallbackToHandler.set(t,o);const r=new s.default(this.updateIntervalMs);if(r.start((()=>{for(const i in this.speakerScores)Date.now()-this.mostRecentUpdateTimestamp[i]>this.waitIntervalMs&&this.updateScore(e,t,i,0,this.speakerMuteState[i])})),this.detectorCallbackToActivityTimer.set(t,r),i&&n){const e=new s.default(n);e.start((()=>{i(this.speakerScores)})),this.detectorCallbackToScoresTimer.set(t,e)}this.realtimeController.realtimeSubscribeToAttendeeIdPresence(o)}unsubscribe(e){const t=this.detectorCallbackToHandler.get(e);this.detectorCallbackToHandler.delete(e),t&&this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(t);const i=this.detectorCallbackToActivityTimer.get(e);i&&(i.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()}
1))}}},42363:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e=.9,t=.01,i=.2,n=.2){this.speakerWeight=e,this.cutoffThreshold=t,this.silenceThreshold=i,this.takeoverRate=n,this.volumes={}}calculateScore(e,t,i){(i||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 s in this.volumes)s!==e&&(this.volumes[s]=Math.max(this.volumes[s]-this.takeoverRate*t,0));return n<this.cutoffThreshold?0:n}prioritizeVideoSendBandwidthForActiveSpeaker(){return!0}}},37535:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(e,t){this.appName=e,this.appVersion=t}static create(e,t){const n=/^[a-zA-Z0-9]+[a-zA-Z0-9_-]*[a-zA-Z0-9]+$/g;if(!e||e.length>32)throw new Error("appName should be a valid string and 1 to 32 characters in length");if(!n.test(e))throw new Error(`appName must satisfy ${n} regular expression`);if(!t||t.length>32)throw new Error("appVersion should be a valid string and 1 to 32 characters in length");if(!/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/gm.test(t))throw new Error("appVersion must satisfy Semantic Versioning format");return new i(e,t)}}t.default=i},47602:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},96802:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(90543),o=i(37797);t.default=class{constructor(e){this.logger=e,this.audioDevice=null,this.audioElement=null,this.audioStream=null,this.browserBehavior=new s.default,this.observers=new Set}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,this.forEachObserver((e=>{this.audioStream&&e.meetingAudioStreamBecameInactive(this.audioStream)})))}bindAudioStream(e){return n(this,void 0,void 0,(function*(){if(e){this.audioStream=e;try{yield this.bindAudioMix()}catch(t){this.logger&&this.logger.warn(`Failed to bind audio stream: ${t}`)}}}))}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()}))}forEachObserver(e){for(const t of this.observers)o.default.nextTick((()=>{e(t)}))}bindAudioMix(){var e,t;return n(this,void 0,void 0,(function*(){if(!this.audioElement)return;const i=this.audioElement.srcObject;this.audioStream&&(this.audioElement.srcObject=this.audioStream),i!==this.audioStream&&this.forEachObserver((e=>{i&&e.meetingAudioStreamBecameInactive(i),this.audioStream&&e.meetingAudioStreamBecameActive(this.audioStream)}));const n=(null===(e=this.audioDevice)||void 0===e?void 0:e.deviceId)!==this.audioElement.sinkId;if(n&&"undefined"===typeof this.audioElement.sinkId)throw new Error("Cannot select audio output device. This browser does not support setSinkId.");const s=this.audioDevice?this.audioDevice.deviceId:"";if(s===this.audioElement.sinkId)return;const o=this.audioElement,r=this.audioStream;if(this.browserBehavior.hasChromiumWebRTC()&&(o.srcObject=null),n)try{yield o.setSinkId(s)}catch(a){throw null===(t=this.logger)||void 0===t||t.error(`Failed to set sinkId for audio element: ${a}`),a}this.browserBehavior.hasChromiumWebRTC()&&(o.srcObject=r)}))}getCurrentMeetingAudioStream(){return n(this,void 0,void 0,(function*(){return this.audioStream}))}addAudioMixObserver(e){return n(this,void 0,void 0,(function*(){this.observers.add(e)}))}removeAudioMixObserver(e){return n(this,void 0,void 0,(function*(){this.observers.delete(e)}))}}},23765:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(e=null){this.audioBitrateBps=e}static fullbandSpeechMono(){return new i(4e4)}static fullbandMusicMono(){return new i(64e3)}static fullbandMusicStereo(){return new i(128e3)}isStereo(){return 128e3===this.audioBitrateBps}}t.default=i},31876:function(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.lastVideosToReceive=null,this.videoSubscriptions=null,this.videoSubscriptionLimit=25,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,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.startAudioVideoT
1imestamp=null,this.attendeePresenceDurationMs=null,this.meetingStartDurationMs=null,this.poorConnectionCount=0,this.maxVideoTileCount=0,this.startTimeMs=null}}},9059:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(78320),o=i(96802),r=i(23765),a=i(90543),d=i(66688),c=i(68581),l=i(93831),u=i(13789),h=i(25687),f=i(5723),g=i(97500),p=i(70983),m=i(37797),v=i(19678),S=i(13860),b=i(79553),w=i(93013),y=i(41208),C=i(99416),T=i(9101),k=i(20289),_=i(64015),I=i(38358),M=i(53216),x=i(47408),E=i(5054),A=i(21129),P=i(26240),R=i(21960),D=i(96180),O=i(2748),V=i(11981),B=i(94543),L=i(28556),N=i(23968),F=i(51209),U=i(25547),$=i(120),W=i(39560),j=i(88797),H=i(99485),z=i(47079),K=i(64833),G=i(25275),q=i(95924),J=i(90250),Q=i(6171),Z=i(50365),X=i(5785),Y=i(79354),ee=i(28660),te=i(51133),ie=i(75185),ne=i(12880),se=i(91508),oe=i(91318),re=i(34242),ae=i(42958),de=i(94922),ce=i(24450),le=i(72472),ue=i(99751),he=i(31876);class fe{constructor(e,t,i,n,s,c){this._audioProfile=new r.default,this.connectionHealthData=new d.default,this.observerQueue=new Set,this.meetingSessionContext=new he.default,this.enableSimulcast=!1,this.useUpdateTransceiverControllerForUplink=!1,this.totalRetryCount=0,this.startAudioVideoT
1imestamp=0,this.mayNeedRenegotiationForSimulcastLayerChange=!1,this.promotedToPrimaryMeeting=!1,this.receiveIndexTask=void 0,this.monitorTask=void 0,this.destroyed=!1,this.usePromises=!0,this._logger=t,this.sessionStateController=new v.default(this._logger),this._configuration=e,this.enableSimulcast=e.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&(new a.default).hasChromiumWebRTC(),this._webSocketAdapter=i,this._realtimeController=new p.default,this._realtimeController.realtimeSetLocalAttendeeId(e.credentials.attendeeId,e.credentials.externalUserId),this._mediaStreamBroker=n,this._reconnectController=s,this._videoTileController=new ae.default(new de.default,this,this._logger),this._audioMixController=new o.default(this._logger),this.meetingSessionContext.logger=this._logger,this._eventController=new l.default(this,c)}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 s.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)m.default.nextTick((()=>{this.observerQueue.has(t)&&e(t)}))}initSignalingClient(){this.meetingSessionContext.signalingClient||(this.connectionHealthData.reset(),this.meetingSessionContext=new he.default,this.meetingSessionContext.logger=this.logger,this.meetingSessionContext.eventController=this.eventController,this.meetingSessionContext.browserBehavior=new a.default,this.meetingSessionContext.meetingSessionConfiguration=this.configuration,this.meetingSessionContext.signalingClient=new y.default(this._webSocketAdapter,this.logger))}uninstallPreStartObserver(){this.meetingSessionContext.signalingClient.removeObserver(this.preStartObserver),this.preStartObserver=void 0}prestart(){return this.logger.info("Pre-connecting signaling connection."),this.createOrReuseSignalingTask().run().then((()=>{const e=()=>n(this,void 0,void 0,(function*(){this.logger.info("Early connection closed; discarding signaling task."),this.signalingTask=void 0,this.uninstallPreStartObserver()}));this.preStartObserver={handleSignalingClientEvent(t){t.type===C.default.WebSocketClosed&&e()}},this.meetingSessionContext.signalingClient.registerObserver(this.preStartObserver)})).catch((e=>{this.logger.error(`Signaling task pre-start failed: ${e}`),this.signalingTask=void 0}))}start(e){this.startReturningPromise(e).then((()=>{this.logger.info("start completed")})).catch((e=>{this.logger.error(`start failed: ${e}`)}))}startReturningPromise(e){return!0===(null===e||void 0===e?void 0:e.signalingOnly)?this.prestart():(this.activeSpeakerDetector,new Promise(((e,t)=>{this.sessionStateController.perform(S.default.Connect,(()=>{this.actionConnect(!1).then(e).catch(t)}))})))}connectWithPromises(e){const t=this.meetingSessionContext;this.monitorTask=new V.default(t,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData);const i=this.monitorTask.once(),n=new F.default(t).once();this.receiveIndexTask=new W.default(t),this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();const s=new z.default(this.logger,"Signaling",[this.createOrReuseSignalingTask(),new O.default(t),new H.default(t),new R.default(t),new U.default(t),this.receiveIndexTask]).once(),o=new E.default(t).once(s),r=new I.default(t).once(o,n),a=new A.default(t).once(r),d=new K.default(t).once(a),c=new P.default(t).once(d),l=new q.default(t).once(c);return new z.default(this.logger,this.wrapTaskName("AudioVideoStart"),[i,((e,t)=>new J.default(this.logger,t,e))(this.configuration.connectionTimeoutMs,new z.default(this.logger,"Peer",[l,e?new J.default(this.logger,new L.default(this.logger,"FinalizeConnection",[new Q.default(t),new G.default(t)]),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs):new G.default(t)]))])}connectWithTasks(e){return this.receiveIndexTask=new W.default(this.meetingSessionContext),this.monitorTask=new V.default(this.meetingSessionContext,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData),this.receiveIndexTask.pauseIngestion(),this.monitorTask.pauseResubscribeCheck(),new z.default(this.logger,this.wrapTaskName("AudioVideoStart"),[this.monitorTask,new F.default(this.meetingSessionContext),new J.default(this.logger,new z.default(this.logger,"Media",[new z.default(this.logger,"Signaling",[new B.default(this.meetingSessionContext),new O.default(this.meetingSessionContext),new H.default(this.meetingSessionContext),new R.default(this.meetingSessionContext),new U.default(this.meetingSessionContext),this.receiveIndexTask]),new z.default(this.logger,"Peer",[new E.default(this.meetingSessionContext),new I.default(this.meetingSessionContext),new A.default(this.meetingSessionContext),new K.default(this.meetingSessionContext),new P.default(this.meetingSessionContext),new q.default(this.meetingSessionContext),e?new J.default(this.logger,new L.default(this.logger,"FinalizeConnection",[new Q.default(this.meetingSessionContext),new G.default(this.meetingSessionContext)]),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs):new G.default(this.meetingSessionContext)])]),this.configuration.connectionTimeoutMs)])}actionConnect(e){return n(this,void 0,void 0,(function*(){this.initSignalingClient(),this.uninstallPreStartObserver(),this.meetingSessionContext.mediaStreamBroker=this._mediaStreamBroker,this.meetingSessionContext.realtimeController=this._realtimeController,this.meetingSessionContext.audioMixController=this._audioMixController,this.meetingSessionContext.audioVideoController=this;const t=!!this.configuration.urls.audioHostURL;if(t?this.enableSimulcast?(this.logger.info("Using transceiver controller with simulcast support"),this.meetingSessionContext.transceiverController=new X.default(this.logger,this.meetingSessionContext.browserBehavior)):(this.logger.info("Using default transceiver controller"),this.meetingSessionContext.transceiverController=new Z.default(this.logger,this.meetingSessionContext.browserBehavior)):(this.logger.info("Using video only transceiver controller"),this.meetingSessionContext.transceiverController=new Y.default(this.logger,this.meetingSessionContext.browserBehavior)),this.meetingSessionContext.volumeIndicatorAdapter=new ue.default(this.logger,this._realtimeController,fe.MIN_VOLUME_DECIBELS,fe.MAX_VOLUME_DECIBELS,this.configuration.credentials.attendeeId),this.meetingSessionContext.videoTileController=this._videoTileController,this.meetingSessionContext.videoDownlinkBandwidthPolicy=this.configuration.videoDownlinkBandwidthPolicy,this.meetingSessionContext.videoUplinkBandwidthPolicy=this.configuration.videoUplinkBandwidthPolicy,this.meetingSessionContext.enableSimulcast=this.enableSimulcast,this.enableSimulcast){let e=this.meetingSessionContext.videoUplinkBandwidthPolicy;e||(e=new ce.default(this.configuration.credentials.attendeeId,this.meetingSessionContext.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy=e),e.addObserver(this),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new ne.default(this.meetingSessionContext.logger)),this.meetingSessionContext.videoStreamIndex=new re.default(this.logger)}else this.meetingSessionContext.enableSimulcast=!1,this.meetingSessionContext.videoStreamIndex=new oe.default(this.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy||(this.meetingSessionContext.videoUplinkBandwidthPolicy=new le.default(this.configuration.credentials.attendeeId,!this.meetingSessionContext.browserBehavior.disableResolutionScaleDown(),this.meetingSessionContext.logger,this.meetingSessionContext.browserBehavior)),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new ie.default(this.configuration.credentials.attendeeId)),this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController&&this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController&&this.meetingSessionContext.browserBehavior.requiresUnifiedPlan()&&(this.useUpd
1ateTransceiverControllerForUplink=!0,this.meetingSessionContext.videoUplinkBandwidthPolicy.setTransceiverController(this.meetingSessionContext.transceiverController)),this.meetingSessionContext.audioProfile=this._audioProfile;this.meetingSessionContext.videoUplinkBandwidthPolicy&&this.maxUplinkBandwidthKbps&&this.meetingSessionContext.videoUplinkBandwidthPolicy.setIdealMaxBandwidthKbps(this.maxUplinkBandwidthKbps),this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController&&this.meetingSessionContext.videoDownlinkBandwidthPolicy.bindToTileController(this._videoTileController),this.meetingSessionContext.lastKnownVideoAvailability=new f.default,this.meetingSessionContext.videoCaptureAndEncodeParameter=new te.default(0,0,0,0,!1),this.meetingSessionContext.videosToReceive=new se.default,this.meetingSessionContext.videosPaused=new se.default,this.meetingSessionContext.statsCollector=new _.default(this,this.logger,this.meetingSessionContext.browserBehavior),this.meetingSessionContext.connectionMonitor=new c.default(this,this._realtimeController,this._videoTileController,this.connectionHealthData,new g.default(this.meetingSessionContext.signalingClient,fe.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.startAudioVideoT
1imestamp=Date.now(),this.forEachObserver((e=>{ee.Maybe.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);const i=t&&this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs>0;let s;this.logger.info("Needs to wait for attendee presence? "+i),s=this.usePromises?this.connectWithPromises(i):this.connectWithTasks(i);try{yield s.run(),this.connectionHealthData.setConnectionStartTime(),this.sessionStateController.perform(S.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(o){this.signalingTask=void 0;const e=new u.default(this.getMeetingStatusCode(o)||h.default.TaskFailed);if(this.logger.info(`Start failed: ${e} due to error ${o}.`),this.sessionStateController.state()===b.default.NotConnected)return void this.logger.info("Start failed and not connected. Not cleaning up.");this.sessionStateController.perform(S.default.Fail,(()=>n(this,void 0,void 0,(function*(){yield this.actionDisconnect(e,!0,o),this.handleMeetingSessionStatus(e,o)||this.notifyStop(e,o)}))))}}))}createOrReuseSignalingTask(){return this.signalingTask||(this.initSignalingClient(),this.signalingTask=new J.default(this.logger,new B.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs).once()),this.signalingTask}actionFinishConnecting(){this.signalingTask=void 0,this.meetingSessionContext.videoDuplexMode=k.SdkStreamServiceType.RX,this.meetingSessionContext.enableSimulcast||(this.useUpdateTransceiverControllerForUplink?this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController():this.enforceBandwidthLimitationForSender(this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0])),this.forEachObserver((e=>{ee.Maybe.of(e.audioVideoDidStart).map((t=>t.bind(e)()))})),this._reconnectController.reset(),this.receiveIndexTask.resumeIngestion(),this.monitorTask.resumeResubscribeCheck()}stopReturningPromise(){var e;return this.sessionStateController.state()===b.default.NotConnected?(null===(e=this.meetingSessionContext.signalingClient)||void 0===e||e.closeConnection(),new j.default(this.meetingSessionContext).run()):new Promise(((e,t)=>{this.sessionStateController.perform(S.default.Disconnect,(()=>{this._reconnectController.disableReconnect(),this.logger.info("attendee left meeting, session will not be reconnected"),this.actionDisconnect(new u.default(h.default.Left),!1,null).then(e).catch(t)}))}))}stop(){this.stopReturningPromise()}actionDisconnect(e,t,i){return n(this,void 0,void 0,(function*(){try{yield new z.default(this.logger,this.wrapTaskName("AudioVideoStop"),[new J.default(this.logger,new D.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)]).run()}catch(n){this.logger.info("fail to stop")}try{const e=[new J.default(this.logger,new x.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)];t||e.push(new j.default(this.meetingSessionContext)),yield new z.default(this.logger,this.wrapTaskName("AudioVideoClean"),e).run()}catch(s){this.logger.info("fail to clean")}this.sessionStateController.perform(S.default.FinishDisconnecting,(()=>{t||this.notifyStop(e,i)}))}))}update(e={needsRenegotiation:!0}
1){let t=e.needsRenegotiation;if(t||(t=void 0===this.meetingSessionContext.peer),t||(t=!this.updateRemoteVideosFromLastVideosToReceive()),t||(t=!this.updateLocalVideoFromPolicy()),this.meetingSessionContext.lastVideosToReceive=this.meetingSessionContext.videosToReceive,!t)return this.logger.info("Update request does not require resubscribe"),this.actionFinishUpdating(),!0;this.logger.info("Update request requires resubscribe");const i=this.sessionStateController.perform(S.default.Update,(()=>{this.actionUpdateWithRenegotiation(!0)}));return i===w.default.Transitioned||i===w.default.DeferredTransition}updateRemoteVideosFromLastVideosToReceive(){var e,t;const i=this.meetingSessionContext;if((null===(e=i.videosToReceive)||void 0===e?void 0:e.empty())||(null===(t=i.lastVideosToReceive)||void 0===t?void 0:t.empty()))return!1;if(!i.transceiverController||!i.transceiverController.getMidForStreamId||!i.transceiverController.setStreamIdForMid||!i.videosToReceive.forEach||!i.signalingClient.remoteVideoUpdate||!i.videoStreamIndex.overrideStreamIdMappings)return!1;let n=[];const s=new Map;let o=[];if(null===i.lastVideosToReceive)n=i.videosToReceive.array();else{const e=i.videoStreamIndex;i.videosToReceive.forEach((t=>{if(i.lastVideosToReceive.contain(t))return;let o=!1;i.lastVideosToReceive.forEach((i=>{o||e.StreamIdsInSameGroup(i,t)&&(s.set(i,t),o=!0)})),o||n.push(t)})),o=i.lastVideosToReceive.array().filter((e=>{const t=i.videosToReceive.contain(e),n=s.has(e);return!t&&!n}))}this.logger.info(`Request to update remote videos with added: ${n}, updated: ${[...s.entries()]}, removed: ${o}`);const r=[];for(const[a,d]of s.entries()){const e=new T.default;if(e.streamId=d,e.attendeeId=i.videoStreamIndex.attendeeIdForStreamId(d),e.mid=i.transceiverController.getMidForStreamId(a),void 0===e.mid)return this.logger.info(`No MID found for stream ID ${a}, cannot update stream without renegotiation`),!1;if(r.push(e),i.transceiverController.setStreamIdForMid(e.mid,d),i.videoStreamIndex.overrideStreamIdMappings(a,d),i.videoTileController.haveVideoTileForAttendeeId(e.attendeeId)){const t=i.videoTileController.getVideoTileForAttendeeId(e.attendeeId);if(!t.setStreamId)return!1;t.setStreamId(d)}}return 0!==r.length&&i.signalingClient.remoteVideoUpdate(r,[]),0===n.length&&0===o.length}updateLocalVideoFromPolicy(){if(this.meetingSessionContext.enableSimulcast){const e=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseEncodingParameters();if(this.mayNeedRenegotiationForSimulcastLayerChange&&!this.negotiatedBitrateLayersAllocationRtpHeaderExtension())return this.logger.info("Needs regenotiation for local video simulcast layer change"),this.mayNeedRenegotiationForSimulcastLayerChange=!1,!1;this.meetingSessionContext.transceiverController.setEncodingParameters(e)}else this.meetingSessionContext.videoCaptureAndEncodeParameter=this.meetingSessionContext.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters();return this.logger.info("Updated local video from policy without renegotiation"),!0}negotiatedBitrateLayersAllocationRtpHeaderExtension(){if(!this.meetingSessionContext.transceiverController.localVideoTransceiver())return!1;const e=this.meetingSessionContext.transceiverController.localVideoTransceiver().sender.getParameters();return!(!e||!e.headerExtensions)&&e.headerExtensions.some((e=>"http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00"===e.uri))}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.actionUpdateWithRenegotiation(!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.actionUpdateWithRenegotiation(!0),e()})),i=this.sessionStateController.perform(S.default.Update,(()=>{t()}));return i===w.default.Transitioned||i===w.default.DeferredTransition}replaceLocalVideo(){return n(this,void 0,void 0,(function*(){let e=null;try{e=yield this.mediaStreamBroker.acquireVideoInputStream()}catch(n){throw new Error(`could not acquire video stream from mediaStreamBroker due to ${n.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 i=this.meetingSessionContext.videoTileController.getLocalVideoTile();if(i){const t=i.state(),n=e.getVideoTracks()[0].getSettings();i.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(s){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 i=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(i):yield Z.default.replaceAudioTrackForSender(this.meetingSessionContext.localAudioSender,i),this._realtimeController.realtimeSetLocalAudioInput(t),this.meetingSessionContext.activeAudioInput=t,e(),n?Promise.resolve():Promise.reject()}))}actionUpdateWithRenegotiation(e){return n(this,void 0,void 0,(function*(){this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();try{yield new z.default(this.logger,this.wrapTaskName("AudioVideoUpdate"),[new $.default(this.meetingSessionContext),new J.default(this.logger,new z.default(this.logger,"UpdateSession",[new I.default(this.meetingSessionContext),new A.default(this.meetingSessionContext),new K.default(this.meetingSessionContext),new P.default(this.meetingSessionContext),new q.default(this.meetingSessionContext),new G.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),e&&this.sessionStateController.perform(S.default.FinishUpdating,(()=>{this.actionFinishUpdating()}))}catch(t){this.sessionStateController.perform(S.default.FinishUpdating,(()=>{const e=new u.default(this.getMeetingStatusCode(t)||h.default.TaskFailed);e.statusCode()!==h.default.IncompatibleSDP&&this.logger.info("failed to update audio-video session"),this.handleMeetingSessionStatus(e,t)}))}}))}notifyStop(e,t){var i;if(this.forEachObserver((t=>{ee.Maybe.of(t.audioVideoDidStop).map((i=>i.bind(t)(e)))})),this.promotedToPrimaryMeeting&&t&&this.forEachObserver((e=>{this.promotedToPrimaryMeeting=!1,ee.Maybe.of(e.audioVideoWasDemotedFromPrimaryMeeting).map((t=>t.bind(e)(new u.default(h.default.SignalingInternalServerError))))})),this.eventController){const{signalingOpenDurationMs:n,poorConnectionCount:s,startTimeMs:o,iceGatheringDurationMs:r,attendeePresenceDurationMs:a,meetingStartDurationMs:d}
1=this.meetingSessionContext,c={maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,meetingDurationMs:null===o?0:Math.round(Date.now()-o),meetingStatus:h.default[e.statusCode()],signalingOpenDurationMs:n,iceGatheringDurationMs:r,attendeePresenceDurationMs:a,poorConnectionCount:s,meetingStartDurationMs:d,retryCount:this.totalRetryCount},l=t&&t.message||(null===(i=e.toString)||void 0===i?void 0:i.call(e))||"";0===c.meetingDurationMs?(c.meetingErrorMessage=l,delete c.meetingDurationMs,delete c.attendeePresenceDurationMs,delete c.meetingStartDurationMs,this.eventController.publishEvent("meetingStartFailed",c)):e.isFailure()||e.isAudioConnectionFailure()?(c.meetingErrorMessage=l,this.eventController.publishEvent("meetingFailed",c)):this.eventController.publishEvent("meetingEnded",c)}}actionFinishUpdating(){if(!this.meetingSessionContext.enableSimulcast)if(this.useUpdateTransceiverControllerForUplink)this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();else{const e=this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0];this.enforceBandwidthLimitationForSender(e)}this.monitorTask.resumeResubscribeCheck(),this.receiveIndexTask.resumeIngestion(),this.logger.info("updated audio-video session")}reconnect(e,t){const i=this._reconnectController.retryWithBackoff((()=>n(this,void 0,void 0,(function*(){this.sessionStateController.state()===b.default.NotConnected?this.sessionStateController.perform(S.default.Connect,(()=>{this.actionConnect(!0)})):this.sessionStateController.perform(S.default.Reconnect,(()=>{this.actionReconnect(e)})),this.totalRetryCount+=1}))),(()=>{this.logger.info("canceled retry")}));return i||this.sessionStateController.perform(S.default.Fail,(()=>{this.actionDisconnect(e,!1,t)})),i}actionReconnect(e){return n(this,void 0,void 0,(function*(){this._reconnectController.hasStartedConnectionAttempt()||(this._reconnectController.startedConnectionAttempt(!1),this.forEachObserver((e=>{ee.Maybe.of(e.audioVideoDidStartConnecting).map((t=>t.bind(e)(!0)))}))),this.meetingSessionContext.volumeIndicatorAdapter.onReconnect(),this.connectionHealthData.reset();try{yield new z.default(this.logger,this.wrapTaskName("AudioVideoReconnect"),[new J.default(this.logger,new z.default(this.logger,"Media",[new M.default(this.meetingSessionContext),new z.default(this.logger,"Signaling",[new B.default(this.meetingSessionContext),new R.default(this.meetingSessionContext),new U.default(this.meetingSessionContext)]),new E.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs),new $.default(this.meetingSessionContext),new J.default(this.logger,new z.default(this.logger,"UpdateSession",[new I.default(this.meetingSessionContext),new A.default(this.meetingSessionContext),new K.default(this.meetingSessionContext),new P.default(this.meetingSessionContext),new q.default(this.meetingSessionContext),new G.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),this.sessionStateController.perform(S.default.FinishConnecting,(()=>{if(this.eventController){const{signalingOpenDurationMs:t,poorConnectionCount:i,startTimeMs:n,iceGatheringDurationMs:s,attendeePresenceDurationMs:o,meetingStartDurationMs:r}=this.meetingSessionContext,a={maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,meetingDurationMs:Math.round(Date.now()-n),meetingStatus:h.default[e.statusCode()],signalingOpenDurationMs:t,iceGatheringDurationMs:s,attendeePresenceDurationMs:o,poorConnectionCount:i,meetingStartDurationMs:r,retryCount:this.totalRetryCount};this.eventController.publishEvent("meetingReconnected",a)}this.actionFinishConnecting()}))}catch(t){this.sessionStateController.perform(S.default.FinishConnecting,(()=>{this.logger.info("failed to reconnect audio-video session");const e=new u.default(this.getMeetingStatusCode(t)||h.default.TaskFailed);this.handleMeetingSessionStatus(e,t)}))}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.parseInt(t[1],10):null}enforceBandwidthLimitationForSender(e){return n(this,void 0,void 0,(function*(){this.meetingSessionContext.browserBehavior.requiresUnifiedPlan()?yield this.meetingSessionContext.transceiverController.setVideoSendingBitrateKbps(e):yield Z.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;
1if(e.statusCode()===h.default.VideoCallSwitchToViewOnly)return this._videoTileController.removeLocalVideoTile(),this.forEachObserver((e=>{ee.Maybe.of(e.videoSendDidBecomeUnavailable).map((t=>t.bind(e)()))})),!1;if(e.statusCode()===h.default.AudioVideoWasRemovedFromPrimaryMeeting)return this.forEachObserver((t=>{ee.Maybe.of(t.audioVideoWasDemotedFromPrimaryMeeting).map((i=>i.bind(t)(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 i=this.reconnect(e,t);return i?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}`:""}`),i}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)),this.maxUplinkBandwidthKbps=e}handleHasBandwidthPriority(e){return n(this,void 0,void 0,(function*(){if(this.meetingSessionContext&&this.meetingSessionContext.videoUplinkBandwidthPolicy&&!this.meetingSessionContext.enableSimulcast){if(this.useUpdateTransceiverControllerForUplink)return this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(e),void(yield this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController());const t=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();this.meetingSessionContext.videoUplinkBandwidthPolicy.setHasBandwidthPriority(e);const i=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();t!==i&&(this.logger.info(`video send bandwidth priority ${e} max has changed from ${t} kbps to ${i} kbps`),yield this.enforceBandwidthLimitationForSender(i))}}))}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.mayNeedRenegotiationForSimulcastLayerChange=!0,this.forEachObserver((t=>{ee.Maybe.of(t.encodingSimulcastLayersDidChange).map((i=>i.bind(t)(e)))}))}promoteToPrimaryMeeting(e){return this.actionPromoteToPrimaryMeeting(e)}actionPromoteToPrimaryMeeting(e){return n(this,void 0,void 0,(function*(){let t=new u.default(h.default.SignalingRequestFailed);return yield new z.default(this.logger,this.wrapTaskName("PromoteToPrimaryMeeting"),[new J.default(this.logger,new N.default(this.meetingSessionContext,e,(e=>{t=e})),this.configuration.connectionTimeoutMs)]).run(),this.promotedToPrimaryMeeting=t.statusCode()===h.default.OK,t}))}demoteFromPrimaryMeeting(){this.meetingSessionContext.signalingClient.demoteFromPrimaryMeeting(),this.forEachObserver((e=>{ee.Maybe.of(e.audioVideoWasDemotedFromPrimaryMeeting).map((t=>t.bind(e)(new u.default(h.default.OK))))}))}}t.default=fe,fe.MIN_VOLUME_DECIBELS=-42,fe.MAX_VOLUME_DECIBELS=-14,fe.PING_PONG_INTERVAL_MS=1e4},69836:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(38434),s=i(30209),o=i(14015),r=i(10589),a=i(68015),d=i(13789),c=i(25687),l=i(76057),u=i(29141),h=i(67631),f=i(9059);class g extends f.default{constructor(e){const t=new r.default;t.meetingId="",t.externalMeetingId="",t.credentials=new a.default,t.credentials.attendeeId="",t.credentials.joinToken="",t.urls=new l.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 s.default,new h.default(new s.default),new o.default,new u.default(0,new n.default(0,0,0)))}setAudioProfile(e){}start(){}stop(){}promoteToPrimaryMeeting(e){return Promise.resolve(new d.default(c.default.OK))}demoteFromPrimaryMeeting(){}}t.default=g},18538:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Prom
1ise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(27170);t.default=class{constructor(e,t,i,n,s,o){this.audioVideoController=e,this.videoTileController=t,this.realtimeController=i,this.audioMixController=n,this.deviceController=s,this.contentShareController=o}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(e){this.audioVideoController.start(e),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")}getCurrentMeetingAudioStream(){return this.trace("getCurrentConferenceStream"),this.audioMixController.getCurrentMeetingAudioStream()}addAudioMixObserver(e){this.trace("addAudioMixObserver"),this.audioMixController.addAudioMixObserver(e)}removeAudioMixObserver(e){this.trace("removeAudioMixObserver"),this.audioMixController.removeAudioMixObserver(e)}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")}
1realtimeUnsubscribeToSetCanUnmuteLocalAudio(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,i){this.realtimeController.realtimeSendDataMessage(e,t,i),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,i,n){this.audioVideoController.activeSpeakerDetector.subscribe(e,t,i,n),this.trace("subscribeToActiveSpeakerDetector")}unsubscribeFromActiveSpeakerDetector(e){this.audioVideoController.activeSpeakerDetector.unsubscribe(e),this.trace("unsubscribeFromActiveSpeakerDetector")}listAudioInputDevices(e=!1){return n(this,void 0,void 0,(function*(){const t=yield this.deviceController.listAudioInputDevices(e);return this.trace("listAudioInputDevices",e,t),t}))}listVideoInputDevices(e=!1){return n(this,void 0,void 0,(function*(){const t=yield this.deviceController.listVideoInputDevices(e);return this.trace("listVideoInputDevices",e,t),t}))}listAudioOutputDevices(e=!1){return n(this,void 0,void 0,(function*(){const t=yield this.deviceController.listAudioOutputDevices(e);return this.trace("listAudioOutputDevices",e,t),t}))}chooseAudioInputDevice(e){return this.trace("chooseAudioInputDevice",e),this.deviceController.chooseAudioInputDevice(e)}chooseVideoInputDevice(e){return s.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,i,n){this.deviceController.chooseVideoInputQuality(e,t,i,n),this.trace("chooseVideoInputQuality",{width:e,height:t,frameRate:i,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 i=this.contentShareController.startContentShareFromScreenCapture(e,t);return this.trace("startContentShareFromScreenCapture"),i}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")}
1removeContentShareObserver(e){this.contentShareController.removeContentShareObserver(e),this.trace("removeContentShareObserver")}trace(e,t,i){let n=`API/DefaultAudioVideoFacade/${this.audioVideoController.configuration.meetingId}/${this.audioVideoController.configuration.credentials.attendeeId}/${e}`;"undefined"!==typeof t&&(n+=` ${JSON.stringify(t)}`),"undefined"!==typeof i&&(n+=` -> ${JSON.stringify(i)}`),this.audioVideoController.logger.info(n)}getRemoteVideoSources(){const e=this.audioVideoController.getRemoteVideoSources();return this.trace("getRemoteVideoSources",null,e),e}get transcriptionController(){return this.realtimeController.transcriptionController}promoteToPrimaryMeeting(e){this.audioVideoController.removeObserver(this),this.audioVideoController.addObserver(this);const t=this.audioVideoController.promoteToPrimaryMeeting(e);return this.trace("promoteToPrimaryMeeting",null,t),t}demoteFromPrimaryMeeting(){this.trace("demoteFromPrimaryMeeting"),this.audioVideoController.demoteFromPrimaryMeeting()}audioVideoWasDemotedFromPrimaryMeeting(e){this.contentShareController.stopContentShare(),this.audioVideoController.removeObserver(this)}}},30179:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(68074),o=i(99734);class r extends s.default{constructor(e,t){super(e,t),this.blurCanvas=document.createElement("canvas"),this.blurCanvasCtx=this.blurCanvas.getContext("2d"),this.blurCanvas.width=this.spec.model.input.width,this.blurCanvas.height=this.spec.model.input.height,this.logger.info("Backgroun
1dBlur processor using builtin blur")}drawImageWithMask(e,t){const i=this.blurredImage,{canvasCtx:n,targetCanvas:s}=this,{width:o,height:r}=s;if(!t||!i)return void n.clearRect(0,0,o,r);this.scaledCanvas.getContext("2d").putImageData(t,0,0),this.blurCanvasCtx.putImageData(this.blurredImage,0,0),n.save(),n.clearRect(0,0,o,r),n.drawImage(this.scaledCanvas,0,0,o,r),n.globalCompositeOperation="source-in",n.drawImage(e,0,0,o,r),n.globalCompositeOperation="destination-over",n.drawImage(this.blurCanvas,0,0,o,r),n.restore()}setBlurStrength(e){if(super.setBlurStrength(e),this.worker){this.modelInitialized=!1,this.worker.postMessage({msg:"destroy"});const e=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:e.path,inputHeight:e.input.height,inputWidth:e.input.width,inputChannels:4,modelRangeMin:e.input.range[0],modelRangeMax:e.input.range[1],blurPixels:this.blurAmount}})}}setBlurPixels(){this.blurAmount=o.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:540}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}handleInitialize(e){if(this.logger.info(`received initialize message: ${this.stringify(e)}`),!e.payload)return this.logger.error("failed to initialize module"),void this.initWorkerPromise.reject(new Error("failed to initialize the module"));const t=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:t.path,inputHeight:t.input.height,inputWidth:t.input.width,inputChannels:4,modelRangeMin:t.input.range[0],modelRangeMax:t.input.range[1],blurPixels:this.blurAmount}}),this.initWorkerPromise.resolve({})}handlePredict(e){this.blurredImage=e.payload.blurOutput,super.handlePredict(e)}destroy(){const e=Object.create(null,{destroy:{get:()=>super.destroy}});var t;return n(this,void 0,void 0,(function*(){e.destroy.call(this),null===(t=this.blurCanvas)||void 0===t||t.remove(),this.blurCanvas=void 0}))}}t.default=r},68074:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(41851),o=i(99734),r=i(99852);class a extends s.default{constructor(e,t){super("background blur",e,t,new r.default),this.blurAmount=0,this.setBlurStrength(t.blurStrength),this.logger.info("Backgroun
1dBlur processor successfully created"),this.logger.info(`BackgroundBlur spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundBlur options: ${this.stringify(t)}`)}validateOptions(e){if(super.validateOptions(e),!e.blurStrength)throw new Error("processor has null options - blurStrength")}initOnFirstExecution(){this.setBlurPixels()}drawImageWithMask(e,t){t||(t=new ImageData(this.spec.model.input.width,this.spec.model.input.height));this.scaledCanvas.getContext("2d").putImageData(t,0,0);const{canvasCtx:i,targetCanvas:n}=this,{width:s,height:o}=n;i.save(),i.clearRect(0,0,s,o),i.drawImage(this.scaledCanvas,0,0,s,o),i.globalCompositeOperation="source-in",i.drawImage(e,0,0,s,o),i.globalCompositeOperation="destination-over",i.filter=`blur(${this.blurAmount}px)`,i.drawImage(e,0,0,n.width,n.height),i.restore()}setBlurStrength(e){this._blurStrength=e,this.logger.info(`blur strength set to ${this._blurStrength}`),this.setBlurPixels()}setBlurPixels(){this.blurAmount=o.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:this.sourceHeight}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}addObserver(e){this.delegate.addObserver(e)}removeObserver(e){this.delegate.removeObserver(e)}static isSupported(){return n(this,void 0,void 0,(function*(){const e=document.createElement("canvas"),t=void 0!==e.getContext("2d").filter;return e.remove(),t}))}}t.default=a},99734:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlurStrengthMapper=void 0;class i{static getBlurAmount(e,t){if(e<=0)throw new Error(`invalid value for blur strength: ${e}`);return Math.round(e*t.height/this.BLUR_STRENGTH_DIVISOR)}}t.BlurStrengthMapper=i,i.BLUR_STRENGTH_DIVISOR=540,t.default={LOW:7,MEDIUM:15,HIGH:30}},51260:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(84243),o=i(88030),r=i(70813),a=i(52801),d=i(30179),c=i(68074),l=i(99734);class u extends a.default{setBlurStrength(){}loadAssets(){return n(this,void 0,void 0,(function*(){}))}addObserver(){}removeObserver(){}}class h extends s.default{static create(e,t){return n(this,void 0,void 0,(function*(){e=h.resolveSpec(e),t=h.resolveOptions(t);const{logger:i}=t,n=yield h.isSupported(e,t);if(i.info(`processor is ${n?"":"not"} supported`),!n)return i.warn("Using no-op processor because background blur is not supported"),new u;let s;return(yield c.default.isSupported())?(i.info("Using browser-provided background blur"),s=new c.default(e,t)):(i.info("Using built-in background blur"),s=new d.default(e,t)),yield s.loadAssets(),s}))}static resolveOptions(e={}){return e.blurStrength||(e.blurStrength=l.default.MEDIUM),e.logger||(e.logger=new o.default("BackgroundBlurProcessor",r.default.INFO)),e=super.resolveOptions(e)}static isSupported(e,t){return e=h.resolveSpec(e),t=h.resolveOptions(t),super.isSupported(e,t)}}t.default=h},99852:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(24627);class s extends n.default{}t.default=s},80022:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(){this.path=null,this.input=null,this.output=null}static builder(){return new i}withDefaultModel(){return this.withSelfieSegmentationDefaults()}withSelfieSegmentationDefaults(){return this.path="https://static.sdkassets.chime.aws/bgblur/models/selfie_segmentation_landscape.tflite",this.input={height:144,width:256,range:[0,1],channels:3},this.output={height:144,width:256,range:[0,1],channels:1},this}withPath(e){return this.path=e,this}withInput(e){return this.input=e,this}withOutput(e){return this.output=e,this}validate(){if(!this.path)throw new Error("model spec path is not set");if(!this.input)throw new Error("model spec input is not set");if(!this.output)throw new Error("model spec output is not set")}build(){return this.validate(),{path:this.path,input:this.input,output:this.output}}}t.default=i},53368:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i,n){this.delegate=e,this.reportingPeriodMillis=t,this.filterCPUUtilization=i,this.logger=n,this._processingFilter=!0,this.lastReportedEventTimestamp=0,this.lastFilterCompleteTimestamp=0,this.filterTotalMillis=0,this.filterCount=0,this.framerate=0,this.filterDurationNotifyMillis=0,this.setSegmentationDuration()}reportEvent(e){const t=e-this.lastReportedEventTimestamp;if(t>=this.reportingPeriodMillis){const i=this.filterCount,n=this.filterTotalMillis;if(this.filterCount=0,this.filterTotalMillis=0,this.lastReportedEventTimestamp=e,0===this.framerate||0===i)return;const s=Math.round(n/i),o=Math.round(this.framerate*(t/1e3))-i,r=Math.round(100*n/t);s>=this.filterDurationNotifyMillis&&this.delegate.filterFrameDurationHigh({framesDropped:o,avgFilterDurationMillis:s,framerate:this.framerate,periodMillis:t}),r>=this.filterCPUUtilization&&this.delegate.filterCPUUtilizationHigh({cpuUtilization:r,filterMillis:n,periodMillis:t})}}setSegmentationDuration(){this.filterDurationNotifyMillis=Math.round(1e3/this.framerate*.8)}frameReceived(e){e!==this.framerate&&(this.framerate=e,this.logger.info(`frame counter setting frame rate to ${this.framerate}`),this.setSegmentationDuration());const t=Date.now();this.reportEvent(t)}filterSubmitted(){this._processingFilter=!0,this.lastFilterCompleteTimestamp=Date.now()}filterComplete(){this.filterTotalMillis+=Date.now()-this.lastFilterCompleteTimestamp,this._processingFilter=!1,this.filterCount++}get processingSegment(){return this._processingFilter}}},41851:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundFilterMonitor=void 0;const s=i(85021),o=i(19807),r=i(53368);class a{constructor(){this.value=void 0,this.resolve=null}whenNext(){return this.promise||(this.promise=new Promise((e=>this.resolve=e))),this.promise}next(e){this.value=e,this.resolve(e),delete this.promise}}class d{constructor(e,t,i,n){this.targetCanvas=document.createElement("canvas"),this.canvasCtx=this.targetCanvas.getContext("2d"),this.canvasVideoFrameBuffer=new o.default(this.targetCanvas),this.mask$=new a,this.sourceWidth=0,this.sourceHeight=0,this.frameNumber=0,this.videoFramesPerFilterUpdate=1,this.initWorkerPromise=d.createWorkerPromise(),this.loadModelPromise=d.createWorkerPromise(),this.modelInitialized=!1,this.destroyed=!1,this.filterType=e,this.validateSpec(t),this.validateOptions(i),this.spec=t,this.logger=i.logger,this.delegate=n,this.initCPUMonitor(i)}static createWorkerPromise(){const e={resolve:null,reject:null,promise:null};return e.promise=new Promise(((t,i)=>{e.resolve=t,e.reject=i})),e}validateSpec(e){if(!e)throw new Error("processor has null spec");if(!e.model)throw new Error("processor spec has null model");if(!e.paths)throw new Error("processor spec has null paths")}validateOptions(e){if(!e)throw new Error("processor has null options");if(!e.logger)throw new Error("processor has null options - logger");if(!e.reportingPeriodMillis)throw new Error("processor has null options - reportingPeriodMillis");if(!e.filterCPUUtilization)throw new Error("processor has null options - filterCPUUtilization")}initCPUMonitor(e){this.videoFramesPerFilterUpdate=1,this.frameCounter=new r.default(this.delegate,e.reportingPeriodMillis,e.filterCPUUtilization,this.logger),this.cpuMonitor=new c(5e3,{reduceCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.min(this.videoFramesPerFilterUpdate+1,10))},increaseCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.max(this.videoFramesPerFilterUpdate-1,1))}}),this.delegate.addObserver(this.cpuMonitor)}stringify(e){return JSON.stringify(e,null,2)}handleInitialize(e){if(this.logger.info(`received initialize message: ${this.stringify(e)}`),!e.payload)return this.logger.error("failed to initialize module"),void this.initWorkerPromise.reject(new Error("failed to initialize the module"));const t=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:t.path,inputHeight:t.input.height,inputWidth:t.input.width,inputChannels:4,modelRangeMin:t.input.range[0],modelRangeMax:t.input.range[1],blurPixels:0}}),this.initWorkerPromise.resolve({})}handleLoadModel(e){if(this.logger.info(`received load model message: ${this.stringify(e)}`),2!==e.payload)return this.logger.error("failed to load model! status: "+e.payload),void this.loadModelPromise.reject(new Error("failed to load model! status: "+e.payload));this.modelInitialized=!0,this.loadModelPromise.resolve({})}handlePredict(e){this.mask$.next(e.payload.output)}handleWorkerEvent(e){const t=e.data;switch(t.msg){case"initialize":this.handleInitialize(t);break;case"loadModel":this.handleLoadModel(t);break;case"predict":this.handlePredict(t);break;default:this.logger.info(`unexpected event msg: ${this.stringify(t)}`)}}loadAssets(){return n(this,void 0,void 0,(function*(){this.logger.info("start initializing the processor");try{this.worker=yield s.loadWorker(this.spec.paths.worker,"Backgroun
1dFilterWorker",{},null),this.worker.addEventListener("message",(e=>this.handleWorkerEvent(e))),this.worker.postMessage({msg:"initialize",payload:{wasmPath:this.spec.paths.wasm,simdPath:this.spec.paths.simd}}),yield this.initWorkerPromise.promise,this.logger.info(`successfully initialized the ${this.filterType} worker`),yield this.loadModelPromise.promise,this.logger.info(`successfully loaded ${this.filterType} worker segmentation model`)}catch(e){throw new Error(`could not initialize the ${this.filterType} video frame processor due to '${e.message}'`)}this.logger.info(`successfully initialized the ${this.filterType} processor`)}))}process(e){return n(this,void 0,void 0,(function*(){if(this.destroyed)return e;this.frameCounter.frameReceived(e[0].framerate),this.cpuMonitor.frameReceived();const t=e[0].asCanvasElement();if(!t)return e;if(!this.modelInitialized)return e[0]=this.canvasVideoFrameBuffer,e;const i=t.width,n=t.height;if(0===i||0===n)return e;0===this.sourceWidth&&(this.sourceWidth=i,this.sourceHeight=n,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight,this.logger.info(`${this.filterType} source width: ${this.sourceWidth}`),this.logger.info(`${this.filterType} source height: ${this.sourceHeight}`),this.initOnFirstExecution()),this.sourceWidth===i&&this.sourceHeight===n||(this.sourceWidth=i,this.sourceHeight=n,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight);try{this.frameCounter.filterSubmitted();let e=this.mask$.value;const i=this.spec.model.input.width/t.width,n=this.spec.model.input.height/t.height;void 0===this.scaledCanvas&&(this.scaledCanvas=document.createElement("canvas"),this.scaledCanvas.width=this.spec.model.input.width,this.scaledCanvas.height=this.spec.model.input.height);const s=this.scaledCanvas.getContext("2d");s.save(),s.scale(i,n),s.drawImage(t,0,0),s.restore();const o=s.getImageData(0,0,this.scaledCanvas.width,this.scaledCanvas.height);if(this.frameNumber%this.videoFramesPerFilterUpdate===0){const t=this.mask$.whenNext();this.worker.postMessage({msg:"predict",payload:o},[o.data.buffer]),e=yield t}this.destroyed||this.drawImageWithMask(t,e)}catch(s){return this.logger.error(`could not process ${this.filterType} frame buffer due to ${s}`),e}finally{this.frameCounter.filterComplete(),this.frameNumber++}return e[0]=this.canvasVideoFrameBuffer,e}))}updateVideoFramesPerFilterUpdate(e){e!==this.videoFramesPerFilterUpdate&&(this.videoFramesPerFilterUpdate=e,this.logger.info(`Adjusting filter rate to compensate for CPU utilization. Filter rate is ${this.videoFramesPerFilterUpdate} video frames per filter.`))}destroy(){var e,t,i,s;return n(this,void 0,void 0,(function*(){this.destroyed=!0,this.delegate.removeObserver(this.cpuMonitor),this.canvasVideoFrameBuffer.destroy(),null===(e=this.worker)||void 0===e||e.postMessage({msg:"destroy"}),null===(t=this.worker)||void 0===t||t.postMessage({msg:"stop"}),null===(i=this.targetCanvas)||void 0===i||i.remove(),this.targetCanvas=void 0,null===(s=this.scaledCanvas)||void 0===s||s.remove(),this.scaledCanvas=void 0,this.logger.info(`${this.filterType} frame process destroyed`)}))}}t.default=d;class c{constructor(e,t){this.monitoringPeriodMillis=e,this.observer=t,this.lastCPUChangeTimestamp=0}filterCPUUtilizationHigh(){const e=Date.now();e-this.lastCPUChangeTimestamp>=this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=e,this.observer.reduceCPUUtilization())}frameReceived(){const e=Date.now();e-this.lastCPUChangeTimestamp>=2*this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=e,this.observer.increaseCPUUtilization())}}t.BackgroundFilterMonitor=c},84243:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(85021),o=i(39424),r=i(80022),a=i(90543),d=i(74046),c=()=>r.default.builder().withSelfieSegmentationDefaults().build(),l="https://static.sdkassets.chime.aws",u={worker:`${l}/bgblur/workers/worker.js`,wasm:`${l}/bgblur/wasm/_cwt-wasm.wasm`,simd:`${l}/bgblur/wasm/_cwt-wasm-simd.wasm`};t.default=class{static defaultAssetSpec(){const e=d.default.sdkVersionSemVer;return{assetGroup:`sdk-${e.major}.${e.minor}`}}static createUrlWithParams(e,t){const i=new URL(e),n=Object.keys(t);for(const s of n)void 0!==t[s]&&i.searchParams.set(s,t[s]);return i.toString()}static resolveSpec(e){const{paths:t=u,model:i=c(),assetGroup:n=this.defaultAssetSpec().assetGroup,revisionID:s=this.defaultAssetSpec().revisionID}=e||{},o={assetGroup:n,revisionID:s,sdk:encodeURIComponent(d.default.sdkVersion),ua:encodeURIComponent(d.default.sdkUserAgentLowResolution)};return t.worker=this.createUrlWithParams(t.worker,o),t.wasm=this.createUrlWithParams(t.wasm,o),t.simd=this.createUrlWithParams(t.simd,o),i.path=this.createUrlWithParams(i.path,o),{paths:t,model:i,assetGroup:n,revisionID:s}}static resolveOptions(e){e.reportingPeriodMillis||(e.reportingPeriodMillis=1e3);return e.filterCPUUtilization?(e.filterCPUUtilization<0||e.filterCPUUtilization>100)&&(e.logger.warn("filterCPUUtilization must be set to a range between 0 and 100 percent. Falling back to default of 30 percent"),e.filterCPUUtilization=30):e.f
1ilterCPUUtilization=30,e}static isSupported(e,t){const{logger:i}=t;if("undefined"===typeof globalThis)return i.info("Browser does not have globalThis."),Promise.resolve(!1);return(new a.default).supportsBackgroundFilter()?o.supportsWASM(globalThis,i)?this.supportsBackgroundFilter(globalThis,e,i):(i.info("Browser does not support WASM."),Promise.resolve(!1)):(i.info("Browser is not supported."),Promise.resolve(!1))}static supportsBackgroundFilter(e=globalThis,t,i){return n(this,void 0,void 0,(function*(){if(!o.supportsWorker(e,i))return i.info("Browser does not support web workers."),!1;const n=t.paths.worker;try{const e=yield s.loadWorker(n,"BackgroundFilterWorker",{},null);try{e.terminate()}catch(r){i.info(`Failed to terminate worker. ${r.message}`)}return!0}catch(r){return i.info(`Failed to fetch and instantiate test worker ${r.message}`),!1}}))}}},24627:function(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)}filterFrameDurationHigh(e){var t;for(const i of this.observers)null===(t=i.filterFrameDurationHigh)||void 0===t||t.call(i,e)}filterCPUUtilizationHigh(e){var t;for(const i of this.observers)null===(t=i.filterCPUUtilizationHigh)||void 0===t||t.call(i,e)}}},59392:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(41851),o=i(1447);class r extends s.default{constructor(e,t){super("background replacement",e,t,new o.default),this.replacementBlob=t.imageBlob,this.logger.info("Backgroun
1dReplacement processor successfully created"),this.logger.info(`BackgroundReplacement spec: ${this.stringify(this.spec)}`),this.logger.info(`BackgroundReplacement options: ${this.stringify(t)}`)}setImageBlob(e){return n(this,void 0,void 0,(function*(){this.replacementBlob=e,this.replacementImage=yield r.loadImage(this.createReplacementObjectUrl())}))}initOnFirstExecution(){}drawImageWithMask(e,t){t||(t=new ImageData(this.spec.model.input.width,this.spec.model.input.height));this.scaledCanvas.getContext("2d").putImageData(t,0,0);const{canvasCtx:i,targetCanvas:n}=this,{width:s,height:o}=n;i.save(),i.clearRect(0,0,s,o),i.drawImage(this.scaledCanvas,0,0,s,o),i.globalCompositeOperation="source-in",i.drawImage(e,0,0,s,o),i.globalCompositeOperation="destination-over",i.drawImage(this.replacementImage,0,0,n.width,n.height),i.restore()}static loadImageExecutor(e,t,i){const n=new Image;n.crossOrigin="Anonymous",n.addEventListener("load",(()=>{e(n)}),!1),n.addEventListener("error",(e=>{t(new Error(`Could not load replacement image ${n.src}: ${e.message}`))}),!1),n.src=i}static loadImage(e){return n(this,void 0,void 0,(function*(){return new Promise(((t,i)=>this.loadImageExecutor(t,i,e)))}))}revokeReplacementObjectUrl(){this.replacementObjectUrl&&URL.revokeObjectURL(this.replacementObjectUrl)}createReplacementObjectUrl(){return this.revokeReplacementObjectUrl(),this.replacementObjectUrl=URL.createObjectURL(this.replacementBlob),this.replacementObjectUrl}loadAssets(){const e=Object.create(null,{loadAssets:{get:()=>super.loadAssets}});return n(this,void 0,void 0,(function*(){this.replacementImage=yield r.loadImage(this.createReplacementObjectUrl()),e.loadAssets.call(this)}))}addObserver(e){this.delegate.addObserver(e)}removeObserver(e){this.delegate.removeObserver(e)}destroy(){const e=Object.create(null,{destroy:{get:()=>super.destroy}});return n(this,void 0,void 0,(function*(){e.destroy.call(this),this.revokeReplacementObjectUrl()}))}}t.default=r},19854:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(84243),o=i(88030),r=i(70813),a=i(52801),d=i(59392);class c extends a.default{loadAssets(){return n(this,void 0,void 0,(function*(){}))}addObserver(){}removeObserver(){}setImageBlob(){return n(this,void 0,void 0,(function*(){}))}}class l extends s.default{static create(e,t){return n(this,void 0,void 0,(function*(){e=this.resolveSpec(e),t=this.resolveOptions(t),yield this.resolveOptionsAsync(t);const{logger:i}=t;if(!(yield l.isSupported(e,t)))return i.warn("Using no-op processor because background replacement is not supported"),new c;i.info("Using background replacement filter");const n=new d.default(e,t);return yield n.loadAssets(),n}))}static resolveOptions(e={}){return e.logger||(e.logger=new o.default("BackgroundReplacementProcessor",r.default.INFO)),super.resolveOptions(e)}static resolveOptionsAsync(e){return n(this,void 0,void 0,(function*(){if(!e.imageBlob){const t=document.createElement("canvas");t.width=100,t.height=100;const i=t.getContext("2d");i.fillStyle="blue",i.fillRect(0,0,100,100);const n=yield new Promise((e=>{t.toBlob(e)}));e.imageBlob=n}}))}static isSupported(e,t){const i=Object.create(null,{isSupported:{get:()=>super.isSupported}});return n(this,void 0,void 0,(function*(){e=this.resolveSpec(e),t=this.resolveOptions(t),yield this.resolveOptionsAsync(t);const n=t.imageBlob,s=URL.createObjectURL(n);try{yield d.default.loadImage(s)}catch(o){return t.logger.info(`Failed to fetch load replacement image ${o.message}`),!1}finally{URL.revokeObjectURL(s)}return i.isSupported.call(this,e,t)}))}}t.default=l},1447:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(24627);class s extends n.default{}t.default=s},38434:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i){this.fixedWaitMs=e,this.shortBackoffMs=t,this.longBackoffMs=i,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}}},55640:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(38434),s=i(67300);t.default=class{constructor(e,t,i){this.fixedWaitMs=e,this.shortBackoffMs=t,this.longBackoffMs=i}create(){return new n.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs)}createWithLimit(e){return new s.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs,e)}}},67300:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(38434);class s extends n.default{constructor(e,t,i,n){super(e,t,i),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=s},90543:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(43631);t.default=class{constructor({recreateAudioContextIfNeeded:e=!1}={}){this.browser=s.detect(),this.browserSupport={chrome:78,"edge-chromium":79,electron:7,firefox:75,ios:12,safari:12,opera:66,samsung:12,crios:86,fxios:23,"ios-webview":605,"chromium-webview":92},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","ios-webview":"WKWebView iOS","chromium-webview":"Chrome WebView"},this.chromeLike=["chrome","edge-chromium","chromium-webview","opera","samsung"],this.webkitBrowsers=["crios","fxios","safari","ios","ios-webview"],this.recreateAudioContextIfNeeded=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()}supportsBackgroundFilter(){return("safari"!==this.name()||15!==this.majorVersion())&&!!this.supportsCanvasCapturedStreamPlayback()}requiresUnifiedPlan(){return this.isFirefox()||this.hasChromiumWebRTC()||this.hasWebKitWebRTC()&&this.isUnifiedPlanSupported()}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(){return this.hasChromiumWebRTC()||this.hasWebKitWebRTC()&&this.isUnifiedPlanSupported()}requiresSortCodecPreferencesForSdpAnswer(){return this.isFirefox()&&this.majorVersion()<=68}requiresSimulcastMunging(){return this.isSafari()}requiresBundlePolicy(){return"max-bundle"}requiresPromiseBasedWebRTCGetStats(){return!this.hasChromiumWebRTC()}requiresVideoElementWorkaround(){return this.isSafari()&&12===this.majorVersion()}requiresNoExactMediaStreamConstraints(){return this.isSamsungInternet()||this.isIOSSafari()&&("12.0.0"===this.version()||"12.1.0"===this.version())}requiresGroupIdMediaStreamConstraints(){return this.isSamsungInternet()}requiresContextRecreationForAudioWorklet(){return!!this.recreateAudioContextIfNeeded&&("chrome"in i.g&&("Mac OS"===this.browser.os&&!(!this.isChrome()&&!this.isEdge(
1))))}getDisplayMediaAudioCaptureSupport(){return this.isChrome()||this.isEdge()}supportsSenderSideBandwidthEstimation(){return this.hasChromiumWebRTC()||this.isSafari()}doesNotSupportMediaDeviceLabels(){return"chromium-webview"===this.browser.name}screenShareUnsupported(){return console.warn("This function is no longer supported."),!0}isSupported(){return!(!this.browserSupport[this.browser.name]||this.majorVersion()<this.browserSupport[this.browser.name])&&("firefox"!==this.browser.name||!this.isAndroid())}isSimulcastSupported(){return this.hasChromiumWebRTC()}supportDownlinkBandwidthEstimation(){return!this.isFirefox()}supportString(){if(this.isAndroid())return`${this.browserName.chrome} ${this.browserSupport.chrome}+, ${this.browserName.samsung} ${this.browserSupport.samsung}+`;const e=[];for(const t in this.browserSupport)e.push(`${this.browserName[t]} ${this.browserSupport[t]}+`);return e.join(", ")}supportedVideoCodecs(){return n(this,void 0,void 0,(function*(){const e=new RTCPeerConnection;return e.addTransceiver("video",{direction:"inactive",streams:[]}),(yield e.createOffer({offerToReceiveVideo:!0})).sdp.split("\r\n").filter((e=>e.includes("a=rtpmap:"))).map((e=>e.replace(/.* /,"").replace(/\/.*/,""))).filter(((e,t,i)=>i.indexOf(e)===t)).filter((e=>"rtx"!==e&&"red"!==e&&"ulpfec"!==e))}))}supportsSetSinkId(){return"setSinkId"in HTMLAudioElement.prototype}disableResolutionScaleDown(){return this.isAndroid()}disable480pResolutionScaleDown(){return/( Chrome\/98\.)/i.test(navigator.userAgent)&&this.browser.os.startsWith("Windows")}requiresDisablingH264Encoding(){return(this.isIOSSafari()||this.isIOSChrome()||this.isIOSFirefox())&&("15.1.0"===this.version()||/( OS 15_1)/i.test(navigator.userAgent))}isIOSSafari(){return"ios"===this.browser.name||"ios-webview"===this.browser.name||"safari"===this.browser.name&&/( Mac )/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1}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")}}},56196:function(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.ClientMetricReportDirection=void 0,function(e){e[e.UPSTREAM=0]="UPSTREAM",e[e.DOWNSTREAM=1]="DOWNSTREAM"}(i=t.ClientMetricReportDirection||(t.ClientMetricReportDirection={})),t.default=i},99496:function(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.ClientMetricReportMediaType=void 0,function(e){e[e.AUDIO=0]="AUDIO",e[e.VIDEO=1]="VIDEO"}(i=t.ClientMetricReportMediaType||(t.ClientMetricReportMediaType={})),t.default=i},92770:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},86893:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(20289),s=i(56196),o=i(99496),r=i(2306);class a{constructor(e,t,i){this.logger=e,this.videoStreamIndex=t,this.selfAttendeeId=i,this.globalMetricReport=new r.default,this.streamMetricReports={},this.currentTimestampMs=0,this.previousTimestampMs=0,this.currentSsrcs={},this.identityValue=(e,t)=>{const i=t?this.streamMetricReports[t]:this.globalMetricReport;return Number(i.currentMetrics[e])},this.decoderLossPercent=(e,t)=>{const i=t?this.streamMetricReports[t]:this.globalMetricReport,n=i.currentMetrics.googDecodingNormal-(i.previousMetrics.googDecodingNormal||0),s=i.currentMetrics.googDecodingCTN-(i.previousMetrics.googDecodingCTN||0);if(s<=0)return 0;const o=s-n;return o<=0?0:100*o/s},this.packetLossPercent=(e,t)=>{const i=t?this.streamMetricReports[t]:this.globalMetricReport,n=i.currentMetrics[e]-(i.previousMetrics[e]||0),s=i.currentMetrics.packetsLost-(i.previousMetrics.packetsLost||0),o=n+s;return o<=0||s<=0?0:100*s/o},this.countPerSecond=(e,t)=>{const i=t?this.streamMetricReports[t]:this.globalMetricReport;let n=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(n<=0)return 0;this.previousTimestampMs<=0&&(n=1);
1const s=i.currentMetrics[e]-(i.previousMetrics[e]||0);return s<=0?0:Math.trunc(s/n)},this.bitsPerSecond=(e,t)=>{const i=t?this.streamMetricReports[t]:this.globalMetricReport;let n=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(n<=0)return 0;this.previousTimestampMs<=0&&(n=1);const s=8*(i.currentMetrics[e]-(i.previousMetrics[e]||0));return s<=0?0:Math.trunc(s/n)},this.secondsToMilliseconds=(e,t)=>{const i=t?this.streamMetricReports[t]:this.globalMetricReport;return Number(1e3*i.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},googFrameHeightSent:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_ENCODE_HEIGHT},googFrameWidthSent:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_ENCODE_WIDTH},frameHeight:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_ENCODE_HEIGHT},frameWidth:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_ENCODE_WIDTH}},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},googFrameHeightReceived:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_DECODE_HEIGHT},googFrameWidthReceived:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_DECODE_WIDTH},frameHeight:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_DECODE_HEIGHT},frameWidth:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_DECODE_WIDTH}},this.observableVideoMetricSpec={videoUpstreamBitrate:{source:"bytesSent",media:o.default.VIDEO,dir:s.default.UPSTREAM},videoUpstreamPacketsSent:{source:"packetsSent",media:o.default.VIDEO,dir:s.default.UPSTREAM},videoUpstreamPacketLossPercent:{source:"packetsLost",media:o.default.VIDEO,dir:s.default.UPSTREAM},videoUpstreamFramesEncodedPerSecond:{source:"framesEncoded",media:o.default.VIDEO,dir:s.default.UPSTREAM},videoUpstreamGoogFrameHeight:{source:"googFrameHeightSent",media:o.default.VIDEO,dir:s.default.UPSTREAM},videoUpstreamGoogFrameWidth:{source:"googFrameWidthSent",media:o.default.VIDEO,dir:s.default.UPSTREAM},videoUpstreamFrameHeight:{source:"frameHeight",media:o.default.VIDEO,dir:s.default.UPSTREAM},videoUpstreamFrameWidth:{source:"frameWidth",media:o.default.VIDEO,dir:s.default.UPSTREAM},videoDownstreamBitrate:{source:"bytesReceived",media:o.default.VIDEO,dir:s.default.DOWNSTREAM},videoDownstreamPacketLossPercent:{source:"packetsLost",media:o.default.VIDEO,dir:s.default.DOWNSTREAM},videoDownstreamPacketsReceived:{source:"packetsReceived",media:o.default.VIDEO,dir:s.default.DOWNSTREAM},videoDownstreamFramesDecodedPerSecond:{source:"framesDecoded",media:o.default.VIDEO,dir:s.default.DOWNSTREAM},videoDownstreamGoogFrameHeight:{source:"googFrameHeightReceived",media:o.default.VIDEO,dir:s.default.DOWNSTREAM},videoDownstreamGoogFrameWidth:{source:"googFrameWidthReceived",media:o.default.VIDEO,dir:s.default.DOWNSTREAM},videoDownstreamFrameHeight:{source:"frameHeight",media:o.default.VIDEO,dir:s.default.DOWNSTREAM},videoDownstreamFrameWidth:{source:"frameWidth",media:o.default.VIDEO,dir:s.default.DOWNSTREAM}},this.observableMetricSpec={audioPacketsReceived:{source:"packetsReceived",media:o.default.AUDIO,dir:s.default.DOWNSTREAM},audioPacketsReceivedFractionLoss:{source:"packetsLost",media:o.default.AUDIO,dir:s.default.DOWNSTREAM},audioDecoderLoss:{source:"googDecodingNormal",media:o.default.AUDIO,dir:s.default.DOWNSTREAM},audioPacketsSent:{source:"packetsSent",media:o.default.AUDIO,dir:s.default.UPSTREAM},audioPacketLossPercent:{source:"packetsLost",media:o.default.AUDIO,dir:s.default.UPSTREAM},videoUpstreamBitrate:{source:"bytesSent",media:o.default.VIDEO,dir:s.default.UPSTREAM},videoPacketSentPerSecond:{source:"packetsSent",media:o.default.VIDEO,dir:s.default.UPSTREAM},availableSendBandwidth:{source:"googAvailableSendBandwidth"},availableReceiveBandwidth:{source:"googAvailableReceiveBandwidth"},audioSpeakerDelayMs:{source:"googCurrentDelayMs",media:o.default.AUDIO,dir:s.default.DOWNSTREAM},availableIncomingBitrate:{source:"availableIncomingBitrate"},availableOutgoingBitrate:{source:"availableOutgoingBitrate"},nackCountReceivedPerSecond:{source:"nackCount",media:o.default.VIDEO,dir:s.default.UPSTREAM},googNackCountReceivedPerSecond:{source:"googNacksReceived",media:o.default.VIDEO,dir:s.default.UPSTREAM}}}getMetricMap(e,t){switch(e){case o.default.AUDIO:switch(t){case s.default.UPSTREAM:return this.audioUpstreamMetricMap;case s.default.DOWNSTREAM:return this.audioDownstreamMetricMap}case o.default.VIDEO:switch(t){case s.default.UPSTREAM:return this.videoUpstreamMetricMap;case s.default.DOWNSTREAM:return this.videoDownstreamMetricMap}default:return this.globalMetricMap}}getObservableMetricValue(e){const t=this.observableMetricSpec[e],i=this.getMetricMap(t.media,t.dir)[t.source],n=i.transform,s=i.source;if(!t.hasOwnProperty("media"))return n(s||t.source);for(const o in this.streamMetricReports){const e=this.streamMetricReports[o];if(t.source in e.currentMetrics&&e.direction===t.dir&&e.mediaType===t.media)return n(s||t.source,Number(o))}return 0}getObservableVideoMetricValue(e,t){const i=this.observableVideoMetricSpec[e],n=this.getMetricMap(i.media,i.dir)[i.source],s=n.transform,o=n.source,r=this.streamMetricReports[t];return r&&i.source in r.currentMetrics?s(o||i.source,t):s(o||i.source)}getObservableMetrics(){const e={};for(const t in this.observableMetricSpec)e[t]=this.getObservableMetricValue(t);return e}getObservableVideoMetrics(){const e={};if(!this.videoStreamIndex||!this.selfAttendeeId)return this.logger.error("Need to define VideoStreamIndex and selfAttendeeId if using getObservableVideoMetrics API"),e;for(const t in this.streamMetricReports)if(this.streamMetricReports[t].mediaType===o.default.VIDEO){const i={};for(const e in this.observableVideoMetricSpec)if(this.observableVideoMetricSpec[e].dir===this.streamMetricReports[t].direction){const n=this.getObservableVideoMetricValue(e,Number(t));isNaN(n)||(i[e]=n)}const n=this.streamMetricReports[t].streamId,s=n?this.videoStreamIndex.attendeeIdForStreamId(n):this.selfAttendeeId;e[s]=e[s]?e[s]:{},e[s][t]=i}return e}clone(){const e=new a(this.logger,this.videoStreamIndex,this.selfAttendeeId);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=a},2306:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){this.previousMetrics={},this.currentMetrics={}}}},62811:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){this.previousMetrics={},this.currentMetrics={}}}},13940:function(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}}},66688:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{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()<e+t}setConnectionStartTime(){this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}reset(){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()}isConnectionStartRecent(e){return i.isTimestampRecent(this.connectionStartTimestampMs,e)}isLastPacketLossRecent(e){return i.isTimestampRecent(this.lastPacketLossInboundTimestampMs,e)}isGoodSignalRecent(e){return i.isTimestampRecent(this.lastGoodSignalTimestampMs,e)}isWeakSignalRecent(e){return i.isTimestampRecent(this.lastWeakSignalTimestampMs,e)}isNoSignalRecent(e){return i.isTimestampRecent(this.lastNoSignalTimestampMs,e)}clone(){const e=new i;return e.connectionStartTimestampMs=this.connectionStartTimestampMs,e.consecutiveStatsWithNoPackets=this.consecutiveStatsWithNoPackets,e.lastPacketLossInboundTimestampMs=this.lastPacketLossInboundTimestampMs,e.lastGoodSignalTimestampMs=this.lastGoodSignalTimestampMs,e.lastWeakSignalTimestampMs=this.lastWeakSignalTimestampMs,e.lastNoSignalTimestampMs=this.lastNoSignalTimestampMs,e.consecutiveMissedPongs=this.consecutiveMissedPongs,e.packetsReceivedInLastMinute=this.packetsReceivedInLastMinute.slice(0),e.fractionPacketsLostInboundInLastMinute=this.fractionPacketsLostInboundInLastMinute.slice(0),e.audioSpeakerDelayMs=this.audioSpeakerDelayMs,e}setConsecutiveMissedPongs(e){this.consecutiveMissedPongs=e}setConsecutiveStatsWithNoPackets(e){this.consecutiveStatsWithNoPackets=e}setLastPacketLossInboundTimestampMs(e){this.lastPacketLossInboundTimestampMs=e}setLastNoSignalTimestampMs(e){this.lastNoSignalTimestampMs=e}setLastWeakSignalTimestampMs(e){this.lastWeakSignalTimestampMs=e}setLastGoodSignalTimestampMs(e){this.lastGoodSignalTimestampMs=e}setAudioSpeakerDelayMs(e){this.audioSpeakerDelayMs=e}}t.default=i},23731:function(e,t){"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}}},39708:function(e,t,i){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});const n=i(13940);class s extends n.default{constructor(e,t,i){super(t,i),this.logger=e,this.audioDelayPointsOverMaximum=0,s.CONNECTION_UNHEALTHY_THRESHOLD=t.connectionUnhealthyThreshold,s.CONNECTION_WAIT_TIME_MS=t.connectionWaitTimeMs,s.MISSED_PONGS_THRESHOLD=t.missedPongsUpperThreshold,s.MAXIMUM_AUDIO_DELAY_MS=t.maximumAudioDelayMs,s.MAXIMUM_AUDIO_DELAY_DATA_POINTS=t.maximumAudioDelayDataPoints}health(){if(this.currentData.isConnectionStartRecent(s.CONNECTION_WAIT_TIME_MS))return 1;const e=this.currentData.consecutiveStatsWithNoPackets>=s.CONNECTION_UNHEALTHY_THRESHOLD,t=this.currentData.consecutiveMissedPongs>=s.MISSED_PONGS_THRESHOLD;this.currentData.audioSpeakerDelayMs>s.MAXIMUM_AUDIO_DELAY_MS?this.audioDelayPointsOverMaximum+=1:this.audioDelayPointsOverMaximum=0;const i=this.audioDelayPointsOverMaximum>s.MAXIMUM_AUDIO_DELAY_DATA_POINTS;i&&(this.audioDelayPointsOverMaximum=0);return e||t||i?(this.logger.warn(`reconnection recommended due to: no packets received: ${e}, missed pongs: ${t}, bad audio delay: ${i}`),0):1}}t.default=s},51922:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(13940);class s 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.pastSamplesToConsider)return 0;const e=this.pastSamplesToConsider,t=e*this.packetsExpected;let i=0;for(let n=0;n<e;n++)i+=this.currentData.packetsReceivedInLastMinute[n];return Math.min(Math.max(1-i/t,0),1)}health(){if(Date.now()-this.lastWarnTimestampMs<this.coolDownTimeMs)return this.currentHealth;return this.calculateFractionalLoss()>=this.fractionalLoss?0!==this.currentHealth&&(this.lastWarnTimestampMs=Date.now(),this.warnCount++,this.warnCount>this.maximumTimesToWarn)?1:0:1}}t.default=s},68581:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(28660);t.default=class{constructor(e,t,i,n,s,o){this.audioVideoController=e,this.realtimeController=t,this.videoTileController=i,this.connectionHealthData=n,this.pingPong=s,this.statsCollector=o,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,i){this.connectionHealthData.setConsecutiveMissedPongs(0),this.statsCollector.logLatency("ping_pong",t),this.statsCollector.logLatency("ping_pong_clock_skew",i),this.updateConnectionHealth()}didMissPongs(){this.connectionHealthData.setConsecutiveMissedPongs(this.connectionHealthData.consecutiveMissedPongs+1),this.updateConnectionHealth()}metricsDidReceive(e){let t=0,i=0;const n=e.getObservableMetrics(),s=n.audioPacketsReceived,o=n.audioPacketsReceivedFractionLoss;let r=0;const a=n.videoPacketSentPerSecond,d=n.videoUpstreamBitrate,c=n.availableSendBandwidth||n.availableOutgoingBitrate,l=n.availableReceiveBandwidth||n.availableIncomingBitrate,u=n.audioSpeakerDelayMs,h=n.nackCountReceivedPerSecond||n.googNackCountReceivedPerSecond;"number"!==typeof c||isNaN(c)||this.updateAvailableSendBandwidth(c/1e3,h),"number"!==typeof l||isNaN(l)||this.updateAvailableReceiveBandwidth(l/1e3),"number"!==typeof d||isNaN(d)||(r=d/1e3),"number"!==typeof u||isNaN(u)||this.connectionHealthData.setAudioSpeakerDelayMs(u),this.monitorVideoUplinkHealth(r,a),"number"===typeof s&&"number"===typeof o&&(t=s,i=o,t<0||i<0||(this.addToMinuteWindow(this.connectionHealthData.packetsReceivedInLastMinute,t),this.addToMinuteWindow(this.connectionHealthData.fractionPacketsLostInboundInLastMinute,i),t>0?(this.hasSeenValidPacketMetricsBefore=!0,this.connectionHealthData.setConsecutiveStatsWithNoPackets(0)):this.hasSeenValidPacketMetricsBefore&&this.connectionHealthData.setConsecutiveStatsWithNoPackets(this.connectionHealthData.consecutiveStatsWithNoPackets+1),(0===t||i>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 i=this.lastAvailableSendBandwidthKbps;this.lastAvailableSendBandwidthKbps=e,this.audioVideoController.forEachObserver((s=>{n.Maybe.of(s.videoSendBandwidthDidChange).map((n=>n.bind(s)(e,i,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((i=>
1{n.Maybe.of(i.videoReceiveBandwidthDidChange).map((n=>n.bind(i)(e,t)))}))}}updateConnectionHealth(){this.audioVideoController.forEachObserver((e=>{n.Maybe.of(e.connectionHealthDidChange).map((t=>t.bind(e)(this.connectionHealthData.clone())))}))}monitorVideoUplinkHealth(e,t){this.videoTileController.hasStartedLocalVideoTile()&&this.audioVideoController.forEachObserver((i=>{n.Maybe.of(i.videoSendHealthDidChange).map((n=>n.bind(i)(e,t)))}))}}},18890:function(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Modality="#content"}(i||(i={})),t.default=i},78370:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(90543),o=i(44142);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?(this.logger.info("No audio stream available. Synthesizing an audio stream."),o.default.synthesizeAudioDevice(0)):this._mediaStream}))}acquireVideoInputStream(){return n(this,void 0,void 0,(function*(){return this._mediaStream}))}releaseMediaStream(e){this.logger.info("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 s.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 i=0;i<this.mediaStream.getTracks().length;i++)this.mediaStream.getTracks()[i].enabled!==e&&(this.mediaStream.getTracks()[i].enabled=e,t=!0);return t}cleanup(){if(this.mediaStream)for(let e=0;e<this.mediaStream.getTracks().length;e++){this.mediaStream.getTracks()[e].stop()}this.mediaStream=null}}t.default=r,r.defaultFrameRate=15},38023:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(10589),o=i(68015),r=i(60214),a=i(37797),d=i(28660),c=i(18890);t.default=class{constructor(e,t,i){this.mediaStreamBroker=e,this.contentAudioVideo=t,this.attendeeAudioVideo=i,this.observerQueue=new Set,this.destroyed=!1,this.contentAudioVideo.addObserver(this),this.setupContentShareEvents()}static createContentShareMeetingSessionConfigure(e){const t=new s.default;return t.meetingId=e.meetingId,t.externalMeetingId=e.externalMeetingId,t.urls=e.urls,t.credentials=new o.default,t.credentials.attendeeId=e.credentials.attendeeId+c.default.Modality,t.credentials.externalUserId=e.credentials.externalUserId,t.credentials.joinToken=e.credentials.joinToken+c.default.Modality,t}setContentAudioProfile(e){this.contentAudioVideo.setAudioProfile(e)}startContentShare(e){return n(this,void 0,void 0,(function*(){if(e){this.mediaStreamBroker.mediaStream=e;for(let e=0;e<this.mediaStreamBroker.mediaStream.getTracks().length;e++)this.mediaStreamBroker.mediaStream.getTracks()[e].addEventListener("ended",(()=>{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 i=yield this.mediaStreamBroker.acquireScreenCaptureDisplayInputStream(e,t);return yield this.startContentShare(i),i}))}pauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!1)&&this.forEachContentShareObserver((e=>{d.Maybe.of(e.contentShareDidPause).map((t=>t.call(e)))}))}unpauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!0)&&this.forEachContentShareObserver((e=>{d.Maybe.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)}
1removeContentShareObserver(e){this.observerQueue.delete(e)}forEachContentShareObserver(e){for(const t of this.observerQueue)a.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=>{d.Maybe.of(e.contentShareDidStop).map((t=>t.call(e)))}))}setupContentShareEvents(){this.attendeeAudioVideo.realtimeController.realtimeSubscribeToAttendeeIdPresence(((e,t,i,n)=>{const s=new r.default(e).hasModality(r.default.MODALITY_CONTENT),o=new r.default(e).base()===this.attendeeAudioVideo.configuration.credentials.attendeeId;if(!s||!o||!t||this.contentShareTile)return;const a=this.mediaStreamBroker.mediaStream;if(null===a||void 0===a?void 0:a.getVideoTracks().length){this.contentShareTile=this.attendeeAudioVideo.videoTileController.addVideoTile();const e=a.getVideoTracks()[0];let t,i;if(e.getSettings){const n=e.getSettings();t=n.width,i=n.height}else{const n=e.getCapabilities();t=n.width,i=n.height}this.contentShareTile.bindVideoStream(this.contentAudioVideo.configuration.credentials.attendeeId,!1,a,t,i,null,this.contentAudioVideo.configuration.credentials.externalUserId)}this.forEachContentShareObserver((e=>{d.Maybe.of(e.contentShareDidStart).map((t=>t.call(e)))}))}))}}},47237:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{static register(){"document"in i.g&&document.addEventListener&&n.shouldRegisterCSPMonitor&&(n.added||(document.addEventListener("securitypolicyviolation",n.listener),n.added=!0))}static unregister(){"document"in i.g&&document.removeEventListener&&(document.removeEventListener("securitypolicyviolation",n.listener),n.loggers=new Set,n.added=!1)}static disable(){n.shouldRegisterCSPMonitor=!1,n.unregister()}static addLogger(e){e&&n.loggers.add(e)}static removeLogger(e){e&&n.loggers.delete(e)}}t.default=n,n.loggers=new Set,n.shouldRegisterCSPMonitor=!0,n.added=!1,n.listener=e=>{const t=`Security Policy Violation\nBlocked URI: ${e.blockedURI}\nViolated Directive: ${e.violatedDirective}\nOriginal Policy: ${e.originalPolicy}\nDocument URI: ${e.documentURI}\nSource File: ${e.sourceFile}\nLine No.: ${e.lineNumber}\n`;for(const i of n.loggers)i.error(t);0===n.loggers.size&&console.error(t)}},11018:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i,n,s,o){this.timestampMs=e,this.topic=t,this.data=i,this.senderAttendeeId=n,this.senderExternalUserId=s,this.throttled=!!o}text(){return(new TextDecoder).decode(this.data)}json(){return JSON.parse((new TextDecoder).decode(this.data))}}},70146:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDestroyable=void 0,t.isDestroyable=function(e){return e&&"destroy"in e}},91746:function(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}},44142:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(90543),o=i(66354),r=i(37797),a=i(23922),d=i(28660),c=i(3327),l=i(91746),u=i(78128),h=i(95348),f=i(31238),g=i(63110),p=i(44842),m=i(6991),v=i(86950),S=i(64500),b=i(27170);class w{constructor(e,t,i=new s.default){this.logger=e,this.browserBehavior=i,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.mediaStreamMuteObserver=(e,t)=>{for(const i of this.deviceChangeObservers)r.default.nextTick((()=>{this.deviceChangeObservers.has(i)&&i.audioInputMuteStateChanged&&i.audioInputMuteStateChanged(e,t)}))},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 S.default(w.defaultVideoWidth,w.defaultVideoHeight,w.defaultVideoFrameRate,w.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}`);
1try{this.mediaDeviceWrapper=(new o.default).create();const e=navigator.mediaDevices.getSupportedConstraints();this.logger.info(`Supported Constraints in this browser ${JSON.stringify(e)}`)}catch(d){e.error(d.message)}}isWatchingForDeviceChanges(){return!!this.onDeviceChangeCallback}ensureWatchingDeviceChanges(){var e;this.isWatchingForDeviceChanges()||(this.logger.info("Starting devicechange listener."),this.onDeviceChangeCallback=()=>{this.logger.info("Device change event callback is triggered"),this.handleDeviceChange()},null===(e=this.mediaDeviceWrapper)||void 0===e||e.addEventListener("devicechange",this.onDeviceChangeCallback))}stopWatchingDeviceChanges(){var e;this.isWatchingForDeviceChanges()&&(this.logger.info("Stopping devicechange listener."),null===(e=this.mediaDeviceWrapper)||void 0===e||e.removeEventListener("devicechange",this.onDeviceChangeCallback),this.onDeviceChangeCallback=void 0)}shouldObserveDeviceChanges(){if(this.deviceChangeObservers.size)return!0;return 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(e=!1){return n(this,void 0,void 0,(function*(){const t=yield this.listDevicesOfKind("audioinput",e);return this.trace("listAudioInputDevices",e,t),t}))}listVideoInputDevices(e=!1){return n(this,void 0,void 0,(function*(){const t=yield this.listDevicesOfKind("videoinput",e);return this.trace("listVideoInputDevices",e,t),t}))}listAudioOutputDevices(e=!1){return n(this,void 0,void 0,(function*(){const t=yield this.listDevicesOfKind("audiooutput",e);return this.trace("listAudioOutputDevices",e,t),t}))}pushAudioMeetingStateForPermissions(e){var t,i;null===(i=null===(t=this.boundAudioVideoController)||void 0===t?void 0:t.eventController)||void 0===i||i.publishEvent(null===e?"audioInputUnselected":"audioInputSelected")}pushVideoMeetingStateForPermissions(e){var t,i;null===(i=null===(t=this.boundAudioVideoController)||void 0===t?void 0:t.eventController)||void 0===i||i.publishEvent(null===e?"videoInputUnselected":"videoInputSelected")}chooseAudioInputDevice(e){var t,i;return n(this,void 0,void 0,(function*(){if(void 0===e)return void this.logger.error("Audio input device cannot be undefined");let n=this.useWebAudio;this.useWebAudio||this.logger.debug("Not using Web Audio. No need to recreate audio context."),"suspended"===(null===(t=w.audioContext)||void 0===t?void 0:t.state)&&(n=!1),n&&!this.browserBehavior.requiresContextRecreationForAudioWorklet()&&(this.logger.debug("Browser does not require audio context recreation hack."),n=!1),n&&!this.transform&&l.isAudioTransformDevice(e)&&(this.logger.debug("Neither device is a transform. No need to recreate audio context."),n=!1),n&&(this.logger.info("Recreating audio context when selecting new 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),w.closeAudioContext()),l.isAudioTransformDevice(e)?(this.logger.info(`Choosing transform input device ${e}`),yield this.chooseAudioTransformInputDevice(e)):(this.logger.info(`Choosing intrinsic audio input device ${e}`),this.removeTransform(),yield this.chooseInputIntrinsicDevice("audio",e,!1),this.trace("chooseAudioInputDevice",e,"success")),n&&(null===(i=this.boundAudioVideoController)||void 0===i?void 0:i.rtcPeerConnection)&&this.boundAudioVideoController.restartLocalAudio((()=>{this.logger.info("Local audio restarted.")})),this.pushAudioMeetingStateForPermissions(e)}))}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 i=w.getAudioContext();if(i instanceof OfflineAudioContext);else switch(i.state){case"running":break;case"closed":throw new Error("Cannot choose a transform device with a closed audio context.");case"suspended":yield i.resume()}let n;try{n=yield e.createAudioNode(i)}catch(o){throw this.logger.error(`Unable to create transform device node: ${o}.`),o}
1const s=yield e.intrinsicDevice();yield this.chooseInputIntrinsicDevice("audio",s,!1),this.logger.debug(`Got inner stream: ${s}.`),this.setTransform(e,n)}))}chooseVideoTransformInputDevice(e){var t,i;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 s=!!n,o=yield e.intrinsicDevice();if(!this.isMediaStreamReusableByDeviceId(null===(t=this.activeDevices.video)||void 0===t?void 0:t.stream,o))return this.logger.info("video transform device needs new intrinsic device"),s&&n.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=e,this.activeDevices.video=null,void(yield this.chooseInputIntrinsicDevice("video",o,!1,!0));this.chosenVideoTransformDevice=e;const r=this.activeDevices.video.stream;if(this.logger.info("video transform device uses previous stream"),!o.id){const e=o;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===(i=this.boundAudioVideoController)||void 0===i?void 0:i.videoTileController.hasStartedLocalVideoTile())&&(this.boundAudioVideoController.replaceLocalVideo?this.restartLocalVideoAfterSelection(!1,!0):yield this.boundAudioVideoController.update({needsRenegotiation:!0}))}))}chooseVideoInputDevice(e){return n(this,void 0,void 0,(function*(){if(void 0!==e){if(b.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 i=null===(t=null===(e=this.transform)||void 0===e?void 0:e.nodes)||void 0===t?void 0:t.end;if(i){const e=i.context.createAnalyser();return e.removeOriginalInputs=()=>{try{i.disconnect(e)}catch(t){}},i.connect(e),e}return this.createAnalyserNodeForRawAudioInput()}createAnalyserNodeForRawAudioInput(){return this.activeDevices.audio?this.createAnalyserNodeForStream(this.activeDevices.audio.stream):null}createAnalyserNodeForStream(e){const t=w.getAudioContext(),i=t.createAnalyser(),n=t.createMediaStreamSource(e);return n.connect(i),this.trace("createAnalyserNodeForAudioInput"),i.removeOriginalInputs=()=>{try{n.disconnect(i)}catch(e){}},i}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);const t=e.srcObject;t&&this.activeDevices.video.stream!==t&&(this.releaseMediaStream(e.srcObject),c.default.disconnectVideoStreamFromVideoElement(e,!1)),this.chosenVideoTransformDevice?c.default.connect
1VideoStreamToVideoElement(this.chosenVideoTransformDevice.outputMediaStream,e,!0):c.default.connectVideoStreamToVideoElement(this.activeDevices.video.stream,e,!0),this.trace("startVideoPreviewForVideoInput",e.id)}stopVideoPreviewForVideoInput(e){const t=e.srcObject,i=this.activeDevices.video;i&&this.releaseActiveDevice(i),t&&(this.releaseMediaStream(t),c.default.disconnectVideoStreamFromVideoElement(e,!1)),this.trace("stopVideoPreviewForVideoInput",e.id)}setDeviceLabelTrigger(e){if(this.deviceInfoCache)for(const t of this.deviceInfoCache)if(!t.label){this.deviceInfoCache=null;break}this.deviceLabelTrigger=e,this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(e){let t=null;return this.useWebAudio?(t=w.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,i,n){const s=this.browserBehavior.requiresResolutionAlignment(e,t);this.videoInputQualitySettings=new S.default(s[0],s[1],i,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.stopTracksAndRemoveCallbacks("audio"),this.logger.info("Removing audio transform, if there is one."),this.removeTransform(),this.audioInputSourceNode&&(this.audioInputSourceNode.disconnect(),this.audioInputSourceNode=void 0),this.audioInputDestinationNode&&(this.audioInputDestinationNode.disconnect(),this.audioInputDestinationNode=void 0)}releaseVideoTransformStream(){this.logger.info("Stopping video track for transform"),this.stopTracksAndRemoveCallbacks("video"),this.logger.info("Disconnecting video transform"),this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null}stopTracksAndRemoveCallbacks(e){const t=this.activeDevices[e];if(!t)return;const i=t.endedCallback,n=t.trackMuteCallback,s=t.trackUnmuteCallback;for(const o of t.stream.getTracks())o.stop(),i&&o.removeEventListener("ended",i),n&&o.removeEventListener("mute",n),s&&o.removeEventListener("unmute",s),delete t.endedCallback,delete t.trackMuteCallback,delete t.trackUnmuteCallback,delete this.activeDevices[e]}releaseOrdinaryStream(e){var t;const i=e.getTracks();if(i.length){for(const e of i)e.stop();for(const i in this.activeDevices){const n=this.activeDevices[i];if((null===n||void 0===n?void 0:n.stream)===e){switch(i){case"audio":for(const t of e.getAudioTracks())t.removeEventListener("mute",n.trackMuteCallback),t.removeEventListener("unmute",n.trackUnmuteCallback),t.removeEventListener("ended",n.endedCallback);delete n.trackMuteCallback,delete n.trackUnmuteCallback,delete n.endedCallback;break;case"video":{if(n.endedCallback){for(const t of e.getTracks())t.removeEventListener("ended",n.endedCallback);delete n.endedCallback}const i=null===(t=this.boundAudioVideoController)||void 0===t?void 0:t.videoTileController;(null===i||void 0===i?void 0:i.hasStartedLocalVideoTile())&&i.stopLocalVideoTile();break}}delete this.activeDevices[i]}}}}releaseMediaStream(e){var t,i;if(e)try{if(e===(null===(t=this.audioInputDestinationNode)||void 0===t?void 0:t.stream))return void this.releaseAudioTransformStream();if(e===(null===(i=this.chosenVideoTransformDevice)||void 0===i?void 0:i.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()&&r.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 i=t;return"string"===typeof i.exact||Array.isArray(i.exact)?i.exact:void 0}static createEmptyAudioDevice(){return w.synthesizeAudioDevice(0)}static createEmptyVideoDevice(){return w.synthesizeVideoDevice("black")}static synthesizeAudioDevice(e){const t=w.getAudioContext(),i=t.createMediaStreamDestination();if(e){const n=t.createGain();n.gain.value=.1,n.connect(i);const s=t.createOscillator();s.frequency.value=e,s.connect(n),s.start()}else{const e=t.createBufferSource();try{e.buffer=t.createBuffer(1,5*t.sampleRate,t.sampleRate)}catch(n){if(!n||"NotSupportedError"!==n.name)throw n;e.buffer=t.createBuffer(1,5*w.defaultSampleRate,w.defaultSampleRate)}e.buffer.getChannelData(0)[0]=3e-4,e.loop=!0,e.connect(i),e.start()}return i.stream}static synthesizeVideoDevice(e){const t=document.createElement("canvas");t.width=480,t.height=t.width/16*9;const i=function(e,t){const i=new a.default(1e3),n=e.getContext("2d"),s=e.captureStream(5)||null;if(!s)return;i.start((()=>
1{"smpte"===t?function(e,t){const i=e.width,n=e.height,s=2*n/3,o=3*n/4,r=n,a=["#c0c0c0","#c0c000","#00c0c0","#00c000","#c000c0","#c00000","#0000c0"],d=["#0000c0","#000000","#c000c0","#000000","#00c0c0","#000000","#c0c0c0"],c=["#00214c","#ffffff","#32006a","#131313","#090909","#131313","#1d1d1d","#131313"],l=[0*i,1*i/4*(5/7),2*i/4*(5/7),3*i/4*(5/7),i*(5/7),i*(5/7+1/21),i*(5/7+2/21),i*(6/7),1*i],u=i/a.length,h=e.getContext("2d");for(let f=0;f<a.length;f++)h.fillStyle=a[f],h.fillRect(t+f*u,0,u,s),h.fillStyle=d[f],h.fillRect(t+f*u,s,u,o-s);for(let f=0;f<c.length;f++)h.fillStyle=c[f],h.fillRect(t+l[f],o,l[f+1]-l[f],r-o)}(e,0):(n.fillStyle=t,n.fillRect(0,0,e.width,e.height))}));const o=()=>{i.stop()};return s.getVideoTracks()[0].addEventListener("ended",o),{listener:o,scheduler:i,stream:s}}(t,e);if(!i)return null;const{stream:n}=i;return n}updateMaxBandwidthKbps(){this.boundAudioVideoController&&this.boundAudioVideoController.setVideoMaxBandwidthKbps(this.videoInputQualitySettings.videoMaxBandwidthKbps)}listDevicesOfKind(e,t){return n(this,void 0,void 0,(function*(){return!t&&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 n of e)if(!n.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(i){this.logger.info("unable to get media device labels")}this.logger.debug(`Update device info cache with devices: ${JSON.stringify(e)}`),this.deviceInfoCache=e}))}listCachedDevicesOfKind(e){const t=[];for(const i of this.deviceInfoCache)i.kind===e&&t.push(i);return t}handleDeviceChange(){return n(this,void 0,void 0,(function*(){if(null===this.deviceInfoCache)return;if(this.alreadyHandlingDeviceChange)return void r.default.nextTick((()=>{this.handleDeviceChange()}));this.alreadyHandlingDeviceChange=!0;const e=this.listCachedDevicesOfKind("audioinput"),t=this.listCachedDevicesOfKind("videoinput"),i=this.listCachedDevicesOfKind("audiooutput");yield this.updateDeviceInfoCacheFromBrowser();const n=this.listCachedDevicesOfKind("audioinput"),s=this.listCachedDevicesOfKind("videoinput"),o=this.listCachedDevicesOfKind("audiooutput");this.forEachObserver((r=>{this.areDeviceListsEqual(e,n)||d.Maybe.of(r.audioInputsChanged).map((e=>e.bind(r)(n))),this.areDeviceListsEqual(t,s)||d.Maybe.of(r.videoInputsChanged).map((e=>e.bind(r)(s))),this.areDeviceListsEqual(i,o)||d.Maybe.of(r.audioOutputsChanged).map((e=>e.bind(r)(o)))})),this.alreadyHandlingDeviceChange=!1}))}handleDeviceStreamEnded(e,t){return n(this,void 0,void 0,(function*(){try{yield this.chooseInputIntrinsicDevice(e,null,!1)}catch(i){this.logger.error("Failed to choose null device after stream ended.")}"audio"===e?this.forEachObserver((e=>{d.Maybe.of(e.audioInputStreamEnded).map((i=>i.bind(e)(t)))})):this.forEachObserver((e=>{d.Maybe.of(e.videoInputStreamEnded).map((i=>i.bind(e)(t)))}))}))}forEachObserver(e){for(const t of this.deviceChangeObservers)r.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}hasSameMediaStreamId(e,t,i){var n,s,o,r;let a;return"audio"===e?(a=null===i||void 0===i?void 0:i.audio.streamId,!!a&&a===(null===(s=null===(n=t.constraints)||void 0===n?void 0:n.audio)||void 0===s?void 0:s.streamId)):(a=null===i||void 0===i?void 0:i.video.streamId,!!a&&a===(null===(r=null===(o=null===t||void 0===t?void 0:t.constraints)||void 0===o?void 0:o.video)||void 0===r?void 0:r.streamId))}hasSameGroupId(e,t,i){if(""===e)return!0;const n=w.getIntrinsicDeviceId(i);return this.logger.debug(`Checking deviceIds ${n} of type ${typeof n} with groupId ${e}
1`),"string"===typeof n&&e===this.getGroupIdFromDeviceId(t,n)}getGroupIdFromDeviceId(e,t){if(null!==this.deviceInfoCache){const i=this.listCachedDevicesOfKind(`${e}input`).find((e=>e.deviceId===t));if(i&&i.groupId)return this.logger.debug(`GroupId of deviceId ${t} found in cache is ${i.groupId}`),i.groupId}else this.logger.error("Device cache is not populated. Please make sure to call list devices first");return this.logger.debug(`GroupId of deviceId ${t} found in cache is empty`),""}getActiveDeviceId(e){if(this.activeDevices[e]&&this.activeDevices[e].constraints){const t=(this.activeDevices[e].constraints.audio||this.activeDevices[e].constraints.video).deviceId;let i;return i="string"===typeof t?t:t.exact,i}return null}restartLocalVideoAfterSelection(e,t){return n(this,void 0,void 0,(function*(){!e&&this.boundAudioVideoController&&this.boundAudioVideoController.videoTileController.hasStartedLocalVideoTile()&&(t?(yield this.boundAudioVideoController.replaceLocalVideo(),this.logger.info("successfully replaced video track")):(this.logger.info("restarting local video to switch to new device"),this.boundAudioVideoController.restartLocalVideo((()=>{}))))}))}handleGetUserMediaError(e,t){if(!e)throw new h.default(e);switch(e.name){case"NotReadableError":case"TrackStartError":throw new g.default(e);case"NotFoundError":case"DevicesNotFoundError":throw new f.default(e);case"NotAllowedError":case"PermissionDeniedError":case"SecurityError":throw t&&t<w.permissionDeniedOriginDetectionThresholdMs?new m.default(e,"Permission denied by browser"):new m.default(e,"Permission denied by user");case"OverconstrainedError":case"ConstraintNotSatisfiedError":throw new p.default(e);case"TypeError":throw new v.default(e);default:throw new h.default(e)}}releaseActiveDevice(e){if(e&&e.stream){if(e.endedCallback){const t=e.stream.getTracks()[0];t&&t.removeEventListener("ended",e.endedCallback)}delete e.endedCallback,this.releaseMediaStream(e.stream),delete e.stream}}matchesDeviceSelection(e,t,i,n){return!!(i&&i.stream.active&&(this.hasSameMediaStreamId(e,i,n)||null!==i.groupId&&this.hasSameGroupId(i.groupId,e,t)))&&(this.logger.debug(`Compare current device constraint ${JSON.stringify(i.constraints)} to proposed constraints ${JSON.stringify(n)}`),i.matchesConstraints(n))}chooseInputIntrinsicDevice(e,t,i,s=!1){var o,r,a,d,c;return n(this,void 0,void 0,(function*(){this.inputDeviceCount+=1;const n=this.inputDeviceCount;if(null===t&&"video"===e){this.lastNoVideoInputDeviceCount=this.inputDeviceCount;const t=this.activeDevices[e];return void(t&&(this.releaseActiveDevice(t),delete this.activeDevices[e],this.watchForDeviceChangesIfNecessary()))}const l=this.calculateMediaStreamConstraints(e,t);if(this.matchesDeviceSelection(e,t,this.activeDevices[e],l))return void this.logger.info(`reusing existing ${e} input device`);this.activeDevices[e]&&this.activeDevices[e].stream&&("audio"===e?this.releaseActiveDevice(this.activeDevices[e]):"video"===e&&(this.stopTracksAndRemoveCallbacks("video"),delete this.activeDevices[e]));const h=Date.now(),f=new u.default;try{this.logger.info(`requesting new ${e} device with constraint ${JSON.stringify(l)}`);const i=this.intrinsicDeviceAsMediaStream(t);if("audio"===e&&null===t)f.stream=w.createEmptyAudioDevice(),f.constraints=null;else if(i)this.logger.info(`using media stream ${i.id} for ${e} device`),f.stream=i,f.constraints=l;else{if(f.stream=yield navigator.mediaDevices.getUserMedia(l),f.constraints=l,"video"===e&&this.lastNoVideoInputDeviceCount>n)return this.logger.warn(`ignored to get video device for constraints ${JSON.stringify(l)} as no device was requested`),void this.releaseMediaStream(f.stream);yield this.handleDeviceChange();const t=f.stream.getTracks()[0];f.endedCallback=()=>{this.activeDevices[e]&&this.activeDevices[e].stream===f.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 f.endedCallback)},t.addEventListener("ended",f.endedCallback,{once:!0})}if(null!==t){const t=null===(o=this.getMediaTrackSettings(f.stream))||void 0===o?void 0:o.deviceId;f.groupId=t?this.getGroupIdFromDeviceId(e,t):""}else f.groupId="";if("audio"===e){const e=f.stream.getAudioTracks()[0];if(e){const t=e.getSettings().deviceId||f.stream;f.trackMuteCallback=()=>{this.mediaStreamMuteObserver(t,!0)},f.trackUnmuteCallback=()=>{this.mediaStreamMuteObserver(t,!1)},e.addEventListener("mute",f.trackMuteCallback,{once:!1}),e.addEventListener("unmute",f.trackUnmuteCallback,{once:!1})}}}catch(g){let t;if(t=(null===g||void 0===g?void 0:g.name)&&g.message?`${g.name}: ${g.message}`:(null===g||void 0===g?void 0:g.name)?g.name:(null===g||void 0===g?void 0:g.message)?g.message:"UnknownError","audio"===e?null===(a=null===(r=this.boundAudioVideoController)||void 0===r?void 0:r.eventController)||void 0===a||a.publishEvent("audioInputFailed",{audioInputErrorMessage:t}):null===(c=null===(d=this.boundAudioVideoController)||void 0===d?void 0:d.eventController)||void 0===c||c.publishEvent("videoInputFailed",{videoInputErrorMessage:t}),this.logger.error(`failed to get ${e} device for constraints ${JSON.stringify(l)}: ${t}`),g&&"constraint"in g&&this.logger.error(`Over-constrained by constraint: ${g.constraint}`),"audio"===e){this.logger.info(`choosing null ${e} device instead`);try{f.stream=w.createEmptyAudioDevice(),f.constraints=null,yield this.handleNewInputDevice(e,f,i)}catch(g){this.logger.error(`failed to choose null ${e} device. ${g.name}: ${g.message}`)}}this.handleGetUserMediaError(g,Date.now()-h)}finally{this.watchForDeviceChangesIfNecessary()}if(this.logger.info(`got ${e} device for constraints ${JSON.stringify(l)}`),yield this.handleNewInputDevice(e,f,i,s),"audio"===e){this.logger.debug("Notifying mute state after selection");for(const e of f.stream.getAudioTracks())e.muted?f.trackMuteCallback():f.trackUnmuteCallback()}}))}handleNewInputDevice(e,t,i,s=!1){return n(this,void 0,void 0,(function*(){if(this.activeDevices[e]=t,this.logger.debug(`Set activeDevice to ${JSON.stringify(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(i,s);else if(this.useWebAudio)this.attachAudioInputStreamToAudioContext(this.activeDevices[e].stream);else if(this.boundAudioVideoController)try{yield this.boundAudioVideoController.restartLocalAudio((()=>{}))}catch(n){this.logger.info(`cannot replace audio track due to: ${n.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 i={};""===t&&(t=null);const n=this.intrinsicDeviceAsMediaStream(t);if(null===t)return null;if("string"===typeof t?this.browserBehavior.requiresNoExactMediaStreamConstraints()&&this.browserBehavior.requiresGroupIdMediaStreamConstraints()?(i.deviceId=t,i.groupId=this.getGroupIdFromDeviceId(e,t)):this.browserBehavior.requiresNoExactMediaStreamConstraints()?i.deviceId=t:i.deviceId={exact:t}:n?i.streamId=n.id:!function(e){return"object"===typeof e&&"deviceId"in e&&"groupId"in e&&"kind"in e&&"label"in e}(t)?i=t:(i.deviceId=t.deviceId,i.groupId=t.groupId),"video"===e&&(i.width=i.width||{ideal:this.videoInputQualitySettings.videoWidth},i.height=i.height||{ideal:this.videoInputQualitySettings.videoHeight},i.frameRate=i.frameRate||{ideal:this.videoInputQualitySettings.videoFrameRate}),"audio"===e&&this.supportSampleRateConstraint()&&(i.sampleRate={ideal:w.defaultSampleRate}),"audio"===e&&this.supportSampleSizeConstraint()&&(i.sampleSize={ideal:w.defaultSampleSize}),"audio"===e&&this.supportChannelCountConstraint()&&(i.channelCount={ideal:w.defaultChannelCount}),"audio"===e){i=Object.assign({echoCancellation:!0,googEchoCancellation:!0,googEchoCancellation2:!0,googAutoGainControl:!0,googAutoGainControl2:!0,googNoiseSuppression:!0,googNoiseSuppression2:!0,googHighpassFilter:!0},i)}return"audio"===e?{audio:i}:{video:i}}deviceInfoFromDeviceId(e,t){if(null===this.deviceInfoCache)return null;for(const i of this.deviceInfoCache)if(i.kind===e&&i.deviceId===t)return i;return null}acquireInputStream(e){return n(this,void 0,void 0,(function*(){if("audio"===e&&this.useWebAudio){return this.getMediaStreamDestinationNode().stream}
1if("video"===e&&this.chosenVideoInputIsTransformDevice())return this.chosenVideoTransformDevice.outputMediaStream;let t=null;if(this.activeDevices[e]){this.logger.info(`checking whether existing ${e} input device can be reused`);const i=this.activeDevices[e];t=i.constraints?i.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(i){if(this.logger.error(`unable to acquire ${e} device`),i instanceof m.default)throw i;throw new h.default(i,`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 i=this.getMediaTrackSettings(e);if(!i.deviceId)return!1;const n=w.getIntrinsicDeviceId(t);return"string"===typeof n&&i.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 i,n;null===(n=null===(i=this.transform)||void 0===i?void 0:i.nodes)||void 0===n||n.end.disconnect(),this.transform={nodes:t,device:e};const s=null===t||void 0===t?void 0:t.end,o=this.getMediaStreamDestinationNode();this.logger.debug(`Connecting transform node ${s} to destination ${o}.`),null===s||void 0===s||s.connect(o),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=w.getAudioContext().createMediaStreamSource(e);const i=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(i)}getMediaStreamDestinationNode(){return this.audioInputDestinationNode||(this.audioInputDestinationNode=w.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(!w.audioContext){const e={};navigator.mediaDevices.getSupportedConstraints().sampleRate&&(e.sampleRate=w.defaultSampleRate),w.audioContext=new(window.AudioContext||window.webkitAudioContext)(e)}return w.audioContext}static closeAudioContext(){if(w.audioContext)try{w.audioContext.close()}catch(e){}w.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,i){let n=`API/DefaultDeviceController/${e}`;"undefined"!==typeof t&&(n+=` ${JSON.stringify(t)}`),"undefined"!==typeof i&&(n+=` -> ${JSON.stringify(i)}`),this.logger.info(n)}}t.default=w,w.permissionDeniedOriginDetectionThresholdMs=500,w.defaultVideoWidth=960,w.defaultVideoHeight=540,w.defaultVideoFrameRate=15,w.defaultVideoMaxBandwidthKbps=1400,w.defaultSampleRate=48e3,w.defaultSampleSize=16,w.defaultChannelCount=1,w.audioContext=null},78128:function(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)}}},95348:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i extends Error{constructor(e,t){super(t||"Error fetching device."),this.cause=e,this.name="GetUserMediaError"}}t.default=i},86154:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Prom
1ise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DestroyableNoOpDeviceController=void 0;const s=i(14015);class o extends s.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,i,n){}getVideoInputQualitySettings(){return null}}t.default=o;t.DestroyableNoOpDeviceController=class extends o{constructor(){super(...arguments),this.destroyed=!1}destroy(){return n(this,void 0,void 0,(function*(){this.destroyed=!0}))}}},31238:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(95348);class s extends n.default{constructor(e){super(e),this.name="NotFoundError"}}t.default=s},63110:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(95348);class s extends n.default{constructor(e){super(e),this.name="NotReadableError"}}t.default=s},44842:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(95348);class s extends n.default{constructor(e,t){super(e),this.constraint=t,this.name="OverconstrainedError"}}t.default=s},6991:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(95348);class s extends n.default{constructor(e,t){super(e,t),this.name="PermissionDeniedError"}}t.default=s},37786:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e){this.inner=e}mute(e){return i(this,void 0,void 0,(function*(){}))}stop(){var e;return i(this,void 0,void 0,(function*(){null===(e=this.node)||void 0===e||e.disconnect()}))}intrinsicDevice(){return i(this,void 0,void 0,(function*(){return this.inner}))}createAudioNode(e){var t;return i(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}}))}}},86950:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(95348);class s extends n.default{constructor(e){super(e),this.name="TypeError"}}t.default=s},64500:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i,n){this.videoWidth=e,this.videoHeight=t,this.videoFrameRate=i,this.videoMaxBandwidthKbps=n}}},27170:function(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}},78236:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((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 i=matchMedia(`(resolution: ${this.devicePixelRatioSource.devicePixelRatio()}dppx)`);"function"===typeof i.addEventListener?(i.addEventListener("change",this.mediaQueryListener),this.mediaQueryList=i):"function"===typeof i.addListener?(i.addListener(this.mediaQueryListener),this.mediaQueryList=i):t.warn("ignoring DefaultDevicePixelRatioMonitor")}destroy(){return i(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()}
1))}registerObserver(e){this.observerQueue.add(e),e.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())}removeObserver(e){this.observerQueue.delete(e)}}},49190:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{devicePixelRatio(){return"undefined"!==typeof window&&window&&window.devicePixelRatio?window.devicePixelRatio:1}}},83520:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))},s=this&&this.__rest||function(e,t){var i={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var s=0;for(n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(i[n[s]]=e[n[s]])}return i};Object.defineProperty(t,"__esModule",{value:!0});const o=i(38434),r=i(23922),a=i(68627),d=i(12571);class c{constructor(e,t,i,o,r){this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.retryCountLimit=15,this.lock=!1,this.cancellableEvents=new Map,this.attributesToFilter=["externalUserId","externalMeetingId","timestampMs"],this.deepCopyCurrentIngestionEvent=e=>({type:e.type,v:e.v,payloads:[...e.payloads]}),this.sendEvents=()=>n(this,void 0,void 0,(function*(){if(this.lock)return;const e=this.getItems(this.flushSize);if(0===e.length)return;this.lock=!0;const t=this.makeRequestBody(e);let i=!1;const n=Date.now();"firefox"===this.metadata.browserName.toLowerCase()&&this.cancellableEvents.set(n,e);try{this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - sending body ${t}`);const e=yield this.send(t);if(this.cancellableEvents.delete(n),e.ok)try{const i=yield e.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - send successful events: ${t} message: ${JSON.stringify(i)}`)}catch(s){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents error reading OK response ${s} for events ${t}`)}else this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Failed to send events ${t} with response status ${e.status}`),i=!0}catch(o){i=!0,this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Error in sending events ${t} to the ingestion endpoint ${o}`)}finally{this.lock=!1}i&&(this.cancellableEvents.delete(n),this.failedIngestionEvents.push(...e))}));const d=new a.default(r).getParserResult(),{browserMajorVersion:c}=d,l=s(d,["browserMajorVersion"]),u=t.toJSON(),{type:h,v:f}=u,g=s(u,["type","v"]);this.authenticationToken=t.getAuthenticationToken(),this.metadata=Object.assign(Object.assign({},l),g),Object.keys(this.metadata).forEach((e=>this.attributesToFilter.push(e))),this.type=h,this.v=f,this.ingestionURL=i,this.logger=r,this.importantEvents=new Set(o);const{maxBufferCapacityKb:p,totalBufferItems:m,flushSize:v,flushIntervalMs:S,retryCountLimit:b}=e;this.maxBufferCapacityBytes=1024*p,this.totalBufferItems=m,this.maxBufferItemCapacityBytes=Math.round(this.maxBufferCapacityBytes/m),this.flushIntervalMs=S,this.flushSize=v,this.retryCountLimit=b,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.beaconEventListener=e=>this.beaconEventHandler(e),this.addEventListeners()}addEventListeners(){this.beaconEventListener&&"window"in i.g&&window.addEventListener&&"document"in i.g&&document.addEventListener&&(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - addEventListeners - adding pagehide and visibility change event listeners"),window.addEventListener("pagehide",this.beaconEventListener),document.addEventListener("visibilitychange",this.beaconEventListener))}beaconEventHandler(e){("visibilitychange"===e.type&&"hidden"===document.visibilityState||"pagehide"===e.type)&&(this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - beaconEventHandler is triggered calling sendBeacon"),this.sendBeacon())}removeEventListeners(){this.beaconEventListener&&"window"in i.g&&window.removeEventListener&&"document"in i.g&&document.removeEventListener&&(window.removeEventListener("pagehide",this.beaconEventListener),document.removeEventListener("visibilitychange",this.beaconEventListener),this.logger.debug("Event Reporting - InMemoryJSONEventBuffer - removeEventListeners - removing pagehide and visibility change event listeners"))}start(){var e;this.removeEventListeners(),this.addEventListeners(),null===(e=this.intervalScheduler)||void 0===e||e.stop(),this.intervalScheduler
1=new r.default(this.flushIntervalMs),this.intervalScheduler.start((()=>this.sendEvents()))}stop(){var e;null===(e=this.intervalScheduler)||void 0===e||e.stop(),this.intervalScheduler=void 0,this.sendBeacon(),this.removeEventListeners()}addItem(e){return n(this,void 0,void 0,(function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - received event ${JSON.stringify(e)}`);const{name:t,ts:i,attributes:n}=e,s=n&&this.filterAttributes(n,this.attributesToFilter),o=Object.assign({name:t,ts:i},s);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - event after filtering attributes ${JSON.stringify(o)}`);const r=this.getSize(o);if(r>c.MAX_ITEM_SIZE_BYTES_ALLOWED)throw new Error(`Event Reporting - Item to be added has size ${r} bytes. Item cannot exceed max item size allowed of ${c.MAX_ITEM_SIZE_BYTES_ALLOWED} bytes.`);if(this.importantEvents.has(t))return this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - sending important event ${JSON.stringify(o)}`),void this.sendEventImmediately({name:t,ts:i,attributes:s});if(this.isFull())throw this.logger.warn("Event Reporting - Event buffer is full"),new Error("Buffer full");if(this.currentIngestionEvent.payloads.push(o),this.ingestionEventSize+=r,this.bufferItemThresholdReached(r)){const e=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);this.buffer.push(e),this.bufferSize+=this.ingestionEventSize,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - buffer item threshold reached updated buffer ${JSON.stringify(this.buffer)}`)}}))}filterAttributes(e,t){const i=new Set(t);return Object.keys(e).filter((e=>i.has(e))).forEach((t=>delete e[t])),e}initializeAndGetCurrentIngestionEvent(){const e={type:this.type,v:this.v,payloads:[]};return this.ingestionEventSize=this.getSize(e),e}bufferItemThresholdReached(e){return e+this.ingestionEventSize>=this.maxBufferItemCapacityBytes||this.currentIngestionEvent.payloads.length===c.MAX_PAYLOAD_ITEMS}getSize(e){let t=0;if("object"===typeof e)for(const[i,n]of Object.entries(e))t+=this.getPrimitiveSize(i),t+=this.getSize(n);else t+=this.getPrimitiveSize(e);return t}getPrimitiveSize(e){let t=0;return"string"===typeof e?t+=2*e.length:"number"===typeof e&&(t+=8),t}isFull(){return this.bufferSize===this.maxBufferCapacityBytes||this.buffer.length===this.totalBufferItems}isEmpty(){return 0===this.buffer.length||0===this.bufferSize}getItems(e,t=0){if(this.isEmpty())return[];e=Math.min(this.buffer.length,e+1);return this.buffer.splice(t,e)}makeBeaconRequestBody(e){const t={metadata:this.metadata,events:e,authorization:this.authenticationToken};return JSON.stringify(t)}makeRequestBody(e){const t={metadata:this.metadata,events:e};return JSON.stringify(t)}sendEventImmediately(e){return n(this,void 0,void 0,(function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - important event received ${JSON.stringify(e)}`);const{name:t,ts:i,attributes:n}=e,s={type:this.type,v:this.v,payloads:[Object.assign({name:t,ts:i},n)]};let o=!1,r=null;const a=this.makeRequestBody([s]);try{if(r=yield this.send(a),r.ok){try{const e=yield r.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - send successful event: ${a}, message: ${JSON.stringify(e)}`)}catch(d){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Error reading OK response ${d} for event ${a}`)}return}this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Failed to send an important event ${a} with response status ${r.status}`),o=!0}catch(c){this.logger.warn(`Event Reporting - There may be a failure in sending an important event ${a} to the ingestion endpoint ${c}.`),o=!0;try{if("firefox"===this.metadata.browserName.toLowerCase()){const e=this.makeBeaconRequestBody([s]);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - beaconing data out ${e}`),o=!navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,e)}}catch(c){this.logger.warn(`Event Reporting - Error sending beacon for an important event ${a}`),o=!0}}o&&(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - pushing to failed events ${a}`),this.failedIngestionEvents.push(s))}))}send(e){return n(this,void 0,void 0,(function*(){const t=new o.default(c.RETRY_FIXED_BACKOFF_WAIT_MS,c.RETRY_SHORT_BACKOFF_MS,c.RETRY_LONG_BACKOFF_MS);try{let i=0;for(;i<this.retryCountLimit;){const n=yield fetch(this.ingestionURL,{method:"POST",headers:{Authorization:`Bearer ${this.authenticationToken}`},body:e});if(n.ok||!c.SENDING_FAILURE_CODES.has(n.status))return n;if(this.logger.warn(`Will retry sending failure for ${e} due to status code ${n.status}.`),i++,i<this.retryCountLimit){const e=t.nextBackoffAmountMs();yield d.wait(e)}}if(i===this.retryCountLimit)throw new Error(`Retry count limit reached for ${e}`)}catch(i){throw i}}))}sendBeacon(){return n(this,void 0,void 0,(function*(){const e=this.buffer;if(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out buffer events ${JSON.stringify(e)}`),this.buffer=[],this.currentIngestionEvent.payloads.length>0){const t=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);e.push(t),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out current ingestion event ${JSON.stringify(t)}`),this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent()}if(this.failedIngestionEvents.length>0){const t=this.failedIngestionEvents.map((e=>this.deepCopyCurrentIngestionEvent(e)));e.push(...t),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out any failed ingestion event ${JSON.stringify(t)}`),this.failedIngestionEvents=[]}if(this.cancellableEvents.size>
10&&(this.cancellableEvents.forEach((t=>{e.push(...t),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out each cancellable event ${JSON.stringify(t)}`)})),this.cancellableEvents.clear()),0===e.length)return;const t=this.makeBeaconRequestBody(e);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - beacon data to send ${t}`);try{navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,t)||this.logger.warn(`Event Reporting - Browser failed to queue beacon data ${t}`)}catch(i){this.logger.warn(`Event Reporting - Sending beacon data ${t} failed with error ${i}`)}}))}reset(){this.maxBufferCapacityBytes=0,this.totalBufferItems=0,this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.lock=!1,this.beaconEventListener=void 0,this.cancellableEvents.clear()}destroy(){return n(this,void 0,void 0,(function*(){this.stop(),this.reset()}))}}t.default=c,c.SENDING_FAILURE_CODES=new Set([408,429,500,502,503,504]),c.RETRY_FIXED_BACKOFF_WAIT_MS=0,c.RETRY_SHORT_BACKOFF_MS=1e3,c.RETRY_LONG_BACKOFF_MS=15e3,c.MAX_PAYLOAD_ITEMS=2,c.MAX_ITEM_SIZE_BYTES_ALLOWED=3e3},97700:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e=5e3,t=2,i=64,n=100,s=15){this.flushIntervalMs=e,this.flushSize=t,this.maxBufferCapacityKb=i,this.totalBufferItems=n,this.retryCountLimit=s}}},93831:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(42238),o=i(74046),r=i(60731);class a{constructor(e,t){var i,n,o,r,d,c,l;this.audioVideoController=e,this.eventReporter=t,this.meetingHistoryStates=[];try{this.parserResult=navigator&&navigator.userAgent?new s.UAParser(navigator.userAgent).getResult():null}catch(u){e.logger.error(u.message)}this.browserMajorVersion=(null===(o=null===(n=null===(i=this.parserResult)||void 0===i?void 0:i.browser)||void 0===n?void 0:n.version)||void 0===o?void 0:o.split(".")[0])||a.UNAVAILABLE,this.browserName=(null===(r=this.parserResult)||void 0===r?void 0:r.browser.name)||a.UNAVAILABLE,this.browserVersion=(null===(d=this.parserResult)||void 0===d?void 0:d.browser.version)||a.UNAVAILABLE,this.deviceName=[(null===(c=this.parserResult)||void 0===c?void 0:c.device.vendor)||"",(null===(l=this.parserResult)||void 0===l?void 0:l.device.model)||""].join(" ").trim()||a.UNAVAILABLE}publishEvent(e,t){return n(this,void 0,void 0,(function*(){const i=Date.now();this.meetingHistoryStates.push({name:e,timestampMs:i});const n=Object.freeze(Object.assign(this.getAttributes(i),t));this.audioVideoController.forEachObserver((t=>{t.eventDidReceive&&t.eventDidReceive(e,n)})),this.reportEvent(e,i,t)}))}reportEvent(e,t,i){var s;return n(this,void 0,void 0,(function*(){let n;try{i&&(n=r.default(i)),yield null===(s=this.eventReporter)||void 0===s?void 0:s.reportEvent(t,e,n)}catch(o){this.audioVideoController.logger.error(`Error reporting event ${o}`)}}))}pushMeetingState(e,t=Date.now()){return n(this,void 0,void 0,(function*(){this.meetingHistoryStates.push({name:e,timestampMs:t}),this.reportEvent(e,t)}))}getAttributes(e){var t,i;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)||a.UNAVAILABLE,osVersion:(null===(i=this.parserResult)||void 0===i?void 0:i.os.version)||a.UNAVAILABLE,sdkVersion:o.default.sdkVersion,sdkName:o.default.sdkName,timestampMs:e}}}t.default=a,a.UNAVAILABLE="Unavailable"},60731:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});t.default=e=>{const t={};for(const[i,n]of Object.entries(e))if(null!==n&&void 0!==n&&""!==n){if("number"!==typeof n&&"string"!==typeof n)throw new TypeError("Unhandled type received while flattening attributes.");t[i]=n}return t}},75680:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(97700);t.default=class{constructor(e,t,i=new n.default){this.eventsClientConfiguration=e,this.ingestionURL=t,this.eventBufferConfiguration=i}}},46366:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(70146),o=i(83520);t.default=class{constructor(e,t){this.reportingEvents=!1,this.importantEvents=["meetingEnded","meetingFailed","meetingStartFailed","audioInputFailed","videoInputFailed","meetingStartSucceeded"],this.destroyed=!1;const{eventsClientConfiguration:i,ingestionURL:n,eventBufferConfiguration:s}=e,{eventsToIgnore:r}=i;this.eventBuffer=new o.default(s,i,n,this.importantEvents,t),this.logger=t,this.eventsToIgnore=r,this.start()}start(){if(!this.reportingEvents)try{this.eventBuffer.start(),this.logger.info("Event reporting started"),this.reportingEvents=!0}catch(e){this.logger.error(`Event Reporting - Error starting the event buffer ${e}`)}}stop(){if(this.reportingEvents)try{this.eventBuffer.stop(),this.logger.info("Event reporting stopped"),this.reportingEvents=!1}catch(e){this.logger.error(`Event Reporting - Error stopping the event buffer ${e}`)}}reportEvent(e,t,i){return n(this,void 0,void 0,(function*(){if(this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - event received in reportEvent ${e}, ${t}, ${JSON.stringify(i)}`),this.eventsToIgnore.includes(t))this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - ${t} event will be ignored as it is in events to ignore`);else try{this.logger.debug("Event Reporting - DefaultMeetingEventReporter - adding item to event buffer"),yield this.eventBuffer.addItem({ts:e,name:t,attributes:i})}catch(n){this.logger.error(`Event Reporting - Error adding event to buffer ${n}`)}}))}destroy(){return n(this,void 0,void 0,(function*(){this.destroyed=!0,this.stop(),s.isDestroyable(this.eventBuffer)&&this.eventBuffer.destroy(),this.eventBuffer=void 0}))}}},90732:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){}reportEvent(e,t,i){}start(){}stop(){}}},79385:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i,n=[]){this.type="Meet",this.v=1,this.meetingId=e,this.attendeeId=t,this.eventsToIgnore=n,this.authenticationToken=i}getAuthenticationToken(){return this.authenticationToken}toJSON(){const e={};return e.type=this.type,e.v=this.v,e.meetingId=this.meetingId,e.attendeeId=this.attendeeId,e}}},63204:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultEventController=t.DefaultDevicePixelRatioMonitor=t.DefaultDeviceController=t.DefaultContentShareController=t.DefaultClientMetricReport=t.DefaultBrowserBehavior=t.DefaultAudioVideoFacade=t.DefaultAudioVideoController=t.DefaultAudioMixController=t.DefaultActiveSpeakerPolicy=t.DefaultActiveSpeakerDetector=t.DataMessage=t.CreateSDPTask=t.CreatePeerConnectionTask=t.ContentShareMediaStreamBroker=t.ContentShareConstants=t.ConsoleLogger=t.ConnectionHealthPolicyConfiguration=t.ConnectionHealthData=t.ClientVideoStreamReceivingReport=t.ClientMetricReportMediaType=t.ClientMetricReportDirection=t.CleanStoppedSessionTask=t.CleanRestartedSessionTask=t.CheckVideoInputFeedback=t.CheckVideoConnectivityFeedback=t.CheckNetworkUDPConnectivityFeedback=t.CheckNetworkTCPConnectivityFeedback=t.CheckContentShareConnectivityFeedback=t.CheckCameraResolutionFeedback=t.CheckAudioOutputFeedback=t.CheckAudioInputFeedback=t.CheckAudioConnectivityFeedback=t.CanvasVideoFrameBuffer=t.CSPMonitor=t.BitrateParameters=t.BaseTask=t.BaseConnectionHealthPolicy=t.Backgroun
1dReplacementVideoFrameProcessor=t.BackgroundFilterVideoFrameProcessor=t.BackgroundBlurVideoFrameProcessor=t.BackgroundBlurStrength=t.AudioVideoControllerState=t.AudioProfile=t.AudioLogEvent=t.Attendee=t.AttachMediaInputTask=t.AsyncScheduler=t.ApplicationMetadata=t.AllHighestVideoBandwidthPolicy=void 0,t.MeetingSessionConfiguration=t.MeetingReadinessCheckerConfiguration=t.MeetingEventsClientConfiguration=t.MediaDeviceProxyHandler=t.Maybe=t.LogLevel=t.Log=t.ListenForVolumeIndicatorsTask=t.LeaveAndReceiveLeaveAckTask=t.JoinAndReceiveIndexTask=t.IntervalScheduler=t.InMemoryJSONEventBuffer=t.GlobalMetricReport=t.GetUserMediaError=t.FullJitterLimitedBackoff=t.FullJitterBackoffFactory=t.FullJitterBackoff=t.FinishGatheringICECandidatesTask=t.EventIngestionConfiguration=t.EventBufferConfiguration=t.DeviceSelection=t.DevicePixelRatioWindowSource=t.DefaultWebSocketAdapter=t.DefaultVolumeIndicatorAdapter=t.DefaultVideoTransformDevice=t.DefaultVideoTileFactory=t.DefaultVideoTileController=t.DefaultVideoTile=t.DefaultVideoStreamIndex=t.DefaultVideoStreamIdSet=t.DefaultVideoFrameProcessorPipeline=t.DefaultVideoCaptureAndEncodeParameter=t.DefaultUserAgentParser=t.DefaultTranscriptionController=t.DefaultTransceiverController=t.DefaultStatsCollector=t.DefaultSimulcastUplinkPolicy=t.DefaultSignalingClient=t.DefaultSigV4=t.DefaultSessionStateController=t.DefaultSDP=t.DefaultReconnectController=t.DefaultRealtimeController=t.DefaultPingPong=t.DefaultModality=t.DefaultMessagingSession=t.DefaultMeetingSession=t.DefaultMeetingReadinessChecker=t.DefaultMeetingEventReporter=t.DefaultMediaDeviceFactory=void 0,t.SendAndReceiveDataMessagesTask=t.SDPMediaSection=t.SDPCandidateType=t.RunnableTask=t.ReleaseMediaStreamsTask=t.ReconnectionHealthPolicy=t.ReceiveVideoStreamIndexTask=t.ReceiveVideoInputTask=t.ReceiveTURNCredentialsTask=t.ReceiveAudioInputTask=t.RealtimeVolumeIndicator=t.RealtimeState=t.RealtimeAttendeePositionInFrame=t.PromoteToPrimaryMeetingTask=t.PrefetchOn=t.PermissionDeniedError=t.ParallelGroupTask=t.OverconstrainedError=t.OpenSignalingConnectionTask=t.OnceTask=t.NotReadableError=t.NotFoundError=t.None=t.NoVideoUplinkBandwidthPolicy=t.NoVideoDownlinkBandwidthPolicy=t.NoOpVideoFrameProcessor=t.NoOpVideoElementFactory=t.NoOpTask=t.NoOpMediaStreamBroker=t.NoOpLogger=t.NoOpEventReporter=t.NoOpDeviceController=t.NoOpDebugLogger=t.NoOpAudioVideoController=t.NScaleVideoUplinkBandwidthPolicy=t.MutableVideoPreferences=t.MultiLogger=t.MonitorTask=t.ModelSpecBuilder=t.MessagingSessionConfiguration=t.Message=t.MeetingSessionVideoAvailability=t.MeetingSessionURLs=t.MeetingSessionTURNCredentials=t.MeetingSessionStatusCode=t.MeetingSessionStatus=t.MeetingSessionPOSTLogger=t.MeetingSessionLifecycleEventCondition=t.MeetingSessionLifecycleEvent=t.MeetingSessionCredentials=void 0,t.VoiceFocusTransformDevice=t.VoiceFocusDeviceTransformer=t.VideoTileState=t.VideoStreamDescription=t.VideoSource=t.VideoQualitySettings=t.VideoPriorityBasedPolicyConfig=t.VideoPriorityBasedPolicy=t.VideoPreferences=t.VideoPreference=t.VideoOnlyTransceiverController=t.VideoLogEvent=t.VideoAdaptiveProbePolicy=t.Versioning=t.UnusableAudioWarningConnectionHealthPolicy=t.TypeError=t.TranscriptionStatusType=t.TranscriptionStatus=t.TranscriptResult=t.TranscriptLanguageWithScore=t.TranscriptItemType=t.TranscriptItem=t.TranscriptEntity=t.TranscriptAlternative=t.Transcript=t.TimeoutTask=t.TimeoutScheduler=t.TaskStatus=t.TargetDisplaySize=t.SubscribeAndReceiveSubscribeAckTask=t.StreamMetricReport=t.Some=t.SingleNodeAudioTransformDevice=t.SimulcastVideoStreamIndex=t.SimulcastTransceiverController=t.SimulcastLayers=t.SignalingClientVideoSubscriptionConfiguration=t.SignalingClientSubscribe=t.SignalingClientJoin=t.SignalingClientEventType=t.SignalingClientEvent=t.SignalingClientConnectionRequest=t.SignalingAndMetricsConnectionMonitor=t.SetRemoteDescriptionTask=t.SetLocalDescriptionTask=t.SessionStateControllerTransitionResult=t.SessionStateControllerState=t.SessionStateControllerDeferPriority=t.SessionStateControllerAction=t.SerialGroupTask=void 0,t.isVideoTransformDevice=t.isDestroyable=t.isAudioTransformDevice=t.ZLIBTextCompressor=t.WebSocketReadyState=t.WaitForAttendeePresenceTask=void 0;const n=i(75185);t.AllHighestVideoBandwidthPolicy=n.default;const s=i(37535);t.ApplicationMetadata=s.default;const o=i(37797);
1t.AsyncScheduler=o.default;const r=i(38358);t.AttachMediaInputTask=r.default;const a=i(47602);t.Attendee=a.default;const d=i(79880);t.AudioLogEvent=d.default;const c=i(23765);t.AudioProfile=c.default;const l=i(31876);t.AudioVideoControllerState=l.default;const u=i(99734);t.BackgroundBlurStrength=u.default;const h=i(51260);t.BackgroundBlurVideoFrameProcessor=h.default;const f=i(84243);t.BackgroundFilterVideoFrameProcessor=f.default;const g=i(19854);t.BackgroundReplacementVideoFrameProcessor=g.default;const p=i(13940);t.BaseConnectionHealthPolicy=p.default;const m=i(31789);t.BaseTask=m.default;const v=i(59394);t.BitrateParameters=v.default;const S=i(47237);t.CSPMonitor=S.default;const b=i(19807);t.CanvasVideoFrameBuffer=b.default;const w=i(62084);t.CheckAudioConnectivityFeedback=w.default;const y=i(48892);t.CheckAudioInputFeedback=y.default;const C=i(69333);t.CheckAudioOutputFeedback=C.default;const T=i(51087);t.CheckCameraResolutionFeedback=T.default;const k=i(72606);t.CheckContentShareConnectivityFeedback=k.default;const _=i(87415);t.CheckNetworkTCPConnectivityFeedback=_.default;const I=i(4299);t.CheckNetworkUDPConnectivityFeedback=I.default;const M=i(26818);t.CheckVideoConnectivityFeedback=M.default;const x=i(71737);t.CheckVideoInputFeedback=x.default;const E=i(53216);t.CleanRestartedSessionTask=E.default;const A=i(47408);t.CleanStoppedSessionTask=A.default;const P=i(56196);t.ClientMetricReportDirection=P.default;const R=i(99496);t.ClientMetricReportMediaType=R.default;const D=i(92770);t.ClientVideoStreamReceivingReport=D.default;const O=i(66688);t.ConnectionHealthData=O.default;const V=i(23731);t.ConnectionHealthPolicyConfiguration=V.default;const B=i(88030);t.ConsoleLogger=B.default;const L=i(18890);t.ContentShareConstants=L.default;const N=i(78370);t.ContentShareMediaStreamBroker=N.default;const F=i(5054);t.CreatePeerConnectionTask=F.default;const U=i(21129);t.CreateSDPTask=U.default;const $=i(11018);t.DataMessage=$.default;const W=i(78320);t.DefaultActiveSpeakerDetector=W.default;const j=i(42363);t.DefaultActiveSpeakerPolicy=j.default;const H=i(96802);t.DefaultAudioMixController=H.default;const z=i(9059);t.DefaultAudioVideoController=z.default;const K=i(18538);t.DefaultAudioVideoFacade=K.default;const G=i(90543);t.DefaultBrowserBehavior=G.default;const q=i(86893);t.DefaultClientMetricReport=q.default;const J=i(38023);t.DefaultContentShareController=J.default;const Q=i(44142);t.DefaultDeviceController=Q.default;const Z=i(78236);t.DefaultDevicePixelRatioMonitor=Z.default;const X=i(93831);t.DefaultEventController=X.default;const Y=i(66354);t.DefaultMediaDeviceFactory=Y.default;const ee=i(46366);t.DefaultMeetingEventReporter=ee.default;const te=i(83980);t.DefaultMeetingReadinessChecker=te.default;const ie=i(19751);t.DefaultMeetingSession=ie.default;const ne=i(88947);t.DefaultMessagingSession=ne.default;const se=i(60214);t.DefaultModality=se.default;const oe=i(97500);t.DefaultPingPong=oe.default;const re=i(70983);t.DefaultRealtimeController=re.default;const ae=i(29141);t.DefaultReconnectController=ae.default;const de=i(47293);t.DefaultSDP=de.default;const ce=i(19678);t.DefaultSessionStateController=ce.default;const le=i(50334);t.DefaultSigV4=le.default;const ue=i(41208);t.DefaultSignalingClient=ue.default;const he=i(24450);t.DefaultSimulcastUplinkPolicy=he.default;const fe=i(64015);t.DefaultStatsCollector=fe.default;const ge=i(50365);t.DefaultTransceiverController=ge.default;const pe=i(95308);t.DefaultTranscriptionController=pe.default;const me=i(68627);t.DefaultUserAgentParser=me.default;const ve=i(51133);t.DefaultVideoCaptureAndEncodeParameter=ve.default;const Se=i(38919);t.DefaultVideoFrameProcessorPipeline=Se.default;const be=i(91508);t.DefaultVideoStreamIdSet=be.default;const we=i(91318);t.DefaultVideoStreamIndex=we.default;const ye=i(3327);t.DefaultVideoTile=ye.default;const Ce=i(42958);t.DefaultVideoTileController=Ce.default;const Te=i(94922);t.DefaultVideoTileFactory=Te.default;const ke=i(67673);t.DefaultVideoTransformDevice=ke.default;const _e=i(99751);t.DefaultVolumeIndicatorAdapter=_e.default;const Ie=i(67631);t.DefaultWebSocketAdapter=Ie.default;const Me=i(49190);t.DevicePixelRatioWindowSource=Me.default;const xe=i(78128);t.DeviceSelection=xe.default;const Ee=i(97700);t.EventBufferConfiguration=Ee.default;const Ae=i(75680);t.EventIngestionConfiguration=Ae.default;const Pe=i(26240);
1t.FinishGatheringICECandidatesTask=Pe.default;const Re=i(38434);t.FullJitterBackoff=Re.default;const De=i(55640);t.FullJitterBackoffFactory=De.default;const Oe=i(67300);t.FullJitterLimitedBackoff=Oe.default;const Ve=i(95348);t.GetUserMediaError=Ve.default;const Be=i(2306);t.GlobalMetricReport=Be.default;const Le=i(83520);t.InMemoryJSONEventBuffer=Le.default;const Ne=i(23922);t.IntervalScheduler=Ne.default;const Fe=i(21960);t.JoinAndReceiveIndexTask=Fe.default;const Ue=i(96180);t.LeaveAndReceiveLeaveAckTask=Ue.default;const $e=i(2748);t.ListenForVolumeIndicatorsTask=$e.default;const We=i(80293);t.Log=We.default;const je=i(70813);t.LogLevel=je.default;const He=i(34236);t.MediaDeviceProxyHandler=He.default;const ze=i(79385);t.MeetingEventsClientConfiguration=ze.default;const Ke=i(3990);t.MeetingReadinessCheckerConfiguration=Ke.default;const Ge=i(10589);t.MeetingSessionConfiguration=Ge.default;const qe=i(68015);t.MeetingSessionCredentials=qe.default;const Je=i(87604);t.MeetingSessionLifecycleEvent=Je.default;const Qe=i(41296);t.MeetingSessionLifecycleEventCondition=Qe.default;const Ze=i(16326);t.MeetingSessionPOSTLogger=Ze.default;const Xe=i(13789);t.MeetingSessionStatus=Xe.default;const Ye=i(25687);t.MeetingSessionStatusCode=Ye.default;const et=i(87215);t.MeetingSessionTURNCredentials=et.default;const tt=i(76057);t.MeetingSessionURLs=tt.default;const it=i(5723);t.MeetingSessionVideoAvailability=it.default;const nt=i(19358);t.Message=nt.default;const st=i(77500);t.MessagingSessionConfiguration=st.default;const ot=i(80022);t.ModelSpecBuilder=ot.default;const rt=i(11981);t.MonitorTask=rt.default;const at=i(69938);t.MultiLogger=at.default;const dt=i(72472);t.NScaleVideoUplinkBandwidthPolicy=dt.default;const ct=i(69836);t.NoOpAudioVideoController=ct.default;const lt=i(30209);t.NoOpDebugLogger=lt.default;const ut=i(86154);t.NoOpDeviceController=ut.default;const ht=i(90732);t.NoOpEventReporter=ht.default;const ft=i(77434);t.NoOpLogger=ft.default;const gt=i(14015);t.NoOpMediaStreamBroker=gt.default;const pt=i(48831);t.NoOpTask=pt.default;const mt=i(13663);t.NoOpVideoElementFactory=mt.default;const vt=i(52801);t.NoOpVideoFrameProcessor=vt.default;const St=i(5319);t.NoVideoDownlinkBandwidthPolicy=St.default;const bt=i(40657);t.NoVideoUplinkBandwidthPolicy=bt.default;const wt=i(31238);t.NotFoundError=wt.default;const yt=i(63110);t.NotReadableError=yt.default;const Ct=i(21124);t.OnceTask=Ct.default;const Tt=i(94543);t.OpenSignalingConnectionTask=Tt.default;const kt=i(44842);t.OverconstrainedError=kt.default;const _t=i(28556);t.ParallelGroupTask=_t.default;const It=i(6991);t.PermissionDeniedError=It.default;const Mt=i(20106);t.PrefetchOn=Mt.default;const xt=i(23968);t.PromoteToPrimaryMeetingTask=xt.default;const Et=i(75910);t.RealtimeAttendeePositionInFrame=Et.default;const At=i(19825);t.RealtimeState=At.default;const Pt=i(49576);t.RealtimeVolumeIndicator=Pt.default;const Rt=i(51209);t.ReceiveAudioInputTask=Rt.default;const Dt=i(25547);t.ReceiveTURNCredentialsTask=Dt.default;const Ot=i(120);t.ReceiveVideoInputTask=Ot.default;const Vt=i(39560);t.ReceiveVideoStreamIndexTask=Vt.default;const Bt=i(39708);t.ReconnectionHealthPolicy=Bt.default;const Lt=i(88797);t.ReleaseMediaStreamsTask=Lt.default;const Nt=i(44191);t.RunnableTask=Nt.default;const Ft=i(4076);t.SDPCandidateType=Ft.default;const Ut=i(41944);t.SDPMediaSection=Ut.default;const $t=i(99485);t.SendAndReceiveDataMessagesTask=$t.default;const Wt=i(47079);t.SerialGroupTask=Wt.default;const jt=i(13860);t.SessionStateControllerAction=jt.default;const Ht=i(36850);t.SessionStateControllerDeferPriority=Ht.default;const zt=i(79553);t.SessionStateControllerState=zt.default;const Kt=i(93013);t.SessionStateControllerTransitionResult=Kt.default;const Gt=i(64833);t.SetLocalDescriptionTask=Gt.default;const qt=i(25275);t.SetRemoteDescriptionTask=qt.default;const Jt=i(68581);t.SignalingAndMetricsConnectionMonitor=Jt.default;const Qt=i(3920);t.SignalingClientConnectionRequest=Qt.default;const Zt=i(42902);t.SignalingClientEvent=Zt.default;const Xt=i(99416);t.SignalingClientEventType=Xt.default;const Yt=i(82168);t.SignalingClientJoin=Yt.default;const ei=i(46729);t.SignalingClientSubscribe=ei.default;const ti=i(9101);t.SignalingClientVideoSubscriptionConfiguration=ti.default;const ii=i(17606);t.SimulcastLayers=ii.default;const ni=i(5785);t.SimulcastTransceiverController=ni.default;const si=i(34242);t.SimulcastVideoStreamIndex=si.default;const oi=i(37786);t.SingleNodeAudioTransformDevice=oi.default;const ri=i(62811);t.StreamMetricReport=ri.default;const ai=i(95924);t.SubscribeAndReceiveSubscribeAckTask=ai.default;const di=i(42721);t.TargetDisplaySize=di.default;const ci=i(4456);t.TaskStatus=ci.default;const li=i(44929);
1t.TimeoutScheduler=li.default;const ui=i(90250);t.TimeoutTask=ui.default;const hi=i(34739);t.Transcript=hi.default;const fi=i(32471);t.TranscriptAlternative=fi.default;const gi=i(67210);t.TranscriptEntity=gi.default;const pi=i(61741);t.TranscriptItem=pi.default;const mi=i(96864);t.TranscriptItemType=mi.default;const vi=i(59063);t.TranscriptLanguageWithScore=vi.default;const Si=i(5323);t.TranscriptResult=Si.default;const bi=i(41288);t.TranscriptionStatus=bi.default;const wi=i(91326);t.TranscriptionStatusType=wi.default;const yi=i(86950);t.TypeError=yi.default;const Ci=i(51922);t.UnusableAudioWarningConnectionHealthPolicy=Ci.default;const Ti=i(74046);t.Versioning=Ti.default;const ki=i(12880);t.VideoAdaptiveProbePolicy=ki.default;const _i=i(40155);t.VideoLogEvent=_i.default;const Ii=i(79354);t.VideoOnlyTransceiverController=Ii.default;const Mi=i(91754);t.VideoPreference=Mi.default;const xi=i(21819);t.VideoPreferences=xi.default;const Ei=i(84992);t.VideoPriorityBasedPolicy=Ei.default;const Ai=i(91034);t.VideoPriorityBasedPolicyConfig=Ai.default;const Pi=i(64500);t.VideoQualitySettings=Pi.default;const Ri=i(90060);t.VideoSource=Ri.default;const Di=i(96876);t.VideoStreamDescription=Di.default;const Oi=i(37804);t.VideoTileState=Oi.default;const Vi=i(32497);t.VoiceFocusDeviceTransformer=Vi.default;const Bi=i(48878);t.VoiceFocusTransformDevice=Bi.default;const Li=i(6171);t.WaitForAttendeePresenceTask=Li.default;const Ni=i(7387);t.WebSocketReadyState=Ni.default;const Fi=i(73320);t.ZLIBTextCompressor=Fi.default;const Ui=i(21819);Object.defineProperty(t,"MutableVideoPreferences",{enumerable:!0,get:function(){return Ui.MutableVideoPreferences}});const $i=i(28660);Object.defineProperty(t,"Some",{enumerable:!0,get:function(){return $i.Some}}),Object.defineProperty(t,"None",{enumerable:!0,get:function(){return $i.None}}),Object.defineProperty(t,"Maybe",{enumerable:!0,get:function(){return $i.Maybe}});const Wi=i(91746);Object.defineProperty(t,"isAudioTransformDevice",{enumerable:!0,get:function(){return Wi.isAudioTransformDevice}});const ji=i(70146);Object.defineProperty(t,"isDestroyable",{enumerable:!0,get:function(){return ji.isDestroyable}});const Hi=i(27170);Object.defineProperty(t,"isVideoTransformDevice",{enumerable:!0,get:function(){return Hi.isVideoTransformDevice}})},88030:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(70813);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<this.level||("string"===typeof e?this.log(n.default.DEBUG,e):e?this.log(n.default.DEBUG,e()):this.log(n.default.DEBUG,""+e))}setLogLevel(e){this.level=e}getLogLevel(){return this.level}log(e,t){if(e<this.level)return;const i=`${(new Date).toISOString()} [${n.default[e]}] ${this.name} - ${t}`;switch(e){case n.default.ERROR:console.error(i);break;case n.default.WARN:console.warn(i);break;case n.default.DEBUG:console.debug(i.replace(/\\r\\n/g,"\n"));break;case n.default.INFO:console.info(i)}}}},80293:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i,n){this.sequenceNumber=e,this.message=t,this.timestampMs=i,this.logLevel=n}}},70813:function(e,t){"use strict";var i;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"}(i=t.LogLevel||(t.LogLevel={})),t.default=i},16326:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(70813),o=i(23922),r=i(80293);t.default=class{constructor(e,t,i,n,o,r=s.default.WARN,a){this.name=e,this.configuration=t,this.batchSize=i,this.intervalMs=n,this.url=o,this.level=r,this.headers=a,this.logCapture=[],this.sequenceNumber=0,this.lock=!1,this.startLogPublishScheduler(this.batchSize),this.eventListener=()=>{this.stop()},this.addEventListener()}addEventListener(){this.eventListener&&"window"in i.g&&window.addEventListener&&window.addEventListener("unload",this.eventListener)}removeEventListener(){this.eventListener&&"window"in i.g&&window.removeEventListener&&window.removeEventListener("unload",this.eventListener)}debug(e){s.default.DEBUG<this.level||("string"===typeof e?this.log(s.default.DEBUG,e):e?this.log(s.default.DEBUG,e()):this.log(s.default.DEBUG,""+e))}info(e){this.log(s.default.INFO,e)}warn(e){this.log(s.default.WARN,e)}error(e){this.log(s.default.ERROR,e)}setLogLevel(e){this.level=e}getLogLevel(){return this.level}getLogCaptureSize(){return this.logCapture.length}startLogPublishScheduler(e){var t;this.addEventListener(),null===(t=this.intervalScheduler)||void 0===t||t.stop(),this.intervalScheduler
1=new o.default(this.intervalMs),this.intervalScheduler.start((()=>n(this,void 0,void 0,(function*(){if(!0===this.lock||0===this.getLogCaptureSize())return;this.lock=!0;const t=this.logCapture.slice(0,e),i=this.makeRequestBody(t);try{200===(yield fetch(this.url,Object.assign({method:"POST",body:i},this.headers?{headers:this.headers}:{}))).status&&(this.logCapture=this.logCapture.slice(t.length))}catch(n){console.warn("[MeetingSessionPOSTLogger] "+n.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<this.level)return;const i=Date.now();this.logCapture.push(new r.default(this.sequenceNumber,t,i,s.default[e])),this.sequenceNumber+=1}}},69938:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(70813);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,i;i="string"===typeof e?e:e?()=>(t||(t=e()),t):""+e;for(const n of this._loggers)n.debug(i)}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}}},30209:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(70813),s=i(77434);class o extends s.default{constructor(){super(n.default.DEBUG)}}t.default=o},77434:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(70813);t.default=class{constructor(e=n.default.OFF){this.level=e}info(e){}warn(e){}error(e){}debug(e){n.default.DEBUG<this.level||"string"!==typeof e&&e()}setLogLevel(e){this.level=e}getLogLevel(){return this.level}}},66354:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(34236);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")}}},34236:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(37797),o=i(23922);class r{constructor(){this.scheduler=null,this.devices=null,this.deviceChangeListeners=new Set,this.get=(e,t,i)=>{if(!Reflect.has(e,t))return;if(!("ondevicechange"in navigator.mediaDevices)){if("addEventListener"===t)return this.patchAddEventListener(e,t,i);if("removeEventListener"===t)return this.patchRemoveEventListener(e,t,i)}const n=Reflect.get(e,t,i);return"function"===typeof n?n.bind(e):n},this.patchAddEventListener=(e,t,i)=>{const n=Reflect.get(e,t,i);return(t,i,s)=>{if("devicechange"!==t)return Reflect.apply(n,e,[t,i,s]);this.deviceChangeListeners.add(i),this.scheduler||(this.scheduler=new o.default(r.INTERVAL_MS),this.scheduler.start(this.pollDeviceLists))}},this.patchRemoveEventListener=(e,t,i)=>{const n=Reflect.get(e,t,i);return(t,i,s)=>{if("devicechange"!==t)return Reflect.apply(n,e,[t,i,s]);this.deviceChangeListeners.delete(i),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();if(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.deviceId<t.deviceId?1:e.deviceId>t.deviceId?-1:0))}))}handleDeviceChangeEvent(){for(const e of this.deviceChangeListeners)s.default.nextTick((()=>
1{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},14015:function(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){}}},62084:function(e,t){"use strict";var i;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"}(i=t.CheckAudioConnectivityFeedback||(t.CheckAudioConnectivityFeedback={})),t.default=i},48892:function(e,t){"use strict";var i;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"}(i=t.CheckAudioInputFeedback||(t.CheckAudioInputFeedback={})),t.default=i},69333:function(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.CheckAudioOutputFeedback=void 0,function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed"}(i=t.CheckAudioOutputFeedback||(t.CheckAudioOutputFeedback={})),t.default=i},51087:function(e,t){"use strict";var i;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"}(i=t.CheckCameraResolutionFeedback||(t.CheckCameraResolutionFeedback={})),t.default=i},72606:function(e,t){"use strict";var i;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"}(i=t.CheckContentShareConnectivityFeedback||(t.CheckContentShareConnectivityFeedback={})),t.default=i},87415:function(e,t){"use strict";var i;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"}(i=t.CheckNetworkTCPConnectivityFeedback||(t.CheckNetworkTCPConnectivityFeedback={})),t.default=i},4299:function(e,t){"use strict";var i;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"}(i=t.CheckNetworkUDPConnectivityFeedback||(t.CheckNetworkUDPConnectivityFeedback={})),t.default=i},26818:function(e,t){"use strict";var i;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"}(i=t.CheckVideoConnectivityFeedback||(t.CheckVideoConnectivityFeedback={})),t.default=i},71737:function(e,t){"use strict";var i;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"}(i=t.CheckVideoInputFeedback||(t.CheckVideoInputFeedback={})),t.default=i},83980:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};
1Object.defineProperty(t,"__esModule",{value:!0});const s=i(96802),o=i(90543),r=i(44142),a=i(6991),d=i(31789),c=i(90250),l=i(62084),u=i(48892),h=i(69333),f=i(51087),g=i(72606),p=i(87415),m=i(4299),v=i(26818),S=i(71737),b=i(3990);class w{constructor(e,t,i=new b.default){this.logger=e,this.meetingSession=t,this.configuration=i,this.browserBehavior=new o.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),u.default.Succeeded}catch(t){return this.logger.error(`MeetingReadinessChecker: Audio input check failed with error ${t}`),t instanceof a.default?u.default.PermissionDenied:u.default.Failed}}))}checkAudioOutput(e,t,i=null){return n(this,void 0,void 0,(function*(){try{const n=e?r.default.getIntrinsicDeviceId(e):"";yield this.playTone(n,440,i);return(yield t())?h.default.Succeeded:h.default.Failed}catch(n){return this.logger.error(`MeetingReadinessChecker: Audio output check failed with error: ${n}`),h.default.Failed}finally{this.stopTone()}}))}playTone(e,t,i){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 o=new s.default(this.logger);try{this.browserBehavior.supportsSetSinkId()&&(yield o.bindAudioDevice({deviceId:e}))}catch(a){this.logger.error(`Failed to bind audio device: ${a}`)}try{yield o.bindAudioElement(i||new Audio)}catch(a){this.logger.error(`Failed to bind audio element: ${a}`)}yield o.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),S.default.Succeeded}catch(t){return this.logger.error(`MeetingReadinessChecker: Video check failed with error ${t}`),t instanceof a.default?S.default.PermissionDenied:S.default.Failed}}))}checkCameraResolution(e,t,i){return n(this,void 0,void 0,(function*(){let n;try{const s=r.default.getIntrinsicDeviceId(e),o={video:this.calculateVideoConstraint(s,t,i)};n=yield navigator.mediaDevices.getUserMedia(o)}catch(s){return this.logger.error(`MeetingReadinessChecker: Camera resolution check with width: ${t} height ${i} failed with error ${s}`),s&&"OverconstrainedError"===s.name?f.default.ResolutionNotSupported:s&&"NotAllowedError"===s.name?f.default.PermissionDenied:f.default.Failed}finally{n&&n.getTracks().forEach((function(e){e.stop()}))}return f.default.Succeeded}))}calculateVideoConstraint(e,t,i){const n=this.browserBehavior.requiresResolutionAlignment(t,i),s={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?(s.deviceId=e,s.width=t,s.height=i):(s.deviceId={exact:e},s.width={exact:n[0]},s.height={exact:n[1]}),s}checkContentShareConnectivity(e){return n(this,void 0,void 0,(function*(){let t=!1,i=!1;const s={contentShareDidStart:()=>{t=!0}},o={audioVideoDidStart:()=>{i=!0}};try{return this.meetingSession.audioVideo.addObserver(o),this.meetingSession.audioVideo.start(),this.meetingSession.audioVideo.addContentShareObserver(s),yield this.meetingSession.audioVideo.startContentShareFromScreenCapture(e),yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){return i&&t})))),i?(yield this.stopMeeting(),t?g.default.Succeeded:g.default.TimedOut):g.default.ConnectionFailed}catch(r){return this.logger.error(`MeetingReadinessChecker: Content share check failed with error ${r}`),"NotAllowedError"===r.name?g.default.PermissionDenied:g.default.Failed}finally{this.meetingSession.audioVideo.removeObserver(o),this.meetingSession.audioVideo.stopContentShare(),this.meetingSession.audioVideo.removeContentShareObserver(s)}}))}checkAudioConnectivity(e){return n(this,void 0,void 0,(function*(){let t=!1;const i=this.meetingSession.audioVideo,s=(e,i,n,s)=>{e===this.meetingSession.configuration.credentials.attendeeId&&i&&(t=!0)};try{yield i.chooseAudioInputDevice(e)}catch(o){return this.logger.error(`MeetingReadinessChecker: Failed to get audio input device with error ${o}`),o instanceof a.default?l.default.AudioInputPermissionDenied:l.default.AudioInputRequestFailed}if(i.realtimeSubscribeToAttendeeIdPresence(s),!(yield this.startMeeting())){i.realtimeUnsubscribeToAttendeeIdPresence(s);
1try{yield this.meetingSession.audioVideo.chooseAudioInputDevice(null)}catch(r){this.logger.error(`MeetingReadinessChecker: Failed to choose null device with error ${r}`)}return l.default.ConnectionFailed}yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){return t})))),i.realtimeUnsubscribeToAttendeeIdPresence(s),yield this.stopMeeting();try{yield this.meetingSession.audioVideo.chooseAudioInputDevice(null)}catch(r){this.logger.error(`MeetingReadinessChecker: Failed to choose null device with error ${r}`)}return t?l.default.Succeeded:l.default.AudioNotReceived}))}checkVideoConnectivity(e){return n(this,void 0,void 0,(function*(){const t=this.meetingSession.audioVideo;try{yield t.chooseVideoInputDevice(e)}catch(s){return this.logger.error(`MeetingReadinessChecker: Failed to get video input device with error ${s}`),s instanceof a.default?v.default.VideoInputPermissionDenied:v.default.VideoInputRequestFailed}if(!(yield this.startMeeting()))return v.default.ConnectionFailed;let i=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&&(i=e.packetsSent)})),i>0})))),t.stopLocalVideoTile(),yield this.stopMeeting(),i<=0?v.default.VideoNotSent:v.default.Succeeded}))}checkNetworkUDPConnectivity(){return n(this,void 0,void 0,(function*(){try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(i){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${i}`),m.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,m.default.ConnectionFailed;let t=!1;return yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){const i=yield e.getRTCPeerConnectionStats();return i&&i.forEach((e=>{"candidate-pair"===e.type&&"succeeded"===e.state&&(t=!0)})),t})))),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),t?m.default.Succeeded:m.default.ICENegotiationFailed}))}checkNetworkTCPConnectivity(){return n(this,void 0,void 0,(function*(){try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(i){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${i}`),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 i=yield e.getRTCPeerConnectionStats();return i&&i.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 i extends d.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 w.delay(this.waitDurationMs)}}))}}const s=new c.default(this.logger,new i(this.logger,this.configuration.waitDurationMs),this.configuration.timeoutMs);return yield s.run(),t}))}}t.default=w},3990:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){this.timeoutMs=1e4,this.waitDurationMs=3e3}}},19751:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(9059),o=i(18538),r=i(38434),a=i(90543),d=i(78370),c=i(38023),l=i(47237),u=i(70146),h=i(75680),f=i(46366),g=i(79385),p=i(29141),m=i(67631);t.default=class{constructor(e,t,i,n){this._configuration=e,this._logger=t,this.checkBrowserSupportAndFeatureConfiguration(),l.default.addLogger(this._logger),l.default.register(),this.setupEventReporter(e,t,n),this._deviceController=i,this.audioVideoController=new s.default(this._configuration,this._logger,new m.default(this._logger),i,new p.default(this._configuration.reconnectTimeoutMs,new r.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs)),this._eventReporter),i.bindToAudioVideoController(this.audioVideoController);const a=new d.default(this._logger);this.contentShareController=new c.default(a,new s.default(c.default.createContentShareMeetingSessionConfigure(this._configuration),this._logger,new m.default(this._logger),a,new p.default(this._configuration.reconnectTimeoutMs,new r.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs))),this.audioVideoController),this.audioVideoFacade=new o.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}get eventReporter(){return this._eventReporter}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()),u.isDestroyable(this.eventReporter)&&(yield this.eventReporter.destroy()),l.default.removeLogger(this._logger),this._logger=void 0,this._configuration=void 0,this._deviceController=void 0,this.audioVideoFacade=void 0,this.audioVideoController=void 0,this.contentShareController=void 0,this._eventReporter=void 0}))}setupEventReporter(e,t,i){if(i)this._eventReporter=i;else{const i=e.urls.eventIngestionURL;if(i){this.logger.info("Event ingestion URL is present in the configuration");const{meetingId:n,credentials:{attendeeId:s,joinToken:o}}=e,r=new g.default(n,s,o),a=new h.default(r,i);this._eventReporter=new f.default(a,t)}}}checkBrowserSupportAndFeatureConfiguration(){const e=new a.default,t=`${e.name()} ${e.majorVersion()} (${e.version()})`;if(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()}.`),e.hasChromiumWebRTC()&&!this._configuration.enableUnifiedPlanForChromiumBasedBrowsers&&this.logger.error("Plan B SDP has been deprecated on Chromium-based browsers. Overriding configured value of 'enableUnifiedPlanForChromiumBasedBrowsers' to be true"),this._configuration.videoUplinkBandwidthPolicy)if(this.isSimulcastUplinkPolicy(this._configuration.videoUplinkBandwidthPolicy)){if(!e.hasChromiumWebRTC())throw new Error("Simulcast is only supported on Chromium-based browsers");this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!0}else this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1;this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&(e.hasChromiumWebRTC()?this.logger.info(`Simulcast is enabled for ${e.name()}`):(this._configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.logger.info("Simulcast is only supported on Chromium-based browsers")))}isSimulcastUplinkPolicy(e){return!(!e||!e.addObserver)}}},10589:function(e,t,i){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});const n=i(23731),s=i(12571),o=i(68015),r=i(76057);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.reconnectTimeoutMs=12e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackOffMs=1e3,this.reconnectLongBackOffMs=5e3,this.enableUnifiedPlanForChromiumBasedBrowsers=!0,this.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.keepLastFrameWhenPaused=!1,e&&((e=s.toLowerCasePropertyNames(e)).meeting&&(e=e.meeting),this.meetingId=e.meetingid,this.externalMeetingId=e.externalmeetingid,this.urls=new r.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,e.mediaplacement.eventingestionurl&&(this.urls.eventIngestionURL=e.mediaplacement.eventingestionurl)),t&&((t=s.toLowerCasePropertyNames(t)).attendee&&(t=t.attendee),this.credentials=new o.default,this.credentials.attendeeId=t.attendeeid,this.credentials.externalUserId=t.externaluserid,this.credentials.joinToken=t.jointoken)}}},68015:function(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:"<redacted>"}}}},87604:function(e,t){"use strict";var i;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"}(i=t.MeetingSessionLifecycleEvent||(t.MeetingSessionLifecycleEvent={})),t.default=i},41296:function(e,t){"use strict";var i;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"}(i=t.MeetingSessionLifecycleEventCondition||(t.MeetingSessionLifecycleEventCondition={})),t.default=i},13789:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(20289),s=i(25687);class o{constructor(e){this._statusCode=e}statusCode(){return this._statusCode}isFailure(){switch(this._statusCode){case s.default.AudioAuthenticationRejected:case s.default.AudioCallAtCapacity:case s.default.AudioInternalServerError:case s.default.AudioServiceUnavailable:case s.default.AudioDisconnected:case s.default.VideoCallAtSourceCapacity:case s.default.SignalingBadRequest:case s.default.SignalingInternalServerError:case s.default.SignalingRequestFailed:case s.default.StateMachineTransitionFailed:case s.default.ICEGatheringTimeoutWorkaround:case s.default.ConnectionHealthReconnect:case s.default.RealtimeApiFailed:case s.default.TaskFailed:case s.default.NoAttendeePresent:return!0;default:return!1}}isTerminal(){switch(this._statusCode){case s.default.Left:case s.default.AudioJoinedFromAnotherDevice:case s.default.AudioAuthenticationRejected:case s.default.AudioCallAtCapacity:case s.default.MeetingEnded:case s.default.AudioDisconnected:case s.default.TURNCredentialsForbidden:case s.default.SignalingBadRequest:case s.default.SignalingRequestFailed:case s.default.VideoCallAtSourceCapacity:case s.default.RealtimeApiFailed:case s.default.AudioAttendeeRemoved:return!0;default:return!1}}isAudioConnectionFailure(){switch(this._statusCode){case s.default.AudioAuthenticationRejected:case s.default.AudioInternalServerError:case s.default.AudioServiceUnavailable:case s.default.StateMachineTransitionFailed:case s.default.ICEGatheringTimeoutWorkaround:case s.default.SignalingBadRequest:case s.default.SignalingInternalServerError:case s.default.SignalingRequestFailed:case s.default.RealtimeApiFailed:case s.default.NoAttendeePresent:return!0;default:return!1}}toString(){switch(this._statusCode){case s.default.OK:return"Everything is OK so far.";case s.default.Left:return"The attendee left the meeting.";case s.default.AudioJoinedFromAnotherDevice:return"The attendee joined from another device.";case s.default.AudioDisconnectAudio:return"The audio connection failed.";case s.default.AudioAuthenticationRejected:return"The meeting rejected the attendee.";case s.default.AudioCallAtCapacity:return"The attendee couldn't join because the meeting was at capacity.";case s.default.AudioCallEnded:case s.default.TURNMeetingEnded:case s.default.MeetingEnded:return"The meeting ended.";case s.default.AudioInternalServerError:case s.default.AudioServiceUnavailable:case s.default.AudioDisconnected:return"The audio connection failed.";
1case s.default.VideoCallSwitchToViewOnly:return"The attendee couldn't start the local video because the maximum video capacity was reached.";case s.default.VideoCallAtSourceCapacity:return"The connection failed due to an internal server error.";case s.default.SignalingBadRequest:case s.default.SignalingInternalServerError:case s.default.SignalingRequestFailed:return"The signaling connection failed.";case s.default.StateMachineTransitionFailed:return"The state transition failed.";case s.default.ICEGatheringTimeoutWorkaround:return"Gathering ICE candidates timed out. In Chrome, this might indicate that the browser is in a bad state after reconnecting to VPN.";case s.default.ConnectionHealthReconnect:return"The meeting was reconnected.";case s.default.RealtimeApiFailed:return"The real-time API failed. This status code might indicate that the callback you passed to the real-time API threw an exception.";case s.default.TaskFailed:return"The connection failed. See the error message for more details.";case s.default.AudioDeviceSwitched:return"The attendee chose another audio device.";case s.default.IncompatibleSDP:return"The connection failed due to incompatible SDP.";case s.default.TURNCredentialsForbidden:return"The meeting ended, or the attendee was removed.";case s.default.NoAttendeePresent:return"The attendee was not present.";case s.default.AudioAttendeeRemoved:return"The meeting ended because attendee removed.";case s.default.AudioVideoWasRemovedFromPrimaryMeeting:return"The Primary meeting credentials provided are no longer valid. chime::DeleteAttendee may have been called on them.";default:{const e=this._statusCode;throw new Error(`Unhandled case: ${e}`)}}}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 o(s.default.SignalingRequestFailed):e.type===n.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE?new o(s.default.AudioVideoWasRemovedFromPrimaryMeeting):new o(s.default.OK)}static fromAudioStatus(e){switch(e){case 200:return new o(s.default.OK);case 301:return new o(s.default.AudioJoinedFromAnotherDevice);case 302:return new o(s.default.AudioDisconnectAudio);case 403:return new o(s.default.AudioAuthenticationRejected);case 409:return new o(s.default.AudioCallAtCapacity);case 410:return new o(s.default.MeetingEnded);case 411:return new o(s.default.AudioAttendeeRemoved);case 500:return new o(s.default.AudioInternalServerError);case 503:return new o(s.default.AudioServiceUnavailable);default:return 2===Math.floor(e/100)?new o(s.default.OK):new o(s.default.AudioDisconnected)}}static fromSignalingStatus(e){switch(e){case 206:return new o(s.default.VideoCallSwitchToViewOnly);case 509:return new o(s.default.VideoCallAtSourceCapacity);case 403:return new o(s.default.AudioAuthenticationRejected);case 409:return new o(s.default.AudioCallAtCapacity);default:switch(Math.floor(e/100)){case 2:return new o(s.default.OK);case 4:return new o(s.default.SignalingBadRequest);case 5:return new o(s.default.SignalingInternalServerError);default:return new o(s.default.SignalingRequestFailed)}}}}t.default=o},25687:function(e,t){"use strict";var i;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",e[e.AudioAttendeeRemoved=24]="AudioAttendeeRemoved",e[e.AudioVideoWasRemovedFromPrimaryMeeting=25]="AudioVideoWasRemovedFromPrimaryMeeting"}(i=t.MeetingSessionStatusCode||(t.MeetingSessionStatusCode={})),t.default=i},87215:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){this.username=null,this.password=null,this.ttl=null,this.uris=null}}},76057:function(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._eventIngestionURL=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}get eventIngestionURL(){return this.urlRewriter(this._eventIngestionURL)}set eventIngestionURL(e){this._eventIngestionURL=e}}},5723:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(){this.remoteVideoAvailable=!1,this.canStartLocalVideo=!1}equal(e){return this.remoteVideoAvailable===e.remoteVideoAvailable&&this.canStartLocalVideo===e.canStartLocalVideo}clone(){const e=new i;return e.remoteVideoAvailable=this.remoteVideoAvailable,e.canStartLocalVideo=this.canStartLocalVideo,e}}t.default=i},19358:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i){this.type=e,this.headers=t,this.payload=i}}},88947:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(38434),o=i(47237),r=i(19358),a=i(29141),d=i(37797),c=i(50334),l=i(67631),u=i(7387),h=i(20106);t.default=class{constructor(e,t,i,n,r){this.configuration=e,this.logger=t,this.webSocket=i,this.reconnectController=n,this.sigV4=r,this.observerQueue=new Set,this.isConnecting=!1,this.webSocket||(this.webSocket=new l.default(this.logger)),this.reconnectController||(this.reconnectController=new a.default(e.reconnectTimeoutMs,new s.default(e.reconnectFixedWaitMs,e.reconnectShortBackoffMs,e.reconnectLongBackoffMs))),this.sigV4||(this.sigV4=new c.default(this.configuration.chimeClient,this.configuration.awsClient)),o.default.addLogger(this.logger),o.default.register()}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.isConnecting?this.startConnecting(!1):this.logger.info("messaging session already started")}stop(){this.isClosed()?this.logger.info("no existing messaging session needs closing"):(this.isClosing=!0,this.webSocket.close(),o.default.removeLogger(this.logger))}forEachObserver(e){for(const t of this.observerQueue)d.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){return n(this,void 0,void 0,(function*(){this.isConnecting=!0;try{e||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0);let i=e?void 0:this.configuration.endpointUrl;if(void 0===i)try{i=(yield this.configuration.chimeClient.getMessagingSessionEndpoint().promise()).Endpoint.Url}catch(t){const e=new CloseEvent("close",{wasClean:!1,code:4999,reason:"Failed to getMessagingSessionEndpoint",bubbles:!1});return void this.closeEventHandler(e)}const n=this.prepareWebSocketUrl(i);this.logger.info(`opening connection to ${n}`),this.webSocket.create(n,[],!0),this.forEachObserver((t=>{t.messagingSessionDidStartConnecting&&t.messagingSessionDidStartConnecting(e)})),this.setUpEventListeners()}finally{this.isConnecting=!1}}))}prepareWebSocketUrl(e){const t=new Map;return t.set("userArn",[this.configuration.userArn]),t.set("sessionId",[this.configuration.messagingSessionId]),this.configuration.prefetchOn===h.default.Connect&&t.set("prefetch-on",[h.default.Connect]),this.sigV4.signURL("GET","wss","chime",e,"/connect","",t)}isClosed(){return this.webSocket.readyState()===u.default.None||this.webSocket.readyState()===u.default.Closed}openEventHandler(){this.reconnectController.reset(),this.isSessionEstablished=!1}receiveMessageHandler(e){try{const t=JSON.parse(e),i=t.Headers["x-amz-chime-event-type"],n=new r.default(i,t.Headers,t.Payload||null);if(this.isSessionEstablished||"SESSION_ESTABLISHED"!==i){if(!this.isSessionEstablished)return}else this.forEachObserver((e=>{e.messagingSessionDidStart&&e.messagingSessionDidStart()})),this.isSessionEstablished=!0;this.forEachObserver((e=>{e.messagingSessionDidReceiveMessage&&e.messagingSessionDidReceiveMessage(n)}))}catch(t){this.logger.error(`Messaging parsing failed: ${t}`)}}
1retryConnection(){return this.reconnectController.retryWithBackoff((()=>n(this,void 0,void 0,(function*(){yield this.startConnecting(!0)}))),null)}closeEventHandler(e){this.logger.info(`WebSocket close: ${e.code} ${e.reason}`),4999!==e.code&&this.webSocket.destroy(),!this.isClosing&&this.canReconnect(e.code)&&this.retryConnection()||(this.isClosing=!1,this.isSessionEstablished&&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}}},77500:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i,n,s){this.userArn=e,this.messagingSessionId=t,this.endpointUrl=i,this.chimeClient=n,this.awsClient=s,this.reconnectTimeoutMs=1e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackoffMs=1e3,this.reconnectLongBackoffMs=5e3,this.prefetchOn=void 0,this.messagingSessionId||(this.messagingSessionId=this.generateSessionId())}generateSessionId(){const e=new Uint32Array(1);return window.crypto.getRandomValues(e)[0].toString()}}},20106:function(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Connect="connect"}(i||(i={})),t.default=i},60214:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(18890);class s{constructor(e){this._id=e}id(){return this._id}base(){return this._id?this._id.split(s.MODALITY_SEPARATOR)[0]:""}modality(){if(!this._id)return"";const e=this._id.split(s.MODALITY_SEPARATOR);return 2===e.length?e[1]:""}hasModality(e){return""!==e&&this.modality()===e}withModality(e){const t=new s(this.base()+s.MODALITY_SEPARATOR+e);return""===e||""===this.base()||new s(t._id).modality()!==e?new s(this.base()):t}}t.default=s,s.MODALITY_SEPARATOR=n.default.Modality[0],s.MODALITY_CONTENT=n.default.Modality.substr(1)},97500:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(37797),s=i(23922),o=i(99416),r=i(20289),a=i(28660);t.default=class{constructor(e,t,i){this.signalingClient=e,this.intervalMs=t,this.logger=i,this.observerQueue=new Set,this.consecutivePongsUnaccountedFor=0,this.intervalScheduler=new s.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)n.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=>{a.Maybe.of(e.didMissPongs).map((t=>t.bind(e)(this.consecutivePongsUnaccountedFor)))}))),this.consecutivePongsUnaccountedFor+=1,this.pingId=this.pingId+1&4294967295;const e=r.SdkPingPongFrame.create();e.pingId=this.pingId,e.type=r.SdkPingPongType.PING,this.pingTimestampLocalMs=this.signalingClient.pingPong(e),this.logger.debug((()=>`sent ping ${this.pingId}`))}pong(e){const t=r.SdkPingPongFrame.create();t.pingId=e,t.type=r.SdkPingPongType.PONG,this.signalingClient.pingPong(t)}handleSignalingClientEvent(e){switch(e.type){case o.default.WebSocketOpen:this.startPingInterval();break;case o.default.WebSocketFailed:case o.default.WebSocketError:this.logger.warn(`stopped pinging (${o.default[e.type]})`),this.stopPingInterval();break;case o.default.WebSocketClosing:case o.default.WebSocketClosed:this.logger.info(`stopped pinging (${o.default[e.type]})`),this.stopPingInterval();break;case o.default.ReceivedSignalFrame:if(e.message.type!==r.SdkSignalFrame.Type.PING_PONG)break;if(e.message.pingPong.type===r.SdkPingPongType.PONG){const t=e.message.pingPong.pingId;if(t!==this.pingId){this.logger.warn(`unexpected ping id ${t} (expected ${this.pingId})`);break}let i;if(this.consecutivePongsUnaccountedFor=0,"number"!==typeof e.message.timestampMs)break;i=e.message.timestampMs,this.logger.debug((()=>`received pong ${t} with timestamp ${i}`));const n=e.timestampMs-this.pingTimestampLocalMs,s=Math.round(i-n/2),o=this.pingTimestampLocalMs-s;this.logger.info(`local clock skew estimate=${o}ms from ping-pong time=${n}ms`),this.forEachObserver((e=>{a.Maybe.of(e.didReceivePong).map((i=>i.bind(e)(t,o,n)))}))}else this.pong(e.message.pingPong.pingId)}}}},70983:function(e,t,i){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});const n=i(95308),s=i(19825),o=i(49576);t.default=class{constructor(e){this.state=new s.default,this._transcriptionController=e||new n.default(this)}realtimeSetLocalAttendeeId(e,t){this.state.localAttendeeId=e,this.state.localExternalUserId=t}realtimeSetAttendeeIdPresence(e,t,i,n,s){try{t&&(this.state.attendeeIdToExternalUserId[e]=i);for(const o of this.state.attendeeIdChangesCallbacks)o(e,t,i,n,s)}catch(o){this.onError(o)}}realtimeSubscribeToAttendeeIdPresence(e){try{this.state.attendeeIdChangesCallbacks.push(e)}catch(t){this.onError(t)}}realtimeUnsubscribeToAttendeeIdPresence(e){try{const t=this.state.attendeeIdChangesCallbacks.indexOf(e);-1!==t&&this.state.attendeeIdChangesCallbacks.splice(t,1)}catch(t){this.onError(t)}}realtimeSetLocalAudioInput(e){try{if(this.state.audioInput===e)return;this.setAudioInputEnabled(!1),this.state.audioInput=e,this.setAudioInputEnabled(!this.state.muted)}catch(t){this.onError(t)}}realtimeSetCanUnmuteLocalAudio(e){try{if(this.state.canUnmute===e)return;this.state.canUnmute=e;for(const t of this.state.setCanUnmuteLocalAudioCallbacks)t(e)}catch(t){this.onError(t)}}realtimeSubscribeToSetCanUnmuteLocalAudio(e){try{this.state.setCanUnmuteLocalAudioCallbacks.push(e)}catch(t){this.onError(t)}}realtimeUnsubscribeToSetCanUnmuteLocalAudio(e){try{const t=this.state.setCanUnmuteLocalAudioCallbacks.indexOf(e);-1!==t&&this.state.setCanUnmuteLocalAudioCallbacks.splice(t,1)}catch(t){this.onError(t)}}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(t){this.onError(t)}}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(e){try{const t=this.state.muteAndUnmuteLocalAudioCallbacks.indexOf(e);-1!==t&&this.state.muteAndUnmuteLocalAudioCallbacks.splice(t,1)}catch(t){this.onError(t)}}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(i){this.onError(i)}}realtimeUnsubscribeFromVolumeIndicator(e,t){try{if(t){const i=this.state.volumeIndicatorCallbacks[e].indexOf(t);-1!==i&&this.state.volumeIndicatorCallbacks[e].splice(i,1)}else delete this.state.volumeIndicatorCallbacks[e]}catch(i){this.onError(i)}}realtimeUpdateVolumeIndicator(e,t,i,n,s){try{i=this.applyLocalMuteOverride(e,i);const o=this.getVolumeIndicatorState(e);let r=!1,a=!1,d=!1;null!==i&&o.muted!==i&&(o.muted=i,a=!0,o.muted&&0!==o.volume&&(o.volume=0,r=!0)),o.muted||null===t||(o.volume!==t&&(o.volume=t,r=!0),null===o.muted&&(o.muted=!1,a=!0)),null!==n&&o.signalStrength!==n&&(o.signalStrength=n,d=!0),this.sendVolumeIndicatorChange(e,r,a,d,s)}catch(o){this.onError(o)}}realtimeSubscribeToLocalSignalStrengthChange(e){try{if(this.state.localSignalStrengthChangeCallbacks.push(e),null===this.state.localAttendeeId)return;this.sendLocalSignalStrengthChange(this.state.localAttendeeId,!0)}catch(t){this.onError(t)}}realtimeUnsubscribeToLocalSignalStrengthChange(e){try{const t=this.state.localSignalStrengthChangeCallbacks.indexOf(e);-1!==t&&this.state.localSignalStrengthChangeCallbacks.splice(t,1)}catch(t){this.onError(t)}}realtimeSubscribeToSendDataMessage(e){try{this.state.sendDataMessageCallbacks.push(e)}catch(t){this.onError(t)}}realtimeUnsubscribeFromSendDataMessage(e){try{const t=this.state.sendDataMessageCallbacks.indexOf(e);-1!==t&&this.state.sendDataMessageCallbacks.splice(t,1)}catch(t){this.onError(t)}}realtimeSendDataMessage(e,t,i){try{for(const n of this.state.sendDataMessageCallbacks)n(e,t,i)}catch(n){this.onError(n)}}realtimeSubscribeToReceiveDataMessage(e,t){try{this.state.receiveDataMessageCallbacks.has(e)?this.state.receiveDataMessageCallbacks.get(e).push(t):this.state.receiveDataMessageCallbacks.set(e,[t])}catch(i){this.onError(i)}}realtimeUnsubscribeFromReceiveDataMessage(e){try{this.state.receiveDataMessageCallbacks.delete(e)}catch(t){this.onError(t)}}realtimeReceiveDataMessage(e){try{if(this.state.receiveDataMessageCallbacks.has(e.topic))for(const t of this.state.receiveDataMessageCallbacks.get(e.topic))t(e)}catch(t){this.onError(t)}}realtimeSubscribeToFatalError(e){try{this.state.fatalErrorCallbacks.push(e)}catch(t){this.onError(t)}}realtimeUnsubscribeToFatalError(e){try{const t=this.state.fatalErrorCallbacks.indexOf(e);-1!==t&&this.state.fatalErrorCallbacks.splice(t,1)}catch(t){this.onError(t)}}get transcriptionController(){return this._transcriptionController}setAudioInputEnabled(e){if(this.state.audioInput)for(const t of this.state.audioInput.getTracks())t.enabled!==e&&(t.enabled=e)}applyLocalMuteOverride(e,t){const i=this.state.localAttendeeId,n=this.state.muted;return e!==i||null===this.state.audioInput?t:n}
1sendVolumeIndicatorChange(e,t,i,n,s){if(this.sendLocalSignalStrengthChange(e,n),!this.state.volumeIndicatorCallbacks.hasOwnProperty(e))return;const r=this.getVolumeIndicatorState(e),a=new o.default;if(t&&(a.volume=r.volume),i&&(a.muted=r.muted),n&&(a.signalStrength=r.signalStrength),!this.stateIsEmpty(a))for(const o of this.state.volumeIndicatorCallbacks[e])o(e,a.volume,a.muted,a.signalStrength,s)}sendLocalSignalStrengthChange(e,t){if(!t)return;if(e!==this.state.localAttendeeId)return;const i=this.getVolumeIndicatorState(e).signalStrength;if(null!==i)for(const n of this.state.localSignalStrengthChangeCallbacks)n(i)}getVolumeIndicatorState(e){return this.state.volumeIndicatorState.hasOwnProperty(e)||(this.state.volumeIndicatorState[e]=new o.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(i){}}}}},75910:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){this.attendeeIndex=null,this.attendeesInFrame=null}}},19825:function(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}}},49576:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){this.volume=null,this.muted=null,this.signalStrength=null}}},29141:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(44929);class s{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 i=this.shouldReconnect&&!this.hasPastReconnectDeadline();return i&&(this.backoffCancel=t,this.backoffTimer=new n.default(this.backoffPolicy.nextBackoffAmountMs()),this.backoffTimer.start((()=>{this.backoffCancel=null,e()}))),i}shouldOnlyRestartPeerConnection(){return this.onlyRestartPeerConnection}clone(){return new s(this.reconnectTimeoutMs,this.backoffPolicy)}setLastActiveTimestampMs(e){this.lastActiveTimestampMs=e}}t.default=s},37797:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(44929);class s extends n.default{constructor(){super(0)}static nextTick(e){setTimeout(e,0)}}t.default=s},23922:function(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}}},44929:function(e,t){"use strict";
1Object.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)}}},47293:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(4076),s=i(41944);class o{constructor(e){this.sdp=e}clone(){return new o(this.sdp)}static isRTPCandidate(e){const t=/candidate[:](\S+) (\d+)/g.exec(e);return null!==t&&"1"===t[2]}static linesToSDP(e){return new o(e.join(o.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:o.candidateTypeFromString(t[1])}static mediaType(e){const t=/m=(audio|video)/g.exec(e);if(null!==t)return t[1]}static mid(e){if(e.includes("a=mid:"))return e.replace(/^(a=mid:)/,"")}static direction(e){const t=/a=(sendrecv|sendonly|recvonly|inactive)/g.exec(e);if(null!==t)return 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()+o.CRLF))}static findActiveCameraSection(e){let t=0,i=!1;for(const n of e){if(/^m=video/.test(n)&&n.indexOf("sendrecv")>-1){i=!0;break}t++}return!1===i&&(t=-1),t}static parseSSRCMedia(e){const t=e.indexOf(" ");let i=0,n="",s="";i=o.extractSSRCFromAttributeLine(e);const r=e.indexOf(":",t);return r>-1?(n=e.substr(t+1,r-t-1),s=e.substr(r+1)):n=e.substr(t+1),[i,n,s]}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 o.splitLines(e).filter((e=>0===e.indexOf(t)))}lines(){return this.sdp.split(o.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 i of e){const e=i.replace(/^a=group:BUNDLE audio$/,"a=group:BUNDLE audio video");e===i?t.push(i):t.push(e)}return o.linesToSDP(t)}copyVideo(e){const t=e.split(o.CRLF),i=o.splitLines(this.sdp);let n=!1;for(const s of t)/^m=video/.test(s)?n=!0:/^m=/.test(s)&&(n=!1),n&&i.push(s);return o.linesToSDP(i)}withoutCandidateType(e){return o.linesToSDP(this.lines().filter((t=>o.candidateType(t)!==e)))}withoutServerReflexiveCandidates(){return this.withoutCandidateType(n.default.ServerReflexive)}withBandwidthRestriction(e,t){const i=this.lines(),n=[];for(const s of i)n.push(s),/^m=video/.test(s)&&(t?n.push("b=TIAS:"+1e3*e):n.push(`b=AS:${e}`));return o.linesToSDP(n)}withAudioMaxAverageBitrate(e){if(!e)return this.clone();e=Math.trunc(Math.min(Math.max(e,o.rfc7587LowestBitrate),o.rfc7587HighestBitrate));const t=this.lines(),i=o.findOpusFmtpAttributes(t),n=o.updateOpusFmtpAttributes(t,i,[`maxaveragebitrate=${e}`]);return o.linesToSDP(n)}withStereoAudio(){const e=this.lines(),t=o.findOpusFmtpAttributes(e),i=o.updateOpusFmtpAttributes(e,t,["stereo=1","sprop-stereo=1"]);return o.linesToSDP(i)}static findOpusFmtpAttributes(e){const t=/^a=rtpmap:\s*(\d+)\s+opus\/48000/;let i=!1;const n=[];for(const s of e)if(s.startsWith("m=audio")&&(n.push(null),i=!0),s.startsWith("m=video")&&(i=!1),i){const e=t.exec(s);null!==e&&(n[n.length-1]=`a=fmtp:${e[1]} `)}return n}static updateOpusFmtpAttributes(e,t,i){const n=[];let s=0,o=null;for(const r of e)if(r.startsWith("m=audio")&&(o=t[s],s++),r.startsWith("m=video")&&(o=null),o&&r.startsWith(o)){const e=r.slice(o.length).split(";"),t=[];for(const n of e){i.findIndex((e=>e.startsWith(n.split("=")[0])))<0&&t.push(n)}for(const n of i)t.push(n);n.push(o+t.join(";"))}else n.push(r);return n}withUnifiedPlanFormat(){let e=this.sdp;return e.includes("mozilla")?this.clone():(e=e.replace("o=-","o=mozilla-chrome"),new o(e))}getUniqueRtpHeaderExtensionId(e){const t=[];for(const n of e)if(/^a=extmap:/.test(n.trim())){const e=+n.split("a=extmap:")[1].split(" ")[0];t.push(e)}t.sort(((e,t)=>e-t));let i=0;for(const n of t){if(n-i>1)return i+1;i=n}return 14===i?-1:i+1}withVideoLayersAllocationRtpHeaderExtension(){const e=o.splitSections(this.sdp),t=[];for(let n of e){if(/^m=video/.test(n)){const e=o.splitLines(n),i=[],s=this.getUniqueRtpHeaderExtensionId(e);if(-1===s){t.push(n);continue}for(const t of e)if(i.push(t),/^a=sendrecv/.test(t.trim())){const e="a=extmap:"+s+" http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00";i.push(e)}n=i.join(o.CRLF)+o.CRLF}t.push(n)}const i=t.join("");return new o(i)}preferH264IfExists(){const e=this.sdp,t=o.splitSections(e);if(t.length<2)return new o(this.sdp);const i=[];for(let s=0;s<t.length;s++){if(/^m=video/.test(t[s])){const e=o.splitLines(t[s]);let i=0,n=0;if(e.forEach((e=>
1{if(/^a=rtpmap:/.test(e)){const t=/^a=rtpmap:([0-9]+)\s/.exec(e);e.toLowerCase().includes("vp8")?i=parseInt(t[1],10):e.toLowerCase().includes("h264")&&(n=parseInt(t[1],10))}})),0!==i&&0!==n){const t=e[0].split(" ");let s=-1,o=-1;for(let e=3;e<t.length;e++){const r=parseInt(t[e],10);r===i?s=e:r===n&&(o=e)}s<o&&(t[s]=n.toString(),t[o]=i.toString()),e[0]=t.join(" ")}t[s]=e.join(o.CRLF)+o.CRLF}i.push(t[s])}const n=i.join("");return new o(n)}withOldFashionedMungingSimulcast(e){if(e<2)return this.clone();const t=this.sdp,i=o.splitSections(t);if(i.length<2)return new o(this.sdp);const n=o.findActiveCameraSection(i);if(-1===n)return new o(this.sdp);let s="",r="";o.matchPrefix(i[n],"a=ssrc:").forEach((e=>{const t=o.parseSSRCMedia(e);"cname"===t[1]?s=t[2]:"msid"===t[1]&&(r=t[2])}));const a=o.matchPrefix(i[n],"a=ssrc-group:FID ");if(""===s||""===r||a.length<1)return new o(this.sdp);const d=o.extractSSRCsFromFIDGroupLine(a[0]),c=i[n].trim().split(o.CRLF).filter((e=>0!==e.indexOf("a=ssrc:")&&0!==e.indexOf("a=ssrc-group:"))),l=[],[u,h]=d.split(" ").map((e=>parseInt(e,10)));let f=u,g=h;for(let o=0;o<e;o++)c.push("a=ssrc:"+f+" cname:"+s),c.push("a=ssrc:"+f+" msid:"+r),c.push("a=ssrc:"+g+" cname:"+s),c.push("a=ssrc:"+g+" msid:"+r),c.push("a=ssrc-group:FID "+f+" "+g),l.push(f),f+=1,g=f+1;c.push("a=ssrc-group:SIM "+l.join(" ")),i[n]=c.join(o.CRLF)+o.CRLF;const p=i.join("");return new o(p)}ssrcForVideoSendingSection(){const e=this.sdp,t=o.splitSections(e);if(t.length<2)return"";const i=o.findActiveCameraSection(t);if(-1===i)return"";const n=o.matchPrefix(t[i],"a=ssrc-group:FID ");if(n.length<1)return"";const s=o.extractSSRCsFromFIDGroupLine(n[0]),[r]=s.split(" ").map((e=>parseInt(e,10)));return r.toString()}videoSendSectionHasDifferentSSRC(e){const t=this.ssrcForVideoSendingSection(),i=e.ssrcForVideoSendingSection();if(""===t||""===i)return!1;return parseInt(t,10)!==parseInt(i,10)}removeH264SupportFromSendSection(){const e=this.sdp,t=o.splitSections(e),i=o.findActiveCameraSection(t);if(-1===i)return new o(this.sdp);const n=t[i],s=o.splitLines(n),r=[],a=new Map;s.forEach((e=>{if(/^a=rtpmap:/.test(e)){const t=/^a=rtpmap:([0-9]+)\s/.exec(e);t&&e.toLowerCase().includes("h264")&&r.push(parseInt(t[1],10))}if(/^a=fmtp:/.test(e)){const t=/^a=fmtp:([0-9]+) apt=([0-9]+)/.exec(e);if(t&&3===t.length){const e=parseInt(t[1],10),i=parseInt(t[2],10);a.has(i)?a.get(i).push(e):a.set(i,[e])}}}));const d=new Set;for(const o of r){d.add(o);const e=a.get(o);if(e)for(const t of e)d.add(t)}if(r.length>0){const e=s[0].split(" ");s[0]=e.filter((e=>!d.has(parseInt(e)))).join(" ")}const c=s.filter((e=>{if(!e.includes("rtpmap")&&!e.includes("rtcp-fb")&&!e.includes("fmtp"))return!0;for(const t of d)if(e.includes(t.toString()))return!1;return!0}));t[i]=c.join(o.CRLF)+o.CRLF;const l=t.join("");return new o(l)}mediaSections(){const e=o.splitSections(this.sdp);if(e.length<2)return[];const t=[];for(let i=1;i<e.length;i++){const n=new s.default,r=o.splitLines(e[i]);for(const e of r){const t=o.mediaType(e);if(void 0!==t){n.mediaType=t;continue}const i=o.direction(e);if(void 0!==i){n.direction=i;continue}const s=o.mid(e);void 0===s||(n.mid=s)}t.push(n)}return t}}t.default=o,o.CRLF="\r\n",o.rfc7587LowestBitrate=6e3,o.rfc7587HighestBitrate=51e4},4076:function(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.SDPCandidateType=void 0,function(e){e.Host="host",e.ServerReflexive="srflx",e.PeerReflexive="prflx",e.Relay="relay"}(i=t.SDPCandidateType||(t.SDPCandidateType={})),t.default=i},41944:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},73320:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(99591);class s{constructor(e){this.logger=e}compress(e,t){if(t.length>0){const e=Math.min(t.length,s.MAX_DICTIONARY_SIZE);t=t.slice(0,e)}const i={memLevel:s.Z_MEM_LEVEL,dictionary:t};return n.deflateRaw(e,i)}decompress(e,t){if(t.length>0){const e=Math.min(t.length,s.MAX_DICTIONARY_SIZE);t=t.slice(0,e)}const i={to:"string",dictionary:t,chunkSize:4096};let o="";try{o=n.inflateRaw(e,i)}catch(r){this.logger.error(`failed to decompress the string with error: [${r}]`)}return o}}t.default=s,s.Z_MEM_LEVEL=9,s.MAX_DICTIONARY_SIZE=31744},19678:function(e,t,i){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});const n=i(13860),s=i(36850),o=i(79553),r=i(93013);t.default=class{constructor(e){this.logger=e,this.currentState=o.SessionStateControllerState.NotConnected,this.deferredAction=null,this.deferredWork=null}perform(e,t){const i=this.currentState;if(i===o.SessionStateControllerState.NotConnected&&e===n.SessionStateControllerAction.Connect)this.transition(o.SessionStateControllerState.Connecting,e);else if(i===o.SessionStateControllerState.Connecting&&e===n.SessionStateControllerAction.Fail)this.transition(o.SessionStateControllerState.Disconnecting,e);else if(i===o.SessionStateControllerState.Connecting&&e===n.SessionStateControllerAction.FinishConnecting)this.transition(o.SessionStateControllerState.Connected,e);else if(i===o.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Disconnect)this.transition(o.SessionStateControllerState.Disconnecting,e);else if(i===o.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Reconnect)this.transition(o.SessionStateControllerState.Connecting,e);else if(i===o.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Fail)this.transition(o.SessionStateControllerState.Disconnecting,e);else if(i===o.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Update)this.transition(o.SessionStateControllerState.Updating,e);else if(i===o.SessionStateControllerState.Updating&&e===n.SessionStateControllerAction.Fail)this.transition(o.SessionStateControllerState.Disconnecting,e);else if(i===o.SessionStateControllerState.Updating&&e===n.SessionStateControllerAction.FinishUpdating)this.transition(o.SessionStateControllerState.Connected,e);else{if(i!==o.SessionStateControllerState.Disconnecting||e!==n.SessionStateControllerAction.FinishDisconnecting)return this.canDefer(e)?(this.logger.info(`deferring transition from ${o.SessionStateControllerState[this.currentState]} with ${n.SessionStateControllerAction[e]}`),this.deferAction(e,t),r.SessionStateControllerTransitionResult.DeferredTransition):(this.logger.warn(`no transition found from ${o.SessionStateControllerState[this.currentState]} with ${n.SessionStateControllerAction[e]}`),r.SessionStateControllerTransitionResult.NoTransitionAvailable);this.transition(o.SessionStateControllerState.NotConnected,e)}try{t()}catch(s){return this.logger.error(`error during state ${o.SessionStateControllerState[this.currentState]} with action ${n.SessionStateControllerAction[e]}: ${s}`),this.logger.info(`rolling back transition to ${o.SessionStateControllerState[i]}`),this.currentState=i,r.SessionStateControllerTransitionResult.TransitionFailed}return this.performDeferredAction(),r.SessionStateControllerTransitionResult.Transitioned}state(){return this.currentState}transition(e,t){this.logger.info(`transitioning from ${o.SessionStateControllerState[this.currentState]} to ${o.SessionStateControllerState[e]} with ${n.SessionStateControllerAction[t]}`),this.currentState=e}deferPriority(e){switch(e){case n.SessionStateControllerAction.Disconnect:return s.SessionStateControllerDeferPriority.VeryHigh;case n.SessionStateControllerAction.Fail:return s.SessionStateControllerDeferPriority.High;case n.SessionStateControllerAction.Reconnect:return s.SessionStateControllerDeferPriority.Medium;case n.SessionStateControllerAction.Update:return s.SessionStateControllerDeferPriority.Low;default:return s.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)!==s.SessionStateControllerDeferPriority.DoNotDefer&&(this.currentState===o.SessionStateControllerState.Connecting||this.currentState===o.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 ${o.SessionStateControllerState[this.currentState]}`)}}},13860:function(e,t){"use strict";var i;
1Object.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"}(i=t.SessionStateControllerAction||(t.SessionStateControllerAction={})),t.default=i},36850:function(e,t){"use strict";var i;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"}(i=t.SessionStateControllerDeferPriority||(t.SessionStateControllerDeferPriority={})),t.default=i},79553:function(e,t){"use strict";var i;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"}(i=t.SessionStateControllerState||(t.SessionStateControllerState={})),t.default=i},93013:function(e,t){"use strict";var i;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"}(i=t.SessionStateControllerTransitionResult||(t.SessionStateControllerTransitionResult={})),t.default=i},41208:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(90543),s=i(44929),o=i(20289),r=i(74046),a=i(7387),d=i(42902),c=i(99416);class l{constructor(e,t){this.webSocket=e,this.logger=t,this.unloadHandler=null,this.closeEventHandler=e=>{this.deactivatePageUnloadHandler(),this.resetConnection(),this.sendEvent(new d.default(this,c.default.WebSocketClosed,null,e.code,e.reason)),this.serviceConnectionRequestQueue()},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=o.SdkSignalFrame.create();return t.type=o.SdkSignalFrame.Type.PING_PONG,t.pingPong=e,this.sendMessage(t),t.timestampMs}join(e){this.logger.info("sending join");const t=o.SdkJoinFrame.create();t.protocolVersion=2,t.flags=o.SdkJoinFlags.HAS_STREAM_UPDATE;const i=new n.default;i.supportsSenderSideBandwidthEstimation()&&(t.flags|=o.SdkJoinFlags.USE_SEND_SIDE_BWE),t.flags|=e.sendBitrates?o.SdkJoinFlags.SEND_BITRATES:0;const s={platformName:i.name(),platformVersion:i.version(),clientSource:r.default.sdkName,chimeSdkVersion:r.default.sdkVersion};if(e.applicationMetadata){const{appName:t,appVersion:i}=e.applicationMetadata;s.appName=t,s.appVersion=i}t.clientDetails=o.SdkClientDetails.create(s),t.audioSessionId=this.audioSessionId,t.wantsCompressedSdp=l.CLIENT_SUPPORTS_COMPRESSION;const a=o.SdkSignalFrame.create();a.type=o.SdkSignalFrame.Type.JOIN,a.join=t,this.sendMessage(a)}subscribe(e){const t=o.SdkSubscribeFrame.create();if(t.sendStreams=[],t.sdpOffer=e.sdpOffer,e.connectionTypeHasVideo&&(t.receiveStreamIds=e.receiveStreamIds),e.audioHost&&(t.audioCheckin=e.audioCheckin,t.audioHost=e.audioHost,t.audioMuted=e.audioMuted,!e.audioCheckin)){const i=o.SdkStreamDescriptor.create();i.mediaType=o.SdkStreamMediaType.AUDIO,i.trackLabel="AmazonChimeExpressAudio",i.attendeeId=e.attendeeId,i.streamId=1,i.groupId=1,i.framerate=15,i.maxBitrateKbps=600,i.avgBitrateBps=4e5,t.sendStreams.push(i)}if(t.compressedSdpOffer=e.compressedSdpOffer,t.duplex=o.SdkStreamServiceType.RX,e.localVideoEnabled){t.duplex=o.SdkStreamServiceType.DUPLEX;for(let i=0;i<e.videoStreamDescriptions.length;i++){const n=e.videoStreamDescriptions[i].clone();n.attendeeId=e.attendeeId,t.sendStreams.push(n.toStreamDescriptor())}}const i=o.SdkSignalFrame.create();i.type=o.SdkSignalFrame.Type.SUBSCRIBE,i.sub=t,this.sendMessage(i)}remoteVideoUpdate(e,t){const i=o.SdkRemoteVideoUpdateFrame.create();i.addedOrUpdatedVideoSubscriptions=e.map(this.convertVideoSubscriptionConfiguration),i.removedVideoSubscriptionMids=t;const n=o.SdkSignalFrame.create();n.type=o.SdkSignalFrame.Type.REMOTE_VIDEO_UPDATE,n.remoteVideoUpdate=i,this.sendMessage(n)}convertVideoSubscriptionConfiguration(e){const t=new o.SdkVideoSubscriptionConfiguration;return t.mid=e.mid,t.attendeeId=e.attendeeId,t.streamId=e.streamId,t}leave(){const e=o.SdkSignalFrame.create();e.type=o.SdkSignalFrame.Type.LEAVE,e.leave=o.SdkLeaveFrame.create(),this.sendMessage(e),this.logger.debug((()=>"sent leave"))}sendClientMetrics(e){const t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.CLIENT_METRIC,t.clientMetric=e,this.sendMessage(t)}sendDataMessage(e){const t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.DATA_MESSAGE,t.dataMessage=e,this.sendMessage(t)}closeConnection(){var e,t;if(this.webSocket.readyState()!==a.default.None&&this.webSocket.readyState()!==a.default.Closed){this.isClosing=!0,this.sendEvent(new d.default(this,c.default.WebSocketClosing,null));const i=new s.default(l.CLOSE_EVENT_TIMEOUT_MS),n=e=>{var t,s;null===(s=(t=this.webSocket).removeEventListener)||void 0===s||s.call(t,"close",n),i.stop(),this.closeEventHandler(e)};null===(t=(e=this.webSocket).removeEventListener)||void 0===t||t.call(e,"close",this.closeEventHandler),this.webSocket.addEventListener("close",n),i.start((()=>{n(new CloseEvent("close",{wasClean:!1,code:1006,reason:"",bubbles:!1}))}
1)),this.webSocket.close(),this.deactivatePageUnloadHandler()}else this.logger.info("no existing signaling client connection needs closing"),this.serviceConnectionRequestQueue()}ready(){return this.webSocket.readyState()===a.default.Open&&!this.isClosing&&this.wasOpened}mute(e){const t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.AUDIO_CONTROL;const i=o.SdkAudioControlFrame.create();i.muted=e,t.audioControl=i,this.sendMessage(t)}pause(e){const t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.PAUSE,t.pause=o.SdkPauseResumeFrame.create(),t.pause.streamIds=e,this.sendMessage(t)}resume(e){const t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.RESUME,t.pause=o.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(o.SdkSignalFrame.encode(e).finish());if(this.ready()){if(!this.webSocket.send(t))return void this.sendEvent(new d.default(this,c.default.WebSocketSendMessageFailure,null));this.sendEvent(new d.default(this,c.default.WebSocketSentMessage,null))}else this.sendEvent(new d.default(this,c.default.WebSocketSkippedMessage,null))}receiveMessage(e){let t;try{t=o.SdkSignalFrame.decode(e)}catch(i){return this.logger.info(`failed to decode: ${e}`),void this.sendEvent(new d.default(this,c.default.ProtocolDecodeFailure,null))}this.logger.debug((()=>`received: ${JSON.stringify(t)}`)),this.webSocket.readyState()===a.default.Open?this.sendEvent(new d.default(this,c.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 d.default(this,c.default.WebSocketConnecting,null))}sendEvent(e){switch(e.type){case c.default.WebSocketMessage:case c.default.ReceivedSignalFrame:case c.default.WebSocketSentMessage:this.logger.debug((()=>`notifying event: ${c.default[e.type]}`));break;case c.default.WebSocketSkippedMessage:this.logger.debug((()=>`notifying event: ${c.default[e.type]}, websocket state=${a.default[this.webSocket.readyState()]}`));break;default:this.logger.info(`notifying event: ${c.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 d.default(this,c.default.WebSocketOpen,null))})),this.webSocket.addEventListener("message",(e=>{this.sendEvent(new d.default(this,c.default.WebSocketMessage,null)),this.receiveMessage(this.stripFrameTypeRTC(new Uint8Array(e.data)))})),this.webSocket.addEventListener("close",this.closeEventHandler),this.webSocket.addEventListener("error",(()=>{!this.isClosing||this.wasOpened?this.wasOpened?(this.logger.error("received error while connected"),this.sendEvent(new d.default(this,c.default.WebSocketError,null))):(this.logger.error("failed to connect"),this.sendEvent(new d.default(this,c.default.WebSocketFailed,null))):this.logger.info("ignoring error closing signaling while connecting")}))}activatePageUnloadHandler(){this.unloadHandler=()=>{this.leave()};const e=i.g;e.window&&e.window.addEventListener&&window.addEventListener("unload",this.unloadHandler)}deactivatePageUnloadHandler(){const e=i.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]}promoteToPrimaryMeeting(e){const t=o.SdkMeetingSessionCredentials.create();t.attendeeId=e.attendeeId,t.externalUserId=e.externalUserId,t.joinToken=e.joinToken;const i=o.SdkPrimaryMeetingJoinFrame.create();i.credentials=t;const n=o.SdkSignalFrame.create();n.type=o.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN,n.primaryMeetingJoin=i,this.sendMessage(n)}demoteFromPrimaryMeeting(){const e=o.SdkPrimaryMeetingLeaveFrame.create(),t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE,t.primaryMeetingLeave=e,this.sendMessage(t)}}t.default=l,l.FRAME_TYPE_RTC=5,l.CLOSE_EVENT_TIMEOUT_MS=2e3,l.CLIENT_SUPPORTS_COMPRESSION=!0},3920:function(e,t){"use strict";
1Object.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]}}},42902:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(99416);t.default=class{constructor(e,t,i,n,s){this.client=e,this.type=t,this.message=i,this.closeCode=n,this.closeReason=s,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}}}},99416:function(e,t){"use strict";var i;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"}(i=t.SignalingClientEventType||(t.SignalingClientEventType={})),t.default=i},82168:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i){this.maxVideos=e,this.sendBitrates=t,this.applicationMetadata=i}}},46729:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(e,t,i,n,s,o,r,a,d,c){this.attendeeId=e,this.sdpOffer=t,this.audioHost=i,this.audioMuted=n,this.audioCheckin=s,this.receiveStreamIds=o,this.localVideoEnabled=r,this.videoStreamDescriptions=a,this.connectionTypeHasVideo=d,this.compressedSdpOffer=c}}},9101:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},50334:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(74046);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,i,n){const s=this.awsClient.util.crypto.hmac("AWS4"+e,t,"buffer"),o=this.awsClient.util.crypto.hmac(s,i,"buffer"),r=this.awsClient.util.crypto.hmac(o,n,"buffer");return this.awsClient.util.crypto.hmac(r,"aws4_request","buffer")}signURL(e,t,i,s,o,r,a){const d=this.getDateTimeString(),c=this.getDateString(d),l=this.chimeClient.config.region,u="host:"+s.toLowerCase()+"\n",h=c+"/"+l+"/"+i+"/aws4_request",f=this.chimeClient.config.credentials;let g=new Map;g.set("X-Amz-Algorithm",["AWS4-HMAC-SHA256"]),g.set("X-Amz-Credential",[encodeURIComponent(f.accessKeyId+"/"+h)]),g.set("X-Amz-Date",[d]),g.set("X-Amz-Expires",["10"]),g.set("X-Amz-SignedHeaders",["host"]),f.sessionToken&&g.set("X-Amz-Security-Token",[encodeURIComponent(f.sessionToken)]),g.set(n.default.X_AMZN_VERSION,[encodeURIComponent(n.default.sdkVersion)]),g.set(n.default.X_AMZN_USER_AGENT,[encodeURIComponent(n.default.sdkUserAgentLowResolution)]),null===a||void 0===a||a.forEach(((e,t)=>{const i=encodeURIComponent(t);e.sort().forEach((e=>{g.has(i)||g.set(i,[]),g.get(i).push(encodeURIComponent(e))}))}));let p="";g=new Map([...g.entries()].sort()),g.forEach(((e,t)=>{e.forEach((e=>{p.length&&(p+="&"),p+=t+"="+e}))}));const m=e+"\n"+o+"\n"+p+"\n"+u+"\nhost\n"+this.awsClient.util.crypto.sha256(r,"hex"),v="AWS4-HMAC-SHA256\n"+d+"\n"+c+"/"+l+"/"+i+"/aws4_request\n"+this.awsClient.util.crypto.sha256(m,"hex"),S=this.getSignatureKey(f.secretAccessKey,c,l,i),b=this.awsClient.util.crypto.hmac(S,v,"hex");
1return t+"://"+s+o+"?"+(p+"&X-Amz-Signature="+b)}}},17606:function(e,t){"use strict";var i;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"}(i=t.SimulcastLayers||(t.SimulcastLayers={})),t.default=i},79880:function(e,t){"use strict";var i;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"}(i=t.AudioLogEvent||(t.AudioLogEvent={})),t.default=i},64015:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(56196),s=i(99496),o=i(86893),r=i(62811),a=i(87604),d=i(41296),c=i(23922),l=i(20289),u=i(28660),h=i(79880),f=i(40155);class g{constructor(e,t,i,n=g.INTERVAL_MS){this.audioVideoController=e,this.logger=t,this.browserBehavior=i,this.interval=n,this.intervalScheduler=null,this.metricsAddTime=(e,t,i)=>{},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,i){const n=this.toSuffix(e);this.logEventTime("meeting"+n,t,i)}logStateTimeout(e,t){const i=this.toSuffix(e);this.logEvent("meeting_session_state_timeout",Object.assign(Object.assign({},t),{state:`state${i}`}))}logAudioEvent(e,t){const i="audio"+this.toSuffix(h.default[e]);this.logEvent(i,t)}logVideoEvent(e,t){const i="video"+this.toSuffix(f.default[e]);this.logEvent(i,t)}logEventTime(e,t,i={}){const n=Object.assign(Object.assign({},i),{call_id:this.audioVideoController.configuration.meetingId,client_type:g.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 i={status:t,status_code:`${e.statusCode()}`};this.logEvent("meeting_session_status",i),e.isTerminal()&&this.logEvent("meeting_session_stopped",i),e.isAudioConnectionFailure()&&this.logEvent("meeting_session_audio_failed",i),e.isFailure()&&this.logEvent("meeting_session_failed",i)}logLifecycleEvent(e,t){const i={lifecycle_event:`lifecycle${this.toSuffix(a.default[e])}`,lifecycle_event_code:`${e}`,lifecycle_event_condition:`condition${this.toSuffix(d.default[t])}`,lifecycle_event_condition_code:`${t}`};this.logEvent("meeting_session_lifecycle",i)}logEvent(e,t={}){const i=Object.assign(Object.assign({},t),{call_id:this.audioVideoController.configuration.meetingId,client_type:g.CLIENT_TYPE});this.logger.debug((()=>`[DefaultStatsCollector] ${e}: ${JSON.stringify(i)}`)),this.metricsLogEvent(e,i)}start(e,t,i){return!this.intervalScheduler&&(this.logger.info("Starting DefaultStatsCollector"),this.signalingClient=e,this.videoStreamIndex=t,this.clientMetricReport=i||new o.default(this.logger,this.videoStreamIndex,this.audioVideoController.configuration.credentials.attendeeId),this.intervalScheduler=new c.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 i=t?this.clientMetricReport.streamMetricReports[Number(e.ssrc)]:this.clientMetricReport.globalMetricReport;let n;n=t?this.clientMetricReport.getMetricMap(i.mediaType,i.direction):this.clientMetricReport.getMetricMap();for(const s in e)s in n&&(i.previousMetrics[s]=i.currentMetrics[s],i.currentMetrics[s]=e[s])}processRawMetricReports(e){this.clientMetricReport.currentSsrcs={};const t=Date.now();for(const i of e){const e=this.isStreamRawMetricReport(i.type);if(e){const e=this.clientMetricReport.streamMetricReports[Number(i.ssrc)];if(e)e.streamId=this.videoStreamIndex.streamIdForSSRC(Number(i.ssrc));else{const e=new r.default;e.mediaType=this.getMediaType(i),e.direction=this.getDirectionType(i),this.videoStreamIndex.allStreams().empty()||(e.streamId=this.videoStreamIndex.streamIdForSSRC(Number(i.ssrc))),this.clientMetricReport.streamMetricReports[Number(i.ssrc)]=e}this.clientMetricReport.currentSsrcs[Number(i.ssrc)]=1}this.updateMetricValues(i,e)}this.clientMetricReport.removeDestroyedSsrcs(),this.clientMetricReport.previousTimestampMs=this.clientMetricReport.currentTimestampMs,this.clientMetricReport.currentTimestampMs=t,this.clientMetricReport.print()}addMetricFrame(e,t,i,n){const s=i.type,o=i.transform,r=i.source,a=t.streamMetricFrames.length,d=t.streamMetricFrames[a-1];if(s){const i=l.SdkMetric.create();i.type=s,i.value=o(r||e,n),n?d.metrics.push(i):t.globalMetrics.push(i)}}addGlobalMetricsToProtobuf(e){const t=this.clientMetricReport.getMetricMap();for(const i in this.clientMetricReport.globalMetricReport.currentMetrics)this.addMetricFrame(i,e,t[i])}addStreamMetricsToProtobuf(e){for(const t in this.clientMetricReport.streamMetricReports){const i=this.clientMetricReport.streamMetricReports[t],n=l.SdkStreamMetricFrame.create();n.streamId=i.streamId,n.metrics=[],e.streamMetricFrames.push(n);const s=this.clientMetricReport.getMetricMap(i.mediaType,i.direction);for(const o in i.currentMetrics)this.addMetricFrame(o,e,s[o],Number(t))}}makeClientMetricProtobuf(){const e=l.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?s.default.AUDIO:s.default.VIDEO}getDirectionType(e){return-1!==e.id.toLowerCase().indexOf("send")||-1!==e.id.toLowerCase().indexOf("outbound")||"outbound-rtp"===e.type?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(g.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)===s.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 i of e)this.isValidRawMetricReport(i)&&t.push(i);return t}handleRawMetricReports(e){const t=this.filterRawMetricReports(e);this.logger.debug((()=>`Filtered raw metrics : ${JSON.stringify(t)}`)),this.processRawMetricReports(t);const i=this.makeClientMetricProtobuf();this.sendClientMetricProtobuf(i),this.audioVideoController.forEachObserver((e=>{u.Maybe.of(e.metricsDidReceive).map((t=>t.bind(e)(this.clientMetricReport.clone())))}
1))}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 i={};t.names().forEach((e=>{i[e]=t.stat(e)})),i.id=t.id,i.type=t.type,i.timestamp=t.timestamp,e.push(i)})),this.handleRawMetricReports(e)}),(e=>{this.logger.error(e.message)}))}compareMajorVersion(e){const t=parseInt(this.browserBehavior.version().split(".")[0]),i=parseInt(e.split(".")[0]);return i===t?0:i>t?1:-1}}t.default=g,g.INTERVAL_MS=1e3,g.FIREFOX_UPDATED_GET_STATS_VERSION="66.0.0",g.CLIENT_TYPE="amazon-chime-sdk-js"},40155:function(e,t){"use strict";var i;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"}(i=t.VideoLogEvent||(t.VideoLogEvent={})),t.default=i},38358:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(40155),o=i(31789);class r extends o.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 i=t.getAudioTracks();if(this.context.browserBehavior.requiresUnifiedPlan())this.context.logger.info("attaching audio track to peer connection (unified-plan)"),yield e.setAudioInput(i.length?i[0]:null);else{this.context.logger.info("attaching audio track to peer connection (plan-b)");const e=this.context.peer.getSenders();t.getAudioTracks().forEach((i=>{e.find((e=>e.track.id===i.id))||(this.context.localAudioSender=this.context.peer.addTrack(i,t))}))}}else yield e.setAudioInput(null),this.context.logger.info("no audio track");const i=this.context.activeVideoInput;if(i){const t=i.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],i))}n&&(this.context.statsCollector.logVideoEvent(s.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},31789:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};
1Object.defineProperty(t,"__esModule",{value:!0});const s=i(21124),o=i(4456);t.default=class{constructor(e){this.logger=e,this.taskName="BaseTask",this.parentTask=null,this.status=o.default.IDLE,this.run=this.baseRun.bind(this,this.run),this.cancel=this.baseCancel.bind(this,this.cancel)}once(...e){return new s.default(this.logger,this,e)}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 o.default.RUNNING:this.logAndThrow(`${this.name()} is already running`);case o.default.CANCELED:this.logAndThrow(`${this.name()} was canceled before running`);case o.default.FINISHED:this.logAndThrow(`${this.name()} was already finished`)}this.status=o.default.RUNNING,yield e.call(this),this.logger.info(`${this.name()} took ${Math.round(Date.now()-t)} ms`)}catch(t){throw t}finally{this.status!==o.default.CANCELED&&(this.status=o.default.FINISHED)}}))}baseCancel(e){this.status!==o.default.CANCELED&&this.status!==o.default.FINISHED?(this.logger.info(`canceling task ${this.name()}`),this.status=o.default.CANCELED,e.call(this)):this.logger.info(`Not canceling ${this.name()}: state is ${this.status}`)}}},53216:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(31789);class o extends s.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=o},47408:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(99416),o=i(31789);class r extends o.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 t of this.context.removableObservers)t.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.videoUplinkBandwidthPolicy.setTransceiverController&&this.context.videoUplinkBandwidthPolicy.setTransceiverController(void 0),this.context.videoDownlinkBandwidthPolicy.bindToTileController&&this.context.videoDownlinkBandwidthPolicy.bindToTileController(void 0);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 i=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===s.default.WebSocketClosed&&(this.signalingClient.removeObserver(this),e())}}(this.context.signalingClient);this.taskCanceler=i,this.context.signalingClient.registerObserver(i)}))}}t.default=r},5054:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Prom
1ise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(31789);class o extends s.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 i=e.streams[0];"audio"===t.kind?this.context.audioMixController.bindAudioStream(i):"video"!==t.kind||this.trackIsVideoInput(t)||this.addRemoteVideoTrack(t,i)}}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}`);const t={optional:[{googCpuOveruseDetection:!1},{googCombinedAudioVideoBwe:!0}]};this.context.peer?this.context.logger.info("reusing peer connection"):(this.context.logger.info("creating new peer connection"),this.context.peer=new RTCPeerConnection(e,t),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){var i;let n=t.id;this.context.browserBehavior.requiresUnifiedPlan()||(t=new MediaStream([e]),n=e.id);const s=this.context.videoStreamIndex.attendeeIdForTrack(n);let o,r;if(this.context.videoTileController.getVideoTileForAttendeeId?(r=this.context.videoTileController.getVideoTileForAttendeeId(s),o=!!(null===(i=null===r||void 0===r?void 0:r.state())||void 0===i?void 0:i.boundVideoStream)):o=this.context.videoTileController.haveVideoTileForAttendeeId(s),o)return void this.context.logger.info(`Not adding remote track. Already have tile for attendeeId: ${s}`);r||(r=this.context.videoTileController.addVideoTile(),this.logger.info(`Created video tile ${r.id()}`));let a,d,c=this.context.videoStreamIndex.streamIdForTrack(n);"undefined"===typeof c&&(this.logger.warn(`stream not found for tile=${r.id()} track=${n}`),c=null);for(let g=0;g<this.trackEvents.length;g++){const i=this.trackEvents[g],n=t.getVideoTracks();if(n&&n.length){const t=n[0],s=()=>{this.context.logger.info(`received the ${i} event for tile=${r.id()} id=${e.id} streamId=${c}`),"ended"===i&&this.context.browserBehavior.requiresUnifiedPlan()&&this.removeRemoteVideoTrack(e,r.state())};t.addEventListener(i,s),this.removeVideoTrackEventListeners[e.id]||(this.removeVideoTrackEventListeners[e.id]=[]),this.removeVideoTrackEventListeners[e.id].push((()=>{t.removeEventListener(i,s)}))}}if(e.getSettings){const t=e.getSettings();a=t.width,d=t.height}else{const t=e.getCapabilities();a=t.width,d=t.height}const l=this.context.videoStreamIndex.externalUserIdForTrack(n);r.bindVideoStream(s,!1,t,a,d,c,l),this.logger.info(`video track added, use tile=${r.id()} track=${n} streamId=${c}`);let u="removetrack",h=t;this.context.browserBehavior.requiresUnifiedPlan()||(this.logger.debug((()=>"updating end event and target track (plan-b)")),u="ended",h=e);const f=()=>this.removeRemoteVideoTrack(e,r.state());this.removeTrackRemovedEventListeners[e.id]=()=>{h.removeEventListener(u,f),delete this.removeTrackRemovedEventListeners[e.id]},h.addEventListener(u,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=o,o.REMOVE_HANDLER_INTERVAL_MS=1e4},21129:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Prom
1ise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(25687),o=i(47293),r=i(31789);class a 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(){var e,t;return!!(null===(t=null===(e=this.context.meetingSessionConfiguration)||void 0===e?void 0:e.urls)||void 0===t?void 0:t.audioHostURL)}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(),i=e||t;return this.context.logger.info(`uses video: ${i} (enabled: true, sending: ${e}, receiving: ${t})`),i}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,i)=>n(this,void 0,void 0,(function*(){this.cancelPromise=e=>{i(e)};try{if(this.context.sdpOfferInit=yield this.context.peer.createOffer(e),this.context.logger.info("peer connection created offer"),this.context.previousSdpOffer&&new o.default(this.context.sdpOfferInit.s
1dp).videoSendSectionHasDifferentSSRC(this.context.previousSdpOffer)){const e=new Error(`canceling ${this.name()} due to the meeting status code: ${s.default.IncompatibleSDP}`);return this.context.previousSdpOffer=null,void i(e)}t()}catch(n){i(n)}finally{delete this.cancelPromise}}))))}))}}t.default=a},26240:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(25687),o=i(47293),r=i(31789);class a extends r.default{constructor(e,t=a.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;if(this.context.browserBehavior.requiresIceCandidateGatheringTimeoutWorkaround()&&this.chromeVpnTimeoutMs<this.context.meetingSessionConfiguration.connectionTimeoutMs){Date.now()-this.startTimestampMs>this.chromeVpnTimeoutMs&&(e=new Error(`canceling ${this.name()} due to the meeting status code: ${s.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 o.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 o.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=i=>{if(this.context.logger.info(`ice candidate: ${i.candidate?i.candidate.candidate:"(null)"} state: ${this.context.peer.iceGatheringState}`),i.candidate&&(o.default.isRTPCandidate(i.candidate.candidate)&&this.context.iceCandidates.push(i.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 o.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=a,a.CHROME_VPN_TIMEOUT_MS=5e3},21960:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Prom
1ise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(13789),o=i(25687),r=i(87215),a=i(99416),d=i(82168),c=i(20289),l=i(31789);class u extends l.default{constructor(e){super(e.logger),this.context=e,this.taskName="JoinAndReceiveIndexTask",this.taskCanceler=null,this.maxVideos=25}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 i=this.context;i.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===a.default.WebSocketClosed){let e=`The signaling connection was closed with code ${t.closeCode} and reason: ${t.closeReason}`;i.logger.warn(e);let n=o.default.SignalingBadRequest;return 4410===t.closeCode?(e="The meeting already ended.",i.logger.warn(e),n=o.default.MeetingEnded):t.closeCode>=4500&&t.closeCode<4600&&(n=o.default.SignalingInternalServerError),void i.audioVideoController.handleMeetingSessionStatus(new s.default(n),new Error(e))}if(t.type!==a.default.ReceivedSignalFrame)return;if(t.message.type===c.SdkSignalFrame.Type.JOIN_ACK){const e=t.message.joinack;return e&&e.videoSubscriptionLimit&&(i.videoSubscriptionLimit=e.videoSubscriptionLimit),i.serverSupportsCompression=null===e||void 0===e?void 0:e.wantsCompressedSdp,void(e&&e.turnCredentials?(i.turnCredentials=new r.default,i.turnCredentials.username=e.turnCredentials.username,i.turnCredentials.password=e.turnCredentials.password,i.turnCredentials.ttl=e.turnCredentials.ttl,i.turnCredentials.uris=e.turnCredentials.uris.map((e=>i.meetingSessionConfiguration.urls.urlRewriter(e))).filter((e=>!!e))):i.logger.error("missing TURN credentials in JoinAckFrame"))}if(t.message.type!==c.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.previousSdpAnswerAsString="",this.context.previousSdpOffer=null,this.context.serverSupportsCompression=!1,this.context.signalingClient.join(new d.default(this.maxVideos,!0,this.context.meetingSessionConfiguration.applicationMetadata))}));this.context.logger.info(`received first index ${JSON.stringify(e)}`),this.context.indexFrame=e}))}}t.default=u},96180:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(99416),o=i(20289),r=i(31789);class a 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 i=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===s.default.ReceivedSignalFrame&&t.message.type===o.SdkSignalFrame.Type.LEAVE_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("got leave ack"),e())}}(this.context.signalingClient,this.context.logger);this.taskCanceler=i,this.context.signalingClient.registerObserver(i)}))}}t.default=a},2748:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Prom
1ise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(99416),o=i(20289),r=i(31789);class a 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===s.default.ReceivedSignalFrame)if(e.message.type===o.SdkSignalFrame.Type.AUDIO_STREAM_ID_INFO){const t=e.message.audioStreamIdInfo;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioStreamIdInfo(t)}else if(e.message.type===o.SdkSignalFrame.Type.AUDIO_METADATA){const t=e.message.audioMetadata;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioMetadata(t)}}}t.default=a},11981:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(56196),o=i(99496),r=i(92770),a=i(39708),d=i(51922),c=i(13789),l=i(25687),u=i(99416),h=i(20289),f=i(79880),g=i(40155),p=i(28660),m=i(31789);class v extends m.default{constructor(e,t,i){super(e.logger),this.context=e,this.initialConnectionHealthData=i,this.taskName="MonitorTask",this.prevSignalStrength=1,this.currentVideoDownlinkBandwidthEstimationKbps=1e4,this.currentAvailableStreamAvgBitrates=null,this.hasSignalingError=!1,this.presenceHandlerCalled=!1,this.isResubscribeCheckPaused=!1,this.pendingMetricsReport=void 0,this.checkAndSendWeakSignalEvent=e=>{const t=e<1,i=this.prevSignalStrength<1,n=t?i?null:f.default.RedmicStartLoss:i?f.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 c.default(l.default.RealtimeApiFailed),e)},this.realtimeAttendeeIdPresenceHandler=(e,t)=>{const i=this.context.meetingSessionConfiguration.credentials.attendeeId;this.logger.info(`attendeePresenceReceived: ${i}`),i===e&&t&&!this.presenceHandlerCalled&&(this.presenceHandlerCalled=!0,this.context.attendeePresenceDurationMs=Date.now()-this.context.startAudioVideoT
1imestamp,this.context.eventController&&this.context.eventController.publishEvent("attendeePresenceReceived",{attendeePresenceDurationMs:this.context.attendeePresenceDurationMs}))},this.generateAudioVideoEventAttributes=()=>{const{signalingOpenDurationMs:e,poorConnectionCount:t,startTimeMs:i,iceGatheringDurationMs:n,attendeePresenceDurationMs:s,meetingStartDurationMs:o}=this.context;return{maxVideoTileCount:this.context.maxVideoTileCount,meetingDurationMs:null===i?0:Math.round(Date.now()-i),signalingOpenDurationMs:e,iceGatheringDurationMs:n,attendeePresenceDurationMs:s,poorConnectionCount:t,meetingStartDurationMs:o}},this.reconnectionHealthPolicy=new a.default(e.logger,Object.assign({},t),this.initialConnectionHealthData.clone()),this.unusableAudioWarningHealthPolicy=new d.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)}))}pauseResubscribeCheck(){this.isResubscribeCheckPaused=!0}resumeResubscribeCheck(){this.isResubscribeCheckPaused&&(this.isResubscribeCheckPaused=!1,this.pendingMetricsReport&&(this.context.logger.info("Resuming resubscribe check with pending metrics report"),this.checkResubscribe(this.pendingMetricsReport)&&this.context.audioVideoController.update({needsRenegotiation:!1})))}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 i=null!==this.context.activeVideoInput?this.context.activeVideoInput.getTracks():null;if(!i||!i[0])return;const n=Date.now()-this.context.videoInputAttachedTimestampMs;t>0||e>0?(this.context.statsCollector.logVideoEvent(g.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(g.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){if(this.isResubscribeCheckPaused)return this.context.logger.info("Resubscribe check is paused, setting incoming client metric report as pending"),void(this.pendingMetricsReport=e);this.pendingMetricsReport=void 0;const t=e.getObservableMetrics();if(!t)return!1;const i=t.availableSendBandwidth||t.availableOutgoingBitrate,n=t.nackCountReceivedPerSecond||t.googNackCountReceivedPerSecond;let s=!1;this.context.videoDownlinkBandwidthPolicy.updateMetrics(e);const o=this.context.videoDownlinkBandwidthPolicy.wantsResubscribe();if(s=s||o,o&&(this.context.videosToReceive=this.context.videoDownlinkBandwidthPolicy.chooseSubscriptions(),this.logger.info(`trigger resubscribe for down=${o}; videosToReceive=[${this.context.videosToReceive.array()}]`)),this.context.videoTileController.hasStartedLocalVideoTile()){this.context.videoUplinkBandwidthPolicy.updateConnectionMetric({uplinkKbps:i/1e3,nackCountPerSecond:n});const e=this.context.videoUplinkBandwidthPolicy.wantsResubscribe();s=s||e,e&&(this.logger.info(`trigger resubscribe for up=${e}; videosToReceive=[${this.context.videosToReceive.array()}]`),this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters(),this.context.videoUplinkBandwidthPolicy.chooseMediaTrackConstraints())}return s}metricsDidReceive(e){const t=e;if(!t)return;if(this.checkResubscribe(e)&&this.context.audioVideoController.update({needsRenegotiation:!1}),!this.currentAvailableStreamAvgBitrates)return;const i=t.streamMetricReports;if(!i)return;const n=new Map,a=new Map;for(const r in i)i[r].mediaType===o.default.VIDEO&&i[r].direction===s.default.DOWNSTREAM&&n.set(i[r].streamId,i[r]);let d=!1;for(const s of this.currentAvailableStreamAvgBitrates.bitrates)if(n.has(s.sourceStreamId)){const e=n.get(s.sourceStreamId),t=this.context.videoStreamIndex.attendeeIdForStreamId(s.sourceStreamId);if(!t)continue;const i=new r.default,o=e.previousMetrics.bytesReceived,c=e.currentMetrics.bytesReceived;if(!o||!c)continue;const l=8*(c-o)/1e3;i.expectedAverageBitrateKbps=s.avgBitrateBps/1e3,i.receivedAverageBitrateKbps=l,i.attendeeId=t,l<s.avgBitrateBps/1e3*v.DEFAULT_DOWNLINK_CALLRATE_UNDERSHOOT_FACTOR&&(d=!0),a.set(t,i)}d&&(this.logger.debug((()=>"Downlink video streams are not receiving enough data")),this.context.audioVideoController.forEachObserver((e=>{p.Maybe.of(e.videoNotReceivingEnoughData).map((t=>
1t.bind(e)(Array.from(a.values()))))})))}connectionHealthDidChange(e){var t;0===e.consecutiveMissedPongs&&this.context.reconnectController&&this.context.reconnectController.setLastActiveTimestampMs(Date.now()),this.reconnectionHealthPolicy.update(e);const i=this.reconnectionHealthPolicy.healthIfChanged();null!==i&&(this.logger.info(`reconnection health is now: ${i}`),0===i&&this.context.audioVideoController.handleMeetingSessionStatus(new c.default(l.default.ConnectionHealthReconnect),null)),this.unusableAudioWarningHealthPolicy.update(e);const n=this.unusableAudioWarningHealthPolicy.healthIfChanged();if(null!==n)if(this.logger.info(`unusable audio warning is now: ${n}`),0===n){this.context.poorConnectionCount+=1;const e=this.generateAudioVideoEventAttributes();null===(t=this.context.eventController)||void 0===t||t.publishEvent("receivingAudioDropped",e),this.context.videoTileController.haveVideoTilesWithStreams()?this.context.audioVideoController.forEachObserver((e=>{p.Maybe.of(e.connectionDidSuggestStopVideo).map((t=>t.bind(e)()))})):this.context.audioVideoController.forEachObserver((e=>{p.Maybe.of(e.connectionDidBecomePoor).map((t=>t.bind(e)()))}))}else this.context.audioVideoController.forEachObserver((e=>{p.Maybe.of(e.connectionDidBecomeGood).map((t=>t.bind(e)()))}))}handleBitrateFrame(e){let t=0;this.currentAvailableStreamAvgBitrates=e,this.logger.debug((()=>`simulcast: bitrates from server ${JSON.stringify(e)}`));for(const i of e.bitrates)this.context.videosToReceive.contain(i.sourceStreamId)&&(t+=i.avgBitrateBps);t/=1e3,this.currentVideoDownlinkBandwidthEstimationKbps*v.DEFAULT_DOWNLINK_CALLRATE_OVERSHOOT_FACTOR<t&&(this.logger.info(`Downlink bandwidth pressure is high: estimated bandwidth ${this.currentVideoDownlinkBandwidthEstimationKbps}Kbps, required bandwidth ${t}Kbps`),this.context.audioVideoController.forEachObserver((e=>{p.Maybe.of(e.estimatedDownlinkBandwidthLessThanRequired).map((i=>i.bind(e)(this.currentVideoDownlinkBandwidthEstimationKbps,t)))})))}handleSignalingClientEvent(e){var t;if(e.type===u.default.WebSocketClosed&&(4410===e.closeCode||e.closeCode>=4500&&e.closeCode<4600)||e.type===u.default.WebSocketError||e.type===u.default.WebSocketFailed){if(!this.hasSignalingError){const e=this.generateAudioVideoEventAttributes();null===(t=this.context.eventController)||void 0===t||t.publishEvent("signalingDropped",e),this.hasSignalingError=!0}}else e.type===u.default.WebSocketOpen&&(this.hasSignalingError=!1);if(e.type===u.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=c.default.fromSignalFrame(e.message);e.message.type!==h.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&t.statusCode()!==l.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},48831:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{cancel(){}name(){return"NoOpTask"}run(){return Promise.resolve()}setParent(e){}}},21124:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(70813),s=i(37797);t.default=class{constructor(e,t,i){this.logger=e,this.task=t,this.dependencies=i,this.canceled=!1}name(){return`${this.task.name()} (once)`}cancel(){if(!this.canceled){if(this.dependencies)for(const e of this.dependencies)e.cancel();this.logger.info(`Canceling ${this.name()}`),s.default.nextTick((()=>this.task.cancel())),this.canceled=!0,this.cancelPromise&&s.default.nextTick((()=>this.cancelPromise(new Error(`canceling ${this.name()}`))))}}logDependencies(){if(this.logger.getLogLevel()>n.default.INFO)return;if(!this.dependencies)return;const e=this.dependencies.filter((e=>e)).map((e=>e.name())).join(", ");this.logger.info(`${this.task.name()} waiting for dependencies: ${e}`)}run(){if(this.promise)return this.promise;const e=this.dependencies?Promise.all(this.dependencies.map((e=>null===e||void 0===e?void 0:e.run()))):Promise.resolve();return this.logDependencies(),this.ongoing=e.then((()=>this.task.run())),this.promise=new Promise(((e,t)=>{this.cancelPromise=t,this.ongoing.then(e).catch(t)}))}setParent(e){this.task.setParent(e)}}},94543:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Prom
1ise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(3920),o=i(99416),r=i(31789);class a 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 s.default(e.urls.signalingURL,e.credentials.joinToken));const t=Date.now();try{yield new Promise(((e,t)=>{const i=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(i){switch(i.type){case o.default.WebSocketOpen:this.signalingClient.removeObserver(this),e();break;case o.default.WebSocketFailed:this.signalingClient.removeObserver(this),t(new Error("WebSocket connection failed"))}}}(this.context.signalingClient);this.context.signalingClient.registerObserver(i),this.taskCanceler=i}))}catch(i){throw i}finally{this.context.signalingOpenDurationMs=Math.round(Date.now()-t),this.logger.info(`Opening signaling connection took ${this.context.signalingOpenDurationMs} ms`)}}))}}t.default=a},28556:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(31789);class o extends s.default{constructor(e,t,i){super(e),this.taskName=t,this.tasksToRunParallel=i;for(const n of i)n.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 n of this.tasksToRunParallel)this.logger.info(`parallel group task ${this.name()} running subtask ${n.name()}`),e.push(n.run());const t=[];for(let n=0;n<e.length;n++){try{yield e[n]}catch(i){t.push(`task ${this.tasksToRunParallel[n].name()} failed: ${i.message}`)}this.logger.info(`parallel group task ${this.name()} completed subtask ${this.tasksToRunParallel[n].name()}`)}if(t.length>0){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=o},23968:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(63204),o=i(99416),r=i(20289),a=i(31789);class d extends a.default{constructor(e,t,i){super(e.logger),this.context=e,this.credentials=t,this.completionCallback=i,this.taskName="PromoteToPrimaryMeetingTask",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.promoteToPrimaryMeeting(this.credentials),this.context.logger.info("Sent request to join primary meeting"),yield this.receivePrimaryMeetingJoinAck()):this.completionCallback(new s.MeetingSessionStatus(s.MeetingSessionStatusCode.SignalingRequestFailed))}))}receivePrimaryMeetingJoinAck(){return new Promise(((e,t)=>{const i=new class{constructor(e,t,i){this.signalingClient=e,this.completionCallback=t,this.logger=i}cancel(){this.signalingClient.removeObserver(this),this.completionCallback(new s.MeetingSessionStatus(s.MeetingSessionStatusCode.SignalingRequestFailed)),e()}handleSignalingClientEvent(t){t.isConnectionTerminated()&&(this.signalingClient.removeObserver(this),this.logger.info("PromoteToPrimaryMeetingTask connection terminated"),this.completionCallback(new s.MeetingSessionStatus(s.MeetingSessionStatusCode.SignalingRequestFailed)),e()),t.type===o.default.ReceivedSignalFrame&&t.message.type===r.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("Got a primary meeting join ACK"),this.completionCallback(s.MeetingSessionStatus.fromSignalFrame(t.message)),e())}}(this.context.signalingClient,this.completionCallback,this.context.logger);this.taskCanceler=i,this.context.signalingClient.registerObserver(i)}))}}t.default=d},51209:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Prom
1ise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(31789);class o extends s.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveAudioInputTask"}run(){var e,t;return n(this,void 0,void 0,(function*(){if(!(null===(t=null===(e=this.context.meetingSessionConfiguration)||void 0===e?void 0:e.urls)||void 0===t?void 0:t.audioHostURL))return void this.context.logger.info("No audio connection: not acquiring audio input");if(this.context.activeAudioInput)return void this.context.logger.info("an active audio input exists");let i;try{i=yield this.context.mediaStreamBroker.acquireAudioInputStream()}catch(n){this.context.logger.warn("could not acquire audio input from current device")}i?(this.context.activeAudioInput=i,this.context.realtimeController.realtimeSetLocalAudioInput(i)):this.context.logger.warn("an audio input is not available")}))}}t.default=o},25547:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(25687),o=i(87215),r=i(60214),a=i(74046),d=i(31789);class c extends d.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,i)=>n(this,void 0,void 0,(function*(){this.cancelPromise=e=>{i(e)};try{const n=yield fetch(a.default.urlWithVersion(this.url),e);if(this.context.logger.info("received TURN credentials"),n.status&&403===n.status)return void i(new Error(`canceling ${this.name()} due to the meeting status code: ${s.default.TURNCredentialsForbidden}`));if(n.status&&404===n.status)return void i(new Error(`canceling ${this.name()} due to the meeting status code: ${s.default.MeetingEnded}`));t(yield n.json())}catch(n){i(n)}finally{delete this.cancelPromise}}))));this.context.turnCredentials=new o.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=c},120:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(20289),o=i(31789);class r extends o.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===s.SdkStreamServiceType.RX||this.context.videoDuplexMode===s.SdkStreamServiceType.DUPLEX;if(this.context.videoTileController.hasStartedLocalVideoTile()?this.context.videoDuplexMode=e?s.SdkStreamServiceType.DUPLEX:s.SdkStreamServiceType.TX:this.context.videoDuplexMode=e?s.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(),this.context.videoStreamIndex.integrateUplinkPolicyDecision([])));const t=this.context.videoTileController.getLocalVideoTile();let i=null;try{i=yield this.context.mediaStreamBroker.acquireVideoInputStream()}catch(n){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())
1)}if(this.context.activeVideoInput=i,i){const e=i.getVideoTracks();if(!e||0===e.length)return;const s=this.context.meetingSessionConfiguration.credentials.attendeeId,o=e[0].getSettings();if(this.context.enableSimulcast){const t=this.context.videoUplinkBandwidthPolicy.chooseMediaTrackConstraints();this.context.logger.info(`simulcast: choose constraint ${JSON.stringify(t)}`);try{yield e[0].applyConstraints(t)}catch(n){this.context.logger.info("simulcast: pass video without more constraint")}}const r=this.context.audioVideoController.configuration.credentials.externalUserId;t.bindVideoStream(s,!0,i,o.width,o.height,null,r);for(let t=0;t<e.length;t++){const i=e[t];this.logger.info(`using video device label=${i.label} id=${i.id}`),this.context.videoDeviceInformation.current_camera_name=i.label,this.context.videoDeviceInformation.current_camera_id=i.id}}}))}stopVideoInput(){this.context.mediaStreamBroker.releaseMediaStream(this.context.activeVideoInput),this.context.activeVideoInput=null}}t.default=r},39560:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(5723),o=i(60214),r=i(99416),a=i(20289),d=i(28660),c=i(31789);class l extends c.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveVideoStreamIndexTask",this.isIngestionPaused=!1,this.pendingIndex=null}removeObserver(){this.context.signalingClient.removeObserver(this)}run(){return n(this,void 0,void 0,(function*(){this.handleIndexFrame(this.context.indexFrame),this.context.signalingClient.registerObserver(this),this.context.removableObservers.push(this)}))}handleSignalingClientEvent(e){if(e.type!==r.default.ReceivedSignalFrame||e.message.type!==a.SdkSignalFrame.Type.INDEX)return;const t=e.message.index;this.context.logger.info(`received new index ${JSON.stringify(t)}`),this.handleIndexFrame(t)}pauseIngestion(){this.isIngestionPaused=!0}resumeIngestion(){this.isIngestionPaused&&(this.isIngestionPaused=!1,this.pendingIndex&&(this.context.logger.info("Resuming index ingestion with pending index"),this.handleIndexFrame(this.pendingIndex)))}handleIndexFrame(e){if(!e)return;if(this.isIngestionPaused)return this.context.logger.info("Index ingestion is paused, setting most recent index as pending"),void(this.pendingIndex=e);this.pendingIndex=null;const t=this.context.audioVideoController.configuration.credentials.attendeeId;e.sources=e.sources.filter((e=>{const i=new o.default(e.attendeeId);return!(i.base()===t&&i.hasModality(o.default.MODALITY_CONTENT))}));const{videoStreamIndex:i,videoDownlinkBandwidthPolicy:n,videoUplinkBandwidthPolicy:s}=this.context,r=i.allVideoSendingSourcesExcludingSelf(t);i.integrateIndexFrame(e),n.updateIndex(i),s.updateIndex(i),this.resubscribe(n,s),this.updateVideoAvailability(e),this.handleIndexVideosPausedAtSource();const a=i.allVideoSendingSourcesExcludingSelf(t);this.areVideoSourcesEqual(r,a)||this.context.audioVideoController.forEachObserver((e=>{d.Maybe.of(e.remoteVideoSourcesDidChange).map((t=>t.bind(e)(a)))}))}areVideoSourcesEqual(e,t){if(e.length!==t.length)return!1;const i=(e,t)=>e.attendee.attendeeId.localeCompare(t.attendee.attendeeId),n=[...e].sort(i),s=[...t].sort(i);for(let o=0;o<n.length;o++)if(n[o].attendee.attendeeId!==s[o].attendee.attendeeId)return!1;return!0}resubscribe(e,t){const i=e.wantsResubscribe(),n=(this.context.videoDuplexMode===a.SdkStreamServiceType.TX||this.context.videoDuplexMode===a.SdkStreamServiceType.DUPLEX)&&t.wantsResubscribe(),s=i||n;if(this.logger.info(`should resubscribe: ${s} (downlink: ${i} uplink: ${n})`),!s)return;const o=e.chooseSubscriptions();this.context.videosToReceive=o.truncate(this.context.videoSubscriptionLimit),o.size()>this.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.context.videoCaptureAndEncodeParameter=t.chooseCaptureAndEncodeParameters(),this.logger.info(`trigger resubscribe for up=${n} down=${i}; videosToReceive=[${this.context.videosToReceive.array()}
1] captureParams=${JSON.stringify(this.context.videoCaptureAndEncodeParameter)}`),this.context.audioVideoController.update({needsRenegotiation:!1})}updateVideoAvailability(e){if(!this.context.videosToReceive)return void this.logger.error("videosToReceive must be set in the meeting context.");const t=new s.default;t.remoteVideoAvailable=!this.context.videosToReceive.empty(),t.canStartLocalVideo=!e.atCapacity,this.context.lastKnownVideoAvailability&&this.context.lastKnownVideoAvailability.equal(t)||(this.context.lastKnownVideoAvailability=t.clone(),this.context.audioVideoController.forEachObserver((e=>{d.Maybe.of(e.videoAvailabilityDidChange).map((i=>i.bind(e)(t.clone())))})))}handleIndexVideosPausedAtSource(){const e=this.context.videoStreamIndex.streamsPausedAtSource();for(const t of this.context.videoTileController.getAllVideoTiles()){const i=t.state();e.contain(i.streamId)?t.markPoorConnection()&&this.logger.info(`marks the tile ${i.tileId} as having a poor connection`):t.unmarkPoorConnection()&&this.logger.info(`unmarks the tile ${i.tileId} as having a poor connection`)}}}t.default=l},88797:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(31789);class o extends s.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReleaseMediaStreamsTask"}run(){return n(this,void 0,void 0,(function*(){if(this.context.mediaStreamBroker)try{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)}catch(e){this.context.logger.error(`Failed to release media streams: ${e}`)}}))}}t.default=o},44191:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(31789);class s extends n.default{constructor(e,t,i="RunnableTask"){super(e),this.fn=t,this.taskName=i}run(){return this.fn().then((()=>{}))}}t.default=s},99485:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(11018),o=i(99416),r=i(20289),a=i(31789);class d extends a.default{constructor(e){super(e.logger),this.context=e,this.taskName="SendAndReceiveDataMessagesTask",this.sendDataMessageHandler=(e,t,i)=>{if(this.context.signalingClient.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,i);const s=r.SdkDataMessagePayload.create();s.topic=e,s.lifetimeMs=i,s.data=n;const o=r.SdkDataMessageFrame.create();o.messages=[s],this.context.signalingClient.sendDataMessage(o)}else this.context.logger.error("Signaling client is not ready")}}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===o.default.ReceivedSignalFrame&&e.message.type===r.SdkSignalFrame.Type.DATA_MESSAGE)for(const t of e.message.dataMessage.messages){const e=new s.default(t.ingestTimeNs/1e6,t.topic,t.data,t.senderAttendeeId,t.senderExternalUserId,0===t.ingestTimeNs);this.context.realtimeController.realtimeReceiveDataMessage(e)}}validateDataMessage(e,t,i){if(!d.TOPIC_REGEX.test(e))throw new Error("Invalid topic");if(t.length>d.DATA_SIZE)throw new Error("Data size has to be less than 2048 bytes");if(i&&i<0)throw new Error("The life time of the message has to be non negative")}}t.default=d,d.TOPIC_REGEX=new RegExp(/^[a-zA-Z0-9_-]{1,36}$/),d.DATA_SIZE=2048},47079:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Prom
1ise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(31789),o=i(4456);class r extends s.default{constructor(e,t,i){super(e),this.taskName=t,this.tasksToRunSerially=i,this.currentTask=null;for(const n of i)n.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 t of this.tasksToRunSerially){this.getStatus()===o.default.CANCELED&&this.logAndThrow(`serial group task ${this.name()} was canceled`);try{this.logger.info(`serial group task ${this.name()} running subtask ${t.name()}`),this.currentTask=t,yield t.run(),this.logger.info(`serial group task ${this.name()} completed subtask ${t.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},64833:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(90543),o=i(47293),r=i(31789);class a extends r.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;
1let t=this.context.sdpOfferInit.sdp;(new s.default).requiresDisablingH264Encoding()&&(t=new o.default(t).removeH264SupportFromSendSection().sdp),this.context.audioProfile&&(t=new o.default(t).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(t=new o.default(t).withStereoAudio().sdp)),this.logger.debug((()=>`local description is >>>${t}<<<`));const i={type:"offer",sdp:t,toJSON:null};yield new Promise(((t,s)=>n(this,void 0,void 0,(function*(){this.cancelPromise=e=>{s(e)};try{yield e.setLocalDescription(i),t()}catch(n){s(n)}finally{delete this.cancelPromise}})))),this.context.logger.info("set local description")}))}}t.default=a},25275:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(90543),o=i(47293),r=i(31789);class a 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 o.default(e).withoutServerReflexiveCandidates().sdp,this.context.audioProfile&&(e=new o.default(e).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(e=new o.default(e).withStereoAudio().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,i=e;let n=i;const s=new o.default(t);if(s.hasVideo()){this.logger.info(`offer has video (plan-b): >>>${s.sdp}<<<`);const e=new o.default(i);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 >>>${i}<<<`),n=e.copyVideo(t).sdp)}e=n}(new s.default).requiresSortCodecPreferencesForSdpAnswer()&&(e=new o.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(i){throw i}}))}createICEConnectionCompletedPromise(e){return new Promise(((t,i)=>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),i(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(s){i(s)}}))))}}t.default=a},95924:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(13789),o=i(25687),r=i(47293),a=i(73320),d=i(99416),c=i(46729),l=i(20289),u=i(31789);class h extends u.default{constructor(e){super(e.logger),this.context=e,this.taskName="SubscribeAndReceiveSubscribeAckTask",this.taskCanceler=null,this.textCompressor=new a.default(e.logger)}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 r.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 i={rid:"hi",maxBitrate:1e3*t,maxFramerate:e,active:!0};this.context.videoStreamIndex.integrateUplinkPolicyDecision([i])}this.context.videoStreamIndex.subscribeFrameSent();const t=this.context.browserBehavior.requiresUnifiedPlan()?this.fixUpSubscriptionOrder(e,this.context.videoSubscriptions):this.context.videoSubscriptions,i=this.context.videoDuplexMode===l.SdkStreamServiceType.TX||this.context.videoDuplexMode===l.SdkStreamServiceType.DUPLEX;let n;const s=e;if(this.context.serverSupportsCompression){const t=this.context.previousSdpOffer?this.context.previousSdpOffer.sdp:"";n=this.textCompressor.compress(s,t),this.context.logger.info(`Compressed the SDP message from ${s.length} to ${n.length} bytes.`),e=""}this.context.previousSdpOffer=new r.default(s);const o=new c.default(this.context.meetingSessionConfiguration.credentials.attendeeId,e,this.context.meetingSessionConfiguration.urls.audioHostURL,this.context.realtimeController.realtimeIsLocalAudioMuted(),!1,t,i,this.context.videoStreamIndex.localStreamDescriptions(),!0,n);this.context.logger.info(`sending subscribe: ${JSON.stringify(o)}`),this.context.signalingClient.subscribe(o);const a=yield this.receiveSubscribeAck();this.context.logger.info(`got subscribe ack: ${JSON.stringify(a)}`);let d="";a.compressedSdpAnswer&&a.compressedSdpAnswer.length?(d=this.textCompressor.decompress(a.compressedSdpAnswer,this.context.previousSdpAnswerAsString),0===d.length&&(this.context.sdpAnswer="",this.context.previousSdpAnswerAsString="",this.logAndThrow("Error occurred while trying to decompress the SDP answer.")),this.context.logger.info(`Decompressed the SDP message from ${a.compressedSdpAnswer.length} to ${d.length} bytes.`),this.context.sdpAnswer=d):this.context.sdpAnswer=a.sdpAnswer,this.context.previousSdpAnswerAsString=this.context.sdpAnswer,this.context.videoStreamIndex.integrateSubscribeAckFrame(a)}
1))}fixUpSubscriptionOrder(e,t){if(void 0===this.context.transceiverController.getMidForStreamId)return t;const i=new Map;for(const o of t){const e=this.context.transceiverController.getMidForStreamId(o);void 0!==e?i.set(e,o):0!==o&&this.context.logger.warn(`Could not find MID for stream ID: ${o}`)}const n=new r.default(e).mediaSections(),s=[];for(const o of n)if("video"===o.mediaType)if("recvonly"===o.direction){const e=i.get(o.mid);if(void 0===e){this.context.logger.warn(`Could not find stream ID for MID: ${o.mid}`);continue}s.push(e)}else s.push(0);return this.context.logger.info(`Fixed up ${JSON.stringify(t)} to ${JSON.stringify(s)} (may be same))}`),s}receiveSubscribeAck(){return new Promise(((e,t)=>{const i=this.context;const n=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.isConnectionTerminated()){const e=`SubscribeAndReceiveSubscribeAckTask connection was terminated with code ${t.closeCode} and reason: ${t.closeReason}`;i.logger.warn(e);let n=o.default.TaskFailed;return t.closeCode>=4500&&t.closeCode<4600&&(n=o.default.SignalingInternalServerError),void i.audioVideoController.handleMeetingSessionStatus(new s.default(n),new Error(e))}if(t.type!==d.default.ReceivedSignalFrame||t.message.type!==l.SdkSignalFrame.Type.SUBSCRIBE_ACK)return;this.signalingClient.removeObserver(this);const n=t.message.suback;e(n)}}(this.context.signalingClient);this.context.signalingClient.registerObserver(n),this.taskCanceler=n}))}}t.default=h},4456:function(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.IDLE="IDLE",e.RUNNING="RUNNING",e.CANCELED="CANCELED",e.FINISHED="FINISHED"}(i||(i={})),t.default=i},90250:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(44929),o=i(31789);class r extends o.default{constructor(e,t,i){super(e),this.taskToRunBeforeTimeout=t,this.timeoutMs=i,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 s.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,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(25687),o=i(31789);class r extends o.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: ${s.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,i)=>{const n=(i,s,o,r,a)=>{e===i&&s&&(this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(n),t(),delete this.cancelPromise)};this.cancelPromise=e=>{this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(n),i(e)},this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(n)}))}))}}t.default=r},50365:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Prom
1ise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((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,this.streamIdToTransceiver=new Map}setEncodingParameters(e){return i(this,void 0,void 0,(function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;const t=this._localCameraTransceiver.sender;if(!e||0===e.size)return;const i=Array.from(e.values()),n=t.getParameters();if(n.encodings&&0!==n.encodings.length)for(const e of n.encodings)for(const t of i){if((e.rid||t.rid)&&e.rid!==t.rid)continue;let i;for(i in t)"rid"!==i&&"codecPayloadType"!==i&&t.hasOwnProperty(i)&&(e[i]=t[i])}else n.encodings=i;yield t.setParameters(n)}))}static setVideoSendingBitrateKbpsForSender(e,t,n){return i(this,void 0,void 0,(function*(){if(!e||t<=0)return;const i=e.getParameters();i.encodings||(i.encodings=[{}]);for(const e of i.encodings)e.maxBitrate=1e3*t;yield e.setParameters(i)}))}static replaceAudioTrackForSender(e,t){return i(this,void 0,void 0,(function*(){return!!e&&(yield e.replaceTrack(t),!0)}))}localAudioTransceiver(){return this._localAudioTransceiver}localVideoTransceiver(){return this._localCameraTransceiver}setVideoSendingBitrateKbps(e){return i(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())&&"undefined"!==typeof 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 i(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 i(this,void 0,void 0,(function*(){yield this.setTransceiverInput(this._localAudioTransceiver,e)}))}setVideoInput(e){return i(this,void 0,void 0,(function*(){yield this.setTransceiverInput(this._localCameraTransceiver,e)}))}updateVideoTransceivers(e,t){if(!this.useTransceivers())return t.array();const i=this.peer.getTransceivers();return this.videoSubscriptions=[0],t=t.clone(),this.updateTransceivers(i,e,t),this.logger.debug((()=>this.debugDumpTransceivers())),this.videoSubscriptions}updateTransceivers(e,t,i){const n=i.array();0===e.length||e[0].stop?0!==e.length&&this.updateTransceiverWithStop(e,t,n):(this.logger.info("Updating transceivers without `stop` function"),this.updateTransceiverWithoutStop(e,t,n));for(const s of n){const e=this.peer.addTransceiver("video",{direction:"recvonly",streams:[new MediaStream]});this.streamIdToTransceiver.set(s,e),this.videoSubscriptions.push(s),this.logger.info(`adding transceiver mid: ${e.mid} subscription: ${s} direction: recvonly`)}}updateTransceiverWithStop(e,t,i){let n=1;this.videoSubscriptions=[0];for(const s of e){if(s===this._localCameraTransceiver||!this.transceiverIsVideo(s)||
1!s.mid)continue;let e=!1;const o=t.streamIdForTrack("v_"+s.mid);if("inactive"!==s.direction&&void 0!==o)for(const[r,a]of i.entries())if(t.StreamIdsInSameGroup(o,a)){s.direction="recvonly",this.videoSubscriptions[n]=a,e=!0,this.streamIdToTransceiver.delete(o),this.streamIdToTransceiver.set(a,s),i.splice(r,1);break}if(!e){this.videoSubscriptions[n]=0,this.logger.info(`Stopping MID: ${s.mid}, direction: ${s.direction}, current direction: ${s.currentDirection}`),s.stop();for(const[e,t]of this.streamIdToTransceiver.entries())s.mid===t.mid&&this.streamIdToTransceiver.delete(e)}n+=1}}updateTransceiverWithoutStop(e,t,i){let n=1;for(const s of e)if(s!==this._localCameraTransceiver&&this.transceiverIsVideo(s)){if(this.videoSubscriptions[n]=0,"inactive"!==s.direction){const e=t.streamIdForTrack("v_"+s.mid);if(void 0!==e)for(const[o,r]of i.entries())if(t.StreamIdsInSameGroup(e,r)){s.direction="recvonly",this.videoSubscriptions[n]=r,this.streamIdToTransceiver.delete(e),this.streamIdToTransceiver.set(r,s),i.splice(o,1);break}}n+=1}n=1;for(const s of e)if(s!==this._localCameraTransceiver&&this.transceiverIsVideo(s)){if("inactive"===s.direction&&i.length>0){s.direction="recvonly";const e=i.shift();this.videoSubscriptions[n]=e,this.streamIdToTransceiver.set(e,s)}else if(0===this.videoSubscriptions[n]){s.direction="inactive";for(const[e,t]of this.streamIdToTransceiver.entries())s===t&&this.streamIdToTransceiver.delete(e)}n+=1}}getMidForStreamId(e){var t;return null===(t=this.streamIdToTransceiver.get(e))||void 0===t?void 0:t.mid}setStreamIdForMid(e,t){for(const[i,n]of this.streamIdToTransceiver.entries())if(n.mid===e)return this.streamIdToTransceiver.delete(i),void this.streamIdToTransceiver.set(t,n)}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 i of this.peer.getTransceivers())this.transceiverIsVideo(i)&&(e+=`transceiver index=${t} mid=${i.mid} subscription=${this.videoSubscriptions[t]} direction=${i.direction}\n`,t+=1);return e}setTransceiverInput(e,t){return i(this,void 0,void 0,(function*(){e&&(e.direction=t?"sendrecv":"inactive",yield e.sender.replaceTrack(t))}))}}t.default=n},5785:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(50365);class o extends s.default{constructor(e,t){super(e,t),this.videoQualityControlParameterMap=new Map;let i=4;for(let n=0;n<o.NAME_ARR_ASCENDING.length;n++){const e=o.NAME_ARR_ASCENDING[n];this.videoQualityControlParameterMap.set(e,{rid:e,scaleResolutionDownBy:i,maxBitrate:1e3*o.BITRATE_ARR_ASCENDING[n]}),i/=2}}setEncodingParameters(e){return n(this,void 0,void 0,(function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;const t=this._localCameraTransceiver.sender,i=Array.from(e.values());if(i.length<=0)return;const n=t.getParameters();if(n.encodings)for(let s=0;s<n.encodings.length;s++)n.encodings[s].rid===o.LOW_LEVEL_NAME&&(n.encodings[s].maxBitrate=e.get(o.LOW_LEVEL_NAME).maxBitrate,n.encodings[s].active=e.get(o.LOW_LEVEL_NAME).active,n.encodings[s].scaleResolutionDownBy=e.get(o.LOW_LEVEL_NAME).scaleResolutionDownBy),n.encodings[s].rid===o.MID_LEVEL_NAME&&(n.encodings[s].maxBitrate=e.get(o.MID_LEVEL_NAME).maxBitrate,n.encodings[s].active=e.get(o.MID_LEVEL_NAME).active,n.encodings[s].scaleResolutionDownBy=e.get(o.MID_LEVEL_NAME).scaleResolutionDownBy),n.encodings[s].rid===o.HIGH_LEVEL_NAME&&(n.encodings[s].maxBitrate=e.get(o.HIGH_LEVEL_NAME).maxBitrate,n.encodings[s].active=e.get(o.HIGH_LEVEL_NAME).active,n.encodings[s].scaleResolutionDownBy=e.get(o.HIGH_LEVEL_NAME).scaleResolutionDownBy);else n.encodings=i;yield t.setParameters(n),this.logVideoTransceiverParameters()}))}static replaceAudioTrackForSender(e,t){return n(this,void 0,void 0,(function*(){return!!e&&(yield e.replaceTrack(t),!0)}))}setVideoSendingBitrateKbps(e){return n(this,void 0,void 0,(function*(){}))}setupLocalTransceivers(){if(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)){const e=Array.from(this.videoQualityControlParameterMap.values());this._localCameraTransceiver=this.peer.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream],sendEncodings:e})}}logVideoTransceiverParameters(){const e=this._localCameraTransceiver.sender.getParameters().encodings;let t="simulcast: current encoding parameters \n";for(const i of e)t+=`rid=${i.rid} maxBitrate=${i.maxBitrate} active=${i.active}
1 scaleDownBy=${i.scaleResolutionDownBy} \n`;this.logger.info(t)}}t.default=o,o.LOW_LEVEL_NAME="low",o.MID_LEVEL_NAME="mid",o.HIGH_LEVEL_NAME="hi",o.NAME_ARR_ASCENDING=["low","mid","hi"],o.BITRATE_ARR_ASCENDING=[200,400,1100]},79354:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(50365);class s extends n.default{constructor(e,t){super(e,t)}setupLocalTransceivers(){this.useTransceivers()&&(this.defaultMediaStream||"undefined"===typeof MediaStream||(this.defaultMediaStream=new MediaStream),this._localCameraTransceiver||(this._localCameraTransceiver=this.peer.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream]})))}}t.default=s},95308:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TRANSCRIPTION_DATA_MESSAGE_TOPIC=void 0;const n=i(11877);t.TRANSCRIPTION_DATA_MESSAGE_TOPIC="aws:chime:transcription";t.default=class{constructor(e){this.realtimeController=e,this.transcriptEventCallbacks=new Set}subscribeToTranscriptEvent(e){0===this.transcriptEventCallbacks.size&&this.realtimeController.realtimeSubscribeToReceiveDataMessage(t.TRANSCRIPTION_DATA_MESSAGE_TOPIC,(e=>{for(const t of n.TranscriptEventConverter.from(e))for(const e of this.transcriptEventCallbacks)e(t)})),this.transcriptEventCallbacks.add(e)}unsubscribeFromTranscriptEvent(e){this.transcriptEventCallbacks.delete(e),0===this.transcriptEventCallbacks.size&&this.realtimeController.realtimeUnsubscribeFromReceiveDataMessage(t.TRANSCRIPTION_DATA_MESSAGE_TOPIC)}}},34739:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},32471:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},67210:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},11877:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TranscriptEventConverter=void 0;const n=i(20289),s=i(34739),o=i(41288),r=i(91326),a=i(96864),d={[n.SdkTranscriptionStatus.Type.STARTED]:r.default.STARTED,[n.SdkTranscriptionStatus.Type.INTERRUPTED]:r.default.INTERRUPTED,[n.SdkTranscriptionStatus.Type.RESUMED]:r.default.RESUMED,[n.SdkTranscriptionStatus.Type.STOPPED]:r.default.STOPPED,[n.SdkTranscriptionStatus.Type.FAILED]:r.default.FAILED};t.TranscriptEventConverter=class{static from(e){let t;try{t=n.SdkTranscriptFrame.decode(e.data)}catch(r){throw new Error("Cannot decode transcript data message: "+r)}const i=[];for(const c of t.events)if(c.status){const e=d[c.status.type];if(!e)continue;const t=new o.default;t.type=e,t.eventTimeMs=c.status.eventTime,t.transcriptionRegion=c.status.transcriptionRegion,t.transcriptionConfiguration=c.status.transcriptionConfiguration,c.status.message&&(t.message=c.status.message),i.push(t)}else if(c.transcript){const e=new s.default;e.results=[];for(const t of c.transcript.results){const i={channelId:t.channelId,isPartial:t.isPartial,resultId:t.resultId,startTimeMs:t.startTime,endTimeMs:t.endTime,alternatives:[]};if(t.languageCode&&(i.languageCode=t.languageCode),t.languageIdentification&&t.languageIdentification.length>0){i.languageIdentification=[];for(const e of t.languageIdentification){const t={languageCode:e.languageCode,score:e.score};i.languageIdentification.push(t)}}for(const e of t.alternatives){const t={items:[],transcript:e.transcript};for(const i of e.items){const e={content:i.content,attendee:{attendeeId:i.speakerAttendeeId,externalUserId:i.speakerExternalUserId},startTimeMs:i.startTime,endTimeMs:i.endTime,type:null};switch(i.vocabularyFilterMatch&&(e.vocabularyFilterMatch=i.vocabularyFilterMatch),i.hasOwnProperty("stable")&&(e.stable=i.stable),i.hasOwnProperty("confidence")&&(e.confidence=i.confidence),i.type){case n.SdkTranscriptItem.Type.PRONUNCIATION:e.type=a.default.PRONUNCIATION;break;case n.SdkTranscriptItem.Type.PUNCTUATION:e.type=a.default.PUNCTUATION}t.items.push(e)}for(const i of e.entities){t.entities||(t.entities=[]);const e={category:i.category,confidence:i.confidence,content:i.content,startTimeMs:i.startTime,endTimeMs:i.endTime};i.type&&(e.type=i.type),t.entities.push(e)}i.alternatives.push(t)}e.results.push(i)}i.push(e)}return i}}},61741:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},96864:function(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.PRONUNCIATION="pronunciation",e.PUNCTUATION="punctuation"}(i||(i={})),t.default=i},59063:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},5323:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},41288:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},91326:function(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.STARTED="started",e.INTERRUPTED="interrupted",e.RESUMED="resumed",e.STOPPED="stopped",e.FAILED="failed"}(i||(i={})),t.default=i},68627:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(42238),s=i(74046);class o{constructor(e){var t,i,s,r,a,d,c;try{this.parserResult=navigator&&navigator.userAgent?new n.UAParser(navigator.userAgent).getResult():void 0}catch(l){e.error(l.message)}this.browserMajorVersion=(null===(s=null===(i=null===(t=this.parserResult)||void 0===t?void 0:t.browser)||void 0===i?void 0:i.version)||void 0===s?void 0:s.split(".")[0])||o.UNAVAILABLE,this.browserName=(null===(r=this.parserResult)||void 0===r?void 0:r.browser.name)||o.UNAVAILABLE,this.browserVersion=(null===(a=this.parserResult)||void 0===a?void 0:a.browser.version)||o.UNAVAILABLE,this.deviceName=[(null===(d=this.parserResult)||void 0===d?void 0:d.device.vendor)||"",(null===(c=this.parserResult)||void 0===c?void 0:c.device.model)||""].join(" ").trim()||o.UNAVAILABLE}getParserResult(){var e,t;return{browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,osName:(null===(e=this.parserResult)||void 0===e?void 0:e.os.name)||o.UNAVAILABLE,osVersion:(null===(t=this.parserResult)||void 0===t?void 0:t.os.version)||o.UNAVAILABLE,sdkVersion:s.default.sdkVersion,sdkName:s.default.sdkName}}}t.default=o,o.UNAVAILABLE="Unavailable"},28660:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.None=t.Some=t.Maybe=void 0;class i{static of(e){return void 0===e||null===e?s.of():n.of(e)}}t.Maybe=i;class n{constructor(e){this.value=e,this.isSome=!0,this.isNone=!1}map(e){return i.of(e(this.value))}flatMap(e){return e(this.value)}get(){return this.value}getOrElse(e){return this.value}defaulting(e){return i.of(this.getOrElse(e))}static of(e){if(null===e||void 0===e)throw new Error("value is ${value}");return new n(e)}}t.Some=n;class s{constructor(){this.isSome=!1,this.isNone=!0}get(){throw new Error("value is null")}getOrElse(e){return e}map(e){return new s}flatMap(e){return new s}defaulting(e){return i.of(this.getOrElse(e))}static of(){return new s}}t.None=s},12571:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toLowerCasePropertyNames=t.isIFramed=t.wait=void 0,t.wait=function(e){return new Promise((t=>setTimeout(t,e)))},t.isIFramed=function(){var e;try{return"IFRAME"===(null===(e=window.frameElement)||void 0===e?void 0:e.nodeName)||parent!==top}catch(t){return!0}},t.toLowerCasePropertyNames=function e(t){return null===t?null:"object"!==typeof t?t:Array.isArray(t)?t.map(e):Object.keys(t).reduce(((i,n)=>{const s=t[n],o="object"===typeof s?e(s):s;return i[n.toLowerCase()]=o,i}),{})}},74046:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(90543),s=i(72336);class o{static get sdkName(){return"amazon-chime-sdk-js"}static get sdkVersion(){return s.default.semverString}static get sdkVersionSemVer(){var e,t,i;const n=s.default.semverString.match(/^(?<major>[0-9]+)\.(?<minor>[0-9]+)(?:\.(?<patch>[0-9]+))?/);return{major:null===(e=null===n||void 0===n?void 0:n.groups)||void 0===e?void 0:e.major,minor:null===(t=null===n||void 0===n?void 0:n.groups)||void 0===t?void 0:t.minor,patch:null===(i=null===n||void 0===n?void 0:n.groups)||void 0===i?void 0:i.patch}}static get buildSHA(){return s.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(o.X_AMZN_VERSION,o.sdkVersion),t.searchParams.append(o.X_AMZN_USER_AGENT,o.sdkUserAgentLowResolution),t.toString()}}t.default=o,o.X_AMZN_VERSION="X-Amzn-Version",o.X_AMZN_USER_AGENT="X-Amzn-User-Agent"},72336:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.default={hash:"373d1f1",raw:"v2.31.0",semverString:"2.31.0"}},51133:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(e,t,i,n,s,o=1){this.cameraWidth=e,this.cameraHeight=t,this.cameraFrameRate=i,this.maxEncodeBitrateKbps=n,this.isSimulcast=s,this.scaleResolutionDownBy=o}equal(e){let t=e.captureWidth()===this.cameraWidth&&e.captureHeight()===this.cameraHeight&&e.captureFrameRate()===this.cameraFrameRate&&e.encodeBitrates().length===this.encodeBitrates().length&&e.encodeScaleResolutionDownBy().length===this.encodeScaleResolutionDownBy().length&&e.encodeWidths().length===this.encodeWidths().length&&e.encodeHeights().length===this.encodeHeights().length;if(t)for(let i=0;i<e.encodeWidths().length;i++)if(e.encodeWidths()[i]!==this.encodeWidths()[i]||e.encodeHeights()[i]!==this.encodeHeights()[i]||e.encodeBitrates()[i]!==this.encodeBitrates()[i]||e.encodeScaleResolutionDownBy()[i]!==this.encodeScaleResolutionDownBy()[i])return t=!1,t;return t}clone(){return new i(this.cameraWidth,this.cameraHeight,this.cameraFrameRate,this.maxEncodeBitrateKbps,this.isSimulcast,this.scaleResolutionDownBy)}captureWidth(){return this.cameraWidth}captureHeight(){return this.cameraHeight}captureFrameRate(){return this.cameraFrameRate}encodeBitrates(){return[this.maxEncodeBitrateKbps]}encodeScaleResolutionDownBy(){return[this.scaleResolutionDownBy]}encodeWidths(){return[this.cameraWidth]}encodeHeights(){return[this.cameraHeight]}}t.default=i},75185:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(91508);t.default=class{constructor(e){this.selfAttendeeId=e,this.reset()}reset(){this.optimalReceiveSet=new n.default,this.subscribedReceiveSet=new n.default,this.videoSources=void 0}updateIndex(e){this.videoIndex=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()}chooseRemoteVideoSources(e){this.videoSources=e,this.optimalReceiveSet=this.calculateOptimalReceiveSet(this.videoIndex).clone()}calculateOptimalReceiveSet(e){const t=new n.default;if(!this.videoIndex||this.videoIndex.allStreams().empty())return t;const i=e.highestQualityStreamFromEachGroupExcludingSelf(this.selfAttendeeId);if(void 0===this.videoSources)return i;const s=this.videoIndex.remoteStreamDescriptions(),o=new Map;for(const n of s)i.contain(n.streamId)&&o.set(n.attendeeId,n.streamId);for(const n of this.videoSources){const e=n.attendee.attendeeId;o.has(e)&&t.add(o.get(e))}return t}}},5319:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(91508);t.default=class{reset(){}updateIndex(e){}updateMetrics(e){}wantsResubscribe(){return!1}chooseSubscriptions(){return new n.default}}},42721:function(e,t){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.TargetDisplaySize=void 0,function(e){e[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High"}(i=t.TargetDisplaySize||(t.TargetDisplaySize={})),t.default=i},12880:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(18890),s=i(91754),o=i(21819),r=i(84992);class a extends r.default{constructor(e){super(e),this.logger=e,super.shouldPauseTiles=!1,this.videoPreferences=void 0}reset(){super.reset(),super.shouldPauseTiles=!1,this.videoPreferences=void 0}updateIndex(e){super.updateIndex(e);const t=o.VideoPreferences.prepare();let i=!1;const r=e.remoteStreamDescriptions();for(const o of r)t.some((e=>e.attendeeId===o.attendeeId))||(o.attendeeId.endsWith(n.default.Modality)?(t.add(new s.default(o.attendeeId,1)),i=!0):t.add(new s.default(o.attendeeId,2)));i?(this.videoPreferences=t.build(),this.videoPreferencesUpdated=!0):this.videoPreferences=void 0}chooseRemoteVideoSources(e){this.logger.error("chooseRemoteVideoSources should not be called by VideoAdaptiveProbePolicy")}}t.default=a},91754:function(e,t,i){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});const n=i(42721);class s{constructor(e,t,i){this.attendeeId=e,this.priority=t,this.targetSize=void 0!==i?i:n.default.High}partialCompare(e){return this.priority-e.priority}equals(e){return this.attendeeId===e.attendeeId&&this.targetSize===e.targetSize&&this.priority===e.priority}clone(){return new s(this.attendeeId,this.priority,this.targetSize)}targetSizeToBitrateKbps(e){switch(e){case n.default.High:return s.HIGH_BITRATE_KBPS;case n.default.Medium:return s.MID_BITRATE_KBPS;case n.default.Low:return s.LOW_BITRATE_KBPS}}}t.default=s,s.LOW_BITRATE_KBPS=300,s.MID_BITRATE_KBPS=600,s.HIGH_BITRATE_KBPS=1200},21819:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VideoPreferences=t.MutableVideoPreferences=void 0;class i{constructor(e=[]){this.items=e}static default(){return new i([])}[Symbol.iterator](){let e=0;const t=this.items;return{next:()=>e<t.length?{done:!1,value:t[e++]}:{done:!0,value:null}}}first(){return this.items[0]}add(e){this.items.push(e)}replaceFirst(e,t){const i=this.items.findIndex(t);-1===i?this.items.push(e):this.has(e)?this.items.splice(i,1):this.items[i]=e}remove(e){this.items=this.items.filter((t=>!t.equals(e)))}clear(){this.items=[]}isEmpty(){return 0===this.items.length}equals(e){if(e===this)return!0;if(e.items.length!==this.items.length)return!1;for(const t of this.items)if(!e.items.some((e=>e.equals(t))))return!1;return!0}has(e){return this.items.some((t=>t.equals(e)))}some(e){return this.items.some(e)}clone(){return new i([...this.items])}sort(){this.items.sort(((e,t)=>e.partialCompare(t)))}modify(){return new n(this)}}class n{constructor(e=new i){this.items=e,this.copied=!1}cow(){this.copied||(this.items=this.items.clone(),this.copied=!0)}add(e){this.items.has(e)||(this.cow(),this.items.add(e))}replaceFirst(e,t){this.items.has(e)&&!this.items.some(t)||(this.cow(),this.items.replaceFirst(e,t))}remove(e){this.items.has(e)&&(this.cow(),this.items.remove(e))}some(e){return this.items.some(e)}clear(){this.items.isEmpty()||(this.cow(),this.items.clear())}build(){return this.copied&&this.items.sort(),this.copied=!1,this.items}}class s{constructor(e){this.builder=e}add(e){this.builder.add(e)}replaceFirst(e,t){this.builder.replaceFirst(e,t)}remove(e){this.builder.remove(e)}some(e){return this.builder.some(e)}clear(){this.builder.clear()}build(){return new o(this.builder.build())}}t.MutableVideoPreferences=s;class o{constructor(e){this.items=e}static prepare(){return new s(new n)}static default(){return new o(i.default())}[Symbol.iterator](){return this.items[Symbol.iterator]()}highestPriority(){var e;return null===(e=this.items.first())||void 0===e?void 0:e.priority}sorted(){return this.items[Symbol.iterator]()}equals(e){return e===this||this.items.equals(e.items)}modify(){return new s(this.items.modify())}some(e){return this.items.some(e)}isEmpty(){return this.items.isEmpty()}clone(){const e=o.prepare();for(const t of this.items)e.add(t.clone());return e.build()}}t.VideoPreferences=o,t.default=o},84992:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(56196),s=i(99496),o=i(18890),r=i(70813),a=i(91508),d=i(42721),c=i(91754),l=i(21819),u=i(91034);class h{constructor(){this.bandwidthEstimateKbps=0,this.usedBandwidthKbps=0,this.packetsLost=0,this.nackCount=0,this.rttMs=0}}class f{constructor(e,t=u.default.Default){this.logger=e,this.videoPriorityBasedPolicyConfig=t,this.shouldPauseTiles=!0,this.observerQueue=new Set,this.pausedBwAttendeeIds=new Set,this.reset()}reset(){this.optimalReceiveSet=new a.default,this.optimalReceiveStreams=[],this.optimalNonPausedReceiveStreams=[],this.subscribedReceiveSet=new a.default,this.subscribedReceiveStreams=[],this.videoPreferences=void 0,this.defaultVideoPreferences=void 0,this.shouldPauseTiles=!0,this.pausedStreamIds=new a.default,this.pausedBwAttendeeIds=new Set,this.videoPreferencesUpdated=!1,this.logCount=0,this.startupPeriod=!0,this.usingPrevTargetRate=!1,this.rateProbeState="Not Probing",this.firstEstimateTimestamp=0,this.lastUpgradeRateKbps=0,this.timeBeforeAllowSubscribeMs=f.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.lastProbeTimestamp=Date.now(),this.timeBeforeAllowProbeMs=f.MIN_TIME_BETWEEN_PROBE_MS,this.downlinkStats=new h,this.prevDownlinkStats=new h,this.probeFailed=!1}bindToTileController(e){this.tileController=e,this.logger.info("tileController bound")}chooseRemoteVideoSources(e){var t;(null===(t=this.videoPreferences)||void 0===t?void 0:t.equals(e))||(this.videoPreferences=null===e||void 0===e?void 0:e.clone(),this.videoPreferencesUpdated=!0,this.logger.info(`bwe: setVideoPreferences bwe: new preferences: ${JSON.stringify(e)}`))}updateIndex(e){this.videoIndex=e,this.videoPreferences||this.updateDefaultVideoPreferences()}updateDefaultVideoPreferences(){const e=new Set;for(const s of this.videoIndex.remoteStreamDescriptions())e.add(s.attendeeId);const t=l.VideoPreferences.prepare(),i=e.size;let n=d.default.High;i>8?n=d.default.Low:i>4&&(n=d.default.Medium);for(const s of e)t.add(new c.default(s,1,n));this.defaultVideoPreferences=t.build()}updateMetrics(e){if(!this.videoIndex||this.videoIndex.allStreams().empty())return;this.prevDownlinkStats=this.downlinkStats,this.downlinkStats=new h;const t=e.getObservableMetrics();isNaN(t.availableIncomingBitrate)?this.downlinkStats.bandwidthEstimateKbps=t.availableReceiveBandwidth/1e3:this.downlinkStats.bandwidthEstimateKbps=t.availableIncomingBitrate/1e3;for(const i in e.streamMetricReports){const t=Number.parseInt(i,10),o=e.streamMetricReports[t];o.direction===n.default.DOWNSTREAM&&o.mediaType===s.default.VIDEO&&(o.currentMetrics.hasOwnProperty("googNacksSent")?this.downlinkStats.nackCount+=e.countPerSecond("googNacksSent",t):o.currentMetrics.hasOwnProperty("nackCount")&&(this.downlinkStats.nackCount+=e.countPerSecond("nackCount",t)),o.currentMetrics.hasOwnProperty("packetsLost")&&(this.downlinkStats.packetsLost+=e.countPerSecond("packetsLost",t)),o.currentMetrics.hasOwnProperty("bytesReceived")&&(this.downlinkStats.usedBandwidthKbps+=e.bitsPerSecond("bytesReceived",t)/1e3))}}wantsResubscribe(){return this.calculateOptimalReceiveSet(),!this.subscribedReceiveSet.equal(this.optimalReceiveSet)}chooseSubscriptions(){return this.subscribedReceiveSet.equal(this.optimalReceiveSet)||(this.lastSubscribeTimestamp=Date.now()),this.subscribedReceiveSet=this.optimalReceiveSet.clone(),this.subscribedReceiveStreams=this.optimalReceiveStreams.slice(),this.subscribedReceiveSet.clone()}addObserver(e){this.observerQueue.add(e)}removeObserver(e){this.observerQueue.delete(e)}forEachObserver(e){for(const t of this.observerQueue)e(t)}setVideoPriorityBasedPolicyConfigs(e){this.videoPriorityBasedPolicyConfig=e}calculateOptimalReceiveStreams(){var e;const t=[],i=this.videoIndex.remoteStreamDescriptions();if(0===i.length||(null===(e=this.videoPreferences)||void 0===e?void 0:e.isEmpty()))return void(this.optimalReceiveStreams=[]);const n=this.rateProbeState;this.cleanBwPausedTiles(i),this.handleAppPausedStreams(t,i);const s=this.availStreamsSameAsLast(i),a=!this.startupPeriod&&s;if(a&&Date.now()-this.lastSubscribeTimestamp<this.timeBeforeAllowSubscribeMs)return;i.sort(((e,t)=>e.maxBitrateKbps===t.maxBitrateKbps?e.streamId-t.streamId:e.maxBitrateKbps-t.maxBitrateKbps));for(const r of i)(0===r.avgBitrateKbps||r.avgBitrateKbps>r.maxBitrateKbps)&&(r.attendeeId.endsWith(o.default.Modality)&&r.maxBitrateKbps<100?r.maxBitrateKbps=r.avgBitrateKbps:r.avgBitrateKbps=r.maxBitrateKbps);const d={targetDownlinkBitrate:0,chosenTotalBitrate:0,deltaToNextUpgrade:0};d.targetDownlinkBitrate=this.determineTargetRate();const c=this.subscribedReceiveSet.size(),l=this.downlinkStats.bandwidthEstimateKbps,u=!this.videoPriorityBasedPolicyConfig.allowSubscribe(c,l);if(this.probeFailed&&(this.probeFailed=!1,this.timeBeforeAllowSubscribeMs=f.MIN_TIME_BETWEEN_SUBSCRIBE_MS,a&&u))return;const h=this.priorityPolicy(d,i,t);let g=0;if(!this.startupPeriod&&s?"Probing"===this.rateProbeState?g=this.handleProbe(t,d.targetDownlinkBitrate):0!==d.deltaToNextUpgrade&&(g=this.maybeOverrideOrProbe(t,d,h)):(this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0),this.prevRemoteInfos=i,this.videoPreferencesUpdated=!1,1===g)return this.logger.info(`bwe: keepSameSubscriptions stats:${JSON.stringify(this.downlinkStats)}`),void(this.prevTargetRateKbps=d.targetDownlinkBitrate);
1if(2===g){const e=this.calculateSubscribeRate(this.preProbeNonPausedReceiveStreams);return this.optimalReceiveStreams=this.preProbeReceiveStreams.slice(),this.processBwPausedStreams(i,this.preProbeNonPausedReceiveStreams),void this.logger.info("bwe: Use Pre-Probe subscription subscribedRate:"+e)}this.optimalNonPausedReceiveStreams=t.slice();const p=this.pausedBwAttendeeIds.size;this.processBwPausedStreams(i,t),this.logger.getLogLevel()<=r.LogLevel.INFO&&(this.logCount%15===0||this.rateProbeState!==n||this.optimalReceiveStreams.length!==t.length||p!==this.pausedBwAttendeeIds.size)&&(this.logger.info(this.policyStateLogStr(i,d.targetDownlinkBitrate)),this.logCount=0),this.logCount++,this.prevTargetRateKbps=d.targetDownlinkBitrate,this.optimalReceiveStreams=t.slice()}calculateOptimalReceiveSet(){const e=new a.default;this.calculateOptimalReceiveStreams();for(const t of this.optimalReceiveStreams)e.add(t.streamId);if(!this.optimalReceiveSet.equal(e)){const t=this.calculateSubscribeRate(this.optimalReceiveStreams);this.logger.info(`bwe: new streamSelection: ${JSON.stringify(e)} subscribedRate:${t}`)}this.optimalReceiveSet=e}determineTargetRate(){let e=0;const t=Date.now();return 0!==this.downlinkStats.bandwidthEstimateKbps?(0===this.firstEstimateTimestamp&&(this.firstEstimateTimestamp=t),this.startupPeriod&&(this.downlinkStats.bandwidthEstimateKbps>f.DEFAULT_BANDWIDTH_KBPS||this.downlinkStats.packetsLost>0||t-this.firstEstimateTimestamp>f.STARTUP_PERIOD_MS&&this.downlinkStats.bandwidthEstimateKbps<=this.prevDownlinkStats.bandwidthEstimateKbps)&&(this.startupPeriod=!1,this.prevTargetRateKbps=this.downlinkStats.bandwidthEstimateKbps),this.startupPeriod?e=f.DEFAULT_BANDWIDTH_KBPS:"Probing"===this.rateProbeState&&this.downlinkStats.usedBandwidthKbps>this.downlinkStats.bandwidthEstimateKbps&&this.downlinkStats.packetsLost<f.SPURIOUS_PACKET_LOST_THRESHOLD?(this.logger.info(`bwe: In probe state, overriding estimate ${this.downlinkStats.bandwidthEstimateKbps} with actual receive bitrate ${this.downlinkStats.usedBandwidthKbps}`),e=this.downlinkStats.usedBandwidthKbps+f.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS):e=this.downlinkStats.bandwidthEstimateKbps):e=0===this.firstEstimateTimestamp?f.DEFAULT_BANDWIDTH_KBPS:this.prevTargetRateKbps,!this.startupPeriod&&(this.usingPrevTargetRate&&this.downlinkStats.bandwidthEstimateKbps<this.prevTargetRateKbps||this.downlinkStats.bandwidthEstimateKbps<this.prevTargetRateKbps*(100-f.LARGE_RATE_CHANGE_TRIGGER_PERCENT)/100||this.downlinkStats.bandwidthEstimateKbps<this.downlinkStats.usedBandwidthKbps*f.LARGE_RATE_CHANGE_TRIGGER_PERCENT/100)&&0===this.downlinkStats.packetsLost?(this.logger.debug((()=>"bwe: ValidateRate: Using Previous rate "+this.prevTargetRateKbps)),this.usingPrevTargetRate=!0,e=this.prevTargetRateKbps):this.usingPrevTargetRate=!1,e}setProbeState(e){if(this.rateProbeState===e)return!1;const t=Date.now();switch(e){case"Not Probing":this.probePendingStartTimestamp=0;break;case"Probe Pending":if(!(0===this.lastProbeTimestamp||t-this.lastProbeTimestamp>f.MIN_TIME_BETWEEN_PROBE_MS))return!1;this.probePendingStartTimestamp=t;break;case"Probing":if(!(t-this.probePendingStartTimestamp>this.timeBeforeAllowProbeMs))return!1;this.lastProbeTimestamp=t,this.preProbeReceiveStreams=this.subscribedReceiveStreams.slice(),this.preProbeNonPausedReceiveStreams=this.optimalNonPausedReceiveStreams,this.timeBeforeAllowProbeMs=Math.min(2*this.timeBeforeAllowProbeMs,f.MAX_HOLD_BEFORE_PROBE_MS)}return this.logger.info("bwe: setProbeState to "+e+" from "+this.rateProbeState),this.rateProbeState=e,!0}upgradeToStream(e,t){for(let i=0;i<e.length;i++)if(e[i].groupId===t.groupId){const n=t.avgBitrateKbps-e[i].avgBitrateKbps;return this.logger.info("bwe: upgradeStream from "+JSON.stringify(e[i])+" to "+t),this.lastUpgradeRateKbps=n,e[i]=t,n}return e.push(t),this.lastUpgradeRateKbps=t.avgBitrateKbps,this.lastUpgradeRateKbps}handleProbe(e,t){if(Date.now()-this.lastProbeTimestamp>f.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&&(this.logger.info(`bwe: Probe encountering packets lost:${this.downlinkStats.packetsLost}`),this.downlinkStats.packetsLost>f.SPURIOUS_PACKET_LOST_THRESHOLD))return this.setProbeState("Not Probing"),this.logger.info(`bwe: Canceling probe due to packets lost:${this.downlinkStats.packetsLost}`),this.probeFailed=!0,this.timeBeforeAllowSubscribeMs=3*Math.max(f.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.timeBeforeAllowSubscribeMs),2;const i=this.calculateSubscribeRate(this.optimalReceiveStreams);return this.chosenStreamsSameAsLast(e)||t>i?(this.logger.info("bwe: Probe successful"),this.setProbeState("Not Probing"),this.timeBeforeAllowProbeMs=f.MIN_TIME_BETWEEN_PROBE_MS,0):1}maybeOverrideOrProbe(e,t,i){const n=this.chosenStreamsSameAsLast(e);let s=0;const o=t.targetDownlinkBitrate>f.LOW_BITRATE_THRESHOLD_KBPS?f.TARGET_RATE_CHANGE_TRIGGER_PERCENT:2*f.TARGET_RATE_CHANGE_TRIGGER_PERCENT,r=t.targetDownlinkBitrate*o/100;if(this.targetRateBaselineForDeltaCheckKbps=void 0!==this.targetRateBaselineForDeltaCheckKbps?this.targetRateBaselineForDeltaCheckKbps:this.prevTargetRateKbps,!n&&Math.abs(t.targetDownlinkBitrate-this.targetRateBaselineForDeltaCheckKbps)<r?(this.logger.info("bwe: MaybeOverrideOrProbe: Reuse last decision based on delta rate. {"+JSON.stringify(this.subscribedReceiveSet)+"}"),s=1):this.targetRateBaselineForDeltaCheckKbps=t.targetDownlinkBitrate,this.downlinkStats.packetsLost>this.prevDownlinkStats.packetsLost)return this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0,s;if(n||1===s)switch(this.rateProbeState){case"Not Probing":this.setProbeState("Probe Pending");break;case"Probe Pending":this.setProbeState("Probing")&&(this.upgradeToStream(e,i),s=0)}else this.setProbeState("Not Probing");return s}calculateSubscribeRate(e){let t=0;for(const i of e)this.pausedStreamIds.contain(i.streamId)||this.pausedBwAttendeeIds.has(i.attendeeId)||(t+=i.maxBitrateKbps);return t}handleAppPausedStreams(e,t){if(!this.tileController)return void this.logger.warn("tileController not found!");this.pausedStreamIds=new a.default;const i=this.tileController.getAllRemoteVideoTiles();for(const n of i){const i=n.state();if(i.paused&&!this.pausedBwAttendeeIds.has(i.boundAttendeeId)){let n=t.length;for(;n--;)t[n].attendeeId===i.boundAttendeeId&&(this.logger.info("bwe: removed paused attendee "+i.boundAttendeeId+" streamId: "+t[n].streamId),this.pausedStreamIds.add(t[n].streamId),this.subscribedReceiveSet.contain(t[n].streamId)&&e.push(t[n]),t.splice(n,1))}}}processBwPausedStreams(e,t){if(!this.tileController)return void this.logger.warn("tileController not found!");const i=this.getCurrentVideoPreferences();if(i&&this.shouldPauseTiles){const n=this.tileController.getAllVideoTiles();for(const s of i){const i=this.getVideoTileForAttendeeId(s.attendeeId,n),o=(null===i||void 0===i?void 0:i.state().paused)||!1;if(t.some((e=>e.attendeeId===s.attendeeId)))o&&this.pausedBwAttendeeIds.has(s.attendeeId)&&(this.logger.info(`bwe: unpausing attendee ${s.attendeeId} due to bandwidth`),this.forEachObserver((e=>{e.tileWillBeUnpausedByDownlinkPolicy(i.id())})),this.tileController.unpauseVideoTile(i.id()),this.pausedBwAttendeeIds.delete(s.attendeeId));else{const n=e.some((e=>e.attendeeId===s.attendeeId));if(i&&n){const e=this.optimalReceiveStreams.find((e=>e.attendeeId===s.attendeeId));void 0!==e&&(o||(this.logger.info(`bwe: pausing streamId ${e.streamId} attendee ${s.attendeeId} due to bandwidth`),this.forEachObserver((e=>{e.tileWillBePausedByDownlinkPolicy(i.id())})),this.tileController.pauseVideoTile(i.id())),t.push(e)),this.pausedBwAttendeeIds.add(s.attendeeId)}else if(n){const e=this.tileController.addVideoTile();e.bindVideoStream(s.attendeeId,!1,null,0,0,0,null),this.forEachObserver((t=>{t.tileWillBePausedByDownlinkPolicy(e.id())}
1)),e.pause(),this.logger.info(`bwe: Created video tile ${e.id()} for bw paused attendee ${s.attendeeId}`),this.pausedBwAttendeeIds.add(s.attendeeId)}}}}}cleanBwPausedTiles(e){if(!this.tileController)return void this.logger.warn("tileController not found!");const t=this.tileController.getAllRemoteVideoTiles(),i=this.getCurrentVideoPreferences();for(const n of t){const t=n.state();t.boundVideoStream||(e.some((e=>e.attendeeId===t.boundAttendeeId))?void 0===i||i.some((e=>e.attendeeId===t.boundAttendeeId))||this.tileController.removeVideoTile(t.tileId):(this.tileController.removeVideoTile(t.tileId),this.logger.info(`bwe: Removed video tile ${t.tileId} for bw paused attendee ${t.boundAttendeeId}`)))}}priorityPolicy(e,t,i){let n;const s=this.getCurrentVideoPreferences(),o=s.highestPriority();let r,a=o;for(;-1!==a;){r=-1;for(const o of s)if(o.priority===a)for(const s of t)s.attendeeId===o.attendeeId&&(i.some((e=>e.groupId===s.groupId))||(e.chosenTotalBitrate+s.avgBitrateKbps<=e.targetDownlinkBitrate?(i.push(s),e.chosenTotalBitrate+=s.avgBitrateKbps):0===e.deltaToNextUpgrade&&(e.deltaToNextUpgrade=s.avgBitrateKbps,n=s)));else if(o.priority>a){r=o.priority;break}for(const o of s)if(o.priority===a){for(const s of t)if(s.attendeeId===o.attendeeId){const r=i.findIndex((e=>e.groupId===s.groupId&&e.maxBitrateKbps<s.maxBitrateKbps));if(-1!==r){const a=s.avgBitrateKbps-i[r].avgBitrateKbps;this.hasSimulcastStreams(t,s.attendeeId,s.groupId)&&this.canUpgrade(s.avgBitrateKbps,o.targetSizeToBitrateKbps(o.targetSize))?(this.logger.info(`bwe: attendee: ${s.attendeeId} group: ${s.groupId} has simulcast and can upgrade avgBitrate: ${s.avgBitrateKbps} target: ${o.targetSizeToBitrateKbps(o.targetSize)} targetTotalBitrate: ${e.targetDownlinkBitrate}`),e.chosenTotalBitrate+a<=e.targetDownlinkBitrate?(e.chosenTotalBitrate+=a,i[r]=s):0===e.deltaToNextUpgrade&&(e.deltaToNextUpgrade=a,n=s)):this.logger.info("bwe: cannot upgrade stream quality beyond target size")}}}else if(o.priority>a)break;if(a===o&&0!==e.deltaToNextUpgrade)break;a=r}return n}getVideoTileForAttendeeId(e,t){for(const i of t){if(i.state().boundAttendeeId===e)return i}return null}canUpgrade(e,t){return e<=t?(this.logger.info(`bwe: canUpgrade: bitrateKbp: ${e} targetBitrateKbp: ${t}`),!0):(this.logger.info(`bwe: cannot Upgrade: bitrateKbp: ${e} targetBitrateKbp: ${t}`),!1)}hasSimulcastStreams(e,t,i){let n=0;for(const s of e)s.attendeeId===t&&s.groupId===i&&n++;return this.logger.info(`bwe: attendeeId: ${t} groupId: ${i} hasSimulcastStreams: streamCount: ${n}`),n>1}availStreamsSameAsLast(e){if(void 0===this.prevRemoteInfos||e.length!==this.prevRemoteInfos.length||!0===this.videoPreferencesUpdated)return!1;for(const t of e){if(void 0===this.prevRemoteInfos.find((e=>e.groupId===t.groupId&&e.streamId===t.streamId&&e.maxBitrateKbps===t.maxBitrateKbps)))return!1}return!0}chosenStreamsSameAsLast(e){if(this.optimalNonPausedReceiveStreams.length!==e.length)return!1;for(const t of this.optimalNonPausedReceiveStreams)if(!e.some((e=>e.streamId===t.streamId)))return!1;return!0}policyStateLogStr(e,t){const i={targetBitrate:t,subscribedRate:this.calculateSubscribeRate(this.optimalReceiveStreams),probeState:this.rateProbeState,startupPeriod:this.startupPeriod};let n="remoteInfos: [";for(const o of e)n+=`{grpId:${o.groupId} strId:${o.streamId} maxBr:${o.maxBitrateKbps} avgBr:${o.avgBitrateKbps}}, `;n+="]";let s=`bwe: optimalReceiveSet ${JSON.stringify(i)}\nbwe: prev ${JSON.stringify(this.prevDownlinkStats)}\nbwe: now ${JSON.stringify(this.downlinkStats)}\nbwe: ${n}\n`;return(this.pausedStreamIds.size()>0||this.pausedBwAttendeeIds.size>0)&&(s+=`bwe: paused: app stream ids ${JSON.stringify(this.pausedStreamIds)} bw attendees { ${Array.from(this.pausedBwAttendeeIds).join(" ")} }\n`),this.videoPreferences?s+=`bwe: preferences: ${JSON.stringify(this.videoPreferences)}`:s+=`bwe: default preferences: ${JSON.stringify(this.defaultVideoPreferences)}`,s}getCurrentVideoPreferences(){return this.videoPreferences||this.defaultVideoPreferences}}t.default=f,f.DEFAULT_BANDWIDTH_KBPS=2800,f.STARTUP_PERIOD_MS=6e3,f.LARGE_RATE_CHANGE_TRIGGER_PERCENT=20,f.TARGET_RATE_CHANGE_TRIGGER_PERCENT=15,f.LOW_BITRATE_THRESHOLD_KBPS=300,f.MIN_TIME_BETWEEN_PROBE_MS=5e3,f.MIN_TIME_BETWEEN_SUBSCRIBE_MS=2e3,f.MAX_HOLD_BEFORE_PROBE_MS=3e4,f.MAX_ALLOWED_PROBE_TIME_MS=6e4,f.SPURIOUS_PACKET_LOST_THRESHOLD=2,f.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS=100},91034:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(e=0,t=0){this.networkIssueResponseDelayFactor=e,this.networkIssueRecoveryDelayFactor=t,this.currentNetworkEvent=0,this.bandwidthDecreaseTimestamp=0,this.referenceBitrate=0,e<0?e=0:e>1&&(e=1),this.networkIssueResponseDelayFactor=e,t<0?t=0:t>1&&(t=1),this.networkIssueRecoveryDelayFactor=t}allowSubscribe(e,t){let i=0;const n=this.currentNetworkEvent;if(t>this.referenceBitrate)return this.currentNetworkEvent=2,this.referenceBitrate=t,!0;if(t<this.referenceBitrate){if(this.currentNetworkEvent=1,i=this.getSubscribeDelay(this.currentNetworkEvent,e),1!==n)this.bandwidthDecreaseTimestamp=Date.now();else if(Date.now()-this.bandwidthDecreaseTimestamp>i)return this.referenceBitrate=t,!0;return!1}return this.currentNetworkEvent=0,!1}getSubscribeDelay(e,t){let n=i.MINIMUM_DELAY_MS;const s=i.MAXIMUM_DELAY_MS-i.MINIMUM_DELAY_MS,o=this.networkIssueResponseDelayFactor;if(1===e)n+=s*o*(1+t/10),n=Math.min(i.MAXIMUM_DELAY_MS,n);return n}}t.default=i,i.MINIMUM_DELAY_MS=2e3,i.MAXIMUM_DELAY_MS=8e3,i.Default=new i(0,0),i.UnstableNetworkPreset=new i(0,1),i.StableNetworkPreset=new i(1,0)},13663:function(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()}}}},19807:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((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 i(this,void 0,void 0,(function*(){return this.destroyed?Promise.reject("canvas buffer is destroyed"):Promise.resolve(this.canvas)}))}asCanvasElement(){return this.canvas}}},38919:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(19807);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,i=[];i.push(this.sourceBuffers[0]);try{for(const e of this.processors)i=yield e.process(i)}catch(d){return void this.forEachObserver((e=>{e.processingDidFailToStart&&e.processingDidFailToStart()}))}this.destBuffers=i;try{t=yield this.destBuffers[0].asCanvasImageSource()}catch(c){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,s=t.height;0!==n&&0!==s&&(this.canvasOutput.width!==n&&this.canvasOutput.height!==s&&(this.canvasOutput.width=n,this.canvasOutput.height=s),this.outputCtx.drawImage(t,0,0,n,s,0,0,n,s),this.hasStarted||(this.hasStarted=!0,this.forEachObserver((e=>{e.processingDidStart&&e.processingDidStart()}))));const o=performance.now()-e,r=2e3/this.framerate-o,a=Math.max(0,1e3/this.framerate-o);r<=0&&this.forEachObserver((e=>{e.processingLatencyTooHigh&&e.processingLatencyTooHigh(o)})),this.lastTimeOut=setTimeout(this.process,a)}))}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");
1this.inputVideoStream=e;const t=this.inputVideoStream.getVideoTracks()[0].getSettings();this.logger.info(`processing pipeline input stream settings ${JSON.stringify(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 i=new s.default(this.canvasInput);this.sourceBuffers.push(i),this.videoInput.load();try{yield this.videoInput.play()}catch(n){this.logger.warn("Video element play() overrided by another load().")}}))}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=[]}}},67673:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(90543),o=i(38919);class r{constructor(e,t,i,n=new s.default){this.logger=e,this.device=t,this.processors=i,this.browserBehavior=n,this.observers=new Set,this.pipe=new o.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 t of this.inputMediaStream.getVideoTracks())t.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.delete(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},52801:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});t.default=class{process(e){return i(this,void 0,void 0,(function*(){return e}))}destroy(){return i(this,void 0,void 0,(function*(){}))}}},90060:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},91508:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{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)}forEach(e){this.ids.forEach(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(),i=e.array();if(t.length!==i.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==i[n])return!1;return!0}clone(){return new i(this.array())}remove(e){this.ids.delete(e)}toJSON(){return this.array()}truncate(e){const t=this.array();return new i(t.splice(0,e))}}t.default=i},91318:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(20289),s=i(91508),o=i(96876);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 o.default,this.videoStreamDescription.trackLabel="AmazonChimeExpressVideo",this.videoStreamDescription.streamId=2,this.videoStreamDescription.groupId=2}localStreamDescriptions(){return[this.videoStreamDescription.clone()]}convertBpsToKbps(e){return e>0&&e<1e3?1:Math.trunc(e/1e3)}remoteStreamDescriptions(){if(!this.currentIndex||!this.currentIndex.sources)return[];const e=[];return this.currentIndex.sources.forEach((t=>{const i=new o.default;i.attendeeId=t.attendeeId,i.groupId=t.groupId,i.streamId=t.streamId,i.maxBitrateKbps=t.maxBitrateKbps,i.avgBitrateKbps=this.convertBpsToKbps(t.avgBitrateBps),e.push(i)})),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 i=!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);e<n.groupId&&(this.logger.warn(`Old group ID ${e} found for attendee ID ${n.attendeeId}, replacing with newer group ID ${n.groupId}`),t.set(n.attendeeId,n.groupId)),i=!0}i&&(this.currentIndex.sources=this.currentIndex.sources.filter((e=>t.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 s.default;if(this.currentIndex)for(const t of this.currentIndex.sources)e.add(t.streamId);return e}allVideoSendingSourcesExcludingSelf(e){const t=[],i=new Set;if(this.currentIndex&&this.currentIndex.sources&&this.currentIndex.sources.length)for(const s of this.currentIndex.sources){const{attendeeId:o,externalUserId:r,mediaType:a}=s;o!==e&&a===n.SdkStreamMediaType.VIDEO&&(i.has(o)||(t.push({attendee:{attendeeId:o,externalUserId:r}}),i.add(o)))}return t}streamSelectionUnderBandwidthConstraint(e,t,i,o){const r=new Set;if(this.currentIndex)for(const s of this.currentIndex.sources)s.attendeeId!==e&&s.mediaType===n.SdkStreamMediaType.VIDEO&&(t.has(s.attendeeId)||i.has(s.attendeeId)||r.add(s.attendeeId));const a=this.buildAttendeeToSortedStreamDescriptorMapExcludingSelf(e),d=new Map;let c=0;a.forEach(((e,t)=>{d.set(t,e[0]),c+=e[0].maxBitrateKbps})),c=this.trySelectHighBitrateForAttendees(a,t,c,o,d),this.trySelectHighBitrateForAttendees(a,r,c,o,d);const l=new s.default;for(const n of d.values())l.add(n.streamId);return l}highestQualityStreamFromEachGroupExcludingSelf(e){const t=new s.default;if(this.currentIndex){const i=new Map;for(const t of this.currentIndex.sources)t.attendeeId!==e&&t.mediaType===n.SdkStreamMediaType.VIDEO&&(!i.has(t.groupId)||t.max
1BitrateKbps>i.get(t.groupId).maxBitrateKbps)&&i.set(t.groupId,t);for(const e of i.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);if(void 0===t||!this.subscribeStreamToAttendeeMap)return this.logger.warn(`no attendee found for track ${e}`),"";const i=this.subscribeStreamToAttendeeMap.get(t);return i||(this.logger.info(`track ${e} (stream ${t}) does not correspond to a known attendee`),"")}externalUserIdForTrack(e){const t=this.streamIdForTrack(e);if(void 0===t||!this.subscribeStreamToExternalUserIdMap)return this.logger.warn(`no external user id found for track ${e}`),"";const i=this.subscribeStreamToExternalUserIdMap.get(t);return i||(this.logger.info(`track ${e} (stream ${t}) does not correspond to a known externalUserId`),"")}attendeeIdForStreamId(e){if(!this.streamToAttendeeMap){if(!this.currentIndex)return"";this.streamToAttendeeMap=this.buildStreamToAttendeeMap(this.currentIndex)}const t=this.streamToAttendeeMap.get(e);return t||(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)}overrideStreamIdMappings(e,t){if(this.subscribeTrackToStreamMap)for(const[i,n]of this.subscribeTrackToStreamMap.entries())if(e===n){this.subscribeTrackToStreamMap.set(i,t);break}if(this.subscribeSsrcToStreamMap)for(const[i,n]of this.subscribeSsrcToStreamMap.entries())if(e===n){this.subscribeSsrcToStreamMap.set(i,t);break}}streamsPausedAtSource(){const e=new s.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 i of e.tracks)i.trackLabel.length>0&&i.streamId>0&&t.set(i.trackLabel,i.streamId);return t}buildSSRCToStreamMap(e){const t=new Map;this.logger.debug((()=>`ssrcMap ${JSON.stringify(e.tracks)}`));for(const i of e.tracks)i.trackLabel.length>0&&i.streamId>0&&t.set(i.ssrc,i.streamId);return t}buildStreamToAttendeeMap(e){const t=new Map;if(e)for(const i of e.sources)t.set(i.streamId,i.attendeeId);return t}buildStreamExternalUserIdMap(e){const t=new Map;if(e)for(const i of e.sources)i.externalUserId&&t.set(i.streamId,i.externalUserId);return t}trySelectHighBitrateForAttendees(e,t,i,n,s){for(const o of t){if(i>=n)break;if(e.has(o)){const t=e.get(o);for(const e of t.reverse())if(i-s.get(o).maxBitrateKbps+e.maxBitrateKbps<n){i=i-s.get(o).maxBitrateKbps+e.maxBitrateKbps,s.set(o,e);break}}}return i}buildAttendeeToSortedStreamDescriptorMapExcludingSelf(e){const t=new Map;if(this.currentIndex)for(const i of this.currentIndex.sources)i.attendeeId!==e&&i.mediaType===n.SdkStreamMediaType.VIDEO&&(t.has(i.attendeeId)?t.get(i.attendeeId).push(i):t.set(i.attendeeId,[i]));return t.forEach(((e,t)=>{e.sort(((e,t)=>e.maxBitrateKbps>t.maxBitrateKbps?1:e.maxBitrateKbps<t.maxBitrateKbps?-1:0))})),t}}},34242:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(20289),s=i(91318),o=i(96876);class r extends s.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,i=0;for(let n=0;n<e.length;n++){const s=e[n].maxBitrate/1e3,r=e[n].maxFramerate;if(t&&n!==this._localStreamInfos.length)0===this._localStreamInfos[i].maxBitrateKbps&&s>0&&(this._localStreamInfos[i].timeEnabled=Date.now()),this._localStreamInfos[i].maxBitrateKbps=s,this._localStreamInfos[i].maxFrameRate=r,this._localStreamInfos[i].disabledByU
1plinkPolicy=0===s,!0===this._localStreamInfos[i].disabledByUplinkPolicy&&(this._localStreamInfos[i].disabledByWebRTC=!1),i++;else{t=!1;const e=new o.default;e.maxBitrateKbps=s,e.maxFrameRate=r,e.disabledByUplinkPolicy=0===s,0!==s&&(e.timeEnabled=Date.now()),this._localStreamInfos.push(e),i++}}t&&this._localStreamInfos.splice(i)}integrateBitratesFrame(e){super.integrateBitratesFrame(e);const t=new Set,i=new Set(this.streamIdToBitrateKbpsMap.keys());for(const n of e.bitrates)t.add(n.sourceStreamId),this.streamIdToBitrateKbpsMap.set(n.sourceStreamId,this.convertBpsToKbps(n.avgBitrateBps));for(const n of i)if(!t.has(n)){this.streamIdToBitrateKbpsMap.get(n)===r.UNSEEN_STREAM_BITRATE?this.streamIdToBitrateKbpsMap.set(n,r.RECENTLY_INACTIVE_STREAM_BITRATE):this.streamIdToBitrateKbpsMap.set(n,r.NOT_SENDING_STREAM_BITRATE)}for(let n=0;n<this._localStreamInfos.length;n++){this._localStreamInfos[n].disabledByWebRTC=!1;const e=this._localStreamInfos[n].streamId;if(!this._localStreamInfos[n].disabledByUplinkPolicy)if(this.streamIdToBitrateKbpsMap.has(e)){this.streamIdToBitrateKbpsMap.get(e)===r.NOT_SENDING_STREAM_BITRATE&&this._lastBitRateMsgTime-this._localStreamInfos[n].timeEnabled>r.BitratesMsgFrequencyMs&&(this._localStreamInfos[n].disabledByWebRTC=!0)}else this._lastBitRateMsgTime-this._localStreamInfos[n].timeEnabled>r.BitratesMsgFrequencyMs&&(this._localStreamInfos[n].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,i=new Set(this.streamIdToBitrateKbpsMap.keys());for(const s of this.currentIndex.sources)s.mediaType===n.SdkStreamMediaType.VIDEO&&(t.add(s.streamId),this.streamIdToBitrateKbpsMap.has(s.streamId)||this.streamIdToBitrateKbpsMap.set(s.streamId,r.UNSEEN_STREAM_BITRATE));for(const n of i)t.has(n)||this.streamIdToBitrateKbpsMap.delete(n)}integrateSubscribeAckFrame(e){if(super.integrateSubscribeAckFrame(e),!e.allocations||void 0===e.allocations)return;let t=0;for(const i of e.allocations){if(this._localStreamInfos.length<t+1){this.logger.info("simulcast: allocation has more than number of local streams");break}this._localStreamInfos[t].groupId=i.groupId,this._localStreamInfos[t].streamId=i.streamId,this.streamIdToBitrateKbpsMap.has(i.streamId)||this.streamIdToBitrateKbpsMap.set(i.streamId,r.UNSEEN_STREAM_BITRATE),t++}}}t.default=r,r.UNSEEN_STREAM_BITRATE=-2,r.RECENTLY_INACTIVE_STREAM_BITRATE=-1,r.NOT_SENDING_STREAM_BITRATE=0,r.BitratesMsgFrequencyMs=4e3},96876:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(20289);class s{constructor(e,t,i,n,s){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=i,this.maxBitrateKbps=n,this.avgBitrateKbps=s}clone(){const e=new s;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=s},3327:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};
1Object.defineProperty(t,"__esModule",{value:!0});const s=i(90543),o=i(60214),r=i(37797),a=i(37804);class d{constructor(e,t,i,n){this.tileController=i,this.devicePixelRatioMonitor=n,this.tileState=new a.default,this.tileState.tileId=e,this.tileState.localTile=t,this.devicePixelRatioMonitor.registerObserver(this)}static connectVideoStreamToVideoElement(e,t,i){const o=i&&"environment"!==e.getVideoTracks()[0].getSettings().facingMode?"rotateY(180deg)":"";d.setVideoElementFlag(t,"disablePictureInPicture",i),d.setVideoElementFlag(t,"disableRemotePlayback",i),t.style.transform!==o&&(t.style.transform=o),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 s.default).requiresVideoElementWorkaround()&&r.default.nextTick((()=>n(this,void 0,void 0,(function*(){try{yield t.play()}catch(e){}}))))}static disconnectVideoStreamFromVideoElement(e,t,i=!1){if(e)if(t)i||(e.srcObject=null,e.style.transform="");else{if(!e.srcObject)return;e.pause(),e.style.transform="",d.setVideoElementFlag(e,"disablePictureInPicture",!1),d.setVideoElementFlag(e,"disableRemotePlayback",!1);const t=e.srcObject,i=t.getTracks();for(const e of i)e.stop(),t.removeTrack(e);if((new s.default).requiresVideoElementWorkaround()){const t=e.srcObject;r.default.nextTick((()=>{e.srcObject===t&&(e.srcObject=null)}))}else e.srcObject=null}}destroy(){this.devicePixelRatioMonitor.removeObserver(this),this.tileState.boundVideoElement&&this.tileState.boundVideoElement.srcObject===this.tileState.boundVideoStream&&d.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,!1),this.tileState=new a.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,i,n,s,r,a){let d=!1;this.tileState.boundAttendeeId!==e&&(this.tileState.boundAttendeeId=e,new o.default(e).hasModality(o.default.MODALITY_CONTENT)&&(this.tileState.isContent=!0),d=!0),this.tileState.boundExternalUserId!==a&&(this.tileState.boundExternalUserId=a,d=!0),this.tileState.localTile!==t&&(this.tileState.localTile=t,d=!0),this.tileState.boundVideoStream!==i&&(this.tileState.boundVideoStream=i,d=!0),this.tileState.videoStreamContentWidth!==n&&(this.tileState.videoStreamContentWidth=n,d=!0),this.tileState.videoStreamContentHeight!==s&&(this.tileState.videoStreamContentHeight=s,d=!0),this.tileState.streamId!==r&&(this.tileState.streamId=r,d=!0),d&&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 i=e.getContext("2d");return i.drawImage(t,0,0,e.width,e.height),i.getImageData(0,0,e.width,e.height)}setStreamId(e){this.tileState.streamId=e,this.tileController.sendTileStateUpdate(this.state())}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?d.connectVideoStreamToVideoElement(this.tileState.boundVideoStream,this.tileState.boundVideoElement,this.tileState.localTile):d.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,this.tileState.paused,this.tileController.keepLastFrameWhenPaused)}static setVideoElementFlag(e,t,i){t in e&&(e[t]=i)}}t.default=d},37804:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});class i{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 i;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=i},42958:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(78236),o=i(49190),r=i(28660);t.default=class{constructor(e,t,i){this.tileFactory=e,this.audioVideoController=t,this.logger=i,this.tileMap=new Map,this.nextTileId=1,this.currentLocalTile=null,this.currentPausedTilesByIds=new Set,this.keepLastFrameWhenPaused=!1,this.keepLastFrameWhenPaused=t.configuration.keepLastFrameWhenPaused}createDevicePixelRatioMonitorIfNeeded(){this.devicePixelRatioMonitor||(this.devicePixelRatioMonitor=new s.default(new o.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 i=this.getVideoTile(e);null!==i?i.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({needsRenegotiation:!0}),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({needsRenegotiation:!0}))}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 i=0,n=0;return t.boundVideoElement&&(i=t.boundVideoElement.clientHeight*t.devicePixelRatio,n=t.boundVideoElement.clientWidth*t.devicePixelRatio),i*n}getAllRemoteVideoTiles(){const e=new Array;
1return this.tileMap.forEach(((t,i)=>{this.currentLocalTile&&i===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 i=this.tileFactory.makeTile(t,e,this,this.devicePixelRatioMonitor);return this.tileMap.set(t,i),i}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.Maybe.of(t.videoTileWasRemoved).map((i=>i.bind(t)(e)))})),this.discardDevicePixelRatioMonitorIfNotNeeded()}removeVideoTilesByAttendeeId(e){const t=[];for(const i of this.getAllVideoTiles()){const n=i.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.Maybe.of(t.videoTileDidUpdate).map((i=>i.bind(t)(e)))}))}haveVideoTilesWithStreams(){for(const e of this.getAllVideoTiles())if(e.state().boundVideoStream)return!0;return!1}haveVideoTileForAttendeeId(e){return!!this.getVideoTileForAttendeeId(e)}getVideoTileForAttendeeId(e){for(const t of this.getAllVideoTiles()){if(t.state().boundAttendeeId===e)return t}}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}}},94922:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3327);t.default=class{makeTile(e,t,i,s){return new n.default(e,t,i,s)}}},59394:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=class{}},24450:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(17606),s=i(5785),o=i(28660),r=i(51133),a=i(59394);class d{constructor(e,t){this.selfAttendeeId=e,this.logger=t,this.numSenders=0,this.shouldDisableSimulcast=!1,this.newQualityMap=new Map,this.currentQualityMap=new Map,this.newActiveStreams=1,this.currentActiveStreams=1,this.lastUplinkBandwidthKbps=d.defaultUplinkBandwidthKbps,this.startTimeMs=0,this.lastUpdatedMs=Date.now(),this.videoIndex=null,this.currLocalDescriptions=[],this.nextLocalDescriptions=[],this.observerQueue=new Set,this.optimalParameters=new r.default(0,0,0,0,!0),this.parametersInEffect=new r.default(0,0,0,0,!0),this.lastUplinkBandwidthKbps=d.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<d.startupDurationMs?this.lastUplinkBandwidthKbps=d.defaultUplinkBandwidthKbps:this.lastUplinkBandwidthKbps=e,this.logger.debug((()=>`simulcast: uplink policy update metrics ${this.lastUplinkBandwidthKbps}`));let t=d.holdDownDurationMs;3===this.currentActiveStreams?t=2*d.holdDownDurationMs:(2===this.currentActiveStreams&&e<=d.kMidDisabledRate||1===this.currentActiveStreams&&e<=d.kHiDisabledRate)&&(t=d.holdDownDurationMs/2),Date.now()<this.lastUpdatedMs+t||(this.newQualityMap=this.calculateEncodingParameters(!1))}calculateEncodingParameters(e){const t=[new a.default,new a.default,new a.default];let i=0,n=0;if(0===this.currentActiveStreams?(i=this.lastUplinkBandwidthKbps+1,n=0):1===this.currentActiveStreams?(i=2400,n=d.kHiDisabledRate):2===this.currentActiveStreams?(i=1e3,n=d.kMidDisabledRate):(i=300,n=0),e||this.lastUplinkBandwidthKbps>=i||this.lastUplinkBandwidthKbps<=n){this.shouldDisableSimulcast?(this.newActiveStreams=0,t[0].maxBitrateKbps=0,t[1].maxBitrateKbps=1200,t[2].maxBitrateKbps=0):this.numSenders<=4&&this.lastUplinkBandwidthKbps>=d.kHiDisabledRate?(this.newActiveStreams=1,t[0].maxBitrateKbps=300,t[1].maxBitrateKbps=0,t[2].maxBitrateKbps=1200):this.lastUplinkBandwidthKbps>=d.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,i)=>e.maxBitrateKbps));this.newQualityMap=this.fillEncodingParamWithBitrates(e),this.encodingParametersEqual()||this.logger.info(`simulcast: policy:calculateEncodingParameters bw:${this.lastUplinkBandwidthKbps} numSources:${this.numSenders} shouldDisableSimulcast:${this.shouldDisableSimulcast} 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,i=t!==this.numSenders,n=e.numberOfParticipants(),s=n>=0&&n<=2,o=this.shouldDisableSimulcast!==s;this.numSenders=t,this.shouldDisableSimulcast=s,this.optimalParameters=new r.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1),this.videoIndex=e,this.newQualityMap=this.calculateEncodingParameters(i||o)}wantsResubscribe(){let e=!this.encodingParametersEqual();this.nextLocalDescriptions=this.videoIndex.localStreamDescriptions();for(let t=0;t<this.nextLocalDescriptions.length;t++){const i=this.nextLocalDescriptions[t].streamId;if(0!==i&&i){const n=this.currLocalDescriptions.findIndex((e=>e.streamId===i));-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 s.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}
1setIdealMaxBandwidthKbps(e){}setHasBandwidthPriority(e){}fillEncodingParamWithBitrates(e){const t=new Map,i=s.default.NAME_ARR_ASCENDING,n=e;let o=this.shouldDisableSimulcast?1:4;for(let s=0;s<i.length;s++){const e=i[s];t.set(e,{rid:e,active:n[s]>0,scaleResolutionDownBy:Math.max(o,1),maxBitrate:1e3*n[s]}),o/=2}return t}getQualityMapString(e){let t="";const i=this.videoIndex.localStreamDescriptions();return 3===i.length&&e.forEach((e=>{let n=!1;n="low"===e.rid?i[0].disabledByWebRTC:"mid"===e.rid?i[1].disabledByWebRTC:i[2].disabledByWebRTC,t+=`{ rid: ${e.rid} active:${e.active} disabledByWebRTC: ${n} maxBitrate:${e.maxBitrate}}`})),t}getEncodingSimulcastLayer(e){switch(e){case 0:return n.default.High;case 1:return n.default.LowAndHigh;case 2:return n.default.LowAndMedium;case 3:return n.default.Low}}publishEncodingSimulcastLayer(){const e=this.getEncodingSimulcastLayer(this.activeStreamsToPublish);this.forEachObserver((t=>{o.Maybe.of(t.encodingSimulcastLayersDidChange).map((i=>i.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)e(t)}}t.default=d,d.defaultUplinkBandwidthKbps=1200,d.startupDurationMs=6e3,d.holdDownDurationMs=4e3,d.defaultMaxFrameRate=15,d.kHiDisabledRate=700,d.kMidDisabledRate=240},72472:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(51133);class o{constructor(e,t=!0,i,n){this.selfAttendeeId=e,this.scaleResolution=t,this.logger=i,this.browserBehavior=n,this.numParticipants=0,this.idealMaxBandwidthKbps=1400,this.hasBandwidthPriority=!1,this.encodingParamMap=new Map,this.optimalParameters=new s.default(0,0,0,0,!1),this.parametersInEffect=new s.default(0,0,0,0,!1),this.encodingParamMap.set(o.encodingMapKey,{maxBitrate:0})}updateConnectionMetric(e){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(e){let t=!0,i=1;if(this.transceiverController&&(t=this.transceiverController.hasVideoInput()),this.numParticipants=e.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+(t?1:0),this.transceiverController){const e=this.getStreamCaptureSetting();if(e){i=this.calculateEncodingParameters(e).scaleResolutionDownBy}}this.optimalParameters=new s.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1,i)}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}setTransceiverController(e){this.transceiverController=e}updateTransceiverController(){return n(this,void 0,void 0,(function*(){const e=this.getStreamCaptureSetting();if(!e)return;const t=this.calculateEncodingParameters(e);this.shouldUpdateEndcodingParameters(t)&&(this.encodingParamMap.set(o.encodingMapKey,t),this.transceiverController.setEncodingParameters(this.encodingParamMap))}))}shouldUpdateEndcodingParameters(e){var t,i;const n=null===(i=null===(t=this.transceiverController.localVideoTransceiver().sender.getParameters())||void 0===t?void 0:t.encodings)||void 0===i?void 0:i[0];return e.maxBitrate!==(null===n||void 0===n?void 0:n.maxBitrate)||e.scaleResolutionDownBy!==(null===n||void 0===n?void 0:n.scaleResolutionDownBy)}calculateEncodingParameters(e){var t,i;const n=1e3*this.maxBandwidthKbps();let s=1;if(void 0!==e.height&&void 0!==e.width&&this.scaleResolution&&!this.hasBandwidthPriority&&this.numParticipants>2){let n=o.targetHeightArray[Math.min(this.numParticipants,o.targetHeightArray.length-1)];480===n&&(null===(t=this.browserBehavior)||void 0===t?void 0:t.disable480pResolutionScaleDown())&&(n=360),s=Math.max(Math.min(e.height,e.width)/n,1),null===(i=this.logger)||void 0===i||i.info(`Resolution scale factor is ${s} for capture resolution ${e.width}x${e.height}. New dimension is ${e.width/s}x${e.height/s}`)}return{scaleResolutionDownBy:s,maxBitrate:n}}getStreamCaptureSetting(){var e,t,i,n;return null===(n=null===(i=null===(t=null===(e=this.transceiverController)||void 0===e?void 0:e.localVideoTransceiver())||void 0===t?void 0:t.sender)||void 0===i?void 0:i.track)||void 0===n?void 0:n.getSettings()}}t.default=o,o.encodingMapKey="video",o.targetHeightArray=[0,0,0,540,540,480,480,480,480,360,360,360,360,270,270,270,270,180,180,180,180,180,180,180,180,180]},40657:function(e,t,i){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});const n=i(51133);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){}}},93928:function(e,t){"use strict";function i(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(i(e))}info(...e){this.base.info(i(e))}warn(...e){this.base.warn(i(e))}error(...e){this.base.error(i(e))}}},32497:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VoiceFocusDeviceTransformer=void 0;const s=i(56035),o=i(12571),r=i(74046),a=i(93928),d=i(48878),c=i(851);class l{constructor(e,{preload:t=!0,logger:i,fetchBehavior:n=l.defaultFetchBehavior()},s){this.spec=e,this.supported=!0,this.logger=i,this.vfLogger=i?new a.default(i):void 0,this.preload=t,this.fetchBehavior=n,this.spec=l.augmentSpec(this.spec),s&&(this.configuration=Promise.resolve(s))}static isSupported(e,t){var i,n;const r={fetchBehavior:l.defaultFetchBehavior(),logger:(null===t||void 0===t?void 0:t.logger)?new a.default(t.logger):void 0};if(o.isIFramed()){if(!1===(null===t||void 0===t?void 0:t.allowIFrame))return null===(i=null===t||void 0===t?void 0:t.logger)||void 0===i||i.error("Amazon Voice Focus support check inside iframe: not supported."),Promise.resolve(!1);null===(n=null===t||void 0===t?void 0:t.logger)||void 0===n||n.warn("Amazon Voice Focus support check inside iframe: not recommended.")}return s.VoiceFocus.isSupported(l.augmentSpec(e),r)}static create(e={},t={},i,s,o){var r,a,d;return n(this,void 0,void 0,(function*(){s&&s.Meeting.Meeting&&(s=s.Meeting);const n="AVAILABLE"===(null===(d=null===(a=null===(r=null===s||void 0===s?void 0:s.Meeting)||void 0===r?void 0:r.MeetingFeatures)||void 0===a?void 0:a.Audio)||void 0===d?void 0:d.EchoReduction),o=i&&!0===i.supported&&"ns_es"===i.model.name&&!n,c="ns_es"===e.name&&!n;if(o||c)throw new Error("Echo Reduction requested but not enabled.");const u=new l(e,t,i);return yield u.init(),u}))}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 i=!0,[n,s]=yield this.allocateVoiceFocus(i),o=Object.assign(Object.assign({},t),{es:"ns_es"===this.spec.name});return new d.default(e,n,s,o)}catch(i){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 s.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(i){null===(e=this.logger)||void 0===e||e.error(`Unable to initialize Amazon Voice Focus: ${i}`),this.supported=!1}}else this.supported=!1}))}createVoiceFocus(e,t){return n(this,void 0,void 0,(function*(){const i=new c.default;return[yield s.VoiceFocus.init(e,{delegate:i,preload:t,logger:this.vfLogger}),i]}))}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}
1return this.createVoiceFocus(yield this.configuration,e)}))}static majorVersion(){return r.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|[1-9][0-9]*)/)[0]}static majorMinorVersion(){return r.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=r.default.sdkUserAgentLowResolution;return{escapedQueryString:`sdk=${encodeURIComponent(e)}&ua=${encodeURIComponent(t)}`}}}t.VoiceFocusDeviceTransformer=l,t.default=l},48878:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(90543);class o{constructor(e,t,i,n,o=!1,r,a=new s.default,d=new Map,c,l){this.device=e,this.voiceFocus=t,this.delegate=i,this.nodeOptions=n,this.failed=o,this.node=r,this.browserBehavior=a,this.farEndStreamToAudioSourceNode=d,this.mixDestNode=c,this.mixSourceNode=l}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||function(e){if("default"===e)return!0;if(!e||"object"!==typeof e)return!1;if("deviceId"in e&&"default"===e.deviceId)return!0;if("id"in e&&"default"===e.id)return!0;return!1}(e)?new o(e,this.voiceFocus,this.delegate,this.nodeOptions,this.failed,this.node,this.browserBehavior,this.farEndStreamToAudioSourceNode,this.mixDestNode,this.mixSourceNode):this}))}intrinsicDevice(){return n(this,void 0,void 0,(function*(){if(this.failed)return this.device;const e=this.nodeOptions.es,t={echoCancellation:!e,googEchoCancellation:!e,googEchoCancellation2:!e,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googNoiseSuppression2:!1};let i;return i=!this.nodeOptions||void 0===this.nodeOptions.agc||this.nodeOptions.agc.useBuiltInAGC,t.autoGainControl=i,t.googAutoGainControl=i,t.googAutoGainControl2=i,this.device?"string"===typeof this.device?(this.browserBehavior.requiresNoExactMediaStreamConstraints()?t.deviceId=this.device:t.deviceId={exact:this.device},t):this.device.id?this.device:Object.assign(Object.assign({},this.device),t):t}))}createAudioNode(e){var t,i;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{if(null===(i=this.node)||void 0===i||i.disconnect(),this.node=yield this.voiceFocus.createNode(e,n),this.nodeOptions.es){this.mixDestNode=new MediaStreamAudioDestinationNode(e,{channelCount:1,channelCountMode:"explicit"});for(const e of this.farEndStreamToAudioSourceNode.keys())this.assignFarEndStreamToAudioSourceNode(e);this.createMixSourceNode()}const t=this.node;return{start:t,end:this.node}}catch(s){throw this.failed=!0,this.delegate.onFallback(this,s),s}}))}observeMeetingAudio(e){return n(this,void 0,void 0,(function*(){if(!this.nodeOptions.es)return;e.addAudioMixObserver(this);const t=yield e.getCurrentMeetingAudioStream();t&&this.addFarEndStream(t)}))}unObserveMeetingAudio(e){return n(this,void 0,void 0,(function*(){if(!this.nodeOptions.es)return;e.removeAudioMixObserver(this);const t=yield e.getCurrentMeetingAudioStream();t&&this.removeFarendStream(t)}))}addObserver(e){this.delegate.addObserver(e)}removeObserver(e){this.delegate.removeObserver(e)}addFarEndStream(e){return n(this,void 0,void 0,(function*(){this.nodeOptions.es&&e&&!this.farEndStreamToAudioSourceNode.has(e)&&(this.node?this.assignFarEndStreamToAudioSourceNode(e):this.farEndStreamToAudioSourceNode.set(e,null))}))}removeFarendStream(e){var t;return n(this,void 0,void 0,(function*(){null===(t=this.farEndStreamToAudioSourceNode.get(e))||void 0===t||t.disconnect(),this.farEndStreamToAudioSourceNode.delete(e)}))}meetingAudioStreamBecameActive(e){return n(this,void 0,void 0,(function*(){this.addFarEndStream(e)}))}meetingAudioStreamBecameInactive(e){return n(this,void 0,void 0,(function*(){this.removeFarendStream(e)}))}assignFarEndStreamToAudioSourceNode(e){const t=this.node.context.createMediaStreamSource(e);t.channelCount=1,t.channelCountMode="explicit",this.farEndStreamToAudioSourceNode.set(e,t),t.connect(this.mixDestNode,0)}createMixSourceNode(){this.mixSourceNode=this.node.context.createMediaStreamSource(this.mixDestNode.stream),this.mixSourceNode.channelCount=1,this.mixSourceNode.channelCountMode="explicit",this.mixSourceNode.connect(this.node,0,1)}}t.default=o},851:function(e,t){"use strict";
1Object.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 i;for(const n of this.observers)null===(i=n.voiceFocusFellBackToInnerStream)||void 0===i||i.call(n,e,t)}onCPUWarning(){var e;for(const t of this.observers)null===(e=t.voiceFocusInsufficientResources)||void 0===e||e.call(t)}}},99751:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(e,t,i,n,s){this.logger=e,this.realtimeController=t,this.minVolumeDecibels=i,this.maxVolumeDecibels=n,this.selfAttendeeId=s,this.streamIdToAttendeeId={},this.streamIdToExternalUserId={},this.warnedAboutMissingStreamIdMapping={},this.attendeeIdToStreamId={},this.sessionReconnected=!1}onReconnect(){this.sessionReconnected=!0}sendRealtimeUpdatesForAudioStreamIdInfo(e){let t=0;for(const i of e.streams){const n=!!i.attendeeId,s=!!i.externalUserId,o=i.hasOwnProperty("muted"),r=!!i.dropped;if(n){this.attendeeIdToStreamId[i.attendeeId]&&this.attendeeIdToStreamId[i.attendeeId]<i.audioStreamId&&delete this.attendeeIdToStreamId[i.attendeeId],this.streamIdToAttendeeId[i.audioStreamId]=i.attendeeId;const n=s?i.externalUserId:i.attendeeId;this.streamIdToExternalUserId[i.audioStreamId]=n,this.attendeeIdToStreamId[i.attendeeId]=i.audioStreamId,this.realtimeController.realtimeSetAttendeeIdPresence(i.attendeeId,!0,n,!1,{attendeeIndex:t++,attendeesInFrame:e.streams.length})}if(o){const e=this.streamIdToAttendeeId[i.audioStreamId],t=this.streamIdToExternalUserId[i.audioStreamId];this.realtimeController.realtimeUpdateVolumeIndicator(e,null,i.muted,null,t)}if(!n&&!o){const n=this.streamIdToAttendeeId[i.audioStreamId];if(n){const s=this.streamIdToExternalUserId[i.audioStreamId];delete this.streamIdToAttendeeId[i.audioStreamId],delete this.streamIdToExternalUserId[i.audioStreamId],delete this.warnedAboutMissingStreamIdMapping[i.audioStreamId],this.attendeeIdToStreamId[n]===i.audioStreamId&&delete this.attendeeIdToStreamId[n];let o=!1;for(const e of Object.keys(this.streamIdToAttendeeId)){const t=parseInt(e);if(t>i.audioStreamId&&this.streamIdToAttendeeId[t]===n){o=!0;break}}o||this.realtimeController.realtimeSetAttendeeIdPresence(n,!1,s,r,{attendeeIndex:t++,attendeesInFrame:e.streams.length})}}}this.sessionReconnected&&(this.cleanUpState(e),this.sessionReconnected=!1)}cleanUpState(e){const t=Object.values(this.streamIdToAttendeeId),i=e.streams.map((e=>e.attendeeId)),n=t.filter((e=>!i.includes(e)));for(const[s,o]of n.entries()){const e=this.attendeeIdToStreamId[o],t=this.streamIdToExternalUserId[e];delete this.streamIdToAttendeeId[e],delete this.streamIdToExternalUserId[e],delete this.warnedAboutMissingStreamIdMapping[e],delete this.attendeeIdToStreamId[o],o!==this.selfAttendeeId?this.realtimeController.realtimeSetAttendeeIdPresence(o,!1,t,!1,{attendeeIndex:s,attendeesInFrame:o.length}):this.logger.warn("the volume indicator adapter cleans up the current attendee (presence = false) after reconnection")}}sendRealtimeUpdatesForAudioMetadata(e){let t=null,i=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===i&&(i={}),null!==e&&(i[e]=this.normalizedSignalStrength(n)))}this.applyRealtimeUpdatesForAudioMetadata(t,i)}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/i.MAX_SIGNAL_STRENGTH_LEVELS;return Math.min(Math.max(t,0),1)}applyRealtimeUpdatesForAudioMetadata(e,t){for(const n in this.streamIdToAttendeeId){const s=this.streamIdToAttendeeId[n],o=this.streamIdToExternalUserId[n];let r=null,a=null;null!==e&&(r=e.hasOwnProperty(s)?e[s]:i.IMPLICIT_VOLUME),null!==t&&(a=t.hasOwnProperty(s)?t[s]:i.IMPLICIT_SIGNAL_STRENGTH),null===r&&null===a||this.realtimeController.realtimeUpdateVolumeIndicator(s,r,null,a,o)}}attendeeIdForStreamId(e){if(0===e)return null;const t=this.streamIdToAttendeeId[e];return t||(this.warnedAboutMissingStreamIdMapping[e]||(this.warnedAboutMissingStreamIdMapping[e]=!0,this.logger.warn(`volume indicator stream id ${e} seen before being defined`)),null)}}t.default=i,i.MAX_SIGNAL_STRENGTH_LEVELS=2,i.IMPLICIT_VOLUME=0,i.IMPLICIT_SIGNAL_STRENGTH=1},67631:function(e,t,i){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});const n=i(74046),s=i(7387);t.default=class{constructor(e){this.logger=e}create(e,t,i){this.connection=new WebSocket(i?e:n.default.urlWithVersion(e),t),this.connection.binaryType="arraybuffer"}send(e){if(!this.connection)return this.logger.error("WebSocket not yet created or already destroyed."),!1;try{return e instanceof Uint8Array?this.connection.send(e.buffer):this.connection.send(e),!0}catch(t){return this.logger.debug((()=>`send error: ${t.message}, websocket state=${s.default[this.readyState()]}`)),!1}}close(e,t){var i;null===(i=this.connection)||void 0===i||i.close(e,t)}destroy(){this.connection=void 0}addEventListener(e,t){this.connection?this.connection.addEventListener(e,t):this.logger.warn("Cannot add event listener with no WebSocket connection.")}removeEventListener(e,t){var i;null===(i=this.connection)||void 0===i||i.removeEventListener(e,t)}readyState(){if(!this.connection)return s.default.None;switch(this.connection.readyState){case WebSocket.CONNECTING:return s.default.Connecting;case WebSocket.OPEN:return s.default.Open;case WebSocket.CLOSING:return s.default.Closing;case WebSocket.CLOSED:return s.default.Closed}}}},7387:function(e,t){"use strict";var i;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"}(i=t.WebSocketReadyState||(t.WebSocketReadyState={})),t.default=i},5995:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.decideModel=t.measureAndDecideExecutionApproach=void 0;const s=i(85021),o=i(39424),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 a{constructor(e,t){this.fetchConfig=e,this.logger=t;const i=`${e.paths.workers}estimator-v1.js`;this.fetchBehavior={headers:e.headers,escapedQueryString:e.escapedQueryString},this.worker=s.loadWorker(i,"VoiceFocusEstimator",this.fetchBehavior,t)}roundtrip(e,t,i){return new Promise(((n,s)=>{this.worker.then((s=>{let o;o=e=>{const{message:r,key:a}=e.data;r===t&&a===i&&(s.removeEventListener("message",o),n(e.data))},s.addEventListener("message",o),s.postMessage(e)})).catch((e=>{var t;null===(t=this.logger)||void 0===t||t.error("Failed to load worker.",e),s(e)}))}))}supportsSIMD(e){const t="simd",i=e||`${this.fetchConfig.paths.wasm}simd-v1.wasm`,n={message:"supports-simd",fetchBehavior:this.fetchBehavior,path:i,key:t};return this.roundtrip(n,"simd-support",t).then((e=>e.supports))}measure(e,t){const i=`${this.fetchConfig.paths.wasm}bench-v1.wasm`,n=`${this.fetchConfig.paths.wasm}bench-v1_simd.wasm`,s=e?n:i,o=`bench:${e}`,r={message:"measure",fetchBehavior:this.fetchBehavior,budget:t,path:s,key:o};return this.roundtrip(r,"measurement",o).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 d=(e,t,i,s)=>n(void 0,void 0,void 0,(function*(){const n={supportsSIMD:e,supportsSAB:o.supportsSharedArrayBuffer(globalThis,window,i),duration:-1};if(e)return null===i||void 0===i||i.info("Supports SIMD: true (force)"),n;const r=!s,d=s||new a(t,i);try{const t=!o.isOldChrome(window,i)&&(yield d.supportsSIMD());return null===i||void 0===i||i.info(`Supports SIMD: ${t} (force: ${e})`),n.supportsSIMD=t,n}finally{r&&d.stop()}}));t.measureAndDecideExecutionApproach=(e,t,i,s=r)=>n(void 0,void 0,void 0,(function*(){let c=e.executionPreference;const{usagePreference:l,variantPreference:u,namePreference:h,simdPreference:f,estimatorBudget:g,executionQuantaPreference:p}=e;"interactivity"===l&&"inline"!==c&&(null===i||void 0===i||i.debug(`Overriding execution preference ${c} to reflect interactivity preference.`),c="inline");const m="force"===f,v="auto"!==u,S="auto"!==c;let b;try{b=v&&S?yield d(m,t,i):yield((e,t,i,s)=>n(void 0,void 0,void 0,(function*(){const n=new a(t,s);try{const r=yield d(e,t,s,n);if(r.supportsSIMD)try{return r.duration=yield n.measure(!0,i),null===s||void 0===s||s.info("SIMD timing:",r.duration),r}catch(o){null===s||void 0===s||s.warn("Failed SIMD estimation; falling back to non-SIMD."),r.supportsSIMD=!1}return r.duration=yield n.measure(!1,i),null===s||void 0===s||s.info("No-SIMD timing:",r.duration),r}catch(o){throw null===s||void 0===s||s.error("Could not feature check.",o),o}finally{n.stop()}})))(m,t,g,i)}catch(w){throw null===i||void 0===i||i.error("Could not load estimator.",w),new Error("Could not load Voice Focus estimator.")}return(({supportsSIMD:e,supportsSAB:t,duration:i,executionPreference:n="auto",simdPreference:s,variantPreference:a="auto",namePreference:d="default",usagePreference:c,executionQuantaPreference:l=3},u=r,h)=>{const f="force"===s||"disable"!==s&&e,g=-1!==i,p=g?(f?2.5:2.63)/i:0,m=f?u.simd:u.wasm,v=g?((e,t)=>1===e?.6:"quality"===t?.65*e:.5*e)(l,c)*p:0,S=g?.7*p:0,b=d,w=e=>({supported:!1,reason:e});if(g){if(p<m.noSupport)return w(`Performance score ${p} worse than threshold ${m.noSupport}.`)}else if("auto"===n||"auto"===a)return w(`Missing explicit execution (${n}) or variant (${a}) preference, but no scoring performed.`);null===h||void 0===h||h.debug(`Bench duration ${i} yields inline score ${v} and worker score ${S}.`);const y=(e,t,i)=>({supported:!0,useSIMD:f,processor:e,executionApproach:t,variant:i,executionQuanta:"inline"===t?l:void 0,name:b}),C=(e,t,i)=>"auto"!==t?!g||e>i[t]?t:"failed":e>i.c100?"c100":e>i.c50?"c50":e>
1i.c20?"c20":e>i.c10?"c10":"failed",T=e=>{switch(e||"auto"){case"auto":{let e=T("inline"),t=T("worker");return null===h||void 0===h||h.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 o.supportsSharedArrayBuffer(globalThis,window,h)?T("worker-sab"):T("worker-postMessage");case"inline":{const e=C(v,a,m.inline);return"failed"===e?w(`Performance score ${v} not sufficient for inline use with variant preference ${a}.`):y("voicefocus-inline-processor","inline",e)}case"worker-sab":{if(!t){const e="Requested worker-sab but no SharedArrayBuffer support.";return null===h||void 0===h||h.warn(e),{supported:!1,reason:e}}const e=C(S,a,m.worker);return"failed"===e?w(`Performance score ${S} not sufficient for worker use with variant preference ${a}.`):y("voicefocus-worker-sab-processor","worker-sab",e)}case"worker-postMessage":{const e=C(S,a,m.worker);if("failed"===e)return w(`Performance score ${S} not sufficient for worker use.`);if("ns_es"===b){const e="Requested echo suppression but postMessage executor does not support it.";return null===h||void 0===h||h.warn(e),{supported:!1,reason:e}}return y("voicefocus-worker-postMessage-processor","worker-postMessage",e)}}};return T(n)})(Object.assign(Object.assign({},b),{simdPreference:f,executionPreference:c,variantPreference:u,namePreference:h,usagePreference:l,executionQuantaPreference:p}),s,i)}));t.decideModel=({category:e,name:t,variant:i,simd:n,url:s})=>`${e}-${t}-${i}-v1${n?"_simd":""}`},80623:function(e,t){"use strict";function i(e,t,i){if(!i)return fetch(e,t);const o=s(e,i),r=n(t,i);return fetch(o,r)}function n(e,t){return(null===t||void 0===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 s(e,t){if(!(null===t||void 0===t?void 0:t.escapedQueryString))return e;const i=-1!==e.lastIndexOf("?");return`${e}${i?"&":"?"}${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=i,t.withRequestHeaders=n,t.withQueryString=s,t.addQueryParams=function(e,t){const i=Object.keys(t);if(!i.length)return e;const n=new URLSearchParams(null===e||void 0===e?void 0:e.escapedQueryString);for(const s of i)n.append(s,t[s]);return Object.assign(Object.assign({},e),{escapedQueryString:n.toString()})};const o={method:"HEAD",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"origin"};t.resolveURL=function(e,t){return i(e,o,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)}},85021:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadWorker=void 0;const n=i(80623),s={method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"};t.loadWorker=(e,t,i,o)=>{null===o||void 0===o||o.debug(`Loading ${t} worker from ${e}.`);let r=!1;try{r=self.origin===new URL(e).origin}catch(a){null===o||void 0===o||o.error("Could not compare origins.",a)}if(r){const s=n.withQueryString(e,i);return Promise.resolve(new Worker(s,{name:t}))}return n.fetchWithBehavior(e,s,i).then((e=>{if(e.ok)return e.blob().then((e=>new Worker(window.URL.createObjectURL(e))));throw new Error("Fetch failed.")}))}},39424:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isOldChrome=t.supportsWASMStreaming=t.supportsSharedArrayBuffer=t.supportsWASM=t.supportsAudioWorklet=t.supp
1ortsWorker=t.supportsVoiceFocusWorker=t.supportsWASMPostMessage=t.isSafari=void 0;const s=i(85021);t.isSafari=(e=globalThis)=>{const t=e.navigator.userAgent,i=t.match(/Safari\//),n=t.match(/Chrom(?:e|ium)\//);return!(!i||n)};t.supportsWASMPostMessage=(e=globalThis)=>{if(t.isSafari(e))return!1;if(((e=globalThis)=>!!e.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/))(e)){return(o(e)||0)<95}return!0};t.supportsVoiceFocusWorker=(e=globalThis,i,o)=>n(void 0,void 0,void 0,(function*(){if(!t.supportsWorker(e,o))return!1;const n=`${i.paths.workers}worker-v1.js`;try{const e=yield s.loadWorker(n,"VoiceFocusTestWorker",i,o);try{e.terminate()}catch(r){null===o||void 0===o||o.debug("Failed to terminate worker.",r)}return!0}catch(r){return null===o||void 0===o||o.info("Failed to fetch and instantiate test worker",r),!1}}));t.supportsWorker=(e=globalThis,t)=>{try{return!!e.Worker}catch(i){return null===t||void 0===t||t.info("Does not support Worker",i),!1}};t.supportsAudioWorklet=(e=globalThis,t)=>{try{return!!e.AudioWorklet&&!!e.AudioWorkletNode}catch(i){return null===t||void 0===t||t.info("Does not support Audio Worklet",i),!1}};t.supportsWASM=(e=globalThis,t)=>{try{return!!e.WebAssembly&&(!!e.WebAssembly.compile||!!e.WebAssembly.compileStreaming)}catch(i){return null===t||void 0===t||t.info("Does not support WASM",i),!1}};t.supportsSharedArrayBuffer=(e=globalThis,t=globalThis,i)=>{try{return!!e.SharedArrayBuffer&&(!!t.chrome||!!e.crossOriginIsolated)}catch(n){return null===i||void 0===i||i.info("Does not support SharedArrayBuffer."),!1}};t.supportsWASMStreaming=(e=globalThis,t)=>{var i;try{return!!(null===(i=e.WebAssembly)||void 0===i?void 0:i.compileStreaming)}catch(n){return null===t||void 0===t||t.info("Does not support WASM streaming compilation",n),!1}};const o=(e=globalThis)=>{try{if(!e.chrome)return}catch(i){}const t=e.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/);if(t)return parseInt(t[1],10)};t.isOldChrome=(e=globalThis,t)=>{const i=o(e);return!!i&&(i<90&&(null===t||void 0===t||t.debug(`Chrome ${i} has incomplete SIMD support.`),!0))}},70103:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VoiceFocusAudioWorkletNode=void 0;class i extends("undefined"!==typeof globalThis&&globalThis.AudioWorkletNode||class{}){}t.VoiceFocusAudioWorkletNode=i},56035:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getAudioInput=t.createAudioContext=t.VoiceFocus=void 0;const s=i(5995),o=i(80623),r=i(85021),a=i(39424),d=i(12633),c=i(81678),l=i(40271),u={useVoiceFocusAGC:!1,useBuiltInAGC:!0},h="stable-v1",f="https://static.sdkassets.chime.aws/",g={processors:`${f}processors/`,workers:`${f}workers/`,wasm:`${f}wasm/`,models:`${f}wasm/`},p={latencyHint:0},m={channelCount:1,echoCancellation:!0,googEchoCancellation:!0,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googTypingNoiseDetection:!1},v=Object.assign(Object.assign({},m),{autoGainControl:!0,googAutoGainControl:!0,googAutoGainControl2:!0}),S=Object.assign(Object.assign({},m),{autoGainControl:!1,googAutoGainControl:!1,googAutoGainControl2:!1}),b={"voicefocus-worker-sab-processor":{file:"worklet-worker-sab-processor-v1.js",node:c.default},"voicefocus-worker-postMessage-processor":{file:"worklet-worker-postMessage-processor-v1.js",node:l.default},"voicefocus-inline-processor":{file:"worklet-inline-processor-v1.js",node:d.default}},w=(e,t)=>{if(void 0!==e&&!o.isValidAssetGroup(e))throw new Error(`Invalid asset group ${e}`);if(void 0!==t&&!o.isValidRevisionID(t))throw new Error(`Invalid revision ID ${t}`)},y=(e,t)=>`${t.models}${s.decideModel(e)}.wasm`;class C{constructor(e,t,i,n,s){this.processorURL=t,this.nodeConstructor=i,this.nodeOptions=n,this.executionQuanta=s,this.internal={worker:e,nodeOptions:n}}static isSupported(e,t){const{fetchBehavior:i,logger:n}=t||{};if("undefined"===typeof globalThis)return null===n||void 0===n||n.debug("Browser does not have globalThis."),Promise.resolve(!1);if(!a.supportsAudioWorklet(globalThis,n))return null===n||void 0===n||n.debug("Browser does not support Audio Worklet."),Promise.resolve(!1);if(!a.supportsWASM(globalThis,n))return null===n||void 0===n||n.debug("Browser does not support WASM."),Promise.resolve(!1);a.supportsWASMStreaming(globalThis,n)||null===n||void 0===n||n.debug("Browser does not support streaming WASM compilation.");const{assetGroup:s=h,revisionID:r,paths:d=g}=e||{};w(s,r);const c=r?{revisionID:r}:{assetGroup:s},l=o.addQueryParams(i,c),u=Object.assign(Object.assign({},l),{paths:d});return a.supportsVoiceFocusWorker(globalThis,u,n)}static mungeExecutionPreference(e,t){const i=void 0===e||"auto"===e;if(a.isSafari(globalThis)){if(i||"inline"===e)return"inline";if(!i)throw new Error(`Unsupported execution preference ${e}`)}if("worker-sab"===e&&!a.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:i,preResolve:n,logger:r}=t||{},{category:a="voicefocus",name:d="default",variant:c="auto",assetGroup:l=h,revisionID:u,simd:f="detect",executionPreference:p="auto",executionQuantaPreference:m,usagePreference:v="interactivity",estimatorBudget:S=100,paths:b=g,thresholds:C}=e||{};if(null===r||void 0===r||r.debug("Configuring Voice Focus with spec",e),void 0!==a&&"voicefocus"!==a)throw new Error(`Unrecognized category ${a}`);if(void 0!==d&&"default"!==d&&"ns_es"!==d)throw new Error(`Unrecognized feature name ${d}`);if(void 0!==c&&!["auto","c100","c50","c20","c10"].includes(c))throw new Error(`Unrecognized feature variant ${c}`);if(void 0!==m&&![1,2,3].includes(m))throw new Error(`Unrecognized execution quanta preference ${m}`);if(w(l,u),void 0!==f&&!["detect","force","disable"].includes(f))throw new Error(`Unrecognized SIMD option ${f}`);if(void 0!==p&&!["auto","inline","worker","worker-sab","worker-postMessage"].includes(p))throw new Error(`Unrecognized execution preference ${p}`);
1if(void 0!==v&&!["quality","interactivity"].includes(v))throw new Error(`Unrecognized usage preference ${v}`);const T={executionPreference:this.mungeExecutionPreference(p,r),usagePreference:v,executionQuantaPreference:m,variantPreference:c,namePreference:d,simdPreference:f,estimatorBudget:S},k=u?{revisionID:u}:{assetGroup:l},_=o.addQueryParams(i,k),I=Object.assign({paths:b},_),M=yield s.measureAndDecideExecutionApproach(T,I,r,C);if(!1===M.supported)return{supported:!1,reason:M.reason};null===r||void 0===r||r.info("Decided execution approach",M);const{useSIMD:x,processor:E,variant:A,executionQuanta:P}=M,R={category:a||"voicefocus",name:d||"default",variant:A,simd:x};if(n){const e=y(R,b);R.url=yield o.resolveURL(e,_)}return{fetchConfig:I,model:R,processor:E,executionQuanta:P,supported:!0}}))}static init(e,{delegate:t,preload:i=!0,logger:s}){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:o,fetchConfig:d,executionQuanta:c}=e,{simd:l,name:u}=n,{paths:h}=d;if("voicefocus-inline-processor"!==o&&"voicefocus-worker-postMessage-processor"!==o&&"voicefocus-worker-sab-processor"!==o)throw new Error(`Unknown processor ${o}`);const f=n.url||y(n,h);null===s||void 0===s||s.debug(`Using model URL ${f}.`);const g=`${h.wasm}audio_buffer-v1${l?"_simd":""}.wasm`,p=`${h.wasm}resampler-v1${l?"_simd":""}.wasm`,m=`${h.workers}worker-v1.js`,{file:v,node:S}=b[o],w=`${h.processors}${v}`,T=yield r.loadWorker(m,"VoiceFocusWorker",d,s);if(i){null===s||void 0===s||s.debug("Preloading",f);let e=a.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";T.postMessage({message:e,preload:!0,key:"model",fetchBehavior:d,path:f})}const k=new C(T,w,S,{processor:o,worker:T,audioBufferURL:g,resamplerURL:p,fetchBehavior:d,modelURL:f,delegate:t,logger:s,numberOfInputs:"ns_es"===u?2:1},c);return Promise.resolve(k)}))}createNode(e,t){var i;const{voiceFocusSampleRate:n=(16e3===e.sampleRate?16e3:48e3),enabled:s=!0,agc:r=u}=t||{},a=null===t||void 0===t?void 0:t.es,d={voiceFocusSampleRate:n,enabled:s,sendBufferCount:10,prefill:6,agc:r,executionQuanta:this.executionQuanta,supportFarendStream:a},c=o.withQueryString(this.processorURL,null===(i=this.nodeOptions)||void 0===i?void 0:i.fetchBehavior);return e.audioWorklet.addModule(c).then((()=>new this.nodeConstructor(e,Object.assign(Object.assign({},this.nodeOptions),{processorOptions:d}))))}applyToStream(e,t,i){return n(this,void 0,void 0,(function*(){const n=t.createMediaStreamSource(e),s=yield this.applyToSourceNode(n,t,i),o=t.createMediaStreamDestination();return s.connect(o),{node:s,source:n,destination:o,stream:o.stream}}))}applyToSourceNode(e,t,i){return n(this,void 0,void 0,(function*(){const n=yield this.createNode(t,i);return e.connect(n),n}))}}t.VoiceFocus=C;t.createAudioContext=(e=p)=>new(window.AudioContext||window.webkitAudioContext)(e);t.getAudioInput=(e,t,i)=>n(void 0,void 0,void 0,(function*(){var n,s;const{constraints:o,spec:r,delegate:a,preload:d=!0,options:c}=t,{logger:l}=i,h=yield C.configure(r,i);if(!h.supported)return null===(n=i.logger)||void 0===n||n.warn("Voice Focus not supported; returning standard stream."),window.navigator.mediaDevices.getUserMedia(o);const f=yield C.init(h,{delegate:a,preload:d,logger:l}),g=(null===(s=t.options)||void 0===s?void 0:s.agc)||u,p=yield window.navigator.mediaDevices.getUserMedia(((e,t)=>{let i;if(i=t.useBuiltInAGC?v:S,!e)return{audio:i};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?i:Object.assign(Object.assign({},e.audio),i)})})(o,g));return f.applyToStream(p,e,c).then((e=>e.stream))}))},12633:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};
1Object.defineProperty(t,"__esModule",{value:!0});const s=i(39424),o=i(70103);class r extends o.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.channelCountMode="explicit",this.channelCount=1;const{modelURL:i,worker:n,fetchBehavior:o,logger:r,delegate:a}=t;this.logger=r,this.port.onmessage=this.onProcessorMessage.bind(this),this.delegate=a,r&&r.debug("VoiceFocusInlineNode:",i),this.worker=n,this.worker.onmessage=this.onWorkerMessage.bind(this);const d=s.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:d,key:"model",fetchBehavior:o,path:i})}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,i,n;const s=e.data;if("cpu"===s.message)null===(t=this.logger)||void 0===t||t.warn("CPU warning:",s.message),null===(i=this.delegate)||void 0===i||i.onCPUWarning();else null===(n=this.logger)||void 0===n||n.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},40271:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const s=i(39424),o=i(70103);class r extends o.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.channelCountMode="explicit",this.channelCount=1;const{modelURL:i,audioBufferURL:n,worker:o,fetchBehavior:r,delegate:a}=t;this.delegate=a,this.worker=o,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:d,agc:c,supportFarendStream:l}=t.processorOptions;this.worker.postMessage({message:"init",approach:"postMessage",frames:16e3===e.sampleRate?160:480,enabled:d,agc:c,fetchBehavior:r,model:i,supportFarendStream:l});const u=s.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:u,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 i=e.data;switch(i.message){case"ready":this.port.postMessage({message:"ready",shared:i.shared},i.shared?Object.values(i.shared):[]);break;case"data":if(!i.buffer)return;this.port.postMessage({message:"data",buffer:i.buffer},[i.buffer]);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(i);break;case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;default:return}}onProcessorMessage(e){var t;const i=e.data;switch(i.message){case"data":if(!i.buffer)return;this.worker.postMessage({message:"data",buffer:i.buffer},[i.buffer]);break;case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(i);break;default:return}}}t.default=r},81678:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{d(n.next(e))}catch(t){o(t)}}function a(e){try{d(n.throw(e))}catch(t){o(t)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))};
1Object.defineProperty(t,"__esModule",{value:!0});const s=i(39424),o=i(70103),r=0,a=1,d=0,c=1,l=2;class u extends o.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.channelCountMode="explicit",this.channelCount=1;const{modelURL:i,resamplerURL:n,worker:o,fetchBehavior:r,delegate:a}=t;this.delegate=a,this.worker=o,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:d,supportFarendStream:c}=t.processorOptions;this.worker.postMessage({message:"init",approach:"sab",frames:16e3===e.sampleRate?160:480,enabled:d,model:i,supportFarendStream:c});const l=s.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:l,key:"resampler",fetchBehavior:r,path:n})}enable(){return n(this,void 0,void 0,(function*(){this.state?(Atomics.store(this.state,a,c),Atomics.notify(this.state,r,1)):this.worker.postMessage({message:"enable"})}))}disable(){return n(this,void 0,void 0,(function*(){this.state?(Atomics.store(this.state,a,d),Atomics.notify(this.state,r,1)):this.worker.postMessage({message:"disable"})}))}stop(){return n(this,void 0,void 0,(function*(){if(this.state)Atomics.store(this.state,a,l),Atomics.notify(this.state,r,1);else try{this.worker.postMessage({message:"stop"})}catch(e){}this.disconnect()}))}onWorkerMessage(e){var t;const i=e.data;switch(i.message){case"ready":if(!i.shared)throw new Error("No shared state.");this.state=new Int32Array(i.shared.state),this.port.postMessage(i);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(i);break;case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;default:return}}onProcessorMessage(e){var t;const i=e.data;switch(i.message){case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(i)}}}t.default=u},43631:function(e,t,i){"use strict";i.r(t),i.d(t,{BotInfo:function(){return d},BrowserInfo:function(){return o},NodeInfo:function(){return r},ReactNativeInfo:function(){return c},SearchBotDeviceInfo:function(){return a},browserName:function(){return p},detect:function(){return f},detectOS:function(){return v},getNodeVersion:function(){return S},parseUserAgent:function(){return m}});var n=i(83454),s=function(e,t,i){if(i||2===arguments.length)for(var n,s=0,o=t.length;s<o;s++)!n&&s in t||(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))},o=function(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"},r=function(e){this.version=e,this.type="node",this.name="node",this.os=n.platform},a=function(e,t,i,n){this.name=e,this.version=t,this.os=i,this.bot=n,this.type="bot-device"},d=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},c=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},l=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,u=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;
1\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],h=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function f(e){return e?m(e):"undefined"===typeof document&&"undefined"!==typeof navigator&&"ReactNative"===navigator.product?new c:"undefined"!==typeof navigator?m(navigator.userAgent):S()}function g(e){return""!==e&&u.reduce((function(t,i){var n=i[0],s=i[1];if(t)return t;var o=s.exec(e);return!!o&&[n,o]}),!1)}function p(e){var t=g(e);return t?t[0]:null}function m(e){var t=g(e);if(!t)return null;var i=t[0],n=t[1];if("searchbot"===i)return new d;var r=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);r?r.length<3&&(r=s(s([],r,!0),function(e){for(var t=[],i=0;i<e;i++)t.push("0");return t}(3-r.length),!0)):r=[];var c=r.join("."),u=v(e),h=l.exec(e);return h&&h[1]?new a(i,c,u,h[1]):new o(i,c,u)}function v(e){for(var t=0,i=h.length;t<i;t++){var n=h[t],s=n[0];if(n[1].exec(e))return s}return null}function S(){return"undefined"!==typeof n&&n.version?new r(n.version.slice(1)):null}},99591:function(e,t,i){"use strict";const{Deflate:n,deflate:s,deflateRaw:o,gzip:r}=i(24555),{Inflate:a,inflate:d,inflateRaw:c,ungzip:l}=i(78843),u=i(71619);e.exports.Deflate=n,e.exports.deflate=s,e.exports.deflateRaw=o,e.exports.gzip=r,e.exports.Inflate=a,e.exports.inflate=d,e.exports.inflateRaw=c,e.exports.ungzip=l,e.exports.constants=u},24555:function(e,t,i){"use strict";const n=i(30405),s=i(24236),o=i(29373),r=i(48898),a=i(62292),d=Object.prototype.toString,{Z_NO_FLUSH:c,Z_SYNC_FLUSH:l,Z_FULL_FLUSH:u,Z_FINISH:h,Z_OK:f,Z_STREAM_END:g,Z_DEFAULT_COMPRESSION:p,Z_DEFAULT_STRATEGY:m,Z_DEFLATED:v}=i(71619),S={level:p,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,legacyHash:!0};function b(e){this.options=s.assign({},S,e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;let i=n.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy,t.legacyHash);if(i!==f)throw new Error(r[i]);if(t.header&&n.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"===typeof t.dictionary?o.string2buf(t.dictionary):"[object ArrayBuffer]"===d.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=n.deflateSetDictionary(this.strm,e),i!==f)throw new Error(r[i]);this._dict_set=!0}}function w(e,t){const i=new b(t);if(i.push(e,!0),i.err)throw i.msg||r[i.err];return i.result}b.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize;let r,a;if(this.ended)return!1;for(a=t===~~t?t:!0===t?h:c,"string"===typeof e?i.input=o.string2buf(e):"[object ArrayBuffer]"===d.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;)if(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),(a===l||a===u)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(r=n.deflate(i,a),r===g)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),r=n.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===f;if(0!==i.avail_out){if(a>0&&i.next_out>0)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else if(0===i.avail_in)break}else this.onData(i.output)}return!0},b.prototype.onData=function(e){this.chunks.push(e)},b.prototype.onEnd=function(e){e===f&&(this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},e.exports.Deflate=b,e.exports.deflate=w,e.exports.deflateRaw=function(e,t){return(t=t||{}).raw=!0,w(e,t)},e.exports.gzip=function(e,t){return(t=t||{}).gzip=!0,w(e,t)},e.exports.constants=i(71619)},78843:function(e,t,i){"use strict";const n=i(27948),s=i(24236),o=i(29373),r=i(48898),a=i(62292),d=i(42401),c=Object.prototype.toString,{Z_NO_FLUSH:l,Z_FINISH:u,Z_OK:h,Z_STREAM_END:f,Z_NEED_DICT:g,Z_STREAM_ERROR:p,Z_DATA_ERROR:m,Z_MEM_ERROR:v,Z_BUF_ER
1ROR:S}=i(71619),b={chunkSize:65536,windowBits:15,to:""};function w(e){this.options=s.assign({},b,e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0===(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;let i=n.inflateInit2(this.strm,t.windowBits);if(i!==h)throw new Error(r[i]);if(this.header=new d,n.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"===typeof t.dictionary?t.dictionary=o.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=n.inflateSetDictionary(this.strm,t.dictionary),i!==h)))throw new Error(r[i])}function y(e,t){const i=new w(t);if(i.push(e,!0),i.err)throw i.msg||r[i.err];return i.result}w.prototype.push=function(e,t){const i=this.strm,s=this.options.chunkSize,r=this.options.dictionary;let a,d,b;if(this.ended)return!1;for(d=t===~~t?t:!0===t?u:l,"[object ArrayBuffer]"===c.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;;){for(0===i.avail_out&&(i.output=new Uint8Array(s),i.next_out=0,i.avail_out=s),a=n.inflate(i,d),a===g&&r&&(a=n.inflateSetDictionary(i,r),a===h?a=n.inflate(i,d):a===m&&(a=g));i.avail_in>0&&a===f&&2&i.state.wrap&&0!==i.state.flags&&0!==i.input[i.next_in];)n.inflateReset(i),a=n.inflate(i,d);switch(a){case p:case m:case g:case v:return this.onEnd(a),this.ended=!0,!1}if(b=i.avail_out,i.next_out&&(0===i.avail_out||a===f||d>0))if("string"===this.options.to){let e=o.utf8border(i.output,i.next_out),t=i.next_out-e,n=o.buf2string(i.output,e);i.next_out=t,i.avail_out=s-t,t&&i.output.set(i.output.subarray(e,e+t),0),this.onData(n)}else this.onData(i.output.length===i.next_out?i.output:i.output.subarray(0,i.next_out)),i.avail_out=0,i.next_out=0;if(a!==h&&a!==S||0!==b){if(a===f)return a=n.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===i.avail_in){if(d===u)return a=n.inflateEnd(this.strm),this.onEnd(a===h?S:a),this.ended=!0,!1;break}}}return!0},w.prototype.onData=function(e){this.chunks.push(e)},w.prototype.onEnd=function(e){e===h&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},e.exports.Inflate=w,e.exports.inflate=y,e.exports.inflateRaw=function(e,t){return(t=t||{}).raw=!0,y(e,t)},e.exports.ungzip=y,e.exports.constants=i(71619)},24236:function(e){"use strict";const t=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);e.exports.assign=function(e){const i=Array.prototype.slice.call(arguments,1);for(;i.length;){const n=i.shift();if(n){if("object"!==typeof n)throw new TypeError(n+"must be non-object");for(const i in n)t(n,i)&&(e[i]=n[i])}}return e},e.exports.flattenChunks=e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t+=e[n].length;const i=new Uint8Array(t);for(let n=0,s=0,o=e.length;n<o;n++){let t=e[n];i.set(t,s),s+=t.length}return i}},29373:function(e){"use strict";let t=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(n){t=!1}const i=new Uint8Array(256);for(let s=0;s<256;s++)i[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;i[254]=i[255]=1,e.exports.string2buf=e=>{if("function"===typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,n,s,o,r=e.length,a=0;for(s=0;s<r;s++)i=e.charCodeAt(s),55296===(64512&i)&&s+1<r&&(n=e.charCodeAt(s+1),56320===(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),s++)),a+=i<128?1:i<2048?2:i<65536?3:4;for(t=new Uint8Array(a),o=0,s=0;o<a;s++)i=e.charCodeAt(s),55296===(64512&i)&&s+1<r&&(n=e.charCodeAt(s+1),56320===(64512&n)&&(i=65536+(i-55296<<10)+(n-56320),s++)),i<128?t[o++]=i:i<2048?(t[o++]=192|i>>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t};
vendor: 4,778 bytes, line 1
1e.exports.buf2string=(e,n)=>{const s=n||e.length;if("function"===typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,n));let o,r;const a=new Array(2*s);for(r=0,o=0;o<s;){let t=e[o++];if(t<128){a[r++]=t;continue}let n=i[t];if(n>4)a[r++]=65533,o+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&o<s;)t=t<<6|63&e[o++],n--;n>1?a[r++]=65533:t<65536?a[r++]=t:(t-=65536,a[r++]=55296|t>>10&1023,a[r++]=56320|1023&t)}}return((e,i)=>{if(i<65534&&e.subarray&&t)return String.fromCharCode.apply(null,e.length===i?e:e.subarray(0,i));let n="";for(let t=0;t<i;t++)n+=String.fromCharCode(e[t]);return n})(a,r)},e.exports.utf8border=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128===(192&e[n]);)n--;return n<0||0===n?t:n+i[e[n]]>t?n:t}},66069:function(e){"use strict";e.exports=(e,t,i,n)=>{let s=65535&e|0,o=e>>>16&65535|0,r=0;for(;0!==i;){r=i>2e3?2e3:i,i-=r;do{s=s+t[n++]|0,o=o+s|0}while(--r);s%=65521,o%=65521}return s|o<<16|0}},71619:function(e){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},2869:function(e){"use strict";const t=new Uint32Array((()=>{let e,t=[];for(var i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t})());e.exports=(e,i,n,s)=>{const o=t,r=s+n;e^=-1;for(let t=s;t<r;t++)e=e>>>8^o[255&(e^i[t])];return-1^e}},30405:function(e,t,i){"use strict";const{_tr_init:n,_tr_stored_block:s,_tr_flush_block:o,_tr_tally:r,_tr_align:a}=i(10342),d=i(66069),c=i(2869),l=i(48898),{Z_NO_FLUSH:u,Z_PARTIAL_FLUSH:h,Z_FULL_FLUSH:f,Z_FINISH:g,Z_BLOCK:p,Z_OK:m,Z_STREAM_END:v,Z_STREAM_ERROR:S,Z_DATA_ERROR:b,Z_BUF_ERROR:w,Z_DEFAULT_COMPRESSION:y,Z_FILTERED:C,Z_HUFFMAN_ONLY:T,Z_RLE:k,Z_FIXED:_,Z_DEFAULT_STRATEGY:I,Z_UNKNOWN:M,Z_DEFLATED:x}=i(71619),E=258,A=262,P=42,R=113,D=666,O=(e,t)=>(e.msg=l[t],t),V=e=>2*e-(e>4?9:0),B=e=>{let t=e.length;for(;--t>=0;)e[t]=0},L=e=>{let t,i,n,s=e.w_size;t=e.hash_size,n=t;do{i=e.head[--n],e.head[n]=i>=s?i-s:0}while(--t);t=s,n=t;do{i=e.prev[--n],e.prev[n]=i>=s?i-s:0}while(--t)};let N=(e,t,i)=>(t<<e.hash_shift^i)&e.hash_mask;const F=(e,t)=>{let i;if(e.legacy_hash)i=e.ins_h=N(e,e.ins_h,e.window[t+3-1]);else{const n=e.window,s=n[t]|n[t+1]<<8|n[t+2]<<16|n[t+3]<<24;i=e.ins_h=Math.imul(s,66521)+66521>>>16&e.hash_mask}const n=e.prev[t&e.w_mask]=e.head[i];return e.head[i]=t,n},U=e=>{const t=e.state;let i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+i),e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))},$=(e,t)=>{o(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,U(e.strm)},W=(e,t)=>{e.pending_buf[e.pending++]=t},j=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},H=(e,t,i,n)=>{let s=e.avail_in;return s>n&&(s=n),0===s?0:(e.avail_in-=s,t.set(e.input.subarray(e.next_in,e.next_in+s),i),1===e.state.wrap?e.adler=d(e.adler,t,s,i):2===e.state.wrap&&(e.adler=c(e.adler,t,s,i)),e.next_in+=s,e.total_in+=s,s)},z=(e,t)=>{let i,n,s=e.max_chain_length,o=e.strstart,r=e.prev_length,a=e.nice_match;const d=e.strstart>e.w_size-A?e.strstart-(e.w_size-A):0,c=e.window,l=e.w_mask,u=e.prev,h=e.strstart+E;let f=c[o+r-1],g=c[o+r];e.prev_length>=e.good_match&&(s>>=2),a>e.lookahead&&(a=e.lookahead);do{if(i=t,c[i+r]===g&&c[i+r-1]===f&&c[i]===c[o]&&c[++i]===c[o+1]){o+=2,i++;do{}while(c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&c[++o]===c[++i]&&o<h);if(n=E-(h-o),o=h-E,n>r){if(e.match_start=t,r=n,n>=a)break;f=c[o+r-1],g=c[o+r]}}}while((t=u[t&l])>d&&0!==--s);return r<=e.lookahead?r:e.lookahead},K=e=>{const t=e.w_size;let i,n,s;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-A)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),L(e),n+=t),0===e.strm.avail_in)break;if(i=H(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=i,e.legacy_hash){if(e.lookahead+e.insert>=3)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=N(e,e.ins_h,e.window[s+1]);e.insert&&(F(e,s),s++,e.insert--,!(e.lookahead+e.insert<3)););}else if(e.lookahead+e.insert>3)for(s=e.strstart-e.insert;e.insert&&(F(e,s),s++,e.insert--,!(e.lookahead+e.insert<=3)););}while(e.lookahead<A&&0!==e.strm.avail_in)},G=(e,t)=>{let i,n,o,r=e.pending_buf_size-5>
vendor: 6,660 bytes, line 1
1e.w_size?e.w_size:e.pending_buf_size-5,a=0,d=e.strm.avail_in;do{if(i=65535,o=e.bi_valid+42>>3,e.strm.avail_out<o)break;if(o=e.strm.avail_out-o,n=e.strstart-e.block_start,i>n+e.strm.avail_in&&(i=n+e.strm.avail_in),i>o&&(i=o),i<r&&(0===i&&t!==g||t===u||i!==n+e.strm.avail_in))break;a=t===g&&i===n+e.strm.avail_in?1:0,s(e,0,0,a),e.pending_buf[e.pending-4]=i,e.pending_buf[e.pending-3]=i>>8,e.pending_buf[e.pending-2]=~i,e.pending_buf[e.pending-1]=~i>>8,U(e.strm),n&&(n>i&&(n=i),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,i-=n),i&&(H(e.strm,e.strm.output,e.strm.next_out,i),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i)}while(0===a);return d-=e.strm.avail_in,d&&(d>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=d&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-d,e.strm.next_in),e.strstart),e.strstart+=d,e.insert+=d>e.w_size-e.insert?e.w_size-e.insert:d),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==u&&t!==g&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(o=e.window_size-e.strstart,e.strm.avail_in>o&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&(H(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water<e.strstart&&(e.high_water=e.strstart),o=e.bi_valid+42>>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,r=o>e.w_size?e.w_size:o,n=e.strstart-e.block_start,(n>=r||(n||t===g)&&t!==u&&0===e.strm.avail_in&&n<=o)&&(i=n>o?o:n,a=t===g&&0===e.strm.avail_in&&i===n?1:0,s(e,e.block_start,i,a),e.block_start+=i,U(e.strm)),a?3:1)},q=(e,t)=>{let i,n;for(;;){if(e.lookahead<A){if(K(e),e.lookahead<A&&t===u)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(i=F(e,e.strstart)),0!==i&&e.strstart-i<=e.w_size-A&&(e.match_length=z(e,i)),e.match_length>=3)if(n=r(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,i=F(e,e.strstart)}while(0!==--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.legacy_hash&&(e.ins_h=e.window[e.strstart],e.ins_h=N(e,e.ins_h,e.window[e.strstart+1]));else n=r(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&($(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===g?($(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&($(e,!1),0===e.strm.avail_out)?1:2},J=(e,t)=>{let i,n,s;for(;;){if(e.lookahead<A){if(K(e),e.lookahead<A&&t===u)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(i=F(e,e.strstart)),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-A&&(e.match_length=z(e,i),e.match_length<=5&&(e.strategy===C||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){s=e.strstart+e.lookahead-3,n=r(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=s&&(i=F(e,e.strstart))}while(0!==--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&($(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=r(e,0,e.window[e.strstart-1]),n&&$(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=r(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===g?($(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&($(e,!1),0===e.strm.avail_out)?1:2};function Q(e,t,i,n,s){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=n,this.func=s}const Z=[new Q(0,0,0,0,G),new Q(4,4,8,4,q),new Q(4,5,16,8,q),new Q(4,6,32,32,q),new Q(4,4,16,16,J),new Q(8,16,32,32,J),new Q(8,16,128,128,J),new Q(8,32,128,256,J),new Q(32,128,258,1024,J),new Q(32,258,258,4096,J)];function X(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=x,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.legacy_hash=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),B(this.dyn_ltree),B(this.dyn_dtree),B(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),B(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),B(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Y=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==P&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==R&&t.status!==D?1:0},ee=e=>{if(Y(e))return O(e,S);e.total_in=e.total_out=0,e.data_type=M;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?P:R,e.adler=2===t.wrap?0:1,t.last_flush=-2,n(t),m},te=e=>{const t=ee(e);var i;return t===m&&((i=e.state).window_size=2*i.w_size,B(i.head),i.max_lazy_match=Z[i.level].max_lazy,i.good_match=Z[i.level].good_length,i.nice_match=Z[i.level].nice_length,i.max_chain_length=Z[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=2,i.match_available=0,i.ins_h=0),t},ie=(e,t,i,n,s,o,r)=>{if(!e)return S;let a=1;if(t===y&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),s<1||s>9||i!==x||n<8||n>15||t<0||t>9||o<0||o>_||8===n&&1!==a)return O(e,S);8===n&&(n=9);const d=new X;return e.state=d,d.strm=e,d.status=P,d.wrap=a,d.gzhead=null,d.w_b
vendor: 4,252 bytes, line 1
1its=n,d.w_size=1<<d.w_bits,d.w_mask=d.w_size-1,d.legacy_hash=r?1:0,d.hash_bits=s+7,!d.legacy_hash&&d.hash_bits<15&&(d.hash_bits=15),d.hash_size=1<<d.hash_bits,d.hash_mask=d.hash_size-1,d.hash_shift=~~((d.hash_bits+3-1)/3),d.window=new Uint8Array(2*d.w_size),d.head=new Uint16Array(d.hash_size),d.prev=new Uint16Array(d.w_size),d.lit_bufsize=1<<s+6,d.pending_buf_size=4*d.lit_bufsize,d.pending_buf=new Uint8Array(d.pending_buf_size),d.sym_buf=d.lit_bufsize,d.sym_end=3*(d.lit_bufsize-1),d.level=t,d.strategy=o,d.method=i,te(e)};e.exports.deflateInit=(e,t)=>ie(e,t,x,15,8,I),e.exports.deflateInit2=ie,e.exports.deflateReset=te,e.exports.deflateResetKeep=ee,e.exports.deflateSetHeader=(e,t)=>Y(e)||2!==e.state.wrap?S:(e.state.gzhead=t,m),e.exports.deflate=(e,t)=>{if(Y(e)||t>p||t<0)return e?O(e,S):S;const i=e.state;if(!e.output||0!==e.avail_in&&!e.input||i.status===D&&t!==g)return O(e,0===e.avail_out?w:S);const n=i.last_flush;if(i.last_flush=t,0!==i.pending){if(U(e),0===e.avail_out)return i.last_flush=-1,m}else if(0===e.avail_in&&V(t)<=V(n)&&t!==g)return O(e,w);if(i.status===D&&0!==e.avail_in)return O(e,w);if(i.status===P&&0===i.wrap&&(i.status=R),i.status===P){let t=x+(i.w_bits-8<<4)<<8,n=-1;if(n=i.strategy>=T||i.level<2?0:i.level<6?1:6===i.level?2:3,t|=n<<6,0!==i.strstart&&(t|=32),t+=31-t%31,j(i,t),0!==i.strstart&&(j(i,e.adler>>>16),j(i,65535&e.adler)),e.adler=1,i.status=R,U(e),0!==i.pending)return i.last_flush=-1,m}if(57===i.status)if(e.adler=0,W(i,31),W(i,139),W(i,8),i.gzhead)W(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),W(i,255&i.gzhead.time),W(i,i.gzhead.time>>8&255),W(i,i.gzhead.time>>16&255),W(i,i.gzhead.time>>24&255),W(i,9===i.level?2:i.strategy>=T||i.level<2?4:0),W(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(W(i,255&i.gzhead.extra.length),W(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=c(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69;else if(W(i,0),W(i,0),W(i,0),W(i,0),W(i,0),W(i,9===i.level?2:i.strategy>=T||i.level<2?4:0),W(i,3),i.status=R,U(e),0!==i.pending)return i.last_flush=-1,m;if(69===i.status){if(i.gzhead.extra){let t=i.pending,n=(65535&i.gzhead.extra.length)-i.gzindex;for(;i.pending+n>i.pending_buf_size;){let s=i.pending_buf_size-i.pending;if(i.pending_buf.set(i.gzhead.extra.subarray(i.gzindex,i.gzindex+s),i.pending),i.pending=i.pending_buf_size,i.gzhead.hcrc&&i.pending>t&&(e.adler=c(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex+=s,U(e),0!==i.pending)return i.last_flush=-1,m;t=0,n-=s}let s=new Uint8Array(i.gzhead.extra);i.pending_buf.set(s.subarray(i.gzindex,i.gzindex+n),i.pending),i.pending+=n,i.gzhead.hcrc&&i.pending>t&&(e.adler=c(e.adler,i.pending_buf,i.pending-t,t)),i.gzindex=0}i.status=73}if(73===i.status){if(i.gzhead.name){let t,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(e.adler=c(e.adler,i.pending_buf,i.pending-n,n)),U(e),0!==i.pending)return i.last_flush=-1,m;n=0}t=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,W(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>n&&(e.adler=c(e.adler,i.pending_buf,i.pending-n,n)),i.gzindex=0}i.status=91}if(91===i.status){if(i.gzhead.comment){let t,n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n&&(e.adler=c(e.adler,i.pending_buf,i.pending-n,n)),U(e),0!==i.pending)return i.last_flush=-1,m;n=0}t=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,W(i,t)}while(0!==t);i.gzhead.hcrc&&i.pending>n&&(e.adler=c(e.adler,i.pending_buf,i.pending-n,n))}i.status=103}if(103===i.status){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size&&(U(e),0!==i.pending))return i.last_flush=-1,m;W(i,255&e.adler),W(i,e.adler>>8&255),e.adler=0}if(i.status=R,U(e),0!==i.pending)return i.last_flush=-1,m}if(0!==e.avail_in||0!==i.lookahead||t!==u&&i.status!==D){let n=0===i.level?G(i,t):i.strategy===T?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(K(e),0===e.lookahead)){if(t===u)return 1;break}if(e.match_length=0,i=r(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&($(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===g?($(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&($(e,!1),0===e.strm.avail_out)?1:2})(i,t):i.strategy===k?((e,t)=>
vendor: 4,465 bytes, line 1
1{let i,n,s,o;const a=e.window;for(;;){if(e.lookahead<=E){if(K(e),e.lookahead<=E&&t===u)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(s=e.strstart-1,n=a[s],n===a[++s]&&n===a[++s]&&n===a[++s])){o=e.strstart+E;do{}while(n===a[++s]&&n===a[++s]&&n===a[++s]&&n===a[++s]&&n===a[++s]&&n===a[++s]&&n===a[++s]&&n===a[++s]&&s<o);e.match_length=E-(o-s),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=r(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=r(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&($(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===g?($(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&($(e,!1),0===e.strm.avail_out)?1:2})(i,t):Z[i.level].func(i,t);if(3!==n&&4!==n||(i.status=D),1===n||3===n)return 0===e.avail_out&&(i.last_flush=-1),m;if(2===n&&(t===h?a(i):t!==p&&(s(i,0,0,!1),t===f&&(B(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),U(e),0===e.avail_out))return i.last_flush=-1,m}return t!==g?m:i.wrap<=0?v:(2===i.wrap?(W(i,255&e.adler),W(i,e.adler>>8&255),W(i,e.adler>>16&255),W(i,e.adler>>24&255),W(i,255&e.total_in),W(i,e.total_in>>8&255),W(i,e.total_in>>16&255),W(i,e.total_in>>24&255)):(j(i,e.adler>>>16),j(i,65535&e.adler)),U(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?m:v)},e.exports.deflateEnd=e=>{if(Y(e))return S;const t=e.state.status;return e.state=null,t===R?O(e,b):m},e.exports.deflateSetDictionary=(e,t)=>{let i=t.length;if(Y(e))return S;const n=e.state,s=n.wrap;if(2===s||1===s&&n.status!==P||n.lookahead)return S;if(1===s&&(e.adler=d(e.adler,t,i,0)),n.wrap=0,i>=n.w_size){0===s&&(B(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(i-n.w_size,i),0),t=e,i=n.w_size}const o=e.avail_in,r=e.next_in,a=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,K(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{F(n,e),e++}while(--t);n.strstart=e,n.lookahead=2,K(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=r,e.input=a,e.avail_in=o,n.wrap=s,m},e.exports.deflateInfo="pako deflate (from Nodeca project)"},42401:function(e){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},94264:function(e){"use strict";const t=16209;e.exports=function(e,i){let n,s,o,r,a,d,c,l,u,h,f,g,p,m,v,S,b,w,y,C,T,k,_,I;const M=e.state;n=e.next_in,_=e.input,s=n+(e.avail_in-5),o=e.next_out,I=e.output,r=o-(i-e.avail_out),a=o+(e.avail_out-257),d=M.dmax,c=M.wsize,l=M.whave,u=M.wnext,h=M.window,f=M.hold,g=M.bits,p=M.lencode,m=M.distcode,v=(1<<M.lenbits)-1,S=(1<<M.distbits)-1;e:do{g<15&&(f+=_[n++]<<g,g+=8,f+=_[n++]<<g,g+=8),b=p[f&v];t:for(;;){if(w=b>>>24,f>>>=w,g-=w,w=b>>>16&255,0===w)I[o++]=65535&b;else{if(!(16&w)){if(0===(64&w)){b=p[(65535&b)+(f&(1<<w)-1)];continue t}if(32&w){M.mode=16191;break e}e.msg="invalid literal/length code",M.mode=t;break e}y=65535&b,w&=15,w&&(g<w&&(f+=_[n++]<<g,g+=8),y+=f&(1<<w)-1,f>>>=w,g-=w),g<15&&(f+=_[n++]<<g,g+=8,f+=_[n++]<<g,g+=8),b=m[f&S];i:for(;;){if(w=b>>>24,f>>>=w,g-=w,w=b>>>16&255,!(16&w)){if(0===(64&w)){b=m[(65535&b)+(f&(1<<w)-1)];continue i}e.msg="invalid distance code",M.mode=t;break e}if(C=65535&b,w&=15,g<w&&(f+=_[n++]<<g,g+=8,g<w&&(f+=_[n++]<<g,g+=8)),C+=f&(1<<w)-1,C>d){e.msg="invalid distance too far back",M.mode=t;break e}if(f>>>=w,g-=w,w=o-r,C>w){if(w=C-w,w>l&&M.sane){e.msg="invalid distance too far back",M.mode=t;break e}if(T=0,k=h,0===u){if(T+=c-w,w<y){y-=w;do{I[o++]=h[T++]}while(--w);T=o-C,k=I}}else if(u<w){if(T+=c+u-w,w-=u,w<y){y-=w;do{I[o++]=h[T++]}while(--w);if(T=0,u<y){w=u,y-=w;do{I[o++]=h[T++]}while(--w);T=o-C,k=I}}}else if(T+=u-w,w<y){y-=w;do{I[o++]=h[T++]}while(--w);T=o-C,k=I}for(;y>2;)I[o++]=k[T++],I[o++]=k[T++],I[o++]=k[T++],y-=3;y&&(I[o++]=k[T++],y>1&&(I[o++]=k[T++]))}else{T=o-C;do{I[o++]=I[T++],I[o++]=I[T++],I[o++]=I[T++],y-=3}while(y>2);y&&(I[o++]=I[T++],y>1&&(I[o++]=I[T++]))}break}}break}}while(n<s&&o<a);y=g>>3,n-=y,g-=y<<3,f&=(1<<g)-1,e.next_in=n,e.next_out=o,e.avail_in=n<s?s-n+5:5-(n-s),e.avail_out=o<a?a-o+257:257-(o-a),M.hold=f,M.bits=g}},27948:function(e,t,i){"use strict";const n=i(66069),s=i(2869),o=i(94264),r=i(9241),{Z_FINISH:a,Z_BLOCK:d,Z_TREES:c,Z_OK:l,Z_STREAM_END:u,Z_NEED_DICT:h,Z_STREAM_ERROR:f,Z_DATA_ERROR:g,Z_MEM_ERROR:p,Z_BUF_ER
vendor: 10,887 bytes, line 1
1ROR:m,Z_DEFLATED:v}=i(71619),S=16180,b=16190,w=16191,y=16192,C=16194,T=16199,k=16200,_=16206,I=16209,M=16210,x=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function E(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const A=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<S||t.mode>16211?1:0},P=e=>{if(A(e))return f;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=S,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,l},R=e=>{if(A(e))return f;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,P(e)},D=(e,t)=>{let i;if(A(e))return f;const n=e.state;return t<0?(i=0,t=-t):(i=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?f:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,R(e))},O=(e,t)=>{if(!e)return f;const i=new E;e.state=i,i.strm=e,i.window=null,i.mode=S;const n=D(e,t);return n!==l&&(e.state=null),n};let V,B,L=!0;const N=e=>{if(L){V=new Int32Array(512),B=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(r(1,e.lens,0,288,V,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;r(2,e.lens,0,32,B,0,e.work,{bits:5}),L=!1}e.lencode=V,e.lenbits=9,e.distcode=B,e.distbits=5},F=(e,t,i,n)=>{let s;const o=e.state;return null===o.window&&(o.window=new Uint8Array(1<<o.wbits)),0===o.wsize&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0),n>=o.wsize?(o.window.set(t.subarray(i-o.wsize,i),0),o.wnext=0,o.whave=o.wsize):(s=o.wsize-o.wnext,s>n&&(s=n),o.window.set(t.subarray(i-n,i-n+s),o.wnext),(n-=s)?(o.window.set(t.subarray(i-n,i),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0};e.exports.inflateReset=R,e.exports.inflateReset2=D,e.exports.inflateResetKeep=P,e.exports.inflateInit=e=>O(e,15),e.exports.inflateInit2=O,e.exports.inflate=(e,t)=>{let i,E,P,R,D,O,V,B,L,U,$,W,j,H,z,K,G,q,J,Q,Z,X,Y=0;const ee=new Uint8Array(4);let te,ie;const ne=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(A(e)||!e.output||!e.input&&0!==e.avail_in)return f;i=e.state,i.mode===w&&(i.mode=y),D=e.next_out,P=e.output,V=e.avail_out,R=e.next_in,E=e.input,O=e.avail_in,B=i.hold,L=i.bits,U=O,$=V,X=l;e:for(;;)switch(i.mode){case S:if(0===i.wrap){i.mode=y;break}for(;L<16;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}if(2&i.wrap&&35615===B){0===i.wbits&&(i.wbits=15),i.check=0,ee[0]=255&B,ee[1]=B>>>8&255,i.check=s(i.check,ee,2,0),B=0,L=0,i.mode=16181;break}if(i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&B)<<8)+(B>>8))%31){e.msg="incorrect header check",i.mode=I;break}if((15&B)!==v){e.msg="unknown compression method",i.mode=I;break}if(B>>>=4,L-=4,Z=8+(15&B),0===i.wbits&&(i.wbits=Z),Z>15||Z>i.wbits){e.msg="invalid window size",i.mode=I;break}i.dmax=1<<i.wbits,i.flags=0,e.adler=i.check=1,i.mode=512&B?16189:w,B=0,L=0;break;case 16181:for(;L<16;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}if(i.flags=B,(255&i.flags)!==v){e.msg="unknown compression method",i.mode=I;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=I;break}i.head&&(i.head.text=B>>8&1),512&i.flags&&4&i.wrap&&(ee[0]=255&B,ee[1]=B>>>8&255,i.check=s(i.check,ee,2,0)),B=0,L=0,i.mode=16182;case 16182:for(;L<32;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}i.head&&(i.head.time=B),512&i.flags&&4&i.wrap&&(ee[0]=255&B,ee[1]=B>>>8&255,ee[2]=B>>>16&255,ee[3]=B>>>24&255,i.check=s(i.check,ee,4,0)),B=0,L=0,i.mode=16183;case 16183:for(;L<16;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}i.head&&(i.head.xflags=255&B,i.head.os=B>>8),512&i.flags&&4&i.wrap&&(ee[0]=255&B,ee[1]=B>>>8&255,i.check=s(i.check,ee,2,0)),B=0,L=0,i.mode=16184;case 16184:if(1024&i.flags){for(;L<16;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}i.length=B,i.head&&(i.head.extra_len=B),512&i.flags&&4&i.wrap&&(ee[0]=255&B,ee[1]=B>>>8&255,i.check=s(i.check,ee,2,0)),B=0,L=0}else i.head&&(i.head.extra=null);i.mode=16185;case 16185:if(1024&i.flags&&(W=i.length,W>O&&(W=O),W&&(i.head&&(Z=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(E.subarray(R,R+W),Z)),512&i.flags&&4&i.wrap&&(i.check=s(i.check,E,W,R)),O-=W,R+=W,i.length-=W),i.length))break e;i.length=0,i.mode=16186;case 16186:if(2048&i.flags){if(0===O)break e;W=0;do{Z=E[R+W++],i.head&&Z&&i.length<65536&&(i.head.name+=String.fromCharCode(Z))}while(Z&&W<O);if(512&i.flags&&4&i.wrap&&(i.check=s(i.check,E,W,R)),O-=W,R+=W,Z)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=16187;case 16187:if(4096&i.flags){if(0===O)break e;W=0;do{Z=E[R+W++],i.head&&Z&&i.length<65536&&(i.head.comment+=String.fromCharCode(Z))}while(Z&&W<O);if(512&i.flags&&4&i.wrap&&(i.check=s(i.check,E,W,R)),O-=W,R+=W,Z)break e}else i.head&&(i.head.comment=null);i.mode=16188;case 16188:if(512&i.flags){for(;L<16;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}if(4&i.wrap&&B!==(65535&i.check)){e.msg="header crc mismatch",i.mode=I;break}B=0,L=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=w;break;case 16189:for(;L<32;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}e.adler=i.check=x(B),B=0,L=0,i.mode=b;case b:if(0===i.havedict)return e.next_out=D,e.avail_out=V,e.next_in=R,e.avail_in=O,i.hold=B,i.bits=L,h;e.adler=i.check=1,i.mode=w;case w:if(t===d||t===c)break e;case y:if(i.last){B>>>=7&L,L-=7&L,i.mode=_;break}for(;L<3;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}switch(i.last=1&B,B>>>=1,L-=1,3&B){case 0:i.mode=16193;break;case 1:if(N(i),i.mode=T,t===c){B>>>=2,L-=2;break e}break;case 2:i.mode=16196;break;case 3:e.msg="invalid block type",i.mode=I}B>>>=2,L-=2;break;case 16193:for(B>>>=7&L,L-=7&L;L<32;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}if((65535&B)!==(B>>>16^65535)){e.msg="invalid stored block lengths",i.mode=I;break}if(i.length=65535&B,B=0,L=0,i.mode=C,t===c)break e;case C:i.mode=16195;case 16195:if(W=i.length,W){if(W>O&&(W=O),W>V&&(W=V),0===W)break e;P.set(E.subarray(R,R+W),D),O-=W,R+=W,V-=W,D+=W,i.length-=W;break}i.mode=w;break;case 16196:for(;L<14;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}if(i.nlen=257+(31&B),B>>>=5,L-=5,i.ndist=1+(31&B),B>>>=5,L-=5,i.ncode=4+(15&B),B>>>=4,L-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=I;break}i.have=0,i.mode=16197;case 16197:for(;i.have<i.ncode;){for(;L<3;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}i.lens[ne[i.have++]]=7&B,B>>>=3,L-=3}for(;i.have<19;)i.lens[ne[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,te={bits:i.lenbits},X=r(0,i.lens,0,19,i.lencode,0,i.work,te),i.lenbits=te.bits,X){e.msg="invalid code lengths set",i.mode=I;break}i.have=0,i.mode=16198;case 16198:for(;i.have<i.nlen+i.ndist;){for(;Y=i.lencode[B&(1<<i.lenbits)-1],z=Y>>>24,K=Y>>>16&255,G=65535&Y,!(z<=L);){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}if(G<16)B>>>=z,L-=z,i.lens[i.have++]=G;else{if(16===G){for(ie=z+2;L<ie;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}if(B>>>=z,L-=z,0===i.have){e.msg="invalid bit length repeat",i.mode=I;break}Z=i.lens[i.have-1],W=3+(3&B),B>>>=2,L-=2}else if(17===G){for(ie=z+3;L<ie;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}B>>>=z,L-=z,Z=0,W=3+(7&B),B>>>=3,L-=3}else{for(ie=z+7;L<ie;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}B>>>=z,L-=z,Z=0,W=11+(127&B),B>>>=7,L-=7}if(i.have+W>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=I;break}for(;W--;)i.lens[i.have++]=Z}}if(i.mode===I)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=I;break}if(i.lenbits=9,te={bits:i.lenbits},X=r(1,i.lens,0,i.nlen,i.lencode,0,i.work,te),i.lenbits=te.bits,X){e.msg="invalid literal/lengths set",i.mode=I;break}if(i.distbits=6,i.distcode=i.distdyn,te={bits:i.distbits},X=r(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,te),i.distbits=te.bits,X){e.msg="invalid distances set",i.mode=I;break}if(i.mode=T,t===c)break e;case T:i.mode=k;case k:if(O>=6&&V>=258){e.next_out=D,e.avail_out=V,e.next_in=R,e.avail_in=O,i.hold=B,i.bits=L,o(e,$),D=e.next_out,P=e.output,V=e.avail_out,R=e.next_in,E=e.input,O=e.avail_in,B=i.hold,L=i.bits,i.mode===w&&(i.back=-1);break}for(i.back=0;Y=i.lencode[B&(1<<i.lenbits)-1],z=Y>>>24,K=Y>>>16&255,G=65535&Y,!(z<=L);){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}if(K&&0===(240&K)){for(q=z,J=K,Q=G;Y=i.lencode[Q+((B&(1<<q+J)-1)>>q)],z=Y>>>24,K=Y>>>16&255,G=65535&Y,!(q+z<=L);){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}B>>>=q,L-=q,i.back+=q}if(B>>>=z,L-=z,i.back+=z,i.length=G,0===K){i.mode=16205;break}if(32&K){i.back=-1,i.mode=w;break}if(64&K){e.msg="invalid literal/length code",i.mode=I;break}i.extra=15&K,i.mode=16201;case 16201:if(i.extra){for(ie=i.extra;L<ie;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}i.length+=B&(1<<i.extra)-1,B>>>=i.extra,L-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=16202;case 16202:for(;Y=i.distcode[B&(1<<i.distbits)-1],z=Y>>>24,K=Y>>>16&255,G=65535&Y,!(z<=L);){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}if(0===(240&K)){for(q=z,J=K,Q=G;Y=i.distcode[Q+((B&(1<<q+J)-1)>>q)],z=Y>>>24,K=Y>>>16&255,G=65535&Y,!(q+z<=L);){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}B>>>=q,L-=q,i.back+=q}if(B>>>=z,L-=z,i.back+=z,64&K){e.msg="invalid distance code",i.mode=I;break}i.offset=G,i.extra=15&K,i.mode=16203;case 16203:if(i.extra){for(ie=i.extra;L<ie;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}i.offset+=B&(1<<i.extra)-1,B>>>=i.extra,L-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=I;break}i.mode=16204;case 16204:if(0===V)break e;if(W=$-V,i.offset>W){if(W=i.offset-W,W>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=I;break}W>i.wnext?(W-=i.wnext,j=i.wsize-W):j=i.wnext-W,W>i.length&&(W=i.length),H=i.window}else H=P,j=D-i.offset,W=i.length;W>V&&(W=V),V-=W,i.length-=W;do{P[D++]=H[j++]}while(--W);0===i.length&&(i.mode=k);break;case 16205:if(0===V)break e;P[D++]=i.length,V--,i.mode=k;break;case _:if(i.wrap){for(;L<32;){if(0===O)break e;O--,B|=E[R++]<<L,L+=8}if($-=V,e.total_out+=$,i.total+=$,4&i.wrap&&$&&(e.adler=i.check=i.flags?s(i.check,P,$,D-$):n(i.check,P,$,D-$)),$=V,4&i.wrap&&(i.flags?B:x(B))!==i.check){e.msg="incorrect data check",i.mode=I;break}B=0,L=0}i.mode=16207;case 16207:if(i.wrap&&i.flags){for(;L<32;){if(0===O)break e;O--,B+=E[R++]<<L,L+=8}if(4&i.wrap&&B!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=I;break}B=0,L=0}i.mode=16208;case 16208:X=u;break e;case I:X=g;break e;case M:return p;default:return f}return e.next_out=D,e.avail_out=V,e.next_in=R,e.avail_in=O,i.hold=B,i.bits=L,(i.wsize||$!==e.avail_out&&i.mode<I&&
vendor: 4,567 bytes, line 1
1(i.mode<_||t!==a))&&F(e,e.output,e.next_out,$-e.avail_out)?(i.mode=M,p):(U-=e.avail_in,$-=e.avail_out,e.total_in+=U,e.total_out+=$,i.total+=$,4&i.wrap&&$&&(e.adler=i.check=i.flags?s(i.check,P,$,e.next_out-$):n(i.check,P,$,e.next_out-$)),e.data_type=i.bits+(i.last?64:0)+(i.mode===w?128:0)+(i.mode===T||i.mode===C?256:0),(0===U&&0===$||t===a)&&X===l&&(X=m),X)},e.exports.inflateEnd=e=>{if(A(e))return f;let t=e.state;return t.window&&(t.window=null),e.state=null,l},e.exports.inflateGetHeader=(e,t)=>{if(A(e))return f;const i=e.state;return 0===(2&i.wrap)?f:(i.head=t,t.done=!1,l)},e.exports.inflateSetDictionary=(e,t)=>{const i=t.length;let s,o,r;return A(e)?f:(s=e.state,0!==s.wrap&&s.mode!==b?f:s.mode===b&&(o=1,o=n(o,t,i,0),o!==s.check)?g:(r=F(e,t,i,i),r?(s.mode=M,p):(s.havedict=1,l)))},e.exports.inflateInfo="pako inflate (from Nodeca project)"},9241:function(e){"use strict";const t=15,i=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),n=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,199,75]),s=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),o=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);e.exports=(e,r,a,d,c,l,u,h)=>{const f=h.bits;let g,p,m,v,S,b,w=0,y=0,C=0,T=0,k=0,_=0,I=0,M=0,x=0,E=0,A=null;const P=new Uint16Array(16),R=new Uint16Array(16);let D,O,V,B=null;for(w=0;w<=t;w++)P[w]=0;for(y=0;y<d;y++)P[r[a+y]]++;for(k=f,T=t;T>=1&&0===P[T];T--);if(k>T&&(k=T),0===T)return c[l++]=20971520,c[l++]=20971520,h.bits=1,0;for(C=1;C<T&&0===P[C];C++);for(k<C&&(k=C),M=1,w=1;w<=t;w++)if(M<<=1,M-=P[w],M<0)return-1;if(M>0&&(0===e||1!==T))return-1;for(R[1]=0,w=1;w<t;w++)R[w+1]=R[w]+P[w];for(y=0;y<d;y++)0!==r[a+y]&&(u[R[r[a+y]]++]=y);if(0===e?(A=B=u,b=20):1===e?(A=i,B=n,b=257):(A=s,B=o,b=0),E=0,y=0,w=C,S=l,_=k,I=0,m=-1,x=1<<k,v=x-1,1===e&&x>852||2===e&&x>592)return 1;for(;;){D=w-I,u[y]+1<b?(O=0,V=u[y]):u[y]>=b?(O=B[u[y]-b],V=A[u[y]-b]):(O=96,V=0),g=1<<w-I,p=1<<_,C=p;do{p-=g,c[S+(E>>I)+p]=D<<24|O<<16|V|0}while(0!==p);for(g=1<<w-1;E&g;)g>>=1;if(0!==g?(E&=g-1,E+=g):E=0,y++,0===--P[w]){if(w===T)break;w=r[a+u[y]]}if(w>k&&(E&v)!==m){for(0===I&&(I=k),S+=C,_=w-I,M=1<<_;_+I<T&&(M-=P[_+I],!(M<=0));)_++,M<<=1;if(x+=1<<_,1===e&&x>852||2===e&&x>592)return 1;m=E&v,c[m]=k<<24|_<<16|S-l|0}}return 0!==E&&(c[S+E]=w-I<<24|64<<16|0),h.bits=k,0}},48898:function(e){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},10342:function(e){"use strict";function t(e){let t=e.length;for(;--t>=0;)e[t]=0}const i=256,n=286,s=30,o=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),a=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),d=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),c=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l=new Array(576);t(l);const u=new Array(60);t(u);const h=new Array(512);t(h);const f=new Array(256);t(f);const g=new Array(29);t(g);const p=new Array(s);function m(e,t,i,n,s){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=n,this.max_length=s,this.has_stree=e&&e.length}let v,S,b;function w(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(p);const y=e=>e<256?h[e]:h[256+(e>>>7)],C=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},T=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,C(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)},k=(e,t,i)=>{T(e,i[2*t],i[2*t+1])},_=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},I=(e,t,i)=>{const n=new Array(16);let s,r,a=0;for(s=1;s<=o;s++)a=a+i[s-1]<<1,n[s]=a;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=_(n[t]++,t))}},M=e=>{let t;for(t=0;t<n;t++)e.dyn_ltree[2*t]=0;for(t=0;t<s;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},x=e=>{e.bi_valid>8?C(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},E=(e,t,i,n)=>{const s=2*t,o=2*i;return e[s]<e[o]||e[s]===e[o]&&n[t]<=n[i]},A=(e,t,i)=>{const n=e.heap[i];let s=i<<1;for(;s<=e.heap_len&&(s<e.heap_len&&E(t,e.heap[s+1],e.heap[s],e.depth)&&s++,!E(t,n,e.heap[s],e.depth));)e.heap[i]=e.heap[s],i=s,s<<=1;
vendor: 4,244 bytes, line 1
1e.heap[i]=n},P=(e,t,n)=>{let s,o,d,c,l=0;if(0!==e.sym_next)do{s=255&e.pending_buf[e.sym_buf+l++],s+=(255&e.pending_buf[e.sym_buf+l++])<<8,o=e.pending_buf[e.sym_buf+l++],0===s?k(e,o,t):(d=f[o],k(e,d+i+1,t),c=r[d],0!==c&&(o-=g[d],T(e,o,c)),s--,d=y(s),k(e,d,n),c=a[d],0!==c&&(s-=p[d],T(e,s,c)))}while(l<e.sym_next);k(e,256,t)},R=(e,t)=>{const i=t.dyn_tree,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,r=t.stat_desc.elems;let a,d,c,l=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<r;a++)0!==i[2*a]?(e.heap[++e.heap_len]=l=a,e.depth[a]=0):i[2*a+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=l<2?++l:0,i[2*c]=1,e.depth[c]=0,e.opt_len--,s&&(e.static_len-=n[2*c+1]);for(t.max_code=l,a=e.heap_len>>1;a>=1;a--)A(e,i,a);c=r;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],A(e,i,1),d=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=d,i[2*c]=i[2*a]+i[2*d],e.depth[c]=(e.depth[a]>=e.depth[d]?e.depth[a]:e.depth[d])+1,i[2*a+1]=i[2*d+1]=c,e.heap[1]=c++,A(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const i=t.dyn_tree,n=t.max_code,s=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,c=t.stat_desc.max_length;let l,u,h,f,g,p,m=0;for(f=0;f<=o;f++)e.bl_count[f]=0;for(i[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)u=e.heap[l],f=i[2*i[2*u+1]+1]+1,f>c&&(f=c,m++),i[2*u+1]=f,u>n||(e.bl_count[f]++,g=0,u>=d&&(g=a[u-d]),p=i[2*u],e.opt_len+=p*(f+g),r&&(e.static_len+=p*(s[2*u+1]+g)));if(0!==m){do{for(f=c-1;0===e.bl_count[f];)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,m-=2}while(m>0);for(f=c;0!==f;f--)for(u=e.bl_count[f];0!==u;)h=e.heap[--l],h>n||(i[2*h+1]!==f&&(e.opt_len+=(f-i[2*h+1])*i[2*h],i[2*h+1]=f),u--)}})(e,t),I(i,l,e.bl_count)},D=(e,t,i)=>{let n,s,o=-1,r=t[1],a=0,d=7,c=4;for(0===r&&(d=138,c=3),t[2*(i+1)+1]=65535,n=0;n<=i;n++)s=r,r=t[2*(n+1)+1],++a<d&&s===r||(a<c?e.bl_tree[2*s]+=a:0!==s?(s!==o&&e.bl_tree[2*s]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,o=s,0===r?(d=138,c=3):s===r?(d=6,c=3):(d=7,c=4))},O=(e,t,i)=>{let n,s,o=-1,r=t[1],a=0,d=7,c=4;for(0===r&&(d=138,c=3),n=0;n<=i;n++)if(s=r,r=t[2*(n+1)+1],!(++a<d&&s===r)){if(a<c)do{k(e,s,e.bl_tree)}while(0!==--a);else 0!==s?(s!==o&&(k(e,s,e.bl_tree),a--),k(e,16,e.bl_tree),T(e,a-3,2)):a<=10?(k(e,17,e.bl_tree),T(e,a-3,3)):(k(e,18,e.bl_tree),T(e,a-11,7));a=0,o=s,0===r?(d=138,c=3):s===r?(d=6,c=3):(d=7,c=4)}};let V=!1;const B=(e,t,i,n)=>{T(e,0+(n?1:0),3),x(e),C(e,i),C(e,~i),i&&e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i};e.exports._tr_init=e=>{V||((()=>{let e,t,i,c,w;const y=new Array(16);for(i=0,c=0;c<28;c++)for(g[c]=i,e=0;e<1<<r[c];e++)f[i++]=c;for(f[i-1]=c,w=0,c=0;c<16;c++)for(p[c]=w,e=0;e<1<<a[c];e++)h[w++]=c;for(w>>=7;c<s;c++)for(p[c]=w<<7,e=0;e<1<<a[c]-7;e++)h[256+w++]=c;for(t=0;t<=o;t++)y[t]=0;for(e=0;e<=143;)l[2*e+1]=8,e++,y[8]++;for(;e<=255;)l[2*e+1]=9,e++,y[9]++;for(;e<=279;)l[2*e+1]=7,e++,y[7]++;for(;e<=287;)l[2*e+1]=8,e++,y[8]++;for(I(l,287,y),e=0;e<s;e++)u[2*e+1]=5,u[2*e]=_(e,5);v=new m(l,r,257,n,o),S=new m(u,a,0,s,o),b=new m(new Array(0),d,0,19,7)})(),V=!0),e.l_desc=new w(e.dyn_ltree,v),e.d_desc=new w(e.dyn_dtree,S),e.bl_desc=new w(e.bl_tree,b),e.bi_buf=0,e.bi_valid=0,M(e)},e.exports._tr_stored_block=B,e.exports._tr_flush_block=(e,t,n,s)=>{let o,r,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<i;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),R(e,e.l_desc),R(e,e.d_desc),a=(e=>{let t;for(D(e,e.dyn_ltree,e.l_desc.max_code),D(e,e.dyn_dtree,e.d_desc.max_code),R(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*c[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),o=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=o&&(o=r)):o=r=n+5,n+4<=o&&-1!==t?B(e,t,n,s):4===e.strategy||r===o?(T(e,2+(s?1:0),3),P(e,l,u)):(T(e,4+(s?1:0),3),((e,t,i,n)=>{let s;for(T(e,t-257,5),T(e,i-1,5),T(e,n-4,4),s=0;s<n;s++)T(e,e.bl_tree[2*c[s]+1],3);O(e,e.dyn_ltree,t-1),O(e,e.dyn_dtree,i-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),P(e,e.dyn_ltree,e.dyn_dtree)),M(e),s&&x(e)},e.exports._tr_tally=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>
18,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(f[n]+i+1)]++,e.dyn_dtree[2*y(t)]++),e.sym_next===e.sym_end),e.exports._tr_align=e=>{T(e,2,3),k(e,256,l),(e=>{16===e.bi_valid?(C(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}},62292:function(e){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},62100:function(e,t,i){"use strict";e.exports=i(89482)},89482:function(e,t,i){"use strict";var n=t;function s(){n.Reader._configure(n.BufferReader),n.util._configure()}n.build="minimal",n.Writer=i(41173),n.BufferWriter=i(43155),n.Reader=i(51408),n.BufferReader=i(50593),n.util=i(99693),n.rpc=i(35994),n.roots=i(85054),n.configure=s,n.Writer._configure(n.BufferWriter),s()},51408:function(e,t,i){"use strict";e.exports=d;var n,s=i(99693),o=s.LongBits,r=s.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function d(e){this.buf=e,this.pos=0,this.len=e.length}var c="undefined"!==typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new d(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new d(e);throw Error("illegal buffer")};function l(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(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 a(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 u(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 a(this,8);return new o(u(this.buf,this.pos+=4),u(this.buf,this.pos+=4))}d.create=s.Buffer?function(e){return(d.create=function(e){return s.Buffer.isBuffer(e)?new n(e):c(e)})(e)}:c,d.prototype._slice=s.Array.prototype.subarray||s.Array.prototype.slice,d.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),d.prototype.int32=function(){return 0|this.uint32()},d.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},d.prototype.bool=function(){return 0!==this.uint32()},d.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return u(this.buf,this.pos+=4)},d.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|u(this.buf,this.pos+=4)},d.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=s.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},d.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=s.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},d.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,i):t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)},d.prototype.string=function(){var e=this.bytes();return r.read(e,0,e.length)},d.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},d.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},d._configure=function(e){n=e;var t=s.Long?"toLong":"toNumber";s.merge(d.prototype,{int64:function(){return l.call(this)[t](!1)},uint64:function(){return l.call(this)[t](!0)},sint64:function(){return l.call(this).zzDecode()[t](!1)},fixed64:function(){return h.call(this)[t](!0)},sfixed64:function(){return h.call(this)[t](!1)}})}},50593:function(e,t,i){"use strict";e.exports=o;var n=i(51408);(o.prototype=Object.create(n.prototype)).constructor=o;var s=i(99693);function o(e){n.call(this,e)}s.Buffer&&(o.prototype._slice=s.Buffer.prototype.slice),o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))}},85054:function(e){"use strict";e.exports={}},35994:function(e,t,i){"use strict";t.Service=i(77948)},77948:function(e,t,i){"use strict";e.exports=s;var n=i(99693);function s(e,t,i){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(i)}(s.prototype=Object.create(n.EventEmitter.prototype)).constructor=s,s.prototype.rpcCall=function e(t,i,s,o,r){if(!o)throw TypeError("request must be specified");var a=this;if(!r)return n.asPromise(e,a,t,i,s,o);if(a.rpcImpl)try{return a.rpcImpl(t,i[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,i){if(e)return a.emit("error",e,t),r(e);if(null!==i){if(!(i instanceof s))try{i=s[a.responseDelimited?"decodeDelimited":"decode"](i)}catch(e){return a.emit("error",e,t),r(e)}return a.emit("data",i,t),r(null,i)}a.end(!0)}))}catch(d){return a.emit("error",d,t),void setTimeout((function(){r(d)}),0)}else setTimeout((function(){r(Error("already ended"))}),0)},s.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit
1("end").off()),this}},1945:function(e,t,i){"use strict";e.exports=s;var n=i(99693);function s(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=s.zero=new s(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var r=s.zeroHash="\0\0\0\0\0\0\0\0";s.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new s(i,n)},s.from=function(e){if("number"===typeof e)return s.fromNumber(e);if(n.isString(e)){if(!n.Long)return s.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new s(e.low>>>0,e.high>>>0):o},s.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+4294967296*i)}return this.lo+4294967296*this.hi},s.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 a=String.prototype.charCodeAt;s.fromHash=function(e){return e===r?o:new s((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},s.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)},s.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},s.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},s.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}},99693:function(e,t,i){"use strict";var n=t;function s(e,t,i){for(var n=Object.keys(t),s=0;s<n.length;++s)void 0!==e[n[s]]&&i||(e[n[s]]=t[n[s]]);return e}function o(e){function t(e,i){if(!(this instanceof t))return new t(e,i);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),i&&s(this,i)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}n.asPromise=i(34537),n.base64=i(97419),n.EventEmitter=i(19211),n.float=i(10945),n.inquire=i(67199),n.utf8=i(94997),n.pool=i(76662),n.LongBits=i(1945),n.global="undefined"!==typeof window&&window||"undefined"!==typeof i.g&&i.g||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isNode=Boolean(n.global.process&&n.global.process.versions&&n.global.process.versions.node),n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var i=e[t];return!(null==i||!e.hasOwnProperty(t))&&("object"!==typeof i||(Array.isArray(i)?i.length:Object.keys(i).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){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 i=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))},n.merge=s,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},i=0;i<e.length;++i)t[e[i]]=1;return function(){for(var e=Object.keys(this),i=e.length-1;i>-1;--i)if(1===t[e[i]]&&void 0!==this[e[i]]&&null!==this[e[i]])return e[i]}},n.oneOfSetter=function(e){return function(t){for(var i=0;i<e.length;++i)e[i]!==t&&delete this[e[i]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,i){return new e(t,i)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},41173:function(e,t,i){"use strict";e.exports=u;var n,s=i(99693),o=s.LongBits,r=s.base64,a=s.utf8;function d(e,t,i){this.fn=e,this.len=t,this.next=void 0,this.val=i}function c(){}function l(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function u(){this.len=0,this.head=new d(c,0,0),this.tail=this.head,this.states=null}function h(e,t,i){t[i]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,i){for(;e.hi;)t[i++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[i++]=127&e.lo|128,e.lo=e.lo>>>7;t[i++]=e.lo}function p(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}u.create=s.Buffer?function(){return(u.create=function(){return new n})()}:function(){return new u},u.alloc=function(e){return new s.Array(e)},s.Array!==Array&&(u.alloc=s.pool(u.alloc,s.Array.prototype.subarray)),u.prototype._push=function(e,t,i){return this.tail=this.tail.next=new d(e,t,i),this.len+=t,this},f.prototype=Object.create(d.prototype),f.prototype.fn=function(e,t,i){for(;e>127;)t[i++]=127&e|128,e>>>=7;t[i]=e},u.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},u.prototype.int32=function(e){return e<0?this._push(g,10,o.fromNumber(e)):this.uint32(e)},u.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},u.prototype.uint64=function(e){var t=o.from(e);return this._push(g,t.length(),t)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(g,t.length(),t)},u.prototype.bool=function(e){return this._push(h,1,e?1:0)},u.prototype.fixed32=function(e){return this._push(p,4,e>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(e){var t=o.from(e);return this._push(p,4,t.lo)._push(p,4,t.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(e){return this._push(s.float.writeFloatLE,4,e)},u.prototype.double=function(e){return this._push(s.float.writeDoubleLE,8,e)};var m=s.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n<e.length;++n)t[i+n]=e[n]};u.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(h,1,0);if(s.isString(e)){var i=u.alloc(t=r.length(e));r.decode(e,i,0),e=i}return this.uint32(t)._push(m,t,e)},u.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(h,1,0)},u.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new d(c,0,0),this.len=0,this},u.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 d(c,0,0),this.len=0),this},u.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this},u.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t},u._configure=function(e){n=e}},43155:function(e,t,i){"use strict";e.exports=r;var n=i(41173);(r.prototype=Object.create(n.prototype)).constructor=r;var s=i(99693),o=s.Buffer;function r(){n.call(this)}r.alloc=function(e){return(r.alloc=s._Buffer_allocUnsafe)(e)};var a=o&&o.prototype instanceof Uint8Array&&"set"===o.prototype.set.name?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n<e.length;)t[i++]=e[n++]};function d(e,t,i){e.length<40?s.utf8.write(e,t,i):t.utf8Write(e,i)}r.prototype.bytes=function(e){s.isString(e)&&(e=s._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(a,t,e),this},r.prototype.string=function(e){var t=o.byteLength(e);return this.uint32(t),t&&this._push(d,t,e),this}},42238:function(e,t,i){var n;!function(s,o){"use strict";var r="function",a="undefined",d="object",c="string",l="major",u="model",h="name",f="type",g="vendor",p="version",m="architecture",v="console",S="mobile",b="tablet",w="smarttv",y="wearable",C="embedded",T="Amazon",k="Apple",_="ASUS",I="BlackBerry",M="Firefox",x="Google",E="Honor",A="Huawei",P="LG",R="Microsoft",D="Motorola",O="Nvidia",V="OnePlus",B="Opera",L="OPPO",N="Samsung",F="Sharp",U="Sony",$="Xiaomi",W="Zebra",j="Facebook",H="Chromium OS",z="Mac OS",K=function(e){for(var t={},i=0;i<e.length;i++)t[e[i].toUpperCase()]=e[i];return t},G=function(e,t){return typeof e===c&&-1!==q(t).indexOf(q(e))},q=function(e){return e.toLowerCase()},J=function(e,t){if(typeof e===c)return e=e.replace(/^\s\s*/,""),typeof t===a?e:e.substring(0,500)},Q=function(e,t){for(var i,n,s,a,c,l,u=0;u<t.length&&!c;){var h=t[u],f=t[u+1];for(i=n=0;i<h.length&&!c&&h[i];)if(c=h[i++].exec(e))for(s=0;s<f.length;s++)l=c[++n],typeof(a=f[s])===d&&a.length>0?2===a.length?typeof a[1]==r?this[a[0]]=a[1].call(this,l):this[a[0]]=a[1]:3===a.length?typeof a[1]!==r||a[1].exec&&a[1].test?this[a[0]]=l?l.replace(a[1],a[2]):o:this[a[0]]=l?a[1].call(this,l,a[2]):o:4===a.length&&(this[a[0]]=l?a[3].call(this,l.replace(a[1],a[2])):o):this[a]=l||o;u+=2}},Z=function(e,t){for(var i in t)if(typeof t[i]===d&&t[i].length>0){for(var n=0;n<t[i].length;n++)if(G(t[i][n],e))return"?"===i?o:i}else if(G(t[i],e))return"?"===i?o:i;return t.hasOwnProperty("*")?t["*"]:e},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Y={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[h,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[h,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[h,p],[/opios[\/ ]+([\w\.]+)/i],[p,[h,"Opera Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[p,[h,"Opera GX"]],[/\bopr\/([\w\.]+)/i],[p,[h,B]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[p,[h,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[p,[h,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[h,p],[/quark(?:pc)?\/([-\w\.]+)/i],[p,[h,"Quark"]],[/\bddg\/([\w\.]+)/i],[p,[h,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[h,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[p,[h,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[h,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[h,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[p,[h,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[p,[h,"Smart Lenovo Browser"]],[/(avast|avg)\/([\w\.]+)/i],[[h,/(.+)/,"$1 Secure Browser"],p],[/\bfocus\/([\w\.]+)/i],[p,[h,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[p,[h,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[h,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[h,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[h,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[h,"MIUI Browser"]],[/fxios\/([\w\.-]+)/i],[p,[h,M]],[/\bqihoobrowser\/?([\w\.]*)/i],[p,[h,"360"]],[/\b(qq)\/([\w\.]+)/i],[[h,/(.+)/,"$1Browser"],p],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[h,/(.+)/,"$1 Browser"],p],[/samsungbrowser\/([\w\.]+)/i],[p,[h,"Samsung Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[p,[h,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[h,"Sogou Mobile"],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[h,p],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[h],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[p,h],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[h,j],p],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[h,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[h,"GSA"]],[/musical_ly(?:.
1+app_?version\/|_)([\w\.]+)/i],[p,[h,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[h,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[h,"Chrome WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[h,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[h,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[h,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,h],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[h,[p,Z,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[h,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[h,"Netscape"],p],[/(wolvic|librewolf)\/([\w\.]+)/i],[h,p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[h,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[h,[p,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[h,[p,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[m,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[m,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[m,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[m,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[m,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[m,/ower/,"",q]],[/ sun4\w[;\)]/i],[[m,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[m,q]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[g,N],[f,b]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[u,[g,N],[f,S]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[g,k],[f,S]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[g,k],[f,b]],[/(macintosh);/i],[u,[g,k]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[g,F],[f,S]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[u,[g,E],[f,b]],[/honor([-\w ]+)[;\)]/i],[u,[g,E],[f,S]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[u,[g,A],[f,b]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[g,A],[f,S]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[u,/_/g," "],[g,$],[f,b]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[u,/_/g," "],[g,$],[f,S]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[g,L],[f,S]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[u,[g,Z,{OnePlus:["304","403","203"],"*":L}],[f,b]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[g,"Vivo"],[f,S]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[u,[g,"Realme"],[f,S]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[g,D],[f,S]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[g,D],[f,b]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[g,P],[f,b]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[g,P],[f,S]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}
1(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[u,[g,"Lenovo"],[f,b]],[/(nokia) (t[12][01])/i],[g,u,[f,b]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[u,/_/g," "],[f,S],[g,"Nokia"]],[/(pixel (c|tablet))\b/i],[u,[g,x],[f,b]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[g,x],[f,S]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[g,U],[f,S]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[g,U],[f,b]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[g,V],[f,S]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[g,T],[f,b]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[g,T],[f,S]],[/(playbook);[-\w\),; ]+(rim)/i],[u,g,[f,b]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[g,I],[f,S]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[g,_],[f,b]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[g,_],[f,S]],[/(nexus 9)/i],[u,[g,"HTC"],[f,b]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[g,[u,/_/g," "],[f,S]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[u,[g,"TCL"],[f,b]],[/(itel) ((\w+))/i],[[g,q],u,[f,Z,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[g,"Acer"],[f,b]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[g,"Meizu"],[f,S]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[u,[g,"Ulefone"],[f,S]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[u,[g,"Energizer"],[f,S]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[u,[g,"Cat"],[f,S]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[u,[g,"Smartfren"],[f,S]],[/droid.+; (a(?:015|06[35]|142p?))/i],[u,[g,"Nothing"],[f,S]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[u,[g,"Archos"],[f,b]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[u,[g,"Archos"],[f,S]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[g,u,[f,b]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[g,u,[f,S]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[g,u,[f,b]],[/(surface duo)/i],[u,[g,R],[f,b]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[g,"Fairphone"],[f,S]],[/(u304aa)/i],[u,[g,"AT&T"],[f,S]],[/\bsie-(\w*)/i],[u,[g,"Siemens"],[f,S]],[/\b(rct\w+) b/i],[u,[g,"RCA"],[f,b]],[/\b(venue[\d ]{2,7}) b/i],[u,[g,"Dell"],[f,b]],[/\b(q(?:mv|ta)\w+) b/i],[u,[g,"Verizon"],[f,b]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[g,"Barnes & Noble"],[f,b]],[/\b(tm\d{3}\w+) b/i],[u,[g,"NuVision"],[f,b]],[/\b(k88) b/i],[u,[g,"ZTE"],[f,b]],[/\b(nx\d{3}j) b/i],[u,[g,"ZTE"],[f,S]],[/\b(gen\d{3}) b.+49h/i],[u,[g,"Swiss"],[f,S]],[/\b(zur\d{3}) b/i],[u,[g,"Swiss"],[f,b]],[/\b((zeki)?tb.*\b) b/i],[u,[g,"Zeki"],[f,b]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[g,"Dragon Touch"],u,[f,b]],[/\b(ns-?\w{0,9}) b/i],[u,[g,"Insignia"],[f,b]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[g,"NextBook"],[f,b]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[g,"Voice"],u,[f,S]],[/\b(lvtel\-)?(v1[12]) b/i],[[g,"LvTel"],u,[f,S]],[/\b(ph-1) /i],[u,[g,"Essential"],[f,S]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[g,"Envizen"],[f,b]],[/\b(trio[-\w\. ]+) b/i],[u,[g,"MachSpeed"],[f,b]],[/\btu_(1491) b/i],[u,[g,"Rotor"],[f,b]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[u,[g,O],[f,b]],[/(sprint) (\w+)/i],[g,u,[f,S]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[g,R],[f,S]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[g,W],[f,b]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[g,W],[f,S]],[/smart-tv.+(samsung)/i],[g,[f,w]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[g,N],[f,w]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[g,P],[f,w]],[/(apple) ?tv/i],[g,[u,"Apple TV"],[f,w]],[/crkey/i],[[u,"Chromecast"],[g,x],[f,w]],[/droid.+aft(\w+)( bui|\))/i],[u,[g,T],[f,w]],[/(shield \w+ tv)/i],[u,[g,O],[f,w]],[/\
vendor: 6,246 bytes, line 1
1(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[g,F],[f,w]],[/(bravia[\w ]+)( bui|\))/i],[u,[g,U],[f,w]],[/(mi(tv|box)-?\w+) bui/i],[u,[g,$],[f,w]],[/Hbbtv.*(technisat) (.*);/i],[g,u,[f,w]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[g,J],[u,J],[f,w]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[u,[f,w]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[f,w]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[g,u,[f,v]],[/droid.+; (shield)( bui|\))/i],[u,[g,O],[f,v]],[/(playstation \w+)/i],[u,[g,U],[f,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[g,R],[f,v]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[u,[g,N],[f,y]],[/((pebble))app/i,/(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[g,u,[f,y]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[u,[g,L],[f,y]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[g,k],[f,y]],[/(opwwe\d{3})/i],[u,[g,V],[f,y]],[/(moto 360)/i],[u,[g,D],[f,y]],[/(smartwatch 3)/i],[u,[g,U],[f,y]],[/(g watch r)/i],[u,[g,P],[f,y]],[/droid.+; (wt63?0{2,3})\)/i],[u,[g,W],[f,y]],[/droid.+; (glass) \d/i],[u,[g,x],[f,y]],[/(pico) (4|neo3(?: link|pro)?)/i],[g,u,[f,y]],[/; (quest( \d| pro)?)/i],[u,[g,j],[f,y]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[g,[f,C]],[/(aeobc)\b/i],[u,[g,T],[f,C]],[/(homepod).+mac os/i],[u,[g,k],[f,C]],[/windows iot/i],[[f,C]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[u,[f,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[f,b]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[f,b]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[f,S]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[u,[g,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[h,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[h,p],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[h,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[h,p],[/ladybird\//i],[[h,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,h]],os:[[/microsoft (windows) (vista|xp)/i],[h,p],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[h,[p,Z,X]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,Z,X],[h,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[h,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[h,z],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,h],[/(ubuntu) ([\w\.]+) like android/i],[[h,/(.+)/,"$1 Touch"],p],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[h,p],[/\(bb(10);/i],[p,[h,I]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[p,[h,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[h,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[h,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[h,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[h,"Chromecast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[h,H],p],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[h,p],[/(sunos) ?([\w\.\d]*)/i],[[h,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[h,p]]},ee=function(e,t){if(typeof e===d&&(t=e,e=o),!(this instanceof ee))return new ee(e,t).getResult();var i=typeof s!==a&&s.navigator?s.navigator:o,n=e||(i&&i.userAgent?i.userAgent:""),l=i&&i.userAgentData?i.userAgentData:o,u=t?function(e,t){var i={};for(var n in e)t[n]&&t[n].length%2===0?i[n]=t[n].concat(e[n]):i[n]=e[n];return i}(Y,t):Y,h=i&&i.userAgent==n;return this.getBrowser=function(){var e,t={};return t.name=o,t.version=o,Q.call(t,n,u.browser),t.major=typeof(e=t.version)===c?e.replace(/[^\d\.]/g,"").split(".")[0]:o,h&&i&&i.brave&&typeof i.brave.isBrave==r&&(t.name="Brave"),t},this.getCPU=function(){var e={};return e.architecture=o,Q.call(e,n,u.cpu),e},this.getDevice=function(){var e={};return e.vendor=o,e.model=o,e.type=o,Q.call(e,n,u.device),h&&!e.type&&l&&l.mobile&&(e.type=S),h&&"Macintosh"==e.model&&i&&typeof i.standalone!==a&&i.maxTouchPoints&&i.maxTouchPoints>2&&(e.model="iPad",e.type=b),e},this.getEngine=function(){var e={};return e.name=o,e.version=o,Q.call(e,n,u.engine),e},this.getOS=function(){var e={};return e.name=o,e.version=o,Q.call(e,n,u.os),h&&!e.name&&l&&l.platform&&"Unknown"!=l.platform&&(e.name=l.platform.replace(/chrome os/i,H).replace(/macos/i,z)),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===c&&e.length>500?J(e,500):e,this},this.setUA(n),this};ee.VERSION="1.0.41",ee.BROWSER=K([h,p,l]),ee.CPU=K([m]),ee.DEVICE=K([u,g,f,v,S,w,b,y,C]),ee.ENGINE=ee.OS=K([h,p]),typeof t!==a?(e.exports&&(t=e.exports=ee),t.UAParser=ee):i.amdO?(n=function(){return ee}.call(t,i,t,e))===o||(e.exports=n):typeof s!==a&&(s.UAParser=ee);var te=typeof s!==a&&(s.jQuery||s.Zepto);if(te&&!te.ua){var ie=new ee;te.ua=ie.getResult(),te.ua.get=function(){return ie.getUA()},te.ua.set=function(e){ie.setUA(e);var t=ie.getResult();for(var i in t)te.ua[i]=t[i]}}}("object"===typeof window?window:this)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.