From 8307b89ce2e0a9c9c79a7ba227ae6f32c2cffa03 Mon Sep 17 00:00:00 2001 From: wataru Date: Wed, 14 Sep 2022 04:59:53 +0900 Subject: [PATCH] update --- docs/assets/setting.json | 7 ++-- docs/index.js | 2 +- docs/recorderServer.py | 85 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 docs/recorderServer.py diff --git a/docs/assets/setting.json b/docs/assets/setting.json index 91c72411..3fcf3834 100644 --- a/docs/assets/setting.json +++ b/docs/assets/setting.json @@ -1,5 +1,7 @@ { "app_title": "voice-recorder", + "storage_type":"local", + "use_mel_spectrogram":false, "text": [ { "title": "ITA-emotion", @@ -19,8 +21,5 @@ "file": "./assets/text/wagahaiwa.txt", "file_hira": "./assets/text/wagahaiwa_hira.txt" } - ], - "uploader":{ - "uploader_url":"" - } + ] } diff --git a/docs/index.js b/docs/index.js index 77b22bbf..5ff43dfd 100644 --- a/docs/index.js +++ b/docs/index.js @@ -1,2 +1,2 @@ /*! For license information please see index.js.LICENSE.txt */ -(()=>{var __webpack_modules__={914:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawSha256=void 0;var n=i(6532),r=function(){function e(){this.state=Int32Array.from(n.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,i=e.byteLength;if(this.bytesHashed+=i,8*this.bytesHashed>n.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;i>0;)this.buffer[this.bufferLength++]=e[t++],i--,this.bufferLength===n.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),i=this.bufferLength;if(t.setUint8(this.bufferLength++,128),i%n.BLOCK_SIZE>=n.BLOCK_SIZE-8){for(var r=this.bufferLength;r>>24&255,a[4*r+1]=this.state[r]>>>16&255,a[4*r+2]=this.state[r]>>>8&255,a[4*r+3]=this.state[r]>>>0&255;return a},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,i=t[0],r=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=0;d>>17|f<<15)^(f>>>19|f<<13)^f>>>10,h=((f=this.temp[d-15])>>>7|f<<25)^(f>>>18|f<<14)^f>>>3;this.temp[d]=(C+this.temp[d-7]|0)+(h+this.temp[d-16]|0)}var p=(((s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7))+(s&c^~s&l)|0)+(u+(n.KEY[d]+this.temp[d]|0)|0)|0,m=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&r^i&a^r&a)|0;u=l,l=c,c=s,s=o+p|0,o=a,a=r,r=i,i=p+m|0}t[0]+=i,t[1]+=r,t[2]+=a,t[3]+=o,t[4]+=s,t[5]+=c,t[6]+=l,t[7]+=u},e}();t.RawSha256=r},6532:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},1938:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),(0,i(655).__exportStar)(i(5430),t)},5430:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var n=i(655),r=i(6532),a=i(914),o=i(7658),s=function(){function e(e){if(this.hash=new a.RawSha256,e){this.outer=new a.RawSha256;var t=function(e){var t=(0,o.convertToBuffer)(e);if(t.byteLength>r.BLOCK_SIZE){var i=new a.RawSha256;i.update(t),t=i.digest()}var n=new Uint8Array(r.BLOCK_SIZE);return n.set(t),n}(e),i=new Uint8Array(r.BLOCK_SIZE);i.set(t);for(var n=0;n{"use strict";var n=i(8764).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=i(470),a=void 0!==n&&n.from?function(e){return n.from(e,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"==typeof e?a(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}},7658:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var n=i(1106);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return n.convertToBuffer}});var r=i(4304);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return r.isEmptyData}});var a=i(2174);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return a.numToUint8}});var o=i(1558);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return o.uint32ArrayFrom}})},4304:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyData=void 0,t.isEmptyData=function(e){return"string"==typeof e?0===e.length:0===e.byteLength}},2174:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numToUint8=void 0,t.numToUint8=function(e){return new Uint8Array([(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e])}},1558:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=void 0,t.uint32ArrayFrom=function(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),i=0;i{"use strict";i.r(t),i.d(t,{fromHex:()=>s,toHex:()=>c});for(var n={},r={},a=0;a<256;a++){var o=a.toString(16).toLowerCase();1===o.length&&(o="0".concat(o)),n[a]=o,r[o]=a}function s(e){if(e.length%2!=0)throw new Error("Hex encoded strings must have an even number length");for(var t=new Uint8Array(e.length/2),i=0;i{"use strict";i.r(t),i.d(t,{fromUtf8:()=>n,toUtf8:()=>r});var n=function(e){return"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):function(e){for(var t=[],i=0,n=e.length;i>6|192,63&r|128);else if(i+1>18|240,a>>12&63|128,a>>6&63|128,63&a|128)}else t.push(r>>12|224,r>>6&63|128,63&r|128)}return Uint8Array.from(t)}(e)},r=function(e){return"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):function(e){for(var t="",i=0,n=e.length;i{"use strict";e.exports=function(e,t){for(var i=new Array(arguments.length-1),n=0,r=2,a=!0;r{"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),r=new Array(123),a=0;a<64;)r[n[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;i.encode=function(e,t,i){for(var r,a=null,o=[],s=0,c=0;t>2],r=(3&l)<<4,c=1;break;case 1:o[s++]=n[r|l>>4],r=(15&l)<<2,c=2;break;case 2:o[s++]=n[r|l>>6],o[s++]=n[63&l],c=0}s>8191&&((a||(a=[])).push(String.fromCharCode.apply(String,o)),s=0)}return c&&(o[s++]=n[r],o[s++]=61,1===c&&(o[s++]=61)),a?(s&&a.push(String.fromCharCode.apply(String,o.slice(0,s))),a.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var o="invalid encoding";i.decode=function(e,t,i){for(var n,a=i,s=0,c=0;c1)break;if(void 0===(l=r[l]))throw Error(o);switch(s){case 0:n=l,s=1;break;case 1:t[i++]=n<<2|(48&l)>>4,n=l,s=2;break;case 2:t[i++]=(15&n)<<4|(60&l)>>2,n=l,s=3;break;case 3:t[i++]=(3&n)<<6|l,s=0}}if(1===s)throw Error(o);return i-a},i.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},9211:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,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={};else if(void 0===t)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n{"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 r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3]}function a(e,n,r){t[0]=e,n[r]=i[3],n[r+1]=i[2],n[r+2]=i[1],n[r+3]=i[0]}function o(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 s(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?r:a,e.writeFloatBE=n?a:r,e.readFloatLE=n?o:s,e.readFloatBE=n?s:o}():function(){function t(e,t,i,n){var r=t<0?1:0;if(r&&(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((r<<31|2139095040)>>>0,i,n);else if(t<11754943508222875e-54)e((r<<31|Math.round(t/1401298464324817e-60))>>>0,i,n);else{var a=Math.floor(Math.log(t)/Math.LN2);e((r<<31|a+127<<23|8388607&Math.round(t*Math.pow(2,-a)*8388608))>>>0,i,n)}}function o(e,t,i){var n=e(t,i),r=2*(n>>31)+1,a=n>>>23&255,o=8388607&n;return 255===a?o?NaN:r*(1/0):0===a?1401298464324817e-60*r*o:r*Math.pow(2,a-150)*(o+8388608)}e.writeFloatLE=t.bind(null,i),e.writeFloatBE=t.bind(null,n),e.readFloatLE=o.bind(null,r),e.readFloatBE=o.bind(null,a)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),i=new Uint8Array(t.buffer),n=128===i[7];function r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3],n[r+4]=i[4],n[r+5]=i[5],n[r+6]=i[6],n[r+7]=i[7]}function a(e,n,r){t[0]=e,n[r]=i[7],n[r+1]=i[6],n[r+2]=i[5],n[r+3]=i[4],n[r+4]=i[3],n[r+5]=i[2],n[r+6]=i[1],n[r+7]=i[0]}function o(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[6]=e[n+6],i[7]=e[n+7],t[0]}function s(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?r:a,e.writeDoubleBE=n?a:r,e.readDoubleLE=n?o:s,e.readDoubleBE=n?s:o}():function(){function t(e,t,i,n,r,a){var o=n<0?1:0;if(o&&(n=-n),0===n)e(0,r,a+t),e(1/n>0?0:2147483648,r,a+i);else if(isNaN(n))e(0,r,a+t),e(2146959360,r,a+i);else if(n>17976931348623157e292)e(0,r,a+t),e((o<<31|2146435072)>>>0,r,a+i);else{var s;if(n<22250738585072014e-324)e((s=n/5e-324)>>>0,r,a+t),e((o<<31|s/4294967296)>>>0,r,a+i);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(s=n*Math.pow(2,-c))>>>0,r,a+t),e((o<<31|c+1023<<20|1048576*s&1048575)>>>0,r,a+i)}}}function o(e,t,i,n,r){var a=e(n,r+t),o=e(n,r+i),s=2*(o>>31)+1,c=o>>>20&2047,l=4294967296*(1048575&o)+a;return 2047===c?l?NaN:s*(1/0):0===c?5e-324*s*l:s*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,i,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=o.bind(null,r,0,4),e.readDoubleBE=o.bind(null,a,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 r(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function a(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},7199:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},6662:e=>{"use strict";e.exports=function(e,t,i){var n=i||8192,r=n>>>1,a=null,o=n;return function(i){if(i<1||i>r)return e(i);o+i>n&&(a=e(n),o=0);var s=t.call(a,o,o+=i);return 7&o&&(o=1+(7|o)),s}}},4997:(e,t)=>{"use strict";var i=t;i.length=function(e){for(var t=0,i=0,n=0;n191&&n<224?a[o++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,a[o++]=55296+(n>>10),a[o++]=56320+(1023&n)):a[o++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,a)),o=0);return r?(o&&r.push(String.fromCharCode.apply(String,a.slice(0,o))),r.join("")):String.fromCharCode.apply(String,a.slice(0,o))},i.write=function(e,t,i){for(var n,r,a=i,o=0;o>6|192,t[i++]=63&n|128):55296==(64512&n)&&56320==(64512&(r=e.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&r),++o,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-a}},8599:e=>{"use strict";const{AbortController:t,AbortSignal:i}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=i,e.exports.default=t},8320:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3922);t.default=class{constructor(e,t,i,n=1e3,r=200){this.realtimeController=e,this.selfAttendeeId=t,this.hasBandwidthPriorityCallback=i,this.waitIntervalMs=n,this.updateIntervalMs=r,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=[],r=Object.keys(this.speakerScores);for(let e=0;et.activeScore-e.activeScore)).filter((function(e){return e.activeScore>0})).map((function(e){return e.attendeeId}));this.activeSpeakers=a,t(a);const o=a.length>0&&a[0]===this.selfAttendeeId&&e.prioritizeVideoSendBandwidthForActiveSpeaker();this.hasBandwidthPriority!==o&&(this.hasBandwidthPriority=o,this.hasBandwidthPriorityCallback(o))}updateScore(e,t,i,n,r){const a=e.calculateScore(i,n,r);this.speakerScores[i]!==a&&(this.speakerScores[i]=a,this.mostRecentUpdateTimestamp[i]=Date.now(),this.updateActiveSpeakers(e,t,i))}subscribe(e,t,i,n){const a=(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,r,a)=>{this.mostRecentUpdateTimestamp[i]=Date.now(),null!==r&&(this.speakerMuteState[i]=r),this.updateScore(e,t,i,n,r)}))};this.detectorCallbackToHandler.set(t,a);const o=new r.default(this.updateIntervalMs);if(o.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,o),i&&n){const e=new r.default(n);e.start((()=>{i(this.speakerScores)})),this.detectorCallbackToScoresTimer.set(t,e)}this.realtimeController.realtimeSubscribeToAttendeeIdPresence(a)}unsubscribe(e){const t=this.detectorCallbackToHandler.get(e);this.detectorCallbackToHandler.delete(e),t&&this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(t);const 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()}))}}},2363:(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 i in this.volumes)i!==e&&(this.volumes[i]=Math.max(this.volumes[i]-this.takeoverRate*t,0));return n{"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},7602:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},6802:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(543),a=i(7797);t.default=class{constructor(e){this.logger=e,this.audioDevice=null,this.audioElement=null,this.audioStream=null,this.browserBehavior=new r.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(e){this.logger&&this.logger.warn(`Failed to bind audio stream: ${e}`)}}}))}bindAudioDevice(e){return n(this,void 0,void 0,(function*(){if(e&&!this.browserBehavior.supportsSetSinkId())throw new Error("Cannot select audio output device. This browser does not support setSinkId.");return this.audioDevice=e,this.bindAudioMix()}))}forEachObserver(e){for(const t of this.observers)a.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&&void 0===this.audioElement.sinkId)throw new Error("Cannot select audio output device. This browser does not support setSinkId.");const r=this.audioDevice?this.audioDevice.deviceId:"";if(r===this.audioElement.sinkId)return;const a=this.audioElement,o=this.audioStream;if(this.browserBehavior.hasChromiumWebRTC()&&(a.srcObject=null),n)try{yield a.setSinkId(r)}catch(e){throw null===(t=this.logger)||void 0===t||t.error(`Failed to set sinkId for audio element: ${e}`),e}this.browserBehavior.hasChromiumWebRTC()&&(a.srcObject=o)}))}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)}))}audioOutputDidChange(e){return n(this,void 0,void 0,(function*(){return this.logger.info("Receive an audio output change event"),this.bindAudioDevice(e)}))}}},3765:(e,t)=>{"use strict";Object.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},1876:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.logger=null,this.browserBehavior=null,this.signalingClient=null,this.meetingSessionConfiguration=null,this.peer=null,this.previousSdpOffer=null,this.sdpOfferInit=null,this.audioVideoController=null,this.realtimeController=null,this.videoTileController=null,this.mediaStreamBroker=null,this.audioMixController=null,this.activeAudioInput=void 0,this.activeVideoInput=void 0,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.videoCaptureAndEncodeParameter=null,this.videosToReceive=null,this.lastVideosToReceive=null,this.videoSubscriptions=null,this.videoSubscriptionLimit=25,this.previousSdpAnswerAsString="",this.serverSupportsCompression=!1,this.videoSendCodecPreferences=[],this.meetingSupportedVideoSendCodecPreferences=void 0,this.videosPaused=null,this.videoDuplexMode=null,this.volumeIndicatorAdapter=null,this.statsCollector=null,this.connectionMonitor=null,this.videoInputAttachedTimestampMs=0,this.audioDeviceInformation={},this.videoDeviceInformation={},this.enableSimulcast=!1,this.eventController=null,this.signalingOpenDurationMs=null,this.iceGatheringDurationMs=null,this.startAudioVideoTimestamp=null,this.attendeePresenceDurationMs=null,this.meetingStartDurationMs=null,this.poorConnectionCount=0,this.maxVideoTileCount=0,this.startTimeMs=null}}},9059:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(8320),a=i(6802),o=i(3765),s=i(543),c=i(4531),l=i(8581),u=i(3789),d=i(5687),f=i(5723),C=i(214),h=i(7500),p=i(983),m=i(7797),v=i(9678),g=i(3860),b=i(9553),M=i(3013),y=i(1208),S=i(9416),L=i(9101),z=i(289),w=i(8597),V=i(8358),H=i(3216),k=i(7408),x=i(5482),_=i(1129),A=i(6240),T=i(1960),E=i(6180),I=i(2748),N=i(1981),P=i(4543),O=i(8556),R=i(9945),D=i(1209),B=i(5547),F=i(120),j=i(9560),U=i(9485),W=i(7079),$=i(4833),q=i(5275),G=i(5924),K=i(250),J=i(6171),Q=i(365),Z=i(7377),Y=i(5785),X=i(9354),ee=i(8660),te=i(1133),ie=i(5185),ne=i(2880),re=i(1508),ae=i(1318),oe=i(4242),se=i(2958),ce=i(4922),le=i(4450),ue=i(4442),de=i(9751),fe=i(1876);class Ce{constructor(e,t,i,n,r,s){this._audioProfile=new o.default,this.connectionHealthData=new c.default,this.observerQueue=new Set,this.meetingSessionContext=new fe.default,this.enableSimulcast=!1,this.useUpdateTransceiverControllerForUplink=!1,this.totalRetryCount=0,this.startAudioVideoTimestamp=0,this.mayNeedRenegotiationForSimulcastLayerChange=!1,this.promotedToPrimaryMeeting=!1,this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!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._webSocketAdapter=i,this._realtimeController=new p.default(n),this._realtimeController.realtimeSetLocalAttendeeId(e.credentials.attendeeId,e.credentials.externalUserId),this._mediaStreamBroker=n,this._reconnectController=r,this._videoTileController=new se.default(new ce.default,this,this._logger),this._audioMixController=new a.default(this._logger),this._mediaStreamBroker.addMediaStreamBrokerObserver(this._audioMixController),this.meetingSessionContext.logger=this._logger,this._eventController=s}destroy(){return n(this,void 0,void 0,(function*(){this.observerQueue.clear(),this._mediaStreamBroker.removeMediaStreamBrokerObserver(this._audioMixController),this.destroyed=!0}))}get configuration(){return this._configuration}get realtimeController(){return this._realtimeController}get activeSpeakerDetector(){return this._activeSpeakerDetector||(this._activeSpeakerDetector=new r.default(this._realtimeController,this._configuration.credentials.attendeeId,this.handleHasBandwidthPriority.bind(this))),this._activeSpeakerDetector}get videoTileController(){return this._videoTileController}get audioMixController(){return this._audioMixController}get logger(){return this._logger}get rtcPeerConnection(){return this.meetingSessionContext&&this.meetingSessionContext.peer||null}get mediaStreamBroker(){return this._mediaStreamBroker}get eventController(){return this._eventController}getRTCPeerConnectionStats(e){return this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent||(this.logger.warn("The `getRTCPeerConnectionStats()` is on its way to be deprecated. It makes an additional call to the `getStats` API and therefore may cause slight performance degradation. Please use the new API `clientMetricReport.getRTCStatsReport()` returned by `metricsDidReceive(clientMetricReport)` callback instead."),this.hasGetRTCPeerConnectionStatsDeprecationMessageBeenSent=!0),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 fe.default,this.meetingSessionContext.logger=this.logger,this.meetingSessionContext.eventController=this.eventController,this.meetingSessionContext.browserBehavior=new s.default,this.meetingSessionContext.videoSendCodecPreferences=this.videoSendCodecPreferences,this.meetingSessionContext.meetingSessionConfiguration=this.configuration,this.meetingSessionContext.signalingClient=new y.default(this._webSocketAdapter,this.logger))}uninstallPreStartObserver(){var e;null===(e=this.meetingSessionContext.signalingClient)||void 0===e||e.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===S.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.signalingOnly)?this.prestart():(this.activeSpeakerDetector,new Promise(((e,t)=>{this.sessionStateController.perform(g.default.Connect,(()=>{this.actionConnect(!1).then(e).catch(t)}))})))}connectWithPromises(e){const t=this.meetingSessionContext;this.monitorTask=new N.default(t,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData);const i=this.monitorTask.once(),n=new D.default(t).once();this.receiveIndexTask=new j.default(t),this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();const r=new W.default(this.logger,"Signaling",[this.createOrReuseSignalingTask(),new I.default(t),new U.default(t),new T.default(t),new B.default(t),this.receiveIndexTask]).once(),a=new x.default(t).once(r),o=new V.default(t).once(a,n),s=new _.default(t).once(o),c=new $.default(t).once(s),l=new A.default(t).once(c),u=new G.default(t).once(l);return new W.default(this.logger,this.wrapTaskName("AudioVideoStart"),[i,((e,t)=>new K.default(this.logger,t,e))(this.configuration.connectionTimeoutMs,new W.default(this.logger,"Peer",[u,e?new K.default(this.logger,new O.default(this.logger,"FinalizeConnection",[new J.default(t),new q.default(t)]),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs):new q.default(t)]))])}connectWithTasks(e){return this.receiveIndexTask=new j.default(this.meetingSessionContext),this.monitorTask=new N.default(this.meetingSessionContext,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData),this.receiveIndexTask.pauseIngestion(),this.monitorTask.pauseResubscribeCheck(),new W.default(this.logger,this.wrapTaskName("AudioVideoStart"),[this.monitorTask,new D.default(this.meetingSessionContext),new K.default(this.logger,new W.default(this.logger,"Media",[new W.default(this.logger,"Signaling",[new P.default(this.meetingSessionContext),new I.default(this.meetingSessionContext),new U.default(this.meetingSessionContext),new T.default(this.meetingSessionContext),new B.default(this.meetingSessionContext),this.receiveIndexTask]),new W.default(this.logger,"Peer",[new x.default(this.meetingSessionContext),new V.default(this.meetingSessionContext),new _.default(this.meetingSessionContext),new $.default(this.meetingSessionContext),new A.default(this.meetingSessionContext),new G.default(this.meetingSessionContext),e?new K.default(this.logger,new O.default(this.logger,"FinalizeConnection",[new J.default(this.meetingSessionContext),new q.default(this.meetingSessionContext)]),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs):new q.default(this.meetingSessionContext)])]),this.configuration.connectionTimeoutMs)])}actionConnect(e){var t;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,this.enableSimulcast=this.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers&&(new s.default).hasChromiumWebRTC();const i=!!this.configuration.urls.audioHostURL;if(i?this.enableSimulcast?(this.logger.info("Using transceiver controller with simulcast support"),new C.default(this.configuration.credentials.attendeeId).hasModality(C.default.MODALITY_CONTENT)?this.meetingSessionContext.transceiverController=new Z.default(this.logger,this.meetingSessionContext.browserBehavior):this.meetingSessionContext.transceiverController=new Y.default(this.logger,this.meetingSessionContext.browserBehavior)):(this.logger.info("Using default transceiver controller"),this.meetingSessionContext.transceiverController=new Q.default(this.logger,this.meetingSessionContext.browserBehavior)):(this.logger.info("Using video only transceiver controller"),this.meetingSessionContext.transceiverController=new X.default(this.logger,this.meetingSessionContext.browserBehavior)),this.meetingSessionContext.volumeIndicatorAdapter=new de.default(this.logger,this._realtimeController,Ce.MIN_VOLUME_DECIBELS,Ce.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 le.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 oe.default(this.logger)}else this.meetingSessionContext.enableSimulcast=!1,this.meetingSessionContext.videoStreamIndex=new ae.default(this.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy||(this.meetingSessionContext.videoUplinkBandwidthPolicy=new ue.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.useUpdateTransceiverControllerForUplink=!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 re.default,this.meetingSessionContext.videosPaused=new re.default,this.meetingSessionContext.statsCollector=new w.default(this,this.logger),this.meetingSessionContext.connectionMonitor=new l.default(this,this._realtimeController,this.connectionHealthData,new h.default(this.meetingSessionContext.signalingClient,Ce.PING_PONG_INTERVAL_MS,this.logger),this.meetingSessionContext.statsCollector),this.meetingSessionContext.reconnectController=this._reconnectController,this.meetingSessionContext.videoDeviceInformation={},e||(this.totalRetryCount=0,this._reconnectController.reset(),this.startAudioVideoTimestamp=Date.now(),this.forEachObserver((e=>{ee.Maybe.of(e.audioVideoDidStartConnecting).map((t=>t.bind(e)(!1)))})),null===(t=this.eventController)||void 0===t||t.publishEvent("meetingStartRequested")),this.meetingSessionContext.startAudioVideoTimestamp=this.startAudioVideoTimestamp,this._reconnectController.hasStartedConnectionAttempt()?this._reconnectController.startedConnectionAttempt(!1):this._reconnectController.startedConnectionAttempt(!0);const r=i&&this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs>0;let a;this.logger.info("Needs to wait for attendee presence? "+r),a=this.usePromises?this.connectWithPromises(r):this.connectWithTasks(r);try{yield a.run(),this.connectionHealthData.setConnectionStartTime(),this._mediaStreamBroker.addMediaStreamBrokerObserver(this),this.sessionStateController.perform(g.default.FinishConnecting,(()=>{this.eventController&&(this.meetingSessionContext.meetingStartDurationMs=Date.now()-this.startAudioVideoTimestamp,this.eventController.publishEvent("meetingStartSucceeded",{maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,poorConnectionCount:this.meetingSessionContext.poorConnectionCount,retryCount:this.totalRetryCount,signalingOpenDurationMs:this.meetingSessionContext.signalingOpenDurationMs,iceGatheringDurationMs:this.meetingSessionContext.iceGatheringDurationMs,meetingStartDurationMs:this.meetingSessionContext.meetingStartDurationMs})),this.meetingSessionContext.startTimeMs=Date.now(),this.actionFinishConnecting()}))}catch(e){this.signalingTask=void 0;const t=new u.default(this.getMeetingStatusCode(e)||d.default.TaskFailed);if(this.logger.info(`Start failed: ${t} due to error ${e}.`),this.sessionStateController.state()===b.default.NotConnected)return void this.logger.info("Start failed and not connected. Not cleaning up.");this.sessionStateController.perform(g.default.Fail,(()=>n(this,void 0,void 0,(function*(){yield this.actionDisconnect(t,!0,e),this.handleMeetingSessionStatus(t,e)||this.notifyStop(t,e)}))))}}))}createOrReuseSignalingTask(){return this.signalingTask||(this.initSignalingClient(),this.signalingTask=new K.default(this.logger,new P.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs).once()),this.signalingTask}actionFinishConnecting(){this.signalingTask=void 0,this.meetingSessionContext.videoDuplexMode=z.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(),this.meetingSessionContext.signalingClient=null,this.cleanUpMediaStreamsAfterStop(),Promise.resolve()):new Promise(((e,t)=>{this.sessionStateController.perform(g.default.Disconnect,(()=>{this._reconnectController.disableReconnect(),this.logger.info("attendee left meeting, session will not be reconnected"),this.actionDisconnect(new u.default(d.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 W.default(this.logger,this.wrapTaskName("AudioVideoStop"),[new K.default(this.logger,new E.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)]).run()}catch(e){this.logger.info("fail to stop")}try{const e=[new K.default(this.logger,new k.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)];this.cleanUpMediaStreamsAfterStop(),yield new W.default(this.logger,this.wrapTaskName("AudioVideoClean"),e).run()}catch(e){this.logger.info("fail to clean")}this.sessionStateController.perform(g.default.FinishDisconnecting,(()=>{t||(this.meetingSessionContext.signalingClient=null,this.notifyStop(e,i))}))}))}update(e={needsRenegotiation:!0}){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(g.default.Update,(()=>{this.actionUpdateWithRenegotiation(!0)}));return i===M.default.Transitioned||i===M.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 r=new Map;let a=[];if(null===i.lastVideosToReceive)n=i.videosToReceive.array();else{const e=i.videoStreamIndex;i.videosToReceive.forEach((t=>{if(i.lastVideosToReceive.contain(t))return;let a=!1;i.lastVideosToReceive.forEach((i=>{a||e.StreamIdsInSameGroup(i,t)&&(r.set(i,t),a=!0)})),a||n.push(t)})),a=i.lastVideosToReceive.array().filter((e=>{const t=i.videosToReceive.contain(e),n=r.has(e);return!t&&!n}))}this.logger.info(`Request to update remote videos with added: ${n}, updated: ${[...r.entries()]}, removed: ${a}`);const o=[];for(const[e,t]of r.entries()){const n=new L.default;if(n.streamId=t,n.attendeeId=i.videoStreamIndex.attendeeIdForStreamId(t),n.mid=i.transceiverController.getMidForStreamId(e),void 0===n.mid)return this.logger.info(`No MID found for stream ID ${e}, cannot update stream without renegotiation`),!1;if(o.push(n),i.transceiverController.setStreamIdForMid(n.mid,t),i.videoStreamIndex.overrideStreamIdMappings(e,t),i.videoTileController.haveVideoTileForAttendeeId(n.attendeeId)){const e=i.videoTileController.getVideoTileForAttendeeId(n.attendeeId);if(!e.setStreamId)return!1;e.setStreamId(t)}}return 0!==o.length&&i.signalingClient.remoteVideoUpdate(o,[]),0===n.length&&0===a.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(g.default.Update,(()=>{t()}));return i===M.default.Transitioned||i===M.default.DeferredTransition}replaceLocalVideo(e){return n(this,void 0,void 0,(function*(){if(!e||e.getVideoTracks().length<1)throw new Error("could not acquire video track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw new Error("no active meeting and peer connection");const t=this.meetingSessionContext.videoTileController.getLocalVideoTile();if(t){const i=t.state(),n=e.getVideoTracks()[0].getSettings();t.bindVideoStream(i.boundAttendeeId,!0,e,n.width,n.height,i.streamId,i.boundExternalUserId)}yield this.meetingSessionContext.transceiverController.setVideoInput(e.getVideoTracks()[0]),this.meetingSessionContext.activeVideoInput=e,this.logger.info("Local video input is updated")}))}replaceLocalAudio(e){return n(this,void 0,void 0,(function*(){if(!e||e.getAudioTracks().length<1)throw new Error("could not acquire audio track");if(!this.meetingSessionContext||!this.meetingSessionContext.peer)throw new Error("no active meeting and peer connection");if(this.connectionHealthData.reset(),this.connectionHealthData.setConnectionStartTime(),!(yield this.meetingSessionContext.transceiverController.replaceAudioTrack(e.getAudioTracks()[0])))throw new Error("Failed to replace audio track");this.meetingSessionContext.activeAudioInput=e,this.logger.info("Local audio input is updated")}))}actionUpdateWithRenegotiation(e){return n(this,void 0,void 0,(function*(){this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();try{yield new W.default(this.logger,this.wrapTaskName("AudioVideoUpdate"),[new F.default(this.meetingSessionContext),new K.default(this.logger,new W.default(this.logger,"UpdateSession",[new V.default(this.meetingSessionContext),new _.default(this.meetingSessionContext),new $.default(this.meetingSessionContext),new A.default(this.meetingSessionContext),new G.default(this.meetingSessionContext),new q.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),e&&this.sessionStateController.perform(g.default.FinishUpdating,(()=>{this.actionFinishUpdating()}))}catch(e){this.sessionStateController.perform(g.default.FinishUpdating,(()=>{const t=new u.default(this.getMeetingStatusCode(e)||d.default.TaskFailed);t.statusCode()!==d.default.IncompatibleSDP&&this.logger.info("failed to update audio-video session"),this.handleMeetingSessionStatus(t,e)}))}}))}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(d.default.SignalingInternalServerError))))})),this.eventController){const{signalingOpenDurationMs:n,poorConnectionCount:r,startTimeMs:a,iceGatheringDurationMs:o,attendeePresenceDurationMs:s,meetingStartDurationMs:c}=this.meetingSessionContext,l={maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,meetingDurationMs:null===a?0:Math.round(Date.now()-a),meetingStatus:d.default[e.statusCode()],signalingOpenDurationMs:n,iceGatheringDurationMs:o,attendeePresenceDurationMs:s,poorConnectionCount:r,meetingStartDurationMs:c,retryCount:this.totalRetryCount},u=t&&t.message||(null===(i=e.toString)||void 0===i?void 0:i.call(e))||"";0===l.meetingDurationMs?(l.meetingErrorMessage=u,delete l.meetingDurationMs,delete l.attendeePresenceDurationMs,delete l.meetingStartDurationMs,this.eventController.publishEvent("meetingStartFailed",l)):e.isFailure()||e.isAudioConnectionFailure()?(l.meetingErrorMessage=u,this.eventController.publishEvent("meetingFailed",l)):this.eventController.publishEvent("meetingEnded",l)}}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(g.default.Connect,(()=>{this.actionConnect(!0)})):this.sessionStateController.perform(g.default.Reconnect,(()=>{this.actionReconnect(e)})),this.totalRetryCount+=1}))),(()=>{this.logger.info("canceled retry")}));return i||this.sessionStateController.perform(g.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 W.default(this.logger,this.wrapTaskName("AudioVideoReconnect"),[new K.default(this.logger,new W.default(this.logger,"Media",[new H.default(this.meetingSessionContext),new W.default(this.logger,"Signaling",[new P.default(this.meetingSessionContext),new T.default(this.meetingSessionContext),new B.default(this.meetingSessionContext)]),new x.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs),new F.default(this.meetingSessionContext),new K.default(this.logger,new W.default(this.logger,"UpdateSession",[new V.default(this.meetingSessionContext),new _.default(this.meetingSessionContext),new $.default(this.meetingSessionContext),new A.default(this.meetingSessionContext),new G.default(this.meetingSessionContext),new q.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),this.sessionStateController.perform(g.default.FinishConnecting,(()=>{if(this.eventController){const{signalingOpenDurationMs:t,poorConnectionCount:i,startTimeMs:n,iceGatheringDurationMs:r,attendeePresenceDurationMs:a,meetingStartDurationMs:o}=this.meetingSessionContext,s={maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,meetingDurationMs:Math.round(Date.now()-n),meetingStatus:d.default[e.statusCode()],signalingOpenDurationMs:t,iceGatheringDurationMs:r,attendeePresenceDurationMs:a,poorConnectionCount:i,meetingStartDurationMs:o,retryCount:this.totalRetryCount};this.eventController.publishEvent("meetingReconnected",s)}this.actionFinishConnecting()}))}catch(e){this.sessionStateController.perform(g.default.FinishConnecting,(()=>{this.logger.info("failed to reconnect audio-video session");const t=new u.default(this.getMeetingStatusCode(e)||d.default.TaskFailed);this.handleMeetingSessionStatus(t,e)}))}this.connectionHealthData.setConnectionStartTime()}))}wrapTaskName(e){return`${e}/${this.configuration.meetingId}/${this.configuration.credentials.attendeeId}`}cleanUpMediaStreamsAfterStop(){this._mediaStreamBroker.removeMediaStreamBrokerObserver(this),this.meetingSessionContext.activeAudioInput=void 0,this.meetingSessionContext.activeVideoInput=void 0}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*(){yield this.meetingSessionContext.transceiverController.setVideoSendingBitrateKbps(e)}))}handleMeetingSessionStatus(e,t){if(this.logger.info(`handling status: ${d.default[e.statusCode()]}`),e.isTerminal()||this.meetingSessionContext.statsCollector&&this.meetingSessionContext.statsCollector.logMeetingSessionStatus(e),e.statusCode()===d.default.IncompatibleSDP)return this.restartLocalVideo((()=>{this.logger.info("handled incompatible SDP by attempting to restart video")})),!0;if(e.statusCode()===d.default.VideoCallSwitchToViewOnly)return this._videoTileController.removeLocalVideoTile(),this.forEachObserver((e=>{ee.Maybe.of(e.videoSendDidBecomeUnavailable).map((t=>t.bind(e)()))})),!1;if(e.statusCode()===d.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 ${d.default[e.statusCode()]}${t?` and error: ${t.message}`:""}`):this.logger.error(`failed with status code ${d.default[e.statusCode()]}${t?` and error: ${t.message}`:""}`),i}return!1}setVideoMaxBandwidthKbps(e){if(e<=0)throw new Error("Max bandwidth kbps has to be greater than 0");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])}setVideoCodecSendPreferences(e){this.videoSendCodecPreferences=e,this.meetingSessionContext.videoSendCodecPreferences=e,this.update({needsRenegotiation:!0})}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(d.default.SignalingRequestFailed);return yield new W.default(this.logger,this.wrapTaskName("PromoteToPrimaryMeeting"),[new K.default(this.logger,new R.default(this.meetingSessionContext,e,(e=>{t=e})),this.configuration.connectionTimeoutMs)]).run(),this.promotedToPrimaryMeeting=t.statusCode()===d.default.OK,t}))}demoteFromPrimaryMeeting(){this.meetingSessionContext.signalingClient.demoteFromPrimaryMeeting(),this.forEachObserver((e=>{ee.Maybe.of(e.audioVideoWasDemotedFromPrimaryMeeting).map((t=>t.bind(e)(new u.default(d.default.OK))))}))}videoInputDidChange(e){return n(this,void 0,void 0,(function*(){this.logger.info("Receive a video input change event"),this.meetingSessionContext&&this.meetingSessionContext.peer?this._videoTileController.hasStartedLocalVideoTile()&&(e?yield this.replaceLocalVideo(e):this._videoTileController.stopLocalVideoTile()):this.logger.info("Skip updating video input because there is no active meeting and peer connection")}))}audioInputDidChange(e){return n(this,void 0,void 0,(function*(){if(this.logger.info("Receive an audio input change event"),this.meetingSessionContext&&this.meetingSessionContext.peer){if(!e)try{e=yield this.mediaStreamBroker.acquireAudioInputStream()}catch(e){return void this.logger.error("Could not acquire audio track from mediaStreamBroker")}yield this.replaceLocalAudio(e)}else this.logger.info("Skip updating audio input because there is no active meeting and peer connection")}))}}t.default=Ce,Ce.MIN_VOLUME_DECIBELS=-42,Ce.MAX_VOLUME_DECIBELS=-14,Ce.PING_PONG_INTERVAL_MS=1e4},9836:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(8434),r=i(3831),a=i(209),o=i(4015),s=i(589),c=i(8015),l=i(3789),u=i(5687),d=i(6057),f=i(9141),C=i(7631),h=i(9059);class p extends h.default{constructor(e){const t=new s.default;t.meetingId="",t.externalMeetingId="",t.credentials=new c.default,t.credentials.attendeeId="",t.credentials.joinToken="",t.urls=new d.default,t.urls.turnControlURL="",t.urls.audioHostURL="",t.urls.signalingURL="wss://localhost/";const i=new a.default;super(e||t,i,new C.default(new a.default),new o.default,new f.default(0,new n.default(0,0,0)),new r.default(e||t,i))}setAudioProfile(e){}start(){}stop(){}promoteToPrimaryMeeting(e){return Promise.resolve(new l.default(u.default.OK))}demoteFromPrimaryMeeting(){}}t.default=p},8538:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(7170);t.default=class{constructor(e,t,i,n,r,a){this.audioVideoController=e,this.videoTileController=t,this.realtimeController=i,this.audioMixController=n,this.deviceController=r,this.contentShareController=a}addObserver(e){this.audioVideoController.addObserver(e),this.trace("addObserver")}removeObserver(e){this.audioVideoController.removeObserver(e),this.trace("removeObserver")}setAudioProfile(e){this.trace("setAudioProfile",e),this.audioVideoController.setAudioProfile(e)}start(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,t=!0){this.videoTileController.unbindVideoElement(e,t),this.trace("unbindVideoElement",{tileId:e,cleanUpVideoElement:t})}startLocalVideoTile(){const e=this.videoTileController.startLocalVideoTile();return this.trace("startLocalVideoTile",null,e),e}stopLocalVideoTile(){this.videoTileController.stopLocalVideoTile(),this.trace("stopLocalVideoTile")}hasStartedLocalVideoTile(){const e=this.videoTileController.hasStartedLocalVideoTile();return this.trace("hasStartedLocalVideoTile",null,e),e}removeLocalVideoTile(){this.videoTileController.removeLocalVideoTile(),this.trace("removeLocalVideoTile")}getLocalVideoTile(){const e=this.videoTileController.getLocalVideoTile();return this.trace("getLocalVideoTile"),e}pauseVideoTile(e){this.videoTileController.pauseVideoTile(e),this.trace("pauseVideoTile",e)}unpauseVideoTile(e){this.videoTileController.unpauseVideoTile(e),this.trace("unpauseVideoTile",e)}getVideoTile(e){const t=this.videoTileController.getVideoTile(e);return this.trace("getVideoTile",e),t}getAllRemoteVideoTiles(){const e=this.videoTileController.getAllRemoteVideoTiles();return this.trace("getAllRemoteVideoTiles"),e}getAllVideoTiles(){const e=this.videoTileController.getAllVideoTiles();return this.trace("getAllVideoTiles"),e}addVideoTile(){const e=this.videoTileController.addVideoTile();return this.trace("addVideoTile",null,e.state()),e}removeVideoTile(e){this.videoTileController.removeVideoTile(e),this.trace("removeVideoTile",e)}removeVideoTilesByAttendeeId(e){const t=this.videoTileController.removeVideoTilesByAttendeeId(e);return this.trace("removeVideoTilesByAttendeeId",e,t),t}removeAllVideoTiles(){this.videoTileController.removeAllVideoTiles(),this.trace("removeAllVideoTiles")}captureVideoTile(e){const t=this.videoTileController.captureVideoTile(e);return this.trace("captureVideoTile",e),t}realtimeSubscribeToAttendeeIdPresence(e){this.realtimeController.realtimeSubscribeToAttendeeIdPresence(e),this.trace("realtimeSubscribeToAttendeeIdPresence")}realtimeUnsubscribeToAttendeeIdPresence(e){this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(e),this.trace("realtimeUnsubscribeToAttendeeIdPresence")}realtimeSetCanUnmuteLocalAudio(e){this.realtimeController.realtimeSetCanUnmuteLocalAudio(e),this.trace("realtimeSetCanUnmuteLocalAudio",e)}realtimeSubscribeToSetCanUnmuteLocalAudio(e){this.realtimeController.realtimeSubscribeToSetCanUnmuteLocalAudio(e),this.trace("realtimeSubscribeToSetCanUnmuteLocalAudio")}realtimeUnsubscribeToSetCanUnmuteLocalAudio(e){this.realtimeController.realtimeUnsubscribeToSetCanUnmuteLocalAudio(e),this.trace("realtimeUnsubscribeToSetCanUnmuteLocalAudio")}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),this.trace("realtimeUnsubscribeToMuteAndUnmuteLocalAudio")}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),this.trace("realtimeSubscribeToFatalError")}realtimeUnsubscribeToFatalError(e){this.realtimeController.realtimeUnsubscribeToFatalError(e),this.trace("realtimeUnsubscribeToFatalError")}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}))}startAudioInput(e){return n(this,void 0,void 0,(function*(){return this.trace("startAudioInput",e),this.deviceController.startAudioInput(e)}))}stopAudioInput(){return n(this,void 0,void 0,(function*(){return this.trace("stopAudioInput"),this.deviceController.stopAudioInput()}))}startVideoInput(e){return n(this,void 0,void 0,(function*(){return r.isVideoTransformDevice(e)?this.trace("startVideoInput with transform device"):this.trace("startVideoInput",e),this.deviceController.startVideoInput(e)}))}stopVideoInput(){return n(this,void 0,void 0,(function*(){return this.trace("stopVideoInput"),this.deviceController.stopVideoInput()}))}chooseAudioOutput(e){const t=this.deviceController.chooseAudioOutput(e);return this.trace("chooseAudioOutput",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){this.deviceController.chooseVideoInputQuality(e,t,i),this.trace("chooseVideoInputQuality",{width:e,height:t,frameRate:i})}setVideoMaxBandwidthKbps(e){this.audioVideoController.setVideoMaxBandwidthKbps(e),this.trace("setVideoMaxBandwidthKbps",e)}setVideoCodecSendPreferences(e){this.audioVideoController.setVideoCodecSendPreferences(e),this.trace("setVideoCodecSendPreferences",e)}getVideoInputQualitySettings(){const e=this.deviceController.getVideoInputQualitySettings();return this.trace("getVideoInputQualitySettings"),e}setContentAudioProfile(e){this.trace("setContentAudioProfile",e),this.contentShareController.setContentAudioProfile(e)}enableSimulcastForContentShare(e,t){this.trace("enableSimulcastForContentShare"),this.contentShareController.enableSimulcastForContentShare(e,t)}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")}removeContentShareObserver(e){this.contentShareController.removeContentShareObserver(e),this.trace("removeContentShareObserver")}setContentShareVideoCodecPreferences(e){this.contentShareController.setContentShareVideoCodecPreferences(e),this.trace("setContentShareVideoCodecPreferences")}trace(e,t,i){let n=`API/DefaultAudioVideoFacade/${this.audioVideoController.configuration.meetingId}/${this.audioVideoController.configuration.credentials.attendeeId}/${e}`;void 0!==t&&(n+=` ${JSON.stringify(t)}`),void 0!==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)}}},179:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(8074),a=i(9734);class o extends r.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("BackgroundBlur processor using builtin blur")}drawImageWithMask(e,t){const i=this.blurredImage,{canvasCtx:n,targetCanvas:r}=this,{width:a,height:o}=r;t&&i?(this.scaledCanvas.getContext("2d").putImageData(t,0,0),this.blurCanvasCtx.putImageData(this.blurredImage,0,0),n.save(),n.clearRect(0,0,a,o),n.drawImage(this.scaledCanvas,0,0,a,o),n.globalCompositeOperation="source-in",n.drawImage(e,0,0,a,o),n.globalCompositeOperation="destination-over",n.drawImage(this.blurCanvas,0,0,a,o),n.restore()):n.clearRect(0,0,a,o)}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=a.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=o},8074:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(1851),a=i(9734),o=i(9852);class s extends r.default{constructor(e,t){super("background blur",e,t,new o.default),this.blurAmount=0,this.setBlurStrength(t.blurStrength),this.logger.info("BackgroundBlur 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:r,height:a}=n;i.save(),i.clearRect(0,0,r,a),i.drawImage(this.scaledCanvas,0,0,r,a),i.globalCompositeOperation="source-in",i.drawImage(e,0,0,r,a),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=a.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=s},9734:(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}},1260:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(4243),a=i(8030),o=i(813),s=i(2801),c=i(179),l=i(8074),u=i(9734);class d extends s.default{setBlurStrength(){}loadAssets(){return n(this,void 0,void 0,(function*(){}))}addObserver(){}removeObserver(){}}class f extends r.default{static create(e,t){return n(this,void 0,void 0,(function*(){e=f.resolveSpec(e),t=f.resolveOptions(t);const{logger:i}=t,n=yield f.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 d;let r;return(yield l.default.isSupported())?(i.info("Using browser-provided background blur"),r=new l.default(e,t)):(i.info("Using built-in background blur"),r=new c.default(e,t)),yield r.loadAssets(),r}))}static resolveOptions(e={}){let t=Object.assign({},e);return t.blurStrength||(t.blurStrength=u.default.MEDIUM),t.logger||(t.logger=new a.default("BackgroundBlurProcessor",o.default.INFO)),t=super.resolveOptions(t),t}static isSupported(e,t){return e=f.resolveSpec(e),t=f.resolveOptions(t),super.isSupported(e,t)}}t.default=f},9852:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(4627);class r extends n.default{}t.default=r},22:(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},3368:(e,t)=>{"use strict";Object.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 r=Math.round(n/i),a=Math.round(this.framerate*(t/1e3))-i,o=Math.round(100*n/t);r>=this.filterDurationNotifyMillis&&this.delegate.filterFrameDurationHigh({framesDropped:a,avgFilterDurationMillis:r,framerate:this.framerate,periodMillis:t}),o>=this.filterCPUUtilization&&this.delegate.filterCPUUtilizationHigh({cpuUtilization:o,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}}},1851:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundFilterMonitor=void 0;const r=i(5021),a=i(9807),o=i(3368);class s{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 c{constructor(e,t,i,n){this.targetCanvas=document.createElement("canvas"),this.canvasCtx=this.targetCanvas.getContext("2d"),this.canvasVideoFrameBuffer=new a.default(this.targetCanvas),this.mask$=new s,this.sourceWidth=0,this.sourceHeight=0,this.frameNumber=0,this.videoFramesPerFilterUpdate=1,this.initWorkerPromise=c.createWorkerPromise(),this.loadModelPromise=c.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 o.default(this.delegate,e.reportingPeriodMillis,e.filterCPUUtilization,this.logger),this.cpuMonitor=new l(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 r.loadWorker(this.spec.paths.worker,"BackgroundFilterWorker",{},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 r=this.scaledCanvas.getContext("2d");r.save(),r.scale(i,n),r.drawImage(t,0,0),r.restore();const a=r.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:a},[a.data.buffer]),e=yield t}this.destroyed||this.drawImageWithMask(t,e)}catch(t){return this.logger.error(`could not process ${this.filterType} frame buffer due to ${t}`),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,r;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===(r=this.scaledCanvas)||void 0===r||r.remove(),this.scaledCanvas=void 0,this.logger.info(`${this.filterType} frame process destroyed`)}))}}t.default=c;class l{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=l},4243:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(5021),a=i(9424),o=i(22),s=i(543),c=i(4046),l=()=>o.default.builder().withSelfieSegmentationDefaults().build(),u="https://static.sdkassets.chime.aws",d={worker:`${u}/bgblur/workers/worker.js`,wasm:`${u}/bgblur/wasm/_cwt-wasm.wasm`,simd:`${u}/bgblur/wasm/_cwt-wasm-simd.wasm`};t.default=class{static defaultAssetSpec(){const e=c.default.sdkVersionSemVer;return{assetGroup:`sdk-${e.major}.${e.minor}`}}static createUrlWithParams(e,t){const i=new URL(e),n=Object.keys(t);for(const e of n)void 0!==t[e]&&i.searchParams.set(e,t[e]);return i.toString()}static resolveSpec(e){const{paths:t=d,model:i=l(),assetGroup:n=this.defaultAssetSpec().assetGroup,revisionID:r=this.defaultAssetSpec().revisionID}=e||{},a={assetGroup:n,revisionID:r,sdk:encodeURIComponent(c.default.sdkVersion),ua:encodeURIComponent(c.default.sdkUserAgentLowResolution)};return t.worker=this.createUrlWithParams(t.worker,a),t.wasm=this.createUrlWithParams(t.wasm,a),t.simd=this.createUrlWithParams(t.simd,a),i.path=this.createUrlWithParams(i.path,a),{paths:t,model:i,assetGroup:n,revisionID:r}}static resolveOptions(e){return e.reportingPeriodMillis||(e.reportingPeriodMillis=1e3),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.filterCPUUtilization=30,e}static isSupported(e,t){const{logger:i}=t;return"undefined"==typeof globalThis?(i.info("Browser does not have globalThis."),Promise.resolve(!1)):(new s.default).supportsBackgroundFilter()?a.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(!a.supportsWorker(e,i))return i.info("Browser does not support web workers."),!1;const n=t.paths.worker;try{const e=yield r.loadWorker(n,"BackgroundFilterWorker",{},null);try{e.terminate()}catch(e){i.info(`Failed to terminate worker. ${e.message}`)}return!0}catch(e){return i.info(`Failed to fetch and instantiate test worker ${e.message}`),!1}}))}}},4627:(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)}}},9392:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(1851),a=i(1447);class o extends r.default{constructor(e,t){super("background replacement",e,t,new a.default),this.replacementBlob=t.imageBlob,this.logger.info("BackgroundReplacement 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 o.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:r,height:a}=n;i.save(),i.clearRect(0,0,r,a),i.drawImage(this.scaledCanvas,0,0,r,a),i.globalCompositeOperation="source-in",i.drawImage(e,0,0,r,a),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 o.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=o},9854:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(4243),a=i(8030),o=i(813),s=i(2801),c=i(9392);class l extends s.default{loadAssets(){return n(this,void 0,void 0,(function*(){}))}addObserver(){}removeObserver(){}setImageBlob(){return n(this,void 0,void 0,(function*(){}))}}class u extends r.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 u.isSupported(e,t)))return i.warn("Using no-op processor because background replacement is not supported"),new l;i.info("Using background replacement filter");const n=new c.default(e,t);return yield n.loadAssets(),n}))}static resolveOptions(e={}){const t=Object.assign({},e);return t.logger||(t.logger=new a.default("BackgroundReplacementProcessor",o.default.INFO)),super.resolveOptions(t)}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,r=URL.createObjectURL(n);try{yield c.default.loadImage(r)}catch(e){return t.logger.info(`Failed to fetch load replacement image ${e.message}`),!1}finally{URL.revokeObjectURL(r)}return i.isSupported.call(this,e,t)}))}}t.default=u},1447:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(4627);class r extends n.default{}t.default=r},8434:(e,t)=>{"use strict";Object.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}}},5640:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(8434),r=i(7300);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 r.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs,e)}}},7300:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(8434);class r 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=r},543:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3631);t.default=class{constructor(){this.browser=r.detect(),this.browserSupport={chrome:78,"edge-chromium":79,electron:7,firefox:75,ios:13,safari:13,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"]}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()}supportsVideoLayersAllocationRtpHeaderExtension(){return this.hasChromiumWebRTC()}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()}requiresBundlePolicy(){return"max-bundle"}requiresNoExactMediaStreamConstraints(){return this.isSamsungInternet()}requiresGroupIdMediaStreamConstraints(){return this.isSamsungInternet()}getDisplayMediaAudioCaptureSupport(){return this.isChrome()||this.isEdge()}doesNotSupportMediaDeviceLabels(){return"chromium-webview"===this.browser.name}isSupported(){return!(!this.browserSupport[this.browser.name]||this.majorVersion()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))}requiresVideoPlayWorkaround(){return this.isSafari()}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||this.isIOSSafari()}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)}}},4571:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(289),r=i(6196),a=i(9496),o=i(2306);class s{constructor(e,t,i){this.logger=e,this.videoStreamIndex=t,this.selfAttendeeId=i,this.globalMetricReport=new o.default,this.streamMetricReports={},this.rtcStatsReport={},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=this.streamMetricReports[t],n=i.currentMetrics.concealedSamples-(i.previousMetrics.concealedSamples||0),r=i.currentMetrics.totalSamplesReceived-(i.previousMetrics.totalSamplesReceived||0);return r<=0||r-n<=0?0:n/r*100},this.packetLossPercent=(e,t)=>{const i=this.streamMetricReports[t],n=i.currentMetrics[e]-(i.previousMetrics[e]||0),r=i.currentMetrics.packetsLost-(i.previousMetrics.packetsLost||0),a=n+r;return a<=0||r<=0?0:100*r/a},this.jitterBufferMs=(e,t)=>{const i=this.streamMetricReports[t],n=i.currentMetrics.jitterBufferDelay-(i.previousMetrics.jitterBufferDelay||0),r=i.currentMetrics.jitterBufferEmittedCount-(i.previousMetrics.jitterBufferEmittedCount||0);return n<=0||r<=0?0:n/r*1e3},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);const r=i.currentMetrics[e]-(i.previousMetrics[e]||0);return r<=0?0:Math.trunc(r/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 r=8*(i.currentMetrics[e]-(i.previousMetrics[e]||0));return r<=0?0:Math.trunc(r/n)},this.secondsToMilliseconds=(e,t)=>{const i=t?this.streamMetricReports[t]:this.globalMetricReport;return Number(1e3*i.currentMetrics[e])},this.globalMetricMap={retransmittedBytesSent:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_RETRANSMIT_BITRATE},totalEncodedBytesTarget:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_TARGET_ENCODER_BITRATE},totalPacketSendDelay:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_BUCKET_DELAY_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.secondsToMilliseconds,type:n.SdkMetric.Type.STUN_RTT_MS}},this.audioUpstreamMetricMap={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},roundTripTime:{transform:this.secondsToMilliseconds,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={concealedSamples:{transform:this.countPerSecond},totalSamplesReceived:{transform:this.countPerSecond},decoderLoss:{transform:this.decoderLossPercent,type:n.SdkMetric.Type.RTC_SPK_FRACTION_DECODER_LOSS_PERCENT},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"},jitter:{transform:this.secondsToMilliseconds,type:n.SdkMetric.Type.RTC_SPK_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:n.SdkMetric.Type.RTC_SPK_JITTER_BUFFER_MS},bytesReceived:{transform:this.bitsPerSecond,type:n.SdkMetric.Type.RTC_SPK_BITRATE}},this.videoUpstreamMetricMap={roundTripTime:{transform:this.secondsToMilliseconds,type:n.SdkMetric.Type.VIDEO_SENT_RTT_MS},nackCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_NACKS_RECEIVED},pliCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_PLIS_RECEIVED},firCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_FIRS_RECEIVED},framesPerSecond:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_INPUT_FPS},framesEncoded:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_ENCODE_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},qpSum:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_SENT_QP_SUM},frameHeight:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_ENCODE_HEIGHT},frameWidth:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_ENCODE_WIDTH},jitter:{transform:this.secondsToMilliseconds}},this.videoDownstreamMetricMap={totalDecodeTime:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_DECODE_MS},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"},framesReceived:{transform:this.identityValue,type:n.SdkMetric.Type.VIDEO_RECEIVED_FPS},framesDecoded:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_DECODE_FPS},nackCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_NACKS_SENT},firCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_FIRS_SENT},pliCount:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_PLIS_SENT},bytesReceived:{transform:this.bitsPerSecond,type:n.SdkMetric.Type.VIDEO_RECEIVED_BITRATE},jitter:{transform:this.secondsToMilliseconds,type:n.SdkMetric.Type.VIDEO_RECEIVED_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:n.SdkMetric.Type.VIDEO_JITTER_BUFFER_MS},qpSum:{transform:this.countPerSecond,type:n.SdkMetric.Type.VIDEO_RECEIVED_QP_SUM},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:a.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamPacketsSent:{source:"packetsSent",media:a.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamPacketLossPercent:{source:"packetsLost",media:a.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamFramesEncodedPerSecond:{source:"framesEncoded",media:a.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamFrameHeight:{source:"frameHeight",media:a.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamFrameWidth:{source:"frameWidth",media:a.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamJitterMs:{source:"jitter",media:a.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamRoundTripTimeMs:{source:"roundTripTime",media:a.default.VIDEO,dir:r.default.UPSTREAM},videoDownstreamBitrate:{source:"bytesReceived",media:a.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamPacketLossPercent:{source:"packetsLost",media:a.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamPacketsReceived:{source:"packetsReceived",media:a.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamFramesDecodedPerSecond:{source:"framesDecoded",media:a.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamFrameHeight:{source:"frameHeight",media:a.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamFrameWidth:{source:"frameWidth",media:a.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamJitterMs:{source:"jitter",media:a.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamDelayMs:{source:"jitterBufferMs",media:a.default.VIDEO,dir:r.default.DOWNSTREAM}},this.observableMetricSpec={audioPacketsReceived:{source:"packetsReceived",media:a.default.AUDIO,dir:r.default.DOWNSTREAM},audioPacketsReceivedFractionLoss:{source:"packetsLost",media:a.default.AUDIO,dir:r.default.DOWNSTREAM},audioDecoderLoss:{source:"decoderLoss",media:a.default.AUDIO,dir:r.default.DOWNSTREAM},audioPacketsSent:{source:"packetsSent",media:a.default.AUDIO,dir:r.default.UPSTREAM},audioPacketLossPercent:{source:"packetsLost",media:a.default.AUDIO,dir:r.default.UPSTREAM},audioUpstreamRoundTripTimeMs:{source:"roundTripTime",media:a.default.AUDIO,dir:r.default.UPSTREAM},videoUpstreamBitrate:{source:"bytesSent",media:a.default.VIDEO,dir:r.default.UPSTREAM},videoPacketSentPerSecond:{source:"packetsSent",media:a.default.VIDEO,dir:r.default.UPSTREAM},audioSpeakerDelayMs:{source:"jitterBufferMs",media:a.default.AUDIO,dir:r.default.DOWNSTREAM},audioUpstreamJitterMs:{source:"jitter",media:a.default.AUDIO,dir:r.default.UPSTREAM},audioDownstreamJitterMs:{source:"jitter",media:a.default.AUDIO,dir:r.default.DOWNSTREAM},nackCountReceivedPerSecond:{source:"nackCount",media:a.default.VIDEO,dir:r.default.UPSTREAM},availableOutgoingBitrate:{source:"availableOutgoingBitrate"},availableIncomingBitrate:{source:"availableIncomingBitrate"},currentRoundTripTimeMs:{source:"currentRoundTripTime"}}}getMetricMap(e,t){switch(e){case a.default.AUDIO:switch(t){case r.default.UPSTREAM:return this.audioUpstreamMetricMap;case r.default.DOWNSTREAM:return this.audioDownstreamMetricMap}case a.default.VIDEO:switch(t){case r.default.UPSTREAM:return this.videoUpstreamMetricMap;case r.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],{transform:n,source:r}=i;if(!t.hasOwnProperty("media"))return n(r||t.source);for(const e in this.streamMetricReports){const i=this.streamMetricReports[e];if(i.direction===t.dir&&i.mediaType===t.media)return n(r||t.source,Number(e))}return 0}getObservableVideoMetricValue(e,t){const i=this.observableVideoMetricSpec[e],n=this.getMetricMap(i.media,i.dir)[i.source],{transform:r,source:a}=n;return r(a||i.source,t)}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===a.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,r=n?this.videoStreamIndex.attendeeIdForStreamId(n):this.selfAttendeeId;e[r]=e[r]?e[r]:{},e[r][t]=i}return e}getRTCStatsReport(){return this.rtcStatsReport}clone(){const e=new s(this.logger,this.videoStreamIndex,this.selfAttendeeId);return e.globalMetricReport=this.globalMetricReport,e.streamMetricReports=this.streamMetricReports,e.rtcStatsReport=this.rtcStatsReport,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=s},6196:(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},9496:(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},2770:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},2306:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.previousMetrics={},this.currentMetrics={}}}},2811:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.previousMetrics={},this.currentMetrics={}}}},3940:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t){this.minHealth=e.minHealth,this.maxHealth=e.maxHealth,this.currentHealth=e.initialHealth,this.currentData=t.clone()}minimumHealth(){return this.minHealth}maximumHealth(){return this.maxHealth}health(){return this.maximumHealth()}update(e){this.currentData=e}getConnectionHealthData(){return this.currentData.clone()}healthy(){return this.health()>this.minimumHealth()}healthIfChanged(){const e=this.health();return e!==this.currentHealth?(this.currentHealth=e,e):null}}},4531:(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(){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.minHealth=0,this.maxHealth=1,this.initialHealth=1,this.connectionUnhealthyThreshold=25,this.noSignalThresholdTimeMs=1e4,this.connectionWaitTimeMs=1e4,this.zeroBarsNoSignalTimeMs=5e3,this.oneBarWeakSignalTimeMs=5e3,this.twoBarsTimeMs=5e3,this.threeBarsTimeMs=1e4,this.fourBarsTimeMs=2e4,this.fiveBarsTimeMs=6e4,this.cooldownTimeMs=6e4,this.pastSamplesToConsider=15,this.goodSignalTimeMs=15e3,this.fractionalLoss=.5,this.packetsExpected=50,this.maximumTimesToWarn=2,this.missedPongsLowerThreshold=1,this.missedPongsUpperThreshold=4,this.maximumAudioDelayMs=6e4,this.maximumAudioDelayDataPoints=10}}},9708:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3940);class r extends n.default{constructor(e,t,i){super(t,i),this.logger=e,this.audioDelayPointsOverMaximum=0,r.CONNECTION_UNHEALTHY_THRESHOLD=t.connectionUnhealthyThreshold,r.CONNECTION_WAIT_TIME_MS=t.connectionWaitTimeMs,r.MISSED_PONGS_THRESHOLD=t.missedPongsUpperThreshold,r.MAXIMUM_AUDIO_DELAY_MS=t.maximumAudioDelayMs,r.MAXIMUM_AUDIO_DELAY_DATA_POINTS=t.maximumAudioDelayDataPoints}health(){if(this.currentData.isConnectionStartRecent(r.CONNECTION_WAIT_TIME_MS))return 1;const e=this.currentData.consecutiveStatsWithNoPackets>=r.CONNECTION_UNHEALTHY_THRESHOLD,t=this.currentData.consecutiveMissedPongs>=r.MISSED_PONGS_THRESHOLD;this.currentData.audioSpeakerDelayMs>r.MAXIMUM_AUDIO_DELAY_MS?this.audioDelayPointsOverMaximum+=1:this.audioDelayPointsOverMaximum=0;const i=this.audioDelayPointsOverMaximum>r.MAXIMUM_AUDIO_DELAY_DATA_POINTS;return i&&(this.audioDelayPointsOverMaximum=0),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=r},1922:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3940);class r extends n.default{constructor(e,t){super(e,t),this.coolDownTimeMs=e.cooldownTimeMs,this.pastSamplesToConsider=e.pastSamplesToConsider,this.fractionalLoss=e.fractionalLoss,this.packetsExpected=e.packetsExpected,this.maximumTimesToWarn=e.maximumTimesToWarn,this.lastWarnTimestampMs=0,this.warnCount=0}calculateFractionalLoss(){if(this.currentData.packetsReceivedInLastMinute.length=this.fractionalLoss?0!==this.currentHealth&&(this.lastWarnTimestampMs=Date.now(),this.warnCount++,this.warnCount>this.maximumTimesToWarn)?1:0:1}}t.default=r},8581:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(8660);t.default=class{constructor(e,t,i,n,r){this.audioVideoController=e,this.realtimeController=t,this.connectionHealthData=i,this.pingPong=n,this.statsCollector=r,this.isActive=!1,this.hasSeenValidPacketMetricsBefore=!1,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(),r=n.audioPacketsReceived,a=n.audioPacketsReceivedFractionLoss,o=n.audioSpeakerDelayMs;"number"!=typeof o||isNaN(o)||this.connectionHealthData.setAudioSpeakerDelayMs(o),"number"==typeof r&&"number"==typeof a&&(t=r,i=a,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()}updateConnectionHealth(){this.audioVideoController.forEachObserver((e=>{n.Maybe.of(e.connectionHealthDidChange).map((t=>t.bind(e)(this.connectionHealthData.clone())))}))}}},8890:(e,t)=>{"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Modality="#content"}(i||(i={})),t.default=i},8370:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(543),a=i(4142);class o{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."),a.default.synthesizeAudioDevice(0)):this._mediaStream}))}acquireVideoInputStream(){return n(this,void 0,void 0,(function*(){return this._mediaStream}))}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)}))}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 r.default).getDisplayMediaAudioCaptureSupport()),video:Object.assign(Object.assign({},!e&&{frameRate:{max:t||o.defaultFrameRate}}),e&&{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:t||o.defaultFrameRate}})}}toggleMediaStream(e){let t=!1;if(this.mediaStream)for(let i=0;i{this.stopContentShare()}));this.contentAudioVideo.start()}}))}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=>{c.Maybe.of(e.contentShareDidPause).map((t=>t.call(e)))}))}unpauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!0)&&this.forEachContentShareObserver((e=>{c.Maybe.of(e.contentShareDidUnpause).map((t=>t.call(e)))}))}setContentShareVideoCodecPreferences(e){this.contentAudioVideo.setVideoCodecSendPreferences(e)}destroy(){return n(this,void 0,void 0,(function*(){this.contentAudioVideo&&(this.destroyed=!0,this.contentAudioVideo.removeObserver(this),this.stopContentShare(),this.observerQueue.clear(),this.contentAudioVideo=void 0,this.attendeeAudioVideo=void 0,this.mediaStreamBroker=void 0)}))}stopContentShare(){this.contentAudioVideo.stop(),this.mediaStreamBroker.cleanup()}addContentShareObserver(e){this.observerQueue.add(e)}removeContentShareObserver(e){this.observerQueue.delete(e)}forEachContentShareObserver(e){for(const t of this.observerQueue)s.default.nextTick((()=>{this.observerQueue.has(t)&&e(t)}))}audioVideoDidStart(){this.mediaStreamBroker.mediaStream.getVideoTracks().length>0&&this.contentAudioVideo.videoTileController.startLocalVideoTile()}audioVideoDidStop(e){this.mediaStreamBroker.cleanup(),this.contentShareTile&&(this.attendeeAudioVideo.videoTileController.removeVideoTile(this.contentShareTile.id()),this.contentShareTile=null),this.forEachContentShareObserver((e=>{c.Maybe.of(e.contentShareDidStop).map((t=>t.call(e)))}))}setupContentShareEvents(){this.attendeeAudioVideo.realtimeController.realtimeSubscribeToAttendeeIdPresence(((e,t,i,n)=>{const r=new o.default(e).hasModality(o.default.MODALITY_CONTENT),a=new o.default(e).base()===this.attendeeAudioVideo.configuration.credentials.attendeeId;if(!r||!a||!t||this.contentShareTile)return;const s=this.mediaStreamBroker.mediaStream;if(null==s?void 0:s.getVideoTracks().length){this.contentShareTile=this.attendeeAudioVideo.videoTileController.addVideoTile();const e=s.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,s,t,i,null,this.contentAudioVideo.configuration.credentials.externalUserId)}this.forEachContentShareObserver((e=>{c.Maybe.of(e.contentShareDidStart).map((t=>t.call(e)))}))}))}}},7237:(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 e of n.loggers)e.error(t);0===n.loggers.size&&console.error(t)}},1018:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,i,n,r,a){this.timestampMs=e,this.topic=t,this.data=i,this.senderAttendeeId=n,this.senderExternalUserId=r,this.throttled=!!a}text(){return(new TextDecoder).decode(this.data)}json(){return JSON.parse((new TextDecoder).decode(this.data))}}},146:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDestroyable=void 0,t.isDestroyable=function(e){return e&&"destroy"in e}},1746:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAudioTransformDevice=void 0,t.isAudioTransformDevice=function(e){return!!e&&"object"==typeof e&&"mute"in e&&"stop"in e&&"intrinsicDevice"in e}},4142:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(543),a=i(6354),o=i(7797),s=i(1515),c=i(8660),l=i(3327),u=i(1746),d=i(8128),f=i(5348),C=i(1238),h=i(3110),p=i(4842),m=i(6991),v=i(6950),g=i(4500),b=i(7170);class M{constructor(e,t,i=new r.default,n){this.logger=e,this.browserBehavior=i,this.eventController=n,this.deviceInfoCache=null,this.activeDevices={audio:null,video:null},this.chosenVideoTransformDevice=null,this.audioOutputDeviceId=void 0,this.deviceChangeObservers=new Set,this.mediaStreamBrokerObservers=new Set,this.deviceLabelTrigger=()=>navigator.mediaDevices.getUserMedia({audio:!0,video:!0}),this.audioInputDestinationNode=null,this.audioInputSourceNode=null,this.videoInputQualitySettings=null,this.useWebAudio=!1,this.useMediaConstraintsFallback=!0,this.audioInputTaskQueue=new s.default,this.videoInputTaskQueue=new s.default,this.muted=!1,this.mediaStreamMuteObserver=(e,t)=>{for(const i of this.deviceChangeObservers)o.default.nextTick((()=>{this.deviceChangeObservers.has(i)&&i.audioInputMuteStateChanged&&i.audioInputMuteStateChanged(e,t)}))},this.alreadyHandlingDeviceChange=!1;const{enableWebAudio:c=!1,useMediaConstraintsFallback:l=!0}=t||{};this.useWebAudio=c,this.useMediaConstraintsFallback=l,this.videoInputQualitySettings=new g.default(M.defaultVideoWidth,M.defaultVideoHeight,M.defaultVideoFrameRate);const u=this.browserBehavior.requiresResolutionAlignment(this.videoInputQualitySettings.videoWidth,this.videoInputQualitySettings.videoHeight);this.videoInputQualitySettings.videoWidth=u[0],this.videoInputQualitySettings.videoHeight=u[1],this.logger.info(`DefaultDeviceController video dimension ${this.videoInputQualitySettings.videoWidth} x ${this.videoInputQualitySettings.videoHeight}`);try{this.mediaDeviceWrapper=(new a.default).create();const e=navigator.mediaDevices.getSupportedConstraints();this.logger.info(`Supported Constraints in this browser ${JSON.stringify(e)}`)}catch(t){e.error(t.message)}}isWatchingForDeviceChanges(){return!!this.onDeviceChangeCallback}ensureWatchingDeviceChanges(){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(){return!!this.deviceChangeObservers.size||(this.activeDevices.audio&&null!==this.activeDevices.audio.constraints||this.activeDevices.video&&null!==this.activeDevices.video.constraints||!!this.audioOutputDeviceId)}watchForDeviceChangesIfNecessary(){this.shouldObserveDeviceChanges()?this.ensureWatchingDeviceChanges():this.stopWatchingDeviceChanges()}destroy(){return n(this,void 0,void 0,(function*(){this.stopWatchingDeviceChanges(),yield this.stopAudioInput(),yield this.stopVideoInput()}))}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;null===(t=this.eventController)||void 0===t||t.publishEvent(void 0===e?"audioInputUnselected":"audioInputSelected")}pushVideoMeetingStateForPermissions(e){var t;null===(t=this.eventController)||void 0===t||t.publishEvent(void 0===e?"videoInputUnselected":"videoInputSelected")}startAudioInput(e){return n(this,void 0,void 0,(function*(){return yield this.audioInputTaskQueue.add((()=>this.startAudioInputTask(e)))}))}startAudioInputTask(e){var t;return n(this,void 0,void 0,(function*(){if(void 0!==e)try{return u.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)),this.trace("startAudioInputDevice",e,"success"),this.useWebAudio?(this.attachAudioInputStreamToAudioContext(this.activeDevices.audio.stream),this.pushAudioMeetingStateForPermissions(this.getMediaStreamDestinationNode().stream),yield null===(t=this.transform)||void 0===t?void 0:t.device.mute(this.muted),this.getMediaStreamDestinationNode().stream):(this.publishAudioInputDidChangeEvent(this.activeDevices.audio.stream),this.activeDevices.audio.stream)}catch(e){throw e}else this.logger.error("Audio input device cannot be undefined")}))}stopAudioInput(){return n(this,void 0,void 0,(function*(){return this.audioInputTaskQueue.add((()=>this.stopAudioInputTask()))}))}stopAudioInputTask(){return n(this,void 0,void 0,(function*(){try{if(this.useWebAudio)return void this.releaseAudioTransformStream();this.stopTracksAndRemoveCallbacks("audio")}finally{this.watchForDeviceChangesIfNecessary(),this.publishAudioInputDidChangeEvent(void 0)}}))}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=M.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(e){throw this.logger.error(`Unable to create transform device node: ${e}.`),e}const r=yield e.intrinsicDevice();yield this.chooseInputIntrinsicDevice("audio",r),this.logger.debug(`Got inner stream: ${r}.`),this.setTransform(e,n)}))}chooseVideoTransformInputDevice(e){var t;return n(this,void 0,void 0,(function*(){if(e===this.chosenVideoTransformDevice)return void this.logger.info("Reselecting same VideoTransformDevice");const i=this.chosenVideoTransformDevice;i&&this.logger.info("Switched from previous VideoTransformDevice");const n=!!i,r=yield e.intrinsicDevice();if(!this.isMediaStreamReusableByDeviceId(null===(t=this.activeDevices.video)||void 0===t?void 0:t.stream,r))return this.logger.info("video transform device needs new intrinsic device"),n&&i.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=e,this.activeDevices.video=null,yield this.chooseInputIntrinsicDevice("video",r),this.logger.info("apply processors to transform"),void(yield this.chosenVideoTransformDevice.transformStream(this.activeDevices.video.stream));this.chosenVideoTransformDevice=e,this.logger.info("video transform device uses previous stream"),this.logger.info("apply processors to transform"),yield e.transformStream(this.activeDevices.video.stream)}))}startVideoInput(e){return n(this,void 0,void 0,(function*(){return yield this.videoInputTaskQueue.add((()=>this.startVideoInputTask(e)))}))}startVideoInputTask(e){return n(this,void 0,void 0,(function*(){if(e)try{return b.isVideoTransformDevice(e)?(this.logger.info(`Choosing video transform device ${e}`),yield this.chooseVideoTransformInputDevice(e),this.publishVideoInputDidChangeEvent(this.chosenVideoTransformDevice.outputMediaStream),this.chosenVideoTransformDevice.outputMediaStream):(this.chosenVideoInputIsTransformDevice()&&(this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null),yield this.chooseInputIntrinsicDevice("video",e),this.trace("startVideoInputDevice",e),this.publishVideoInputDidChangeEvent(this.activeDevices.video.stream),this.activeDevices.video.stream)}catch(e){throw e}else this.logger.error("Invalid video input device")}))}stopVideoInput(){return n(this,void 0,void 0,(function*(){return this.videoInputTaskQueue.add((()=>this.stopVideoInputTask()))}))}stopVideoInputTask(){return n(this,void 0,void 0,(function*(){try{if(this.chosenVideoInputIsTransformDevice())return void this.releaseVideoTransformStream();this.stopTracksAndRemoveCallbacks("video")}finally{this.watchForDeviceChangesIfNecessary(),this.publishVideoInputDidChangeEvent(void 0)}}))}chooseAudioOutput(e){return n(this,void 0,void 0,(function*(){this.audioOutputDeviceId=e,this.watchForDeviceChangesIfNecessary();const t=this.deviceInfoFromDeviceId("audiooutput",this.audioOutputDeviceId);this.publishAudioOutputDidChangeEvent(t),this.trace("chooseAudioOutput",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(e){}},i.connect(e),e}return this.createAnalyserNodeForRawAudioInput()}createAnalyserNodeForRawAudioInput(){return this.activeDevices.audio?this.createAnalyserNodeForStream(this.activeDevices.audio.stream):null}createAnalyserNodeForStream(e){const t=M.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);l.default.connectVideoStreamToVideoElement(this.chosenVideoTransformDevice?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream,e,!0),this.trace("startVideoPreviewForVideoInput",e.id)}stopVideoPreviewForVideoInput(e){l.default.disconnectVideoStreamFromVideoElement(e,!1),this.trace("stopVideoPreviewForVideoInput",e.id)}setDeviceLabelTrigger(e){if(this.deviceInfoCache)for(const e of this.deviceInfoCache)if(!e.label){this.deviceInfoCache=null;break}this.deviceLabelTrigger=e,this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(e){let t=null;return this.useWebAudio?(t=M.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){const n=this.browserBehavior.requiresResolutionAlignment(e,t);this.videoInputQualitySettings=new g.default(n[0],n[1],i)}getVideoInputQualitySettings(){return this.videoInputQualitySettings}acquireAudioInputStream(){return n(this,void 0,void 0,(function*(){return this.activeDevices.audio||(this.logger.info("No audio device chosen, creating empty audio device"),yield this.startAudioInput(null)),this.useWebAudio?this.getMediaStreamDestinationNode().stream:this.activeDevices.audio.stream}))}acquireVideoInputStream(){return n(this,void 0,void 0,(function*(){if(!this.activeDevices.video)throw new Error("No video device chosen");return this.chosenVideoInputIsTransformDevice()?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream}))}acquireDisplayInputStream(e){return n(this,void 0,void 0,(function*(){throw new Error("unsupported")}))}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,r=t.trackUnmuteCallback;for(const a of t.stream.getTracks())a.stop(),i&&a.removeEventListener("ended",i),n&&a.removeEventListener("mute",n),r&&a.removeEventListener("unmute",r),delete t.endedCallback,delete t.trackMuteCallback,delete t.trackUnmuteCallback,delete this.activeDevices[e]}chosenVideoInputIsTransformDevice(){return!!this.chosenVideoTransformDevice}muteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!1)}unmuteLocalAudioInputStream(){this.toggleLocalAudioInputStream(!0)}toggleLocalAudioInputStream(e){var t;let i=this.activeDevices.audio;if(this.useWebAudio&&(i=this.getMediaStreamDestinationNode()),i){for(const t of i.stream.getTracks())t.enabled!==e&&(t.enabled=e);this.muted!==!e&&(this.muted=!e,null===(t=this.transform)||void 0===t||t.device.mute(this.muted))}}static getIntrinsicDeviceId(e){if(!e)return;if("string"==typeof e)return e;if(e.id)return e.id;const t=e.deviceId;if(!t)return;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 M.synthesizeAudioDevice(0)}static synthesizeAudioDevice(e){const t=M.getAudioContext(),i=t.createMediaStreamDestination();if(e){const n=t.createGain();n.gain.value=.1,n.connect(i);const r=t.createOscillator();r.frequency.value=e,r.connect(n),r.start()}else{const e=t.createBufferSource();try{e.buffer=t.createBuffer(1,5*t.sampleRate,t.sampleRate)}catch(i){if(!i||"NotSupportedError"!==i.name)throw i;e.buffer=t.createBuffer(1,5*M.defaultSampleRate,M.defaultSampleRate)}e.buffer.getChannelData(0)[0]=3e-4,e.loop=!0,e.connect(i),e.start()}return i.stream}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 i of e)if(!i.label){t=!1;break}if(!t)try{this.logger.info("attempting to trigger media device labels since they are hidden");const t=yield this.deviceLabelTrigger();e=yield navigator.mediaDevices.enumerateDevices();for(const e of t.getTracks())e.stop()}catch(e){this.logger.info("unable to get media device labels")}this.logger.debug(`Update device info cache with devices: ${JSON.stringify(e)}`),this.deviceInfoCache=e}))}listCachedDevicesOfKind(e){const t=[];if(this.deviceInfoCache)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 o.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"),r=this.listCachedDevicesOfKind("videoinput"),a=this.listCachedDevicesOfKind("audiooutput");this.forEachObserver((o=>{this.areDeviceListsEqual(e,n)||c.Maybe.of(o.audioInputsChanged).map((e=>e.bind(o)(n))),this.areDeviceListsEqual(t,r)||c.Maybe.of(o.videoInputsChanged).map((e=>e.bind(o)(r))),this.areDeviceListsEqual(i,a)||c.Maybe.of(o.audioOutputsChanged).map((e=>e.bind(o)(a)))})),this.alreadyHandlingDeviceChange=!1}))}handleDeviceStreamEnded(e,t){return n(this,void 0,void 0,(function*(){try{"audio"===e?(this.logger.warn("Audio input device which was active is no longer available, resetting to null device"),yield this.startAudioInput(null)):(this.logger.warn("Video input device which was active is no longer available, stopping video"),yield this.stopVideoInput())}catch(e){this.logger.error("Failed to choose null device after stream ended.")}"audio"===e?this.forEachObserver((e=>{c.Maybe.of(e.audioInputStreamEnded).map((i=>i.bind(e)(t)))})):this.forEachObserver((e=>{c.Maybe.of(e.videoInputStreamEnded).map((i=>i.bind(e)(t)))}))}))}forEachObserver(e){for(const t of this.deviceChangeObservers)o.default.nextTick((()=>{this.deviceChangeObservers.has(t)&&e(t)}))}forEachMediaStreamBrokerObserver(e){for(const t of this.mediaStreamBrokerObservers)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,r,a,o;let s;return"audio"===e?(s=null==i?void 0:i.audio.streamId,!!s&&s===(null===(r=null===(n=t.constraints)||void 0===n?void 0:n.audio)||void 0===r?void 0:r.streamId)):(s=null==i?void 0:i.video.streamId,!!s&&s===(null===(o=null===(a=null==t?void 0:t.constraints)||void 0===a?void 0:a.video)||void 0===o?void 0:o.streamId))}hasSameGroupId(e,t,i){if(""===e)return!0;const n=M.getIntrinsicDeviceId(i);return this.logger.debug(`Checking deviceIds ${n} of type ${typeof n} with groupId ${e}`),"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}return this.logger.debug(`GroupId of deviceId ${t} found in cache is empty`),""}handleGetUserMediaError(e,t){if(!e)throw new f.default(e);switch(e.name){case"NotReadableError":case"TrackStartError":throw new h.default(e);case"NotFoundError":case"DevicesNotFoundError":throw new C.default(e);case"NotAllowedError":case"PermissionDeniedError":case"SecurityError":throw t&&t{this.activeDevices[e]&&this.activeDevices[e].stream===t.stream&&(this.handleDeviceStreamEnded(e,n),delete t.endedCallback)},r.addEventListener("ended",t.endedCallback,{once:!0})),"audio"===e){const e=t.stream.getAudioTracks()[0];if(e){const i=e.getSettings().deviceId||t.stream;t.trackMuteCallback=()=>{this.mediaStreamMuteObserver(i,!0)},t.trackUnmuteCallback=()=>{this.mediaStreamMuteObserver(i,!1)},e.addEventListener("mute",t.trackMuteCallback,{once:!1}),e.addEventListener("unmute",t.trackUnmuteCallback,{once:!1}),this.logger.debug("Notifying mute state after selection"),e.muted?t.trackMuteCallback():t.trackUnmuteCallback()}}}))}calculateMediaStreamConstraints(e,t,i,n){if(n&&1===this.listCachedDevicesOfKind(`${e}input`).length)return!0;const r={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?r.deviceId=t:r.deviceId={exact:t},i&&(r.groupId=i),n?r:"video"===e?(r.width={ideal:this.videoInputQualitySettings.videoWidth},r.height={ideal:this.videoInputQualitySettings.videoHeight},r.frameRate={ideal:this.videoInputQualitySettings.videoFrameRate},r):(this.supportSampleRateConstraint()&&(r.sampleRate={ideal:M.defaultSampleRate}),this.supportSampleSizeConstraint()&&(r.sampleSize={ideal:M.defaultSampleSize}),this.supportChannelCountConstraint()&&(r.channelCount={ideal:M.defaultChannelCount}),Object.assign({echoCancellation:!0,googEchoCancellation:!0,googEchoCancellation2:!0,googAutoGainControl:!0,googAutoGainControl2:!0,googNoiseSuppression:!0,googNoiseSuppression2:!0,googHighpassFilter:!0},r))}getMediaStreamConstraintsFromTrackConstraints(e,t){return"audio"===e?{audio:t}:{video:t}}getMediaStreamConstraints(e,t,i=!1){let n={};if(!t)return null;const r=this.intrinsicDeviceAsMediaStream(t);if(r)return n.streamId=r.id,this.getMediaStreamConstraintsFromTrackConstraints(e,n);if("string"==typeof t){let r="";return this.browserBehavior.requiresGroupIdMediaStreamConstraints()&&(null!==this.deviceInfoCache?r=this.getGroupIdFromDeviceId(e,t):this.logger.error("Device cache is not populated. Please make sure to call list devices first")),n=this.calculateMediaStreamConstraints(e,t,r,i),this.getMediaStreamConstraintsFromTrackConstraints(e,n)}return function(e){return"object"==typeof e&&"deviceId"in e&&"groupId"in e&&"kind"in e&&"label"in e}(t)?(n=this.calculateMediaStreamConstraints(e,t.deviceId,t.groupId,i),this.getMediaStreamConstraintsFromTrackConstraints(e,n)):(n=t,this.getMediaStreamConstraintsFromTrackConstraints(e,n))}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}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=M.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 r=null==t?void 0:t.end,a=this.getMediaStreamDestinationNode();this.logger.debug(`Connecting transform node ${r} to destination ${a}.`),null==r||r.connect(a),this.reconnectAudioInputs()}removeTransform(){var e;const t=this.transform;if(t)return null===(e=this.transform.nodes)||void 0===e||e.end.disconnect(),this.transform=void 0,this.reconnectAudioInputs(),t}attachAudioInputStreamToAudioContext(e){var t;null===(t=this.audioInputSourceNode)||void 0===t||t.disconnect(),this.audioInputSourceNode=M.getAudioContext().createMediaStreamSource(e);const i=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(i)}getMediaStreamDestinationNode(){return this.audioInputDestinationNode||(this.audioInputDestinationNode=M.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(!M.audioContext){const e={};navigator.mediaDevices.getSupportedConstraints().sampleRate&&(e.sampleRate=M.defaultSampleRate),M.audioContext=new(window.AudioContext||window.webkitAudioContext)(e)}return M.audioContext}static closeAudioContext(){if(M.audioContext)try{M.audioContext.close()}catch(e){}M.audioContext=null}addMediaStreamBrokerObserver(e){this.mediaStreamBrokerObservers.add(e)}removeMediaStreamBrokerObserver(e){this.mediaStreamBrokerObservers.delete(e)}publishVideoInputDidChangeEvent(e){this.forEachMediaStreamBrokerObserver((t=>{t.videoInputDidChange&&t.videoInputDidChange(e)})),this.pushVideoMeetingStateForPermissions(e)}publishAudioInputDidChangeEvent(e){this.forEachMediaStreamBrokerObserver((t=>{t.audioInputDidChange&&t.audioInputDidChange(e)})),this.pushAudioMeetingStateForPermissions(e)}publishAudioOutputDidChangeEvent(e){this.forEachMediaStreamBrokerObserver((t=>{t.audioOutputDidChange&&t.audioOutputDidChange(e)}))}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}`;void 0!==t&&(n+=` ${JSON.stringify(t)}`),void 0!==i&&(n+=` -> ${JSON.stringify(i)}`),this.logger.info(n)}}t.default=M,M.permissionDeniedOriginDetectionThresholdMs=500,M.defaultVideoWidth=960,M.defaultVideoHeight=540,M.defaultVideoFrameRate=15,M.defaultSampleRate=48e3,M.defaultSampleSize=16,M.defaultChannelCount=1,M.audioContext=null},8128:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.groupId=""}matchesConstraints(e){return JSON.stringify(this.constraints)===JSON.stringify(e)}}},5348:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i extends Error{constructor(e,t){super(t||"Error fetching device."),this.cause=e,this.name="GetUserMediaError"}}t.default=i},6154:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoOpDeviceControllerWithEventController=void 0;const r=i(4015);class a extends r.default{constructor(e){super(),this.destroyed=!1}destroy(){return n(this,void 0,void 0,(function*(){this.destroyed=!0}))}listAudioInputDevices(){return Promise.resolve([])}listVideoInputDevices(){return Promise.resolve([])}listAudioOutputDevices(){return Promise.resolve([])}startAudioInput(e){return Promise.reject()}stopAudioInput(){return Promise.resolve()}startVideoInput(e){return Promise.reject()}stopVideoInput(){return Promise.resolve()}chooseAudioOutput(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){}getVideoInputQualitySettings(){return null}}t.default=a,t.NoOpDeviceControllerWithEventController=class extends a{constructor(e){super(),this.eventController=e}}},1238:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(5348);class r extends n.default{constructor(e){super(e),this.name="NotFoundError"}}t.default=r},3110:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(5348);class r extends n.default{constructor(e){super(e),this.name="NotReadableError"}}t.default=r},4842:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(5348);class r extends n.default{constructor(e,t){super(e),this.constraint=t,this.name="OverconstrainedError"}}t.default=r},6991:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(5348);class r extends n.default{constructor(e,t){super(e,t),this.name="PermissionDeniedError"}}t.default=r},7786:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((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}}))}}},6950:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(5348);class r extends n.default{constructor(e){super(e),this.name="TypeError"}}t.default=r},4500:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,i){this.videoWidth=e,this.videoHeight=t,this.videoFrameRate=i}}},7170:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isVideoTransformDevice=void 0,t.isVideoTransformDevice=function(e){return!!e&&"object"==typeof e&&"transformStream"in e&&"stop"in e&&"intrinsicDevice"in e}},8236:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((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()}))}registerObserver(e){this.observerQueue.add(e),e.devicePixelRatioChanged(this.devicePixelRatioSource.devicePixelRatio())}removeObserver(e){this.observerQueue.delete(e)}}},9190:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{devicePixelRatio(){return"undefined"!=typeof window&&window&&window.devicePixelRatio?window.devicePixelRatio:1}}},3520:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))},r=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 r=0;for(n=Object.getOwnPropertySymbols(e);r({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(e){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents error reading OK response ${e} for events ${t}`)}else this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Failed to send events ${t} with response status ${e.status}`),i=!0}catch(e){i=!0,this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Error in sending events ${t} to the ingestion endpoint ${e}`)}finally{this.lock=!1}i&&(this.cancellableEvents.delete(n),this.failedIngestionEvents.push(...e))}));const c=new s.default(o).getParserResult(),{browserMajorVersion:l}=c,u=r(c,["browserMajorVersion"]),d=t.toJSON(),{type:f,v:C}=d,h=r(d,["type","v"]);this.authenticationToken=t.getAuthenticationToken(),this.metadata=Object.assign(Object.assign({},u),h),Object.keys(this.metadata).forEach((e=>this.attributesToFilter.push(e))),this.type=f,this.v=C,this.ingestionURL=i,this.logger=o,this.importantEvents=new Set(a);const{maxBufferCapacityKb:p,totalBufferItems:m,flushSize:v,flushIntervalMs:g,retryCountLimit:b}=e;this.maxBufferCapacityBytes=1024*p,this.totalBufferItems=m,this.maxBufferItemCapacityBytes=Math.round(this.maxBufferCapacityBytes/m),this.flushIntervalMs=g,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=new o.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,r=n&&this.filterAttributes(n,this.attributesToFilter),a=Object.assign({name:t,ts:i},r);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - event after filtering attributes ${JSON.stringify(a)}`);const o=this.getSize(a);if(o>l.MAX_ITEM_SIZE_BYTES_ALLOWED)throw new Error(`Event Reporting - Item to be added has size ${o} bytes. Item cannot exceed max item size allowed of ${l.MAX_ITEM_SIZE_BYTES_ALLOWED} bytes.`);if(this.importantEvents.has(t))return this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - sending important event ${JSON.stringify(a)}`),void this.sendEventImmediately({name:t,ts:i,attributes:r});if(this.isFull())throw this.logger.warn("Event Reporting - Event buffer is full"),new Error("Buffer full");if(this.currentIngestionEvent.payloads.push(a),this.ingestionEventSize+=o,this.bufferItemThresholdReached(o)){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===l.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){return this.isEmpty()?[]:(e=Math.min(this.buffer.length,e+1),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,r={type:this.type,v:this.v,payloads:[Object.assign({name:t,ts:i},n)]};let a=!1,o=null;const s=this.makeRequestBody([r]);try{if(o=yield this.send(s),o.ok){try{const e=yield o.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - send successful event: ${s}, message: ${JSON.stringify(e)}`)}catch(e){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Error reading OK response ${e} for event ${s}`)}return}this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Failed to send an important event ${s} with response status ${o.status}`),a=!0}catch(e){this.logger.warn(`Event Reporting - There may be a failure in sending an important event ${s} to the ingestion endpoint ${e}.`),a=!0;try{if("firefox"===this.metadata.browserName.toLowerCase()){const e=this.makeBeaconRequestBody([r]);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - beaconing data out ${e}`),a=!navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,e)}}catch(e){this.logger.warn(`Event Reporting - Error sending beacon for an important event ${s}`),a=!0}}a&&(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - pushing to failed events ${s}`),this.failedIngestionEvents.push(r))}))}send(e){return n(this,void 0,void 0,(function*(){const t=new a.default(l.RETRY_FIXED_BACKOFF_WAIT_MS,l.RETRY_SHORT_BACKOFF_MS,l.RETRY_LONG_BACKOFF_MS);try{let i=0;for(;i0){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>0&&(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(e){this.logger.warn(`Event Reporting - Sending beacon data ${t} failed with error ${e}`)}}))}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=l,l.SENDING_FAILURE_CODES=new Set([408,429,500,502,503,504]),l.RETRY_FIXED_BACKOFF_WAIT_MS=0,l.RETRY_SHORT_BACKOFF_MS=1e3,l.RETRY_LONG_BACKOFF_MS=15e3,l.MAX_PAYLOAD_ITEMS=2,l.MAX_ITEM_SIZE_BYTES_ALLOWED=3e3},7700:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e=5e3,t=2,i=64,n=100,r=15){this.flushIntervalMs=e,this.flushSize=t,this.maxBufferCapacityKb=i,this.totalBufferItems=n,this.retryCountLimit=r}}},3831:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(2238),a=i(146),o=i(5680),s=i(6366),c=i(9385),l=i(7797),u=i(4046),d=i(731);class f{constructor(e,t,i){var n,a,o,s,c,l,u;this.meetingHistoryStates=[],this.observerSet=new Set,this.destroyed=!1,this.logger=t,this.configuration=e,this.setupEventReporter(e,t,i);try{this.parserResult=navigator&&navigator.userAgent?new r.UAParser(navigator.userAgent).getResult():null}catch(e){this.logger.error(e.message)}this.browserMajorVersion=(null===(o=null===(a=null===(n=this.parserResult)||void 0===n?void 0:n.browser)||void 0===a?void 0:a.version)||void 0===o?void 0:o.split(".")[0])||f.UNAVAILABLE,this.browserName=(null===(s=this.parserResult)||void 0===s?void 0:s.browser.name)||f.UNAVAILABLE,this.browserVersion=(null===(c=this.parserResult)||void 0===c?void 0:c.browser.version)||f.UNAVAILABLE,this.deviceName=[(null===(l=this.parserResult)||void 0===l?void 0:l.device.vendor)||"",(null===(u=this.parserResult)||void 0===u?void 0:u.device.model)||""].join(" ").trim()||f.UNAVAILABLE}addObserver(e){this.observerSet.add(e)}removeObserver(e){this.observerSet.delete(e)}forEachObserver(e){for(const t of this.observerSet)l.default.nextTick((()=>{this.observerSet.has(t)&&e(t)}))}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.forEachObserver((t=>{t.eventDidReceive(e,n)})),this.reportEvent(e,i,t)}))}reportEvent(e,t,i){var r;return n(this,void 0,void 0,(function*(){let n;try{i&&(n=d.default(i)),yield null===(r=this.eventReporter)||void 0===r?void 0:r.reportEvent(t,e,n)}catch(e){this.logger.error(`Error reporting event ${e}`)}}))}setupEventReporter(e,t,i){if(i)this._eventReporter=i;else if(e.urls){const i=e.urls.eventIngestionURL;if(i){this.logger.info("Event ingestion URL is present in the configuration");const{meetingId:n,credentials:{attendeeId:r,joinToken:a}}=e,l=new c.default(n,r,a),u=new o.default(l,i);this._eventReporter=new s.default(u,t)}}}getAttributes(e){var t,i;return{attendeeId:this.configuration.credentials.attendeeId,browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,externalMeetingId:"string"==typeof this.configuration.externalMeetingId?this.configuration.externalMeetingId:"",externalUserId:this.configuration.credentials.externalUserId,meetingHistory:this.meetingHistoryStates,meetingId:this.configuration.meetingId,osName:(null===(t=this.parserResult)||void 0===t?void 0:t.os.name)||f.UNAVAILABLE,osVersion:(null===(i=this.parserResult)||void 0===i?void 0:i.os.version)||f.UNAVAILABLE,sdkVersion:u.default.sdkVersion,sdkName:u.default.sdkName,timestampMs:e}}get eventReporter(){return this._eventReporter}destroy(){return n(this,void 0,void 0,(function*(){a.isDestroyable(this.eventReporter)&&(yield this.eventReporter.destroy()),this.logger=void 0,this.configuration=void 0,this._eventReporter=void 0,this.destroyed=!0}))}}t.default=f,f.UNAVAILABLE="Unavailable"},731:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=e=>{const t={};for(const[i,n]of Object.entries(e))if(null!=n&&""!==n){if("number"!=typeof n&&"string"!=typeof n)throw new TypeError("Unhandled type received while flattening attributes.");t[i]=n}return t}},5680:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(7700);t.default=class{constructor(e,t,i=new n.default){this.eventsClientConfiguration=e,this.ingestionURL=t,this.eventBufferConfiguration=i}}},6366:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(146),a=i(3520);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:r}=e,{eventsToIgnore:o}=i;this.eventBuffer=new a.default(r,i,n,this.importantEvents,t),this.logger=t,this.eventsToIgnore=o,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(e){this.logger.error(`Event Reporting - Error adding event to buffer ${e}`)}}))}destroy(){return n(this,void 0,void 0,(function*(){this.destroyed=!0,this.stop(),r.isDestroyable(this.eventBuffer)&&this.eventBuffer.destroy(),this.eventBuffer=void 0}))}}},732:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){}reportEvent(e,t,i){}start(){}stop(){}}},9385:(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}}},3204:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultEventController=t.DefaultDevicePixelRatioMonitor=t.DefaultDeviceController=t.DefaultContentShareController=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.ClientMetricReport=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.BackgroundReplacementVideoFrameProcessor=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.MeetingSessionCredentials=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.DefaultSimulcastUplinkPolicyForContentShare=t.DefaultSimulcastUplinkPolicy=t.DefaultSignalingClient=t.DefaultSigV4=t.DefaultSessionStateController=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.SDP=t.RunnableTask=t.ReconnectionHealthPolicy=t.ReceiveVideoStreamIndexTask=t.ReceiveVideoInputTask=t.ReceiveTURNCredentialsTask=t.ReceiveAudioInputTask=t.RealtimeVolumeIndicator=t.RealtimeState=t.RealtimeAttendeePositionInFrame=t.PromoteToPrimaryMeetingTask=t.PromiseQueue=t.PrefetchOn=t.PermissionDeniedError=t.ParallelGroupTask=t.POSTLogger=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.MeetingSessionLifecycleEventCondition=t.MeetingSessionLifecycleEvent=void 0,t.VideoStreamDescription=t.VideoSource=t.VideoQualitySettings=t.VideoPriorityBasedPolicyConfig=t.VideoPriorityBasedPolicy=t.VideoPreferences=t.VideoPreference=t.VideoOnlyTransceiverController=t.VideoLogEvent=t.VideoCodecCapability=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.SimulcastContentShareTransceiverController=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.ServerSideNetworkAdaption=t.SerialGroupTask=void 0,t.isVideoTransformDevice=t.isDestroyable=t.isAudioTransformDevice=t.ZLIBTextCompressor=t.WebSocketReadyState=t.WaitForAttendeePresenceTask=t.VoiceFocusTransformDevice=t.VoiceFocusDeviceTransformer=t.VideoTileState=void 0;const n=i(5185);t.AllHighestVideoBandwidthPolicy=n.default;const r=i(7535);t.ApplicationMetadata=r.default;const a=i(7797);t.AsyncScheduler=a.default;const o=i(8358);t.AttachMediaInputTask=o.default;const s=i(7602);t.Attendee=s.default;const c=i(9880);t.AudioLogEvent=c.default;const l=i(3765);t.AudioProfile=l.default;const u=i(1876);t.AudioVideoControllerState=u.default;const d=i(9734);t.BackgroundBlurStrength=d.default;const f=i(1260);t.BackgroundBlurVideoFrameProcessor=f.default;const C=i(4243);t.BackgroundFilterVideoFrameProcessor=C.default;const h=i(9854);t.BackgroundReplacementVideoFrameProcessor=h.default;const p=i(3940);t.BaseConnectionHealthPolicy=p.default;const m=i(1789);t.BaseTask=m.default;const v=i(9394);t.BitrateParameters=v.default;const g=i(7237);t.CSPMonitor=g.default;const b=i(9807);t.CanvasVideoFrameBuffer=b.default;const M=i(2084);t.CheckAudioConnectivityFeedback=M.default;const y=i(8892);t.CheckAudioInputFeedback=y.default;const S=i(9333);t.CheckAudioOutputFeedback=S.default;const L=i(1087);t.CheckCameraResolutionFeedback=L.default;const z=i(2606);t.CheckContentShareConnectivityFeedback=z.default;const w=i(7415);t.CheckNetworkTCPConnectivityFeedback=w.default;const V=i(4299);t.CheckNetworkUDPConnectivityFeedback=V.default;const H=i(6818);t.CheckVideoConnectivityFeedback=H.default;const k=i(1737);t.CheckVideoInputFeedback=k.default;const x=i(3216);t.CleanRestartedSessionTask=x.default;const _=i(7408);t.CleanStoppedSessionTask=_.default;const A=i(4571);t.ClientMetricReport=A.default;const T=i(6196);t.ClientMetricReportDirection=T.default;const E=i(9496);t.ClientMetricReportMediaType=E.default;const I=i(2770);t.ClientVideoStreamReceivingReport=I.default;const N=i(4531);t.ConnectionHealthData=N.default;const P=i(3731);t.ConnectionHealthPolicyConfiguration=P.default;const O=i(8030);t.ConsoleLogger=O.default;const R=i(8890);t.ContentShareConstants=R.default;const D=i(8370);t.ContentShareMediaStreamBroker=D.default;const B=i(5482);t.CreatePeerConnectionTask=B.default;const F=i(1129);t.CreateSDPTask=F.default;const j=i(1018);t.DataMessage=j.default;const U=i(8320);t.DefaultActiveSpeakerDetector=U.default;const W=i(2363);t.DefaultActiveSpeakerPolicy=W.default;const $=i(6802);t.DefaultAudioMixController=$.default;const q=i(9059);t.DefaultAudioVideoController=q.default;const G=i(8538);t.DefaultAudioVideoFacade=G.default;const K=i(543);t.DefaultBrowserBehavior=K.default;const J=i(8023);t.DefaultContentShareController=J.default;const Q=i(4142);t.DefaultDeviceController=Q.default;const Z=i(8236);t.DefaultDevicePixelRatioMonitor=Z.default;const Y=i(3831);t.DefaultEventController=Y.default;const X=i(6354);t.DefaultMediaDeviceFactory=X.default;const ee=i(6366);t.DefaultMeetingEventReporter=ee.default;const te=i(3980);t.DefaultMeetingReadinessChecker=te.default;const ie=i(4202);t.DefaultMeetingSession=ie.default;const ne=i(8947);t.DefaultMessagingSession=ne.default;const re=i(214);t.DefaultModality=re.default;const ae=i(7500);t.DefaultPingPong=ae.default;const oe=i(983);t.DefaultRealtimeController=oe.default;const se=i(9141);t.DefaultReconnectController=se.default;const ce=i(9678);t.DefaultSessionStateController=ce.default;const le=i(334);t.DefaultSigV4=le.default;const ue=i(1208);t.DefaultSignalingClient=ue.default;const de=i(4450);t.DefaultSimulcastUplinkPolicy=de.default;const fe=i(3879);t.DefaultSimulcastUplinkPolicyForContentShare=fe.default;const Ce=i(365);t.DefaultTransceiverController=Ce.default;const he=i(5308);t.DefaultTranscriptionController=he.default;const pe=i(8627);t.DefaultUserAgentParser=pe.default;const me=i(1133);t.DefaultVideoCaptureAndEncodeParameter=me.default;const ve=i(8919);t.DefaultVideoFrameProcessorPipeline=ve.default;const ge=i(1508);t.DefaultVideoStreamIdSet=ge.default;const be=i(1318);t.DefaultVideoStreamIndex=be.default;const Me=i(3327);t.DefaultVideoTile=Me.default;const ye=i(2958);t.DefaultVideoTileController=ye.default;const Se=i(4922);t.DefaultVideoTileFactory=Se.default;const Le=i(7673);t.DefaultVideoTransformDevice=Le.default;const ze=i(9751);t.DefaultVolumeIndicatorAdapter=ze.default;const we=i(7631);t.DefaultWebSocketAdapter=we.default;const Ve=i(9190);t.DevicePixelRatioWindowSource=Ve.default;const He=i(8128);t.DeviceSelection=He.default;const ke=i(7700);t.EventBufferConfiguration=ke.default;const xe=i(5680);t.EventIngestionConfiguration=xe.default;const _e=i(6240);t.FinishGatheringICECandidatesTask=_e.default;const Ae=i(8434);t.FullJitterBackoff=Ae.default;const Te=i(5640);t.FullJitterBackoffFactory=Te.default;const Ee=i(7300);t.FullJitterLimitedBackoff=Ee.default;const Ie=i(5348);t.GetUserMediaError=Ie.default;const Ne=i(2306);t.GlobalMetricReport=Ne.default;const Pe=i(3520);t.InMemoryJSONEventBuffer=Pe.default;const Oe=i(3922);t.IntervalScheduler=Oe.default;const Re=i(1960);t.JoinAndReceiveIndexTask=Re.default;const De=i(6180);t.LeaveAndReceiveLeaveAckTask=De.default;const Be=i(2748);t.ListenForVolumeIndicatorsTask=Be.default;const Fe=i(293);t.Log=Fe.default;const je=i(813);t.LogLevel=je.default;const Ue=i(4236);t.MediaDeviceProxyHandler=Ue.default;const We=i(9385);t.MeetingEventsClientConfiguration=We.default;const $e=i(3990);t.MeetingReadinessCheckerConfiguration=$e.default;const qe=i(589);t.MeetingSessionConfiguration=qe.default;const Ge=i(8015);t.MeetingSessionCredentials=Ge.default;const Ke=i(7604);t.MeetingSessionLifecycleEvent=Ke.default;const Je=i(1296);t.MeetingSessionLifecycleEventCondition=Je.default;const Qe=i(3789);t.MeetingSessionStatus=Qe.default;const Ze=i(5687);t.MeetingSessionStatusCode=Ze.default;const Ye=i(7215);t.MeetingSessionTURNCredentials=Ye.default;const Xe=i(6057);t.MeetingSessionURLs=Xe.default;const et=i(5723);t.MeetingSessionVideoAvailability=et.default;const tt=i(9358);t.Message=tt.default;const it=i(4323);t.MessagingSessionConfiguration=it.default;const nt=i(22);t.ModelSpecBuilder=nt.default;const rt=i(1981);t.MonitorTask=rt.default;const at=i(9938);t.MultiLogger=at.default;const ot=i(4442);t.NScaleVideoUplinkBandwidthPolicy=ot.default;const st=i(9836);t.NoOpAudioVideoController=st.default;const ct=i(209);t.NoOpDebugLogger=ct.default;const lt=i(6154);t.NoOpDeviceController=lt.default;const ut=i(732);t.NoOpEventReporter=ut.default;const dt=i(7434);t.NoOpLogger=dt.default;const ft=i(4015);t.NoOpMediaStreamBroker=ft.default;const Ct=i(8831);t.NoOpTask=Ct.default;const ht=i(3663);t.NoOpVideoElementFactory=ht.default;const pt=i(2801);t.NoOpVideoFrameProcessor=pt.default;const mt=i(5319);t.NoVideoDownlinkBandwidthPolicy=mt.default;const vt=i(657);t.NoVideoUplinkBandwidthPolicy=vt.default;const gt=i(1238);t.NotFoundError=gt.default;const bt=i(3110);t.NotReadableError=bt.default;const Mt=i(1124);t.OnceTask=Mt.default;const yt=i(4543);t.OpenSignalingConnectionTask=yt.default;const St=i(4842);t.OverconstrainedError=St.default;const Lt=i(5013);t.POSTLogger=Lt.default;const zt=i(8556);t.ParallelGroupTask=zt.default;const wt=i(6991);t.PermissionDeniedError=wt.default;const Vt=i(106);t.PrefetchOn=Vt.default;const Ht=i(1515);t.PromiseQueue=Ht.default;const kt=i(9945);t.PromoteToPrimaryMeetingTask=kt.default;const xt=i(5910);t.RealtimeAttendeePositionInFrame=xt.default;const _t=i(9825);t.RealtimeState=_t.default;const At=i(9576);t.RealtimeVolumeIndicator=At.default;const Tt=i(1209);t.ReceiveAudioInputTask=Tt.default;const Et=i(5547);t.ReceiveTURNCredentialsTask=Et.default;const It=i(120);t.ReceiveVideoInputTask=It.default;const Nt=i(9560);t.ReceiveVideoStreamIndexTask=Nt.default;const Pt=i(9708);t.ReconnectionHealthPolicy=Pt.default;const Ot=i(4191);t.RunnableTask=Ot.default;const Rt=i(326);t.SDP=Rt.default;const Dt=i(4076);t.SDPCandidateType=Dt.default;const Bt=i(1944);t.SDPMediaSection=Bt.default;const Ft=i(9485);t.SendAndReceiveDataMessagesTask=Ft.default;const jt=i(7079);t.SerialGroupTask=jt.default;const Ut=i(7103);t.ServerSideNetworkAdaption=Ut.default;const Wt=i(3860);t.SessionStateControllerAction=Wt.default;const $t=i(6850);t.SessionStateControllerDeferPriority=$t.default;const qt=i(9553);t.SessionStateControllerState=qt.default;const Gt=i(3013);t.SessionStateControllerTransitionResult=Gt.default;const Kt=i(4833);t.SetLocalDescriptionTask=Kt.default;const Jt=i(5275);t.SetRemoteDescriptionTask=Jt.default;const Qt=i(8581);t.SignalingAndMetricsConnectionMonitor=Qt.default;const Zt=i(3920);t.SignalingClientConnectionRequest=Zt.default;const Yt=i(2902);t.SignalingClientEvent=Yt.default;const Xt=i(9416);t.SignalingClientEventType=Xt.default;const ei=i(2168);t.SignalingClientJoin=ei.default;const ti=i(6729);t.SignalingClientSubscribe=ti.default;const ii=i(9101);t.SignalingClientVideoSubscriptionConfiguration=ii.default;const ni=i(7377);t.SimulcastContentShareTransceiverController=ni.default;const ri=i(7606);t.SimulcastLayers=ri.default;const ai=i(5785);t.SimulcastTransceiverController=ai.default;const oi=i(4242);t.SimulcastVideoStreamIndex=oi.default;const si=i(7786);t.SingleNodeAudioTransformDevice=si.default;const ci=i(2811);t.StreamMetricReport=ci.default;const li=i(5924);t.SubscribeAndReceiveSubscribeAckTask=li.default;const ui=i(2721);t.TargetDisplaySize=ui.default;const di=i(4456);t.TaskStatus=di.default;const fi=i(4929);t.TimeoutScheduler=fi.default;const Ci=i(250);t.TimeoutTask=Ci.default;const hi=i(4739);t.Transcript=hi.default;const pi=i(2471);t.TranscriptAlternative=pi.default;const mi=i(7210);t.TranscriptEntity=mi.default;const vi=i(1741);t.TranscriptItem=vi.default;const gi=i(6864);t.TranscriptItemType=gi.default;const bi=i(9063);t.TranscriptLanguageWithScore=bi.default;const Mi=i(5323);t.TranscriptResult=Mi.default;const yi=i(1288);t.TranscriptionStatus=yi.default;const Si=i(1326);t.TranscriptionStatusType=Si.default;const Li=i(6950);t.TypeError=Li.default;const zi=i(1922);t.UnusableAudioWarningConnectionHealthPolicy=zi.default;const wi=i(4046);t.Versioning=wi.default;const Vi=i(2880);t.VideoAdaptiveProbePolicy=Vi.default;const Hi=i(2330);t.VideoCodecCapability=Hi.default;const ki=i(155);t.VideoLogEvent=ki.default;const xi=i(9354);t.VideoOnlyTransceiverController=xi.default;const _i=i(1754);t.VideoPreference=_i.default;const Ai=i(1819);t.VideoPreferences=Ai.default;const Ti=i(4992);t.VideoPriorityBasedPolicy=Ti.default;const Ei=i(1034);t.VideoPriorityBasedPolicyConfig=Ei.default;const Ii=i(4500);t.VideoQualitySettings=Ii.default;const Ni=i(60);t.VideoSource=Ni.default;const Pi=i(6876);t.VideoStreamDescription=Pi.default;const Oi=i(7804);t.VideoTileState=Oi.default;const Ri=i(2497);t.VoiceFocusDeviceTransformer=Ri.default;const Di=i(8878);t.VoiceFocusTransformDevice=Di.default;const Bi=i(6171);t.WaitForAttendeePresenceTask=Bi.default;const Fi=i(7387);t.WebSocketReadyState=Fi.default;const ji=i(3320);t.ZLIBTextCompressor=ji.default;const Ui=i(1819);Object.defineProperty(t,"MutableVideoPreferences",{enumerable:!0,get:function(){return Ui.MutableVideoPreferences}});const Wi=i(8660);Object.defineProperty(t,"Some",{enumerable:!0,get:function(){return Wi.Some}}),Object.defineProperty(t,"None",{enumerable:!0,get:function(){return Wi.None}}),Object.defineProperty(t,"Maybe",{enumerable:!0,get:function(){return Wi.Maybe}});const $i=i(1746);Object.defineProperty(t,"isAudioTransformDevice",{enumerable:!0,get:function(){return $i.isAudioTransformDevice}});const qi=i(146);Object.defineProperty(t,"isDestroyable",{enumerable:!0,get:function(){return qi.isDestroyable}});const Gi=i(7170);Object.defineProperty(t,"isVideoTransformDevice",{enumerable:!0,get:function(){return Gi.isVideoTransformDevice}})},8030:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(813);t.default=class{constructor(e,t=n.default.WARN){this.name=e,this.level=t}info(e){this.log(n.default.INFO,e)}warn(e){this.log(n.default.WARN,e)}error(e){this.log(n.default.ERROR,e)}debug(e){n.default.DEBUG{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,i,n){this.sequenceNumber=e,this.message=t,this.timestampMs=i,this.logLevel=n}}},813:(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},9938:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(813);t.default=class{constructor(...e){this._loggers=e}info(e){for(const t of this._loggers)t.info(e)}warn(e){for(const t of this._loggers)t.warn(e)}error(e){for(const t of this._loggers)t.error(e)}debug(e){let t,i;i="string"==typeof e?e:e?()=>(t||(t=e()),t):""+e;for(const e of this._loggers)e.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}}},209:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(813),r=i(7434);class a extends r.default{constructor(){super(n.default.DEBUG)}}t.default=a},7434:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(813);t.default=class{constructor(e=n.default.OFF){this.level=e}info(e){}warn(e){}error(e){}debug(e){n.default.DEBUG{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){o.default.DEBUGn(this,void 0,void 0,(function*(){if(!0===this.lock||0===this.getLogCaptureSize())return;this.lock=!0;const e=this.logCapture.slice(0,this.batchSize),t=this.makeRequestBody(e);try{200===(yield fetch(this.url,Object.assign({method:"POST",body:t},this.headers?{headers:this.headers}:{}))).status&&(this.logCapture=this.logCapture.slice(e.length))}catch(e){console.warn("[POSTLogger] "+e.message)}finally{this.lock=!1}}))))}stop(){var e;null===(e=this.intervalScheduler)||void 0===e||e.stop(),this.intervalScheduler=void 0,this.removeEventListener();const t=this.makeRequestBody(this.logCapture);navigator.sendBeacon(this.url,t)}destroy(){return n(this,void 0,void 0,(function*(){this.stop(),this.metadata=void 0,this.headers=void 0,this.logCapture=[],this.sequenceNumber=0,this.lock=!1,this.batchSize=0,this.intervalMs=0,this.url=void 0}))}makeRequestBody(e){return JSON.stringify(Object.assign(Object.assign({},this.metadata),{logs:e}))}log(e,t){if(e{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(4236);t.default=class{constructor(){this.isMediaDevicesSupported="undefined"!=typeof navigator&&!!navigator.mediaDevices}create(){if(this.isMediaDevicesSupported)return new Proxy(navigator.mediaDevices,new n.default);throw new Error("navigator.mediaDevices is not supported")}}},4236:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(7797),a=i(3922);class o{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,r)=>{if("devicechange"!==t)return Reflect.apply(n,e,[t,i,r]);this.deviceChangeListeners.add(i),this.scheduler||(this.scheduler=new a.default(o.INTERVAL_MS),this.scheduler.start(this.pollDeviceLists))}},this.patchRemoveEventListener=(e,t,i)=>{const n=Reflect.get(e,t,i);return(t,i,r)=>{if("devicechange"!==t)return Reflect.apply(n,e,[t,i,r]);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();this.devices&&(e.length!==this.devices.length||e.some(((e,t)=>e.deviceId!==this.devices[t].deviceId)))&&this.handleDeviceChangeEvent(),this.devices=e}))}sortedDeviceList(){return n(this,void 0,void 0,(function*(){return(yield navigator.mediaDevices.enumerateDevices()).sort(((e,t)=>e.deviceIdt.deviceId?-1:0))}))}handleDeviceChangeEvent(){for(const e of this.deviceChangeListeners)r.default.nextTick((()=>{if(this.deviceChangeListeners.has(e)){const t=new Event("devicechange");"function"==typeof e?e(t):e.handleEvent(t)}}))}}t.default=o,o.INTERVAL_MS=1e3},4015:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{acquireAudioInputStream(){return Promise.reject()}acquireVideoInputStream(){return Promise.reject()}acquireDisplayInputStream(e){return Promise.reject()}muteLocalAudioInputStream(){}unmuteLocalAudioInputStream(){}addMediaStreamBrokerObserver(e){}removeMediaStreamBrokerObserver(e){}}},2084:(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},8892:(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},9333:(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},1087:(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},2606:(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},7415:(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:(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},6818:(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},1737:(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},3980:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(6802),a=i(543),o=i(4142),s=i(6991),c=i(1789),l=i(250),u=i(2084),d=i(8892),f=i(9333),C=i(1087),h=i(2606),p=i(7415),m=i(4299),v=i(6818),g=i(1737),b=i(3990);class M{constructor(e,t,i=new b.default){this.logger=e,this.meetingSession=t,this.configuration=i,this.browserBehavior=new a.default}static delay(e){return n(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))}))}checkAudioInput(e){return n(this,void 0,void 0,(function*(){try{return yield this.meetingSession.audioVideo.startAudioInput(e),yield this.meetingSession.audioVideo.stopAudioInput(),d.default.Succeeded}catch(e){return this.logger.error(`MeetingReadinessChecker: Audio input check failed with error ${e}`),e instanceof s.default?d.default.PermissionDenied:d.default.Failed}}))}checkAudioOutput(e,t,i=null){return n(this,void 0,void 0,(function*(){try{const n=e?o.default.getIntrinsicDeviceId(e):"";return yield this.playTone(n,440,i),(yield t())?f.default.Succeeded:f.default.Failed}catch(e){return this.logger.error(`MeetingReadinessChecker: Audio output check failed with error: ${e}`),f.default.Failed}finally{this.stopTone()}}))}playTone(e,t,i){return n(this,void 0,void 0,(function*(){this.oscillatorNode&&this.stopTone(),this.audioContext=o.default.getAudioContext(),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=0,this.oscillatorNode=this.audioContext.createOscillator(),this.oscillatorNode.frequency.value=t,this.oscillatorNode.connect(this.gainNode),this.destinationStream=this.audioContext.createMediaStreamDestination(),this.gainNode.connect(this.destinationStream);const n=this.audioContext.currentTime+.1;this.gainNode.gain.linearRampToValueAtTime(0,n),this.gainNode.gain.linearRampToValueAtTime(.1,n+.1),this.oscillatorNode.start();const a=new r.default(this.logger);try{this.browserBehavior.supportsSetSinkId()&&(yield a.bindAudioDevice({deviceId:e}))}catch(e){this.logger.error(`Failed to bind audio device: ${e}`)}try{yield a.bindAudioElement(i||new Audio)}catch(e){this.logger.error(`Failed to bind audio element: ${e}`)}yield a.bindAudioStream(this.destinationStream.stream)}))}stopTone(){if(!(this.audioContext&&this.gainNode&&this.oscillatorNode&&this.destinationStream))return;const e=this.audioContext.currentTime;this.gainNode.gain.linearRampToValueAtTime(.1,e+.1+1),this.gainNode.gain.linearRampToValueAtTime(0,e+.2+1),this.oscillatorNode.stop(),this.oscillatorNode.disconnect(this.gainNode),this.gainNode.disconnect(this.destinationStream),this.oscillatorNode=null,this.gainNode=null,this.destinationStream=null}checkVideoInput(e){return n(this,void 0,void 0,(function*(){try{return yield this.meetingSession.audioVideo.startVideoInput(e),yield this.meetingSession.audioVideo.stopVideoInput(),g.default.Succeeded}catch(e){return this.logger.error(`MeetingReadinessChecker: Video check failed with error ${e}`),e instanceof s.default?g.default.PermissionDenied:g.default.Failed}}))}checkCameraResolution(e,t,i){return n(this,void 0,void 0,(function*(){let n;try{const r=o.default.getIntrinsicDeviceId(e),a={video:this.calculateVideoConstraint(r,t,i)};n=yield navigator.mediaDevices.getUserMedia(a)}catch(e){return this.logger.error(`MeetingReadinessChecker: Camera resolution check with width: ${t} height ${i} failed with error ${e}`),e&&"OverconstrainedError"===e.name?C.default.ResolutionNotSupported:e&&"NotAllowedError"===e.name?C.default.PermissionDenied:C.default.Failed}finally{n&&n.getTracks().forEach((function(e){e.stop()}))}return C.default.Succeeded}))}calculateVideoConstraint(e,t,i){const n=this.browserBehavior.requiresResolutionAlignment(t,i),r={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?(r.deviceId=e,r.width=t,r.height=i):(r.deviceId={exact:e},r.width={exact:n[0]},r.height={exact:n[1]}),r}checkContentShareConnectivity(e){return n(this,void 0,void 0,(function*(){let t=!1,i=!1;const r={contentShareDidStart:()=>{t=!0}},a={audioVideoDidStart:()=>{i=!0}};try{return this.meetingSession.audioVideo.addObserver(a),this.meetingSession.audioVideo.start(),this.meetingSession.audioVideo.addContentShareObserver(r),yield this.meetingSession.audioVideo.startContentShareFromScreenCapture(e),yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){return i&&t})))),i?(yield this.stopMeeting(),t?h.default.Succeeded:h.default.TimedOut):h.default.ConnectionFailed}catch(e){return this.logger.error(`MeetingReadinessChecker: Content share check failed with error ${e}`),"NotAllowedError"===e.name?h.default.PermissionDenied:h.default.Failed}finally{this.meetingSession.audioVideo.removeObserver(a),this.meetingSession.audioVideo.stopContentShare(),this.meetingSession.audioVideo.removeContentShareObserver(r)}}))}checkAudioConnectivity(e){return n(this,void 0,void 0,(function*(){let t=!1;const i=this.meetingSession.audioVideo,r=(e,i,n,r)=>{e===this.meetingSession.configuration.credentials.attendeeId&&i&&(t=!0)};try{yield i.startAudioInput(e)}catch(e){return this.logger.error(`MeetingReadinessChecker: Failed to get audio input device with error ${e}`),e instanceof s.default?u.default.AudioInputPermissionDenied:u.default.AudioInputRequestFailed}return i.realtimeSubscribeToAttendeeIdPresence(r),(yield this.startMeeting())?(yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){return t})))),i.realtimeUnsubscribeToAttendeeIdPresence(r),yield this.stopMeeting(),yield this.meetingSession.audioVideo.stopAudioInput(),t?u.default.Succeeded:u.default.AudioNotReceived):(i.realtimeUnsubscribeToAttendeeIdPresence(r),yield this.meetingSession.audioVideo.stopAudioInput(),u.default.ConnectionFailed)}))}checkVideoConnectivity(e){return n(this,void 0,void 0,(function*(){const t=this.meetingSession.audioVideo;let i=0;const r={metricsDidReceive(e){e.getRTCStatsReport().forEach((e=>{"outbound-rtp"===e.type&&"video"===e.mediaType&&(i=e.packetsSent)}))}};try{yield t.startVideoInput(e)}catch(e){return this.logger.error(`MeetingReadinessChecker: Failed to get video input device with error ${e}`),e instanceof s.default?v.default.VideoInputPermissionDenied:v.default.VideoInputRequestFailed}return t.addObserver(r),(yield this.startMeeting())?(t.startLocalVideoTile(),yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){return i>0})))),yield t.stopVideoInput(),yield this.stopMeeting(),t.removeObserver(r),i<=0?v.default.VideoNotSent:v.default.Succeeded):v.default.ConnectionFailed}))}checkNetworkUDPConnectivity(){return n(this,void 0,void 0,(function*(){let e=!1;const t={metricsDidReceive(t){t.getRTCStatsReport().forEach((t=>{"candidate-pair"===t.type&&"succeeded"===t.state&&(e=!0)}))}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(e){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${e}`),m.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=e=>{const t=this.originalURLRewriter(e);return t.includes("transport=tcp")?"":t};const i=this.meetingSession.audioVideo;return i.addObserver(t),(yield this.startMeeting())?(yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){return e})))),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),i.removeObserver(t),e?m.default.Succeeded:m.default.ICENegotiationFailed):(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,m.default.ConnectionFailed)}))}checkNetworkTCPConnectivity(){return n(this,void 0,void 0,(function*(){let e=!1;const t={metricsDidReceive(t){t.getRTCStatsReport().forEach((t=>{"candidate-pair"===t.type&&"succeeded"===t.state&&(e=!0)}))}};try{this.originalURLRewriter=this.meetingSession.configuration.urls.urlRewriter}catch(e){return this.logger.error(`MeetingSessionConfiguration.urls doesn't exist. Error: ${e}`),p.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=e=>{const t=this.originalURLRewriter(e);return t.includes("transport=udp")?"":t};const i=this.meetingSession.audioVideo;return i.addObserver(t),(yield this.startMeeting())?(yield this.executeTimeoutTask((()=>n(this,void 0,void 0,(function*(){return e})))),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),i.removeObserver(t),e?p.default.Succeeded:p.default.ICENegotiationFailed):(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,p.default.ConnectionFailed)}))}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 c.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 M.delay(this.waitDurationMs)}}))}}const r=new l.default(this.logger,new i(this.logger,this.configuration.waitDurationMs),this.configuration.timeoutMs);return yield r.run(),t}))}}t.default=M},3990:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.timeoutMs=1e4,this.waitDurationMs=3e3}}},4202:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(9059),a=i(8538),o=i(8434),s=i(543),c=i(8370),l=i(8023),u=i(7237),d=i(146),f=i(3831),C=i(9141),h=i(7631);t.default=class{constructor(e,t,i,n){this._eventController=n,this._configuration=e,this._logger=t,this.checkBrowserSupportAndFeatureConfiguration(),u.default.addLogger(this._logger),u.default.register(),this._eventController||(this._eventController=new f.default(e,t)),i.eventController||(i.eventController=this.eventController),this.audioVideoController=new r.default(this._configuration,this._logger,new h.default(this._logger),i,new C.default(this._configuration.reconnectTimeoutMs,new o.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs)),this.eventController),this._deviceController=i;const s=new c.default(this._logger);this.contentShareController=new l.default(s,new r.default(l.default.createContentShareMeetingSessionConfigure(this._configuration),this._logger,new h.default(this._logger),s,new C.default(this._configuration.reconnectTimeoutMs,new o.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs))),this.audioVideoController),this.audioVideoFacade=new a.default(this.audioVideoController,this.audioVideoController.videoTileController,this.audioVideoController.realtimeController,this.audioVideoController.audioMixController,this._deviceController,this.contentShareController)}get configuration(){return this._configuration}get logger(){return this._logger}get audioVideo(){return this.audioVideoFacade}get contentShare(){return this.contentShareController}get deviceController(){return this._deviceController}get eventController(){return this._eventController}destroy(){return n(this,void 0,void 0,(function*(){d.isDestroyable(this.contentShareController)&&(yield this.contentShareController.destroy()),d.isDestroyable(this.audioVideoController)&&(yield this.audioVideoController.destroy()),d.isDestroyable(this.eventController)&&(yield this.eventController.destroy()),u.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._eventController=void 0}))}checkBrowserSupportAndFeatureConfiguration(){const e=new s.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()}.`),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)}}},589:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3731),r=i(8690),a=i(8015),o=i(6057);t.default=class{constructor(e,t){this.meetingId=null,this.externalMeetingId=null,this.credentials=null,this.urls=null,this.connectionTimeoutMs=15e3,this.attendeePresenceTimeoutMs=0,this.connectionHealthPolicyConfiguration=new n.default,this.reconnectTimeoutMs=12e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackOffMs=1e3,this.reconnectLongBackOffMs=5e3,this.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.videoDownlinkBandwidthPolicy=null,this.videoUplinkBandwidthPolicy=null,this.keepLastFrameWhenPaused=!1,e&&((e=r.toLowerCasePropertyNames(e)).meeting&&(e=e.meeting),this.meetingId=e.meetingid,this.externalMeetingId=e.externalmeetingid,this.urls=new o.default,this.urls.audioHostURL=e.mediaplacement.audiohosturl,this.urls.signalingURL=e.mediaplacement.signalingurl,this.urls.turnControlURL=e.mediaplacement.turncontrolurl,e.mediaplacement.eventingestionurl&&(this.urls.eventIngestionURL=e.mediaplacement.eventingestionurl)),t&&((t=r.toLowerCasePropertyNames(t)).attendee&&(t=t.attendee),this.credentials=new a.default,this.credentials.attendeeId=t.attendeeid,this.credentials.externalUserId=t.externaluserid,this.credentials.joinToken=t.jointoken)}}},8015:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.attendeeId=null,this.externalUserId=null,this.joinToken=null}toJSON(){return{attendeeId:this.attendeeId,joinToken:null===this.joinToken?null:""}}}},7604:(e,t)=>{"use strict";var 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},1296:(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},3789:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(289),r=i(5687);class a{constructor(e){this._statusCode=e}statusCode(){return this._statusCode}isFailure(){switch(this._statusCode){case r.default.AudioAuthenticationRejected:case r.default.AudioCallAtCapacity:case r.default.AudioInternalServerError:case r.default.AudioServiceUnavailable:case r.default.AudioDisconnected:case r.default.VideoCallAtSourceCapacity:case r.default.SignalingBadRequest:case r.default.SignalingInternalServerError:case r.default.SignalingRequestFailed:case r.default.ICEGatheringTimeoutWorkaround:case r.default.ConnectionHealthReconnect:case r.default.RealtimeApiFailed:case r.default.TaskFailed:case r.default.NoAttendeePresent:return!0;default:return!1}}isTerminal(){switch(this._statusCode){case r.default.Left:case r.default.AudioJoinedFromAnotherDevice:case r.default.AudioAuthenticationRejected:case r.default.AudioCallAtCapacity:case r.default.MeetingEnded:case r.default.AudioDisconnected:case r.default.TURNCredentialsForbidden:case r.default.SignalingBadRequest:case r.default.SignalingRequestFailed:case r.default.VideoCallAtSourceCapacity:case r.default.RealtimeApiFailed:case r.default.AudioAttendeeRemoved:return!0;default:return!1}}isAudioConnectionFailure(){switch(this._statusCode){case r.default.AudioAuthenticationRejected:case r.default.AudioInternalServerError:case r.default.AudioServiceUnavailable:case r.default.ICEGatheringTimeoutWorkaround:case r.default.SignalingBadRequest:case r.default.SignalingInternalServerError:case r.default.SignalingRequestFailed:case r.default.RealtimeApiFailed:case r.default.NoAttendeePresent:return!0;default:return!1}}toString(){switch(this._statusCode){case r.default.OK:return"Everything is OK so far.";case r.default.Left:return"The attendee left the meeting.";case r.default.AudioJoinedFromAnotherDevice:return"The attendee joined from another device.";case r.default.AudioAuthenticationRejected:return"The meeting rejected the attendee.";case r.default.AudioCallAtCapacity:return"The attendee couldn't join because the meeting was at capacity.";case r.default.MeetingEnded:return"The meeting ended.";case r.default.AudioInternalServerError:case r.default.AudioServiceUnavailable:case r.default.AudioDisconnected:return"The audio connection failed.";case r.default.VideoCallSwitchToViewOnly:return"The attendee couldn't start the local video because the maximum video capacity was reached.";case r.default.VideoCallAtSourceCapacity:return"The connection failed due to an internal server error.";case r.default.SignalingBadRequest:case r.default.SignalingInternalServerError:case r.default.SignalingRequestFailed:return"The signaling connection failed.";case r.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 r.default.ConnectionHealthReconnect:return"The meeting was reconnected.";case r.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 r.default.TaskFailed:return"The connection failed. See the error message for more details.";case r.default.IncompatibleSDP:return"The connection failed due to incompatible SDP.";case r.default.TURNCredentialsForbidden:return"The meeting ended, or the attendee was removed.";case r.default.NoAttendeePresent:return"The attendee was not present.";case r.default.AudioAttendeeRemoved:return"The meeting ended because attendee removed.";case r.default.AudioVideoWasRemovedFromPrimaryMeeting:return"The Primary meeting credentials provided are no longer valid. chime::DeleteAttendee may have been called on them.";case r.default.AudioDisconnectAudio:return"The audio connection failed.";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 a(r.default.SignalingRequestFailed):e.type===n.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE?new a(r.default.AudioVideoWasRemovedFromPrimaryMeeting):new a(r.default.OK)}static fromAudioStatus(e){switch(e){case 200:return new a(r.default.OK);case 301:return new a(r.default.AudioJoinedFromAnotherDevice);case 302:return new a(r.default.AudioDisconnectAudio);case 403:return new a(r.default.AudioAuthenticationRejected);case 409:return new a(r.default.AudioCallAtCapacity);case 410:return new a(r.default.MeetingEnded);case 411:return new a(r.default.AudioAttendeeRemoved);case 500:return new a(r.default.AudioInternalServerError);case 503:return new a(r.default.AudioServiceUnavailable);default:return 2===Math.floor(e/100)?new a(r.default.OK):new a(r.default.AudioDisconnected)}}static fromSignalingStatus(e){switch(e){case 206:return new a(r.default.VideoCallSwitchToViewOnly);case 509:return new a(r.default.VideoCallAtSourceCapacity);case 403:return new a(r.default.AudioAuthenticationRejected);case 409:return new a(r.default.AudioCallAtCapacity);default:switch(Math.floor(e/100)){case 2:return new a(r.default.OK);case 4:return new a(r.default.SignalingBadRequest);case 5:return new a(r.default.SignalingInternalServerError);default:return new a(r.default.SignalingRequestFailed)}}}}t.default=a},5687:(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.AudioAuthenticationRejected=3]="AudioAuthenticationRejected",e[e.AudioCallAtCapacity=4]="AudioCallAtCapacity",e[e.MeetingEnded=5]="MeetingEnded",e[e.AudioInternalServerError=6]="AudioInternalServerError",e[e.AudioServiceUnavailable=7]="AudioServiceUnavailable",e[e.AudioDisconnected=8]="AudioDisconnected",e[e.VideoCallSwitchToViewOnly=9]="VideoCallSwitchToViewOnly",e[e.VideoCallAtSourceCapacity=10]="VideoCallAtSourceCapacity",e[e.SignalingBadRequest=11]="SignalingBadRequest",e[e.SignalingInternalServerError=12]="SignalingInternalServerError",e[e.SignalingRequestFailed=13]="SignalingRequestFailed",e[e.ICEGatheringTimeoutWorkaround=14]="ICEGatheringTimeoutWorkaround",e[e.ConnectionHealthReconnect=15]="ConnectionHealthReconnect",e[e.RealtimeApiFailed=16]="RealtimeApiFailed",e[e.TaskFailed=17]="TaskFailed",e[e.IncompatibleSDP=18]="IncompatibleSDP",e[e.TURNCredentialsForbidden=19]="TURNCredentialsForbidden",e[e.NoAttendeePresent=20]="NoAttendeePresent",e[e.AudioAttendeeRemoved=21]="AudioAttendeeRemoved",e[e.AudioVideoWasRemovedFromPrimaryMeeting=22]="AudioVideoWasRemovedFromPrimaryMeeting",e[e.AudioDisconnectAudio=23]="AudioDisconnectAudio"}(i=t.MeetingSessionStatusCode||(t.MeetingSessionStatusCode={})),t.default=i},7215:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.username=null,this.password=null,this.ttl=null,this.uris=null}}},6057:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this._audioHostURL=null,this._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 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:(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},9358:(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}}},8947:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(8434),a=i(7237),o=i(9358),s=i(9141),c=i(7797),l=i(334),u=i(7631),d=i(7387),f=i(106);t.default=class{constructor(e,t,i,n,o){this.configuration=e,this.logger=t,this.webSocket=i,this.reconnectController=n,this.sigV4=o,this.observerQueue=new Set,this.webSocket||(this.webSocket=new u.default(this.logger)),this.reconnectController||(this.reconnectController=new s.default(e.reconnectTimeoutMs,new r.default(e.reconnectFixedWaitMs,e.reconnectShortBackoffMs,e.reconnectLongBackoffMs))),this.sigV4||(this.sigV4=new l.default(this.configuration.chimeClient)),a.default.addLogger(this.logger),a.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(){return n(this,void 0,void 0,(function*(){this.isClosed()?yield 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(),a.default.removeLogger(this.logger))}forEachObserver(e){for(const t of this.observerQueue)c.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*(){const t=yield this.prepareWebSocketUrl();this.logger.info(`opening connection to ${t}`),e||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),this.webSocket.create(t,[],!0),this.forEachObserver((t=>{t.messagingSessionDidStartConnecting&&t.messagingSessionDidStartConnecting(e)})),this.setUpEventListeners()}))}prepareWebSocketUrl(){return n(this,void 0,void 0,(function*(){const e=new Map;return e.set("userArn",[this.configuration.userArn]),e.set("sessionId",[this.configuration.messagingSessionId]),this.configuration.prefetchOn===f.default.Connect&&e.set("prefetch-on",[f.default.Connect]),yield this.sigV4.signURL("GET","wss","chime",this.configuration.endpointUrl,"/connect","",e)}))}isClosed(){return this.webSocket.readyState()===d.default.None||this.webSocket.readyState()===d.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 o.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(e){this.logger.error(`Messaging parsing failed: ${e}`)}}closeEventHandler(e){this.logger.info(`WebSocket close: ${e.code} ${e.reason}`),this.webSocket.destroy(),!this.isClosing&&this.canReconnect(e.code)&&this.reconnectController.retryWithBackoff((()=>n(this,void 0,void 0,(function*(){this.startConnecting(!0)}))),null)||(this.isClosing=!1,this.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}}},4323:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,i,n){this.userArn=e,this.messagingSessionId=t,this.endpointUrl=i,this.chimeClient=n,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()}}},106:(e,t)=>{"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Connect="connect"}(i||(i={})),t.default=i},214:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(8890);class r{constructor(e){this._id=e}id(){return this._id}base(){return this._id?this._id.split(r.MODALITY_SEPARATOR)[0]:""}modality(){if(!this._id)return"";const e=this._id.split(r.MODALITY_SEPARATOR);return 2===e.length?e[1]:""}hasModality(e){return""!==e&&this.modality()===e}withModality(e){const t=new r(this.base()+r.MODALITY_SEPARATOR+e);return""===e||""===this.base()||new r(t._id).modality()!==e?new r(this.base()):t}}t.default=r,r.MODALITY_SEPARATOR=n.default.Modality[0],r.MODALITY_CONTENT=n.default.Modality.substr(1)},7500:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(7797),r=i(3922),a=i(9416),o=i(289),s=i(8660);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 r.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=>{s.Maybe.of(e.didMissPongs).map((t=>t.bind(e)(this.consecutivePongsUnaccountedFor)))}))),this.consecutivePongsUnaccountedFor+=1,this.pingId=this.pingId+1&4294967295;const e=o.SdkPingPongFrame.create();e.pingId=this.pingId,e.type=o.SdkPingPongType.PING,this.pingTimestampLocalMs=this.signalingClient.pingPong(e),this.logger.debug((()=>`sent ping ${this.pingId}`))}pong(e){const t=o.SdkPingPongFrame.create();t.pingId=e,t.type=o.SdkPingPongType.PONG,this.signalingClient.pingPong(t)}handleSignalingClientEvent(e){switch(e.type){case a.default.WebSocketOpen:this.startPingInterval();break;case a.default.WebSocketFailed:case a.default.WebSocketError:this.logger.warn(`stopped pinging (${a.default[e.type]})`),this.stopPingInterval();break;case a.default.WebSocketClosing:case a.default.WebSocketClosed:this.logger.info(`stopped pinging (${a.default[e.type]})`),this.stopPingInterval();break;case a.default.ReceivedSignalFrame:if(e.message.type!==o.SdkSignalFrame.Type.PING_PONG)break;if(e.message.pingPong.type===o.SdkPingPongType.PONG){const t=e.message.pingPong.pingId;if(t!==this.pingId){this.logger.warn(`unexpected ping id ${t} (expected ${this.pingId})`);break}let 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,r=Math.round(i-n/2),a=this.pingTimestampLocalMs-r;this.logger.info(`local clock skew estimate=${a}ms from ping-pong time=${n}ms`),this.forEachObserver((e=>{s.Maybe.of(e.didReceivePong).map((i=>i.bind(e)(t,a,n)))}))}else this.pong(e.message.pingPong.pingId)}}}},983:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(5308),r=i(9825),a=i(9576);t.default=class{constructor(e,t){this.mediaStreamBroker=e,this.state=new r.default,this._transcriptionController=t||new n.default(this)}realtimeSetLocalAttendeeId(e,t){this.state.localAttendeeId=e,this.state.localExternalUserId=t}realtimeSetAttendeeIdPresence(e,t,i,n,r){try{t&&(this.state.attendeeIdToExternalUserId[e]=i);for(const a of this.state.attendeeIdChangesCallbacks)a(e,t,i,n,r)}catch(e){this.onError(e)}}realtimeSubscribeToAttendeeIdPresence(e){try{this.state.attendeeIdChangesCallbacks.push(e)}catch(e){this.onError(e)}}realtimeUnsubscribeToAttendeeIdPresence(e){try{const t=this.state.attendeeIdChangesCallbacks.indexOf(e);-1!==t&&this.state.attendeeIdChangesCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeSetCanUnmuteLocalAudio(e){try{if(this.state.canUnmute===e)return;this.state.canUnmute=e;for(const t of this.state.setCanUnmuteLocalAudioCallbacks)t(e)}catch(e){this.onError(e)}}realtimeSubscribeToSetCanUnmuteLocalAudio(e){try{this.state.setCanUnmuteLocalAudioCallbacks.push(e)}catch(e){this.onError(e)}}realtimeUnsubscribeToSetCanUnmuteLocalAudio(e){try{const t=this.state.setCanUnmuteLocalAudioCallbacks.indexOf(e);-1!==t&&this.state.setCanUnmuteLocalAudioCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeCanUnmuteLocalAudio(){return this.state.canUnmute}realtimeMuteLocalAudio(){if(!this.state.muted)try{this.setAudioInputEnabled(!1),this.state.muted=!0,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId);for(const e of this.state.muteAndUnmuteLocalAudioCallbacks)e(!0)}catch(e){this.onError(e)}}realtimeUnmuteLocalAudio(){if(!this.state.muted)return!0;if(!this.state.canUnmute)return!1;try{this.setAudioInputEnabled(!0),this.state.muted=!1,this.realtimeUpdateVolumeIndicator(this.state.localAttendeeId,null,null,null,this.state.localExternalUserId);for(const e of this.state.muteAndUnmuteLocalAudioCallbacks)e(!1);return!0}catch(e){return this.onError(e),!1}}realtimeSubscribeToMuteAndUnmuteLocalAudio(e){try{this.state.muteAndUnmuteLocalAudioCallbacks.push(e)}catch(e){this.onError(e)}}realtimeUnsubscribeToMuteAndUnmuteLocalAudio(e){try{const t=this.state.muteAndUnmuteLocalAudioCallbacks.indexOf(e);-1!==t&&this.state.muteAndUnmuteLocalAudioCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeIsLocalAudioMuted(){return this.state.muted}realtimeSubscribeToVolumeIndicator(e,t){try{this.state.volumeIndicatorCallbacks.hasOwnProperty(e)||(this.state.volumeIndicatorCallbacks[e]=[]),this.state.volumeIndicatorCallbacks[e].push(t),this.sendVolumeIndicatorChange(e,!0,!0,!0,this.state.attendeeIdToExternalUserId[e])}catch(e){this.onError(e)}}realtimeUnsubscribeFromVolumeIndicator(e,t){if(this.state.volumeIndicatorCallbacks[e])if(t){const i=this.state.volumeIndicatorCallbacks[e].indexOf(t);i>=0&&this.state.volumeIndicatorCallbacks[e].splice(i,1)}else delete this.state.volumeIndicatorCallbacks[e]}realtimeUpdateVolumeIndicator(e,t,i,n,r){try{i=this.applyLocalMuteOverride(e,i);const a=this.getVolumeIndicatorState(e);let o=!1,s=!1,c=!1;null!==i&&a.muted!==i&&(a.muted=i,s=!0,a.muted&&0!==a.volume&&(a.volume=0,o=!0)),a.muted||null===t||(a.volume!==t&&(a.volume=t,o=!0),null===a.muted&&(a.muted=!1,s=!0)),null!==n&&a.signalStrength!==n&&(a.signalStrength=n,c=!0),this.sendVolumeIndicatorChange(e,o,s,c,r)}catch(e){this.onError(e)}}realtimeSubscribeToLocalSignalStrengthChange(e){try{if(this.state.localSignalStrengthChangeCallbacks.push(e),null===this.state.localAttendeeId)return;this.sendLocalSignalStrengthChange(this.state.localAttendeeId,!0)}catch(e){this.onError(e)}}realtimeUnsubscribeToLocalSignalStrengthChange(e){try{const t=this.state.localSignalStrengthChangeCallbacks.indexOf(e);-1!==t&&this.state.localSignalStrengthChangeCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeSubscribeToSendDataMessage(e){try{this.state.sendDataMessageCallbacks.push(e)}catch(e){this.onError(e)}}realtimeUnsubscribeFromSendDataMessage(e){try{const t=this.state.sendDataMessageCallbacks.indexOf(e);-1!==t&&this.state.sendDataMessageCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeSendDataMessage(e,t,i){try{for(const n of this.state.sendDataMessageCallbacks)n(e,t,i)}catch(e){this.onError(e)}}realtimeSubscribeToReceiveDataMessage(e,t){try{this.state.receiveDataMessageCallbacks.has(e)?this.state.receiveDataMessageCallbacks.get(e).push(t):this.state.receiveDataMessageCallbacks.set(e,[t])}catch(e){this.onError(e)}}realtimeUnsubscribeFromReceiveDataMessage(e){try{this.state.receiveDataMessageCallbacks.delete(e)}catch(e){this.onError(e)}}realtimeReceiveDataMessage(e){try{if(this.state.receiveDataMessageCallbacks.has(e.topic))for(const t of this.state.receiveDataMessageCallbacks.get(e.topic))t(e)}catch(e){this.onError(e)}}realtimeSubscribeToFatalError(e){try{this.state.fatalErrorCallbacks.push(e)}catch(e){this.onError(e)}}realtimeUnsubscribeToFatalError(e){try{const t=this.state.fatalErrorCallbacks.indexOf(e);-1!==t&&this.state.fatalErrorCallbacks.splice(t,1)}catch(e){this.onError(e)}}get transcriptionController(){return this._transcriptionController}setAudioInputEnabled(e){e?this.mediaStreamBroker.unmuteLocalAudioInputStream():this.mediaStreamBroker.muteLocalAudioInputStream()}applyLocalMuteOverride(e,t){const i=this.state.localAttendeeId,n=this.state.muted;return e!==i?t:"activeDevices"in this.mediaStreamBroker&&this.mediaStreamBroker.activeDevices.audio?n:t}sendVolumeIndicatorChange(e,t,i,n,r){if(this.sendLocalSignalStrengthChange(e,n),!this.state.volumeIndicatorCallbacks.hasOwnProperty(e))return;const o=this.getVolumeIndicatorState(e),s=new a.default;if(t&&(s.volume=o.volume),i&&(s.muted=o.muted),n&&(s.signalStrength=o.signalStrength),!this.stateIsEmpty(s))for(const t of this.state.volumeIndicatorCallbacks[e])t(e,s.volume,s.muted,s.signalStrength,r)}sendLocalSignalStrengthChange(e,t){if(!t)return;if(e!==this.state.localAttendeeId)return;const i=this.getVolumeIndicatorState(e).signalStrength;if(null!==i)for(const e of this.state.localSignalStrengthChangeCallbacks)e(i)}getVolumeIndicatorState(e){return this.state.volumeIndicatorState.hasOwnProperty(e)||(this.state.volumeIndicatorState[e]=new a.default),this.state.volumeIndicatorState[e]}stateIsEmpty(e){return null===e.volume&&null===e.muted&&null===e.signalStrength}onError(e){try{for(const t of this.state.fatalErrorCallbacks)t(e)}catch(t){try{console.error(e),console.error(t)}catch(e){}}}}},5910:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.attendeeIndex=null,this.attendeesInFrame=null}}},9825:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.localAttendeeId=null,this.localExternalUserId=null,this.attendeeIdChangesCallbacks=[],this.canUnmute=!0,this.setCanUnmuteLocalAudioCallbacks=[],this.muted=!1,this.muteAndUnmuteLocalAudioCallbacks=[],this.volumeIndicatorState={},this.attendeeIdToExternalUserId={},this.volumeIndicatorCallbacks={},this.localSignalStrengthChangeCallbacks=[],this.fatalErrorCallbacks=[],this.sendDataMessageCallbacks=[],this.receiveDataMessageCallbacks=new Map}}},9576:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.volume=null,this.muted=null,this.signalStrength=null}}},9141:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(4929);class r{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 r(this.reconnectTimeoutMs,this.backoffPolicy)}setLastActiveTimestampMs(e){this.lastActiveTimestampMs=e}}t.default=r},7797:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(4929);class r extends n.default{constructor(){super(0)}static nextTick(e){setTimeout(e,0)}}t.default=r},3922:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.intervalMs=e}start(e){this.stop(),this.timer=setInterval(e,this.intervalMs)}stop(){void 0!==this.timer&&(clearInterval(this.timer),this.timer=void 0)}running(){return void 0!==this.timer}}},4929:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.timeoutMs=e,this.timer=null}start(e){this.stop(),this.timer=setTimeout((()=>{clearTimeout(this.timer),e()}),this.timeoutMs)}stop(){null!==this.timer&&(clearTimeout(this.timer),this.timer=null)}}},326:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(4076),r=i(1944),a=i(2330);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||-1===n.indexOf("sendonly")&&-1===n.indexOf("recvonly")&&-1===n.indexOf("inactive"))){i=!0;break}t++}return!1===i&&(t=-1),t}static extractSSRCsFromFIDGroupLine(e){return/^a=ssrc-group:FID\s(.+)/.exec(e)[1]}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)}withoutCandidateType(e){return o.linesToSDP(this.lines().filter((t=>o.candidateType(t)!==e)))}withoutServerReflexiveCandidates(){return this.withoutCandidateType(n.default.ServerReflexive)}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 r of e)if(r.startsWith("m=audio")&&(n.push(null),i=!0),r.startsWith("m=video")&&(i=!1),i){const e=t.exec(r);null!==e&&(n[n.length-1]=`a=fmtp:${e[1]} `)}return n}static updateOpusFmtpAttributes(e,t,i){const n=[];let r=0,a=null;for(const o of e)if(o.startsWith("m=audio")&&(a=t[r],r++),o.startsWith("m=video")&&(a=null),a&&o.startsWith(a)){const e=o.slice(a.length).split(";"),t=[];for(const n of e)i.findIndex((e=>e.startsWith(n.split("=")[0])))<0&&t.push(n);for(const e of i)t.push(e);n.push(a+t.join(";"))}else n.push(o);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 i of e)if(/^a=extmap:/.test(i.trim())){const e=+i.split("a=extmap:")[1].split(" ")[0];t.includes(e)||t.push(e)}t.sort(((e,t)=>e-t));let i=0;for(const e of t){if(e-i>1)return i+1;i=e}return 14===i?-1:i+1}withVideoLayersAllocationRtpHeaderExtension(e){const t="http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00",i=e?e.getRtpHeaderExtensionId(t):-1,n=-1===i?this.getUniqueRtpHeaderExtensionId(o.splitLines(this.sdp)):i,r=o.splitSections(this.sdp),a=[];for(let e of r){if(/^m=video/.test(e)&&-1===o.getRtpHeaderExtensionIdInSection(e,t)){const i=o.splitLines(e),r=[];if(-1===n||this.hasRtpHeaderExtensionId(n)){a.push(e);continue}for(const e of i)if(r.push(e),/^a=sendrecv/.test(e.trim())){const e="a=extmap:"+n+" "+t;r.push(e)}e=r.join(o.CRLF)+o.CRLF}else if(-1!==i&&/^m=video/.test(e)&&o.getRtpHeaderExtensionIdInSection(e,t)!==i){const n=o.splitLines(e),r=[];for(const e of n)if(/^a=extmap:/.test(e.trim())&&e.split("a=extmap:")[1].split(" ")[1]===t){if(!this.hasRtpHeaderExtensionId(i)){const e="a=extmap:"+i+" "+t;r.push(e)}}else r.push(e);e=r.join(o.CRLF)+o.CRLF}a.push(e)}const s=a.join("");return new o(s)}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 r=o.extractSSRCsFromFIDGroupLine(n[0]),[a]=r.split(" ").map((e=>parseInt(e,10)));return a.toString()}videoSendSectionHasDifferentSSRC(e){const t=this.ssrcForVideoSendingSection(),i=e.ssrcForVideoSendingSection();return""!==t&&""!==i&&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],r=o.splitLines(n),a=[],s=new Map;r.forEach((e=>{if(/^a=rtpmap:/.test(e)){const t=/^a=rtpmap:([0-9]+)\s/.exec(e);t&&e.toLowerCase().includes("h264")&&a.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);s.has(i)?s.get(i).push(e):s.set(i,[e])}}}));const c=new Set;for(const e of a){c.add(e);const t=s.get(e);if(t)for(const e of t)c.add(e)}if(a.length>0){const e=r[0].split(" ");r[0]=e.filter((e=>!c.has(parseInt(e)))).join(" ")}const l=r.filter((e=>{if(!e.includes("rtpmap")&&!e.includes("rtcp-fb")&&!e.includes("fmtp"))return!0;for(const t of c)if(e.includes(t.toString()))return!1;return!0}));t[i]=l.join(o.CRLF)+o.CRLF;const u=t.join("");return new o(u)}mediaSections(){const e=o.splitSections(this.sdp);if(e.length<2)return[];const t=[];for(let i=1;i{if(/^a=rtpmap:/.test(e))for(const r of t){if(!e.includes(`${r.codecName}/${r.codecCapability.clockRate}`))continue;const t=/^a=rtpmap:([0-9]+)\s/.exec(e);let a=!1;if(void 0!==r.codecCapability.sdpFmtpLine){for(const e of n)if(e.startsWith(`a=fmtp:${t[1]} ${r.codecCapability.sdpFmtpLine}`)){a=!0;break}}else a=!0;if(a){i.set(r.codecName,t[1]);break}}}));const r=new Set(i.values()),a=n[0].split(" ").filter((e=>!r.has(e))),s=Array.from(i.values()).sort(((e,n)=>t.findIndex((t=>i.get(t.codecName)===e))-t.findIndex((e=>i.get(e.codecName)===n))));return a.splice(3,0,...s.values()),n[0]=a.join(" "),n.join(o.CRLF)+o.CRLF}highestPriorityVideoSendCodec(){const e=this.sdp,t=o.splitSections(e),i=o.findActiveCameraSection(t);if(-1===i)return;const n=o.splitLines(t[i]),r=n[0].split(" ");if(r.length<4)return;const s=r[3];let c,l,u;for(const e of n){const t=/^a=rtpmap:([0-9]+)\s/.exec(e);if(null===t||t.length<2||t[1]!==s)continue;const i=e.split(" ")[1].split("/");if(!(void 0===i||i.length<2)){c=i[0],l=i[1];for(const e of n)if(e.startsWith(`a=fmtp:${s}`)){const t=e.split(" ");if(void 0===t||t.length<2)return;u=t[1]}break}}return void 0!==c?new a.default(c,{clockRate:parseInt(l),mimeType:`video/${c}`,sdpFmtpLine:u}):void 0}}t.default=o,o.CRLF="\r\n",o.rfc7587LowestBitrate=6e3,o.rfc7587HighestBitrate=51e4},4076:(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},1944:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},2330:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(289);class r{constructor(e,t){this.codecName=e,this.codecCapability=t}equals(e){return void 0!==e&&this.codecName===e.codecName&&this.codecCapability.mimeType===e.codecCapability.mimeType&&this.codecCapability.clockRate===e.codecCapability.clockRate&&this.codecCapability.sdpFmtpLine===e.codecCapability.sdpFmtpLine}static vp8(){return new r("VP8",{clockRate:9e4,mimeType:"video/VP8"})}static h264ConstrainedBaselineProfile(){return new r("H264",{clockRate:9e4,mimeType:"video/H264",sdpFmtpLine:"level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"})}static h264(){return this.h264ConstrainedBaselineProfile()}static fromSignaled(e){switch(e){case n.SdkVideoCodecCapability.VP8:return this.vp8();case n.SdkVideoCodecCapability.H264_CONSTRAINED_BASELINE_PROFILE:return this.h264ConstrainedBaselineProfile();default:return}}}t.default=r},3320:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(9591);class r{constructor(e){this.logger=e}compress(e,t){if(t.length>0){const e=Math.min(t.length,r.MAX_DICTIONARY_SIZE);t=t.slice(0,e)}const i={memLevel:r.Z_MEM_LEVEL,dictionary:t};return n.deflateRaw(e,i)}decompress(e,t){if(t.length>0){const e=Math.min(t.length,r.MAX_DICTIONARY_SIZE);t=t.slice(0,e)}const i={to:"string",dictionary:t,chunkSize:4096};let a="";try{a=n.inflateRaw(e,i)}catch(e){this.logger.error(`failed to decompress the string with error: [${e}]`)}return a}}t.default=r,r.Z_MEM_LEVEL=9,r.MAX_DICTIONARY_SIZE=31744},9678:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3860),r=i(6850),a=i(9553),o=i(3013);t.default=class{constructor(e){this.logger=e,this.currentState=a.SessionStateControllerState.NotConnected,this.deferredAction=null,this.deferredWork=null}perform(e,t){const i=this.currentState;if(i===a.SessionStateControllerState.NotConnected&&e===n.SessionStateControllerAction.Connect)this.transition(a.SessionStateControllerState.Connecting,e);else if(i===a.SessionStateControllerState.Connecting&&e===n.SessionStateControllerAction.Fail)this.transition(a.SessionStateControllerState.Disconnecting,e);else if(i===a.SessionStateControllerState.Connecting&&e===n.SessionStateControllerAction.FinishConnecting)this.transition(a.SessionStateControllerState.Connected,e);else if(i===a.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Disconnect)this.transition(a.SessionStateControllerState.Disconnecting,e);else if(i===a.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Reconnect)this.transition(a.SessionStateControllerState.Connecting,e);else if(i===a.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Fail)this.transition(a.SessionStateControllerState.Disconnecting,e);else if(i===a.SessionStateControllerState.Connected&&e===n.SessionStateControllerAction.Update)this.transition(a.SessionStateControllerState.Updating,e);else if(i===a.SessionStateControllerState.Updating&&e===n.SessionStateControllerAction.Fail)this.transition(a.SessionStateControllerState.Disconnecting,e);else if(i===a.SessionStateControllerState.Updating&&e===n.SessionStateControllerAction.FinishUpdating)this.transition(a.SessionStateControllerState.Connected,e);else{if(i!==a.SessionStateControllerState.Disconnecting||e!==n.SessionStateControllerAction.FinishDisconnecting)return this.canDefer(e)?(this.logger.info(`deferring transition from ${a.SessionStateControllerState[this.currentState]} with ${n.SessionStateControllerAction[e]}`),this.deferAction(e,t),o.SessionStateControllerTransitionResult.DeferredTransition):(this.logger.warn(`no transition found from ${a.SessionStateControllerState[this.currentState]} with ${n.SessionStateControllerAction[e]}`),o.SessionStateControllerTransitionResult.NoTransitionAvailable);this.transition(a.SessionStateControllerState.NotConnected,e)}try{t()}catch(t){return this.logger.error(`error during state ${a.SessionStateControllerState[this.currentState]} with action ${n.SessionStateControllerAction[e]}: ${t}`),this.logger.info(`rolling back transition to ${a.SessionStateControllerState[i]}`),this.currentState=i,o.SessionStateControllerTransitionResult.TransitionFailed}return this.performDeferredAction(),o.SessionStateControllerTransitionResult.Transitioned}state(){return this.currentState}transition(e,t){this.logger.info(`transitioning from ${a.SessionStateControllerState[this.currentState]} to ${a.SessionStateControllerState[e]} with ${n.SessionStateControllerAction[t]}`),this.currentState=e}deferPriority(e){switch(e){case n.SessionStateControllerAction.Disconnect:return r.SessionStateControllerDeferPriority.VeryHigh;case n.SessionStateControllerAction.Fail:return r.SessionStateControllerDeferPriority.High;case n.SessionStateControllerAction.Reconnect:return r.SessionStateControllerDeferPriority.Medium;case n.SessionStateControllerAction.Update:return r.SessionStateControllerDeferPriority.Low;default:return r.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)!==r.SessionStateControllerDeferPriority.DoNotDefer&&(this.currentState===a.SessionStateControllerState.Connecting||this.currentState===a.SessionStateControllerState.Updating)}performDeferredAction(){if(!this.deferredAction)return;const e=this.deferredAction,t=this.deferredWork;this.deferredAction=null,this.deferredWork=null,this.logger.info(`performing deferred action ${n.SessionStateControllerAction[e]}`),this.perform(e,t)!==o.SessionStateControllerTransitionResult.Transitioned&&this.logger.info(`unable to perform deferred action ${n.SessionStateControllerAction[e]} in state ${a.SessionStateControllerState[this.currentState]}`)}}},3860:(e,t)=>{"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.SessionStateControllerAction=void 0,function(e){e[e.Connect=0]="Connect",e[e.FinishConnecting=1]="FinishConnecting",e[e.Update=2]="Update",e[e.FinishUpdating=3]="FinishUpdating",e[e.Reconnect=4]="Reconnect",e[e.Disconnect=5]="Disconnect",e[e.Fail=6]="Fail",e[e.FinishDisconnecting=7]="FinishDisconnecting"}(i=t.SessionStateControllerAction||(t.SessionStateControllerAction={})),t.default=i},6850:(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},9553:(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},3013:(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},1208:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(543),r=i(4929),a=i(289),o=i(4046),s=i(7387),c=i(7103),l=i(2902),u=i(9416);class d{constructor(e,t){this.webSocket=e,this.logger=t,this.unloadHandler=null,this.closeEventHandler=e=>{this.deactivatePageUnloadHandler(),this.resetConnection(),this.sendEvent(new l.default(this,u.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=a.SdkSignalFrame.create();return t.type=a.SdkSignalFrame.Type.PING_PONG,t.pingPong=e,this.sendMessage(t),t.timestampMs}join(e){this.logger.info("sending join");const t=a.SdkJoinFrame.create();t.protocolVersion=2,t.flags=a.SdkJoinFlags.HAS_STREAM_UPDATE;const i=new n.default,r={platformName:i.name(),platformVersion:i.version(),clientSource:o.default.sdkName,chimeSdkVersion:o.default.sdkVersion};if(e.applicationMetadata){const{appName:t,appVersion:i}=e.applicationMetadata;r.appName=t,r.appVersion=i}t.clientDetails=a.SdkClientDetails.create(r),t.audioSessionId=this.audioSessionId,t.wantsCompressedSdp=d.CLIENT_SUPPORTS_COMPRESSION,t.serverSideNetworkAdaption=c.convertServerSideNetworkAdaptionEnumToSignaled(e.serverSideNetworkAdaption),e.serverSideNetworkAdaption===c.default.BandwidthProbing&&(t.wantsServerSideNetworkProbingOnReceiveSideEstimator=!0),t.supportedServerSideNetworkAdaptions=e.supportedServerSideNetworkAdaptions.map(c.convertServerSideNetworkAdaptionEnumToSignaled);const s=a.SdkSignalFrame.create();s.type=a.SdkSignalFrame.Type.JOIN,s.join=t,this.sendMessage(s)}subscribe(e){const t=a.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=a.SdkStreamDescriptor.create();i.mediaType=a.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=a.SdkStreamServiceType.RX,e.localVideoEnabled){t.duplex=a.SdkStreamServiceType.DUPLEX;for(let i=0;i0&&(t.videoSubscriptionConfiguration=e.videoSubscriptionConfiguration.map(this.convertVideoSubscriptionConfiguration));const i=a.SdkSignalFrame.create();i.type=a.SdkSignalFrame.Type.SUBSCRIBE,i.sub=t,this.sendMessage(i)}remoteVideoUpdate(e,t){const i=a.SdkRemoteVideoUpdateFrame.create();i.addedOrUpdatedVideoSubscriptions=e.map(this.convertVideoSubscriptionConfiguration),i.removedVideoSubscriptionMids=t;const n=a.SdkSignalFrame.create();n.type=a.SdkSignalFrame.Type.REMOTE_VIDEO_UPDATE,n.remoteVideoUpdate=i,this.sendMessage(n)}convertVideoSubscriptionConfiguration(e){const t=new a.SdkVideoSubscriptionConfiguration;return t.mid=e.mid,t.attendeeId=e.attendeeId,t.streamId=e.streamId,t.groupId=e.groupId,t.priority=e.priority,t.targetBitrateKbps=e.targetBitrateKbps,t}leave(){const e=a.SdkSignalFrame.create();e.type=a.SdkSignalFrame.Type.LEAVE,e.leave=a.SdkLeaveFrame.create(),this.sendMessage(e),this.logger.debug((()=>"sent leave"))}sendClientMetrics(e){const t=a.SdkSignalFrame.create();t.type=a.SdkSignalFrame.Type.CLIENT_METRIC,t.clientMetric=e,this.sendMessage(t)}sendDataMessage(e){const t=a.SdkSignalFrame.create();t.type=a.SdkSignalFrame.Type.DATA_MESSAGE,t.dataMessage=e,this.sendMessage(t)}closeConnection(){var e,t;if(this.webSocket.readyState()!==s.default.None&&this.webSocket.readyState()!==s.default.Closed){this.isClosing=!0,this.sendEvent(new l.default(this,u.default.WebSocketClosing,null));const i=new r.default(d.CLOSE_EVENT_TIMEOUT_MS),n=e=>{var t,r;null===(r=(t=this.webSocket).removeEventListener)||void 0===r||r.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}))})),this.webSocket.close(),this.deactivatePageUnloadHandler()}else this.logger.info("no existing signaling client connection needs closing"),this.serviceConnectionRequestQueue()}ready(){return this.webSocket.readyState()===s.default.Open&&!this.isClosing&&this.wasOpened}mute(e){const t=a.SdkSignalFrame.create();t.type=a.SdkSignalFrame.Type.AUDIO_CONTROL;const i=a.SdkAudioControlFrame.create();i.muted=e,t.audioControl=i,this.sendMessage(t)}pause(e){const t=a.SdkSignalFrame.create();t.type=a.SdkSignalFrame.Type.PAUSE,t.pause=a.SdkPauseResumeFrame.create(),t.pause.streamIds=e,this.sendMessage(t)}resume(e){const t=a.SdkSignalFrame.create();t.type=a.SdkSignalFrame.Type.RESUME,t.pause=a.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(a.SdkSignalFrame.encode(e).finish());if(this.ready()){if(!this.webSocket.send(t))return void this.sendEvent(new l.default(this,u.default.WebSocketSendMessageFailure,null));this.sendEvent(new l.default(this,u.default.WebSocketSentMessage,null))}else this.sendEvent(new l.default(this,u.default.WebSocketSkippedMessage,null))}receiveMessage(e){let t;try{t=a.SdkSignalFrame.decode(e)}catch(t){return this.logger.info(`failed to decode: ${e}`),void this.sendEvent(new l.default(this,u.default.ProtocolDecodeFailure,null))}this.logger.debug((()=>`received: ${JSON.stringify(t)}`)),this.webSocket.readyState()===s.default.Open?this.sendEvent(new l.default(this,u.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!==d.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]=d.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 l.default(this,u.default.WebSocketConnecting,null))}sendEvent(e){switch(e.type){case u.default.WebSocketMessage:case u.default.ReceivedSignalFrame:case u.default.WebSocketSentMessage:this.logger.debug((()=>`notifying event: ${u.default[e.type]}`));break;case u.default.WebSocketSkippedMessage:this.logger.debug((()=>`notifying event: ${u.default[e.type]}, websocket state=${s.default[this.webSocket.readyState()]}`));break;default:this.logger.info(`notifying event: ${u.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 l.default(this,u.default.WebSocketOpen,null))})),this.webSocket.addEventListener("message",(e=>{this.sendEvent(new l.default(this,u.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 l.default(this,u.default.WebSocketError,null))):(this.logger.error("failed to connect"),this.sendEvent(new l.default(this,u.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.removeEventListener&&window.removeEventListener("unload",this.unloadHandler),this.unloadHandler=null}generateNewAudioSessionId(){const e=new Uint32Array(1);return window.crypto.getRandomValues(e)[0]}promoteToPrimaryMeeting(e){const t=a.SdkMeetingSessionCredentials.create();t.attendeeId=e.attendeeId,t.externalUserId=e.externalUserId,t.joinToken=e.joinToken;const i=a.SdkPrimaryMeetingJoinFrame.create();i.credentials=t;const n=a.SdkSignalFrame.create();n.type=a.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN,n.primaryMeetingJoin=i,this.sendMessage(n)}demoteFromPrimaryMeeting(){const e=a.SdkPrimaryMeetingLeaveFrame.create(),t=a.SdkSignalFrame.create();t.type=a.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE,t.primaryMeetingLeave=e,this.sendMessage(t)}}t.default=d,d.FRAME_TYPE_RTC=5,d.CLOSE_EVENT_TIMEOUT_MS=2e3,d.CLIENT_SUPPORTS_COMPRESSION=!0},7103:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertServerSideNetworkAdaptionEnumToSignaled=t.convertServerSideNetworkAdaptionEnumFromSignaled=t.ServerSideNetworkAdaption=void 0;const n=i(289);var r;!function(e){e[e.Default=0]="Default",e[e.None=1]="None",e[e.BandwidthProbing=2]="BandwidthProbing"}(r=t.ServerSideNetworkAdaption||(t.ServerSideNetworkAdaption={})),t.default=r,t.convertServerSideNetworkAdaptionEnumFromSignaled=function(e){switch(e){case n.SdkServerSideNetworkAdaption.DEFAULT:return r.Default;case n.SdkServerSideNetworkAdaption.NONE:return r.None;case n.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING:return r.BandwidthProbing}},t.convertServerSideNetworkAdaptionEnumToSignaled=function(e){switch(e){case r.Default:return n.SdkServerSideNetworkAdaption.DEFAULT;case r.None:return n.SdkServerSideNetworkAdaption.NONE;case r.BandwidthProbing:return n.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING}}},3920:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t){this.signalingURL=e,this.joinToken=t}url(){return this.signalingURL+"?X-Chime-Control-Protocol-Version=3&X-Amzn-Chime-Send-Close-On-Error=1"}protocols(){return["_aws_wt_session",this.joinToken]}}},2902:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(9416);t.default=class{constructor(e,t,i,n,r){this.client=e,this.type=t,this.message=i,this.closeCode=n,this.closeReason=r,this.timestampMs=Date.now()}isConnectionTerminated(){switch(this.type){case n.default.WebSocketFailed:case n.default.WebSocketError:case n.default.WebSocketClosing:case n.default.WebSocketClosed:return!0;default:return!1}}}},9416:(e,t)=>{"use strict";var 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},2168:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(7103);t.default=class{constructor(e){this.applicationMetadata=e,this.serverSideNetworkAdaption=n.default.Default,this.supportedServerSideNetworkAdaptions=[]}}},6729:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,i,n,r,a,o,s,c,l){this.attendeeId=e,this.sdpOffer=t,this.audioHost=i,this.audioMuted=n,this.audioCheckin=r,this.receiveStreamIds=a,this.localVideoEnabled=o,this.videoStreamDescriptions=s,this.connectionTypeHasVideo=c,this.compressedSdpOffer=l,this.videoSubscriptionConfiguration=[]}}},9101:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},289:(e,t,i)=>{"use strict";var n,r,a=i(2100),o=a.Reader,s=a.Writer,c=a.util,l=a.roots.default||(a.roots.default={});l.SdkSignalFrame=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.timestampMs=e.uint64();break;case 2:n.type=e.int32();break;case 3:n.error=l.SdkErrorFrame.decode(e,e.uint32());break;case 4:n.join=l.SdkJoinFrame.decode(e,e.uint32());break;case 5:n.joinack=l.SdkJoinAckFrame.decode(e,e.uint32());break;case 6:n.sub=l.SdkSubscribeFrame.decode(e,e.uint32());break;case 7:n.suback=l.SdkSubscribeAckFrame.decode(e,e.uint32());break;case 8:n.index=l.SdkIndexFrame.decode(e,e.uint32());break;case 10:n.pause=l.SdkPauseResumeFrame.decode(e,e.uint32());break;case 11:n.leave=l.SdkLeaveFrame.decode(e,e.uint32());break;case 12:n.leaveAck=l.SdkLeaveAckFrame.decode(e,e.uint32());break;case 14:n.bitrates=l.SdkBitrateFrame.decode(e,e.uint32());break;case 17:n.audioControl=l.SdkAudioControlFrame.decode(e,e.uint32());break;case 18:n.audioMetadata=l.SdkAudioMetadataFrame.decode(e,e.uint32());break;case 19:n.audioStreamIdInfo=l.SdkAudioStreamIdInfoFrame.decode(e,e.uint32());break;case 20:n.pingPong=l.SdkPingPongFrame.decode(e,e.uint32());break;case 21:n.audioStatus=l.SdkAudioStatusFrame.decode(e,e.uint32());break;case 22:n.clientMetric=l.SdkClientMetricFrame.decode(e,e.uint32());break;case 23:n.dataMessage=l.SdkDataMessageFrame.decode(e,e.uint32());break;case 25:n.remoteVideoUpdate=l.SdkRemoteVideoUpdateFrame.decode(e,e.uint32());break;case 26:n.primaryMeetingJoin=l.SdkPrimaryMeetingJoinFrame.decode(e,e.uint32());break;case 27:n.primaryMeetingJoinAck=l.SdkPrimaryMeetingJoinAckFrame.decode(e,e.uint32());break;case 28:n.primaryMeetingLeave=l.SdkPrimaryMeetingLeaveFrame.decode(e,e.uint32());break;default:e.skipType(7&r)}}if(!n.hasOwnProperty("timestampMs"))throw c.ProtocolError("missing required 'timestampMs'",{instance:n});if(!n.hasOwnProperty("type"))throw c.ProtocolError("missing required 'type'",{instance:n});return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(!(c.isInteger(e.timestampMs)||e.timestampMs&&c.isInteger(e.timestampMs.low)&&c.isInteger(e.timestampMs.high)))return"timestampMs: integer|Long expected";switch(e.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 7:case 8:case 9:case 10:case 13:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 24:case 25:case 26:case 27:}var t;return null!=e.error&&e.hasOwnProperty("error")&&(t=l.SdkErrorFrame.verify(e.error))?"error."+t:null!=e.join&&e.hasOwnProperty("join")&&(t=l.SdkJoinFrame.verify(e.join))?"join."+t:null!=e.joinack&&e.hasOwnProperty("joinack")&&(t=l.SdkJoinAckFrame.verify(e.joinack))?"joinack."+t:null!=e.sub&&e.hasOwnProperty("sub")&&(t=l.SdkSubscribeFrame.verify(e.sub))?"sub."+t:null!=e.suback&&e.hasOwnProperty("suback")&&(t=l.SdkSubscribeAckFrame.verify(e.suback))?"suback."+t:null!=e.index&&e.hasOwnProperty("index")&&(t=l.SdkIndexFrame.verify(e.index))?"index."+t:null!=e.pause&&e.hasOwnProperty("pause")&&(t=l.SdkPauseResumeFrame.verify(e.pause))?"pause."+t:null!=e.leave&&e.hasOwnProperty("leave")&&(t=l.SdkLeaveFrame.verify(e.leave))?"leave."+t:null!=e.leaveAck&&e.hasOwnProperty("leaveAck")&&(t=l.SdkLeaveAckFrame.verify(e.leaveAck))?"leaveAck."+t:null!=e.bitrates&&e.hasOwnProperty("bitrates")&&(t=l.SdkBitrateFrame.verify(e.bitrates))?"bitrates."+t:null!=e.audioControl&&e.hasOwnProperty("audioControl")&&(t=l.SdkAudioControlFrame.verify(e.audioControl))?"audioControl."+t:null!=e.audioMetadata&&e.hasOwnProperty("audioMetadata")&&(t=l.SdkAudioMetadataFrame.verify(e.audioMetadata))?"audioMetadata."+t:null!=e.audioStreamIdInfo&&e.hasOwnProperty("audioStreamIdInfo")&&(t=l.SdkAudioStreamIdInfoFrame.verify(e.audioStreamIdInfo))?"audioStreamIdInfo."+t:null!=e.pingPong&&e.hasOwnProperty("pingPong")&&(t=l.SdkPingPongFrame.verify(e.pingPong))?"pingPong."+t:null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&(t=l.SdkAudioStatusFrame.verify(e.audioStatus))?"audioStatus."+t:null!=e.clientMetric&&e.hasOwnProperty("clientMetric")&&(t=l.SdkClientMetricFrame.verify(e.clientMetric))?"clientMetric."+t:null!=e.dataMessage&&e.hasOwnProperty("dataMessage")&&(t=l.SdkDataMessageFrame.verify(e.dataMessage))?"dataMessage."+t:null!=e.remoteVideoUpdate&&e.hasOwnProperty("remoteVideoUpdate")&&(t=l.SdkRemoteVideoUpdateFrame.verify(e.remoteVideoUpdate))?"remoteVideoUpdate."+t:null!=e.primaryMeetingJoin&&e.hasOwnProperty("primaryMeetingJoin")&&(t=l.SdkPrimaryMeetingJoinFrame.verify(e.primaryMeetingJoin))?"primaryMeetingJoin."+t:null!=e.primaryMeetingJoinAck&&e.hasOwnProperty("primaryMeetingJoinAck")&&(t=l.SdkPrimaryMeetingJoinAckFrame.verify(e.primaryMeetingJoinAck))?"primaryMeetingJoinAck."+t:null!=e.primaryMeetingLeave&&e.hasOwnProperty("primaryMeetingLeave")&&(t=l.SdkPrimaryMeetingLeaveFrame.verify(e.primaryMeetingLeave))?"primaryMeetingLeave."+t:null},e.fromObject=function(e){if(e instanceof l.SdkSignalFrame)return e;var t=new l.SdkSignalFrame;switch(null!=e.timestampMs&&(c.Long?(t.timestampMs=c.Long.fromValue(e.timestampMs)).unsigned=!0:"string"==typeof e.timestampMs?t.timestampMs=parseInt(e.timestampMs,10):"number"==typeof e.timestampMs?t.timestampMs=e.timestampMs:"object"==typeof e.timestampMs&&(t.timestampMs=new c.LongBits(e.timestampMs.low>>>0,e.timestampMs.high>>>0).toNumber(!0))),e.type){case"JOIN":case 1:t.type=1;break;case"JOIN_ACK":case 2:t.type=2;break;case"SUBSCRIBE":case 3:t.type=3;break;case"SUBSCRIBE_ACK":case 4:t.type=4;break;case"INDEX":case 5:t.type=5;break;case"PAUSE":case 7:t.type=7;break;case"RESUME":case 8:t.type=8;break;case"LEAVE":case 9:t.type=9;break;case"LEAVE_ACK":case 10:t.type=10;break;case"BITRATES":case 13:t.type=13;break;case"AUDIO_CONTROL":case 16:t.type=16;break;case"AUDIO_METADATA":case 17:t.type=17;break;case"AUDIO_STREAM_ID_INFO":case 18:t.type=18;break;case"PING_PONG":case 19:t.type=19;break;case"AUDIO_STATUS":case 20:t.type=20;break;case"CLIENT_METRIC":case 21:t.type=21;break;case"DATA_MESSAGE":case 22:t.type=22;break;case"REMOTE_VIDEO_UPDATE":case 24:t.type=24;break;case"PRIMARY_MEETING_JOIN":case 25:t.type=25;break;case"PRIMARY_MEETING_JOIN_ACK":case 26:t.type=26;break;case"PRIMARY_MEETING_LEAVE":case 27:t.type=27}if(null!=e.error){if("object"!=typeof e.error)throw TypeError(".SdkSignalFrame.error: object expected");t.error=l.SdkErrorFrame.fromObject(e.error)}if(null!=e.join){if("object"!=typeof e.join)throw TypeError(".SdkSignalFrame.join: object expected");t.join=l.SdkJoinFrame.fromObject(e.join)}if(null!=e.joinack){if("object"!=typeof e.joinack)throw TypeError(".SdkSignalFrame.joinack: object expected");t.joinack=l.SdkJoinAckFrame.fromObject(e.joinack)}if(null!=e.sub){if("object"!=typeof e.sub)throw TypeError(".SdkSignalFrame.sub: object expected");t.sub=l.SdkSubscribeFrame.fromObject(e.sub)}if(null!=e.suback){if("object"!=typeof e.suback)throw TypeError(".SdkSignalFrame.suback: object expected");t.suback=l.SdkSubscribeAckFrame.fromObject(e.suback)}if(null!=e.index){if("object"!=typeof e.index)throw TypeError(".SdkSignalFrame.index: object expected");t.index=l.SdkIndexFrame.fromObject(e.index)}if(null!=e.pause){if("object"!=typeof e.pause)throw TypeError(".SdkSignalFrame.pause: object expected");t.pause=l.SdkPauseResumeFrame.fromObject(e.pause)}if(null!=e.leave){if("object"!=typeof e.leave)throw TypeError(".SdkSignalFrame.leave: object expected");t.leave=l.SdkLeaveFrame.fromObject(e.leave)}if(null!=e.leaveAck){if("object"!=typeof e.leaveAck)throw TypeError(".SdkSignalFrame.leaveAck: object expected");t.leaveAck=l.SdkLeaveAckFrame.fromObject(e.leaveAck)}if(null!=e.bitrates){if("object"!=typeof e.bitrates)throw TypeError(".SdkSignalFrame.bitrates: object expected");t.bitrates=l.SdkBitrateFrame.fromObject(e.bitrates)}if(null!=e.audioControl){if("object"!=typeof e.audioControl)throw TypeError(".SdkSignalFrame.audioControl: object expected");t.audioControl=l.SdkAudioControlFrame.fromObject(e.audioControl)}if(null!=e.audioMetadata){if("object"!=typeof e.audioMetadata)throw TypeError(".SdkSignalFrame.audioMetadata: object expected");t.audioMetadata=l.SdkAudioMetadataFrame.fromObject(e.audioMetadata)}if(null!=e.audioStreamIdInfo){if("object"!=typeof e.audioStreamIdInfo)throw TypeError(".SdkSignalFrame.audioStreamIdInfo: object expected");t.audioStreamIdInfo=l.SdkAudioStreamIdInfoFrame.fromObject(e.audioStreamIdInfo)}if(null!=e.pingPong){if("object"!=typeof e.pingPong)throw TypeError(".SdkSignalFrame.pingPong: object expected");t.pingPong=l.SdkPingPongFrame.fromObject(e.pingPong)}if(null!=e.audioStatus){if("object"!=typeof e.audioStatus)throw TypeError(".SdkSignalFrame.audioStatus: object expected");t.audioStatus=l.SdkAudioStatusFrame.fromObject(e.audioStatus)}if(null!=e.clientMetric){if("object"!=typeof e.clientMetric)throw TypeError(".SdkSignalFrame.clientMetric: object expected");t.clientMetric=l.SdkClientMetricFrame.fromObject(e.clientMetric)}if(null!=e.dataMessage){if("object"!=typeof e.dataMessage)throw TypeError(".SdkSignalFrame.dataMessage: object expected");t.dataMessage=l.SdkDataMessageFrame.fromObject(e.dataMessage)}if(null!=e.remoteVideoUpdate){if("object"!=typeof e.remoteVideoUpdate)throw TypeError(".SdkSignalFrame.remoteVideoUpdate: object expected");t.remoteVideoUpdate=l.SdkRemoteVideoUpdateFrame.fromObject(e.remoteVideoUpdate)}if(null!=e.primaryMeetingJoin){if("object"!=typeof e.primaryMeetingJoin)throw TypeError(".SdkSignalFrame.primaryMeetingJoin: object expected");t.primaryMeetingJoin=l.SdkPrimaryMeetingJoinFrame.fromObject(e.primaryMeetingJoin)}if(null!=e.primaryMeetingJoinAck){if("object"!=typeof e.primaryMeetingJoinAck)throw TypeError(".SdkSignalFrame.primaryMeetingJoinAck: object expected");t.primaryMeetingJoinAck=l.SdkPrimaryMeetingJoinAckFrame.fromObject(e.primaryMeetingJoinAck)}if(null!=e.primaryMeetingLeave){if("object"!=typeof e.primaryMeetingLeave)throw TypeError(".SdkSignalFrame.primaryMeetingLeave: object expected");t.primaryMeetingLeave=l.SdkPrimaryMeetingLeaveFrame.fromObject(e.primaryMeetingLeave)}return t},e.toObject=function(e,t){t||(t={});var i={};if(t.defaults){if(c.Long){var n=new c.Long(0,0,!0);i.timestampMs=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else i.timestampMs=t.longs===String?"0":0;i.type=t.enums===String?"JOIN":1,i.error=null,i.join=null,i.joinack=null,i.sub=null,i.suback=null,i.index=null,i.pause=null,i.leave=null,i.leaveAck=null,i.bitrates=null,i.audioControl=null,i.audioMetadata=null,i.audioStreamIdInfo=null,i.pingPong=null,i.audioStatus=null,i.clientMetric=null,i.dataMessage=null,i.remoteVideoUpdate=null,i.primaryMeetingJoin=null,i.primaryMeetingJoinAck=null,i.primaryMeetingLeave=null}return null!=e.timestampMs&&e.hasOwnProperty("timestampMs")&&("number"==typeof e.timestampMs?i.timestampMs=t.longs===String?String(e.timestampMs):e.timestampMs:i.timestampMs=t.longs===String?c.Long.prototype.toString.call(e.timestampMs):t.longs===Number?new c.LongBits(e.timestampMs.low>>>0,e.timestampMs.high>>>0).toNumber(!0):e.timestampMs),null!=e.type&&e.hasOwnProperty("type")&&(i.type=t.enums===String?l.SdkSignalFrame.Type[e.type]:e.type),null!=e.error&&e.hasOwnProperty("error")&&(i.error=l.SdkErrorFrame.toObject(e.error,t)),null!=e.join&&e.hasOwnProperty("join")&&(i.join=l.SdkJoinFrame.toObject(e.join,t)),null!=e.joinack&&e.hasOwnProperty("joinack")&&(i.joinack=l.SdkJoinAckFrame.toObject(e.joinack,t)),null!=e.sub&&e.hasOwnProperty("sub")&&(i.sub=l.SdkSubscribeFrame.toObject(e.sub,t)),null!=e.suback&&e.hasOwnProperty("suback")&&(i.suback=l.SdkSubscribeAckFrame.toObject(e.suback,t)),null!=e.index&&e.hasOwnProperty("index")&&(i.index=l.SdkIndexFrame.toObject(e.index,t)),null!=e.pause&&e.hasOwnProperty("pause")&&(i.pause=l.SdkPauseResumeFrame.toObject(e.pause,t)),null!=e.leave&&e.hasOwnProperty("leave")&&(i.leave=l.SdkLeaveFrame.toObject(e.leave,t)),null!=e.leaveAck&&e.hasOwnProperty("leaveAck")&&(i.leaveAck=l.SdkLeaveAckFrame.toObject(e.leaveAck,t)),null!=e.bitrates&&e.hasOwnProperty("bitrates")&&(i.bitrates=l.SdkBitrateFrame.toObject(e.bitrates,t)),null!=e.audioControl&&e.hasOwnProperty("audioControl")&&(i.audioControl=l.SdkAudioControlFrame.toObject(e.audioControl,t)),null!=e.audioMetadata&&e.hasOwnProperty("audioMetadata")&&(i.audioMetadata=l.SdkAudioMetadataFrame.toObject(e.audioMetadata,t)),null!=e.audioStreamIdInfo&&e.hasOwnProperty("audioStreamIdInfo")&&(i.audioStreamIdInfo=l.SdkAudioStreamIdInfoFrame.toObject(e.audioStreamIdInfo,t)),null!=e.pingPong&&e.hasOwnProperty("pingPong")&&(i.pingPong=l.SdkPingPongFrame.toObject(e.pingPong,t)),null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&(i.audioStatus=l.SdkAudioStatusFrame.toObject(e.audioStatus,t)),null!=e.clientMetric&&e.hasOwnProperty("clientMetric")&&(i.clientMetric=l.SdkClientMetricFrame.toObject(e.clientMetric,t)),null!=e.dataMessage&&e.hasOwnProperty("dataMessage")&&(i.dataMessage=l.SdkDataMessageFrame.toObject(e.dataMessage,t)),null!=e.remoteVideoUpdate&&e.hasOwnProperty("remoteVideoUpdate")&&(i.remoteVideoUpdate=l.SdkRemoteVideoUpdateFrame.toObject(e.remoteVideoUpdate,t)),null!=e.primaryMeetingJoin&&e.hasOwnProperty("primaryMeetingJoin")&&(i.primaryMeetingJoin=l.SdkPrimaryMeetingJoinFrame.toObject(e.primaryMeetingJoin,t)),null!=e.primaryMeetingJoinAck&&e.hasOwnProperty("primaryMeetingJoinAck")&&(i.primaryMeetingJoinAck=l.SdkPrimaryMeetingJoinAckFrame.toObject(e.primaryMeetingJoinAck,t)),null!=e.primaryMeetingLeave&&e.hasOwnProperty("primaryMeetingLeave")&&(i.primaryMeetingLeave=l.SdkPrimaryMeetingLeaveFrame.toObject(e.primaryMeetingLeave,t)),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e.Type=(t={},(i=Object.create(t))[t[1]="JOIN"]=1,i[t[2]="JOIN_ACK"]=2,i[t[3]="SUBSCRIBE"]=3,i[t[4]="SUBSCRIBE_ACK"]=4,i[t[5]="INDEX"]=5,i[t[7]="PAUSE"]=7,i[t[8]="RESUME"]=8,i[t[9]="LEAVE"]=9,i[t[10]="LEAVE_ACK"]=10,i[t[13]="BITRATES"]=13,i[t[16]="AUDIO_CONTROL"]=16,i[t[17]="AUDIO_METADATA"]=17,i[t[18]="AUDIO_STREAM_ID_INFO"]=18,i[t[19]="PING_PONG"]=19,i[t[20]="AUDIO_STATUS"]=20,i[t[21]="CLIENT_METRIC"]=21,i[t[22]="DATA_MESSAGE"]=22,i[t[24]="REMOTE_VIDEO_UPDATE"]=24,i[t[25]="PRIMARY_MEETING_JOIN"]=25,i[t[26]="PRIMARY_MEETING_JOIN_ACK"]=26,i[t[27]="PRIMARY_MEETING_LEAVE"]=27,i),e}(),l.SdkErrorFrame=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.status=e.uint32();break;case 2:n.description=e.string();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.status&&e.hasOwnProperty("status")&&!c.isInteger(e.status)?"status: integer expected":null!=e.description&&e.hasOwnProperty("description")&&!c.isString(e.description)?"description: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkErrorFrame)return e;var t=new l.SdkErrorFrame;return null!=e.status&&(t.status=e.status>>>0),null!=e.description&&(t.description=String(e.description)),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.status=0,i.description=""),null!=e.status&&e.hasOwnProperty("status")&&(i.status=e.status),null!=e.description&&e.hasOwnProperty("description")&&(i.description=e.description),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkJoinFlags=(n={},(r=Object.create(n))[n[2]="HAS_STREAM_UPDATE"]=2,r[n[16]="COMPLETE_VIDEO_SOURCES_LIST"]=16,r[n[32]="EXCLUDE_SELF_CONTENT_IN_INDEX"]=32,r),l.SdkClientDetails=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.appName=e.string();break;case 2:n.appVersion=e.string();break;case 3:n.deviceModel=e.string();break;case 4:n.deviceMake=e.string();break;case 5:n.platformName=e.string();break;case 6:n.platformVersion=e.string();break;case 7:n.clientSource=e.string();break;case 8:n.chimeSdkVersion=e.string();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.appName&&e.hasOwnProperty("appName")&&!c.isString(e.appName)?"appName: string expected":null!=e.appVersion&&e.hasOwnProperty("appVersion")&&!c.isString(e.appVersion)?"appVersion: string expected":null!=e.deviceModel&&e.hasOwnProperty("deviceModel")&&!c.isString(e.deviceModel)?"deviceModel: string expected":null!=e.deviceMake&&e.hasOwnProperty("deviceMake")&&!c.isString(e.deviceMake)?"deviceMake: string expected":null!=e.platformName&&e.hasOwnProperty("platformName")&&!c.isString(e.platformName)?"platformName: string expected":null!=e.platformVersion&&e.hasOwnProperty("platformVersion")&&!c.isString(e.platformVersion)?"platformVersion: string expected":null!=e.clientSource&&e.hasOwnProperty("clientSource")&&!c.isString(e.clientSource)?"clientSource: string expected":null!=e.chimeSdkVersion&&e.hasOwnProperty("chimeSdkVersion")&&!c.isString(e.chimeSdkVersion)?"chimeSdkVersion: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkClientDetails)return e;var t=new l.SdkClientDetails;return null!=e.appName&&(t.appName=String(e.appName)),null!=e.appVersion&&(t.appVersion=String(e.appVersion)),null!=e.deviceModel&&(t.deviceModel=String(e.deviceModel)),null!=e.deviceMake&&(t.deviceMake=String(e.deviceMake)),null!=e.platformName&&(t.platformName=String(e.platformName)),null!=e.platformVersion&&(t.platformVersion=String(e.platformVersion)),null!=e.clientSource&&(t.clientSource=String(e.clientSource)),null!=e.chimeSdkVersion&&(t.chimeSdkVersion=String(e.chimeSdkVersion)),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.appName="",i.appVersion="",i.deviceModel="",i.deviceMake="",i.platformName="",i.platformVersion="",i.clientSource="",i.chimeSdkVersion=""),null!=e.appName&&e.hasOwnProperty("appName")&&(i.appName=e.appName),null!=e.appVersion&&e.hasOwnProperty("appVersion")&&(i.appVersion=e.appVersion),null!=e.deviceModel&&e.hasOwnProperty("deviceModel")&&(i.deviceModel=e.deviceModel),null!=e.deviceMake&&e.hasOwnProperty("deviceMake")&&(i.deviceMake=e.deviceMake),null!=e.platformName&&e.hasOwnProperty("platformName")&&(i.platformName=e.platformName),null!=e.platformVersion&&e.hasOwnProperty("platformVersion")&&(i.platformVersion=e.platformVersion),null!=e.clientSource&&e.hasOwnProperty("clientSource")&&(i.clientSource=e.clientSource),null!=e.chimeSdkVersion&&e.hasOwnProperty("chimeSdkVersion")&&(i.chimeSdkVersion=e.chimeSdkVersion),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkServerSideNetworkAdaption=function(){var e={},t=Object.create(e);return t[e[1]="DEFAULT"]=1,t[e[2]="NONE"]=2,t[e[3]="BANDWIDTH_PROBING"]=3,t}(),l.SdkJoinFrame=function(){function e(e){if(this.supportedServerSideNetworkAdaptions=[],e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.protocolVersion=e.uint32();break;case 2:n.maxNumOfVideos=e.uint32();break;case 3:n.flags=e.uint32();break;case 4:n.clientDetails=l.SdkClientDetails.decode(e,e.uint32());break;case 6:n.audioSessionId=e.uint64();break;case 7:n.wantsCompressedSdp=e.bool();break;case 8:n.wantsServerSideNetworkProbingOnReceiveSideEstimator=e.bool();break;case 10:n.serverSideNetworkAdaption=e.int32();break;case 11:if(n.supportedServerSideNetworkAdaptions&&n.supportedServerSideNetworkAdaptions.length||(n.supportedServerSideNetworkAdaptions=[]),2==(7&r))for(var a=e.uint32()+e.pos;e.pos>>0),null!=e.maxNumOfVideos&&(t.maxNumOfVideos=e.maxNumOfVideos>>>0),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.clientDetails){if("object"!=typeof e.clientDetails)throw TypeError(".SdkJoinFrame.clientDetails: object expected");t.clientDetails=l.SdkClientDetails.fromObject(e.clientDetails)}switch(null!=e.audioSessionId&&(c.Long?(t.audioSessionId=c.Long.fromValue(e.audioSessionId)).unsigned=!0:"string"==typeof e.audioSessionId?t.audioSessionId=parseInt(e.audioSessionId,10):"number"==typeof e.audioSessionId?t.audioSessionId=e.audioSessionId:"object"==typeof e.audioSessionId&&(t.audioSessionId=new c.LongBits(e.audioSessionId.low>>>0,e.audioSessionId.high>>>0).toNumber(!0))),null!=e.wantsCompressedSdp&&(t.wantsCompressedSdp=Boolean(e.wantsCompressedSdp)),null!=e.wantsServerSideNetworkProbingOnReceiveSideEstimator&&(t.wantsServerSideNetworkProbingOnReceiveSideEstimator=Boolean(e.wantsServerSideNetworkProbingOnReceiveSideEstimator)),e.serverSideNetworkAdaption){case"DEFAULT":case 1:t.serverSideNetworkAdaption=1;break;case"NONE":case 2:t.serverSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:t.serverSideNetworkAdaption=3}if(e.supportedServerSideNetworkAdaptions){if(!Array.isArray(e.supportedServerSideNetworkAdaptions))throw TypeError(".SdkJoinFrame.supportedServerSideNetworkAdaptions: array expected");t.supportedServerSideNetworkAdaptions=[];for(var i=0;i>>0,e.audioSessionId.high>>>0).toNumber(!0):e.audioSessionId),null!=e.wantsCompressedSdp&&e.hasOwnProperty("wantsCompressedSdp")&&(i.wantsCompressedSdp=e.wantsCompressedSdp),null!=e.wantsServerSideNetworkProbingOnReceiveSideEstimator&&e.hasOwnProperty("wantsServerSideNetworkProbingOnReceiveSideEstimator")&&(i.wantsServerSideNetworkProbingOnReceiveSideEstimator=e.wantsServerSideNetworkProbingOnReceiveSideEstimator),null!=e.serverSideNetworkAdaption&&e.hasOwnProperty("serverSideNetworkAdaption")&&(i.serverSideNetworkAdaption=t.enums===String?l.SdkServerSideNetworkAdaption[e.serverSideNetworkAdaption]:e.serverSideNetworkAdaption),e.supportedServerSideNetworkAdaptions&&e.supportedServerSideNetworkAdaptions.length){i.supportedServerSideNetworkAdaptions=[];for(var r=0;r>>3){case 1:n.turnCredentials=l.SdkTurnCredentials.decode(e,e.uint32());break;case 2:n.videoSubscriptionLimit=e.uint32();break;case 3:n.wantsCompressedSdp=e.bool();break;case 4:n.defaultServerSideNetworkAdaption=e.int32();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.turnCredentials&&e.hasOwnProperty("turnCredentials")){var t=l.SdkTurnCredentials.verify(e.turnCredentials);if(t)return"turnCredentials."+t}if(null!=e.videoSubscriptionLimit&&e.hasOwnProperty("videoSubscriptionLimit")&&!c.isInteger(e.videoSubscriptionLimit))return"videoSubscriptionLimit: integer expected";if(null!=e.wantsCompressedSdp&&e.hasOwnProperty("wantsCompressedSdp")&&"boolean"!=typeof e.wantsCompressedSdp)return"wantsCompressedSdp: boolean expected";if(null!=e.defaultServerSideNetworkAdaption&&e.hasOwnProperty("defaultServerSideNetworkAdaption"))switch(e.defaultServerSideNetworkAdaption){default:return"defaultServerSideNetworkAdaption: enum value expected";case 1:case 2:case 3:}return null},e.fromObject=function(e){if(e instanceof l.SdkJoinAckFrame)return e;var t=new l.SdkJoinAckFrame;if(null!=e.turnCredentials){if("object"!=typeof e.turnCredentials)throw TypeError(".SdkJoinAckFrame.turnCredentials: object expected");t.turnCredentials=l.SdkTurnCredentials.fromObject(e.turnCredentials)}switch(null!=e.videoSubscriptionLimit&&(t.videoSubscriptionLimit=e.videoSubscriptionLimit>>>0),null!=e.wantsCompressedSdp&&(t.wantsCompressedSdp=Boolean(e.wantsCompressedSdp)),e.defaultServerSideNetworkAdaption){case"DEFAULT":case 1:t.defaultServerSideNetworkAdaption=1;break;case"NONE":case 2:t.defaultServerSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:t.defaultServerSideNetworkAdaption=3}return t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.turnCredentials=null,i.videoSubscriptionLimit=0,i.wantsCompressedSdp=!1,i.defaultServerSideNetworkAdaption=t.enums===String?"DEFAULT":1),null!=e.turnCredentials&&e.hasOwnProperty("turnCredentials")&&(i.turnCredentials=l.SdkTurnCredentials.toObject(e.turnCredentials,t)),null!=e.videoSubscriptionLimit&&e.hasOwnProperty("videoSubscriptionLimit")&&(i.videoSubscriptionLimit=e.videoSubscriptionLimit),null!=e.wantsCompressedSdp&&e.hasOwnProperty("wantsCompressedSdp")&&(i.wantsCompressedSdp=e.wantsCompressedSdp),null!=e.defaultServerSideNetworkAdaption&&e.hasOwnProperty("defaultServerSideNetworkAdaption")&&(i.defaultServerSideNetworkAdaption=t.enums===String?l.SdkServerSideNetworkAdaption[e.defaultServerSideNetworkAdaption]:e.defaultServerSideNetworkAdaption),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkLeaveFrame=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.duplex=e.int32();break;case 2:n.sendStreams&&n.sendStreams.length||(n.sendStreams=[]),n.sendStreams.push(l.SdkStreamDescriptor.decode(e,e.uint32()));break;case 3:if(n.receiveStreamIds&&n.receiveStreamIds.length||(n.receiveStreamIds=[]),2==(7&r))for(var a=e.uint32()+e.pos;e.pos>>0}if(null!=e.sdpOffer&&(t.sdpOffer=String(e.sdpOffer)),null!=e.audioHost&&(t.audioHost=String(e.audioHost)),null!=e.audioCheckin&&(t.audioCheckin=Boolean(e.audioCheckin)),null!=e.audioMuted&&(t.audioMuted=Boolean(e.audioMuted)),null!=e.compressedSdpOffer&&("string"==typeof e.compressedSdpOffer?c.base64.decode(e.compressedSdpOffer,t.compressedSdpOffer=c.newBuffer(c.base64.length(e.compressedSdpOffer)),0):e.compressedSdpOffer.length&&(t.compressedSdpOffer=e.compressedSdpOffer)),e.videoSubscriptionConfiguration){if(!Array.isArray(e.videoSubscriptionConfiguration))throw TypeError(".SdkSubscribeFrame.videoSubscriptionConfiguration: array expected");for(t.videoSubscriptionConfiguration=[],i=0;i>>3){case 1:n.duplex=e.int32();break;case 2:n.allocations&&n.allocations.length||(n.allocations=[]),n.allocations.push(l.SdkStreamAllocation.decode(e,e.uint32()));break;case 3:n.sdpAnswer=e.string();break;case 4:n.tracks&&n.tracks.length||(n.tracks=[]),n.tracks.push(l.SdkTrackMapping.decode(e,e.uint32()));break;case 5:n.compressedSdpAnswer=e.bytes();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.duplex&&e.hasOwnProperty("duplex"))switch(e.duplex){default:return"duplex: enum value expected";case 1:case 2:case 3:}if(null!=e.allocations&&e.hasOwnProperty("allocations")){if(!Array.isArray(e.allocations))return"allocations: array expected";for(var t=0;t>>3){case 1:n.atCapacity=e.bool();break;case 2:n.sources&&n.sources.length||(n.sources=[]),n.sources.push(l.SdkStreamDescriptor.decode(e,e.uint32()));break;case 3:if(n.pausedAtSourceIds&&n.pausedAtSourceIds.length||(n.pausedAtSourceIds=[]),2==(7&r))for(var a=e.uint32()+e.pos;e.pos>>0}if(null!=e.numParticipants&&(t.numParticipants=e.numParticipants>>>0),e.supportedReceiveCodecIntersection){if(!Array.isArray(e.supportedReceiveCodecIntersection))throw TypeError(".SdkIndexFrame.supportedReceiveCodecIntersection: array expected");for(t.supportedReceiveCodecIntersection=[],i=0;i>>3){case 1:if(n.streamIds&&n.streamIds.length||(n.streamIds=[]),2==(7&r))for(var a=e.uint32()+e.pos;e.pos>>0}if(e.groupIds){if(!Array.isArray(e.groupIds))throw TypeError(".SdkPauseResumeFrame.groupIds: array expected");for(t.groupIds=[],i=0;i>>0}return t},e.toObject=function(e,t){t||(t={});var i={};if((t.arrays||t.defaults)&&(i.streamIds=[],i.groupIds=[]),e.streamIds&&e.streamIds.length){i.streamIds=[];for(var n=0;n>>3==1?(n.bitrates&&n.bitrates.length||(n.bitrates=[]),n.bitrates.push(l.SdkBitrate.decode(e,e.uint32()))):e.skipType(7&r)}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.bitrates&&e.hasOwnProperty("bitrates")){if(!Array.isArray(e.bitrates))return"bitrates: array expected";for(var t=0;t>>3){case 1:n.streamId=e.uint32();break;case 2:n.framerate=e.uint32();break;case 3:n.maxBitrateKbps=e.uint32();break;case 4:n.trackLabel=e.string();break;case 6:n.groupId=e.uint32();break;case 7:n.avgBitrateBps=e.uint32();break;case 8:n.attendeeId=e.string();break;case 9:n.mediaType=e.int32();break;case 10:n.externalUserId=e.string();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.streamId&&e.hasOwnProperty("streamId")&&!c.isInteger(e.streamId))return"streamId: integer expected";if(null!=e.framerate&&e.hasOwnProperty("framerate")&&!c.isInteger(e.framerate))return"framerate: integer expected";if(null!=e.maxBitrateKbps&&e.hasOwnProperty("maxBitrateKbps")&&!c.isInteger(e.maxBitrateKbps))return"maxBitrateKbps: integer expected";if(null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!c.isString(e.trackLabel))return"trackLabel: string expected";if(null!=e.groupId&&e.hasOwnProperty("groupId")&&!c.isInteger(e.groupId))return"groupId: integer expected";if(null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&!c.isInteger(e.avgBitrateBps))return"avgBitrateBps: integer expected";if(null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!c.isString(e.attendeeId))return"attendeeId: string expected";if(null!=e.mediaType&&e.hasOwnProperty("mediaType"))switch(e.mediaType){default:return"mediaType: enum value expected";case 1:case 2:}return null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&!c.isString(e.externalUserId)?"externalUserId: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkStreamDescriptor)return e;var t=new l.SdkStreamDescriptor;switch(null!=e.streamId&&(t.streamId=e.streamId>>>0),null!=e.framerate&&(t.framerate=e.framerate>>>0),null!=e.maxBitrateKbps&&(t.maxBitrateKbps=e.maxBitrateKbps>>>0),null!=e.trackLabel&&(t.trackLabel=String(e.trackLabel)),null!=e.groupId&&(t.groupId=e.groupId>>>0),null!=e.avgBitrateBps&&(t.avgBitrateBps=e.avgBitrateBps>>>0),null!=e.attendeeId&&(t.attendeeId=String(e.attendeeId)),e.mediaType){case"AUDIO":case 1:t.mediaType=1;break;case"VIDEO":case 2:t.mediaType=2}return null!=e.externalUserId&&(t.externalUserId=String(e.externalUserId)),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.streamId=0,i.framerate=0,i.maxBitrateKbps=0,i.trackLabel="",i.groupId=0,i.avgBitrateBps=0,i.attendeeId="",i.mediaType=t.enums===String?"AUDIO":1,i.externalUserId=""),null!=e.streamId&&e.hasOwnProperty("streamId")&&(i.streamId=e.streamId),null!=e.framerate&&e.hasOwnProperty("framerate")&&(i.framerate=e.framerate),null!=e.maxBitrateKbps&&e.hasOwnProperty("maxBitrateKbps")&&(i.maxBitrateKbps=e.maxBitrateKbps),null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&(i.trackLabel=e.trackLabel),null!=e.groupId&&e.hasOwnProperty("groupId")&&(i.groupId=e.groupId),null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&(i.avgBitrateBps=e.avgBitrateBps),null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&(i.attendeeId=e.attendeeId),null!=e.mediaType&&e.hasOwnProperty("mediaType")&&(i.mediaType=t.enums===String?l.SdkStreamMediaType[e.mediaType]:e.mediaType),null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&(i.externalUserId=e.externalUserId),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkStreamAllocation=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.trackLabel=e.string();break;case 2:n.streamId=e.uint32();break;case 3:n.groupId=e.uint32();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!c.isString(e.trackLabel)?"trackLabel: string expected":null!=e.streamId&&e.hasOwnProperty("streamId")&&!c.isInteger(e.streamId)?"streamId: integer expected":null!=e.groupId&&e.hasOwnProperty("groupId")&&!c.isInteger(e.groupId)?"groupId: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkStreamAllocation)return e;var t=new l.SdkStreamAllocation;return null!=e.trackLabel&&(t.trackLabel=String(e.trackLabel)),null!=e.streamId&&(t.streamId=e.streamId>>>0),null!=e.groupId&&(t.groupId=e.groupId>>>0),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.trackLabel="",i.streamId=0,i.groupId=0),null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&(i.trackLabel=e.trackLabel),null!=e.streamId&&e.hasOwnProperty("streamId")&&(i.streamId=e.streamId),null!=e.groupId&&e.hasOwnProperty("groupId")&&(i.groupId=e.groupId),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkTrackMapping=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.streamId=e.uint32();break;case 2:n.ssrc=e.uint32();break;case 3:n.trackLabel=e.string();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.streamId&&e.hasOwnProperty("streamId")&&!c.isInteger(e.streamId)?"streamId: integer expected":null!=e.ssrc&&e.hasOwnProperty("ssrc")&&!c.isInteger(e.ssrc)?"ssrc: integer expected":null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!c.isString(e.trackLabel)?"trackLabel: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkTrackMapping)return e;var t=new l.SdkTrackMapping;return null!=e.streamId&&(t.streamId=e.streamId>>>0),null!=e.ssrc&&(t.ssrc=e.ssrc>>>0),null!=e.trackLabel&&(t.trackLabel=String(e.trackLabel)),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.streamId=0,i.ssrc=0,i.trackLabel=""),null!=e.streamId&&e.hasOwnProperty("streamId")&&(i.streamId=e.streamId),null!=e.ssrc&&e.hasOwnProperty("ssrc")&&(i.ssrc=e.ssrc),null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&(i.trackLabel=e.trackLabel),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkBitrate=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.sourceStreamId=e.uint32();break;case 2:n.avgBitrateBps=e.uint32();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.sourceStreamId&&e.hasOwnProperty("sourceStreamId")&&!c.isInteger(e.sourceStreamId)?"sourceStreamId: integer expected":null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&!c.isInteger(e.avgBitrateBps)?"avgBitrateBps: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkBitrate)return e;var t=new l.SdkBitrate;return null!=e.sourceStreamId&&(t.sourceStreamId=e.sourceStreamId>>>0),null!=e.avgBitrateBps&&(t.avgBitrateBps=e.avgBitrateBps>>>0),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.sourceStreamId=0,i.avgBitrateBps=0),null!=e.sourceStreamId&&e.hasOwnProperty("sourceStreamId")&&(i.sourceStreamId=e.sourceStreamId),null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&(i.avgBitrateBps=e.avgBitrateBps),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkAudioControlFrame=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3==1?n.muted=e.bool():e.skipType(7&r)}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.muted&&e.hasOwnProperty("muted")&&"boolean"!=typeof e.muted?"muted: boolean expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioControlFrame)return e;var t=new l.SdkAudioControlFrame;return null!=e.muted&&(t.muted=Boolean(e.muted)),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.muted=!1),null!=e.muted&&e.hasOwnProperty("muted")&&(i.muted=e.muted),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkAudioMetadataFrame=function(){function e(e){if(this.attendeeStates=[],e)for(var t=Object.keys(e),i=0;i>>3==1?(n.attendeeStates&&n.attendeeStates.length||(n.attendeeStates=[]),n.attendeeStates.push(l.SdkAudioAttendeeState.decode(e,e.uint32()))):e.skipType(7&r)}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attendeeStates&&e.hasOwnProperty("attendeeStates")){if(!Array.isArray(e.attendeeStates))return"attendeeStates: array expected";for(var t=0;t>>3){case 1:n.audioStreamId=e.uint32();break;case 2:n.volume=e.uint32();break;case 3:n.muted=e.bool();break;case 4:n.signalStrength=e.uint32();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&!c.isInteger(e.audioStreamId)?"audioStreamId: integer expected":null!=e.volume&&e.hasOwnProperty("volume")&&!c.isInteger(e.volume)?"volume: integer expected":null!=e.muted&&e.hasOwnProperty("muted")&&"boolean"!=typeof e.muted?"muted: boolean expected":null!=e.signalStrength&&e.hasOwnProperty("signalStrength")&&!c.isInteger(e.signalStrength)?"signalStrength: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioAttendeeState)return e;var t=new l.SdkAudioAttendeeState;return null!=e.audioStreamId&&(t.audioStreamId=e.audioStreamId>>>0),null!=e.volume&&(t.volume=e.volume>>>0),null!=e.muted&&(t.muted=Boolean(e.muted)),null!=e.signalStrength&&(t.signalStrength=e.signalStrength>>>0),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.audioStreamId=0,i.volume=0,i.muted=!1,i.signalStrength=0),null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&(i.audioStreamId=e.audioStreamId),null!=e.volume&&e.hasOwnProperty("volume")&&(i.volume=e.volume),null!=e.muted&&e.hasOwnProperty("muted")&&(i.muted=e.muted),null!=e.signalStrength&&e.hasOwnProperty("signalStrength")&&(i.signalStrength=e.signalStrength),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkAudioStreamIdInfoFrame=function(){function e(e){if(this.streams=[],e)for(var t=Object.keys(e),i=0;i>>3==1?(n.streams&&n.streams.length||(n.streams=[]),n.streams.push(l.SdkAudioStreamIdInfo.decode(e,e.uint32()))):e.skipType(7&r)}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.streams&&e.hasOwnProperty("streams")){if(!Array.isArray(e.streams))return"streams: array expected";for(var t=0;t>>3){case 1:n.audioStreamId=e.uint32();break;case 2:n.attendeeId=e.string();break;case 3:n.muted=e.bool();break;case 4:n.externalUserId=e.string();break;case 5:n.dropped=e.bool();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&!c.isInteger(e.audioStreamId)?"audioStreamId: integer expected":null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!c.isString(e.attendeeId)?"attendeeId: string expected":null!=e.muted&&e.hasOwnProperty("muted")&&"boolean"!=typeof e.muted?"muted: boolean expected":null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&!c.isString(e.externalUserId)?"externalUserId: string expected":null!=e.dropped&&e.hasOwnProperty("dropped")&&"boolean"!=typeof e.dropped?"dropped: boolean expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioStreamIdInfo)return e;var t=new l.SdkAudioStreamIdInfo;return null!=e.audioStreamId&&(t.audioStreamId=e.audioStreamId>>>0),null!=e.attendeeId&&(t.attendeeId=String(e.attendeeId)),null!=e.muted&&(t.muted=Boolean(e.muted)),null!=e.externalUserId&&(t.externalUserId=String(e.externalUserId)),null!=e.dropped&&(t.dropped=Boolean(e.dropped)),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.audioStreamId=0,i.attendeeId="",i.muted=!1,i.externalUserId="",i.dropped=!1),null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&(i.audioStreamId=e.audioStreamId),null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&(i.attendeeId=e.attendeeId),null!=e.muted&&e.hasOwnProperty("muted")&&(i.muted=e.muted),null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&(i.externalUserId=e.externalUserId),null!=e.dropped&&e.hasOwnProperty("dropped")&&(i.dropped=e.dropped),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkPingPongType=function(){var e={},t=Object.create(e);return t[e[1]="PING"]=1,t[e[2]="PONG"]=2,t}(),l.SdkPingPongFrame=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.type=e.int32();break;case 2:n.pingId=e.uint32();break;default:e.skipType(7&r)}}if(!n.hasOwnProperty("type"))throw c.ProtocolError("missing required 'type'",{instance:n});if(!n.hasOwnProperty("pingId"))throw c.ProtocolError("missing required 'pingId'",{instance:n});return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";switch(e.type){default:return"type: enum value expected";case 1:case 2:}return c.isInteger(e.pingId)?null:"pingId: integer expected"},e.fromObject=function(e){if(e instanceof l.SdkPingPongFrame)return e;var t=new l.SdkPingPongFrame;switch(e.type){case"PING":case 1:t.type=1;break;case"PONG":case 2:t.type=2}return null!=e.pingId&&(t.pingId=e.pingId>>>0),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.type=t.enums===String?"PING":1,i.pingId=0),null!=e.type&&e.hasOwnProperty("type")&&(i.type=t.enums===String?l.SdkPingPongType[e.type]:e.type),null!=e.pingId&&e.hasOwnProperty("pingId")&&(i.pingId=e.pingId),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkAudioStatusFrame=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3==1?n.audioStatus=e.uint32():e.skipType(7&r)}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&!c.isInteger(e.audioStatus)?"audioStatus: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioStatusFrame)return e;var t=new l.SdkAudioStatusFrame;return null!=e.audioStatus&&(t.audioStatus=e.audioStatus>>>0),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.audioStatus=0),null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&(i.audioStatus=e.audioStatus),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkMetric=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.type=e.int32();break;case 2:n.value=e.double();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.type&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:case 64:case 66:case 69:case 72:case 86:case 87:}return null!=e.value&&e.hasOwnProperty("value")&&"number"!=typeof e.value?"value: number expected":null},e.fromObject=function(e){if(e instanceof l.SdkMetric)return e;var t=new l.SdkMetric;switch(e.type){case"VIDEO_ACTUAL_ENCODER_BITRATE":case 1:t.type=1;break;case"VIDEO_AVAILABLE_SEND_BANDWIDTH":case 2:t.type=2;break;case"VIDEO_RETRANSMIT_BITRATE":case 3:t.type=3;break;case"VIDEO_AVAILABLE_RECEIVE_BANDWIDTH":case 4:t.type=4;break;case"VIDEO_TARGET_ENCODER_BITRATE":case 5:t.type=5;break;case"VIDEO_BUCKET_DELAY_MS":case 6:t.type=6;break;case"STUN_RTT_MS":case 7:t.type=7;break;case"SOCKET_DISCARDED_PPS":case 8:t.type=8;break;case"RTC_MIC_JITTER_MS":case 9:t.type=9;break;case"RTC_MIC_PPS":case 10:t.type=10;break;case"RTC_MIC_FRACTION_PACKET_LOST_PERCENT":case 11:t.type=11;break;case"RTC_MIC_BITRATE":case 12:t.type=12;break;case"RTC_MIC_RTT_MS":case 13:t.type=13;break;case"RTC_SPK_PPS":case 14:t.type=14;break;case"RTC_SPK_FRACTION_PACKET_LOST_PERCENT":case 15:t.type=15;break;case"RTC_SPK_JITTER_MS":case 16:t.type=16;break;case"RTC_SPK_FRACTION_DECODER_LOSS_PERCENT":case 17:t.type=17;break;case"RTC_SPK_BITRATE":case 18:t.type=18;break;case"RTC_SPK_CURRENT_DELAY_MS":case 19:t.type=19;break;case"RTC_SPK_JITTER_BUFFER_MS":case 20:t.type=20;break;case"VIDEO_SENT_RTT_MS":case 21:t.type=21;break;case"VIDEO_ENCODE_USAGE_PERCENT":case 22:t.type=22;break;case"VIDEO_NACKS_RECEIVED":case 23:t.type=23;break;case"VIDEO_PLIS_RECEIVED":case 24:t.type=24;break;case"VIDEO_AVERAGE_ENCODE_MS":case 25:t.type=25;break;case"VIDEO_INPUT_FPS":case 26:t.type=26;break;case"VIDEO_ENCODE_FPS":case 27:t.type=27;break;case"VIDEO_SENT_FPS":case 28:t.type=28;break;case"VIDEO_FIRS_RECEIVED":case 29:t.type=29;break;case"VIDEO_SENT_PPS":case 30:t.type=30;break;case"VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT":case 31:t.type=31;break;case"VIDEO_SENT_BITRATE":case 32:t.type=32;break;case"VIDEO_DROPPED_FPS":case 33:t.type=33;break;case"VIDEO_TARGET_DELAY_MS":case 34:t.type=34;break;case"VIDEO_DECODE_MS":case 35:t.type=35;break;case"VIDEO_OUTPUT_FPS":case 36:t.type=36;break;case"VIDEO_RECEIVED_PPS":case 37:t.type=37;break;case"VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT":case 38:t.type=38;break;case"VIDEO_RENDER_DELAY_MS":case 39:t.type=39;break;case"VIDEO_RECEIVED_FPS":case 40:t.type=40;break;case"VIDEO_DECODE_FPS":case 41:t.type=41;break;case"VIDEO_NACKS_SENT":case 42:t.type=42;break;case"VIDEO_FIRS_SENT":case 43:t.type=43;break;case"VIDEO_RECEIVED_BITRATE":case 44:t.type=44;break;case"VIDEO_CURRENT_DELAY_MS":case 45:t.type=45;break;case"VIDEO_JITTER_BUFFER_MS":case 46:t.type=46;break;case"VIDEO_DISCARDED_PPS":case 47:t.type=47;break;case"VIDEO_PLIS_SENT":case 48:t.type=48;break;case"VIDEO_RECEIVED_JITTER_MS":case 49:t.type=49;break;case"VIDEO_ENCODE_HEIGHT":case 64:t.type=64;break;case"VIDEO_SENT_QP_SUM":case 66:t.type=66;break;case"VIDEO_DECODE_HEIGHT":case 69:t.type=69;break;case"VIDEO_RECEIVED_QP_SUM":case 72:t.type=72;break;case"VIDEO_ENCODE_WIDTH":case 86:t.type=86;break;case"VIDEO_DECODE_WIDTH":case 87:t.type=87}return null!=e.value&&(t.value=Number(e.value)),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.type=t.enums===String?"VIDEO_ACTUAL_ENCODER_BITRATE":1,i.value=0),null!=e.type&&e.hasOwnProperty("type")&&(i.type=t.enums===String?l.SdkMetric.Type[e.type]:e.type),null!=e.value&&e.hasOwnProperty("value")&&(i.value=t.json&&!isFinite(e.value)?String(e.value):e.value),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e.Type=function(){var e={},t=Object.create(e);return t[e[1]="VIDEO_ACTUAL_ENCODER_BITRATE"]=1,t[e[2]="VIDEO_AVAILABLE_SEND_BANDWIDTH"]=2,t[e[3]="VIDEO_RETRANSMIT_BITRATE"]=3,t[e[4]="VIDEO_AVAILABLE_RECEIVE_BANDWIDTH"]=4,t[e[5]="VIDEO_TARGET_ENCODER_BITRATE"]=5,t[e[6]="VIDEO_BUCKET_DELAY_MS"]=6,t[e[7]="STUN_RTT_MS"]=7,t[e[8]="SOCKET_DISCARDED_PPS"]=8,t[e[9]="RTC_MIC_JITTER_MS"]=9,t[e[10]="RTC_MIC_PPS"]=10,t[e[11]="RTC_MIC_FRACTION_PACKET_LOST_PERCENT"]=11,t[e[12]="RTC_MIC_BITRATE"]=12,t[e[13]="RTC_MIC_RTT_MS"]=13,t[e[14]="RTC_SPK_PPS"]=14,t[e[15]="RTC_SPK_FRACTION_PACKET_LOST_PERCENT"]=15,t[e[16]="RTC_SPK_JITTER_MS"]=16,t[e[17]="RTC_SPK_FRACTION_DECODER_LOSS_PERCENT"]=17,t[e[18]="RTC_SPK_BITRATE"]=18,t[e[19]="RTC_SPK_CURRENT_DELAY_MS"]=19,t[e[20]="RTC_SPK_JITTER_BUFFER_MS"]=20,t[e[21]="VIDEO_SENT_RTT_MS"]=21,t[e[22]="VIDEO_ENCODE_USAGE_PERCENT"]=22,t[e[23]="VIDEO_NACKS_RECEIVED"]=23,t[e[24]="VIDEO_PLIS_RECEIVED"]=24,t[e[25]="VIDEO_AVERAGE_ENCODE_MS"]=25,t[e[26]="VIDEO_INPUT_FPS"]=26,t[e[27]="VIDEO_ENCODE_FPS"]=27,t[e[28]="VIDEO_SENT_FPS"]=28,t[e[29]="VIDEO_FIRS_RECEIVED"]=29,t[e[30]="VIDEO_SENT_PPS"]=30,t[e[31]="VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT"]=31,t[e[32]="VIDEO_SENT_BITRATE"]=32,t[e[33]="VIDEO_DROPPED_FPS"]=33,t[e[34]="VIDEO_TARGET_DELAY_MS"]=34,t[e[35]="VIDEO_DECODE_MS"]=35,t[e[36]="VIDEO_OUTPUT_FPS"]=36,t[e[37]="VIDEO_RECEIVED_PPS"]=37,t[e[38]="VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT"]=38,t[e[39]="VIDEO_RENDER_DELAY_MS"]=39,t[e[40]="VIDEO_RECEIVED_FPS"]=40,t[e[41]="VIDEO_DECODE_FPS"]=41,t[e[42]="VIDEO_NACKS_SENT"]=42,t[e[43]="VIDEO_FIRS_SENT"]=43,t[e[44]="VIDEO_RECEIVED_BITRATE"]=44,t[e[45]="VIDEO_CURRENT_DELAY_MS"]=45,t[e[46]="VIDEO_JITTER_BUFFER_MS"]=46,t[e[47]="VIDEO_DISCARDED_PPS"]=47,t[e[48]="VIDEO_PLIS_SENT"]=48,t[e[49]="VIDEO_RECEIVED_JITTER_MS"]=49,t[e[64]="VIDEO_ENCODE_HEIGHT"]=64,t[e[66]="VIDEO_SENT_QP_SUM"]=66,t[e[69]="VIDEO_DECODE_HEIGHT"]=69,t[e[72]="VIDEO_RECEIVED_QP_SUM"]=72,t[e[86]="VIDEO_ENCODE_WIDTH"]=86,t[e[87]="VIDEO_DECODE_WIDTH"]=87,t}(),e}(),l.SdkStreamMetricFrame=function(){function e(e){if(this.metrics=[],e)for(var t=Object.keys(e),i=0;i>>3){case 3:n.streamId=e.uint32();break;case 4:n.groupId=e.uint32();break;case 5:n.metrics&&n.metrics.length||(n.metrics=[]),n.metrics.push(l.SdkMetric.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.streamId&&e.hasOwnProperty("streamId")&&!c.isInteger(e.streamId))return"streamId: integer expected";if(null!=e.groupId&&e.hasOwnProperty("groupId")&&!c.isInteger(e.groupId))return"groupId: integer expected";if(null!=e.metrics&&e.hasOwnProperty("metrics")){if(!Array.isArray(e.metrics))return"metrics: array expected";for(var t=0;t>>0),null!=e.groupId&&(t.groupId=e.groupId>>>0),e.metrics){if(!Array.isArray(e.metrics))throw TypeError(".SdkStreamMetricFrame.metrics: array expected");t.metrics=[];for(var i=0;i>>3){case 1:n.globalMetrics&&n.globalMetrics.length||(n.globalMetrics=[]),n.globalMetrics.push(l.SdkMetric.decode(e,e.uint32()));break;case 2:n.streamMetricFrames&&n.streamMetricFrames.length||(n.streamMetricFrames=[]),n.streamMetricFrames.push(l.SdkStreamMetricFrame.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.globalMetrics&&e.hasOwnProperty("globalMetrics")){if(!Array.isArray(e.globalMetrics))return"globalMetrics: array expected";for(var t=0;t>>3==1?(n.messages&&n.messages.length||(n.messages=[]),n.messages.push(l.SdkDataMessagePayload.decode(e,e.uint32()))):e.skipType(7&r)}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.messages&&e.hasOwnProperty("messages")){if(!Array.isArray(e.messages))return"messages: array expected";for(var t=0;t>>3){case 1:n.topic=e.string();break;case 2:n.data=e.bytes();break;case 3:n.lifetimeMs=e.uint32();break;case 4:n.senderAttendeeId=e.string();break;case 5:n.ingestTimeNs=e.int64();break;case 6:n.senderExternalUserId=e.string();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.topic&&e.hasOwnProperty("topic")&&!c.isString(e.topic)?"topic: string expected":null!=e.data&&e.hasOwnProperty("data")&&!(e.data&&"number"==typeof e.data.length||c.isString(e.data))?"data: buffer expected":null!=e.lifetimeMs&&e.hasOwnProperty("lifetimeMs")&&!c.isInteger(e.lifetimeMs)?"lifetimeMs: integer expected":null!=e.senderAttendeeId&&e.hasOwnProperty("senderAttendeeId")&&!c.isString(e.senderAttendeeId)?"senderAttendeeId: string expected":null!=e.ingestTimeNs&&e.hasOwnProperty("ingestTimeNs")&&!(c.isInteger(e.ingestTimeNs)||e.ingestTimeNs&&c.isInteger(e.ingestTimeNs.low)&&c.isInteger(e.ingestTimeNs.high))?"ingestTimeNs: integer|Long expected":null!=e.senderExternalUserId&&e.hasOwnProperty("senderExternalUserId")&&!c.isString(e.senderExternalUserId)?"senderExternalUserId: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkDataMessagePayload)return e;var t=new l.SdkDataMessagePayload;return null!=e.topic&&(t.topic=String(e.topic)),null!=e.data&&("string"==typeof e.data?c.base64.decode(e.data,t.data=c.newBuffer(c.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.lifetimeMs&&(t.lifetimeMs=e.lifetimeMs>>>0),null!=e.senderAttendeeId&&(t.senderAttendeeId=String(e.senderAttendeeId)),null!=e.ingestTimeNs&&(c.Long?(t.ingestTimeNs=c.Long.fromValue(e.ingestTimeNs)).unsigned=!1:"string"==typeof e.ingestTimeNs?t.ingestTimeNs=parseInt(e.ingestTimeNs,10):"number"==typeof e.ingestTimeNs?t.ingestTimeNs=e.ingestTimeNs:"object"==typeof e.ingestTimeNs&&(t.ingestTimeNs=new c.LongBits(e.ingestTimeNs.low>>>0,e.ingestTimeNs.high>>>0).toNumber())),null!=e.senderExternalUserId&&(t.senderExternalUserId=String(e.senderExternalUserId)),t},e.toObject=function(e,t){t||(t={});var i={};if(t.defaults){if(i.topic="",t.bytes===String?i.data="":(i.data=[],t.bytes!==Array&&(i.data=c.newBuffer(i.data))),i.lifetimeMs=0,i.senderAttendeeId="",c.Long){var n=new c.Long(0,0,!1);i.ingestTimeNs=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else i.ingestTimeNs=t.longs===String?"0":0;i.senderExternalUserId=""}return null!=e.topic&&e.hasOwnProperty("topic")&&(i.topic=e.topic),null!=e.data&&e.hasOwnProperty("data")&&(i.data=t.bytes===String?c.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),null!=e.lifetimeMs&&e.hasOwnProperty("lifetimeMs")&&(i.lifetimeMs=e.lifetimeMs),null!=e.senderAttendeeId&&e.hasOwnProperty("senderAttendeeId")&&(i.senderAttendeeId=e.senderAttendeeId),null!=e.ingestTimeNs&&e.hasOwnProperty("ingestTimeNs")&&("number"==typeof e.ingestTimeNs?i.ingestTimeNs=t.longs===String?String(e.ingestTimeNs):e.ingestTimeNs:i.ingestTimeNs=t.longs===String?c.Long.prototype.toString.call(e.ingestTimeNs):t.longs===Number?new c.LongBits(e.ingestTimeNs.low>>>0,e.ingestTimeNs.high>>>0).toNumber():e.ingestTimeNs),null!=e.senderExternalUserId&&e.hasOwnProperty("senderExternalUserId")&&(i.senderExternalUserId=e.senderExternalUserId),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkTurnCredentials=function(){function e(e){if(this.uris=[],e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.username=e.string();break;case 2:n.password=e.string();break;case 3:n.ttl=e.uint32();break;case 4:n.uris&&n.uris.length||(n.uris=[]),n.uris.push(e.string());break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.username&&e.hasOwnProperty("username")&&!c.isString(e.username))return"username: string expected";if(null!=e.password&&e.hasOwnProperty("password")&&!c.isString(e.password))return"password: string expected";if(null!=e.ttl&&e.hasOwnProperty("ttl")&&!c.isInteger(e.ttl))return"ttl: integer expected";if(null!=e.uris&&e.hasOwnProperty("uris")){if(!Array.isArray(e.uris))return"uris: array expected";for(var t=0;t>>0),e.uris){if(!Array.isArray(e.uris))throw TypeError(".SdkTurnCredentials.uris: array expected");t.uris=[];for(var i=0;i>>3){case 1:n.content=e.string();break;case 2:n.endTime=e.int64();break;case 3:n.speakerAttendeeId=e.string();break;case 4:n.speakerExternalUserId=e.string();break;case 5:n.startTime=e.int64();break;case 6:n.type=e.int32();break;case 7:n.vocabularyFilterMatch=e.bool();break;case 8:n.confidence=e.double();break;case 9:n.stable=e.bool();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.content&&e.hasOwnProperty("content")&&!c.isString(e.content))return"content: string expected";if(null!=e.endTime&&e.hasOwnProperty("endTime")&&!(c.isInteger(e.endTime)||e.endTime&&c.isInteger(e.endTime.low)&&c.isInteger(e.endTime.high)))return"endTime: integer|Long expected";if(null!=e.speakerAttendeeId&&e.hasOwnProperty("speakerAttendeeId")&&!c.isString(e.speakerAttendeeId))return"speakerAttendeeId: string expected";if(null!=e.speakerExternalUserId&&e.hasOwnProperty("speakerExternalUserId")&&!c.isString(e.speakerExternalUserId))return"speakerExternalUserId: string expected";if(null!=e.startTime&&e.hasOwnProperty("startTime")&&!(c.isInteger(e.startTime)||e.startTime&&c.isInteger(e.startTime.low)&&c.isInteger(e.startTime.high)))return"startTime: integer|Long expected";if(null!=e.type&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 1:case 2:}return null!=e.vocabularyFilterMatch&&e.hasOwnProperty("vocabularyFilterMatch")&&"boolean"!=typeof e.vocabularyFilterMatch?"vocabularyFilterMatch: boolean expected":null!=e.confidence&&e.hasOwnProperty("confidence")&&"number"!=typeof e.confidence?"confidence: number expected":null!=e.stable&&e.hasOwnProperty("stable")&&"boolean"!=typeof e.stable?"stable: boolean expected":null},e.fromObject=function(e){if(e instanceof l.SdkTranscriptItem)return e;var t=new l.SdkTranscriptItem;switch(null!=e.content&&(t.content=String(e.content)),null!=e.endTime&&(c.Long?(t.endTime=c.Long.fromValue(e.endTime)).unsigned=!1:"string"==typeof e.endTime?t.endTime=parseInt(e.endTime,10):"number"==typeof e.endTime?t.endTime=e.endTime:"object"==typeof e.endTime&&(t.endTime=new c.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber())),null!=e.speakerAttendeeId&&(t.speakerAttendeeId=String(e.speakerAttendeeId)),null!=e.speakerExternalUserId&&(t.speakerExternalUserId=String(e.speakerExternalUserId)),null!=e.startTime&&(c.Long?(t.startTime=c.Long.fromValue(e.startTime)).unsigned=!1:"string"==typeof e.startTime?t.startTime=parseInt(e.startTime,10):"number"==typeof e.startTime?t.startTime=e.startTime:"object"==typeof e.startTime&&(t.startTime=new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber())),e.type){case"PRONUNCIATION":case 1:t.type=1;break;case"PUNCTUATION":case 2:t.type=2}return null!=e.vocabularyFilterMatch&&(t.vocabularyFilterMatch=Boolean(e.vocabularyFilterMatch)),null!=e.confidence&&(t.confidence=Number(e.confidence)),null!=e.stable&&(t.stable=Boolean(e.stable)),t},e.toObject=function(e,t){t||(t={});var i={};if(t.defaults){if(i.content="",c.Long){var n=new c.Long(0,0,!1);i.endTime=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else i.endTime=t.longs===String?"0":0;i.speakerAttendeeId="",i.speakerExternalUserId="",c.Long?(n=new c.Long(0,0,!1),i.startTime=t.longs===String?n.toString():t.longs===Number?n.toNumber():n):i.startTime=t.longs===String?"0":0,i.type=t.enums===String?"PRONUNCIATION":1,i.vocabularyFilterMatch=!1,i.confidence=0,i.stable=!1}return null!=e.content&&e.hasOwnProperty("content")&&(i.content=e.content),null!=e.endTime&&e.hasOwnProperty("endTime")&&("number"==typeof e.endTime?i.endTime=t.longs===String?String(e.endTime):e.endTime:i.endTime=t.longs===String?c.Long.prototype.toString.call(e.endTime):t.longs===Number?new c.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber():e.endTime),null!=e.speakerAttendeeId&&e.hasOwnProperty("speakerAttendeeId")&&(i.speakerAttendeeId=e.speakerAttendeeId),null!=e.speakerExternalUserId&&e.hasOwnProperty("speakerExternalUserId")&&(i.speakerExternalUserId=e.speakerExternalUserId),null!=e.startTime&&e.hasOwnProperty("startTime")&&("number"==typeof e.startTime?i.startTime=t.longs===String?String(e.startTime):e.startTime:i.startTime=t.longs===String?c.Long.prototype.toString.call(e.startTime):t.longs===Number?new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber():e.startTime),null!=e.type&&e.hasOwnProperty("type")&&(i.type=t.enums===String?l.SdkTranscriptItem.Type[e.type]:e.type),null!=e.vocabularyFilterMatch&&e.hasOwnProperty("vocabularyFilterMatch")&&(i.vocabularyFilterMatch=e.vocabularyFilterMatch),null!=e.confidence&&e.hasOwnProperty("confidence")&&(i.confidence=t.json&&!isFinite(e.confidence)?String(e.confidence):e.confidence),null!=e.stable&&e.hasOwnProperty("stable")&&(i.stable=e.stable),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e.Type=function(){var e={},t=Object.create(e);return t[e[1]="PRONUNCIATION"]=1,t[e[2]="PUNCTUATION"]=2,t}(),e}(),l.SdkTranscriptEntity=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.category=e.string();break;case 2:n.confidence=e.double();break;case 3:n.content=e.string();break;case 4:n.endTime=e.int64();break;case 5:n.startTime=e.int64();break;case 6:n.type=e.string();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.category&&e.hasOwnProperty("category")&&!c.isString(e.category)?"category: string expected":null!=e.confidence&&e.hasOwnProperty("confidence")&&"number"!=typeof e.confidence?"confidence: number expected":null!=e.content&&e.hasOwnProperty("content")&&!c.isString(e.content)?"content: string expected":null!=e.endTime&&e.hasOwnProperty("endTime")&&!(c.isInteger(e.endTime)||e.endTime&&c.isInteger(e.endTime.low)&&c.isInteger(e.endTime.high))?"endTime: integer|Long expected":null!=e.startTime&&e.hasOwnProperty("startTime")&&!(c.isInteger(e.startTime)||e.startTime&&c.isInteger(e.startTime.low)&&c.isInteger(e.startTime.high))?"startTime: integer|Long expected":null!=e.type&&e.hasOwnProperty("type")&&!c.isString(e.type)?"type: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkTranscriptEntity)return e;var t=new l.SdkTranscriptEntity;return null!=e.category&&(t.category=String(e.category)),null!=e.confidence&&(t.confidence=Number(e.confidence)),null!=e.content&&(t.content=String(e.content)),null!=e.endTime&&(c.Long?(t.endTime=c.Long.fromValue(e.endTime)).unsigned=!1:"string"==typeof e.endTime?t.endTime=parseInt(e.endTime,10):"number"==typeof e.endTime?t.endTime=e.endTime:"object"==typeof e.endTime&&(t.endTime=new c.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber())),null!=e.startTime&&(c.Long?(t.startTime=c.Long.fromValue(e.startTime)).unsigned=!1:"string"==typeof e.startTime?t.startTime=parseInt(e.startTime,10):"number"==typeof e.startTime?t.startTime=e.startTime:"object"==typeof e.startTime&&(t.startTime=new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber())),null!=e.type&&(t.type=String(e.type)),t},e.toObject=function(e,t){t||(t={});var i={};if(t.defaults){if(i.category="",i.confidence=0,i.content="",c.Long){var n=new c.Long(0,0,!1);i.endTime=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else i.endTime=t.longs===String?"0":0;c.Long?(n=new c.Long(0,0,!1),i.startTime=t.longs===String?n.toString():t.longs===Number?n.toNumber():n):i.startTime=t.longs===String?"0":0,i.type=""}return null!=e.category&&e.hasOwnProperty("category")&&(i.category=e.category),null!=e.confidence&&e.hasOwnProperty("confidence")&&(i.confidence=t.json&&!isFinite(e.confidence)?String(e.confidence):e.confidence),null!=e.content&&e.hasOwnProperty("content")&&(i.content=e.content),null!=e.endTime&&e.hasOwnProperty("endTime")&&("number"==typeof e.endTime?i.endTime=t.longs===String?String(e.endTime):e.endTime:i.endTime=t.longs===String?c.Long.prototype.toString.call(e.endTime):t.longs===Number?new c.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber():e.endTime),null!=e.startTime&&e.hasOwnProperty("startTime")&&("number"==typeof e.startTime?i.startTime=t.longs===String?String(e.startTime):e.startTime:i.startTime=t.longs===String?c.Long.prototype.toString.call(e.startTime):t.longs===Number?new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber():e.startTime),null!=e.type&&e.hasOwnProperty("type")&&(i.type=e.type),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkTranscriptAlternative=function(){function e(e){if(this.items=[],this.entities=[],e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.items&&n.items.length||(n.items=[]),n.items.push(l.SdkTranscriptItem.decode(e,e.uint32()));break;case 2:n.transcript=e.string();break;case 3:n.entities&&n.entities.length||(n.entities=[]),n.entities.push(l.SdkTranscriptEntity.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.items&&e.hasOwnProperty("items")){if(!Array.isArray(e.items))return"items: array expected";for(var t=0;t>>3){case 1:n.languageCode=e.string();break;case 2:n.score=e.double();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.languageCode&&e.hasOwnProperty("languageCode")&&!c.isString(e.languageCode)?"languageCode: string expected":null!=e.score&&e.hasOwnProperty("score")&&"number"!=typeof e.score?"score: number expected":null},e.fromObject=function(e){if(e instanceof l.SdkTranscriptLanguageWithScore)return e;var t=new l.SdkTranscriptLanguageWithScore;return null!=e.languageCode&&(t.languageCode=String(e.languageCode)),null!=e.score&&(t.score=Number(e.score)),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.languageCode="",i.score=0),null!=e.languageCode&&e.hasOwnProperty("languageCode")&&(i.languageCode=e.languageCode),null!=e.score&&e.hasOwnProperty("score")&&(i.score=t.json&&!isFinite(e.score)?String(e.score):e.score),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkTranscriptResult=function(){function e(e){if(this.alternatives=[],this.languageIdentification=[],e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.alternatives&&n.alternatives.length||(n.alternatives=[]),n.alternatives.push(l.SdkTranscriptAlternative.decode(e,e.uint32()));break;case 2:n.channelId=e.string();break;case 3:n.endTime=e.int64();break;case 4:n.isPartial=e.bool();break;case 5:n.resultId=e.string();break;case 6:n.startTime=e.int64();break;case 7:n.languageCode=e.string();break;case 8:n.languageIdentification&&n.languageIdentification.length||(n.languageIdentification=[]),n.languageIdentification.push(l.SdkTranscriptLanguageWithScore.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.alternatives&&e.hasOwnProperty("alternatives")){if(!Array.isArray(e.alternatives))return"alternatives: array expected";for(var t=0;t>>0,e.endTime.high>>>0).toNumber())),null!=e.isPartial&&(t.isPartial=Boolean(e.isPartial)),null!=e.resultId&&(t.resultId=String(e.resultId)),null!=e.startTime&&(c.Long?(t.startTime=c.Long.fromValue(e.startTime)).unsigned=!1:"string"==typeof e.startTime?t.startTime=parseInt(e.startTime,10):"number"==typeof e.startTime?t.startTime=e.startTime:"object"==typeof e.startTime&&(t.startTime=new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber())),null!=e.languageCode&&(t.languageCode=String(e.languageCode)),e.languageIdentification){if(!Array.isArray(e.languageIdentification))throw TypeError(".SdkTranscriptResult.languageIdentification: array expected");for(t.languageIdentification=[],i=0;i>>0,e.endTime.high>>>0).toNumber():e.endTime),null!=e.isPartial&&e.hasOwnProperty("isPartial")&&(i.isPartial=e.isPartial),null!=e.resultId&&e.hasOwnProperty("resultId")&&(i.resultId=e.resultId),null!=e.startTime&&e.hasOwnProperty("startTime")&&("number"==typeof e.startTime?i.startTime=t.longs===String?String(e.startTime):e.startTime:i.startTime=t.longs===String?c.Long.prototype.toString.call(e.startTime):t.longs===Number?new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber():e.startTime),null!=e.languageCode&&e.hasOwnProperty("languageCode")&&(i.languageCode=e.languageCode),e.languageIdentification&&e.languageIdentification.length)for(i.languageIdentification=[],r=0;r>>3==1?(n.results&&n.results.length||(n.results=[]),n.results.push(l.SdkTranscriptResult.decode(e,e.uint32()))):e.skipType(7&r)}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.results&&e.hasOwnProperty("results")){if(!Array.isArray(e.results))return"results: array expected";for(var t=0;t>>3){case 1:n.type=e.int32();break;case 2:n.eventTime=e.int64();break;case 3:n.transcriptionRegion=e.string();break;case 4:n.transcriptionConfiguration=e.string();break;case 5:n.message=e.string();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.type&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:}return null!=e.eventTime&&e.hasOwnProperty("eventTime")&&!(c.isInteger(e.eventTime)||e.eventTime&&c.isInteger(e.eventTime.low)&&c.isInteger(e.eventTime.high))?"eventTime: integer|Long expected":null!=e.transcriptionRegion&&e.hasOwnProperty("transcriptionRegion")&&!c.isString(e.transcriptionRegion)?"transcriptionRegion: string expected":null!=e.transcriptionConfiguration&&e.hasOwnProperty("transcriptionConfiguration")&&!c.isString(e.transcriptionConfiguration)?"transcriptionConfiguration: string expected":null!=e.message&&e.hasOwnProperty("message")&&!c.isString(e.message)?"message: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkTranscriptionStatus)return e;var t=new l.SdkTranscriptionStatus;switch(e.type){case"STARTED":case 1:t.type=1;break;case"INTERRUPTED":case 2:t.type=2;break;case"RESUMED":case 3:t.type=3;break;case"STOPPED":case 4:t.type=4;break;case"FAILED":case 5:t.type=5}return null!=e.eventTime&&(c.Long?(t.eventTime=c.Long.fromValue(e.eventTime)).unsigned=!1:"string"==typeof e.eventTime?t.eventTime=parseInt(e.eventTime,10):"number"==typeof e.eventTime?t.eventTime=e.eventTime:"object"==typeof e.eventTime&&(t.eventTime=new c.LongBits(e.eventTime.low>>>0,e.eventTime.high>>>0).toNumber())),null!=e.transcriptionRegion&&(t.transcriptionRegion=String(e.transcriptionRegion)),null!=e.transcriptionConfiguration&&(t.transcriptionConfiguration=String(e.transcriptionConfiguration)),null!=e.message&&(t.message=String(e.message)),t},e.toObject=function(e,t){t||(t={});var i={};if(t.defaults){if(i.type=t.enums===String?"STARTED":1,c.Long){var n=new c.Long(0,0,!1);i.eventTime=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else i.eventTime=t.longs===String?"0":0;i.transcriptionRegion="",i.transcriptionConfiguration="",i.message=""}return null!=e.type&&e.hasOwnProperty("type")&&(i.type=t.enums===String?l.SdkTranscriptionStatus.Type[e.type]:e.type),null!=e.eventTime&&e.hasOwnProperty("eventTime")&&("number"==typeof e.eventTime?i.eventTime=t.longs===String?String(e.eventTime):e.eventTime:i.eventTime=t.longs===String?c.Long.prototype.toString.call(e.eventTime):t.longs===Number?new c.LongBits(e.eventTime.low>>>0,e.eventTime.high>>>0).toNumber():e.eventTime),null!=e.transcriptionRegion&&e.hasOwnProperty("transcriptionRegion")&&(i.transcriptionRegion=e.transcriptionRegion),null!=e.transcriptionConfiguration&&e.hasOwnProperty("transcriptionConfiguration")&&(i.transcriptionConfiguration=e.transcriptionConfiguration),null!=e.message&&e.hasOwnProperty("message")&&(i.message=e.message),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e.Type=function(){var e={},t=Object.create(e);return t[e[1]="STARTED"]=1,t[e[2]="INTERRUPTED"]=2,t[e[3]="RESUMED"]=3,t[e[4]="STOPPED"]=4,t[e[5]="FAILED"]=5,t}(),e}(),l.SdkTranscriptEvent=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.status=l.SdkTranscriptionStatus.decode(e,e.uint32());break;case 2:n.transcript=l.SdkTranscript.decode(e,e.uint32());break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.status&&e.hasOwnProperty("status")&&(t.Event=1,i=l.SdkTranscriptionStatus.verify(e.status)))return"status."+i;if(null!=e.transcript&&e.hasOwnProperty("transcript")){if(1===t.Event)return"Event: multiple values";var i;if(t.Event=1,i=l.SdkTranscript.verify(e.transcript))return"transcript."+i}return null},e.fromObject=function(e){if(e instanceof l.SdkTranscriptEvent)return e;var t=new l.SdkTranscriptEvent;if(null!=e.status){if("object"!=typeof e.status)throw TypeError(".SdkTranscriptEvent.status: object expected");t.status=l.SdkTranscriptionStatus.fromObject(e.status)}if(null!=e.transcript){if("object"!=typeof e.transcript)throw TypeError(".SdkTranscriptEvent.transcript: object expected");t.transcript=l.SdkTranscript.fromObject(e.transcript)}return t},e.toObject=function(e,t){t||(t={});var i={};return null!=e.status&&e.hasOwnProperty("status")&&(i.status=l.SdkTranscriptionStatus.toObject(e.status,t),t.oneofs&&(i.Event="status")),null!=e.transcript&&e.hasOwnProperty("transcript")&&(i.transcript=l.SdkTranscript.toObject(e.transcript,t),t.oneofs&&(i.Event="transcript")),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkTranscriptFrame=function(){function e(e){if(this.events=[],e)for(var t=Object.keys(e),i=0;i>>3==1?(n.events&&n.events.length||(n.events=[]),n.events.push(l.SdkTranscriptEvent.decode(e,e.uint32()))):e.skipType(7&r)}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.events&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(var t=0;t>>3){case 1:n.addedOrUpdatedVideoSubscriptions&&n.addedOrUpdatedVideoSubscriptions.length||(n.addedOrUpdatedVideoSubscriptions=[]),n.addedOrUpdatedVideoSubscriptions.push(l.SdkVideoSubscriptionConfiguration.decode(e,e.uint32()));break;case 2:n.removedVideoSubscriptionMids&&n.removedVideoSubscriptionMids.length||(n.removedVideoSubscriptionMids=[]),n.removedVideoSubscriptionMids.push(e.string());break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.addedOrUpdatedVideoSubscriptions&&e.hasOwnProperty("addedOrUpdatedVideoSubscriptions")){if(!Array.isArray(e.addedOrUpdatedVideoSubscriptions))return"addedOrUpdatedVideoSubscriptions: array expected";for(var t=0;t>>3){case 1:n.mid=e.string();break;case 2:n.attendeeId=e.string();break;case 3:n.streamId=e.uint32();break;case 4:n.priority=e.uint32();break;case 5:n.targetBitrateKbps=e.uint32();break;case 6:n.groupId=e.uint32();break;default:e.skipType(7&r)}}if(!n.hasOwnProperty("mid"))throw c.ProtocolError("missing required 'mid'",{instance:n});return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":c.isString(e.mid)?null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!c.isString(e.attendeeId)?"attendeeId: string expected":null!=e.streamId&&e.hasOwnProperty("streamId")&&!c.isInteger(e.streamId)?"streamId: integer expected":null!=e.priority&&e.hasOwnProperty("priority")&&!c.isInteger(e.priority)?"priority: integer expected":null!=e.targetBitrateKbps&&e.hasOwnProperty("targetBitrateKbps")&&!c.isInteger(e.targetBitrateKbps)?"targetBitrateKbps: integer expected":null!=e.groupId&&e.hasOwnProperty("groupId")&&!c.isInteger(e.groupId)?"groupId: integer expected":null:"mid: string expected"},e.fromObject=function(e){if(e instanceof l.SdkVideoSubscriptionConfiguration)return e;var t=new l.SdkVideoSubscriptionConfiguration;return null!=e.mid&&(t.mid=String(e.mid)),null!=e.attendeeId&&(t.attendeeId=String(e.attendeeId)),null!=e.streamId&&(t.streamId=e.streamId>>>0),null!=e.priority&&(t.priority=e.priority>>>0),null!=e.targetBitrateKbps&&(t.targetBitrateKbps=e.targetBitrateKbps>>>0),null!=e.groupId&&(t.groupId=e.groupId>>>0),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.mid="",i.attendeeId="",i.streamId=0,i.priority=0,i.targetBitrateKbps=0,i.groupId=0),null!=e.mid&&e.hasOwnProperty("mid")&&(i.mid=e.mid),null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&(i.attendeeId=e.attendeeId),null!=e.streamId&&e.hasOwnProperty("streamId")&&(i.streamId=e.streamId),null!=e.priority&&e.hasOwnProperty("priority")&&(i.priority=e.priority),null!=e.targetBitrateKbps&&e.hasOwnProperty("targetBitrateKbps")&&(i.targetBitrateKbps=e.targetBitrateKbps),null!=e.groupId&&e.hasOwnProperty("groupId")&&(i.groupId=e.groupId),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkPrimaryMeetingJoinFrame=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3==1?n.credentials=l.SdkMeetingSessionCredentials.decode(e,e.uint32()):e.skipType(7&r)}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.credentials&&e.hasOwnProperty("credentials")){var t=l.SdkMeetingSessionCredentials.verify(e.credentials);if(t)return"credentials."+t}return null},e.fromObject=function(e){if(e instanceof l.SdkPrimaryMeetingJoinFrame)return e;var t=new l.SdkPrimaryMeetingJoinFrame;if(null!=e.credentials){if("object"!=typeof e.credentials)throw TypeError(".SdkPrimaryMeetingJoinFrame.credentials: object expected");t.credentials=l.SdkMeetingSessionCredentials.fromObject(e.credentials)}return t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.credentials=null),null!=e.credentials&&e.hasOwnProperty("credentials")&&(i.credentials=l.SdkMeetingSessionCredentials.toObject(e.credentials,t)),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkPrimaryMeetingJoinAckFrame=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i>>3){case 1:n.attendeeId=e.string();break;case 2:n.externalUserId=e.string();break;case 3:n.joinToken=e.string();break;default:e.skipType(7&r)}}return n},e.decodeDelimited=function(e){return e instanceof o||(e=new o(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!c.isString(e.attendeeId)?"attendeeId: string expected":null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&!c.isString(e.externalUserId)?"externalUserId: string expected":null!=e.joinToken&&e.hasOwnProperty("joinToken")&&!c.isString(e.joinToken)?"joinToken: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkMeetingSessionCredentials)return e;var t=new l.SdkMeetingSessionCredentials;return null!=e.attendeeId&&(t.attendeeId=String(e.attendeeId)),null!=e.externalUserId&&(t.externalUserId=String(e.externalUserId)),null!=e.joinToken&&(t.joinToken=String(e.joinToken)),t},e.toObject=function(e,t){t||(t={});var i={};return t.defaults&&(i.attendeeId="",i.externalUserId="",i.joinToken=""),null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&(i.attendeeId=e.attendeeId),null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&(i.externalUserId=e.externalUserId),null!=e.joinToken&&e.hasOwnProperty("joinToken")&&(i.joinToken=e.joinToken),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,a.util.toJSONOptions)},e}(),l.SdkVideoCodecCapability=function(){var e={},t=Object.create(e);return t[e[1]="VP8"]=1,t[e[3]="H264_CONSTRAINED_BASELINE_PROFILE"]=3,t}(),e.exports=l,c.Long=void 0,a.configure()},334:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(1938),a=i(3538),o=i(4046);t.default=class{constructor(e){this.chimeClient=e}makeTwoDigits(e){return e>9?e.toString():"0"+e.toString()}hmac(e,t){const i=new r.Sha256(t);return i.update(e),i.digest()}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,r){return n(this,void 0,void 0,(function*(){const n=yield this.hmac(t,"AWS4"+e),a=yield this.hmac(i,n),o=yield this.hmac(r,a);return yield this.hmac("aws4_request",o)}))}signURL(e,t,i,r,s,c,l){return n(this,void 0,void 0,(function*(){const n=this.getDateTimeString(),u=this.getDateString(n);let d="";d=this.chimeClient.config.region instanceof Function?yield this.chimeClient.config.region():this.chimeClient.config.region;const f="host:"+r.toLowerCase()+"\n",C=u+"/"+d+"/"+i+"/aws4_request";let h;h=this.chimeClient.config.credentials instanceof Function?yield this.chimeClient.config.credentials():this.chimeClient.config.credentials;let p=new Map;p.set("X-Amz-Algorithm",["AWS4-HMAC-SHA256"]),p.set("X-Amz-Credential",[encodeURIComponent(h.accessKeyId+"/"+C)]),p.set("X-Amz-Date",[n]),p.set("X-Amz-Expires",["10"]),p.set("X-Amz-SignedHeaders",["host"]),h.sessionToken&&p.set("X-Amz-Security-Token",[encodeURIComponent(h.sessionToken)]),p.set(o.default.X_AMZN_VERSION,[encodeURIComponent(o.default.sdkVersion)]),p.set(o.default.X_AMZN_USER_AGENT,[encodeURIComponent(o.default.sdkUserAgentLowResolution)]),null==l||l.forEach(((e,t)=>{const i=encodeURIComponent(t);e.sort().forEach((e=>{p.has(i)||p.set(i,[]),p.get(i).push(encodeURIComponent(e))}))}));let m="";p=new Map([...p.entries()].sort()),p.forEach(((e,t)=>{e.forEach((e=>{m.length&&(m+="&"),m+=t+"="+e}))}));const v=e+"\n"+s+"\n"+m+"\n"+f+"\nhost\n"+a.toHex(yield this.hmac(c)),g=a.toHex(yield this.hmac(v)),b="AWS4-HMAC-SHA256\n"+n+"\n"+u+"/"+d+"/"+i+"/aws4_request\n"+g,M=yield this.getSignatureKey(h.secretAccessKey,u,d,i),y=a.toHex(yield this.hmac(b,M));return t+"://"+r+s+"?"+m+"&X-Amz-Signature="+y}))}}},7606:(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},9880:(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},8597:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(4571),a=i(6196),o=i(9496),s=i(2811),c=i(7604),l=i(1296),u=i(3922),d=i(289),f=i(8660),C=i(9880),h=i(155);class p{constructor(e,t,i=p.INTERVAL_MS){this.audioVideoController=e,this.logger=t,this.interval=i,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(C.default[e]);this.logEvent(i,t)}logVideoEvent(e,t){const i="video"+this.toSuffix(h.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:p.CLIENT_TYPE,metric_type:"latency"});this.logger.debug((()=>`[StatsCollector] ${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(c.default[e])}`,lifecycle_event_code:`${e}`,lifecycle_event_condition:`condition${this.toSuffix(l.default[t])}`,lifecycle_event_condition_code:`${t}`};this.logEvent("meeting_session_lifecycle",i)}logEvent(e,t={}){const i=Object.assign(Object.assign({},t),{call_id:this.audioVideoController.configuration.meetingId,client_type:p.CLIENT_TYPE});this.logger.debug((()=>`[StatsCollector] ${e}: ${JSON.stringify(i)}`)),this.metricsLogEvent(e,i)}start(e,t){return!this.intervalScheduler&&(this.logger.info("Starting StatsCollector"),this.signalingClient=e,this.videoStreamIndex=t,this.clientMetricReport=new r.default(this.logger,this.videoStreamIndex,this.audioVideoController.configuration.credentials.attendeeId),this.intervalScheduler=new u.default(this.interval),this.intervalScheduler.start((()=>n(this,void 0,void 0,(function*(){yield this.getStatsWrapper()})))),!0)}stop(){this.logger.info("Stopping StatsCollector"),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 t in e)t in n&&(i.previousMetrics[t]=i.currentMetrics[t],i.currentMetrics[t]=e[t])}processRawMetricReports(e){this.clientMetricReport.currentSsrcs={};const t=Date.now();for(const t of e){const e=this.isStreamRawMetricReport(t.type);if(e){const e=this.clientMetricReport.streamMetricReports[Number(t.ssrc)];if(e)e.streamId=this.videoStreamIndex.streamIdForSSRC(Number(t.ssrc));else{const e=new s.default;e.mediaType=this.getMediaType(t),e.direction=this.getDirectionType(t),this.videoStreamIndex.allStreams().empty()||(e.streamId=this.videoStreamIndex.streamIdForSSRC(Number(t.ssrc))),this.clientMetricReport.streamMetricReports[Number(t.ssrc)]=e}this.clientMetricReport.currentSsrcs[Number(t.ssrc)]=1}this.updateMetricValues(t,e)}this.clientMetricReport.removeDestroyedSsrcs(),this.clientMetricReport.previousTimestampMs=this.clientMetricReport.currentTimestampMs,this.clientMetricReport.currentTimestampMs=t,this.clientMetricReport.print()}addMetricFrame(e,t,i,n){const r=i.type,a=i.transform,o=i.source,s=t.streamMetricFrames.length,c=t.streamMetricFrames[s-1];if(r){const i=d.SdkMetric.create();i.type=r,i.value=a(o||e,n),n?c.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=d.SdkStreamMetricFrame.create();n.streamId=i.streamId,n.metrics=[],e.streamMetricFrames.push(n);const r=this.clientMetricReport.getMetricMap(i.mediaType,i.direction);for(const n in i.currentMetrics)this.addMetricFrame(n,e,r[n],Number(t))}}makeClientMetricProtobuf(){const e=d.SdkClientMetricFrame.create();return e.globalMetrics=[],e.streamMetricFrames=[],this.addGlobalMetricsToProtobuf(e),this.addStreamMetricsToProtobuf(e),e}sendClientMetricProtobuf(e){this.signalingClient.sendClientMetrics(e)}isStreamRawMetricReport(e){return["inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp"].includes(e)}getMediaType(e){return"audio"===e.kind?o.default.AUDIO:o.default.VIDEO}getDirectionType(e){const{type:t}=e;return"inbound-rtp"===t||"remote-outbound-rtp"===t?a.default.DOWNSTREAM:a.default.UPSTREAM}isValidStandardRawMetric(e){return"inbound-rtp"===e.type||"outbound-rtp"===e.type||"remote-inbound-rtp"===e.type||"remote-outbound-rtp"===e.type||"candidate-pair"===e.type&&"succeeded"===e.state}isValidSsrc(e){let t=!0;return this.isStreamRawMetricReport(e.type)&&this.getDirectionType(e)===a.default.DOWNSTREAM&&this.getMediaType(e)===o.default.VIDEO&&(t=this.videoStreamIndex.streamIdForSSRC(Number(e.ssrc))>0),t}isValidRawMetricReport(e){return 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=>{f.Maybe.of(e.metricsDidReceive).map((t=>t.bind(e)(this.clientMetricReport.clone())))}))}getStatsWrapper(){return n(this,void 0,void 0,(function*(){if(!this.audioVideoController.rtcPeerConnection)return;const e=[];try{const t=yield this.audioVideoController.rtcPeerConnection.getStats();this.clientMetricReport.rtcStatsReport=t,t.forEach((t=>{e.push(t)})),this.handleRawMetricReports(e)}catch(e){this.logger.error(e.message)}}))}}t.default=p,p.INTERVAL_MS=1e3,p.CLIENT_TYPE="amazon-chime-sdk-js"},155:(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},8358:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(155),a=i(1789);class o extends a.default{constructor(e){super(e.logger),this.context=e,this.taskName="AttachMediaInputTask"}run(){return n(this,void 0,void 0,(function*(){const e=this.context.transceiverController;e.setPeer(this.context.peer),e.setupLocalTransceivers();const t=this.context.activeAudioInput;if(t){const i=t.getAudioTracks();this.context.logger.info("attaching audio track to peer connection"),yield e.setAudioInput(i.length?i[0]:null)}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.logger.info("attaching video track to peer connection"),yield e.setVideoInput(n),this.context.enableSimulcast&&this.context.videoUplinkBandwidthPolicy){const t=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();e.setEncodingParameters(t)}n&&(this.context.statsCollector.logVideoEvent(r.default.InputAttached,this.context.videoDeviceInformation),this.context.videoInputAttachedTimestampMs=Date.now())}else yield e.setVideoInput(null),this.context.logger.info("no video track");this.context.videoSubscriptions=e.updateVideoTransceivers(this.context.videoStreamIndex,this.context.videosToReceive)}))}}t.default=o},1789:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(1124),a=i(4456);t.default=class{constructor(e){this.logger=e,this.taskName="BaseTask",this.parentTask=null,this.status=a.default.IDLE,this.run=this.baseRun.bind(this,this.run),this.cancel=this.baseCancel.bind(this,this.cancel)}once(...e){return new r.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 a.default.RUNNING:this.logAndThrow(`${this.name()} is already running`);case a.default.CANCELED:this.logAndThrow(`${this.name()} was canceled before running`);case a.default.FINISHED:this.logAndThrow(`${this.name()} was already finished`)}this.status=a.default.RUNNING,yield e.call(this),this.logger.info(`${this.name()} took ${Math.round(Date.now()-t)} ms`)}catch(e){throw e}finally{this.status!==a.default.CANCELED&&(this.status=a.default.FINISHED)}}))}baseCancel(e){this.status!==a.default.CANCELED&&this.status!==a.default.FINISHED?(this.logger.info(`canceling task ${this.name()}`),this.status=a.default.CANCELED,e.call(this)):this.logger.info(`Not canceling ${this.name()}: state is ${this.status}`)}}},3216:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(1789);class a extends r.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.peer=null,this.context.videoDownlinkBandwidthPolicy.reset(),this.context.videoUplinkBandwidthPolicy.reset&&this.context.videoUplinkBandwidthPolicy.reset(),this.context.iceCandidateHandler=null,this.context.iceCandidates=[],this.context.previousSdpOffer=null}))}}t.default=a},7408:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(9416),a=i(1789);class o extends a.default{constructor(e){super(e.logger),this.context=e,this.taskName="CleanStoppedSessionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){try{this.context.signalingClient.ready()&&(this.context.signalingClient.closeConnection(),yield this.receiveWebSocketClosedEvent())}catch(e){throw e}finally{for(const e of this.context.removableObservers)e.removeObserver();this.context.statsCollector.stop(),this.context.statsCollector=null,this.context.connectionMonitor.stop(),this.context.connectionMonitor=null,this.context.peer&&this.context.peer.close(),this.context.peer=null,this.context.sdpAnswer=null,this.context.sdpOfferInit=null,this.context.indexFrame=null,this.context.videoDownlinkBandwidthPolicy.reset(),this.context.videoUplinkBandwidthPolicy.reset&&this.context.videoUplinkBandwidthPolicy.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===r.default.WebSocketClosed&&(this.signalingClient.removeObserver(this),e())}}(this.context.signalingClient);this.taskCanceler=i,this.context.signalingClient.registerObserver(i)}))}}t.default=o},5482:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(1789);class a extends r.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="unified-plan",this.context.peer?this.context.logger.info("reusing peer connection"):(this.context.logger.info("creating new peer connection"),this.context.peer=new RTCPeerConnection(e),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){return!!this.context.transceiverController.useTransceivers()&&(this.logger.debug((()=>"getting video track type")),this.context.transceiverController.trackIsVideoInput(e))}addRemoteVideoTrack(e,t){var i;const n=t.id,r=this.context.videoStreamIndex.attendeeIdForTrack(n);let a,o;if(this.context.videoTileController.getVideoTileForAttendeeId?(o=this.context.videoTileController.getVideoTileForAttendeeId(r),a=!!(null===(i=null==o?void 0:o.state())||void 0===i?void 0:i.boundVideoStream)):a=this.context.videoTileController.haveVideoTileForAttendeeId(r),a)return void this.context.logger.info(`Not adding remote track. Already have tile for attendeeId: ${r}`);o||(o=this.context.videoTileController.addVideoTile(),this.logger.info(`Created video tile ${o.id()}`));let s,c,l=this.context.videoStreamIndex.streamIdForTrack(n);void 0===l&&(this.logger.warn(`stream not found for tile=${o.id()} track=${n}`),l=null);for(let i=0;i{this.context.logger.info(`received the ${n} event for tile=${o.id()} id=${e.id} streamId=${l}`),"ended"===n&&this.removeRemoteVideoTrack(e,o.state())};t.addEventListener(n,i),this.removeVideoTrackEventListeners[e.id]||(this.removeVideoTrackEventListeners[e.id]=[]),this.removeVideoTrackEventListeners[e.id].push((()=>{t.removeEventListener(n,i)}))}}if(e.getSettings){const t=e.getSettings();s=t.width,c=t.height}else{const t=e.getCapabilities();s=t.width,c=t.height}const u=this.context.videoStreamIndex.externalUserIdForTrack(n);o.bindVideoStream(r,!1,t,s,c,l,u),this.logger.info(`video track added, use tile=${o.id()} track=${n} streamId=${l}`);const d="removetrack",f=t,C=()=>this.removeRemoteVideoTrack(e,o.state());this.removeTrackRemovedEventListeners[e.id]=()=>{f.removeEventListener(d,C),delete this.removeTrackRemovedEventListeners[e.id]},f.addEventListener(d,C)}removeRemoteVideoTrack(e,t){if(this.removeTrackRemovedEventListeners.hasOwnProperty(e.id)){this.removeTrackRemovedEventListeners[e.id]();for(const t of this.removeVideoTrackEventListeners[e.id])t();delete this.removeVideoTrackEventListeners[e.id]}this.logger.info(`video track ended, removing tile=${t.tileId} id=${e.id} stream=${t.streamId}`),t.streamId?this.context.videosPaused.remove(t.streamId):this.logger.warn(`no stream found for tile=${t.tileId}`),this.context.videoTileController.removeVideoTile(t.tileId)}}t.default=a,a.REMOVE_HANDLER_INTERVAL_MS=1e4},1129:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(5687),a=i(326),o=i(1789);class s extends o.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 a.default(this.context.sdpOfferInit.sdp).videoSendSectionHasDifferentSSRC(this.context.previousSdpOffer)){const e=new Error(`canceling ${this.name()} due to the meeting status code: ${r.default.IncompatibleSDP}`);return this.context.previousSdpOffer=null,void i(e)}t()}catch(e){i(e)}finally{delete this.cancelPromise}}))))}))}}t.default=s},6240:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(5687),a=i(326),o=i(1789);class s extends o.default{constructor(e,t=s.CHROME_VPN_TIMEOUT_MS){super(e.logger),this.context=e,this.chromeVpnTimeoutMs=t,this.taskName="FinishGatheringICECandidatesTask"}removeEventListener(){this.context.peer&&(this.context.peer.removeEventListener("icecandidate",this.context.iceCandidateHandler),this.context.turnCredentials||this.context.peer.removeEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler))}cancel(){let e;this.context.browserBehavior.requiresIceCandidateGatheringTimeoutWorkaround()&&this.chromeVpnTimeoutMsthis.chromeVpnTimeoutMs&&(e=new Error(`canceling ${this.name()} due to the meeting status code: ${r.default.ICEGatheringTimeoutWorkaround}`)),this.cancelPromise&&(e=e||new Error(`canceling ${this.name()}`),this.cancelPromise(e),delete this.cancelPromise)}run(){return n(this,void 0,void 0,(function*(){if(this.context.peer||this.logAndThrow("session does not have peer connection; bypass ice gathering"),this.context.browserBehavior.requiresCheckForSdpConnectionAttributes()){if(new a.default(this.context.peer.localDescription.sdp).hasCandidatesForAllMLines())return void this.context.logger.info(`ice gathering already complete; bypass gathering, current local description ${this.context.peer.localDescription.sdp}`)}else this.context.logger.info(`iOS device does not require checking for connection attributes in SDP, current local description ${this.context.peer.localDescription.sdp}`);if(!this.context.browserBehavior.hasFirefoxWebRTC()&&"complete"!==this.context.peer.iceGatheringState||!new a.default(this.context.peer.localDescription.sdp).hasCandidates())try{yield new Promise(((e,t)=>{this.cancelPromise=e=>{this.removeEventListener(),t(e)},this.context.turnCredentials||(this.context.iceGatheringStateEventHandler=()=>{if("complete"===this.context.peer.iceGatheringState)return this.removeEventListener(),e(),void delete this.cancelPromise},this.context.peer.addEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler)),this.context.iceCandidateHandler=i=>{if(this.context.logger.info(`ice candidate: ${i.candidate?i.candidate.candidate:"(null)"} state: ${this.context.peer.iceGatheringState}`),i.candidate&&(a.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 a.default(this.context.peer.localDescription.sdp).hasCandidates()&&0!==this.context.iceCandidates.length?(e(),delete this.cancelPromise):(t(new Error("no ice candidates were gathered")),delete this.cancelPromise))},this.context.peer.addEventListener("icecandidate",this.context.iceCandidateHandler),this.startTimestampMs=Date.now()}))}catch(e){throw e}finally{this.startTimestampMs&&(this.context.iceGatheringDurationMs=Math.round(Date.now()-this.startTimestampMs))}else this.context.logger.info("ice gathering state is complete and candidates are in SDP; bypass gathering")}))}}t.default=s,s.CHROME_VPN_TIMEOUT_MS=5e3},1960:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3789),a=i(5687),o=i(7215),s=i(7103),c=i(9416),l=i(2168),u=i(289),d=i(1789);class f extends d.default{constructor(e){super(e.logger),this.context=e,this.taskName="JoinAndReceiveIndexTask",this.taskCanceler=null}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===c.default.WebSocketClosed){let e=`The signaling connection was closed with code ${t.closeCode} and reason: ${t.closeReason}`;i.logger.warn(e);let n=a.default.SignalingBadRequest;return 4410===t.closeCode?(e="The meeting already ended.",i.logger.warn(e),n=a.default.MeetingEnded):t.closeCode>=4500&&t.closeCode<4600&&(n=a.default.SignalingInternalServerError),void i.audioVideoController.handleMeetingSessionStatus(new r.default(n),new Error(e))}if(t.type!==c.default.ReceivedSignalFrame)return;if(t.message.type===u.SdkSignalFrame.Type.JOIN_ACK){const e=t.message.joinack;if(e&&e.videoSubscriptionLimit&&(i.videoSubscriptionLimit=e.videoSubscriptionLimit),i.serverSupportsCompression=null==e?void 0:e.wantsCompressedSdp,void 0!==(null==e?void 0:e.defaultServerSideNetworkAdaption)&&e.defaultServerSideNetworkAdaption!==s.default.Default&&void 0!==i.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption){const t=e.defaultServerSideNetworkAdaption;i.logger.info(`Overriding server side network adaption value to ${t}`),i.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption(s.convertServerSideNetworkAdaptionEnumFromSignaled(t))}return void(e&&e.turnCredentials?(i.turnCredentials=new o.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!==u.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;const d=new l.default(this.context.meetingSessionConfiguration.applicationMetadata);void 0!==this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&void 0!==this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions&&(d.serverSideNetworkAdaption=this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption(),d.supportedServerSideNetworkAdaptions=this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions()),this.context.signalingClient.join(d)}));this.context.logger.info(`received first index ${JSON.stringify(e)}`),this.context.indexFrame=e}))}}t.default=f},6180:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(9416),a=i(289),o=i(1789);class s extends o.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===r.default.ReceivedSignalFrame&&t.message.type===a.SdkSignalFrame.Type.LEAVE_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("got leave ack"),e())}}(this.context.signalingClient,this.context.logger);this.taskCanceler=i,this.context.signalingClient.registerObserver(i)}))}}t.default=s},2748:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(9416),a=i(289),o=i(1789);class s extends o.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===r.default.ReceivedSignalFrame)if(e.message.type===a.SdkSignalFrame.Type.AUDIO_STREAM_ID_INFO){const t=e.message.audioStreamIdInfo;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioStreamIdInfo(t)}else if(e.message.type===a.SdkSignalFrame.Type.AUDIO_METADATA){const t=e.message.audioMetadata;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioMetadata(t)}}}t.default=s},1981:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(6196),a=i(9496),o=i(2770),s=i(9708),c=i(1922),l=i(3789),u=i(5687),d=i(9416),f=i(289),C=i(9880),h=i(8660),p=i(1789);class m extends p.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:C.default.RedmicStartLoss:i?C.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 l.default(u.default.RealtimeApiFailed),e)},this.realtimeAttendeeIdPresenceHandler=(e,t)=>{var i;const n=this.context.meetingSessionConfiguration.credentials.attendeeId;this.logger.info(`attendeePresenceReceived: ${n}`),n===e&&t&&!this.presenceHandlerCalled&&(this.presenceHandlerCalled=!0,this.context.attendeePresenceDurationMs=Date.now()-this.context.startAudioVideoTimestamp,null===(i=this.context.eventController)||void 0===i||i.publishEvent("attendeePresenceReceived",{attendeePresenceDurationMs:this.context.attendeePresenceDurationMs}))},this.generateAudioVideoEventAttributes=()=>{const{signalingOpenDurationMs:e,poorConnectionCount:t,startTimeMs:i,iceGatheringDurationMs:n,attendeePresenceDurationMs:r,meetingStartDurationMs:a}=this.context;return{maxVideoTileCount:this.context.maxVideoTileCount,meetingDurationMs:null===i?0:Math.round(Date.now()-i),signalingOpenDurationMs:e,iceGatheringDurationMs:n,attendeePresenceDurationMs:r,poorConnectionCount:t,meetingStartDurationMs:a}},this.reconnectionHealthPolicy=new s.default(e.logger,Object.assign({},t),this.initialConnectionHealthData.clone()),this.unusableAudioWarningHealthPolicy=new c.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)}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.availableOutgoingBitrate,n=t.nackCountReceivedPerSecond;let r=!1;this.context.videoDownlinkBandwidthPolicy.updateMetrics(e);const a=this.context.videoDownlinkBandwidthPolicy.wantsResubscribe();if(r=r||a,a){const e=this.context.videoDownlinkBandwidthPolicy.chooseSubscriptions();this.context.videosToReceive=e.truncate(this.context.videoSubscriptionLimit),e.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.logger.info(`trigger resubscribe for down=${a}; videosToReceive=[${this.context.videosToReceive.array()}]`)}if(this.context.videoTileController.hasStartedLocalVideoTile()){this.context.videoUplinkBandwidthPolicy.updateConnectionMetric({uplinkKbps:i/1e3,nackCountPerSecond:n});const e=this.context.videoUplinkBandwidthPolicy.wantsResubscribe();r=r||e,e&&(this.logger.info(`trigger resubscribe for up=${e}; videosToReceive=[${this.context.videosToReceive.array()}]`),this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters(),this.context.videoUplinkBandwidthPolicy.chooseMediaTrackConstraints())}return r}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=e.getObservableMetrics();this.currentVideoDownlinkBandwidthEstimationKbps=n.availableIncomingBitrate;const s=new Map,c=new Map;for(const e in i)i[e].mediaType===a.default.VIDEO&&i[e].direction===r.default.DOWNSTREAM&&s.set(i[e].streamId,i[e]);let l=!1;for(const e of this.currentAvailableStreamAvgBitrates.bitrates)if(s.has(e.sourceStreamId)){const t=s.get(e.sourceStreamId),i=this.context.videoStreamIndex.attendeeIdForStreamId(e.sourceStreamId);if(!i)continue;const n=new o.default,r=t.previousMetrics.bytesReceived,a=t.currentMetrics.bytesReceived;if(!r||!a)continue;const u=8*(a-r)/1e3;n.expectedAverageBitrateKbps=e.avgBitrateBps/1e3,n.receivedAverageBitrateKbps=u,n.attendeeId=i,u{h.Maybe.of(e.connectionDidSuggestStopVideo).map((t=>t.bind(e)()))})):this.context.audioVideoController.forEachObserver((e=>{h.Maybe.of(e.connectionDidBecomePoor).map((t=>t.bind(e)()))}))}else this.context.audioVideoController.forEachObserver((e=>{h.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*m.DEFAULT_DOWNLINK_CALLRATE_OVERSHOOT_FACTOR=4500&&e.closeCode<4600)||e.type===d.default.WebSocketError||e.type===d.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===d.default.WebSocketOpen&&(this.hasSignalingError=!1);if(e.type===d.default.ReceivedSignalFrame){if(e.message.bitrates){const t=e.message.bitrates;this.context.videoStreamIndex.integrateBitratesFrame(t),this.context.videoDownlinkBandwidthPolicy.updateIndex(this.context.videoStreamIndex),this.handleBitrateFrame(e.message.bitrates)}const t=l.default.fromSignalFrame(e.message);e.message.type!==f.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&t.statusCode()!==u.default.OK&&this.context.audioVideoController.handleMeetingSessionStatus(t,null)}}}t.default=m,m.DEFAULT_DOWNLINK_CALLRATE_OVERSHOOT_FACTOR=2,m.DEFAULT_DOWNLINK_CALLRATE_UNDERSHOOT_FACTOR=.2},8831:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{cancel(){}name(){return"NoOpTask"}run(){return Promise.resolve()}setParent(e){}}},1124:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(813),r=i(7797);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()}`),r.default.nextTick((()=>this.task.cancel())),this.canceled=!0,this.cancelPromise&&r.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.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)}}},4543:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3920),a=i(9416),o=i(1789);class s extends o.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 r.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 a.default.WebSocketOpen:this.signalingClient.removeObserver(this),e();break;case a.default.WebSocketFailed:this.signalingClient.removeObserver(this),t(new Error("WebSocket connection failed"))}}}(this.context.signalingClient);this.context.signalingClient.registerObserver(i),this.taskCanceler=i}))}catch(e){throw e}finally{this.context.signalingOpenDurationMs=Math.round(Date.now()-t),this.logger.info(`Opening signaling connection took ${this.context.signalingOpenDurationMs} ms`)}}))}}t.default=s},8556:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(1789);class a extends r.default{constructor(e,t,i){super(e),this.taskName=t,this.tasksToRunParallel=i;for(const e of i)e.setParent(this)}cancel(){for(const e of this.tasksToRunParallel)this.logger.info(`canceling parallel group task ${this.name()} subtask ${e.name()}`),e.cancel()}run(){return n(this,void 0,void 0,(function*(){const e=[];for(const t of this.tasksToRunParallel)this.logger.info(`parallel group task ${this.name()} running subtask ${t.name()}`),e.push(t.run());const t=[];for(let i=0;i0){const e=t.join(", ");this.logAndThrow(`parallel group task ${this.name()} failed for tasks: ${e}`)}this.logger.info(`parallel group task ${this.name()} completed`)}))}}t.default=a},9945:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3204),a=i(9416),o=i(289),s=i(1789);class c extends s.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 r.MeetingSessionStatus(r.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 r.MeetingSessionStatus(r.MeetingSessionStatusCode.SignalingRequestFailed)),e()}handleSignalingClientEvent(t){t.isConnectionTerminated()&&(this.signalingClient.removeObserver(this),this.logger.info("PromoteToPrimaryMeetingTask connection terminated"),this.completionCallback(new r.MeetingSessionStatus(r.MeetingSessionStatusCode.SignalingRequestFailed)),e()),t.type===a.default.ReceivedSignalFrame&&t.message.type===o.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("Got a primary meeting join ACK"),this.completionCallback(r.MeetingSessionStatus.fromSignalFrame(t.message)),e())}}(this.context.signalingClient,this.completionCallback,this.context.logger);this.taskCanceler=i,this.context.signalingClient.registerObserver(i)}))}}t.default=c},1209:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(1789);class a extends r.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(e){this.context.logger.warn("could not acquire audio input from current device")}i?this.context.activeAudioInput=i:this.context.logger.warn("an audio input is not available")}))}}t.default=a},5547:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(5687),a=i(7215),o=i(214),s=i(4046),c=i(1789);class l extends c.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 o.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(s.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: ${r.default.TURNCredentialsForbidden}`));if(n.status&&404===n.status)return void i(new Error(`canceling ${this.name()} due to the meeting status code: ${r.default.MeetingEnded}`));t(yield n.json())}catch(e){i(e)}finally{delete this.cancelPromise}}))));this.context.turnCredentials=new a.default,this.context.turnCredentials.password=t.password,this.context.turnCredentials.ttl=t.ttl,this.context.turnCredentials.uris=t.uris.map((e=>this.context.meetingSessionConfiguration.urls.urlRewriter(e))).filter((e=>!!e)),this.context.turnCredentials.username=t.username}))}}t.default=l},120:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(214),a=i(289),o=i(1789);class s 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===a.SdkStreamServiceType.RX||this.context.videoDuplexMode===a.SdkStreamServiceType.DUPLEX;if(this.context.videoTileController.hasStartedLocalVideoTile()?this.context.videoDuplexMode=e?a.SdkStreamServiceType.DUPLEX:a.SdkStreamServiceType.TX:this.context.videoDuplexMode=e?a.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.context.activeVideoInput=void 0,this.context.videoStreamIndex.integrateUplinkPolicyDecision([])));const t=this.context.videoTileController.getLocalVideoTile();let i;try{i=yield this.context.mediaStreamBroker.acquireVideoInputStream()}catch(e){this.context.logger.warn("could not acquire video input from current device"),this.context.videoTileController.stopLocalVideoTile()}if(this.context.enableSimulcast){const e=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();this.context.videoStreamIndex.integrateUplinkPolicyDecision(Array.from(e.values()))}if(this.context.activeVideoInput=i,i){const e=i.getVideoTracks();if(!e||0===e.length)return;const n=this.context.meetingSessionConfiguration.credentials.attendeeId,a=new r.default(n).hasModality(r.default.MODALITY_CONTENT),o=e[0].getSettings();if(this.context.enableSimulcast&&!a){const t=this.context.videoUplinkBandwidthPolicy.chooseMediaTrackConstraints();this.context.logger.info(`simulcast: choose constraint ${JSON.stringify(t)}`);try{yield e[0].applyConstraints(t)}catch(e){this.context.logger.info("simulcast: pass video without more constraint")}}const s=this.context.audioVideoController.configuration.credentials.externalUserId;t.bindVideoStream(n,!0,i,o.width,o.height,null,s);for(let t=0;t{const i=new a.default(e.attendeeId);return!(i.base()===t&&i.hasModality(a.default.MODALITY_CONTENT))}));const{videoStreamIndex:i,videoDownlinkBandwidthPolicy:n,videoUplinkBandwidthPolicy:r}=this.context,o=i.allVideoSendingSourcesExcludingSelf(t);i.integrateIndexFrame(e),n.updateIndex(i),r.updateIndex(i),this.resubscribe(n,r),this.updateVideoAvailability(e),this.handleIndexVideosPausedAtSource(),e.supportedReceiveCodecIntersection.length>0&&this.handleSupportedVideoReceiveCodecIntersection(e);const s=i.allVideoSendingSourcesExcludingSelf(t);this.areVideoSourcesEqual(o,s)||this.context.audioVideoController.forEachObserver((e=>{l.Maybe.of(e.remoteVideoSourcesDidChange).map((t=>t.bind(e)(s)))}))}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),r=[...t].sort(i);for(let e=0;ethis.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()}] 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 r.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=>{l.Maybe.of(e.videoAvailabilityDidChange).map((i=>i.bind(e)(t.clone())))})))}handleSupportedVideoReceiveCodecIntersection(e){if(void 0===this.context.videoSendCodecPreferences)return;const t=[];let i=!1;for(const n of this.context.videoSendCodecPreferences){for(const i of e.supportedReceiveCodecIntersection)if(n.equals(o.default.fromSignaled(i))){t.push(n);break}n.equals(this.context.currentVideoSendCodec)&&(i=!0)}t.length>0?this.context.meetingSupportedVideoSendCodecPreferences=t:(this.logger.warn("Interesection of meeting receive codec support and send codec preferences has no overlap, falling back to just values provided in `setVideoCodecSendPreferences`"),this.context.meetingSupportedVideoSendCodecPreferences=void 0),i&&this.context.audioVideoController.update({needsRenegotiation:!0})}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=d},4191:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(1789);class r extends n.default{constructor(e,t,i="RunnableTask"){super(e),this.fn=t,this.taskName=i}run(){return this.fn().then((()=>{}))}}t.default=r},9485:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(1018),a=i(9416),o=i(289),s=i(1789);class c extends s.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 r=o.SdkDataMessagePayload.create();r.topic=e,r.lifetimeMs=i,r.data=n;const a=o.SdkDataMessageFrame.create();a.messages=[r],this.context.signalingClient.sendDataMessage(a)}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===a.default.ReceivedSignalFrame&&e.message.type===o.SdkSignalFrame.Type.DATA_MESSAGE)for(const t of e.message.dataMessage.messages){const e=new r.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(!c.TOPIC_REGEX.test(e))throw new Error("Invalid topic");if(t.length>c.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=c,c.TOPIC_REGEX=new RegExp(/^[a-zA-Z0-9_-]{1,36}$/),c.DATA_SIZE=2048},7079:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(1789),a=i(4456);class o extends r.default{constructor(e,t,i){super(e),this.taskName=t,this.tasksToRunSerially=i,this.currentTask=null;for(const e of i)e.setParent(this)}cancel(){this.currentTask&&(this.logger.info(`canceling serial group task ${this.name()} subtask ${this.currentTask.name()}`),this.currentTask.cancel())}run(){return n(this,void 0,void 0,(function*(){for(const e of this.tasksToRunSerially){this.getStatus()===a.default.CANCELED&&this.logAndThrow(`serial group task ${this.name()} was canceled`);try{this.logger.info(`serial group task ${this.name()} running subtask ${e.name()}`),this.currentTask=e,yield e.run(),this.logger.info(`serial group task ${this.name()} completed subtask ${e.name()}`)}catch(e){this.logAndThrow(`serial group task ${this.name()} was canceled due to subtask ${this.currentTask.name()} error: ${e.message}`)}finally{this.currentTask=null}}this.logger.info(`serial group task ${this.name()} completed`)}))}}t.default=o},4833:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(543),a=i(326),o=i(1789);class s extends o.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;let t=this.context.sdpOfferInit.sdp;this.context.browserBehavior.supportsVideoLayersAllocationRtpHeaderExtension()&&(t=new a.default(t).withVideoLayersAllocationRtpHeaderExtension(this.context.previousSdpOffer).sdp),(new r.default).requiresDisablingH264Encoding()&&(t=new a.default(t).removeH264SupportFromSendSection().sdp),void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(t=new a.default(t).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.audioProfile&&(t=new a.default(t).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(t=new a.default(t).withStereoAudio().sdp)),this.logger.debug((()=>`local description is >>>${t}<<<`));const i={type:"offer",sdp:t,toJSON:null};yield new Promise(((t,r)=>n(this,void 0,void 0,(function*(){this.cancelPromise=e=>{r(e)};try{yield e.setLocalDescription(i),t()}catch(e){r(e)}finally{delete this.cancelPromise}})))),this.context.logger.info("set local description")}))}}t.default=s},5275:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(326),a=i(1789);class o extends a.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;e=new r.default(e).withoutServerReflexiveCandidates().sdp,this.context.audioProfile&&(e=new r.default(e).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(e=new r.default(e).withStereoAudio().sdp)),void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(e=new r.default(e).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp,this.context.currentVideoSendCodec=new r.default(e).highestPriorityVideoSendCodec()),this.logger.info(`processed remote description is >>>${e}<<<`);const t={type:"answer",sdp:e,toJSON:null};try{yield this.createICEConnectionCompletedPromise(t)}catch(e){throw e}}))}createICEConnectionCompletedPromise(e){return new Promise(((t,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(e){i(e)}}))))}}t.default=o},5924:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(3789),a=i(5687),o=i(326),s=i(3320),c=i(7103),l=i(9416),u=i(6729),d=i(9101),f=i(289),C=i(1789);class h extends C.default{constructor(e){super(e.logger),this.context=e,this.taskName="SubscribeAndReceiveSubscribeAckTask",this.taskCanceler=null,this.textCompressor=new s.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=new o.default(this.context.peer.localDescription.sdp).withUnifiedPlanFormat().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.fixUpSubscriptionOrder(e,this.context.videoSubscriptions),i=this.context.videoDuplexMode===f.SdkStreamServiceType.TX||this.context.videoDuplexMode===f.SdkStreamServiceType.DUPLEX;let n;const r=e;if(this.context.serverSupportsCompression){const t=this.context.previousSdpOffer?this.context.previousSdpOffer.sdp:"";n=this.textCompressor.compress(r,t),this.context.logger.info(`Compressed the SDP message from ${r.length} to ${n.length} bytes.`),e=""}this.context.previousSdpOffer=new o.default(r);const a=new u.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);void 0!==this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption()!==c.default.None&&void 0!==this.context.videoDownlinkBandwidthPolicy.getVideoPreferences&&(a.videoSubscriptionConfiguration=this.convertVideoPreferencesToVideoSubscriptionConfiguration(t,this.context.videoDownlinkBandwidthPolicy.getVideoPreferences())),this.context.logger.info(`sending subscribe: ${JSON.stringify(a)}`),this.context.signalingClient.subscribe(a);const s=yield this.receiveSubscribeAck();this.context.logger.info(`got subscribe ack: ${JSON.stringify(s)}`);let l="";s.compressedSdpAnswer&&s.compressedSdpAnswer.length?(l=this.textCompressor.decompress(s.compressedSdpAnswer,this.context.previousSdpAnswerAsString),0===l.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 ${s.compressedSdpAnswer.length} to ${l.length} bytes.`),this.context.sdpAnswer=l):this.context.sdpAnswer=s.sdpAnswer,this.context.previousSdpAnswerAsString=this.context.sdpAnswer,this.context.videoStreamIndex.integrateSubscribeAckFrame(s)}))}fixUpSubscriptionOrder(e,t){if(void 0===this.context.transceiverController.getMidForStreamId)return t;const i=new Map;for(const e of t){const t=this.context.transceiverController.getMidForStreamId(e);void 0!==t?i.set(t,e):0!==e&&this.logger.warn(`Could not find MID for stream ID: ${e}`)}const n=new o.default(e).mediaSections(),r=[];for(const e of n)if("video"===e.mediaType)if("recvonly"===e.direction){const t=i.get(e.mid);if(void 0===t){this.logger.warn(`Could not find stream ID for MID: ${e.mid}`);continue}r.push(t)}else r.push(0);return this.logger.info(`Fixed up ${JSON.stringify(t)} to ${JSON.stringify(r)} (may be same))}`),r}convertVideoPreferencesToVideoSubscriptionConfiguration(e,t){if(void 0===this.context.transceiverController.getMidForStreamId||void 0===t)return[];const i=new Array,n=new Map,r=new Map;for(const t of e){const e=this.context.transceiverController.getMidForStreamId(t);if(void 0===e){0!==t&&this.context.logger.warn(`Could not find MID for stream ID: ${t}`);continue}const i=this.context.videoStreamIndex.attendeeIdForStreamId(t);n.set(i,e),r.set(i,this.context.videoStreamIndex.groupIdForStreamId(t))}for(const e of t){const t=new d.default,a=n.get(e.attendeeId);void 0!==a?(t.mid=a,t.attendeeId=e.attendeeId,t.groupId=r.get(e.attendeeId),t.priority=Number.MAX_SAFE_INTEGER-e.priority,t.targetBitrateKbps=e.targetSizeToBitrateKbps(e.targetSize),i.push(t)):this.context.logger.warn(`Could not find MID for attendee ID: ${e.attendeeId}`)}return i}receiveSubscribeAck(){return new Promise(((e,t)=>{const i=this.context,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=a.default.TaskFailed;return t.closeCode>=4500&&t.closeCode<4600&&(n=a.default.SignalingInternalServerError),void i.audioVideoController.handleMeetingSessionStatus(new r.default(n),new Error(e))}if(t.type!==l.default.ReceivedSignalFrame||t.message.type!==f.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:(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},250:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(4929),a=i(1789);class o extends a.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 r.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=o},6171:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(5687),a=i(1789);class o extends a.default{constructor(e){super(e.logger),this.context=e,this.taskName="WaitForAttendeePresenceTask"}cancel(){if(this.cancelPromise){const e=new Error(`canceling ${this.name()} due to the meeting status code: ${r.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,r,a,o,s)=>{e===i&&r&&(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=o},365:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{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)}))}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;if(!t||e<=0)return;const i=t.getParameters();i.encodings||(i.encodings=[{}]);for(const t of i.encodings)t.maxBitrate=1e3*e;yield t.setParameters(i)}))}setPeer(e){this.peer=e}reset(){this._localCameraTransceiver=null,this._localAudioTransceiver=null,this.videoSubscriptions=[],this.defaultMediaStream=null,this.peer=null}useTransceivers(){return!!this.peer&&void 0!==this.peer.getTransceivers}hasVideoInput(){return!(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)}trackIsVideoInput(e){return!!this._localCameraTransceiver&&(e===this._localCameraTransceiver.sender.track||e===this._localCameraTransceiver.receiver.track)}setupLocalTransceivers(){this.useTransceivers()&&(this.defaultMediaStream||"undefined"==typeof MediaStream||(this.defaultMediaStream=new MediaStream),this._localAudioTransceiver||(this._localAudioTransceiver=this.peer.addTransceiver("audio",{direction:"inactive",streams:[this.defaultMediaStream]})),this._localCameraTransceiver||(this._localCameraTransceiver=this.peer.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream]})))}replaceAudioTrack(e){return 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 e of n){const t=this.peer.addTransceiver("video",{direction:"recvonly",streams:[new MediaStream]});this.streamIdToTransceiver.set(e,t),this.videoSubscriptions.push(e),this.logger.info(`adding transceiver mid: ${t.mid} subscription: ${e} direction: recvonly`)}}updateTransceiverWithStop(e,t,i){let n=1;this.videoSubscriptions=[0];for(const r of e){if(r===this._localCameraTransceiver||!this.transceiverIsVideo(r)||!r.mid)continue;let e=!1;const a=t.streamIdForTrack("v_"+r.mid);if("inactive"!==r.direction&&void 0!==a)for(const[o,s]of i.entries())if(t.StreamIdsInSameGroup(a,s)){r.direction="recvonly",this.videoSubscriptions[n]=s,e=!0,this.streamIdToTransceiver.delete(a),this.streamIdToTransceiver.set(s,r),i.splice(o,1);break}if(!e){this.videoSubscriptions[n]=0,this.logger.info(`Stopping MID: ${r.mid}, direction: ${r.direction}, current direction: ${r.currentDirection}`),r.stop();for(const[e,t]of this.streamIdToTransceiver.entries())r.mid===t.mid&&this.streamIdToTransceiver.delete(e)}n+=1}}updateTransceiverWithoutStop(e,t,i){let n=1;for(const r of e)if(r!==this._localCameraTransceiver&&this.transceiverIsVideo(r)){if(this.videoSubscriptions[n]=0,"inactive"!==r.direction){const e=t.streamIdForTrack("v_"+r.mid);if(void 0!==e)for(const[a,o]of i.entries())if(t.StreamIdsInSameGroup(e,o)){r.direction="recvonly",this.videoSubscriptions[n]=o,this.streamIdToTransceiver.delete(e),this.streamIdToTransceiver.set(o,r),i.splice(a,1);break}}n+=1}n=1;for(const t of e)if(t!==this._localCameraTransceiver&&this.transceiverIsVideo(t)){if("inactive"===t.direction&&i.length>0){t.direction="recvonly";const e=i.shift();this.videoSubscriptions[n]=e,this.streamIdToTransceiver.set(e,t)}else if(0===this.videoSubscriptions[n]){t.direction="inactive";for(const[e,i]of this.streamIdToTransceiver.entries())t===i&&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))}))}}},7377:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(5785);class a extends r.default{constructor(e,t){super(e,t);let i=2;this.videoQualityControlParameterMap=new Map;for(let e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(365);class r 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=r},5308:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TRANSCRIPTION_DATA_MESSAGE_TOPIC=void 0;const n=i(1877);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)}}},4739:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},2471:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},7210:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},1877:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TranscriptEventConverter=void 0;const n=i(289),r=i(4739),a=i(1288),o=i(1326),s=i(6864),c={[n.SdkTranscriptionStatus.Type.STARTED]:o.default.STARTED,[n.SdkTranscriptionStatus.Type.INTERRUPTED]:o.default.INTERRUPTED,[n.SdkTranscriptionStatus.Type.RESUMED]:o.default.RESUMED,[n.SdkTranscriptionStatus.Type.STOPPED]:o.default.STOPPED,[n.SdkTranscriptionStatus.Type.FAILED]:o.default.FAILED};t.TranscriptEventConverter=class{static from(e){let t;try{t=n.SdkTranscriptFrame.decode(e.data)}catch(e){throw new Error("Cannot decode transcript data message: "+e)}const i=[];for(const e of t.events)if(e.status){const t=c[e.status.type];if(!t)continue;const n=new a.default;n.type=t,n.eventTimeMs=e.status.eventTime,n.transcriptionRegion=e.status.transcriptionRegion,n.transcriptionConfiguration=e.status.transcriptionConfiguration,e.status.message&&(n.message=e.status.message),i.push(n)}else if(e.transcript){const t=new r.default;t.results=[];for(const i of e.transcript.results){const e={channelId:i.channelId,isPartial:i.isPartial,resultId:i.resultId,startTimeMs:i.startTime,endTimeMs:i.endTime,alternatives:[]};if(i.languageCode&&(e.languageCode=i.languageCode),i.languageIdentification&&i.languageIdentification.length>0){e.languageIdentification=[];for(const t of i.languageIdentification){const i={languageCode:t.languageCode,score:t.score};e.languageIdentification.push(i)}}for(const t of i.alternatives){const i={items:[],transcript:t.transcript};for(const e of t.items){const t={content:e.content,attendee:{attendeeId:e.speakerAttendeeId,externalUserId:e.speakerExternalUserId},startTimeMs:e.startTime,endTimeMs:e.endTime,type:null};switch(e.vocabularyFilterMatch&&(t.vocabularyFilterMatch=e.vocabularyFilterMatch),e.hasOwnProperty("stable")&&(t.stable=e.stable),e.hasOwnProperty("confidence")&&(t.confidence=e.confidence),e.type){case n.SdkTranscriptItem.Type.PRONUNCIATION:t.type=s.default.PRONUNCIATION;break;case n.SdkTranscriptItem.Type.PUNCTUATION:t.type=s.default.PUNCTUATION}i.items.push(t)}for(const e of t.entities){i.entities||(i.entities=[]);const t={category:e.category,confidence:e.confidence,content:e.content,startTimeMs:e.startTime,endTimeMs:e.endTime};e.type&&(t.type=e.type),i.entities.push(t)}e.alternatives.push(i)}t.results.push(e)}i.push(t)}return i}}},1741:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},6864:(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},9063:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},5323:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},1288:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},1326:(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},8627:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(2238),r=i(4046);class a{constructor(e){var t,i,r,o,s,c,l;try{this.parserResult=navigator&&navigator.userAgent?new n.UAParser(navigator.userAgent).getResult():void 0}catch(t){e.error(t.message)}this.browserMajorVersion=(null===(r=null===(i=null===(t=this.parserResult)||void 0===t?void 0:t.browser)||void 0===i?void 0:i.version)||void 0===r?void 0:r.split(".")[0])||a.UNAVAILABLE,this.browserName=(null===(o=this.parserResult)||void 0===o?void 0:o.browser.name)||a.UNAVAILABLE,this.browserVersion=(null===(s=this.parserResult)||void 0===s?void 0:s.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}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)||a.UNAVAILABLE,osVersion:(null===(t=this.parserResult)||void 0===t?void 0:t.os.version)||a.UNAVAILABLE,sdkVersion:r.default.sdkVersion,sdkName:r.default.sdkName}}}t.default=a,a.UNAVAILABLE="Unavailable"},1515:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.queue=Promise.resolve()}add(e){return new Promise(((t,i)=>{this.queue=this.queue.then(e).then(t).catch(i)}))}}},8660:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.None=t.Some=t.Maybe=void 0;class i{static of(e){return null==e?r.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)throw new Error("value is ${value}");return new n(e)}}t.Some=n;class r{constructor(){this.isSome=!1,this.isNone=!0}get(){throw new Error("value is null")}getOrElse(e){return e}map(e){return new r}flatMap(e){return new r}defaulting(e){return i.of(this.getOrElse(e))}static of(){return new r}}t.None=r},8690:(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(e){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 r=t[n],a="object"==typeof r?e(r):r;return i[n.toLowerCase()]=a,i}),{})}},4046:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(543),r=i(2336);class a{static get sdkName(){return"amazon-chime-sdk-js"}static get sdkVersion(){return r.default.semverString}static get sdkVersionSemVer(){var e,t,i,n;const a=r.default.semverString.match(/^(?[0-9]+)\.(?[0-9]+)((?:\.(?[0-9]+))(?:-(?[a-zA-Z]+(\.[0-9])*))?)?/);return{major:null===(e=null==a?void 0:a.groups)||void 0===e?void 0:e.major,minor:null===(t=null==a?void 0:a.groups)||void 0===t?void 0:t.minor,patch:null===(i=null==a?void 0:a.groups)||void 0===i?void 0:i.patch,preRelease:null===(n=null==a?void 0:a.groups)||void 0===n?void 0:n.preRelease}}static get buildSHA(){return r.default.hash.substr(1)}static get sdkUserAgentLowResolution(){const e=new n.default;return`${e.name()}-${e.majorVersion()}`}static urlWithVersion(e){const t=new URL(e);return t.searchParams.append(a.X_AMZN_VERSION,a.sdkVersion),t.searchParams.append(a.X_AMZN_USER_AGENT,a.sdkUserAgentLowResolution),t.toString()}}t.default=a,a.X_AMZN_VERSION="X-Amzn-Version",a.X_AMZN_USER_AGENT="X-Amzn-User-Agent"},2336:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={hash:"8ebe622",raw:"v3.6.0",semverString:"3.6.0"}},1133:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(e,t,i,n,r,a=1){this.cameraWidth=e,this.cameraHeight=t,this.cameraFrameRate=i,this.maxEncodeBitrateKbps=n,this.isSimulcast=r,this.scaleResolutionDownBy=a}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{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(1508);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 r=this.videoIndex.remoteStreamDescriptions(),a=new Map;for(const e of r)i.contain(e.streamId)&&a.set(e.attendeeId,e.streamId);for(const e of this.videoSources){const i=e.attendee.attendeeId;a.has(i)&&t.add(a.get(i))}return t}}},5319:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(1508);t.default=class{reset(){}updateIndex(e){}updateMetrics(e){}wantsResubscribe(){return!1}chooseSubscriptions(){return new n.default}}},2721:(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},2880:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(8890),r=i(1754),a=i(1819),o=i(4992);class s extends o.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=a.VideoPreferences.prepare();let i=!1;const o=e.remoteStreamDescriptions();for(const e of o)t.some((t=>t.attendeeId===e.attendeeId))||(e.attendeeId.endsWith(n.default.Modality)?(t.add(new r.default(e.attendeeId,1)),i=!0):t.add(new r.default(e.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=s},1754:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(2721);class r{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 r(this.attendeeId,this.priority,this.targetSize)}targetSizeToBitrateKbps(e){switch(e){case n.default.High:return r.HIGH_BITRATE_KBPS;case n.default.Medium:return r.MID_BITRATE_KBPS;case n.default.Low:return r.LOW_BITRATE_KBPS}}}t.default=r,r.LOW_BITRATE_KBPS=300,r.MID_BITRATE_KBPS=600,r.HIGH_BITRATE_KBPS=1200},1819:(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.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 r{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 a(this.builder.build())}}t.MutableVideoPreferences=r;class a{constructor(e){this.items=e}static prepare(){return new r(new n)}static default(){return new a(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 r(this.items.modify())}some(e){return this.items.some(e)}isEmpty(){return this.items.isEmpty()}clone(){const e=a.prepare();for(const t of this.items)e.add(t.clone());return e.build()}}t.VideoPreferences=a,t.default=a},4992:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(6196),r=i(9496),a=i(8890),o=i(813),s=i(7103),c=i(1508),l=i(2721),u=i(1754),d=i(1819),f=i(1034);class C{constructor(){this.bandwidthEstimateKbps=0,this.usedBandwidthKbps=0,this.packetsLost=0,this.nackCount=0,this.rttMs=0}}class h{constructor(e,t=f.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 c.default,this.optimalReceiveStreams=[],this.optimalNonPausedReceiveStreams=[],this.subscribedReceiveSet=new c.default,this.subscribedReceiveStreams=[],this.videoPreferences=void 0,this.defaultVideoPreferences=void 0,this.shouldPauseTiles=!0,this.pausedStreamIds=new c.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=h.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.lastProbeTimestamp=Date.now(),this.timeBeforeAllowProbeMs=h.MIN_TIME_BETWEEN_PROBE_MS,this.downlinkStats=new C,this.prevDownlinkStats=new C,this.probeFailed=!1,this.serverSideNetworkAdaption=this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption}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.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 t of this.videoIndex.remoteStreamDescriptions())e.add(t.attendeeId);const t=d.VideoPreferences.prepare(),i=e.size;let n=l.default.High;i>8?n=l.default.Low:i>4&&(n=l.default.Medium);for(const i of e)t.add(new u.default(i,1,n));this.defaultVideoPreferences=t.build()}updateMetrics(e){if(!this.videoIndex||this.videoIndex.allStreams().empty())return;this.prevDownlinkStats=this.downlinkStats,this.downlinkStats=new C;const t=e.getObservableMetrics();this.downlinkStats.bandwidthEstimateKbps=t.availableIncomingBitrate/1e3;for(const t in e.streamMetricReports){const i=Number.parseInt(t,10),a=e.streamMetricReports[i];a.direction===n.default.DOWNSTREAM&&a.mediaType===r.default.VIDEO&&(a.currentMetrics.hasOwnProperty("nackCount")&&(this.downlinkStats.nackCount+=e.countPerSecond("nackCount",i)),a.currentMetrics.hasOwnProperty("packetsLost")&&(this.downlinkStats.packetsLost+=e.countPerSecond("packetsLost",i)),a.currentMetrics.hasOwnProperty("bytesReceived")&&(this.downlinkStats.usedBandwidthKbps+=e.bitsPerSecond("bytesReceived",i)/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 r=this.availStreamsSameAsLast(i),c=!this.startupPeriod&&r;if(c&&Date.now()-this.lastSubscribeTimestampe.maxBitrateKbps===t.maxBitrateKbps?e.streamId-t.streamId:e.maxBitrateKbps-t.maxBitrateKbps));for(const e of i)(0===e.avgBitrateKbps||e.avgBitrateKbps>e.maxBitrateKbps)&&(e.attendeeId.endsWith(a.default.Modality)&&e.maxBitrateKbps<100?e.maxBitrateKbps=e.avgBitrateKbps:e.avgBitrateKbps=e.maxBitrateKbps);const l={targetDownlinkBitrate:0,chosenTotalBitrate:0,deltaToNextUpgrade:0};l.targetDownlinkBitrate=this.determineTargetRate();const u=this.subscribedReceiveSet.size(),d=this.downlinkStats.bandwidthEstimateKbps,f=!this.videoPriorityBasedPolicyConfig.allowSubscribe(u,d);if(this.probeFailed&&(this.probeFailed=!1,this.timeBeforeAllowSubscribeMs=h.MIN_TIME_BETWEEN_SUBSCRIBE_MS,c&&f))return;const C=this.priorityPolicy(l,i,t);let p=0;if(this.serverSideNetworkAdaption!==s.default.None&&this.serverSideNetworkAdaption!==s.default.Default||this.startupPeriod||!r?(this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0):"Probing"===this.rateProbeState?p=this.handleProbe(t,l.targetDownlinkBitrate):0!==l.deltaToNextUpgrade&&(p=this.maybeOverrideOrProbe(t,l,C)),this.prevRemoteInfos=i,this.videoPreferencesUpdated=!1,1===p)return this.logger.info(`bwe: keepSameSubscriptions stats:${JSON.stringify(this.downlinkStats)}`),void(this.prevTargetRateKbps=l.targetDownlinkBitrate);if(2===p){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 m=this.pausedBwAttendeeIds.size;this.processBwPausedStreams(i,t),this.logger.getLogLevel()<=o.LogLevel.INFO&&(this.logCount%15==0||this.rateProbeState!==n||this.optimalReceiveStreams.length!==t.length||m!==this.pausedBwAttendeeIds.size)&&(this.logger.info(this.policyStateLogStr(i,l.targetDownlinkBitrate)),this.logCount=0),this.logCount++,this.prevTargetRateKbps=l.targetDownlinkBitrate,this.optimalReceiveStreams=t.slice()}calculateOptimalReceiveSet(){const e=new c.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>h.DEFAULT_BANDWIDTH_KBPS||this.downlinkStats.packetsLost>0||t-this.firstEstimateTimestamp>h.STARTUP_PERIOD_MS&&this.downlinkStats.bandwidthEstimateKbps<=this.prevDownlinkStats.bandwidthEstimateKbps)&&(this.startupPeriod=!1,this.prevTargetRateKbps=this.downlinkStats.bandwidthEstimateKbps),this.startupPeriod?e=h.DEFAULT_BANDWIDTH_KBPS:"Probing"===this.rateProbeState&&this.downlinkStats.usedBandwidthKbps>this.downlinkStats.bandwidthEstimateKbps&&this.downlinkStats.packetsLost"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>h.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,h.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;ih.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>h.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(h.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=h.MIN_TIME_BETWEEN_PROBE_MS,0):1}maybeOverrideOrProbe(e,t,i){const n=this.chosenStreamsSameAsLast(e);let r=0;const a=t.targetDownlinkBitrate>h.LOW_BITRATE_THRESHOLD_KBPS?h.TARGET_RATE_CHANGE_TRIGGER_PERCENT:2*h.TARGET_RATE_CHANGE_TRIGGER_PERCENT,o=t.targetDownlinkBitrate*a/100;if(this.targetRateBaselineForDeltaCheckKbps=void 0!==this.targetRateBaselineForDeltaCheckKbps?this.targetRateBaselineForDeltaCheckKbps:this.prevTargetRateKbps,!n&&Math.abs(t.targetDownlinkBitrate-this.targetRateBaselineForDeltaCheckKbps)this.prevDownlinkStats.packetsLost)return this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0,r;if(n||1===r)switch(this.rateProbeState){case"Not Probing":this.setProbeState("Probe Pending");break;case"Probe Pending":this.setProbeState("Probing")&&(this.upgradeToStream(e,i),r=0)}else this.setProbeState("Not Probing");return r}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 c.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 r of i){const i=this.getVideoTileForAttendeeId(r.attendeeId,n),a=(null==i?void 0:i.state().paused)||!1;if(t.some((e=>e.attendeeId===r.attendeeId)))a&&this.pausedBwAttendeeIds.has(r.attendeeId)&&(this.logger.info(`bwe: unpausing attendee ${r.attendeeId} due to bandwidth`),this.forEachObserver((e=>{e.tileWillBeUnpausedByDownlinkPolicy(i.id())})),this.tileController.unpauseVideoTile(i.id()),this.pausedBwAttendeeIds.delete(r.attendeeId));else{const n=e.some((e=>e.attendeeId===r.attendeeId));if(i&&n){const e=this.optimalReceiveStreams.find((e=>e.attendeeId===r.attendeeId));void 0!==e&&(a||(this.logger.info(`bwe: pausing streamId ${e.streamId} attendee ${r.attendeeId} due to bandwidth`),this.forEachObserver((e=>{e.tileWillBePausedByDownlinkPolicy(i.id())})),this.tileController.pauseVideoTile(i.id())),t.push(e)),this.pausedBwAttendeeIds.add(r.attendeeId)}else if(n){const e=this.tileController.addVideoTile();e.bindVideoStream(r.attendeeId,!1,null,0,0,0,null),this.forEachObserver((t=>{t.tileWillBePausedByDownlinkPolicy(e.id())})),e.pause(),this.logger.info(`bwe: Created video tile ${e.id()} for bw paused attendee ${r.attendeeId}`),this.pausedBwAttendeeIds.add(r.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 r=this.getCurrentVideoPreferences(),o=r.highestPriority();let s,c=o;for(;-1!==c;){s=-1;for(const a of r)if(a.priority===c)for(const r of t)r.attendeeId===a.attendeeId&&(i.some((e=>e.groupId===r.groupId))||(e.chosenTotalBitrate+r.avgBitrateKbps<=e.targetDownlinkBitrate?(i.push(r),e.chosenTotalBitrate+=r.avgBitrateKbps):0===e.deltaToNextUpgrade&&(e.deltaToNextUpgrade=r.avgBitrateKbps,n=r)));else if(a.priority>c){s=a.priority;break}for(const o of r)if(o.priority===c){for(const r of t)if(r.attendeeId===o.attendeeId){const s=i.findIndex((e=>e.groupId===r.groupId&&e.maxBitrateKbpsc)break;if(c===o&&0!==e.deltaToNextUpgrade)break;c=s}return n}getVideoTileForAttendeeId(e,t){for(const i of t)if(i.state().boundAttendeeId===e)return i;return null}canUpgrade(e,t,i,n){let r=!1;return n?(t===l.default.High||t===l.default.Medium&&e<=i)&&(r=!0):e<=i&&(r=!0),r?(this.logger.info(`bwe: canUpgrade: bitrateKbp: ${e} targetBitrateKbp: ${i}`),!0):(this.logger.info(`bwe: cannot Upgrade: bitrateKbp: ${e} targetBitrateKbp: ${i}`),!1)}hasSimulcastStreams(e,t,i){let n=0;for(const r of e)r.attendeeId===t&&r.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 t of e)n+=`{grpId:${t.groupId} strId:${t.streamId} maxBr:${t.maxBitrateKbps} avgBr:${t.avgBitrateKbps}}, `;n+="]";let r=`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)&&(r+=`bwe: paused: app stream ids ${JSON.stringify(this.pausedStreamIds)} bw attendees { ${Array.from(this.pausedBwAttendeeIds).join(" ")} }\n`),this.videoPreferences?r+=`bwe: preferences: ${JSON.stringify(this.videoPreferences)}`:r+=`bwe: default preferences: ${JSON.stringify(this.defaultVideoPreferences)}`,r}getCurrentVideoPreferences(){return this.videoPreferences||this.defaultVideoPreferences}getServerSideNetworkAdaption(){return this.serverSideNetworkAdaption}setServerSideNetworkAdaption(e){this.serverSideNetworkAdaption=e,this.setProbeState("Not Probing")}supportedServerSideNetworkAdaptions(){return[s.default.None,s.default.BandwidthProbing]}getVideoPreferences(){let e=this.getCurrentVideoPreferences();return e||(e=d.VideoPreferences.prepare().build()),e}}t.default=h,h.DEFAULT_BANDWIDTH_KBPS=2800,h.STARTUP_PERIOD_MS=6e3,h.LARGE_RATE_CHANGE_TRIGGER_PERCENT=20,h.TARGET_RATE_CHANGE_TRIGGER_PERCENT=15,h.LOW_BITRATE_THRESHOLD_KBPS=300,h.MIN_TIME_BETWEEN_PROBE_MS=5e3,h.MIN_TIME_BETWEEN_SUBSCRIBE_MS=2e3,h.MAX_HOLD_BEFORE_PROBE_MS=3e4,h.MAX_ALLOWED_PROBE_TIME_MS=6e4,h.SPURIOUS_PACKET_LOST_THRESHOLD=2,h.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS=100},1034:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(7103);class r{constructor(e=0,t=0){this.networkIssueResponseDelayFactor=e,this.networkIssueRecoveryDelayFactor=t,this.currentNetworkEvent=0,this.bandwidthDecreaseTimestamp=0,this.referenceBitrate=0,this.serverSideNetworkAdaption=n.default.Default,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(ti)return this.referenceBitrate=t,!0;return!1}return this.currentNetworkEvent=0,!1}getSubscribeDelay(e,t){let i=r.MINIMUM_DELAY_MS;const n=r.MAXIMUM_DELAY_MS-r.MINIMUM_DELAY_MS,a=this.networkIssueResponseDelayFactor;return 1===e&&(i+=n*a*(1+t/10),i=Math.min(r.MAXIMUM_DELAY_MS,i)),i}}t.default=r,r.MINIMUM_DELAY_MS=2e3,r.MAXIMUM_DELAY_MS=8e3,r.Default=new r(0,0),r.UnstableNetworkPreset=new r(0,1),r.StableNetworkPreset=new r(1,0)},3663:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{create(){const e={clientWidth:400,clientHeight:300,width:400,height:300,videoWidth:400,videoHeight:300,style:{transform:""},hasAttribute:()=>!1,removeAttribute:()=>{},setAttribute:()=>{},srcObject:!1,paused:!0,pause:()=>{e.paused=!0},play:()=>(e.paused=!1,Promise.resolve())};return e}}},9807:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((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}}},8919:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(9807);t.default=class{constructor(e,t){this.logger=e,this.stages=t,this.fr=15,this.outputMediaStream=new MediaStream,this.videoInput=document.createElement("video"),this.canvasOutput=document.createElement("canvas"),this.outputCtx=this.canvasOutput.getContext("2d"),this.canvasInput=document.createElement("canvas"),this.inputCtx=this.canvasInput.getContext("2d"),this.inputVideoStream=null,this.sourceBuffers=[],this.destBuffers=[],this.observers=new Set,this.hasStarted=!1,this.process=e=>n(this,void 0,void 0,(function*(){if(!this.inputVideoStream)return;const e=performance.now();this.videoInput.videoWidth&&(this.canvasInput.width!==this.videoInput.videoWidth&&(this.canvasInput.width=this.videoInput.videoWidth,this.canvasInput.height=this.videoInput.videoHeight,this.sourceBuffers[0].height=this.canvasInput.height,this.sourceBuffers[0].width=this.canvasInput.width,this.sourceBuffers[0].framerate=this.framerate),this.inputCtx.drawImage(this.videoInput,0,0));let t,i=[];i.push(this.sourceBuffers[0]);try{for(const e of this.processors)i=yield e.process(i)}catch(e){return void this.forEachObserver((e=>{e.processingDidFailToStart&&e.processingDidFailToStart()}))}this.destBuffers=i;try{t=yield this.destBuffers[0].asCanvasImageSource()}catch(e){return void(this.inputVideoStream&&(this.logger.info("buffers are destroyed and pipeline could not start"),this.forEachObserver((e=>{e.processingDidFailToStart&&e.processingDidFailToStart()}))))}const n=t.width,r=t.height;0!==n&&0!==r&&(this.canvasOutput.width!==n&&this.canvasOutput.height!==r&&(this.canvasOutput.width=n,this.canvasOutput.height=r),this.outputCtx.drawImage(t,0,0,n,r,0,0,n,r),this.hasStarted||(this.hasStarted=!0,this.forEachObserver((e=>{e.processingDidStart&&e.processingDidStart()}))));const a=performance.now()-e,o=2e3/this.framerate-a,s=Math.max(0,1e3/this.framerate-a);o<=0&&this.forEachObserver((e=>{e.processingLatencyTooHigh&&e.processingLatencyTooHigh(a)})),this.lastTimeOut=setTimeout(this.process,s)}))}destroy(){if(this.stop(),this.stages)for(const e of this.stages)e.destroy()}get framerate(){return this.fr}set framerate(e){this.fr=e<0?15:e}stop(){if(this.videoInput.removeEventListener("loadedmetadata",this.process),this.videoInput.srcObject=null,this.destroyInputMediaStreamAndBuffers(),this.outputMediaStream)for(const e of this.outputMediaStream.getVideoTracks())e.stop();this.lastTimeOut&&(clearTimeout(this.lastTimeOut),this.lastTimeOut=void 0),this.hasStarted&&(this.hasStarted=!1,this.forEachObserver((e=>{e.processingDidStop&&e.processingDidStop()})))}addObserver(e){this.observers.add(e)}removeObserver(e){this.observers.delete(e)}getInputMediaStream(){return n(this,void 0,void 0,(function*(){return this.inputVideoStream}))}getActiveOutputMediaStream(){return this.outputMediaStream&&this.outputMediaStream.active?this.outputMediaStream:this.outputMediaStream=this.canvasOutput.captureStream(this.framerate)}setInputMediaStream(e){return n(this,void 0,void 0,(function*(){if(!e)return void this.stop();if(0===e.getVideoTracks().length)return void this.logger.error("No video tracks in input media stream, ignoring");this.inputVideoStream=e;const t=this.inputVideoStream.getVideoTracks()[0].getSettings();this.logger.info(`processing pipeline input stream settings ${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 r.default(this.canvasInput);this.sourceBuffers.push(i),this.videoInput.load();try{yield this.videoInput.play()}catch(e){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=[]}}},7673:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(543),a=i(8919);class o{constructor(e,t,i,n=new r.default){this.logger=e,this.device=t,this.processors=i,this.browserBehavior=n,this.observers=new Set,this.pipe=new a.default(this.logger,this.processors),this.pipe.addObserver(this)}get outputMediaStream(){return this.pipe.outputMediaStream}chooseNewInnerDevice(e){const t=new o(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*(){return this.device}))}transformStream(e){return n(this,void 0,void 0,(function*(){return yield this.pipe.setInputMediaStream(e),this.inputMediaStream=e,this.pipe.getActiveOutputMediaStream()}))}onOutputStreamDisconnect(){this.logger.info("DefaultVideoTransformDevice: detach stopping input media stream");const e=this.device&&this.device.id;if(this.pipe.stop(),!e&&this.inputMediaStream)for(const e of this.inputMediaStream.getVideoTracks())e.stop()}stop(){return n(this,void 0,void 0,(function*(){if(this.inputMediaStream)for(const e of this.inputMediaStream.getVideoTracks())e.stop();this.pipe.destroy(),this.inputMediaStream=null}))}addObserver(e){this.observers.add(e)}removeObserver(e){this.observers.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=o},2801:function(e,t){"use strict";var i=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((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*(){}))}}},60:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},1508:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class 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 e=0;e{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(289),r=i(1508),a=i(6876);t.default=class{constructor(e){this.logger=e,this.currentIndex=null,this.indexForSubscribe=null,this.currentSubscribeAck=null,this.subscribeTrackToStreamMap=null,this.subscribeStreamToAttendeeMap=null,this.subscribeStreamToExternalUserIdMap=null,this.subscribeSsrcToStreamMap=null,this.streamToAttendeeMap=null,this.streamToExternalUserIdMap=null,this.videoStreamDescription=new a.default,this.videoStreamDescription.trackLabel="AmazonChimeExpressVideo",this.videoStreamDescription.streamId=2,this.videoStreamDescription.groupId=2}localStreamDescriptions(){return[this.videoStreamDescription.clone()]}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 a.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);et.get(e.attendeeId)===e.groupId))),this.streamToAttendeeMap=null,this.streamToExternalUserIdMap=null}subscribeFrameSent(){this.indexForSubscribe=this.currentIndex}integrateSubscribeAckFrame(e){this.currentSubscribeAck=e,this.subscribeTrackToStreamMap=this.buildTrackToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToStreamMap=this.buildSSRCToStreamMap(this.currentSubscribeAck),this.subscribeStreamToAttendeeMap=this.buildStreamToAttendeeMap(this.indexForSubscribe),this.subscribeStreamToExternalUserIdMap=this.buildStreamExternalUserIdMap(this.indexForSubscribe)}integrateBitratesFrame(e){if(this.currentIndex)for(const t of e.bitrates){const e=this.currentIndex.sources.find((e=>e.streamId===t.sourceStreamId));void 0!==e&&(e.avgBitrateBps=t.avgBitrateBps)}}allStreams(){const e=new r.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 r of this.currentIndex.sources){const{attendeeId:a,externalUserId:o,mediaType:s}=r;a!==e&&s===n.SdkStreamMediaType.VIDEO&&(i.has(a)||(t.push({attendee:{attendeeId:a,externalUserId:o}}),i.add(a)))}return t}streamSelectionUnderBandwidthConstraint(e,t,i,a){const o=new Set;if(this.currentIndex)for(const r of this.currentIndex.sources)r.attendeeId!==e&&r.mediaType===n.SdkStreamMediaType.VIDEO&&(t.has(r.attendeeId)||i.has(r.attendeeId)||o.add(r.attendeeId));const s=this.buildAttendeeToSortedStreamDescriptorMapExcludingSelf(e),c=new Map;let l=0;s.forEach(((e,t)=>{c.set(t,e[0]),l+=e[0].maxBitrateKbps})),l=this.trySelectHighBitrateForAttendees(s,t,l,a,c),this.trySelectHighBitrateForAttendees(s,o,l,a,c);const u=new r.default;for(const e of c.values())u.add(e.streamId);return u}highestQualityStreamFromEachGroupExcludingSelf(e){const t=new r.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.maxBitrateKbps>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}`),"";return this.subscribeStreamToAttendeeMap.get(t)||(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}`),"";return this.subscribeStreamToExternalUserIdMap.get(t)||(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)}return this.streamToAttendeeMap.get(e)||(this.logger.info(`stream ${e}) does not correspond to a known attendee`),"")}groupIdForStreamId(e){if(this.currentIndex&&this.currentIndex.sources){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 r.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,r){for(const a of t){if(i>=n)break;if(e.has(a)){const t=e.get(a);for(const e of t.reverse())if(i-r.get(a).maxBitrateKbps+e.maxBitrateKbps{e.sort(((e,t)=>e.maxBitrateKbps>t.maxBitrateKbps?1:e.maxBitrateKbps{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(289),r=i(1318),a=i(6876);class o extends r.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;n0&&(this._localStreamInfos[i].timeEnabled=Date.now()),this._localStreamInfos[i].maxBitrateKbps=r,this._localStreamInfos[i].maxFrameRate=o,this._localStreamInfos[i].disabledByUplinkPolicy=0===r,!0===this._localStreamInfos[i].disabledByUplinkPolicy&&(this._localStreamInfos[i].disabledByWebRTC=!1),i++;else{t=!1;const e=new a.default;e.maxBitrateKbps=r,e.maxFrameRate=o,e.disabledByUplinkPolicy=0===r,0!==r&&(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 i of e.bitrates)t.add(i.sourceStreamId),this.streamIdToBitrateKbpsMap.set(i.sourceStreamId,this.convertBpsToKbps(i.avgBitrateBps));for(const e of i)t.has(e)||(this.streamIdToBitrateKbpsMap.get(e)===o.UNSEEN_STREAM_BITRATE?this.streamIdToBitrateKbpsMap.set(e,o.RECENTLY_INACTIVE_STREAM_BITRATE):this.streamIdToBitrateKbpsMap.set(e,o.NOT_SENDING_STREAM_BITRATE));for(let e=0;eo.BitratesMsgFrequencyMs&&(this._localStreamInfos[e].disabledByWebRTC=!0):this._lastBitRateMsgTime-this._localStreamInfos[e].timeEnabled>o.BitratesMsgFrequencyMs&&(this._localStreamInfos[e].disabledByWebRTC=!0))}this._lastBitRateMsgTime=Date.now(),this.logLocalStreamDescriptions()}logLocalStreamDescriptions(){let e="";for(const t of this._localStreamInfos)e+=`streamId=${t.streamId} maxBitrate=${t.maxBitrateKbps} disabledByWebRTC=${t.disabledByWebRTC} disabledByUplink=${t.disabledByUplinkPolicy}\n`;this.logger.debug((()=>e))}integrateIndexFrame(e){super.integrateIndexFrame(e);const t=new Set,i=new Set(this.streamIdToBitrateKbpsMap.keys());for(const e of this.currentIndex.sources)e.mediaType===n.SdkStreamMediaType.VIDEO&&(t.add(e.streamId),this.streamIdToBitrateKbpsMap.has(e.streamId)||this.streamIdToBitrateKbpsMap.set(e.streamId,o.UNSEEN_STREAM_BITRATE));for(const e of i)t.has(e)||this.streamIdToBitrateKbpsMap.delete(e)}integrateSubscribeAckFrame(e){if(super.integrateSubscribeAckFrame(e),!e.allocations||void 0===e.allocations)return;let t=0;for(const i of e.allocations){if(this._localStreamInfos.length{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(289);class r{constructor(e,t,i,n,r){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=r}clone(){const e=new r;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=r},3327:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(543),r=i(214),a=i(7804);class o{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 r=i&&"environment"!==e.getVideoTracks()[0].getSettings().facingMode?"rotateY(180deg)":"";o.setVideoElementFlag(t,"disablePictureInPicture",i),o.setVideoElementFlag(t,"disableRemotePlayback",i),t.style.transform!==r&&(t.style.transform=r),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 n.default).requiresVideoPlayWorkaround()&&t.paused&&t.play())}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="",o.setVideoElementFlag(e,"disablePictureInPicture",!1),o.setVideoElementFlag(e,"disableRemotePlayback",!1),e.srcObject=null}}destroy(){this.devicePixelRatioMonitor.removeObserver(this),this.tileState.boundVideoElement&&this.tileState.boundVideoElement.srcObject===this.tileState.boundVideoStream&&o.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,a,o,s){let c=!1;this.tileState.boundAttendeeId!==e&&(this.tileState.boundAttendeeId=e,new r.default(e).hasModality(r.default.MODALITY_CONTENT)&&(this.tileState.isContent=!0),c=!0),this.tileState.boundExternalUserId!==s&&(this.tileState.boundExternalUserId=s,c=!0),this.tileState.localTile!==t&&(this.tileState.localTile=t,c=!0),this.tileState.boundVideoStream!==i&&(this.tileState.boundVideoStream=i,c=!0),this.tileState.videoStreamContentWidth!==n&&(this.tileState.videoStreamContentWidth=n,c=!0),this.tileState.videoStreamContentHeight!==a&&(this.tileState.videoStreamContentHeight=a,c=!0),this.tileState.streamId!==o&&(this.tileState.streamId=o,c=!0),c&&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?o.connectVideoStreamToVideoElement(this.tileState.boundVideoStream,this.tileState.boundVideoElement,this.tileState.localTile):o.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,this.tileState.paused,this.tileController.keepLastFrameWhenPaused)}static setVideoElementFlag(e,t,i){t in e&&(e[t]=i)}}t.default=o},7804:(e,t)=>{"use strict";Object.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},2958:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(8236),a=i(9190),o=i(8660),s=i(3327);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 r.default(new a.default,this.logger))}discardDevicePixelRatioMonitorIfNotNeeded(){return n(this,void 0,void 0,(function*(){if(this.tileMap.size||!this.devicePixelRatioMonitor)return;const e=this.devicePixelRatioMonitor;return this.devicePixelRatioMonitor=void 0,e.destroy()}))}bindVideoElement(e,t){const i=this.getVideoTile(e);null!==i?i.bindVideoElement(t):this.logger.warn(`Ignoring video element binding for unknown tile id ${e}`)}unbindVideoElement(e,t=!0){const i=this.getVideoTile(e);if(null===i)return void this.logger.warn(`Ignoring video element unbinding for unknown tile id ${e}`);this.logger.info("Unbinding the video element");const n=i.stateRef().boundVideoElement;i.bindVideoElement(null),t&&(this.logger.info("Cleaning up the video element"),s.default.disconnectVideoStreamFromVideoElement(n,!1))}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;return 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=>{o.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=>{o.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}}},4922:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(3327);t.default=class{makeTile(e,t,i,r){return new n.default(e,t,i,r)}}},9394:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},4450:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(7606),r=i(5785),a=i(8660),o=i(1133),s=i(9394);class c{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=c.defaultUplinkBandwidthKbps,this.startTimeMs=0,this.lastUpdatedMs=Date.now(),this.videoIndex=null,this.currLocalDescriptions=[],this.nextLocalDescriptions=[],this.observerQueue=new Set,this.optimalParameters=new o.default(0,0,0,0,!0),this.parametersInEffect=new o.default(0,0,0,0,!0),this.lastUplinkBandwidthKbps=c.defaultUplinkBandwidthKbps,this.currentQualityMap=this.fillEncodingParamWithBitrates([300,0,1200]),this.newQualityMap=this.fillEncodingParamWithBitrates([300,0,1200])}updateConnectionMetric({uplinkKbps:e=0}){if(isNaN(e))return;0===this.startTimeMs&&(this.startTimeMs=Date.now()),Date.now()-this.startTimeMs`simulcast: uplink policy update metrics ${this.lastUplinkBandwidthKbps}`));let t=c.holdDownDurationMs;3===this.currentActiveStreams?t=2*c.holdDownDurationMs:(2===this.currentActiveStreams&&e<=c.kMidDisabledRate||1===this.currentActiveStreams&&e<=c.kHiDisabledRate)&&(t=c.holdDownDurationMs/2),Date.now()=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>=c.kHiDisabledRate?(this.newActiveStreams=1,t[0].maxBitrateKbps=300,t[1].maxBitrateKbps=0,t[2].maxBitrateKbps=1200):this.lastUplinkBandwidthKbps>=c.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(),r=n>=0&&n<=2,a=this.shouldDisableSimulcast!==r;this.numSenders=t,this.shouldDisableSimulcast=r,this.optimalParameters=new o.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1),this.videoIndex=e,this.newQualityMap=this.calculateEncodingParameters(i||a)}wantsResubscribe(){let e=!this.encodingParametersEqual();this.nextLocalDescriptions=this.videoIndex.localStreamDescriptions();for(let t=0;te.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 r.default.NAME_ARR_ASCENDING)if(e=e||!this.compareEncodingParameter(this.newQualityMap.get(t),this.currentQualityMap.get(t)),e)break;return!e}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}captureWidth(){return 1280}captureHeight(){return 768}captureFrameRate(){return 15}maxBandwidthKbps(){return 1400}setIdealMaxBandwidthKbps(e){}setHasBandwidthPriority(e){}fillEncodingParamWithBitrates(e){const t=new Map,i=r.default.NAME_ARR_ASCENDING,n=e;let a=this.shouldDisableSimulcast?1:4;for(let e=0;e0,scaleResolutionDownBy:Math.max(a,1),maxBitrate:1e3*n[e]}),a/=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=>{a.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=c,c.defaultUplinkBandwidthKbps=1200,c.startupDurationMs=6e3,c.holdDownDurationMs=4e3,c.defaultMaxFrameRate=15,c.kHiDisabledRate=700,c.kMidDisabledRate=240},3879:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(7377);t.default=class{constructor(e,t){this.logger=e,this.encodingParams=t,this.videoIndex=null,this.currLocalDescriptions=[],this.nextLocalDescriptions=[]}updateConnectionMetric(e){}chooseMediaTrackConstraints(){}chooseEncodingParameters(){var e,t,i,r,a,o,s,c,l,u,d,f;const C=new Map,h=n.default.NAME_ARR_ASCENDING;return C.set(h[0],{rid:h[0],active:!0,scaleResolutionDownBy:(null===(t=null===(e=this.encodingParams)||void 0===e?void 0:e.low)||void 0===t?void 0:t.scaleResolutionDownBy)||2,maxBitrate:1e3*((null===(r=null===(i=this.encodingParams)||void 0===i?void 0:i.low)||void 0===r?void 0:r.maxBitrateKbps)||300),maxFramerate:(null===(o=null===(a=this.encodingParams)||void 0===a?void 0:a.low)||void 0===o?void 0:o.maxFramerate)||5}),C.set(h[1],{rid:h[1],active:!0,scaleResolutionDownBy:(null===(c=null===(s=this.encodingParams)||void 0===s?void 0:s.high)||void 0===c?void 0:c.scaleResolutionDownBy)||1,maxBitrate:1e3*((null===(u=null===(l=this.encodingParams)||void 0===l?void 0:l.high)||void 0===u?void 0:u.maxBitrateKbps)||1200),maxFramerate:null===(f=null===(d=this.encodingParams)||void 0===d?void 0:d.high)||void 0===f?void 0:f.maxFramerate}),this.getQualityMapString(C),C}updateIndex(e){this.videoIndex=e}wantsResubscribe(){var e,t;let i=!1;this.nextLocalDescriptions=null===(e=this.videoIndex)||void 0===e?void 0:e.localStreamDescriptions();for(let e=0;e<(null===(t=this.nextLocalDescriptions)||void 0===t?void 0:t.length);e++){const t=this.nextLocalDescriptions[e].streamId;if(0!==t&&t){const n=this.currLocalDescriptions.findIndex((e=>e.streamId===t));-1!==n&&this.nextLocalDescriptions[e].disabledByWebRTC!==this.currLocalDescriptions[n].disabledByWebRTC&&(i=!0)}}return this.currLocalDescriptions=this.nextLocalDescriptions,i}chooseCaptureAndEncodeParameters(){}maxBandwidthKbps(){return 1200}setIdealMaxBandwidthKbps(e){}setHasBandwidthPriority(e){}getQualityMapString(e){var t;let i="";const n=null===(t=this.videoIndex)||void 0===t?void 0:t.localStreamDescriptions();(null==n?void 0:n.length)>0&&(e.forEach((e=>{let t=!1;t="low"===e.rid?n[0].disabledByWebRTC:n[1].disabledByWebRTC,i+=`{ rid: ${e.rid} active:${e.active} disabledByWebRTC: ${t} maxBitrate:${e.maxBitrate} scaleResolutionDownBy:${e.scaleResolutionDownBy} maxFrameRate:${e.maxFramerate}`})),this.logger.info(`simulcast: content policy:chooseEncodingParameters newQualityMap: ${i}`))}addObserver(e){}removeObserver(e){}forEachObserver(e){}}},4442:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(1133);class a{constructor(e,t=!0,i,n){this.selfAttendeeId=e,this.scaleResolution=t,this.logger=i,this.browserBehavior=n,this.numberOfPublishedVideoSources=0,this.idealMaxBandwidthKbps=1400,this.hasBandwidthPriority=!1,this.encodingParamMap=new Map,this.reset()}reset(){this.numberOfPublishedVideoSources=0,this.optimalParameters=new r.default(0,0,0,0,!1),this.parametersInEffect=new r.default(0,0,0,0,!1),this.encodingParamMap.set(a.encodingMapKey,{maxBitrate:0})}updateConnectionMetric(e){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(e){var t;let i=!0,n=1;this.transceiverController&&(i=this.transceiverController.hasVideoInput());const a=e.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+(i?1:0);if(this.numberOfPublishedVideoSources!==a){if(this.numberOfPublishedVideoSources=a,this.transceiverController){const e=this.getStreamCaptureSetting();e&&(n=this.calculateEncodingParameters(e).scaleResolutionDownBy)}this.optimalParameters=new r.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1,n)}else null===(t=this.logger)||void 0===t||t.debug("Skipping update index; Number of participants has not changed")}wantsResubscribe(){return!this.parametersInEffect.equal(this.optimalParameters)}chooseCaptureAndEncodeParameters(){return this.parametersInEffect=this.optimalParameters.clone(),this.parametersInEffect.clone()}captureWidth(){let e=640;return this.getNumberOfPublishedVideoSources()>4&&(e=320),e}captureHeight(){let e=384;return this.getNumberOfPublishedVideoSources()>4&&(e=192),e}captureFrameRate(){return 15}maxBandwidthKbps(){if(this.hasBandwidthPriority)return Math.trunc(this.idealMaxBandwidthKbps);let e=0;return e=this.getNumberOfPublishedVideoSources()<=2?this.idealMaxBandwidthKbps:this.getNumberOfPublishedVideoSources()<=4?2*this.idealMaxBandwidthKbps/3:(544/11+14880/(11*this.getNumberOfPublishedVideoSources()))/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(a.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.maxBitrate)||e.scaleResolutionDownBy!==(null==n?void 0:n.scaleResolutionDownBy)}calculateEncodingParameters(e){var t,i;const n=1e3*this.maxBandwidthKbps();let r=1;if(void 0!==e.height&&void 0!==e.width&&this.scaleResolution&&!this.hasBandwidthPriority&&this.getNumberOfPublishedVideoSources()>2){let n=a.targetHeightArray[Math.min(this.getNumberOfPublishedVideoSources(),a.targetHeightArray.length-1)];480===n&&(null===(t=this.browserBehavior)||void 0===t?void 0:t.disable480pResolutionScaleDown())&&(n=360),r=Math.max(Math.min(e.height,e.width)/n,1),null===(i=this.logger)||void 0===i||i.info(`Resolution scale factor is ${r} for capture resolution ${e.width}x${e.height}. New dimension is ${e.width/r}x${e.height/r}`)}return{scaleResolutionDownBy:r,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()}getNumberOfPublishedVideoSources(){var e;return null!==(e=this.numberOfPublishedVideoSources)&&void 0!==e?e:0}}t.default=a,a.encodingMapKey="video",a.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]},657:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(1133);t.default=class{constructor(){}updateConnectionMetric(e){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(e){}wantsResubscribe(){return!1}chooseCaptureAndEncodeParameters(){return new n.default(0,0,0,0,!1)}maxBandwidthKbps(){return 0}setIdealMaxBandwidthKbps(e){}setHasBandwidthPriority(e){}}},3928:(e,t)=>{"use strict";function 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))}}},2497:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VoiceFocusDeviceTransformer=void 0;const r=i(6035),a=i(8690),o=i(4046),s=i(3928),c=i(8878),l=i(851);class u{constructor(e,{preload:t=!0,logger:i,fetchBehavior:n=u.defaultFetchBehavior()},r){this.spec=e,this.supported=!0,this.logger=i,this.vfLogger=i?new s.default(i):void 0,this.preload=t,this.fetchBehavior=n,this.spec=u.augmentSpec(this.spec),r&&(this.configuration=Promise.resolve(r))}static isSupported(e,t){var i,n;const o={fetchBehavior:u.defaultFetchBehavior(),logger:(null==t?void 0:t.logger)?new s.default(t.logger):void 0};if(a.isIFramed()){if(!1===(null==t?void 0:t.allowIFrame))return null===(i=null==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.logger)||void 0===n||n.warn("Amazon Voice Focus support check inside iframe: not recommended.")}return r.VoiceFocus.isSupported(u.augmentSpec(e),o)}static create(e={},t={},i,r,a){var o,s,c;return n(this,void 0,void 0,(function*(){r&&r.Meeting.Meeting&&(r=r.Meeting);const n="AVAILABLE"===(null===(c=null===(s=null===(o=null==r?void 0:r.Meeting)||void 0===o?void 0:o.MeetingFeatures)||void 0===s?void 0:s.Audio)||void 0===c?void 0:c.EchoReduction),a=i&&!0===i.supported&&"ns_es"===i.model.name&&!n,l="ns_es"===e.name&&!n;if(a||l)throw new Error("Echo Reduction requested but not enabled.");const d=new u(e,t,i);return yield d.init(),d}))}static configure(e={},t={}){return n(this,void 0,void 0,(function*(){return new u(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,r]=yield this.allocateVoiceFocus(i),a=Object.assign(Object.assign({},t),{es:"ns_es"===this.spec.name});return new c.default(e,n,r,a)}catch(e){return}}))}static augmentSpec(e){return e&&(e.assetGroup||e.revisionID)?e:Object.assign(Object.assign({},e),{assetGroup:u.currentSDKAssetGroup()})}configure(e=!1){return n(this,void 0,void 0,(function*(){const t={fetchBehavior:this.fetchBehavior,preResolve:e,logger:this.vfLogger};return r.VoiceFocus.configure(this.spec,t)}))}init(){var e;return n(this,void 0,void 0,(function*(){this.configuration||(this.configuration=this.configure());const t=yield this.configuration;if(t.supported){this.pendingVoiceFocus=this.createVoiceFocus(t,this.preload);try{yield this.pendingVoiceFocus}catch(t){null===(e=this.logger)||void 0===e||e.error(`Unable to initialize Amazon Voice Focus: ${t}`),this.supported=!1}}else this.supported=!1}))}createVoiceFocus(e,t){return n(this,void 0,void 0,(function*(){const i=new l.default;return[yield r.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}return this.createVoiceFocus(yield this.configuration,e)}))}static majorVersion(){return o.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|[1-9][0-9]*)/)[0]}static majorMinorVersion(){return o.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=u.majorMinorVersion()||"unknown",t=o.default.sdkUserAgentLowResolution;return{escapedQueryString:`sdk=${encodeURIComponent(e)}&ua=${encodeURIComponent(t)}`}}}t.VoiceFocusDeviceTransformer=u,t.default=u},8878:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(543);class a{constructor(e,t,i,n,a=!1,o,s=new r.default,c=new Map,l,u){this.device=e,this.voiceFocus=t,this.delegate=i,this.nodeOptions=n,this.failed=a,this.node=o,this.browserBehavior=s,this.farEndStreamToAudioSourceNode=c,this.mixDestNode=l,this.mixSourceNode=u}getInnerDevice(){return this.device}mute(e){return n(this,void 0,void 0,(function*(){this.node&&(e?yield this.node.disable():yield this.node.enable())}))}stop(){return n(this,void 0,void 0,(function*(){this.node&&(this.node.disconnect(),yield this.node.stop())}))}chooseNewInnerDevice(e){return n(this,void 0,void 0,(function*(){return this.device!==e||("default"===(t=e)||t&&"object"==typeof t&&("deviceId"in t&&"default"===t.deviceId||"id"in t&&"default"===t.id))?new a(e,this.voiceFocus,this.delegate,this.nodeOptions,this.failed,this.node,this.browserBehavior,this.farEndStreamToAudioSourceNode,this.mixDestNode,this.mixSourceNode):this;var t}))}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()}return{start:this.node,end:this.node}}catch(e){throw this.failed=!0,this.delegate.onFallback(this,e),e}}))}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=a},851:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.observers=new Set}addObserver(e){this.observers.add(e)}removeObserver(e){this.observers.delete(e)}onFallback(e,t){var 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)}}},9751:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{constructor(e,t,i,n,r){this.logger=e,this.realtimeController=t,this.minVolumeDecibels=i,this.maxVolumeDecibels=n,this.selfAttendeeId=r,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,r=!!i.externalUserId,a=i.hasOwnProperty("muted"),o=!!i.dropped;if(n){this.attendeeIdToStreamId[i.attendeeId]&&this.attendeeIdToStreamId[i.attendeeId]i.audioStreamId&&this.streamIdToAttendeeId[t]===n){a=!0;break}}a||this.realtimeController.realtimeSetAttendeeIdPresence(n,!1,r,o,{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[e,t]of n.entries()){const i=this.attendeeIdToStreamId[t],n=this.streamIdToExternalUserId[i];delete this.streamIdToAttendeeId[i],delete this.streamIdToExternalUserId[i],delete this.warnedAboutMissingStreamIdMapping[i],delete this.attendeeIdToStreamId[t],t!==this.selfAttendeeId?this.realtimeController.realtimeSetAttendeeIdPresence(t,!1,n,!1,{attendeeIndex:e,attendeesInFrame:t.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 r=this.streamIdToAttendeeId[n],a=this.streamIdToExternalUserId[n];let o=null,s=null;null!==e&&(o=e.hasOwnProperty(r)?e[r]:i.IMPLICIT_VOLUME),null!==t&&(s=t.hasOwnProperty(r)?t[r]:i.IMPLICIT_SIGNAL_STRENGTH),null===o&&null===s||this.realtimeController.realtimeUpdateVolumeIndicator(r,o,null,s,a)}}attendeeIdForStreamId(e){if(0===e)return null;return this.streamIdToAttendeeId[e]||(this.warnedAboutMissingStreamIdMapping[e]||(this.warnedAboutMissingStreamIdMapping[e]=!0,this.logger.warn(`volume indicator stream id ${e} seen before being defined`)),null)}}t.default=i,i.MAX_SIGNAL_STRENGTH_LEVELS=2,i.IMPLICIT_VOLUME=0,i.IMPLICIT_SIGNAL_STRENGTH=1},7631:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=i(4046),r=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(e){return this.logger.debug((()=>`send error: ${e.message}, websocket state=${r.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 r.default.None;switch(this.connection.readyState){case WebSocket.CONNECTING:return r.default.Connecting;case WebSocket.OPEN:return r.default.Open;case WebSocket.CLOSING:return r.default.Closing;case WebSocket.CLOSED:return r.default.Closed}}}},7387:(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(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.decideModel=t.measureAndDecideExecutionApproach=void 0;const r=i(5021),a=i(9424),o={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 s{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=r.loadWorker(i,"VoiceFocusEstimator",this.fetchBehavior,t)}roundtrip(e,t,i){return new Promise(((n,r)=>{this.worker.then((r=>{let a;a=e=>{const{message:o,key:s}=e.data;o===t&&s===i&&(r.removeEventListener("message",a),n(e.data))},r.addEventListener("message",a),r.postMessage(e)})).catch((e=>{var t;null===(t=this.logger)||void 0===t||t.error("Failed to load worker.",e),r(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`,r=e?n:i,a=`bench:${e}`,o={message:"measure",fetchBehavior:this.fetchBehavior,budget:t,path:r,key:a};return this.roundtrip(o,"measurement",a).then((e=>{if(e.measurement)return e.measurement;throw new Error("Failed to measure.")}))}stop(){this.worker.then((e=>{var t;null===(t=this.logger)||void 0===t||t.debug("Stopping estimator worker."),e.terminate()})).catch((e=>{}))}}const c=(e,t,i,r)=>n(void 0,void 0,void 0,(function*(){const n={supportsSIMD:e,supportsSAB:a.supportsSharedArrayBuffer(globalThis,window,i),duration:-1};if(e)return null==i||i.info("Supports SIMD: true (force)"),n;const o=!r,c=r||new s(t,i);try{const t=!a.isOldChrome(window,i)&&(yield c.supportsSIMD());return null==i||i.info(`Supports SIMD: ${t} (force: ${e})`),n.supportsSIMD=t,n}finally{o&&c.stop()}}));t.measureAndDecideExecutionApproach=(e,t,i,r=o)=>n(void 0,void 0,void 0,(function*(){let l=e.executionPreference;const{usagePreference:u,variantPreference:d,namePreference:f,simdPreference:C,estimatorBudget:h,executionQuantaPreference:p}=e;"interactivity"===u&&"inline"!==l&&(null==i||i.debug(`Overriding execution preference ${l} to reflect interactivity preference.`),l="inline");const m="force"===C,v="auto"!==d,g="auto"!==l;let b;try{b=v&&g?yield c(m,t,i):yield((e,t,i,r)=>n(void 0,void 0,void 0,(function*(){const n=new s(t,r);try{const a=yield c(e,t,r,n);if(a.supportsSIMD)try{return a.duration=yield n.measure(!0,i),null==r||r.info("SIMD timing:",a.duration),a}catch(e){null==r||r.warn("Failed SIMD estimation; falling back to non-SIMD."),a.supportsSIMD=!1}return a.duration=yield n.measure(!1,i),null==r||r.info("No-SIMD timing:",a.duration),a}catch(e){throw null==r||r.error("Could not feature check.",e),e}finally{n.stop()}})))(m,t,h,i)}catch(e){throw null==i||i.error("Could not load estimator.",e),new Error("Could not load Voice Focus estimator.")}return(({supportsSIMD:e,supportsSAB:t,duration:i,executionPreference:n="auto",simdPreference:r,variantPreference:s="auto",namePreference:c="default",usagePreference:l,executionQuantaPreference:u=3},d=o,f)=>{const C="force"===r||"disable"!==r&&e,h=-1!==i,p=h?(C?2.5:2.63)/i:0,m=C?d.simd:d.wasm,v=h?((e,t)=>1===e?.6:"quality"===t?.65*e:.5*e)(u,l)*p:0,g=h?.7*p:0,b=c,M=e=>({supported:!1,reason:e});if(h){if(p({supported:!0,useSIMD:C,processor:e,executionApproach:t,variant:i,executionQuanta:"inline"===t?u:void 0,name:b}),S=(e,t,i)=>"auto"!==t?!h||e>i[t]?t:"failed":e>i.c100?"c100":e>i.c50?"c50":e>i.c20?"c20":e>i.c10?"c10":"failed",L=e=>{switch(e||"auto"){case"auto":{let e=L("inline"),t=L("worker");return null==f||f.debug(`Reducing auto preference: ${JSON.stringify(e)} vs ${JSON.stringify(t)}`),!1===e.supported||!1===t.supported?t:e.variant===t.variant||"c50"===e.variant?e:t}case"worker":return a.supportsSharedArrayBuffer(globalThis,window,f)?L("worker-sab"):L("worker-postMessage");case"inline":{const e=S(v,s,m.inline);return"failed"===e?M(`Performance score ${v} not sufficient for inline use with variant preference ${s}.`):y("voicefocus-inline-processor","inline",e)}case"worker-sab":{if(!t){const e="Requested worker-sab but no SharedArrayBuffer support.";return null==f||f.warn(e),{supported:!1,reason:e}}const e=S(g,s,m.worker);return"failed"===e?M(`Performance score ${g} not sufficient for worker use with variant preference ${s}.`):y("voicefocus-worker-sab-processor","worker-sab",e)}case"worker-postMessage":{const e=S(g,s,m.worker);if("failed"===e)return M(`Performance score ${g} not sufficient for worker use.`);if("ns_es"===b){const e="Requested echo suppression but postMessage executor does not support it.";return null==f||f.warn(e),{supported:!1,reason:e}}return y("voicefocus-worker-postMessage-processor","worker-postMessage",e)}}};return L(n)})(Object.assign(Object.assign({},b),{simdPreference:C,executionPreference:l,variantPreference:d,namePreference:f,usagePreference:u,executionQuantaPreference:p}),r,i)})),t.decideModel=({category:e,name:t,variant:i,simd:n,url:r})=>`${e}-${t}-${i}-v1${n?"_simd":""}`},623:(e,t)=>{"use strict";function i(e,t,i){if(!i)return fetch(e,t);const a=r(e,i),o=n(t,i);return fetch(a,o)}function n(e,t){return(null==t?void 0:t.headers)?e?Object.assign(Object.assign({},e),{headers:Object.assign(Object.assign({},e.headers||{}),t.headers)}):{headers:t.headers}:e}function r(e,t){if(!(null==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=r,t.addQueryParams=function(e,t){const i=Object.keys(t);if(!i.length)return e;const n=new URLSearchParams(null==e?void 0:e.escapedQueryString);for(const e of i)n.append(e,t[e]);return Object.assign(Object.assign({},e),{escapedQueryString:n.toString()})};const a={method:"HEAD",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"origin"};t.resolveURL=function(e,t){return i(e,a,t).then((t=>t.redirected?t.url:e))},t.isValidAssetGroup=function(e){return!!e&&/^[-.a-zA-Z0-9]+$/.test(e)},t.isValidRevisionID=function(e){return!!e&&/^[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{22}$/.test(e)}},5021:(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadWorker=void 0;const n=i(623),r={method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"};t.loadWorker=(e,t,i,a)=>{null==a||a.debug(`Loading ${t} worker from ${e}.`);let o=!1;try{o=self.origin===new URL(e).origin}catch(e){null==a||a.error("Could not compare origins.",e)}if(o){const r=n.withQueryString(e,i);return Promise.resolve(new Worker(r,{name:t}))}return n.fetchWithBehavior(e,r,i).then((e=>{if(e.ok)return e.blob().then((e=>new Worker(window.URL.createObjectURL(e))));throw new Error("Fetch failed.")}))}},9424:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isOldChrome=t.supportsWASMStreaming=t.supportsSharedArrayBuffer=t.supportsWASM=t.supportsAudioWorklet=t.supportsWorker=t.supportsVoiceFocusWorker=t.supportsWASMPostMessage=t.isSafari=void 0;const r=i(5021);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)=>!t.isSafari(e)&&(!((e=globalThis)=>!!e.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/))(e)||(a(e)||0)<95),t.supportsVoiceFocusWorker=(e=globalThis,i,a)=>n(void 0,void 0,void 0,(function*(){if(!t.supportsWorker(e,a))return!1;const n=`${i.paths.workers}worker-v1.js`;try{const e=yield r.loadWorker(n,"VoiceFocusTestWorker",i,a);try{e.terminate()}catch(e){null==a||a.debug("Failed to terminate worker.",e)}return!0}catch(e){return null==a||a.info("Failed to fetch and instantiate test worker",e),!1}})),t.supportsWorker=(e=globalThis,t)=>{try{return!!e.Worker}catch(e){return null==t||t.info("Does not support Worker",e),!1}},t.supportsAudioWorklet=(e=globalThis,t)=>{try{return!!e.AudioWorklet&&!!e.AudioWorkletNode}catch(e){return null==t||t.info("Does not support Audio Worklet",e),!1}},t.supportsWASM=(e=globalThis,t)=>{try{return!(!e.WebAssembly||!e.WebAssembly.compile&&!e.WebAssembly.compileStreaming)}catch(e){return null==t||t.info("Does not support WASM",e),!1}},t.supportsSharedArrayBuffer=(e=globalThis,t=globalThis,i)=>{try{return!(!e.SharedArrayBuffer||!t.chrome&&!e.crossOriginIsolated)}catch(e){return null==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(e){return null==t||t.info("Does not support WASM streaming compilation",e),!1}};const a=(e=globalThis)=>{try{if(!e.chrome)return}catch(e){}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=a(e);return!!i&&i<90&&(null==t||t.debug(`Chrome ${i} has incomplete SIMD support.`),!0)}},103:(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},6035:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getAudioInput=t.createAudioContext=t.VoiceFocus=void 0;const r=i(5995),a=i(623),o=i(5021),s=i(9424),c=i(2633),l=i(1678),u=i(271),d={useVoiceFocusAGC:!1,useBuiltInAGC:!0},f="stable-v1",C="https://static.sdkassets.chime.aws",h={processors:`${C}/processors/`,workers:`${C}/workers/`,wasm:`${C}/wasm/`,models:`${C}/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}),g=Object.assign(Object.assign({},m),{autoGainControl:!1,googAutoGainControl:!1,googAutoGainControl2:!1}),b={"voicefocus-worker-sab-processor":{file:"worklet-worker-sab-processor-v1.js",node:l.default},"voicefocus-worker-postMessage-processor":{file:"worklet-worker-postMessage-processor-v1.js",node:u.default},"voicefocus-inline-processor":{file:"worklet-inline-processor-v1.js",node:c.default}},M=(e,t)=>{if(void 0!==e&&!a.isValidAssetGroup(e))throw new Error(`Invalid asset group ${e}`);if(void 0!==t&&!a.isValidRevisionID(t))throw new Error(`Invalid revision ID ${t}`)},y=(e,t)=>`${t.models}${r.decideModel(e)}.wasm`;class S{constructor(e,t,i,n,r){this.processorURL=t,this.nodeConstructor=i,this.nodeOptions=n,this.executionQuanta=r,this.internal={worker:e,nodeOptions:n}}static isSupported(e,t){const{fetchBehavior:i,logger:n}=t||{};if("undefined"==typeof globalThis)return null==n||n.debug("Browser does not have globalThis."),Promise.resolve(!1);if(!s.supportsAudioWorklet(globalThis,n))return null==n||n.debug("Browser does not support Audio Worklet."),Promise.resolve(!1);if(!s.supportsWASM(globalThis,n))return null==n||n.debug("Browser does not support WASM."),Promise.resolve(!1);s.supportsWASMStreaming(globalThis,n)||null==n||n.debug("Browser does not support streaming WASM compilation.");const{assetGroup:r=f,revisionID:o,paths:c=h}=e||{};M(r,o);const l=o?{revisionID:o}:{assetGroup:r},u=a.addQueryParams(i,l),d=Object.assign(Object.assign({},u),{paths:c});return s.supportsVoiceFocusWorker(globalThis,d,n)}static mungeExecutionPreference(e,t){const i=void 0===e||"auto"===e;if(s.isSafari(globalThis)){if(i||"inline"===e)return"inline";if(!i)throw new Error(`Unsupported execution preference ${e}`)}if("worker-sab"===e&&!s.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:o}=t||{},{category:s="voicefocus",name:c="default",variant:l="auto",assetGroup:u=f,revisionID:d,simd:C="detect",executionPreference:p="auto",executionQuantaPreference:m,usagePreference:v="interactivity",estimatorBudget:g=100,paths:b=h,thresholds:S}=e||{};if(null==o||o.debug("Configuring Voice Focus with spec",e),void 0!==s&&"voicefocus"!==s)throw new Error(`Unrecognized category ${s}`);if(void 0!==c&&"default"!==c&&"ns_es"!==c)throw new Error(`Unrecognized feature name ${c}`);if(void 0!==l&&!["auto","c100","c50","c20","c10"].includes(l))throw new Error(`Unrecognized feature variant ${l}`);if(void 0!==m&&![1,2,3].includes(m))throw new Error(`Unrecognized execution quanta preference ${m}`);if(M(u,d),void 0!==C&&!["detect","force","disable"].includes(C))throw new Error(`Unrecognized SIMD option ${C}`);if(void 0!==p&&!["auto","inline","worker","worker-sab","worker-postMessage"].includes(p))throw new Error(`Unrecognized execution preference ${p}`);if(void 0!==v&&!["quality","interactivity"].includes(v))throw new Error(`Unrecognized usage preference ${v}`);const L={executionPreference:this.mungeExecutionPreference(p,o),usagePreference:v,executionQuantaPreference:m,variantPreference:l,namePreference:c,simdPreference:C,estimatorBudget:g},z=d?{revisionID:d}:{assetGroup:u},w=a.addQueryParams(i,z),V=Object.assign({paths:b},w),H=yield r.measureAndDecideExecutionApproach(L,V,o,S);if(!1===H.supported)return{supported:!1,reason:H.reason};null==o||o.info("Decided execution approach",H);const{useSIMD:k,processor:x,variant:_,executionQuanta:A}=H,T={category:s||"voicefocus",name:c||"default",variant:_,simd:k};if(n){const e=y(T,b);T.url=yield a.resolveURL(e,w)}return{fetchConfig:V,model:T,processor:x,executionQuanta:A,supported:!0}}))}static init(e,{delegate:t,preload:i=!0,logger:r}){return n(this,void 0,void 0,(function*(){if(!1===e.supported)throw new Error("Voice Focus not supported. Reason: "+e.reason);const{model:n,processor:a,fetchConfig:c,executionQuanta:l}=e,{simd:u,name:d}=n,{paths:f}=c;if("voicefocus-inline-processor"!==a&&"voicefocus-worker-postMessage-processor"!==a&&"voicefocus-worker-sab-processor"!==a)throw new Error(`Unknown processor ${a}`);const C=n.url||y(n,f);null==r||r.debug(`Using model URL ${C}.`);const h=`${f.wasm}audio_buffer-v1${u?"_simd":""}.wasm`,p=`${f.wasm}resampler-v1${u?"_simd":""}.wasm`,m=`${f.workers}worker-v1.js`,{file:v,node:g}=b[a],M=`${f.processors}${v}`,L=yield o.loadWorker(m,"VoiceFocusWorker",c,r);if(i){null==r||r.debug("Preloading",C);let e=s.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";L.postMessage({message:e,preload:!0,key:"model",fetchBehavior:c,path:C})}const z=new S(L,M,g,{processor:a,worker:L,audioBufferURL:h,resamplerURL:p,fetchBehavior:c,modelURL:C,delegate:t,logger:r,numberOfInputs:"ns_es"===d?2:1},l);return Promise.resolve(z)}))}createNode(e,t){var i;const{voiceFocusSampleRate:n=(16e3===e.sampleRate?16e3:48e3),enabled:r=!0,agc:o=d}=t||{},s=null==t?void 0:t.es,c={voiceFocusSampleRate:n,enabled:r,sendBufferCount:10,prefill:6,agc:o,executionQuanta:this.executionQuanta,supportFarendStream:s},l=a.withQueryString(this.processorURL,null===(i=this.nodeOptions)||void 0===i?void 0:i.fetchBehavior);return e.audioWorklet.addModule(l).then((()=>new this.nodeConstructor(e,Object.assign(Object.assign({},this.nodeOptions),{processorOptions:c}))))}applyToStream(e,t,i){return n(this,void 0,void 0,(function*(){const n=t.createMediaStreamSource(e),r=yield this.applyToSourceNode(n,t,i),a=t.createMediaStreamDestination();return r.connect(a),{node:r,source:n,destination:a,stream:a.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=S,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,r;const{constraints:a,spec:o,delegate:s,preload:c=!0,options:l}=t,{logger:u}=i,f=yield S.configure(o,i);if(!f.supported)return null===(n=i.logger)||void 0===n||n.warn("Voice Focus not supported; returning standard stream."),window.navigator.mediaDevices.getUserMedia(a);const C=yield S.init(f,{delegate:s,preload:c,logger:u}),h=(null===(r=t.options)||void 0===r?void 0:r.agc)||d,p=yield window.navigator.mediaDevices.getUserMedia(((e,t)=>{let i;if(i=t.useBuiltInAGC?v:g,!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)})})(a,h));return C.applyToStream(p,e,l).then((e=>e.stream))}))},2633:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(9424),a=i(103);class o extends a.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.cpuWarningCount=0,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:i,worker:n,fetchBehavior:a,logger:o,delegate:s}=t;this.logger=o,this.port.onmessage=this.onProcessorMessage.bind(this),this.delegate=s,o&&o.debug("VoiceFocusInlineNode:",i),this.worker=n,this.worker.onmessage=this.onWorkerMessage.bind(this);const c=r.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:c,key:"model",fetchBehavior:a,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(){var e;return n(this,void 0,void 0,(function*(){this.port.postMessage({message:"stop"});try{null===(e=this.worker)||void 0===e||e.terminate()}catch(e){console.error("failed to terminate worker:",e)}this.disconnect()}))}onProcessorMessage(e){var t,i,n;const r=e.data;if("cpu"===r.message){this.cpuWarningCount++;const e=Date.now(),n=this.cpuWarningLastTriggered||e,a=Math.abs(e-n);(!this.cpuWarningLastTriggered||a>5e3)&&(null===(t=this.logger)||void 0===t||t.warn(`CPU warning (count: ${this.cpuWarningCount}):`,r.message),this.cpuWarningCount=0,this.cpuWarningLastTriggered=e),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=o},271:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(9424),a=i(103);class o extends a.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.channelCountMode="explicit",this.channelCount=1;const{modelURL:i,audioBufferURL:n,worker:a,fetchBehavior:o,delegate:s}=t;this.delegate=s,this.worker=a,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:c,agc:l,supportFarendStream:u}=t.processorOptions;this.worker.postMessage({message:"init",approach:"postMessage",frames:16e3===e.sampleRate?160:480,enabled:c,agc:l,fetchBehavior:o,model:i,supportFarendStream:u});const d=r.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:d,key:"buffer",fetchBehavior:o,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=o},1678:function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=i(9424),a=i(103);class o extends a.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.channelCountMode="explicit",this.channelCount=1;const{modelURL:i,resamplerURL:n,worker:a,fetchBehavior:o,delegate:s}=t;this.delegate=s,this.worker=a,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:c,supportFarendStream:l}=t.processorOptions;this.worker.postMessage({message:"init",approach:"sab",frames:16e3===e.sampleRate?160:480,enabled:c,model:i,supportFarendStream:l});const u=r.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:u,key:"resampler",fetchBehavior:o,path:n})}enable(){return n(this,void 0,void 0,(function*(){this.state?(Atomics.store(this.state,1,1),Atomics.notify(this.state,0,1)):this.worker.postMessage({message:"enable"})}))}disable(){return n(this,void 0,void 0,(function*(){this.state?(Atomics.store(this.state,1,0),Atomics.notify(this.state,0,1)):this.worker.postMessage({message:"disable"})}))}stop(){return n(this,void 0,void 0,(function*(){if(this.state)Atomics.store(this.state,1,2),Atomics.notify(this.state,0,1);else try{this.worker.postMessage({message:"stop"})}catch(e){}this.disconnect()}))}onWorkerMessage(e){var t;const 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=o},9742:(e,t)=>{"use strict";t.byteLength=function(e){var t=c(e),i=t[0],n=t[1];return 3*(i+n)/4-n},t.toByteArray=function(e){var t,i,a=c(e),o=a[0],s=a[1],l=new r(function(e,t,i){return 3*(t+i)/4-i}(0,o,s)),u=0,d=s>0?o-4:o;for(i=0;i>16&255,l[u++]=t>>8&255,l[u++]=255&t;return 2===s&&(t=n[e.charCodeAt(i)]<<2|n[e.charCodeAt(i+1)]>>4,l[u++]=255&t),1===s&&(t=n[e.charCodeAt(i)]<<10|n[e.charCodeAt(i+1)]<<4|n[e.charCodeAt(i+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,a=[],o=16383,s=0,c=n-r;sc?c:s+o));return 1===r?(t=e[n-1],a.push(i[t>>2]+i[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],a.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+"=")),a.join("")};for(var i=[],n=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var i=e.indexOf("=");return-1===i&&(i=t),[i,i===t?0:4-i%4]}function l(e,t,n){for(var r,a,o=[],s=t;s>18&63]+i[a>>12&63]+i[a>>6&63]+i[63&a]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},5420:(e,t,i)=>{var n=i(8764).Buffer,r=Object.prototype.toString,a=void 0!==n&&"function"==typeof n.alloc&&"function"==typeof n.allocUnsafe&&"function"==typeof n.from;e.exports=function(e,t,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return o=e,"ArrayBuffer"===r.call(o).slice(8,-1)?function(e,t,i){t>>>=0;var r=e.byteLength-t;if(r<0)throw new RangeError("'offset' is out of bounds");if(void 0===i)i=r;else if((i>>>=0)>r)throw new RangeError("'length' is out of bounds");return a?n.from(e.slice(t,t+i)):new n(new Uint8Array(e.slice(t,t+i)))}(e,t,i):"string"==typeof e?function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!n.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');return a?n.from(e,t):new n(e,t)}(e,t):a?n.from(e):new n(e);var o}},8764:(e,t,i)=>{"use strict";const n=i(9742),r=i(645),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function s(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,i){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,i)}function l(e,t,i){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const i=0|p(e,t);let n=s(i);const r=n.write(e,t);return r!==i&&(n=n.slice(0,r)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(J(e,Uint8Array)){const t=new Uint8Array(e);return C(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(J(e,ArrayBuffer)||e&&J(e.buffer,ArrayBuffer))return C(e,t,i);if("undefined"!=typeof SharedArrayBuffer&&(J(e,SharedArrayBuffer)||e&&J(e.buffer,SharedArrayBuffer)))return C(e,t,i);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,i);const r=function(e){if(c.isBuffer(e)){const t=0|h(e.length),i=s(t);return 0===i.length||e.copy(i,0,0,t),i}return void 0!==e.length?"number"!=typeof e.length||Q(e.length)?s(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),s(e<0?0:0|h(e))}function f(e){const t=e.length<0?0:0|h(e.length),i=s(t);for(let n=0;n=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||J(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const i=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===i)return 0;let r=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return G(e).length;default:if(r)return n?-1:q(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,i){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return _(this,t,i);case"utf8":case"utf-8":return V(this,t,i);case"ascii":return k(this,t,i);case"latin1":case"binary":return x(this,t,i);case"base64":return w(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function v(e,t,i){const n=e[t];e[t]=e[i],e[i]=n}function g(e,t,i,n,r){if(0===e.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),Q(i=+i)&&(i=r?0:e.length-1),i<0&&(i=e.length+i),i>=e.length){if(r)return-1;i=e.length-1}else if(i<0){if(!r)return-1;i=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:b(e,t,i,n,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,i):Uint8Array.prototype.lastIndexOf.call(e,t,i):b(e,[t],i,n,r);throw new TypeError("val must be string, number or Buffer")}function b(e,t,i,n,r){let a,o=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,i/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){let n=-1;for(a=i;as&&(i=s-c),a=i;a>=0;a--){let i=!0;for(let n=0;nr&&(n=r):n=r;const a=t.length;let o;for(n>a/2&&(n=a/2),o=0;o>8,r=i%256,a.push(r),a.push(n);return a}(t,e.length-i),e,i,n)}function w(e,t,i){return 0===t&&i===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,i))}function V(e,t,i){i=Math.min(e.length,i);const n=[];let r=t;for(;r239?4:t>223?3:t>191?2:1;if(r+o<=i){let i,n,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:i=e[r+1],128==(192&i)&&(c=(31&t)<<6|63&i,c>127&&(a=c));break;case 3:i=e[r+1],n=e[r+2],128==(192&i)&&128==(192&n)&&(c=(15&t)<<12|(63&i)<<6|63&n,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:i=e[r+1],n=e[r+2],s=e[r+3],128==(192&i)&&128==(192&n)&&128==(192&s)&&(c=(15&t)<<18|(63&i)<<12|(63&n)<<6|63&s,c>65535&&c<1114112&&(a=c))}}null===a?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),r+=o}return function(e){const t=e.length;if(t<=H)return String.fromCharCode.apply(String,e);let i="",n=0;for(;nn.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,r)):Uint8Array.prototype.set.call(n,t,r);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,r)}r+=t.length}return n},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;ti&&(e+=" ... "),""},a&&(c.prototype[a]=c.prototype.inspect),c.prototype.compare=function(e,t,i,n,r){if(J(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===i&&(i=e?e.length:0),void 0===n&&(n=0),void 0===r&&(r=this.length),t<0||i>e.length||n<0||r>this.length)throw new RangeError("out of range index");if(n>=r&&t>=i)return 0;if(n>=r)return-1;if(t>=i)return 1;if(this===e)return 0;let a=(r>>>=0)-(n>>>=0),o=(i>>>=0)-(t>>>=0);const s=Math.min(a,o),l=this.slice(n,r),u=e.slice(t,i);for(let e=0;e>>=0,isFinite(i)?(i>>>=0,void 0===n&&(n="utf8")):(n=i,i=void 0)}const r=this.length-t;if((void 0===i||i>r)&&(i=r),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return M(this,e,t,i);case"utf8":case"utf-8":return y(this,e,t,i);case"ascii":case"latin1":case"binary":return S(this,e,t,i);case"base64":return L(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,e,t,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const H=4096;function k(e,t,i){let n="";i=Math.min(e.length,i);for(let r=t;rn)&&(i=n);let r="";for(let n=t;ni)throw new RangeError("Trying to access beyond buffer length")}function E(e,t,i,n,r,a){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||te.length)throw new RangeError("Index out of range")}function I(e,t,i,n,r){j(t,n,r,e,i,7);let a=Number(t&BigInt(4294967295));e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a,a>>=8,e[i++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[i++]=o,o>>=8,e[i++]=o,o>>=8,e[i++]=o,o>>=8,e[i++]=o,i}function N(e,t,i,n,r){j(t,n,r,e,i,7);let a=Number(t&BigInt(4294967295));e[i+7]=a,a>>=8,e[i+6]=a,a>>=8,e[i+5]=a,a>>=8,e[i+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[i+3]=o,o>>=8,e[i+2]=o,o>>=8,e[i+1]=o,o>>=8,e[i]=o,i+8}function P(e,t,i,n,r,a){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function O(e,t,i,n,a){return t=+t,i>>>=0,a||P(e,0,i,4),r.write(e,t,i,n,23,4),i+4}function R(e,t,i,n,a){return t=+t,i>>>=0,a||P(e,0,i,8),r.write(e,t,i,n,52,8),i+8}c.prototype.slice=function(e,t){const i=this.length;(e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t>>=0,t>>>=0,i||T(e,t,this.length);let n=this[e],r=1,a=0;for(;++a>>=0,t>>>=0,i||T(e,t,this.length);let n=this[e+--t],r=1;for(;t>0&&(r*=256);)n+=this[e+--t]*r;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Y((function(e){U(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||W(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,r=this[++e]+256*this[++e]+65536*this[++e]+i*2**24;return BigInt(n)+(BigInt(r)<>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||W(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],r=this[++e]*2**24+65536*this[++e]+256*this[++e]+i;return(BigInt(n)<>>=0,t>>>=0,i||T(e,t,this.length);let n=this[e],r=1,a=0;for(;++a=r&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,i){e>>>=0,t>>>=0,i||T(e,t,this.length);let n=t,r=1,a=this[e+--n];for(;n>0&&(r*=256);)a+=this[e+--n]*r;return r*=128,a>=r&&(a-=Math.pow(2,8*t)),a},c.prototype.readInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||T(e,2,this.length);const i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},c.prototype.readInt16BE=function(e,t){e>>>=0,t||T(e,2,this.length);const i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Y((function(e){U(e>>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||W(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(i<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],i=this[e+7];void 0!==t&&void 0!==i||W(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||T(e,4,this.length),r.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||T(e,4,this.length),r.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||T(e,8,this.length),r.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||T(e,8,this.length),r.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,i,n){e=+e,t>>>=0,i>>>=0,n||E(this,e,t,i,Math.pow(2,8*i)-1,0);let r=1,a=0;for(this[t]=255&e;++a>>=0,i>>>=0,n||E(this,e,t,i,Math.pow(2,8*i)-1,0);let r=i-1,a=1;for(this[t+r]=255&e;--r>=0&&(a*=256);)this[t+r]=e/a&255;return t+i},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,i){return e=+e,t>>>=0,i||E(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,i){return e=+e,t>>>=0,i||E(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,i){return e=+e,t>>>=0,i||E(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,i){return e=+e,t>>>=0,i||E(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,i){return e=+e,t>>>=0,i||E(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Y((function(e,t=0){return I(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Y((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*i-1);E(this,e,t,i,n-1,-n)}let r=0,a=1,o=0;for(this[t]=255&e;++r>0)-o&255;return t+i},c.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*i-1);E(this,e,t,i,n-1,-n)}let r=i-1,a=1,o=0;for(this[t+r]=255&e;--r>=0&&(a*=256);)e<0&&0===o&&0!==this[t+r+1]&&(o=1),this[t+r]=(e/a>>0)-o&255;return t+i},c.prototype.writeInt8=function(e,t,i){return e=+e,t>>>=0,i||E(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,i){return e=+e,t>>>=0,i||E(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,i){return e=+e,t>>>=0,i||E(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,i){return e=+e,t>>>=0,i||E(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,i){return e=+e,t>>>=0,i||E(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Y((function(e,t=0){return I(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Y((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,i){return O(this,e,t,!0,i)},c.prototype.writeFloatBE=function(e,t,i){return O(this,e,t,!1,i)},c.prototype.writeDoubleLE=function(e,t,i){return R(this,e,t,!0,i)},c.prototype.writeDoubleBE=function(e,t,i){return R(this,e,t,!1,i)},c.prototype.copy=function(e,t,i,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,i=void 0===i?this.length:i>>>0,e||(e=0),"number"==typeof e)for(r=t;r=n+4;i-=3)t=`_${e.slice(i-3,i)}${t}`;return`${e.slice(0,i)}${t}`}function j(e,t,i,n,r,a){if(e>i||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(a+1)}${n}`:`>= -(2${n} ** ${8*(a+1)-1}${n}) and < 2 ** ${8*(a+1)-1}${n}`:`>= ${t}${n} and <= ${i}${n}`,new D.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,i){U(t,"offset"),void 0!==e[t]&&void 0!==e[t+i]||W(t,e.length-(i+1))}(n,r,a)}function U(e,t){if("number"!=typeof e)throw new D.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,i){if(Math.floor(e)!==e)throw U(e,i),new D.ERR_OUT_OF_RANGE(i||"offset","an integer",e);if(t<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${t}`,e)}B("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),B("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),B("ERR_OUT_OF_RANGE",(function(e,t,i){let n=`The value of "${e}" is out of range.`,r=i;return Number.isInteger(i)&&Math.abs(i)>2**32?r=F(String(i)):"bigint"==typeof i&&(r=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(r=F(r)),r+="n"),n+=` It must be ${t}. Received ${r}`,n}),RangeError);const $=/[^+/0-9A-Za-z-_]/g;function q(e,t){let i;t=t||1/0;const n=e.length;let r=null;const a=[];for(let o=0;o55295&&i<57344){if(!r){if(i>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}r=i;continue}if(i<56320){(t-=3)>-1&&a.push(239,191,189),r=i;continue}i=65536+(r-55296<<10|i-56320)}else r&&(t-=3)>-1&&a.push(239,191,189);if(r=null,i<128){if((t-=1)<0)break;a.push(i)}else if(i<2048){if((t-=2)<0)break;a.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;a.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return a}function G(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,i,n){let r;for(r=0;r=t.length||r>=e.length);++r)t[r+i]=e[r];return r}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Q(e){return e!=e}const Z=function(){const e="0123456789abcdef",t=new Array(256);for(let i=0;i<16;++i){const n=16*i;for(let r=0;r<16;++r)t[n+r]=e[i]+e[r]}return t}();function Y(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},6688:(e,t,i)=>{"use strict";i.d(t,{Z:()=>s});var n=i(8081),r=i.n(n),a=i(3645),o=i.n(a)()(r());o.push([e.id,"@import url(https://fonts.googleapis.com/css2?family=Chicle&family=Poppins:ital,wght@0,200;0,400;0,600;1,200;1,400;1,600&display=swap);"]),o.push([e.id,'/* @import "./002_Frame.css";\n\n@import "./010_Dialog.css";\n@import "./101_processing.css";\n@import "./102_RotatedButton.css";\n@import "./103_tooltips.css";\n@import "./104_signage.css"; */\n:root {\n --text-color: #333;\n --company-color1: rgba(64, 119, 187, 1);\n --company-color2: rgba(29, 47, 78, 1);\n --company-color3: rgba(255, 255, 255, 1);\n --company-color1-alpha: rgba(64, 119, 187, 0.3);\n --company-color2-alpha: rgba(29, 47, 78, 0.3);\n --company-color3-alpha: rgba(255, 255, 255, 0.3);\n --global-shadow-color: rgba(0, 0, 0, 0.4);\n\n --sidebar-transition-time: 0.3s;\n --sidebar-transition-animation: ease-in-out;\n\n --header-height: 1.5rem;\n --right-sidebar-width: 320px;\n\n --dialog-border-color: rgba(100, 100, 100, 1);\n --dialog-shadow-color: rgba(0, 0, 0, 0.3);\n --dialog-background-color: rgba(255, 255, 255, 1);\n --dialog-primary-color: rgba(19, 70, 209, 1);\n --dialog-active-color: rgba(40, 70, 209, 1);\n --dialog-input-border-color: rgba(200, 200, 200, 1);\n --dialog-submit-button-color: rgba(180, 190, 230, 1);\n --dialog-cancel-button-color: rgba(235, 80, 80, 1);\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: "Poppins", sans-serif;\n}\nhtml {\n font-size: 16px;\n}\nbody {\n height: 100%;\n width: 100%;\n color: var(--text-color);\n background: linear-gradient(45deg, var(--company-color1) 0, 5%, var(--company-color2) 5% 10%, var(--company-color3) 10% 80%, var(--company-color1) 80% 85%, var(--company-color2) 85% 100%);\n}\n\n.application-container {\n position: relative;\n height: 100vh;\n width: 100%;\n overflow: hidden;\n list-style-type: none;\n}\n\n.state-control-checkbox {\n display: none;\n}\n\n.video-for-recorder-container {\n position: absolute;\n left: -1000px;\n width: 30px;\n height: 30px;\n}\n\n/* */\n/* */\n/* */\n/* start button */\n.front-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n margin-top: 30px;\n}\n.front-title {\n font-size: 4rem;\n font-weight: 100;\n}\n.front-description {\n font-size: 0.9rem;\n text-align: center;\n}\n.front-description-img {\n height: 2rem;\n}\n.front-description-strong {\n color: #f66;\n font-size: 0.9rem;\n font-weight: 600;\n}\n.front-start-button {\n font-size: 4rem;\n border: 3px solid #333;\n background: #eef;\n width: 500px;\n padding: 15px;\n cursor: pointer;\n text-align: center;\n margin: 100px 0 0 0 auto;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n.front-note {\n font-size: 1rem;\n}\n.front-attention {\n font-size: 0.8rem;\n color: #f55;\n font-weight: 600;\n}\n.front-disclaimer {\n font-size: 0.8rem;\n}\n\n/* Header */\n\n.header {\n position: fixed;\n top: 0px;\n left: 0px;\n height: var(--header-height);\n background: #ffe;\n width: 100vw;\n display: flex;\n justify-content: space-between;\n}\n.header-application-title-container {\n display: flex;\n}\n.header-application-title-logo {\n width: var(--header-height);\n height: var(--header-height);\n padding: 2px 2px 2px 2px;\n margin: 0px 2px 0px 5px;\n}\n.header-application-title-text {\n font-weight: 600;\n margin: 0px 2px 0px 2px;\n}\n\n.header-device-selector-container {\n margin: 0 10px 0 0;\n display: flex;\n}\n.header-device-selector-text {\n margin: 0px 2px 0px 10px;\n}\n.device-selector-option {\n font-size: 1rem;\n}\n.device-selector-select {\n max-width: 10rem;\n font-size: 0.7rem;\n}\n\n/* Body */\n.body {\n position: fixed;\n top: var(--header-height);\n width: 100%;\n height: calc(100% - var(--header-height));\n}\n/* Body -> Controller */\n.controller {\n display: flex;\n margin: 10px 0 10px 40px;\n}\n/* Body -> Controller -> Corpus */\n.corpus-selector-label {\n font-size: 1.3rem;\n font-weight: 600;\n padding: 0 4px 0 4px;\n}\n.corpus-selector-option {\n font-size: 1rem;\n padding: 0 4px 0 4px;\n}\n.corpus-selector-select {\n max-width: 10rem;\n font-size: 1rem;\n padding: 0 4px 0 4px;\n}\n\n/* Body -> Controller -> Text Index */\n.text-index-selector-container {\n display: flex;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n padding: 0 40px 0 40px;\n text-align: center;\n}\n.text-index-selector-button {\n color: #333;\n cursor: pointer;\n font-size: 1.3rem;\n font-weight: 600;\n border: 1px solid #000;\n width: 30px;\n border-radius: 3px;\n}\n.text-index-selector-button-disable {\n font-size: 1.3rem;\n font-weight: 600;\n color: #ddd;\n border: 1px solid #000;\n width: 30px;\n border-radius: 3px;\n}\n.text-index-selector-current-index {\n font-size: 1.3rem;\n font-weight: 600;\n padding: 0 2px 0 2px;\n width: 100px;\n}\n\n/* Body -> Controller -> Audio Controller */\n.audio-controller-button-container {\n display: flex;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n text-align: center;\n}\n.audio-controller-button {\n color: #000;\n font-weight: 600;\n cursor: pointer;\n border: 1px solid #444;\n border-radius: 3px;\n width: 100px;\n margin: 0 4px 0 4px;\n}\n.audio-controller-button-disabled {\n color: #aaa;\n border: 1px solid #444;\n border-radius: 3px;\n width: 100px;\n margin: 0 4px 0 4px;\n}\n.audio-controller-button-active {\n color: #444;\n font-weight: 600;\n background: #dfd;\n border: 1px solid #444;\n border-radius: 3px;\n width: 100px;\n margin: 0 4px 0 4px;\n}\n.audio-controller-button-attention {\n color: #44f;\n font-weight: 600;\n cursor: pointer;\n background: #fcc;\n border: 1px solid #444;\n border-radius: 3px;\n width: 100px;\n margin: 0 4px 0 4px;\n}\n/* Body -> Controller -> Export Controller */\n.export-controller-button-container {\n display: flex;\n flex-direction: row;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n text-align: center;\n padding: 0 60px 0 60px;\n}\n.export-controller-button-export {\n color: #000;\n font-weight: 600;\n cursor: pointer;\n border: 1px solid #444;\n border-radius: 3px;\n width: 100px;\n margin: 0 4px 0 4px;\n}\n.export-controller-button-export-disabled {\n color: #aaa;\n font-weight: 600;\n border: 1px solid #444;\n border-radius: 3px;\n width: 100px;\n margin: 0 4px 0 4px;\n}\n.export-controller-button-export-memo {\n color: rgb(190, 129, 75);\n font-weight: 600;\n}\n.export-controller-export-progress {\n}\n/* */\n/* */\n/* */\n/* */\n.recorder-card-container {\n height: 300px;\n width: 90%;\n margin: 0 20px 0 20px;\n overflow-y: hidden;\n overflow-x: hidden;\n}\n.recorder-card-list {\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n}\n.recorder-card {\n border: 1px solid rgb(103, 103, 103);\n background: rgba(255, 255, 238, 0.8);\n height: 300px;\n width: 100%;\n border-radius: 15px;\n}\n.recorder-card-title {\n font-size: 1.5rem;\n padding: 10px;\n color: #644;\n}\n.recorder-card-text {\n font-size: 1.7rem;\n padding: 4px 10px 4px 10px;\n color: #c44;\n}\n.recorder-card-text_hira {\n font-size: 1.7rem;\n padding: 4px 10px 4px 10px;\n color: #477;\n}\n\n/* */\n/* */\n/* */\n.waveform-container,\n.mel-spectrogram-container\n {\n width: 500px;\n box-sizing: content-box;\n /* border: 1px solid #aaa; */\n margin: 20px auto;\n /* padding: 30px; */\n background: #fff;\n}\n.mel-spectrogram-div{\n width:100%;\n height:150px;\n display:flex;\n -o-object-fit:contain;\n object-fit:contain;\n margin-top:10px;\n}\n.mel-spectrogram-canvas{\n width: 100%;\n}\n.waveform-header {\n display: flex;\n}\n.waveform-header-item {\n padding: 0 5px 0 5px;\n width: 200px;\n}\n.waveform-header-item-warn {\n padding: 0 5px 0 5px;\n width: 200px;\n color: #f00;\n}\n',""]);const s=o},3645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var i="",n=void 0!==t[5];return t[4]&&(i+="@supports (".concat(t[4],") {")),t[2]&&(i+="@media ".concat(t[2]," {")),n&&(i+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),i+=e(t),n&&(i+="}"),t[2]&&(i+="}"),t[4]&&(i+="}"),i})).join("")},t.i=function(e,i,n,r,a){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(n)for(var s=0;s0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=a),i&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=i):u[2]=i),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),t.push(u))}},t}},8081:e=>{"use strict";e.exports=function(e){return e[1]}},3631:(e,t,i)=>{"use strict";i.r(t),i.d(t,{BotInfo:()=>c,BrowserInfo:()=>a,NodeInfo:()=>o,ReactNativeInfo:()=>l,SearchBotDeviceInfo:()=>s,browserName:()=>p,detect:()=>C,detectOS:()=>v,getNodeVersion:()=>g,parseUserAgent:()=>m});var n=i(4155),r=function(e,t,i){if(i||2===arguments.length)for(var n,r=0,a=t.length;r{"use strict";var t,i="object"==typeof Reflect?Reflect:null,n=i&&"function"==typeof i.apply?i.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};t=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(i,n){function r(i){e.removeListener(t,a),n(i)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",r),i([].slice.call(arguments))}p(e,t,a,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&p(e,"error",t,{once:!0})}(e,r)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function l(e,t,i,n){var r,a,o,l;if(s(i),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),a=e._events),o=a[t]),void 0===o)o=a[t]=i,++e._eventsCount;else if("function"==typeof o?o=a[t]=n?[i,o]:[o,i]:n?o.unshift(i):o.push(i),(r=c(e))>0&&o.length>r&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,i){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},r=u.bind(n);return r.listener=i,n.wrapFn=r,r}function f(e,t,i){var n=e._events;if(void 0===n)return[];var r=n[t];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]:i?function(e){for(var t=new Array(e.length),i=0;i0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var c=a[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,u=h(c,l);for(i=0;i=0;a--)if(i[a]===t||i[a].listener===t){o=i[a].listener,r=a;break}if(r<0)return this;0===r?i.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):C.call(e,t)},a.prototype.listenerCount=C,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},9645:e=>{"use strict";function t(e){if(this.size=0|e,this.size<=1||0!=(this.size&this.size-1))throw new Error("FFT size must be a power of two and bigger than 1");this._csize=e<<1;for(var t=new Array(2*this.size),i=0;ir;r<<=1)n++;this._width=n%2==0?n-1:n,this._bitrev=new Array(1<>>o&3)<>>1),n=0;n>>1]=e[n];return i},t.prototype.createComplexArray=function(){const e=new Array(this._csize);for(var t=0;t>>1],i[n+1]=0;return i},t.prototype.completeSpectrum=function(e){for(var t=this._csize,i=t>>>1,n=2;n>=2;r>=2;r>>=2){var l=(a=n/r<<1)>>>2;for(e=0;e>>1,r>>>1)}else for(e=0,t=0;e>>1,r>>>1)}var s=this._inv?-1:1,c=this.table;for(r>>=2;r>=2;r>>=2){var l=(a=n/r<<1)>>>1,u=l>>>1,d=u>>>1;for(e=0;e{t.read=function(e,t,i,n,r){var a,o,s=8*r-n-1,c=(1<>1,u=-7,d=i?r-1:0,f=i?-1:1,C=e[t+d];for(d+=f,a=C&(1<<-u)-1,C>>=-u,u+=s;u>0;a=256*a+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+e[t+d],d+=f,u-=8);if(0===a)a=1-l;else{if(a===c)return o?NaN:1/0*(C?-1:1);o+=Math.pow(2,n),a-=l}return(C?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,i,n,r,a){var o,s,c,l=8*a-r-1,u=(1<>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,C=n?0:a-1,h=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*Math.pow(2,r),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[i+C]=255&s,C+=h,s/=256,r-=8);for(o=o<0;e[i+C]=255&o,C+=h,o/=256,l-=8);e[i+C-h]|=128*p}},5733:(e,t,i)=>{var n=i(8764).Buffer,r=i(4155);e.exports=function e(t,i,n){function r(o,s){if(!i[o]){if(!t[o]){if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=i[o]={exports:{}};t[o][0].call(l.exports,(function(e){return r(t[o][1][e]||e)}),l,l.exports,e,t,i,n)}return i[o].exports}for(var a=void 0,o=0;o>2,s=(3&t)<<4|i>>4,c=1>6:64,l=2>4,i=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,n=(3&s)<<6|(c=a.indexOf(e.charAt(l++))),f[u++]=t,64!==s&&(f[u++]=i),64!==c&&(f[u++]=n);return f}},{"./support":30,"./utils":32}],2:[function(e,t,i){"use strict";var n=e("./external"),r=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function s(e,t,i,n,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=i,this.compression=n,this.compressedContent=r}s.prototype={getContentWorker:function(){var e=new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(e,t,i){return e.pipe(new a).pipe(new o("uncompressedSize")).pipe(t.compressWorker(i)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,i){"use strict";var n=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,i){"use strict";var n=e("./utils"),r=function(){for(var e,t=[],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}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==n.getTypeOf(e)?function(e,t,i,n){var a=r,o=0+i;e^=-1;for(var s=0;s>>8^a[255&(e^t[s])];return-1^e}(0|t,e,e.length):function(e,t,i,n){var a=r,o=0+i;e^=-1;for(var s=0;s>>8^a[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,i){"use strict";i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(e,t,i){"use strict";var n;n="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,i){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,r=e("pako"),a=e("./utils"),o=e("./stream/GenericWorker"),s=n?"uint8array":"array";function c(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}i.magic="\b\0",a.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},i.compressWorker=function(e){return new c("Deflate",e)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,i){"use strict";function n(e,t){var i,n="";for(i=0;i>>=8;return n}function r(e,t,i,r,o,u){var d,f,C=e.file,h=e.compression,p=u!==s.utf8encode,m=a.transformTo("string",u(C.name)),v=a.transformTo("string",s.utf8encode(C.name)),g=C.comment,b=a.transformTo("string",u(g)),M=a.transformTo("string",s.utf8encode(g)),y=v.length!==C.name.length,S=M.length!==g.length,L="",z="",w="",V=C.dir,H=C.date,k={crc32:0,compressedSize:0,uncompressedSize:0};t&&!i||(k.crc32=e.crc32,k.compressedSize=e.compressedSize,k.uncompressedSize=e.uncompressedSize);var x=0;t&&(x|=8),p||!y&&!S||(x|=2048);var _=0,A=0;V&&(_|=16),"UNIX"===o?(A=798,_|=function(e,t){var i=e;return e||(i=t?16893:33204),(65535&i)<<16}(C.unixPermissions,V)):(A=20,_|=function(e){return 63&(e||0)}(C.dosPermissions)),d=H.getUTCHours(),d<<=6,d|=H.getUTCMinutes(),d<<=5,d|=H.getUTCSeconds()/2,f=H.getUTCFullYear()-1980,f<<=4,f|=H.getUTCMonth()+1,f<<=5,f|=H.getUTCDate(),y&&(z=n(1,1)+n(c(m),4)+v,L+="up"+n(z.length,2)+z),S&&(w=n(1,1)+n(c(b),4)+M,L+="uc"+n(w.length,2)+w);var T="";return T+="\n\0",T+=n(x,2),T+=h.magic,T+=n(d,2),T+=n(f,2),T+=n(k.crc32,4),T+=n(k.compressedSize,4),T+=n(k.uncompressedSize,4),T+=n(m.length,2),T+=n(L.length,2),{fileRecord:l.LOCAL_FILE_HEADER+T+m+L,dirRecord:l.CENTRAL_FILE_HEADER+n(A,2)+T+n(b.length,2)+"\0\0\0\0"+n(_,4)+n(r,4)+m+L+b}}var a=e("../utils"),o=e("../stream/GenericWorker"),s=e("../utf8"),c=e("../crc32"),l=e("../signature");function u(e,t,i,n){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=i,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,i=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:i?(t+100*(i-n-1))/i:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var i=r(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,i=r(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(i.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+n(e.crc32,4)+n(e.compressedSize,4)+n(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:i.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)i=(i<<8)+this.byteAt(t);return this.index+=e,i},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=r},{"../utils":32}],19:[function(e,t,i){"use strict";var n=e("./Uint8ArrayReader");function r(e){n.call(this,e)}e("../utils").inherits(r,n),r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,i){"use strict";var n=e("./DataReader");function r(e){n.call(this,e)}e("../utils").inherits(r,n),r.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},r.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},r.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./DataReader":18}],21:[function(e,t,i){"use strict";var n=e("./ArrayReader");function r(e){n.call(this,e)}e("../utils").inherits(r,n),r.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,i){"use strict";var n=e("../utils"),r=e("../support"),a=e("./ArrayReader"),o=e("./StringReader"),s=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||r.uint8array?"nodebuffer"===t?new s(e):r.uint8array?new c(n.transformTo("uint8array",e)):new a(n.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,i){"use strict";i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,i){"use strict";var n=e("./GenericWorker"),r=e("../utils");function a(e){n.call(this,"ConvertWorker to "+e),this.destType=e}r.inherits(a,n),a.prototype.processChunk=function(e){this.push({data:r.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,i){"use strict";var n=e("./GenericWorker"),r=e("../crc32");function a(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,n),a.prototype.processChunk=function(e){this.streamInfo.crc32=r(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,i){"use strict";var n=e("../utils"),r=e("./GenericWorker");function a(e){r.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(a,r),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}r.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,i){"use strict";var n=e("../utils"),r=e("./GenericWorker");function a(e){r.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}n.inherits(a,r),a.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,i){"use strict";function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var i=0;i "+e:e}},t.exports=n},{}],29:[function(e,t,i){"use strict";var r=e("../utils"),a=e("./ConvertWorker"),o=e("./GenericWorker"),s=e("../base64"),c=e("../support"),l=e("../external"),u=null;if(c.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function d(e,t,i){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=t,this._mimeType=i,r.checkSupport(n),this._worker=e.pipe(new a(n)),e.lock()}catch(e){this._worker=new o("error"),this._worker.error(e)}}d.prototype={accumulate:function(e){return function(e,t){return new l.Promise((function(i,a){var o=[],c=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",(function(e,i){o.push(e),t&&t(i)})).on("error",(function(e){o=[],a(e)})).on("end",(function(){try{var e=function(e,t,i){switch(e){case"blob":return r.newBlob(r.transformTo("arraybuffer",t),i);case"base64":return s.encode(t);default:return r.transformTo(e,t)}}(l,function(e,t){var i,r=0,a=null,o=0;for(i=0;i>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t}(e)},i.utf8decode=function(e){return r.nodebuffer?n.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,i,r,a,o=e.length,c=new Array(2*o);for(t=i=0;t>10&1023,c[i++]=56320|1023&r)}return c.length!==i&&(c.subarray?c=c.subarray(0,i):c.length=i),n.applyFromCharCode(c)}(e=n.transformTo(r.uint8array?"uint8array":"array",e))},n.inherits(l,o),l.prototype.processChunk=function(e){var t=n.transformTo(r.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+s[e[i]]>t?i:t}(t),c=t;o!==t.length&&(r.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:i.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=l,n.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:i.utf8encode(e.data),meta:e.meta})},i.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,i){"use strict";var n=e("./support"),r=e("./base64"),a=e("./nodejsUtils"),o=e("./external");function s(e){return e}function c(e,t){for(var i=0;i>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,i,n,r=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(i<65536?t[o++]=224|i>>>12:(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63),t[o++]=128|i>>>6&63),t[o++]=128|63&i);return t},i.buf2binstring=function(e){return c(e,e.length)},i.binstring2buf=function(e){for(var t=new n.Buf8(e.length),i=0,r=t.length;i>10&1023,l[n++]=56320|1023&r)}return c(l,n)},i.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;0<=i&&128==(192&e[i]);)i--;return i<0||0===i?t:i+o[e[i]]>t?i:t}},{"./common":41}],43:[function(e,t,i){"use strict";t.exports=function(e,t,i,n){for(var r=65535&e|0,a=e>>>16&65535|0,o=0;0!==i;){for(i-=o=2e3>>1:e>>>1;t[i]=e}return t}();t.exports=function(e,t,i,r){var a=n,o=r+i;e^=-1;for(var s=r;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,i){"use strict";var n,r=e("../utils/common"),a=e("./trees"),o=e("./adler32"),s=e("./crc32"),c=e("./messages"),l=-2,u=258,d=262,f=113;function C(e,t){return e.msg=c[t],t}function h(e){return(e<<1)-(4e.avail_out&&(i=e.avail_out),0!==i&&(r.arraySet(e.output,t.pending_buf,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))}function v(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,m(e.strm)}function g(e,t){e.pending_buf[e.pending++]=t}function b(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function M(e,t){var i,n,r=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-d?e.strstart-(e.w_size-d):0,l=e.window,f=e.w_mask,C=e.prev,h=e.strstart+u,p=l[a+o-1],m=l[a+o];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do{if(l[(i=t)+o]===m&&l[i+o-1]===p&&l[i]===l[a]&&l[++i]===l[a+1]){a+=2,i++;do{}while(l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&ac&&0!=--r);return o<=e.lookahead?o:e.lookahead}function y(e){var t,i,n,a,c,l,u,f,C,h,p=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=p+(p-d)){for(r.arraySet(e.window,e.window,p,p,0),e.match_start-=p,e.strstart-=p,e.block_start-=p,t=i=e.hash_size;n=e.head[--t],e.head[t]=p<=n?n-p:0,--i;);for(t=i=p;n=e.prev[--t],e.prev[t]=p<=n?n-p:0,--i;);a+=p}if(0===e.strm.avail_in)break;if(l=e.strm,u=e.window,f=e.strstart+e.lookahead,h=void 0,(C=a)<(h=l.avail_in)&&(h=C),i=0===h?0:(l.avail_in-=h,r.arraySet(u,l.input,l.next_in,h,f),1===l.state.wrap?l.adler=o(l.adler,u,h,f):2===l.state.wrap&&(l.adler=s(l.adler,u,h,f)),l.next_in+=h,l.total_in+=h,h),e.lookahead+=i,e.lookahead+e.insert>=3)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3)if(n=a._tr_tally(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){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3&&e.match_length<=e.prev_length){for(r=e.strstart+e.lookahead-3,n=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=r&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(y(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+i;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,v(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-d&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(v(e,!1),e.strm.avail_out),1)})),new z(4,4,8,4,S),new z(4,5,16,8,S),new z(4,6,32,32,S),new z(4,4,16,16,L),new z(8,16,32,32,L),new z(8,16,128,128,L),new z(8,32,128,256,L),new z(32,128,258,1024,L),new z(32,258,258,4096,L)],i.deflateInit=function(e,t){return k(e,t,8,15,8,0)},i.deflateInit2=k,i.deflateReset=H,i.deflateResetKeep=V,i.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?l:(e.state.gzhead=t,0):l},i.deflate=function(e,t){var i,r,o,c;if(!e||!e.state||5>8&255),g(r,r.gzhead.time>>16&255),g(r,r.gzhead.time>>24&255),g(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),g(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(g(r,255&r.gzhead.extra.length),g(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=s(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(g(r,0),g(r,0),g(r,0),g(r,0),g(r,0),g(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),g(r,3),r.status=f);else{var d=8+(r.w_bits-8<<4)<<8;d|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(d|=32),d+=31-d%31,r.status=f,b(r,d),0!==r.strstart&&(b(r,e.adler>>>16),b(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(o=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>o&&(e.adler=s(e.adler,r.pending_buf,r.pending-o,o)),m(e),o=r.pending,r.pending!==r.pending_buf_size));)g(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>o&&(e.adler=s(e.adler,r.pending_buf,r.pending-o,o)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=s(e.adler,r.pending_buf,r.pending-o,o)),m(e),o=r.pending,r.pending===r.pending_buf_size)){c=1;break}c=r.gzindexo&&(e.adler=s(e.adler,r.pending_buf,r.pending-o,o)),0===c&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=s(e.adler,r.pending_buf,r.pending-o,o)),m(e),o=r.pending,r.pending===r.pending_buf_size)){c=1;break}c=r.gzindexo&&(e.adler=s(e.adler,r.pending_buf,r.pending-o,o)),0===c&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&m(e),r.pending+2<=r.pending_buf_size&&(g(r,255&e.adler),g(r,e.adler>>8&255),e.adler=0,r.status=f)):r.status=f),0!==r.pending){if(m(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&h(t)<=h(i)&&4!==t)return C(e,-5);if(666===r.status&&0!==e.avail_in)return C(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&666!==r.status){var M=2===r.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(y(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var i,n,r,o,s=e.window;;){if(e.lookahead<=u){if(y(e),e.lookahead<=u&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=a._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(v(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(v(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(v(e,!1),0===e.strm.avail_out)?1:2}(r,t):n[r.level].func(r,t);if(3!==M&&4!==M||(r.status=666),1===M||3===M)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===M&&(1===t?a._tr_align(r):5!==t&&(a._tr_stored_block(r,0,0,!1),3===t&&(p(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),m(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?(g(r,255&e.adler),g(r,e.adler>>8&255),g(r,e.adler>>16&255),g(r,e.adler>>24&255),g(r,255&e.total_in),g(r,e.total_in>>8&255),g(r,e.total_in>>16&255),g(r,e.total_in>>24&255)):(b(r,e.adler>>>16),b(r,65535&e.adler)),m(e),0=i.w_size&&(0===s&&(p(i.head),i.strstart=0,i.block_start=0,i.insert=0),f=new r.Buf8(i.w_size),r.arraySet(f,t,C-i.w_size,i.w_size,0),t=f,C=i.w_size),c=e.avail_in,u=e.next_in,d=e.input,e.avail_in=C,e.next_in=0,e.input=t,y(i);i.lookahead>=3;){for(n=i.strstart,a=i.lookahead-2;i.ins_h=(i.ins_h<>>=M=b>>>24,h-=M,0==(M=b>>>16&255))V[a++]=65535&b;else{if(!(16&M)){if(0==(64&M)){b=p[(65535&b)+(C&(1<>>=M,h-=M),h<15&&(C+=w[n++]<>>=M=b>>>24,h-=M,!(16&(M=b>>>16&255))){if(0==(64&M)){b=m[(65535&b)+(C&(1<>>=M,h-=M,(M=a-o)>3,C&=(1<<(h-=y<<3))-1,e.next_in=n,e.next_out=a,e.avail_in=n>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function u(){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 n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function d(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32(852),t.distcode=t.distdyn=new n.Buf32(592),t.sane=1,t.back=-1,0):c}function f(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,d(e)):c}function C(e,t){var i,n;return e&&e.state?(n=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(n.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(r<(a=o.wsize-o.wnext)&&(a=r),n.arraySet(o.window,t,i-r,a,o.wnext),(r-=a)?(n.arraySet(o.window,t,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,i.check=a(i.check,P,2,0),v=m=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&m)<<8)+(m>>8))%31){e.msg="incorrect header check",i.mode=30;break}if(8!=(15&m)){e.msg="unknown compression method",i.mode=30;break}if(v-=4,A=8+(15&(m>>>=4)),0===i.wbits)i.wbits=A;else if(A>i.wbits){e.msg="invalid window size",i.mode=30;break}i.dmax=1<>8&1),512&i.flags&&(P[0]=255&m,P[1]=m>>>8&255,i.check=a(i.check,P,2,0)),v=m=0,i.mode=3;case 3:for(;v<32;){if(0===h)break e;h--,m+=u[f++]<>>8&255,P[2]=m>>>16&255,P[3]=m>>>24&255,i.check=a(i.check,P,4,0)),v=m=0,i.mode=4;case 4:for(;v<16;){if(0===h)break e;h--,m+=u[f++]<>8),512&i.flags&&(P[0]=255&m,P[1]=m>>>8&255,i.check=a(i.check,P,2,0)),v=m=0,i.mode=5;case 5:if(1024&i.flags){for(;v<16;){if(0===h)break e;h--,m+=u[f++]<>>8&255,i.check=a(i.check,P,2,0)),v=m=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(h<(S=i.length)&&(S=h),S&&(i.head&&(A=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),n.arraySet(i.head.extra,u,f,S,A)),512&i.flags&&(i.check=a(i.check,u,S,f)),h-=S,f+=S,i.length-=S),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===h)break e;for(S=0;A=u[f+S++],i.head&&A&&i.length<65536&&(i.head.name+=String.fromCharCode(A)),A&&S>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=12;break;case 10:for(;v<32;){if(0===h)break e;h--,m+=u[f++]<>>=7&v,v-=7&v,i.mode=27;break}for(;v<3;){if(0===h)break e;h--,m+=u[f++]<>>=1)){case 0:i.mode=14;break;case 1:if(g(i),i.mode=20,6!==t)break;m>>>=2,v-=2;break e;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=30}m>>>=2,v-=2;break;case 14:for(m>>>=7&v,v-=7&v;v<32;){if(0===h)break e;h--,m+=u[f++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&m,v=m=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(S=i.length){if(h>>=5,v-=5,i.ndist=1+(31&m),m>>>=5,v-=5,i.ncode=4+(15&m),m>>>=4,v-=4,286>>=3,v-=3}for(;i.have<19;)i.lens[O[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,E={bits:i.lenbits},T=s(0,i.lens,0,19,i.lencode,0,i.work,E),i.lenbits=E.bits,T){e.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have>>16&255,H=65535&N,!((w=N>>>24)<=v);){if(0===h)break e;h--,m+=u[f++]<>>=w,v-=w,i.lens[i.have++]=H;else{if(16===H){for(I=w+2;v>>=w,v-=w,0===i.have){e.msg="invalid bit length repeat",i.mode=30;break}A=i.lens[i.have-1],S=3+(3&m),m>>>=2,v-=2}else if(17===H){for(I=w+3;v>>=w)),m>>>=3,v-=3}else{for(I=w+7;v>>=w)),m>>>=7,v-=7}if(i.have+S>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=30;break}for(;S--;)i.lens[i.have++]=A}}if(30===i.mode)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,E={bits:i.lenbits},T=s(1,i.lens,0,i.nlen,i.lencode,0,i.work,E),i.lenbits=E.bits,T){e.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,E={bits:i.distbits},T=s(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,E),i.distbits=E.bits,T){e.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(6<=h&&258<=p){e.next_out=C,e.avail_out=p,e.next_in=f,e.avail_in=h,i.hold=m,i.bits=v,o(e,y),C=e.next_out,d=e.output,p=e.avail_out,f=e.next_in,u=e.input,h=e.avail_in,m=i.hold,v=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;V=(N=i.lencode[m&(1<>>16&255,H=65535&N,!((w=N>>>24)<=v);){if(0===h)break e;h--,m+=u[f++]<>k)])>>>16&255,H=65535&N,!(k+(w=N>>>24)<=v);){if(0===h)break e;h--,m+=u[f++]<>>=k,v-=k,i.back+=k}if(m>>>=w,v-=w,i.back+=w,i.length=H,0===V){i.mode=26;break}if(32&V){i.back=-1,i.mode=12;break}if(64&V){e.msg="invalid literal/length code",i.mode=30;break}i.extra=15&V,i.mode=22;case 22:if(i.extra){for(I=i.extra;v>>=i.extra,v-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;V=(N=i.distcode[m&(1<>>16&255,H=65535&N,!((w=N>>>24)<=v);){if(0===h)break e;h--,m+=u[f++]<>k)])>>>16&255,H=65535&N,!(k+(w=N>>>24)<=v);){if(0===h)break e;h--,m+=u[f++]<>>=k,v-=k,i.back+=k}if(m>>>=w,v-=w,i.back+=w,64&V){e.msg="invalid distance code",i.mode=30;break}i.offset=H,i.extra=15&V,i.mode=24;case 24:if(i.extra){for(I=i.extra;v>>=i.extra,v-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===p)break e;if(S=y-p,i.offset>S){if((S=i.offset-S)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=30;break}L=S>i.wnext?(S-=i.wnext,i.wsize-S):i.wnext-S,S>i.length&&(S=i.length),z=i.window}else z=d,L=C-i.offset,S=i.length;for(pg?(M=O[R+d[z]],E[I+d[z]]):(M=96,0),C=1<>x)+(h-=C)]=b<<24|M<<16|y|0,0!==h;);for(C=1<>=1;if(0!==C?(T&=C-1,T+=C):T=0,z++,0==--N[L]){if(L===V)break;L=t[i+d[z]]}if(H>>7)]}function w(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function V(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<>>=1,i<<=1,0<--t;);return i>>>1}function x(e,t,i){var n,r,a=new Array(16),o=0;for(n=1;n<=c;n++)a[n]=o=o+i[n-1]<<1;for(r=0;r<=t;r++){var s=e[2*r+1];0!==s&&(e[2*r]=k(a[s]++,s))}}function _(e){var t;for(t=0;t>1;1<=i;i--)E(e,a,i);for(r=l;i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],E(e,a,1),n=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=n,a[2*r]=a[2*i]+a[2*n],e.depth[r]=(e.depth[i]>=e.depth[n]?e.depth[i]:e.depth[n])+1,a[2*i+1]=a[2*n+1]=r,e.heap[1]=r++,E(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,n,r,a,o,s,l=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,f=t.stat_desc.has_stree,C=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(a=0;a<=c;a++)e.bl_count[a]=0;for(l[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)p<(a=l[2*l[2*(n=e.heap[i])+1]+1]+1)&&(a=p,m++),l[2*n+1]=a,u>=7;n>>=1)if(1&i&&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>>3,(o=e.static_len+3+7>>>3)<=r&&(r=o)):r=o=i+5,i+4<=r&&-1!==t?D(e,t,i,n):4===e.strategy||o===r?(V(e,2+(n?1:0),3),I(e,C,h)):(V(e,4+(n?1:0),3),function(e,t,i,n){var r;for(V(e,t-257,5),V(e,i-1,5),V(e,n-4,4),r=0;r>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(m[i]+a+1)]++,e.dyn_dtree[2*z(t)]++),e.last_lit===e.lit_bufsize-1},i._tr_align=function(e){V(e,2,3),H(e,256,C),function(e){16===e.bi_valid?(w(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,i){"use strict";t.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}},{}],54:[function(e,t,n){(function(e){!function(e,t){"use strict";if(!e.setImmediate){var i,n,a,o,s=1,c={},l=!1,u=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,i="[object process]"==={}.toString.call(e.process)?function(e){r.nextTick((function(){C(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?(o="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",h,!1):e.attachEvent("onmessage",h),function(t){e.postMessage(o+t,"*")}):e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){C(e.data)},function(e){a.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(n=u.documentElement,function(e){var t=u.createElement("script");t.onreadystatechange=function(){C(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):function(e){setTimeout(C,0,e)},d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n{e.exports=function e(t,i,n){function r(o,s){if(!i[o]){if(!t[o]){if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=i[o]={exports:{}};t[o][0].call(l.exports,(function(e){return r(t[o][1][e]||e)}),l,l.exports,e,t,i,n)}return i[o].exports}for(var a=void 0,o=0;o=43)}})).catch((function(){return!1}))}(e).then((function(e){return f=e}))}function b(e){var t=C[e.name],i={};i.promise=new o((function(e,t){i.resolve=e,i.reject=t})),t.deferredOperations.push(i),t.dbReady?t.dbReady=t.dbReady.then((function(){return i.promise})):t.dbReady=i.promise}function M(e){var t=C[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function y(e,t){var i=C[e.name].deferredOperations.pop();if(i)return i.reject(t),i.promise}function S(e,t){return new o((function(i,n){if(C[e.name]=C[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return i(e.db);b(e),e.db.close()}var a=[e.name];t&&a.push(e.version);var o=r.open.apply(r,a);t&&(o.onupgradeneeded=function(t){var i=o.result;try{i.createObjectStore(e.storeName),t.oldVersion<=1&&i.createObjectStore(d)}catch(i){if("ConstraintError"!==i.name)throw i;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),n(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(e){e.target.close()},i(t),M(e)}}))}function L(e){return S(e,!1)}function z(e){return S(e,!0)}function w(e,t){if(!e.db)return!0;var i=!e.db.objectStoreNames.contains(e.storeName),n=e.versione.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),r||i){if(i){var a=e.db.version+1;a>e.version&&(e.version=a)}return!0}return!1}function V(e){return a([v(atob(e.data))],{type:e.type})}function H(e){return e&&e.__local_forage_encoded_blob}function k(e){var t=this,i=t._initReady().then((function(){var e=C[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(i,e,e),i}function x(e,t,i,n){void 0===n&&(n=1);try{var r=e.db.transaction(e.storeName,t);i(null,r)}catch(r){if(n>0&&(!e.db||"InvalidStateError"===r.name||"NotFoundError"===r.name))return o.resolve().then((function(){if(!e.db||"NotFoundError"===r.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),z(e)})).then((function(){return function(e){b(e);for(var t=C[e.name],i=t.forages,n=0;n>4,u[c++]=(15&n)<<4|r>>2,u[c++]=(3&r)<<6|63&a;return l}function J(e){var t,i=new Uint8Array(e),n="";for(t=0;t>2],n+=A[(3&i[t])<<4|i[t+1]>>4],n+=A[(15&i[t+1])<<2|i[t+2]>>6],n+=A[63&i[t+2]];return i.length%3==2?n=n.substring(0,n.length-1)+"=":i.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var Q={serialize:function(e,t){var i="";if(e&&(i=G.call(e)),e&&("[object ArrayBuffer]"===i||e.buffer&&"[object ArrayBuffer]"===G.call(e.buffer))){var n,r=E;e instanceof ArrayBuffer?(n=e,r+=N):(n=e.buffer,"[object Int8Array]"===i?r+=O:"[object Uint8Array]"===i?r+=R:"[object Uint8ClampedArray]"===i?r+=D:"[object Int16Array]"===i?r+=B:"[object Uint16Array]"===i?r+=j:"[object Int32Array]"===i?r+=F:"[object Uint32Array]"===i?r+=U:"[object Float32Array]"===i?r+=W:"[object Float64Array]"===i?r+=$:t(new Error("Failed to get type for BinaryArray"))),t(r+J(n))}else if("[object Blob]"===i){var a=new FileReader;a.onload=function(){var i="~~local_forage_type~"+e.type+"~"+J(this.result);t("__lfsc__:blob"+i)},a.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(i){console.error("Couldn't convert value into a JSON string: ",e),t(null,i)}},deserialize:function(e){if(e.substring(0,I)!==E)return JSON.parse(e);var t,i=e.substring(q),n=e.substring(I,q);if(n===P&&T.test(i)){var r=i.match(T);t=r[1],i=i.substring(r[0].length)}var o=K(i);switch(n){case N:return o;case P:return a([o],{type:t});case O:return new Int8Array(o);case R:return new Uint8Array(o);case D:return new Uint8ClampedArray(o);case B:return new Int16Array(o);case j:return new Uint16Array(o);case F:return new Int32Array(o);case U:return new Uint32Array(o);case W:return new Float32Array(o);case $:return new Float64Array(o);default:throw new Error("Unkown type: "+n)}},stringToBuffer:K,bufferToString:J};function Z(e,t,i,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,n)}function Y(e,t,i,n,r,a){e.executeSql(i,n,r,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,s){s.rows.length?a(e,o):Z(e,t,(function(){e.executeSql(i,n,r,a)}),a)}),a):a(e,o)}),a)}function X(e,t,i,n){var r=this;e=l(e);var a=new o((function(a,o){r.ready().then((function(){void 0===t&&(t=null);var s=t,c=r._dbInfo;c.serializer.serialize(t,(function(t,l){l?o(l):c.db.transaction((function(i){Y(i,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){a(s)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void a(X.apply(r,[e,s,i,n-1]));o(t)}}))}))})).catch(o)}));return s(a,i),a}function ee(e){return new o((function(t,i){e.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(i,n){for(var r=[],a=0;a0}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var i in e)t[i]=e[i];return t.keyPrefix=ie(e,this._defaultConfig),ne()?(this._dbInfo=t,t.serializer=Q,o.resolve()):o.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var i=this,n=i.ready().then((function(){for(var t=i._dbInfo,n=t.keyPrefix,r=n.length,a=localStorage.length,o=1,s=0;s=0;i--){var n=localStorage.key(i);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return s(i,e),i},length:function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},key:function(e,t){var i=this,n=i.ready().then((function(){var t,n=i._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}));return s(n,t),n},keys:function(e){var t=this,i=t.ready().then((function(){for(var e=t._dbInfo,i=localStorage.length,n=[],r=0;r=0;t--){var i=localStorage.key(t);0===i.indexOf(e)&&localStorage.removeItem(i)}})):o.reject("Invalid arguments"),s(n,t),n}},ae=function(e,t){for(var i=e.length,n=0;n{"use strict";const{Deflate:n,deflate:r,deflateRaw:a,gzip:o}=i(4555),{Inflate:s,inflate:c,inflateRaw:l,ungzip:u}=i(8843),d=i(1619);e.exports.Deflate=n,e.exports.deflate=r,e.exports.deflateRaw=a,e.exports.gzip=o,e.exports.Inflate=s,e.exports.inflate=c,e.exports.inflateRaw=l,e.exports.ungzip=u,e.exports.constants=d},4555:(e,t,i)=>{"use strict";const n=i(405),r=i(6247),a=i(9373),o=i(8898),s=i(2292),c=Object.prototype.toString,{Z_NO_FLUSH:l,Z_SYNC_FLUSH:u,Z_FULL_FLUSH:d,Z_FINISH:f,Z_OK:C,Z_STREAM_END:h,Z_DEFAULT_COMPRESSION:p,Z_DEFAULT_STRATEGY:m,Z_DEFLATED:v}=i(1619);function g(e){this.options=r.assign({level:p,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:m},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 s,this.strm.avail_out=0;let i=n.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(i!==C)throw new Error(o[i]);if(t.header&&n.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?a.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,i=n.deflateSetDictionary(this.strm,e),i!==C)throw new Error(o[i]);this._dict_set=!0}}function b(e,t){const i=new g(t);if(i.push(e,!0),i.err)throw i.msg||o[i.err];return i.result}g.prototype.push=function(e,t){const i=this.strm,r=this.options.chunkSize;let o,s;if(this.ended)return!1;for(s=t===~~t?t:!0===t?f:l,"string"==typeof e?i.input=a.string2buf(e):"[object ArrayBuffer]"===c.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(r),i.next_out=0,i.avail_out=r),(s===u||s===d)&&i.avail_out<=6)this.onData(i.output.subarray(0,i.next_out)),i.avail_out=0;else{if(o=n.deflate(i,s),o===h)return i.next_out>0&&this.onData(i.output.subarray(0,i.next_out)),o=n.deflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===C;if(0!==i.avail_out){if(s>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},g.prototype.onData=function(e){this.chunks.push(e)},g.prototype.onEnd=function(e){e===C&&(this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},e.exports.Deflate=g,e.exports.deflate=b,e.exports.deflateRaw=function(e,t){return(t=t||{}).raw=!0,b(e,t)},e.exports.gzip=function(e,t){return(t=t||{}).gzip=!0,b(e,t)},e.exports.constants=i(1619)},8843:(e,t,i)=>{"use strict";const n=i(6351),r=i(6247),a=i(9373),o=i(8898),s=i(2292),c=i(2401),l=Object.prototype.toString,{Z_NO_FLUSH:u,Z_FINISH:d,Z_OK:f,Z_STREAM_END:C,Z_NEED_DICT:h,Z_STREAM_ERROR:p,Z_DATA_ERROR:m,Z_MEM_ERROR:v}=i(1619);function g(e){this.options=r.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;let i=n.inflateInit2(this.strm,t.windowBits);if(i!==f)throw new Error(o[i]);if(this.header=new c,n.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=a.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=n.inflateSetDictionary(this.strm,t.dictionary),i!==f)))throw new Error(o[i])}function b(e,t){const i=new g(t);if(i.push(e),i.err)throw i.msg||o[i.err];return i.result}g.prototype.push=function(e,t){const i=this.strm,r=this.options.chunkSize,o=this.options.dictionary;let s,c,g;if(this.ended)return!1;for(c=t===~~t?t:!0===t?d:u,"[object ArrayBuffer]"===l.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(r),i.next_out=0,i.avail_out=r),s=n.inflate(i,c),s===h&&o&&(s=n.inflateSetDictionary(i,o),s===f?s=n.inflate(i,c):s===m&&(s=h));i.avail_in>0&&s===C&&i.state.wrap>0&&0!==e[i.next_in];)n.inflateReset(i),s=n.inflate(i,c);switch(s){case p:case m:case h:case v:return this.onEnd(s),this.ended=!0,!1}if(g=i.avail_out,i.next_out&&(0===i.avail_out||s===C))if("string"===this.options.to){let e=a.utf8border(i.output,i.next_out),t=i.next_out-e,n=a.buf2string(i.output,e);i.next_out=t,i.avail_out=r-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));if(s!==f||0!==g){if(s===C)return s=n.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===i.avail_in)break}}return!0},g.prototype.onData=function(e){this.chunks.push(e)},g.prototype.onEnd=function(e){e===f&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},e.exports.Inflate=g,e.exports.inflate=b,e.exports.inflateRaw=function(e,t){return(t=t||{}).raw=!0,b(e,t)},e.exports.ungzip=b,e.exports.constants=i(1619)},6247: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 i=0,n=e.length;i{"use strict";let t=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){t=!1}const i=new Uint8Array(256);for(let e=0;e<256;e++)i[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;i[254]=i[254]=1,e.exports.string2buf=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,i,n,r,a,o=e.length,s=0;for(r=0;r>>6,t[a++]=128|63&i):i<65536?(t[a++]=224|i>>>12,t[a++]=128|i>>>6&63,t[a++]=128|63&i):(t[a++]=240|i>>>18,t[a++]=128|i>>>12&63,t[a++]=128|i>>>6&63,t[a++]=128|63&i);return t},e.exports.buf2string=(e,n)=>{const r=n||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,n));let a,o;const s=new Array(2*r);for(o=0,a=0;a4)s[o++]=65533,a+=n-1;else{for(t&=2===n?31:3===n?15:7;n>1&&a1?s[o++]=65533:t<65536?s[o++]=t:(t-=65536,s[o++]=55296|t>>10&1023,s[o++]=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{(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}},6069:e=>{"use strict";e.exports=(e,t,i,n)=>{let r=65535&e|0,a=e>>>16&65535|0,o=0;for(;0!==i;){o=i>2e3?2e3:i,i-=o;do{r=r+t[n++]|0,a=a+r|0}while(--o);r%=65521,a%=65521}return r|a<<16|0}},1619: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: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,r)=>{const a=t,o=r+n;e^=-1;for(let t=r;t>>8^a[255&(e^i[t])];return-1^e}},405:(e,t,i)=>{"use strict";const{_tr_init:n,_tr_stored_block:r,_tr_flush_block:a,_tr_tally:o,_tr_align:s}=i(342),c=i(6069),l=i(2869),u=i(8898),{Z_NO_FLUSH:d,Z_PARTIAL_FLUSH:f,Z_FULL_FLUSH:C,Z_FINISH:h,Z_BLOCK:p,Z_OK:m,Z_STREAM_END:v,Z_STREAM_ERROR:g,Z_DATA_ERROR:b,Z_BUF_ERROR:M,Z_DEFAULT_COMPRESSION:y,Z_FILTERED:S,Z_HUFFMAN_ONLY:L,Z_RLE:z,Z_FIXED:w,Z_DEFAULT_STRATEGY:V,Z_UNKNOWN:H,Z_DEFLATED:k}=i(1619),x=258,_=262,A=103,T=113,E=666,I=(e,t)=>(e.msg=u[t],t),N=e=>(e<<1)-(e>4?9:0),P=e=>{let t=e.length;for(;--t>=0;)e[t]=0};let O=(e,t,i)=>(t<{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))},D=(e,t)=>{a(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,R(e.strm)},B=(e,t)=>{e.pending_buf[e.pending++]=t},F=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},j=(e,t,i,n)=>{let r=e.avail_in;return r>n&&(r=n),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),i),1===e.state.wrap?e.adler=c(e.adler,t,r,i):2===e.state.wrap&&(e.adler=l(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)},U=(e,t)=>{let i,n,r=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+x;let C=l[a+o-1],h=l[a+o];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do{if(i=t,l[i+o]===h&&l[i+o-1]===C&&l[i]===l[a]&&l[++i]===l[a+1]){a+=2,i++;do{}while(l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&l[++a]===l[++i]&&ao){if(e.match_start=t,o=n,n>=s)break;C=l[a+o-1],h=l[a+o]}}}while((t=d[t&u])>c&&0!=--r);return o<=e.lookahead?o:e.lookahead},W=e=>{const t=e.w_size;let i,n,r,a,o;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-_)){e.window.set(e.window.subarray(t,t+t),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,i=n;do{r=e.head[--i],e.head[i]=r>=t?r-t:0}while(--n);n=t,i=n;do{r=e.prev[--i],e.prev[i]=r>=t?r-t:0}while(--n);a+=t}if(0===e.strm.avail_in)break;if(n=j(e.strm,e.window,e.strstart+e.lookahead,a),e.lookahead+=n,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=O(e,e.ins_h,e.window[o+1]);e.insert&&(e.ins_h=O(e,e.ins_h,e.window[o+3-1]),e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<_&&0!==e.strm.avail_in)},$=(e,t)=>{let i,n;for(;;){if(e.lookahead<_){if(W(e),e.lookahead<_&&t===d)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=O(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-_&&(e.match_length=U(e,i)),e.match_length>=3)if(n=o(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=O(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=O(e,e.ins_h,e.window[e.strstart+1]);else n=o(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(D(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===h?(D(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(D(e,!1),0===e.strm.avail_out)?1:2},q=(e,t)=>{let i,n,r;for(;;){if(e.lookahead<_){if(W(e),e.lookahead<_&&t===d)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=O(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,n=o(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=r&&(e.ins_h=O(e,e.ins_h,e.window[e.strstart+3-1]),i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(D(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=o(e,0,e.window[e.strstart-1]),n&&D(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=o(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===h?(D(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(D(e,!1),0===e.strm.avail_out)?1:2};function G(e,t,i,n,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=n,this.func=r}const K=[new G(0,0,0,0,((e,t)=>{let i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(W(e),0===e.lookahead&&t===d)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;const n=e.block_start+i;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,D(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-_&&(D(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===h?(D(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(D(e,!1),e.strm.avail_out),1)})),new G(4,4,8,4,$),new G(4,5,16,8,$),new G(4,6,32,32,$),new G(4,4,16,16,q),new G(8,16,32,32,q),new G(8,16,128,128,q),new G(8,32,128,256,q),new G(32,128,258,1024,q),new G(32,258,258,4096,q)];function J(){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=k,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),P(this.dyn_ltree),P(this.dyn_dtree),P(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),P(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),P(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Q=e=>{if(!e||!e.state)return I(e,g);e.total_in=e.total_out=0,e.data_type=H;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:T,e.adler=2===t.wrap?0:1,t.last_flush=d,n(t),m},Z=e=>{const t=Q(e);var i;return t===m&&((i=e.state).window_size=2*i.w_size,P(i.head),i.max_lazy_match=K[i.level].max_lazy,i.good_match=K[i.level].good_length,i.nice_match=K[i.level].nice_length,i.max_chain_length=K[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},Y=(e,t,i,n,r,a)=>{if(!e)return g;let o=1;if(t===y&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),r<1||r>9||i!==k||n<8||n>15||t<0||t>9||a<0||a>w)return I(e,g);8===n&&(n=9);const s=new J;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<Y(e,t,k,15,8,V),e.exports.deflateInit2=Y,e.exports.deflateReset=Z,e.exports.deflateResetKeep=Q,e.exports.deflateSetHeader=(e,t)=>e&&e.state?2!==e.state.wrap?g:(e.state.gzhead=t,m):g,e.exports.deflate=(e,t)=>{let i,n;if(!e||!e.state||t>p||t<0)return e?I(e,g):g;const a=e.state;if(!e.output||!e.input&&0!==e.avail_in||a.status===E&&t!==h)return I(e,0===e.avail_out?M:g);a.strm=e;const c=a.last_flush;if(a.last_flush=t,42===a.status)if(2===a.wrap)e.adler=0,B(a,31),B(a,139),B(a,8),a.gzhead?(B(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),B(a,255&a.gzhead.time),B(a,a.gzhead.time>>8&255),B(a,a.gzhead.time>>16&255),B(a,a.gzhead.time>>24&255),B(a,9===a.level?2:a.strategy>=L||a.level<2?4:0),B(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(B(a,255&a.gzhead.extra.length),B(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=l(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69):(B(a,0),B(a,0),B(a,0),B(a,0),B(a,0),B(a,9===a.level?2:a.strategy>=L||a.level<2?4:0),B(a,3),a.status=T);else{let t=k+(a.w_bits-8<<4)<<8,i=-1;i=a.strategy>=L||a.level<2?0:a.level<6?1:6===a.level?2:3,t|=i<<6,0!==a.strstart&&(t|=32),t+=31-t%31,a.status=T,F(a,t),0!==a.strstart&&(F(a,e.adler>>>16),F(a,65535&e.adler)),e.adler=1}if(69===a.status)if(a.gzhead.extra){for(i=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>i&&(e.adler=l(e.adler,a.pending_buf,a.pending-i,i)),R(e),i=a.pending,a.pending!==a.pending_buf_size));)B(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>i&&(e.adler=l(e.adler,a.pending_buf,a.pending-i,i)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=73)}else a.status=73;if(73===a.status)if(a.gzhead.name){i=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=l(e.adler,a.pending_buf,a.pending-i,i)),R(e),i=a.pending,a.pending===a.pending_buf_size)){n=1;break}n=a.gzindexi&&(e.adler=l(e.adler,a.pending_buf,a.pending-i,i)),0===n&&(a.gzindex=0,a.status=91)}else a.status=91;if(91===a.status)if(a.gzhead.comment){i=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=l(e.adler,a.pending_buf,a.pending-i,i)),R(e),i=a.pending,a.pending===a.pending_buf_size)){n=1;break}n=a.gzindexi&&(e.adler=l(e.adler,a.pending_buf,a.pending-i,i)),0===n&&(a.status=A)}else a.status=A;if(a.status===A&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&R(e),a.pending+2<=a.pending_buf_size&&(B(a,255&e.adler),B(a,e.adler>>8&255),e.adler=0,a.status=T)):a.status=T),0!==a.pending){if(R(e),0===e.avail_out)return a.last_flush=-1,m}else if(0===e.avail_in&&N(t)<=N(c)&&t!==h)return I(e,M);if(a.status===E&&0!==e.avail_in)return I(e,M);if(0!==e.avail_in||0!==a.lookahead||t!==d&&a.status!==E){let i=a.strategy===L?((e,t)=>{let i;for(;;){if(0===e.lookahead&&(W(e),0===e.lookahead)){if(t===d)return 1;break}if(e.match_length=0,i=o(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(D(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===h?(D(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(D(e,!1),0===e.strm.avail_out)?1:2})(a,t):a.strategy===z?((e,t)=>{let i,n,r,a;const s=e.window;for(;;){if(e.lookahead<=x){if(W(e),e.lookahead<=x&&t===d)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,n=s[r],n===s[++r]&&n===s[++r]&&n===s[++r])){a=e.strstart+x;do{}while(n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&re.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=o(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=o(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(D(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===h?(D(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(D(e,!1),0===e.strm.avail_out)?1:2})(a,t):K[a.level].func(a,t);if(3!==i&&4!==i||(a.status=E),1===i||3===i)return 0===e.avail_out&&(a.last_flush=-1),m;if(2===i&&(t===f?s(a):t!==p&&(r(a,0,0,!1),t===C&&(P(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),R(e),0===e.avail_out))return a.last_flush=-1,m}return t!==h?m:a.wrap<=0?v:(2===a.wrap?(B(a,255&e.adler),B(a,e.adler>>8&255),B(a,e.adler>>16&255),B(a,e.adler>>24&255),B(a,255&e.total_in),B(a,e.total_in>>8&255),B(a,e.total_in>>16&255),B(a,e.total_in>>24&255)):(F(a,e.adler>>>16),F(a,65535&e.adler)),R(e),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?m:v)},e.exports.deflateEnd=e=>{if(!e||!e.state)return g;const t=e.state.status;return 42!==t&&69!==t&&73!==t&&91!==t&&t!==A&&t!==T&&t!==E?I(e,g):(e.state=null,t===T?I(e,b):m)},e.exports.deflateSetDictionary=(e,t)=>{let i=t.length;if(!e||!e.state)return g;const n=e.state,r=n.wrap;if(2===r||1===r&&42!==n.status||n.lookahead)return g;if(1===r&&(e.adler=c(e.adler,t,i,0)),n.wrap=0,i>=n.w_size){0===r&&(P(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 a=e.avail_in,o=e.next_in,s=e.input;for(e.avail_in=i,e.next_in=0,e.input=t,W(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=O(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++}while(--t);n.strstart=e,n.lookahead=2,W(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=o,e.input=s,e.avail_in=a,n.wrap=r,m},e.exports.deflateInfo="pako deflate (from Nodeca project)"},2401: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}},4264:e=>{"use strict";e.exports=function(e,t){let i,n,r,a,o,s,c,l,u,d,f,C,h,p,m,v,g,b,M,y,S,L,z,w;const V=e.state;i=e.next_in,z=e.input,n=i+(e.avail_in-5),r=e.next_out,w=e.output,a=r-(t-e.avail_out),o=r+(e.avail_out-257),s=V.dmax,c=V.wsize,l=V.whave,u=V.wnext,d=V.window,f=V.hold,C=V.bits,h=V.lencode,p=V.distcode,m=(1<>>24,f>>>=b,C-=b,b=g>>>16&255,0===b)w[r++]=65535&g;else{if(!(16&b)){if(0==(64&b)){g=h[(65535&g)+(f&(1<>>=b,C-=b),C<15&&(f+=z[i++]<>>24,f>>>=b,C-=b,b=g>>>16&255,!(16&b)){if(0==(64&b)){g=p[(65535&g)+(f&(1<s){e.msg="invalid distance too far back",V.mode=30;break e}if(f>>>=b,C-=b,b=r-a,y>b){if(b=y-b,b>l&&V.sane){e.msg="invalid distance too far back",V.mode=30;break e}if(S=0,L=d,0===u){if(S+=c-b,b2;)w[r++]=L[S++],w[r++]=L[S++],w[r++]=L[S++],M-=3;M&&(w[r++]=L[S++],M>1&&(w[r++]=L[S++]))}else{S=r-y;do{w[r++]=w[S++],w[r++]=w[S++],w[r++]=w[S++],M-=3}while(M>2);M&&(w[r++]=w[S++],M>1&&(w[r++]=w[S++]))}break}}break}}while(i>3,i-=M,C-=M<<3,f&=(1<{"use strict";const n=i(6069),r=i(2869),a=i(4264),o=i(9241),{Z_FINISH:s,Z_BLOCK:c,Z_TREES:l,Z_OK:u,Z_STREAM_END:d,Z_NEED_DICT:f,Z_STREAM_ERROR:C,Z_DATA_ERROR:h,Z_MEM_ERROR:p,Z_BUF_ERROR:m,Z_DEFLATED:v}=i(1619),g=12,b=30,M=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function y(){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 S=e=>{if(!e||!e.state)return C;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=1,t.last=0,t.havedict=0,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,u},L=e=>{if(!e||!e.state)return C;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,S(e)},z=(e,t)=>{let i;if(!e||!e.state)return C;const n=e.state;return t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?C:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,L(e))},w=(e,t)=>{if(!e)return C;const i=new y;e.state=i,i.window=null;const n=z(e,t);return n!==u&&(e.state=null),n};let V,H,k=!0;const x=e=>{if(k){V=new Int32Array(512),H=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(o(1,e.lens,0,288,V,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;o(2,e.lens,0,32,H,0,e.work,{bits:5}),k=!1}e.lencode=V,e.lenbits=9,e.distcode=H,e.distbits=5},_=(e,t,i,n)=>{let r;const a=e.state;return null===a.window&&(a.wsize=1<=a.wsize?(a.window.set(t.subarray(i-a.wsize,i),0),a.wnext=0,a.whave=a.wsize):(r=a.wsize-a.wnext,r>n&&(r=n),a.window.set(t.subarray(i-n,i-n+r),a.wnext),(n-=r)?(a.window.set(t.subarray(i-n,i),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=r,a.wnext===a.wsize&&(a.wnext=0),a.whavew(e,15),e.exports.inflateInit2=w,e.exports.inflate=(e,t)=>{let i,y,S,L,z,w,V,H,k,A,T,E,I,N,P,O,R,D,B,F,j,U,W=0;const $=new Uint8Array(4);let q,G;const K=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return C;i=e.state,i.mode===g&&(i.mode=13),z=e.next_out,S=e.output,V=e.avail_out,L=e.next_in,y=e.input,w=e.avail_in,H=i.hold,k=i.bits,A=w,T=V,U=u;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;k<16;){if(0===w)break e;w--,H+=y[L++]<>>8&255,i.check=r(i.check,$,2,0),H=0,k=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&H)<<8)+(H>>8))%31){e.msg="incorrect header check",i.mode=b;break}if((15&H)!==v){e.msg="unknown compression method",i.mode=b;break}if(H>>>=4,k-=4,j=8+(15&H),0===i.wbits)i.wbits=j;else if(j>i.wbits){e.msg="invalid window size",i.mode=b;break}i.dmax=1<>8&1),512&i.flags&&($[0]=255&H,$[1]=H>>>8&255,i.check=r(i.check,$,2,0)),H=0,k=0,i.mode=3;case 3:for(;k<32;){if(0===w)break e;w--,H+=y[L++]<>>8&255,$[2]=H>>>16&255,$[3]=H>>>24&255,i.check=r(i.check,$,4,0)),H=0,k=0,i.mode=4;case 4:for(;k<16;){if(0===w)break e;w--,H+=y[L++]<>8),512&i.flags&&($[0]=255&H,$[1]=H>>>8&255,i.check=r(i.check,$,2,0)),H=0,k=0,i.mode=5;case 5:if(1024&i.flags){for(;k<16;){if(0===w)break e;w--,H+=y[L++]<>>8&255,i.check=r(i.check,$,2,0)),H=0,k=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(E=i.length,E>w&&(E=w),E&&(i.head&&(j=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Uint8Array(i.head.extra_len)),i.head.extra.set(y.subarray(L,L+E),j)),512&i.flags&&(i.check=r(i.check,y,E,L)),w-=E,L+=E,i.length-=E),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===w)break e;E=0;do{j=y[L+E++],i.head&&j&&i.length<65536&&(i.head.name+=String.fromCharCode(j))}while(j&&E>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=g;break;case 10:for(;k<32;){if(0===w)break e;w--,H+=y[L++]<>>=7&k,k-=7&k,i.mode=27;break}for(;k<3;){if(0===w)break e;w--,H+=y[L++]<>>=1,k-=1,3&H){case 0:i.mode=14;break;case 1:if(x(i),i.mode=20,t===l){H>>>=2,k-=2;break e}break;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=b}H>>>=2,k-=2;break;case 14:for(H>>>=7&k,k-=7&k;k<32;){if(0===w)break e;w--,H+=y[L++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=b;break}if(i.length=65535&H,H=0,k=0,i.mode=15,t===l)break e;case 15:i.mode=16;case 16:if(E=i.length,E){if(E>w&&(E=w),E>V&&(E=V),0===E)break e;S.set(y.subarray(L,L+E),z),w-=E,L+=E,V-=E,z+=E,i.length-=E;break}i.mode=g;break;case 17:for(;k<14;){if(0===w)break e;w--,H+=y[L++]<>>=5,k-=5,i.ndist=1+(31&H),H>>>=5,k-=5,i.ncode=4+(15&H),H>>>=4,k-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=b;break}i.have=0,i.mode=18;case 18:for(;i.have>>=3,k-=3}for(;i.have<19;)i.lens[K[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,q={bits:i.lenbits},U=o(0,i.lens,0,19,i.lencode,0,i.work,q),i.lenbits=q.bits,U){e.msg="invalid code lengths set",i.mode=b;break}i.have=0,i.mode=19;case 19:for(;i.have>>24,O=W>>>16&255,R=65535&W,!(P<=k);){if(0===w)break e;w--,H+=y[L++]<>>=P,k-=P,i.lens[i.have++]=R;else{if(16===R){for(G=P+2;k>>=P,k-=P,0===i.have){e.msg="invalid bit length repeat",i.mode=b;break}j=i.lens[i.have-1],E=3+(3&H),H>>>=2,k-=2}else if(17===R){for(G=P+3;k>>=P,k-=P,j=0,E=3+(7&H),H>>>=3,k-=3}else{for(G=P+7;k>>=P,k-=P,j=0,E=11+(127&H),H>>>=7,k-=7}if(i.have+E>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=b;break}for(;E--;)i.lens[i.have++]=j}}if(i.mode===b)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=b;break}if(i.lenbits=9,q={bits:i.lenbits},U=o(1,i.lens,0,i.nlen,i.lencode,0,i.work,q),i.lenbits=q.bits,U){e.msg="invalid literal/lengths set",i.mode=b;break}if(i.distbits=6,i.distcode=i.distdyn,q={bits:i.distbits},U=o(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,q),i.distbits=q.bits,U){e.msg="invalid distances set",i.mode=b;break}if(i.mode=20,t===l)break e;case 20:i.mode=21;case 21:if(w>=6&&V>=258){e.next_out=z,e.avail_out=V,e.next_in=L,e.avail_in=w,i.hold=H,i.bits=k,a(e,T),z=e.next_out,S=e.output,V=e.avail_out,L=e.next_in,y=e.input,w=e.avail_in,H=i.hold,k=i.bits,i.mode===g&&(i.back=-1);break}for(i.back=0;W=i.lencode[H&(1<>>24,O=W>>>16&255,R=65535&W,!(P<=k);){if(0===w)break e;w--,H+=y[L++]<>D)],P=W>>>24,O=W>>>16&255,R=65535&W,!(D+P<=k);){if(0===w)break e;w--,H+=y[L++]<>>=D,k-=D,i.back+=D}if(H>>>=P,k-=P,i.back+=P,i.length=R,0===O){i.mode=26;break}if(32&O){i.back=-1,i.mode=g;break}if(64&O){e.msg="invalid literal/length code",i.mode=b;break}i.extra=15&O,i.mode=22;case 22:if(i.extra){for(G=i.extra;k>>=i.extra,k-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;W=i.distcode[H&(1<>>24,O=W>>>16&255,R=65535&W,!(P<=k);){if(0===w)break e;w--,H+=y[L++]<>D)],P=W>>>24,O=W>>>16&255,R=65535&W,!(D+P<=k);){if(0===w)break e;w--,H+=y[L++]<>>=D,k-=D,i.back+=D}if(H>>>=P,k-=P,i.back+=P,64&O){e.msg="invalid distance code",i.mode=b;break}i.offset=R,i.extra=15&O,i.mode=24;case 24:if(i.extra){for(G=i.extra;k>>=i.extra,k-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=b;break}i.mode=25;case 25:if(0===V)break e;if(E=T-V,i.offset>E){if(E=i.offset-E,E>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=b;break}E>i.wnext?(E-=i.wnext,I=i.wsize-E):I=i.wnext-E,E>i.length&&(E=i.length),N=i.window}else N=S,I=z-i.offset,E=i.length;E>V&&(E=V),V-=E,i.length-=E;do{S[z++]=N[I++]}while(--E);0===i.length&&(i.mode=21);break;case 26:if(0===V)break e;S[z++]=i.length,V--,i.mode=21;break;case 27:if(i.wrap){for(;k<32;){if(0===w)break e;w--,H|=y[L++]<{if(!e||!e.state)return C;let t=e.state;return t.window&&(t.window=null),e.state=null,u},e.exports.inflateGetHeader=(e,t)=>{if(!e||!e.state)return C;const i=e.state;return 0==(2&i.wrap)?C:(i.head=t,t.done=!1,u)},e.exports.inflateSetDictionary=(e,t)=>{const i=t.length;let r,a,o;return e&&e.state?(r=e.state,0!==r.wrap&&11!==r.mode?C:11===r.mode&&(a=1,a=n(a,t,i,0),a!==r.check)?h:(o=_(e,t,i,i),o?(r.mode=31,p):(r.havedict=1,u))):C},e.exports.inflateInfo="pako inflate (from Nodeca project)"},9241:e=>{"use strict";const t=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]),i=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),n=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]),r=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,a,o,s,c,l,u,d)=>{const f=d.bits;let C,h,p,m,v,g,b=0,M=0,y=0,S=0,L=0,z=0,w=0,V=0,H=0,k=0,x=null,_=0;const A=new Uint16Array(16),T=new Uint16Array(16);let E,I,N,P=null,O=0;for(b=0;b<=15;b++)A[b]=0;for(M=0;M=1&&0===A[S];S--);if(L>S&&(L=S),0===S)return c[l++]=20971520,c[l++]=20971520,d.bits=1,0;for(y=1;y0&&(0===e||1!==S))return-1;for(T[1]=0,b=1;b<15;b++)T[b+1]=T[b]+A[b];for(M=0;M852||2===e&&H>592)return 1;for(;;){E=b-w,u[M]g?(I=P[O+u[M]],N=x[_+u[M]]):(I=96,N=0),C=1<>w)+h]=E<<24|I<<16|N|0}while(0!==h);for(C=1<>=1;if(0!==C?(k&=C-1,k+=C):k=0,M++,0==--A[b]){if(b===S)break;b=a[o+u[M]]}if(b>L&&(k&m)!==p){for(0===w&&(w=L),v+=y,z=b-w,V=1<852||2===e&&H>592)return 1;p=k&m,c[p]=L<<24|z<<16|v-l|0}}return 0!==k&&(c[v+k]=b-w<<24|64<<16|0),d.bits=L,0}},8898: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"}},342:e=>{"use strict";function t(e){let t=e.length;for(;--t>=0;)e[t]=0}const i=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]),n=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]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),a=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=new Array(576);t(o);const s=new Array(60);t(s);const c=new Array(512);t(c);const l=new Array(256);t(l);const u=new Array(29);t(u);const d=new Array(30);function f(e,t,i,n,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=n,this.max_length=r,this.has_stree=e&&e.length}let C,h,p;function m(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(d);const v=e=>e<256?c[e]:c[256+(e>>>7)],g=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},b=(e,t,i)=>{e.bi_valid>16-i?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<{b(e,i[2*t],i[2*t+1])},y=(e,t)=>{let i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1},S=(e,t,i)=>{const n=new Array(16);let r,a,o=0;for(r=1;r<=15;r++)n[r]=o=o+i[r-1]<<1;for(a=0;a<=t;a++){let t=e[2*a+1];0!==t&&(e[2*a]=y(n[t]++,t))}},L=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;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.last_lit=e.matches=0},z=e=>{e.bi_valid>8?g(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},w=(e,t,i,n)=>{const r=2*t,a=2*i;return e[r]{const n=e.heap[i];let r=i<<1;for(;r<=e.heap_len&&(r{let a,o,s,c,f=0;if(0!==e.last_lit)do{a=e.pending_buf[e.d_buf+2*f]<<8|e.pending_buf[e.d_buf+2*f+1],o=e.pending_buf[e.l_buf+f],f++,0===a?M(e,o,t):(s=l[o],M(e,s+256+1,t),c=i[s],0!==c&&(o-=u[s],b(e,o,c)),a--,s=v(a),M(e,s,r),c=n[s],0!==c&&(a-=d[s],b(e,a,c)))}while(f{const i=t.dyn_tree,n=t.stat_desc.static_tree,r=t.stat_desc.has_stree,a=t.stat_desc.elems;let o,s,c,l=-1;for(e.heap_len=0,e.heap_max=573,o=0;o>1;o>=1;o--)V(e,i,o);c=a;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],V(e,i,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,i[2*c]=i[2*o]+i[2*s],e.depth[c]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,i[2*o+1]=i[2*s+1]=c,e.heap[1]=c++,V(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,r=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length;let l,u,d,f,C,h,p=0;for(f=0;f<=15;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,p++),i[2*u+1]=f,u>n||(e.bl_count[f]++,C=0,u>=s&&(C=o[u-s]),h=i[2*u],e.opt_len+=h*(f+C),a&&(e.static_len+=h*(r[2*u+1]+C)));if(0!==p){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]--,p-=2}while(p>0);for(f=c;0!==f;f--)for(u=e.bl_count[f];0!==u;)d=e.heap[--l],d>n||(i[2*d+1]!==f&&(e.opt_len+=(f-i[2*d+1])*i[2*d],i[2*d+1]=f),u--)}})(e,t),S(i,l,e.bl_count)},x=(e,t,i)=>{let n,r,a=-1,o=t[1],s=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(i+1)+1]=65535,n=0;n<=i;n++)r=o,o=t[2*(n+1)+1],++s{let n,r,a=-1,o=t[1],s=0,c=7,l=4;for(0===o&&(c=138,l=3),n=0;n<=i;n++)if(r=o,o=t[2*(n+1)+1],!(++s{b(e,0+(n?1:0),3),((e,t,i,n)=>{z(e),g(e,i),g(e,~i),e.pending_buf.set(e.window.subarray(t,t+i),e.pending),e.pending+=i})(e,t,i)};e.exports._tr_init=e=>{A||((()=>{let e,t,a,m,v;const g=new Array(16);for(a=0,m=0;m<28;m++)for(u[m]=a,e=0;e<1<>=7;m<30;m++)for(d[m]=v<<7,e=0;e<1<{let r,c,l=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&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<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),k(e,e.l_desc),k(e,e.d_desc),l=(e=>{let t;for(x(e,e.dyn_ltree,e.l_desc.max_code),x(e,e.dyn_dtree,e.d_desc.max_code),k(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*a[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,c=e.static_len+3+7>>>3,c<=r&&(r=c)):r=c=i+5,i+4<=r&&-1!==t?T(e,t,i,n):4===e.strategy||c===r?(b(e,2+(n?1:0),3),H(e,o,s)):(b(e,4+(n?1:0),3),((e,t,i,n)=>{let r;for(b(e,t-257,5),b(e,i-1,5),b(e,n-4,4),r=0;r(e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(l[i]+256+1)]++,e.dyn_dtree[2*v(t)]++),e.last_lit===e.lit_bufsize-1),e.exports._tr_align=e=>{b(e,2,3),M(e,256,o),(e=>{16===e.bi_valid?(g(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)}},2292: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}},4155:e=>{var t,i,n=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(i){try{return t.call(null,e,0)}catch(i){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var s,c=[],l=!1,u=-1;function d(){l&&s&&(l=!1,s.length?c=s.concat(c):u=-1,c.length&&f())}function f(){if(!l){var e=o(d);l=!0;for(var t=c.length;t;){for(s=c,c=[];++u1)for(var i=1;i{"use strict";var n=i(414);function r(){}function a(){}a.resetWarningCache=r,e.exports=function(){function e(e,t,i,r,a,o){if(o!==n){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var i={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:r};return i.PropTypes=i,i}},5697:(e,t,i)=>{e.exports=i(2703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},2100:(e,t,i)=>{"use strict";e.exports=i(9482)},9482:(e,t,i)=>{"use strict";var n=t;function r(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=i(1173),n.BufferWriter=i(3155),n.Reader=i(1408),n.BufferReader=i(593),n.util=i(9693),n.rpc=i(5994),n.roots=i(5054),n.configure=r,r()},1408:(e,t,i)=>{"use strict";e.exports=c;var n,r=i(9693),a=r.LongBits,o=r.utf8;function s(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},d=function(){return r.Buffer?function(e){return(c.create=function(e){return r.Buffer.isBuffer(e)?new n(e):u(e)})(e)}:u};function f(){var e=new a(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw s(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 s(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 C(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 s(this,8);return new a(C(this.buf,this.pos+=4),C(this.buf,this.pos+=4))}c.create=d(),c.prototype._slice=r.Array.prototype.subarray||r.Array.prototype.slice,c.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,s(this,10);return l}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return C(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|C(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var e=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var e=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw s(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)},c.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw s(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},c.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},c._configure=function(e){n=e,c.create=d(),n._configure();var t=r.Long?"toLong":"toNumber";r.merge(c.prototype,{int64:function(){return f.call(this)[t](!1)},uint64:function(){return f.call(this)[t](!0)},sint64:function(){return f.call(this).zzDecode()[t](!1)},fixed64:function(){return h.call(this)[t](!0)},sfixed64:function(){return h.call(this)[t](!1)}})}},593:(e,t,i)=>{"use strict";e.exports=a;var n=i(1408);(a.prototype=Object.create(n.prototype)).constructor=a;var r=i(9693);function a(e){n.call(this,e)}a._configure=function(){r.Buffer&&(a.prototype._slice=r.Buffer.prototype.slice)},a.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},a._configure()},5054:e=>{"use strict";e.exports={}},5994:(e,t,i)=>{"use strict";t.Service=i(7948)},7948:(e,t,i)=>{"use strict";e.exports=r;var n=i(9693);function r(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)}(r.prototype=Object.create(n.EventEmitter.prototype)).constructor=r,r.prototype.rpcCall=function e(t,i,r,a,o){if(!a)throw TypeError("request must be specified");var s=this;if(!o)return n.asPromise(e,s,t,i,r,a);if(s.rpcImpl)try{return s.rpcImpl(t,i[s.requestDelimited?"encodeDelimited":"encode"](a).finish(),(function(e,i){if(e)return s.emit("error",e,t),o(e);if(null!==i){if(!(i instanceof r))try{i=r[s.responseDelimited?"decodeDelimited":"decode"](i)}catch(e){return s.emit("error",e,t),o(e)}return s.emit("data",i,t),o(null,i)}s.end(!0)}))}catch(e){return s.emit("error",e,t),void setTimeout((function(){o(e)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},r.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(e,t,i)=>{"use strict";e.exports=r;var n=i(9693);function r(e,t){this.lo=e>>>0,this.hi=t>>>0}var a=r.zero=new r(0,0);a.toNumber=function(){return 0},a.zzEncode=a.zzDecode=function(){return this},a.length=function(){return 1};var o=r.zeroHash="\0\0\0\0\0\0\0\0";r.fromNumber=function(e){if(0===e)return a;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 r(i,n)},r.from=function(e){if("number"==typeof e)return r.fromNumber(e);if(n.isString(e)){if(!n.Long)return r.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new r(e.low>>>0,e.high>>>0):a},r.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},r.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 s=String.prototype.charCodeAt;r.fromHash=function(e){return e===o?a:new r((s.call(e,0)|s.call(e,1)<<8|s.call(e,2)<<16|s.call(e,3)<<24)>>>0,(s.call(e,4)|s.call(e,5)<<8|s.call(e,6)<<16|s.call(e,7)<<24)>>>0)},r.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)},r.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},r.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},r.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}},9693:function(e,t,i){"use strict";var n=t;function r(e,t,i){for(var n=Object.keys(t),r=0;r0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var i=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))},n.merge=r,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=a,n.ProtocolError=a("ProtocolError"),n.oneOfGetter=function(e){for(var t={},i=0;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{"use strict";e.exports=d;var n,r=i(9693),a=r.LongBits,o=r.base64,s=r.utf8;function c(e,t,i){this.fn=e,this.len=t,this.next=void 0,this.val=i}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function d(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var f=function(){return r.Buffer?function(){return(d.create=function(){return new n})()}:function(){return new d}};function C(e,t,i){t[i]=255&e}function h(e,t){this.len=e,this.next=void 0,this.val=t}function p(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 m(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}d.create=f(),d.alloc=function(e){return new r.Array(e)},r.Array!==Array&&(d.alloc=r.pool(d.alloc,r.Array.prototype.subarray)),d.prototype._push=function(e,t,i){return this.tail=this.tail.next=new c(e,t,i),this.len+=t,this},h.prototype=Object.create(c.prototype),h.prototype.fn=function(e,t,i){for(;e>127;)t[i++]=127&e|128,e>>>=7;t[i]=e},d.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new h((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},d.prototype.int32=function(e){return e<0?this._push(p,10,a.fromNumber(e)):this.uint32(e)},d.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},d.prototype.uint64=function(e){var t=a.from(e);return this._push(p,t.length(),t)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(e){var t=a.from(e).zzEncode();return this._push(p,t.length(),t)},d.prototype.bool=function(e){return this._push(C,1,e?1:0)},d.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(e){var t=a.from(e);return this._push(m,4,t.lo)._push(m,4,t.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(e){return this._push(r.float.writeFloatLE,4,e)},d.prototype.double=function(e){return this._push(r.float.writeDoubleLE,8,e)};var v=r.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n>>0;if(!t)return this._push(C,1,0);if(r.isString(e)){var i=d.alloc(t=o.length(e));o.decode(e,i,0),e=i}return this.uint32(t)._push(v,t,e)},d.prototype.string=function(e){var t=s.length(e);return t?this.uint32(t)._push(s.write,t,e):this._push(C,1,0)},d.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},d.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 c(l,0,0),this.len=0),this},d.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},d.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},d._configure=function(e){n=e,d.create=f(),n._configure()}},3155:(e,t,i)=>{"use strict";e.exports=a;var n=i(1173);(a.prototype=Object.create(n.prototype)).constructor=a;var r=i(9693);function a(){n.call(this)}function o(e,t,i){e.length<40?r.utf8.write(e,t,i):t.utf8Write?t.utf8Write(e,i):t.write(e,i)}a._configure=function(){a.alloc=r._Buffer_allocUnsafe,a.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&"set"===r.Buffer.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>>0;return this.uint32(t),t&&this._push(a.writeBytesBuffer,t,e),this},a.prototype.string=function(e){var t=r.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},a._configure()},4448:(e,t,i)=>{"use strict";var n=i(7294),r=i(3840);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i