voice-changer/client/demo/dist/index.js

2 lines
1.3 MiB
Raw Blame History

/*! For license information please see index.js.LICENSE.txt */
(()=>{var __webpack_modules__={504:function(module,__unused_webpack_exports,__webpack_require__){var t;"undefined"!=typeof self&&self,t=__WEBPACK_EXTERNAL_MODULE__8156__=>(()=>{var __webpack_modules__={8260:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6665:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5470:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},969:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5287:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMsWindow=void 0;var n=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];t.isMsWindow=function(e){if(function(e){return"MSInputMethodContext"in e&&"msCrypto"in e}(e)&&void 0!==e.msCrypto.subtle){var t=e.msCrypto,i=t.getRandomValues,r=t.subtle;return n.map((function(e){return r[e]})).concat(i).every((function(e){return"function"==typeof e}))}return!1}},87:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(655);i.__exportStar(n(8260),t),i.__exportStar(n(6665),t),i.__exportStar(n(5470),t),i.__exportStar(n(969),t),i.__exportStar(n(5287),t)},7333:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_DATA_SHA_256=t.SHA_256_HMAC_ALGO=t.SHA_256_HASH=void 0,t.SHA_256_HASH={name:"SHA-256"},t.SHA_256_HMAC_ALGO={name:"HMAC",hash:t.SHA_256_HASH},t.EMPTY_DATA_SHA_256=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85])},2769:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var i=n(3479),r=n(8889),o=n(1938),s=n(21),a=n(87),l=n(6495),c=function(){function e(e){(0,s.supportsWebCrypto)((0,l.locateWindow)())?this.hash=new r.Sha256(e):(0,a.isMsWindow)((0,l.locateWindow)())?this.hash=new i.Sha256(e):this.hash=new o.Sha256(e)}return e.prototype.update=function(e,t){this.hash.update(e,t)},e.prototype.digest=function(){return this.hash.digest()},e}();t.Sha256=c},3479:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var i=n(8036),r=n(7333),o=n(470),s=n(6495),a=function(){function e(e){e?(this.operation=function(e){return new Promise((function(t,n){var i=(0,s.locateWindow)().msCrypto.subtle.importKey("raw",l(e),r.SHA_256_HMAC_ALGO,!1,["sign"]);i.oncomplete=function(){i.result&&t(i.result),n(new Error("ImportKey completed without importing key."))},i.onerror=function(){n(new Error("ImportKey failed to import key."))}}))}(e).then((function(e){return(0,s.locateWindow)().msCrypto.subtle.sign(r.SHA_256_HMAC_ALGO,e)})),this.operation.catch((function(){}))):this.operation=Promise.resolve((0,s.locateWindow)().msCrypto.subtle.digest("SHA-256"))}return e.prototype.update=function(e){var t=this;(0,i.isEmptyData)(e)||(this.operation=this.operation.then((function(n){return n.onerror=function(){t.operation=Promise.reject(new Error("Error encountered updating hash"))},n.process(l(e)),n})),this.operation.catch((function(){})))},e.prototype.digest=function(){return this.operation.then((function(e){return new Promise((function(t,n){e.onerror=function(){n(new Error("Error encountered finalizing hash"))},e.oncomplete=function(){e.result&&t(new Uint8Array(e.result)),n(new Error("Error encountered finalizing hash"))},e.finish()}))}))},e}();function l(e){return"string"==typeof e?(0,o.fromUtf8)(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=a},7643:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebCryptoSha256=t.Ie11Sha256=void 0,(0,n(655).__exportStar)(n(2769),t);var i=n(3479);Object.defineProperty(t,"Ie11Sha256",{enumerable:!0,get:function(){return i.Sha256}});var r=n(8889);Object.defineProperty(t,"WebCryptoSha256",{enumerable:!0,get:function(){return r.Sha256}})},8036:(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}},8889:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var i=n(7658),r=n(7333),o=n(6495),s=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise((function(t,n){(0,o.locateWindow)().crypto.subtle.importKey("raw",(0,i.convertToBuffer)(e),r.SHA_256_HMAC_ALGO,!1,["sign"]).then(t,n)})),this.key.catch((function(){})))}return e.prototype.update=function(e){if(!(0,i.isEmptyData)(e)){var t=(0,i.convertToBuffer)(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},e.prototype.digest=function(){var e=this;return this.key?this.key.then((function(t){return(0,o.locateWindow)().crypto.subtle.sign(r.SHA_256_HMAC_ALGO,t,e.toHash).then((function(e){return new Uint8Array(e)}))})):(0,i.isEmptyData)(this.toHash)?Promise.resolve(r.EMPTY_DATA_SHA_256):Promise.resolve().then((function(){return(0,o.locateWindow)().crypto.subtle.digest(r.SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e}();t.Sha256=s},914:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RawSha256=void 0;var i=n(6532),r=function(){function e(){this.state=Int32Array.from(i.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,n=e.byteLength;if(this.bytesHashed+=n,8*this.bytesHashed>i.MAX_HASHABLE_LENGTH)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===i.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),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%i.BLOCK_SIZE>=i.BLOCK_SIZE-8){for(var r=this.bufferLength;r<i.BLOCK_SIZE;r++)t.setUint8(r,0);this.hashBuffer(),this.bufferLength=0}for(r=this.bufferLength;r<i.BLOCK_SIZE-8;r++)t.setUint8(r,0);t.setUint32(i.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),t.setUint32(i.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}var o=new Uint8Array(i.DIGEST_LENGTH);for(r=0;r<8;r++)o[4*r]=this.state[r]>>>24&255,o[4*r+1]=this.state[r]>>>16&255,o[4*r+2]=this.state[r]>>>8&255,o[4*r+3]=this.state[r]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],r=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],d=t[7],u=0;u<i.BLOCK_SIZE;u++){if(u<16)this.temp[u]=(255&e[4*u])<<24|(255&e[4*u+1])<<16|(255&e[4*u+2])<<8|255&e[4*u+3];else{var h=this.temp[u-2],p=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,f=((h=this.temp[u-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[u]=(p+this.temp[u-7]|0)+(f+this.temp[u-16]|0)}var m=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&l^~a&c)|0)+(d+(i.KEY[u]+this.temp[u]|0)|0)|0,g=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&r^n&o^r&o)|0;d=c,c=l,l=a,a=s+m|0,s=o,o=r,r=n,n=m+g|0}t[0]+=n,t[1]+=r,t[2]+=o,t[3]+=s,t[4]+=a,t[5]+=l,t[6]+=c,t[7]+=d},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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(655).__exportStar(n(5430),t)},5430:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var i=n(655),r=n(6532),o=n(914),s=n(7658),a=function(){function e(e){if(this.hash=new o.RawSha256,e){this.outer=new o.RawSha256;var t=function(e){var t=(0,s.convertToBuffer)(e);if(t.byteLength>r.BLOCK_SIZE){var n=new o.RawSha256;n.update(t),t=n.digest()}var i=new Uint8Array(r.BLOCK_SIZE);return i.set(t),i}(e),n=new Uint8Array(r.BLOCK_SIZE);n.set(t);for(var i=0;i<r.BLOCK_SIZE;i++)t[i]^=54,n[i]^=92;for(this.hash.update(t),this.outer.update(n),i=0;i<t.byteLength;i++)t[i]=0}}return e.prototype.update=function(e){if(!(0,s.isEmptyData)(e)&&!this.error)try{this.hash.update((0,s.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return i.__awaiter(this,void 0,void 0,(function(){return i.__generator(this,(function(e){return[2,this.digestSync()]}))}))},e}();t.Sha256=a},21:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(655).__exportStar(n(7787),t)},7787:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.supportsZeroByteGCM=t.supportsSubtleCrypto=t.supportsSecureRandom=t.supportsWebCrypto=void 0;var i=n(655),r=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function o(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function s(e){return e&&r.every((function(t){return"function"==typeof e[t]}))}t.supportsWebCrypto=function(e){return!(!o(e)||"object"!=typeof e.crypto.subtle)&&s(e.crypto.subtle)},t.supportsSecureRandom=o,t.supportsSubtleCrypto=s,t.supportsZeroByteGCM=function(e){return i.__awaiter(this,void 0,void 0,(function(){var t;return i.__generator(this,(function(n){switch(n.label){case 0:if(!s(e))return[2,!1];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,e.generateKey({name:"AES-GCM",length:128},!1,["encrypt"])];case 2:return t=n.sent(),[4,e.encrypt({name:"AES-GCM",iv:new Uint8Array(Array(12)),additionalData:new Uint8Array(Array(16)),tagLength:128},t,new Uint8Array(0))];case 3:return[2,16===n.sent().byteLength];case 4:return n.sent(),[2,!1];case 5:return[2]}}))}))}},1106:(e,t,n)=>{"use strict";var i=n(8764).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.convertToBuffer=void 0;var r=n(470),o=void 0!==i&&i.from?function(e){return i.from(e,"utf8")}:r.fromUtf8;t.convertToBuffer=function(e){return e instanceof Uint8Array?e:"string"==typeof e?o(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}},7658:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uint32ArrayFrom=t.numToUint8=t.isEmptyData=t.convertToBuffer=void 0;var i=n(1106);Object.defineProperty(t,"convertToBuffer",{enumerable:!0,get:function(){return i.convertToBuffer}});var r=n(4304);Object.defineProperty(t,"isEmptyData",{enumerable:!0,get:function(){return r.isEmptyData}});var o=n(2174);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return o.numToUint8}});var s=n(1558);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return s.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),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}},5891:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AllowNotifications:()=>Rn,AppInstanceUserMembershipSummaryFilterSensitiveLog:()=>ni,AssociateChannelFlowCommand:()=>cs,AssociateChannelFlowRequestFilterSensitiveLog:()=>ii,BadRequestException:()=>Kn,BatchChannelMembershipsFilterSensitiveLog:()=>oi,BatchCreateChannelMembershipCommand:()=>ds,BatchCreateChannelMembershipErrorFilterSensitiveLog:()=>ai,BatchCreateChannelMembershipRequestFilterSensitiveLog:()=>si,BatchCreateChannelMembershipResponseFilterSensitiveLog:()=>li,ChannelAssociatedWithFlowSummaryFilterSensitiveLog:()=>ui,ChannelBanFilterSensitiveLog:()=>hi,ChannelBanSummaryFilterSensitiveLog:()=>pi,ChannelFilterSensitiveLog:()=>di,ChannelFlowCallbackCommand:()=>us,ChannelFlowCallbackRequestFilterSensitiveLog:()=>wi,ChannelFlowCallbackResponseFilterSensitiveLog:()=>Ci,ChannelFlowFilterSensitiveLog:()=>vi,ChannelFlowSummaryFilterSensitiveLog:()=>ki,ChannelMembershipFilterSensitiveLog:()=>Ei,ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog:()=>Ti,ChannelMembershipPreferencesFilterSensitiveLog:()=>Ii,ChannelMembershipSummaryFilterSensitiveLog:()=>Mi,ChannelMembershipType:()=>Nn,ChannelMessageCallbackFilterSensitiveLog:()=>Si,ChannelMessageFilterSensitiveLog:()=>Pi,ChannelMessagePersistenceType:()=>jn,ChannelMessageStatus:()=>zn,ChannelMessageStatusStructureFilterSensitiveLog:()=>Ai,ChannelMessageSummaryFilterSensitiveLog:()=>Oi,ChannelMessageType:()=>$n,ChannelMode:()=>Fn,ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog:()=>Ri,ChannelModeratorFilterSensitiveLog:()=>Ni,ChannelModeratorSummaryFilterSensitiveLog:()=>Di,ChannelPrivacy:()=>Ln,ChannelSummaryFilterSensitiveLog:()=>_i,ChimeSDKMessaging:()=>na,ChimeSDKMessagingClient:()=>Pn,ChimeSDKMessagingServiceException:()=>On,ConflictException:()=>Gn,CreateChannelBanCommand:()=>hs,CreateChannelBanRequestFilterSensitiveLog:()=>Ui,CreateChannelBanResponseFilterSensitiveLog:()=>Vi,CreateChannelCommand:()=>ps,CreateChannelFlowCommand:()=>fs,CreateChannelFlowRequestFilterSensitiveLog:()=>ji,CreateChannelFlowResponseFilterSensitiveLog:()=>zi,CreateChannelMembershipCommand:()=>ms,CreateChannelMembershipRequestFilterSensitiveLog:()=>$i,CreateChannelMembershipResponseFilterSensitiveLog:()=>Wi,CreateChannelModeratorCommand:()=>gs,CreateChannelModeratorRequestFilterSensitiveLog:()=>Hi,CreateChannelModeratorResponseFilterSensitiveLog:()=>qi,CreateChannelRequestFilterSensitiveLog:()=>Li,CreateChannelResponseFilterSensitiveLog:()=>Bi,DeleteChannelBanCommand:()=>vs,DeleteChannelBanRequestFilterSensitiveLog:()=>Gi,DeleteChannelCommand:()=>bs,DeleteChannelFlowCommand:()=>ys,DeleteChannelFlowRequestFilterSensitiveLog:()=>Ji,DeleteChannelMembershipCommand:()=>Ss,DeleteChannelMembershipRequestFilterSensitiveLog:()=>Qi,DeleteChannelMessageCommand:()=>ws,DeleteChannelMessageRequestFilterSensitiveLog:()=>Yi,DeleteChannelModeratorCommand:()=>Cs,DeleteChannelModeratorRequestFilterSensitiveLog:()=>Zi,DeleteChannelRequestFilterSensitiveLog:()=>Ki,DescribeChannelBanCommand:()=>ks,DescribeChannelBanRequestFilterSensitiveLog:()=>tr,DescribeChannelBanResponseFilterSensitiveLog:()=>nr,DescribeChannelCommand:()=>Es,DescribeChannelFlowCommand:()=>_s,DescribeChannelFlowRequestFilterSensitiveLog:()=>ir,DescribeChannelFlowResponseFilterSensitiveLog:()=>rr,DescribeChannelMembershipCommand:()=>Ts,DescribeChannelMembershipForAppInstanceUserCommand:()=>xs,DescribeChannelMembershipForAppInstanceUserRequestFilterSensitiveLog:()=>ar,DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog:()=>lr,DescribeChannelMembershipRequestFilterSensitiveLog:()=>or,DescribeChannelMembershipResponseFilterSensitiveLog:()=>sr,DescribeChannelModeratedByAppInstanceUserCommand:()=>Is,DescribeChannelModeratedByAppInstanceUserRequestFilterSensitiveLog:()=>cr,DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog:()=>dr,DescribeChannelModeratorCommand:()=>Ms,DescribeChannelModeratorRequestFilterSensitiveLog:()=>ur,DescribeChannelModeratorResponseFilterSensitiveLog:()=>hr,DescribeChannelRequestFilterSensitiveLog:()=>Xi,DescribeChannelResponseFilterSensitiveLog:()=>er,DisassociateChannelFlowCommand:()=>As,DisassociateChannelFlowRequestFilterSensitiveLog:()=>pr,ElasticChannelConfigurationFilterSensitiveLog:()=>ci,ErrorCode:()=>Dn,FallbackAction:()=>Un,ForbiddenException:()=>Jn,GetChannelMembershipPreferencesCommand:()=>Ps,GetChannelMembershipPreferencesRequestFilterSensitiveLog:()=>fr,GetChannelMembershipPreferencesResponseFilterSensitiveLog:()=>mr,GetChannelMessageCommand:()=>Os,GetChannelMessageRequestFilterSensitiveLog:()=>gr,GetChannelMessageResponseFilterSensitiveLog:()=>vr,GetChannelMessageStatusCommand:()=>Rs,GetChannelMessageStatusRequestFilterSensitiveLog:()=>br,GetChannelMessageStatusResponseFilterSensitiveLog:()=>yr,GetMessagingSessionEndpointCommand:()=>Ns,GetMessagingSessionEndpointRequestFilterSensitiveLog:()=>Sr,GetMessagingSessionEndpointResponseFilterSensitiveLog:()=>Cr,IdentityFilterSensitiveLog:()=>ri,InvocationType:()=>Bn,LambdaConfigurationFilterSensitiveLog:()=>fi,ListChannelBansCommand:()=>Ds,ListChannelBansRequestFilterSensitiveLog:()=>kr,ListChannelBansResponseFilterSensitiveLog:()=>Er,ListChannelFlowsCommand:()=>Fs,ListChannelFlowsRequestFilterSensitiveLog:()=>_r,ListChannelFlowsResponseFilterSensitiveLog:()=>Tr,ListChannelMembershipsCommand:()=>Ls,ListChannelMembershipsForAppInstanceUserCommand:()=>Bs,ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog:()=>Mr,ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog:()=>Ar,ListChannelMembershipsRequestFilterSensitiveLog:()=>xr,ListChannelMembershipsResponseFilterSensitiveLog:()=>Ir,ListChannelMessagesCommand:()=>Us,ListChannelMessagesRequestFilterSensitiveLog:()=>Pr,ListChannelMessagesResponseFilterSensitiveLog:()=>Or,ListChannelModeratorsCommand:()=>Vs,ListChannelModeratorsRequestFilterSensitiveLog:()=>Rr,ListChannelModeratorsResponseFilterSensitiveLog:()=>Nr,ListChannelsAssociatedWithChannelFlowCommand:()=>js,ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog:()=>Lr,ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog:()=>Br,ListChannelsCommand:()=>zs,ListChannelsModeratedByAppInstanceUserCommand:()=>$s,ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog:()=>Ur,ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog:()=>Vr,ListChannelsRequestFilterSensitiveLog:()=>Dr,ListChannelsResponseFilterSensitiveLog:()=>Fr,ListSubChannelsCommand:()=>Ws,ListSubChannelsRequestFilterSensitiveLog:()=>jr,ListSubChannelsResponseFilterSensitiveLog:()=>$r,ListTagsForResourceCommand:()=>Hs,ListTagsForResourceRequestFilterSensitiveLog:()=>Wr,ListTagsForResourceResponseFilterSensitiveLog:()=>Hr,MessageAttributeValueFilterSensitiveLog:()=>bi,MessagingSessionEndpointFilterSensitiveLog:()=>wr,NotFoundException:()=>Qn,ProcessorConfigurationFilterSensitiveLog:()=>mi,ProcessorFilterSensitiveLog:()=>gi,PushNotificationConfigurationFilterSensitiveLog:()=>yi,PushNotificationPreferencesFilterSensitiveLog:()=>xi,PushNotificationType:()=>Vn,PutChannelMembershipPreferencesCommand:()=>qs,PutChannelMembershipPreferencesRequestFilterSensitiveLog:()=>qr,PutChannelMembershipPreferencesResponseFilterSensitiveLog:()=>Kr,RedactChannelMessageCommand:()=>Ks,RedactChannelMessageRequestFilterSensitiveLog:()=>Gr,RedactChannelMessageResponseFilterSensitiveLog:()=>Jr,ResourceLimitExceededException:()=>ti,SearchChannelsCommand:()=>Gs,SearchChannelsRequestFilterSensitiveLog:()=>Yr,SearchChannelsResponseFilterSensitiveLog:()=>Zr,SearchFieldFilterSensitiveLog:()=>Qr,SearchFieldKey:()=>Hn,SearchFieldOperator:()=>qn,SendChannelMessageCommand:()=>Js,SendChannelMessageRequestFilterSensitiveLog:()=>Xr,SendChannelMessageResponseFilterSensitiveLog:()=>eo,ServiceFailureException:()=>Yn,ServiceUnavailableException:()=>Zn,SortOrder:()=>Wn,SubChannelSummaryFilterSensitiveLog:()=>zr,TagFilterSensitiveLog:()=>Fi,TagResourceCommand:()=>Qs,TagResourceRequestFilterSensitiveLog:()=>to,ThrottledClientException:()=>Xn,UnauthorizedClientException:()=>ei,UntagResourceCommand:()=>Ys,UntagResourceRequestFilterSensitiveLog:()=>no,UpdateChannelCommand:()=>Zs,UpdateChannelFlowCommand:()=>Xs,UpdateChannelFlowRequestFilterSensitiveLog:()=>oo,UpdateChannelFlowResponseFilterSensitiveLog:()=>so,UpdateChannelMessageCommand:()=>ea,UpdateChannelMessageRequestFilterSensitiveLog:()=>ao,UpdateChannelMessageResponseFilterSensitiveLog:()=>lo,UpdateChannelReadMarkerCommand:()=>ta,UpdateChannelReadMarkerRequestFilterSensitiveLog:()=>co,UpdateChannelReadMarkerResponseFilterSensitiveLog:()=>uo,UpdateChannelRequestFilterSensitiveLog:()=>io,UpdateChannelResponseFilterSensitiveLog:()=>ro,paginateListChannelBans:()=>oa,paginateListChannelFlows:()=>la,paginateListChannelMemberships:()=>fa,paginateListChannelMembershipsForAppInstanceUser:()=>ua,paginateListChannelMessages:()=>va,paginateListChannelModerators:()=>Sa,paginateListChannels:()=>Ma,paginateListChannelsAssociatedWithChannelFlow:()=>ka,paginateListChannelsModeratedByAppInstanceUser:()=>Ta,paginateListSubChannels:()=>Oa,paginateSearchChannels:()=>Da});var i={};n.r(i),n.d(i,{isVirtualHostableS3Bucket:()=>Bt,parseArn:()=>Ut,partition:()=>At});var r,o={};n.r(o),n.d(o,{aws:()=>i,booleanEquals:()=>Vt,getAttr:()=>jt,isSet:()=>zt,isValidHostLabel:()=>Lt,not:()=>$t,parseURL:()=>qt,stringEquals:()=>Kt,substring:()=>Gt,uriEncode:()=>Jt}),function(e){e.ENV="env",e.CONFIG="shared config entry"}(r||(r={}));const s=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),a=e=>s(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e;class l{constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?":"!==e.protocol.slice(-1)?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?"/"!==e.path.charAt(0)?`/${e.path}`:e.path:"/"}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&"object"==typeof t.query&&"object"==typeof t.headers}clone(){const e=new l({...this,headers:{...this.headers}});var t;return e.query&&(e.query=(t=e.query,Object.keys(t).reduce(((e,n)=>{const i=t[n];return{...e,[n]:Array.isArray(i)?[...i]:i}}),{}))),e}}const c="content-length",d={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},u={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},h={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function p(e,t,n){return{applyToStack:i=>{i.add(((e,t)=>(n,i)=>async i=>{const{response:r}=await n(i);try{return{response:r,output:await t(r,e)}}catch(e){throw Object.defineProperty(e,"$response",{value:r}),e}})(e,n),u),i.add(((e,t)=>(n,i)=>async r=>{const o=i.endpointV2?.url&&e.urlParser?async()=>e.urlParser(i.endpointV2.url):e.endpoint;if(!o)throw new Error("No valid endpoint provider available.");const s=await t(r.input,{...e,endpoint:o});return n({...r,request:s})})(e,t),h)}}}const f=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,m=/(\d+\.){3}\d+/,g=/\.\./,v=(e,t,n)=>{const i=async()=>{const i=n[e]??n[t];return"function"==typeof i?i():i};return"endpoint"===e||"endpoint"===t?async()=>{const e=await i();if(e&&"object"==typeof e){if("url"in e)return e.url.href;if("hostname"in e){const{protocol:t,hostname:n,port:i,path:r}=e;return`${t}//${n}${i?":"+i:""}${r}`}}return e}:i},b={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:h.name},y=(e,t)=>({applyToStack:n=>{n.addRelativeTo((({config:e,instructions:t})=>(n,i)=>async r=>{const o=await(async(e,t,n,i)=>{const r=await(async(e,t,n)=>{const i={},r=t?.getEndpointParameterInstructions?.()||{};for(const[t,o]of Object.entries(r))switch(o.type){case"staticContextParams":i[t]=o.value;break;case"contextParams":i[t]=e[o.name];break;case"clientContextParams":case"builtInParams":i[t]=await v(o.name,t,n)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return 0===Object.keys(r).length&&Object.assign(i,n),"s3"===String(n.serviceId).toLowerCase()&&await(async e=>{const t=e?.Bucket||"";if("string"==typeof e.Bucket&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),(e=>{const[t,n,i,r,o,s]=e.split(":"),a="arn"===t&&e.split(":").length>=6,l=5===[t,n,i,o,s].filter(Boolean).length;if(a&&!l)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return!!("arn"===t&&n&&i&&o&&s)})(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else n=t,(!f.test(n)||m.test(n)||g.test(n)||-1!==t.indexOf(".")&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);var n;return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e})(i),i})(e,t,n);if("function"!=typeof n.endpointProvider)throw new Error("config.endpointProvider is not set.");return n.endpointProvider(r,i)})(r.input,{getEndpointParameterInstructions:()=>t},{...e},i);i.endpointV2=o,i.authSchemes=o.properties?.authSchemes;const s=i.authSchemes?.[0];return s&&(i.signing_region=s.signingRegion,i.signing_service=s.signingName),n({...r})})({config:e,instructions:t}),b)}}),S=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},w=e=>{if("string"==typeof e)return w(new URL(e));const{hostname:t,pathname:n,port:i,protocol:r,search:o}=e;let s;return o&&(s=function(e){const t={};if(e=e.replace(/^\?/,""))for(const n of e.split("&")){let[e,i=null]=n.split("=");e=decodeURIComponent(e),i&&(i=decodeURIComponent(i)),e in t?Array.isArray(t[e])?t[e].push(i):t[e]=[t[e],i]:t[e]=i}return t}(o)),{hostname:t,port:i?parseInt(i):void 0,protocol:r,path:n,query:s}},C={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},k={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0};var E=n(4155);const _="X-Amzn-Trace-Id",T={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"};var x,I;(I=x||(x={})).STANDARD="standard",I.ADAPTIVE="adaptive";const M=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],A=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],P=[500,502,503,504],O=["ECONNRESET","EPIPE","ETIMEDOUT"],R=e=>429===e.$metadata?.httpStatusCode||M.includes(e.name)||1==e.$retryable?.throttling,N=e=>A.includes(e.name)||O.includes(e?.code||"")||P.includes(e.$metadata?.httpStatusCode||0);class D{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8;const t=this.getCurrentTimeInSeconds();this.lastThrottleTime=t,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.currentCapacity){const t=(e-this.currentCapacity)/this.fillRate*1e3;await new Promise((e=>setTimeout(e,t)))}this.currentCapacity=this.currentCapacity-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp)return void(this.lastTimestamp=e);const t=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+t),this.lastTimestamp=e}updateClientSendingRate(e){let t;if(this.updateMeasuredRate(),R(e)){const e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const n=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(n)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(2*e)/2;if(this.requestCount++,t>this.lastTxRateBucket){const e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}class F{constructor(e){this.maxAttemptsProvider=e,this.mode=x.STANDARD,this.retryToken=((e,t,n,i)=>{const r=(()=>{let e=100;return{computeNextBackoffDelay:t=>Math.floor(Math.min(2e4,Math.random()*2**t*e)),setDelayBase:t=>{e=t}}})();let o,s=500,a=Math.min(2e4,100),l=0;const c=e=>"TRANSIENT"===e?10:5,d=e=>c(e)<=s;return{getRetryCount:()=>l,getRetryDelay:()=>a,getLastRetryCost:()=>o,hasRetryTokens:d,getRetryTokenCount:e=>{const t=e.errorType;if(!d(t))throw new Error("No retry token available");const n=c(t),i="THROTTLING"===t?500:100;r.setDelayBase(i);const u=r.computeNextBackoffDelay(l);if(e.retryAfterHint){const t=e.retryAfterHint.getTime()-Date.now();a=Math.max(t||0,u)}else a=u;return l++,o=n,s-=n,n},releaseRetryTokens:e=>{s+=e??1,s=Math.min(s,500)}}})(),this.maxAttemptsProvider=e}async acquireInitialRetryToken(e){return this.retryToken}async refreshRetryTokenForRetry(e,t){const n=await this.getMaxAttempts();if(this.shouldRetry(e,t,n))return e.getRetryTokenCount(t),e;throw new Error("No retry token available")}recordSuccess(e){this.retryToken.releaseRetryTokens(e.getLastRetryCost())}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn("Max attempts provider could not resolve. Using default of 3"),3}}shouldRetry(e,t,n){return e.getRetryCount()<n&&e.hasRetryTokens(t.errorType)&&this.isRetryableError(t.errorType)}isRetryableError(e){return"THROTTLING"===e||"TRANSIENT"===e}}class L{constructor(e,t){this.maxAttemptsProvider=e,this.mode=x.ADAPTIVE;const{rateLimiter:n}=t??{};this.rateLimiter=n??new D,this.standardRetryStrategy=new F(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,t){return this.rateLimiter.updateClientSendingRate(t),this.standardRetryStrategy.refreshRetryTokenForRetry(e,t)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}class B{constructor(e){this.statusCode=e.statusCode,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const t=e;return"number"==typeof t.statusCode&&"object"==typeof t.headers}}var U,V=new Uint8Array(16);function j(){if(!U&&!(U="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return U(V)}const z=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,$=function(e){return"string"==typeof e&&z.test(e)};for(var W=[],H=0;H<256;++H)W.push((H+256).toString(16).substr(1));const q=function(e,t,n){var i=(e=e||{}).random||(e.rng||j)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(W[e[t+0]]+W[e[t+1]]+W[e[t+2]]+W[e[t+3]]+"-"+W[e[t+4]]+W[e[t+5]]+"-"+W[e[t+6]]+W[e[t+7]]+"-"+W[e[t+8]]+W[e[t+9]]+"-"+W[e[t+10]]+W[e[t+11]]+W[e[t+12]]+W[e[t+13]]+W[e[t+14]]+W[e[t+15]]).toLowerCase();if(!$(n))throw TypeError("Stringified UUID is invalid");return n}(i)},K=e=>{const t={errorType:G(e)},n=Q(e.$response);return n&&(t.retryAfterHint=n),t},G=e=>R(e)?"THROTTLING":N(e)?"TRANSIENT":(e=>{if(void 0!==e.$metadata?.httpStatusCode){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!N(e)}return!1})(e)?"SERVER_ERROR":"CLIENT_ERROR",J={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Q=e=>{if(!B.isInstance(e))return;const t=Object.keys(e.headers).find((e=>"retry-after"===e.toLowerCase()));if(!t)return;const n=e.headers[t],i=Number(n);return Number.isNaN(i)?new Date(n):new Date(1e3*i)};class Y extends Error{constructor(e,t=!0){super(e),this.tryNextLink=t,this.name="ProviderError",Object.setPrototypeOf(this,Y.prototype)}static from(e,t=!0){return Object.assign(new this(e.message,t),e)}}const Z=(e,t,n)=>{let i,r,o,s=!1;const a=async()=>{r||(r=e());try{i=await r,o=!0,s=!1}finally{r=void 0}return i};return void 0===t?async e=>(o&&!e?.forceRefresh||(i=await a()),i):async e=>(o&&!e?.forceRefresh||(i=await a()),s?i:n&&!n(i)?(s=!0,i):t(i)?(await a(),i):i)};var X=n(3538);const ee="X-Amz-Date",te="X-Amz-Signature",ne="X-Amz-Security-Token",ie="authorization",re=ee.toLowerCase(),oe=[ie,re,"date"],se=te.toLowerCase(),ae="x-amz-content-sha256",le=ne.toLowerCase(),ce={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},de=/^proxy-/,ue=/^sec-/,he="AWS4-HMAC-SHA256",pe="AWS4-HMAC-SHA256-PAYLOAD",fe="aws4_request",me={},ge=[],ve=(e,t,n)=>`${e}/${t}/${n}/${fe}`,be=(e,t,n)=>{const i=new e(t);return i.update(n),i.digest()},ye=({headers:e},t,n)=>{const i={};for(const r of Object.keys(e).sort()){if(null==e[r])continue;const o=r.toLowerCase();(o in ce||t?.has(o)||de.test(o)||ue.test(o))&&(!n||n&&!n.has(o))||(i[o]=e[r].trim().replace(/\s+/g," "))}return i},Se=e=>encodeURIComponent(e).replace(/[!'()*]/g,we),we=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`,Ce=async({headers:e,body:t},n)=>{for(const t of Object.keys(e))if(t.toLowerCase()===ae)return e[t];if(null==t)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if("string"==typeof t||ArrayBuffer.isView(t)||(i=t,"function"==typeof ArrayBuffer&&i instanceof ArrayBuffer||"[object ArrayBuffer]"===Object.prototype.toString.call(i))){const e=new n;return e.update(t),(0,X.toHex)(await e.digest())}var i;return"UNSIGNED-PAYLOAD"},ke=({headers:e,query:t,...n})=>({...n,headers:{...e},query:t?Ee(t):void 0}),Ee=e=>Object.keys(e).reduce(((t,n)=>{const i=e[n];return{...t,[n]:Array.isArray(i)?[...i]:i}}),{}),_e=e=>{e="function"==typeof e.clone?e.clone():ke(e);for(const t of Object.keys(e.headers))oe.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e};class Te{constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:r,uriEscapePath:o=!0}){this.service=i,this.sha256=r,this.uriEscapePath=o,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=S(n),this.credentialProvider=S(t)}async presign(e,t={}){const{signingDate:n=new Date,expiresIn:i=3600,unsignableHeaders:r,unhoistableHeaders:o,signableHeaders:s,signingRegion:a,signingService:l}=t,c=await this.credentialProvider();this.validateResolvedCredentials(c);const d=a??await this.regionProvider(),{longDate:u,shortDate:h}=xe(n);if(i>604800)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const p=ve(h,d,l??this.service),f=((e,t={})=>{const{headers:n,query:i={}}="function"==typeof e.clone?e.clone():ke(e);for(const e of Object.keys(n)){const r=e.toLowerCase();"x-amz-"!==r.slice(0,6)||t.unhoistableHeaders?.has(r)||(i[e]=n[e],delete n[e])}return{...e,headers:n,query:i}})(_e(e),{unhoistableHeaders:o});c.sessionToken&&(f.query[ne]=c.sessionToken),f.query["X-Amz-Algorithm"]=he,f.query["X-Amz-Credential"]=`${c.accessKeyId}/${p}`,f.query[ee]=u,f.query["X-Amz-Expires"]=i.toString(10);const m=ye(f,r,s);return f.query["X-Amz-SignedHeaders"]=Ie(m),f.query[te]=await this.getSignature(u,p,this.getSigningKey(c,d,h,l),this.createCanonicalRequest(f,m,await Ce(e,this.sha256))),f}async sign(e,t){return"string"==typeof e?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:i,signingRegion:r,signingService:o}){const s=r??await this.regionProvider(),{shortDate:a,longDate:l}=xe(n),c=ve(a,s,o??this.service),d=await Ce({headers:{},body:t},this.sha256),u=new this.sha256;u.update(e);const h=(0,X.toHex)(await u.digest()),p=[pe,l,c,i,h,d].join("\n");return this.signString(p,{signingDate:n,signingRegion:s,signingService:o})}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:i}={}){const r=await this.credentialProvider();this.validateResolvedCredentials(r);const o=n??await this.regionProvider(),{shortDate:s}=xe(t),a=new this.sha256(await this.getSigningKey(r,o,s,i));return a.update(e),(0,X.toHex)(await a.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:i,signingRegion:r,signingService:o}={}){const s=await this.credentialProvider();this.validateResolvedCredentials(s);const a=r??await this.regionProvider(),l=_e(e),{longDate:c,shortDate:d}=xe(t),u=ve(d,a,o??this.service);l.headers[re]=c,s.sessionToken&&(l.headers[le]=s.sessionToken);const h=await Ce(l,this.sha256);!((e,t)=>{e=e.toLowerCase();for(const n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1})(ae,l.headers)&&this.applyChecksum&&(l.headers[ae]=h);const p=ye(l,i,n),f=await this.getSignature(c,u,this.getSigningKey(s,a,d,o),this.createCanonicalRequest(l,p,h));return l.headers[ie]=`${he} Credential=${s.accessKeyId}/${u}, SignedHeaders=${Ie(p)}, Signature=${f}`,l}createCanonicalRequest(e,t,n){const i=Object.keys(t).sort();return`${e.method}\n${this.getCanonicalPath(e)}\n${(({query:e={}})=>{const t=[],n={};for(const i of Object.keys(e).sort()){if(i.toLowerCase()===se)continue;t.push(i);const r=e[i];"string"==typeof r?n[i]=`${Se(i)}=${Se(r)}`:Array.isArray(r)&&(n[i]=r.slice(0).sort().reduce(((e,t)=>e.concat([`${Se(i)}=${Se(t)}`])),[]).join("&"))}return t.map((e=>n[e])).filter((e=>e)).join("&")})(e)}\n${i.map((e=>`${e}:${t[e]}`)).join("\n")}\n\n${i.join(";")}\n${n}`}async createStringToSign(e,t,n){const i=new this.sha256;i.update(n);const r=await i.digest();return`${he}\n${e}\n${t}\n${(0,X.toHex)(r)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const n of e.split("/"))0!==n?.length&&"."!==n&&(".."===n?t.pop():t.push(n));const n=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return encodeURIComponent(n).replace(/%2F/g,"/")}return e}async getSignature(e,t,n,i){const r=await this.createStringToSign(e,t,i),o=new this.sha256(await n);return o.update(r),(0,X.toHex)(await o.digest())}getSigningKey(e,t,n,i){return(async(e,t,n,i,r)=>{const o=await be(e,t.secretAccessKey,t.accessKeyId),s=`${n}:${i}:${r}:${(0,X.toHex)(o)}:${t.sessionToken}`;if(s in me)return me[s];for(ge.push(s);ge.length>50;)delete me[ge.shift()];let a=`AWS4${t.secretAccessKey}`;for(const t of[n,i,r,fe])a=await be(e,a,t);return me[s]=a})(this.sha256,e,n,t,i||this.service)}validateResolvedCredentials(e){if("object"!=typeof e||"string"!=typeof e.accessKeyId||"string"!=typeof e.secretAccessKey)throw new Error("Resolved credential object is not valid")}}const xe=e=>{const t=(n=e,(e=>"number"==typeof e?new Date(1e3*e):"string"==typeof e?Number(e)?new Date(1e3*Number(e)):new Date(e):e)(n).toISOString().replace(/\.\d{3}Z$/,"Z")).replace(/[\-:]/g,"");var n;return{longDate:t,shortDate:t.slice(0,8)}},Ie=e=>Object.keys(e).sort().join(";"),Me=e=>new Date(Date.now()+e),Ae=(e,t)=>{const n=Date.parse(e);return((e,t)=>Math.abs(Me(t).getTime()-e)>=3e5)(n,t)?n-Date.now():t},Pe=e=>B.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,Oe={name:"awsAuthMiddleware",tags:["SIGNATURE","AWSAUTH"],relation:"after",toMiddleware:"retryMiddleware",override:!0},Re="user-agent",Ne="x-amz-user-agent",De=/[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,Fe=([e,t])=>{const n=e.indexOf("/"),i=e.substring(0,n);let r=e.substring(n+1);return"api"===i&&(r=r.toLowerCase()),[i,r,t].filter((e=>e&&e.length>0)).map((e=>e?.replace(De,"_"))).join("/")},Le={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0};class Be{trace(){}debug(){}info(){}warn(){}error(){}}const Ue=()=>{let e=[],t=[];const n=new Set,i=n=>(e.forEach((e=>{n.add(e.middleware,{...e})})),t.forEach((e=>{n.addRelativeTo(e.middleware,{...e})})),n),r=e=>{const t=[];return e.before.forEach((e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...r(e))})),t.push(e),e.after.reverse().forEach((e=>{0===e.before.length&&0===e.after.length?t.push(e):t.push(...r(e))})),t},o=(n=!1)=>{const i=[],o=[],s={};var a;return e.forEach((e=>{const t={...e,before:[],after:[]};t.name&&(s[t.name]=t),i.push(t)})),t.forEach((e=>{const t={...e,before:[],after:[]};t.name&&(s[t.name]=t),o.push(t)})),o.forEach((e=>{if(e.toMiddleware){const t=s[e.toMiddleware];if(void 0===t){if(n)return;throw new Error(`${e.toMiddleware} is not found when adding ${e.name||"anonymous"} middleware ${e.relation} ${e.toMiddleware}`)}"after"===e.relation&&t.after.push(e),"before"===e.relation&&t.before.push(e)}})),(a=i,a.sort(((e,t)=>Ve[t.step]-Ve[e.step]||je[t.priority||"normal"]-je[e.priority||"normal"]))).map(r).reduce(((e,t)=>(e.push(...t),e)),[])},s={add:(t,i={})=>{const{name:r,override:o}=i,s={step:"initialize",priority:"normal",middleware:t,...i};if(r){if(n.has(r)){if(!o)throw new Error(`Duplicate middleware name '${r}'`);const t=e.findIndex((e=>e.name===r)),n=e[t];if(n.step!==s.step||n.priority!==s.priority)throw new Error(`"${r}" middleware with ${n.priority} priority in ${n.step} step cannot be overridden by same-name middleware with ${s.priority} priority in ${s.step} step.`);e.splice(t,1)}n.add(r)}e.push(s)},addRelativeTo:(e,i)=>{const{name:r,override:o}=i,s={middleware:e,...i};if(r){if(n.has(r)){if(!o)throw new Error(`Duplicate middleware name '${r}'`);const e=t.findIndex((e=>e.name===r)),n=t[e];if(n.toMiddleware!==s.toMiddleware||n.relation!==s.relation)throw new Error(`"${r}" middleware ${n.relation} "${n.toMiddleware}" middleware cannot be overridden by same-name middleware ${s.relation} "${s.toMiddleware}" middleware.`);t.splice(e,1)}n.add(r)}t.push(s)},clone:()=>i(Ue()),use:e=>{e.applyToStack(s)},remove:i=>"string"==typeof i?(i=>{let r=!1;const o=e=>!e.name||e.name!==i||(r=!0,n.delete(i),!1);return e=e.filter(o),t=t.filter(o),r})(i):(i=>{let r=!1;const o=e=>e.middleware!==i||(r=!0,e.name&&n.delete(e.name),!1);return e=e.filter(o),t=t.filter(o),r})(i),removeByTag:i=>{let r=!1;const o=e=>{const{tags:t,name:o}=e;return!t||!t.includes(i)||(o&&n.delete(o),r=!0,!1)};return e=e.filter(o),t=t.filter(o),r},concat:e=>{const t=i(Ue());return t.use(e),t},applyToStack:i,identify:()=>o(!0).map((e=>e.name+": "+(e.tags||[]).join(","))),resolve:(e,t)=>{for(const n of o().map((e=>e.middleware)).reverse())e=n(e,t);return e}};return s},Ve={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},je={high:3,normal:2,low:1};class ze{constructor(e){this.middlewareStack=Ue(),this.config=e}send(e,t,n){const i="function"!=typeof t?t:void 0,r="function"==typeof t?t:n,o=e.resolveMiddleware(this.middlewareStack,this.config,i);if(!r)return o(e).then((e=>e.output));o(e).then((e=>r(null,e.output)),(e=>r(e))).catch((()=>{}))}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}class $e{constructor(){this.middlewareStack=Ue()}}const We="***SensitiveInformation***",He=e=>{if(null!=e){if("number"==typeof e){if(0!==e&&1!==e||nt.warn(tt(`Expected boolean, got ${typeof e}: ${e}`)),0===e)return!1;if(1===e)return!0}if("string"==typeof e){const t=e.toLowerCase();if("false"!==t&&"true"!==t||nt.warn(tt(`Expected boolean, got ${typeof e}: ${e}`)),"false"===t)return!1;if("true"===t)return!0}if("boolean"==typeof e)return e;throw new TypeError(`Expected boolean, got ${typeof e}: ${e}`)}},qe=e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&nt.warn(tt(`Expected number but observed string: ${e}`)),t}if("number"==typeof e)return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},Ke=(Math.ceil(2**127*(2-2**-23)),e=>{if(null!=e){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}}),Ge=e=>Je(e,32),Je=(e,t)=>{const n=Ke(e);if(void 0!==n&&Qe(n,t)!==n)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return n},Qe=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},Ye=(e,t)=>{if(null==e){if(t)throw new TypeError(`Expected a non-null value for ${t}`);throw new TypeError("Expected a non-null value")}return e},Ze=e=>{if(null==e)return;if("object"==typeof e&&!Array.isArray(e))return e;const t=Array.isArray(e)?"array":typeof e;throw new TypeError(`Expected object, got ${t}: ${e}`)},Xe=e=>{if(null!=e){if("string"==typeof e)return e;if(["boolean","number","bigint"].includes(typeof e))return nt.warn(tt(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)}},et=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,tt=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter((e=>!e.includes("stackTraceWarning"))).join("\n"),nt={warn:console.warn},it=e=>{if(null==e)return;let t;if("number"==typeof e)t=e;else{if("string"!=typeof e)throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");t=(e=>qe("string"==typeof e?(e=>{const t=e.match(et);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)})(e):e))(e)}if(Number.isNaN(t)||t===1/0||t===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(1e3*t))};class rt extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,rt.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const ot=(e,t={})=>{Object.entries(t).filter((([,e])=>void 0!==e)).forEach((([t,n])=>{null!=e[t]&&""!==e[t]||(e[t]=n)}));const n=e.message||e.Message||"UnknownError";return e.message=n,delete e.Message,e},st=({output:e,parsedBody:t,exceptionCtor:n,errorCode:i})=>{const r=at(e),o=r.httpStatusCode?r.httpStatusCode+"":void 0,s=new n({name:t.code||t.Code||i||o||"UnknownError",$fault:"client",$metadata:r});throw ot(s,t)},at=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),lt=e=>{switch(e){case"standard":case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},ct=function(){const e=Object.getPrototypeOf(this).constructor,t=Function.bind.apply(String,[null,...arguments]),n=new t;return Object.setPrototypeOf(n,e.prototype),n};function dt(e,t,n){let i,r,o;if(void 0===t&&void 0===n)i={},o=e;else{if(i=e,"function"==typeof t)return r=t,o=n,ut(i,r,o);o=t}for(const e of Object.keys(o)){if(!Array.isArray(o[e])){i[e]=o[e];continue}let[t,n]=o[e];if("function"==typeof n){let r;const o=void 0===t&&null!=(r=n()),s="function"==typeof t&&!!t(void 0)||"function"!=typeof t&&!!t;o?i[e]=r:s&&(i[e]=n())}else{const r=void 0===t&&null!=n,o="function"==typeof t&&!!t(n)||"function"!=typeof t&&!!t;(r||o)&&(i[e]=n)}}return i}ct.prototype=Object.create(String.prototype,{constructor:{value:ct,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(ct,String);const ut=(e,t,n)=>dt(e,Object.entries(n).reduce(((e,[n,i])=>(Array.isArray(i)?e[n]=i:e[n]="function"==typeof i?[t,i()]:[t,i],e)),{}));function ht(e){return encodeURIComponent(e).replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}const pt=(e,t,n,i,r,o)=>{if(null==t||void 0===t[n])throw new Error("No value provided for input HTTP label: "+n+".");{const t=i();if(t.length<=0)throw new Error("Empty value provided for input HTTP label: "+n+".");e=e.replace(r,o?t.split("/").map((e=>ht(e))).join("/"):ht(t))}return e};var ft=n(7643);function mt(e=0){return new Promise(((t,n)=>{e&&setTimeout((()=>{const t=new Error(`Request did not complete within ${e} ms`);t.name="TimeoutError",n(t)}),e)}))}class gt{constructor(e){"function"==typeof e?this.configProvider=e().then((e=>e||{})):(this.config=e??{},this.configProvider=Promise.resolve(this.config))}destroy(){}async handle(e,{abortSignal:t}={}){this.config||(this.config=await this.configProvider);const n=this.config.requestTimeout;if(t?.aborted){const e=new Error("Request aborted");return e.name="AbortError",Promise.reject(e)}let i=e.path;if(e.query){const t=function(e){const t=[];for(let n of Object.keys(e).sort()){const i=e[n];if(n=Se(n),Array.isArray(i))for(let e=0,r=i.length;e<r;e++)t.push(`${n}=${Se(i[e])}`);else{let e=n;(i||"string"==typeof i)&&(e+=`=${Se(i)}`),t.push(e)}}return t.join("&")}(e.query);t&&(i+=`?${t}`)}const{port:r,method:o}=e,s=`${e.protocol}//${e.hostname}${r?`:${r}`:""}${i}`,a={body:"GET"===o||"HEAD"===o?void 0:e.body,headers:new Headers(e.headers),method:o};"undefined"!=typeof AbortController&&(a.signal=t);const l=new Request(s,a),c=[fetch(l).then((e=>{const t=e.headers,n={};for(const e of t.entries())n[e[0]]=e[1];return void 0!==e.body?{response:new B({headers:n,statusCode:e.status,body:e.body})}:e.blob().then((t=>({response:new B({headers:n,statusCode:e.status,body:t})})))})),mt(n)];return t&&c.push(new Promise(((e,n)=>{t.onabort=()=>{const e=new Error("Request aborted");e.name="AbortError",n(e)}}))),Promise.race(c)}}const vt={},bt=new Array(64);for(let e=0,t="A".charCodeAt(0),n="Z".charCodeAt(0);e+t<=n;e++){const n=String.fromCharCode(e+t);vt[n]=e,bt[e]=n}for(let e=0,t="a".charCodeAt(0),n="z".charCodeAt(0);e+t<=n;e++){const n=String.fromCharCode(e+t),i=e+26;vt[n]=i,bt[i]=n}for(let e=0;e<10;e++){vt[e.toString(10)]=e+52;const t=e.toString(10),n=e+52;vt[t]=n,bt[n]=t}vt["+"]=62,bt[62]="+",vt["/"]=63,bt[63]="/";const yt=e=>{let t=e.length/4*3;"=="===e.slice(-2)?t-=2:"="===e.slice(-1)&&t--;const n=new ArrayBuffer(t),i=new DataView(n);for(let t=0;t<e.length;t+=4){let n=0,r=0;for(let i=t,o=t+3;i<=o;i++)if("="!==e[i]){if(!(e[i]in vt))throw new TypeError(`Invalid character ${e[i]} in base64 string.`);n|=vt[e[i]]<<6*(o-i),r+=6}else n>>=6;const o=t/4*3;n>>=r%8;const s=Math.floor(r/8);for(let e=0;e<s;e++){const t=8*(s-e-1);i.setUint8(o+e,(n&255<<t)>>t)}}return new Uint8Array(n)};function St(e){let t="";for(let n=0;n<e.length;n+=3){let i=0,r=0;for(let t=n,o=Math.min(n+3,e.length);t<o;t++)i|=e[t]<<8*(o-t-1),r+=8;const o=Math.ceil(r/6);i<<=6*o-r;for(let e=1;e<=o;e++){const n=6*(o-e);t+=bt[(i&63<<n)>>n]}t+="==".slice(0,4-o)}return t}const wt=e=>"function"==typeof Blob&&e instanceof Blob?async function(e){const t=await function(e){return new Promise(((t,n)=>{const i=new FileReader;i.onloadend=()=>{if(2!==i.readyState)return n(new Error("Reader aborted too early"));const e=i.result??"",r=e.indexOf(","),o=r>-1?r+1:e.length;t(e.substring(o))},i.onabort=()=>n(new Error("Read aborted")),i.onerror=()=>n(i.error),i.readAsDataURL(e)}))}(e),n=yt(t);return new Uint8Array(n)}(e):async function(e){let t=new Uint8Array(0);const n=e.getReader();let i=!1;for(;!i;){const{done:e,value:r}=await n.read();if(r){const e=t;t=new Uint8Array(e.length+r.length),t.set(e),t.set(r,e.length)}i=e}return t}(e),Ct=e=>{if("string"==typeof e){let t=e.length;for(let n=t-1;n>=0;n--){const i=e.charCodeAt(n);i>127&&i<=2047?t++:i>2047&&i<=65535&&(t+=2),i>=56320&&i<=57343&&n--}return t}if("number"==typeof e.byteLength)return e.byteLength;if("number"==typeof e.size)return e.size;throw new Error(`Body Length computation failed for ${e}`)};var kt=n(1206),Et=n.n(kt);const _t=({serviceId:e,clientVersion:t})=>async()=>{const n="undefined"!=typeof window&&window?.navigator?.userAgent?Et().parse(window.navigator.userAgent):void 0,i=[["aws-sdk-js",t],[`os/${n?.os?.name||"other"}`,n?.os?.version],["lang/js"],["md/browser",`${n?.browser?.name??"unknown"}_${n?.browser?.version??"unknown"}`]];return e&&i.push([`api/${e}`,t]),i};var Tt=n(470);const xt=JSON.parse('{"partitions":[{"id":"aws","outputs":{"dnsSuffix":"amazonaws.com","dualStackDnsSuffix":"api.aws","name":"aws","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^(us|eu|ap|sa|ca|me|af)\\\\-\\\\w+\\\\-\\\\d+$","regions":{"af-south-1":{"description":"Africa (Cape Town)"},"ap-east-1":{"description":"Asia Pacific (Hong Kong)"},"ap-northeast-1":{"description":"Asia Pacific (Tokyo)"},"ap-northeast-2":{"description":"Asia Pacific (Seoul)"},"ap-northeast-3":{"description":"Asia Pacific (Osaka)"},"ap-south-1":{"description":"Asia Pacific (Mumbai)"},"ap-south-2":{"description":"Asia Pacific (Hyderabad)"},"ap-southeast-1":{"description":"Asia Pacific (Singapore)"},"ap-southeast-2":{"description":"Asia Pacific (Sydney)"},"ap-southeast-3":{"description":"Asia Pacific (Jakarta)"},"aws-global":{"description":"AWS Standard global region"},"ca-central-1":{"description":"Canada (Central)"},"eu-central-1":{"description":"Europe (Frankfurt)"},"eu-central-2":{"description":"Europe (Zurich)"},"eu-north-1":{"description":"Europe (Stockholm)"},"eu-south-1":{"description":"Europe (Milan)"},"eu-south-2":{"description":"Europe (Spain)"},"eu-west-1":{"description":"Europe (Ireland)"},"eu-west-2":{"description":"Europe (London)"},"eu-west-3":{"description":"Europe (Paris)"},"me-central-1":{"description":"Middle East (UAE)"},"me-south-1":{"description":"Middle East (Bahrain)"},"sa-east-1":{"description":"South America (Sao Paulo)"},"us-east-1":{"description":"US East (N. Virginia)"},"us-east-2":{"description":"US East (Ohio)"},"us-west-1":{"description":"US West (N. California)"},"us-west-2":{"description":"US West (Oregon)"}}},{"id":"aws-cn","outputs":{"dnsSuffix":"amazonaws.com.cn","dualStackDnsSuffix":"api.amazonwebservices.com.cn","name":"aws-cn","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^cn\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-cn-global":{"description":"AWS China global region"},"cn-north-1":{"description":"China (Beijing)"},"cn-northwest-1":{"description":"China (Ningxia)"}}},{"id":"aws-us-gov","outputs":{"dnsSuffix":"amazonaws.com","dualStackDnsSuffix":"api.aws","name":"aws-us-gov","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^us\\\\-gov\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-us-gov-global":{"description":"AWS GovCloud (US) global region"},"us-gov-east-1":{"description":"AWS GovCloud (US-East)"},"us-gov-west-1":{"description":"AWS GovCloud (US-West)"}}},{"id":"aws-iso","outputs":{"dnsSuffix":"c2s.ic.gov","dualStackDnsSuffix":"c2s.ic.gov","name":"aws-iso","supportsDualStack":false,"supportsFIPS":true},"regionRegex":"^us\\\\-iso\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-iso-global":{"description":"AWS ISO (US) global region"},"us-iso-east-1":{"description":"US ISO East"},"us-iso-west-1":{"description":"US ISO WEST"}}},{"id":"aws-iso-b","outputs":{"dnsSuffix":"sc2s.sgov.gov","dualStackDnsSuffix":"sc2s.sgov.gov","name":"aws-iso-b","supportsDualStack":false,"supportsFIPS":true},"regionRegex":"^us\\\\-isob\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-iso-b-global":{"description":"AWS ISOB (US) global region"},"us-isob-east-1":{"description":"US ISOB East (Ohio)"}}}],"version":"1.1"}'),{partitions:It}=xt,Mt=It.find((e=>"aws"===e.id)),At=e=>{for(const t of It){const{regions:n,outputs:i}=t;for(const[t,r]of Object.entries(n))if(t===e)return{...i,...r}}for(const t of It){const{regionRegex:n,outputs:i}=t;if(new RegExp(n).test(e))return{...i}}if(!Mt)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...Mt.outputs}},Pt="endpoints";function Ot(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${Ot(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(Ot).join(", ")})`:JSON.stringify(e,null,2)}class Rt extends Error{constructor(e){super(e),this.name="EndpointError"}}const Nt=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),Dt=e=>Nt.test(e)||e.startsWith("[")&&e.endsWith("]"),Ft=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Lt=(e,t=!1)=>{if(!t)return Ft.test(e);const n=e.split(".");for(const e of n)if(!Lt(e))return!1;return!0},Bt=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!Bt(t))return!1;return!0}return!(!Lt(e)||e.length<3||e.length>63||e!==e.toLowerCase()||Dt(e))},Ut=e=>{const t=e.split(":");if(t.length<6)return null;const[n,i,r,o,s,...a]=t;return"arn"!==n||""===i||""===r||""===a[0]?null:{partition:i,service:r,region:o,accountId:s,resourceId:a[0].includes("/")?a[0].split("/"):a}},Vt=(e,t)=>e===t,jt=(e,t)=>(e=>{const t=e.split("."),n=[];for(const i of t){const t=i.indexOf("[");if(-1!==t){if(i.indexOf("]")!==i.length-1)throw new Rt(`Path: '${e}' does not end with ']'`);const r=i.slice(t+1,-1);if(Number.isNaN(parseInt(r)))throw new Rt(`Invalid array index: '${r}' in path: '${e}'`);0!==t&&n.push(i.slice(0,t)),n.push(r)}else n.push(i)}return n})(t).reduce(((n,i)=>{if("object"!=typeof n)throw new Rt(`Index '${i}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(n)?n[parseInt(i)]:n[i]}),e),zt=e=>null!=e,$t=e=>!e;var Wt;!function(e){e.HTTP="http",e.HTTPS="https"}(Wt||(Wt={}));const Ht={[Wt.HTTP]:80,[Wt.HTTPS]:443},qt=e=>{const t=(()=>{try{if(e instanceof URL)return e;if("object"==typeof e&&"hostname"in e){const{hostname:t,port:n,protocol:i="",path:r="",query:o={}}=e,s=new URL(`${i}//${t}${n?`:${n}`:""}${r}`);return s.search=Object.entries(o).map((([e,t])=>`${e}=${t}`)).join("&"),s}return new URL(e)}catch(e){return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const n=t.href,{host:i,hostname:r,pathname:o,protocol:s,search:a}=t;if(a)return null;const l=s.slice(0,-1);if(!Object.values(Wt).includes(l))return null;const c=Dt(r);return{scheme:l,authority:`${i}${n.includes(`${i}:${Ht[l]}`)||"string"==typeof e&&e.includes(`${i}:${Ht[l]}`)?`:${Ht[l]}`:""}`,path:o,normalizedPath:o.endsWith("/")?o:`${o}/`,isIp:c}},Kt=(e,t)=>e===t,Gt=(e,t,n,i)=>t>=n||e.length<n?null:i?e.substring(e.length-n,e.length-t):e.substring(t,n),Jt=e=>encodeURIComponent(e).replace(/[!*'()]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),Qt=(e,t)=>{const n=[],i={...t.endpointParams,...t.referenceRecord};let r=0;for(;r<e.length;){const t=e.indexOf("{",r);if(-1===t){n.push(e.slice(r));break}n.push(e.slice(r,t));const o=e.indexOf("}",t);if(-1===o){n.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[o+1]&&(n.push(e.slice(t+1,o)),r=o+2);const s=e.substring(t+1,o);if(s.includes("#")){const[e,t]=s.split("#");n.push(jt(i[e],t))}else n.push(i[s]);r=o+1}return n.join("")},Yt=(e,t,n)=>{if("string"==typeof e)return Qt(e,n);if(e.fn)return Zt(e,n);if(e.ref)return(({ref:e},t)=>({...t.endpointParams,...t.referenceRecord}[e]))(e,n);throw new Rt(`'${t}': ${String(e)} is not a string, function or reference.`)},Zt=({fn:e,argv:t},n)=>{const i=t.map((e=>["boolean","number"].includes(typeof e)?e:Yt(e,"arg",n)));return e.split(".").reduce(((e,t)=>e[t]),o)(...i)},Xt=({assign:e,...t},n)=>{if(e&&e in n.referenceRecord)throw new Rt(`'${e}' is already defined in Reference Record.`);const i=Zt(t,n);return n.logger?.debug?.(Pt,`evaluateCondition: ${Ot(t)} = ${Ot(i)}`),{result:""===i||!!i,...null!=e&&{toAssign:{name:e,value:i}}}},en=(e=[],t)=>{const n={};for(const i of e){const{result:e,toAssign:r}=Xt(i,{...t,referenceRecord:{...t.referenceRecord,...n}});if(!e)return{result:e};r&&(n[r.name]=r.value,t.logger?.debug?.(Pt,`assign: ${r.name} := ${Ot(r.value)}`))}return{result:!0,referenceRecord:n}},tn=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>({...e,[n]:i.map((e=>{const i=Yt(e,"Header value entry",t);if("string"!=typeof i)throw new Rt(`Header '${n}' value '${i}' is not a string`);return i}))})),{}),nn=(e,t)=>{if(Array.isArray(e))return e.map((e=>nn(e,t)));switch(typeof e){case"string":return Qt(e,t);case"object":if(null===e)throw new Rt(`Unexpected endpoint property: ${e}`);return rn(e,t);case"boolean":return e;default:throw new Rt("Unexpected endpoint property type: "+typeof e)}},rn=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>({...e,[n]:nn(i,t)})),{}),on=(e,t)=>{const n=Yt(e,"Endpoint URL",t);if("string"==typeof n)try{return new URL(n)}catch(e){throw console.error(`Failed to construct URL with ${n}`,e),e}throw new Rt("Endpoint URL must be a string, got "+typeof n)},sn=(e,t)=>{const{conditions:n,endpoint:i}=e,{result:r,referenceRecord:o}=en(n,t);if(!r)return;const s={...t,referenceRecord:{...t.referenceRecord,...o}},{url:a,properties:l,headers:c}=i;return t.logger?.debug?.(Pt,`Resolving endpoint from template: ${Ot(i)}`),{...null!=c&&{headers:tn(c,s)},...null!=l&&{properties:rn(l,s)},url:on(a,s)}},an=(e,t)=>{const{conditions:n,error:i}=e,{result:r,referenceRecord:o}=en(n,t);if(r)throw new Rt(Yt(i,"Error",{...t,referenceRecord:{...t.referenceRecord,...o}}))},ln=(e,t)=>{const{conditions:n,rules:i}=e,{result:r,referenceRecord:o}=en(n,t);if(r)return cn(i,{...t,referenceRecord:{...t.referenceRecord,...o}})},cn=(e,t)=>{for(const n of e)if("endpoint"===n.type){const e=sn(n,t);if(e)return e}else if("error"===n.type)an(n,t);else{if("tree"!==n.type)throw new Rt(`Unknown endpoint rule: ${n}`);{const e=ln(n,t);if(e)return e}}throw new Rt("Rules evaluation failed")},dn="fn",un="argv",hn="ref",pn="String",fn="PartitionResult",mn="tree",gn="error",vn="endpoint",bn={required:!0,default:!1,type:"Boolean"},yn={[hn]:"Endpoint"},Sn={[dn]:"booleanEquals",[un]:[{[hn]:"UseFIPS"},!0]},wn={[dn]:"booleanEquals",[un]:[{[hn]:"UseDualStack"},!0]},Cn={},kn={[dn]:"booleanEquals",[un]:[!0,{[dn]:"getAttr",[un]:[{[hn]:fn},"supportsFIPS"]}]},En={[dn]:"booleanEquals",[un]:[!0,{[dn]:"getAttr",[un]:[{[hn]:fn},"supportsDualStack"]}]},_n=[yn],Tn=[Sn],xn=[wn],In={version:"1.0",parameters:{Region:{required:!0,type:pn},UseDualStack:bn,UseFIPS:bn,Endpoint:{required:!1,type:pn}},rules:[{conditions:[{[dn]:"aws.partition",[un]:[{[hn]:"Region"}],assign:fn}],type:mn,rules:[{conditions:[{[dn]:"isSet",[un]:_n},{[dn]:"parseURL",[un]:_n,assign:"url"}],type:mn,rules:[{conditions:Tn,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:gn},{type:mn,rules:[{conditions:xn,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:gn},{endpoint:{url:yn,properties:Cn,headers:Cn},type:vn}]}]},{conditions:[Sn,wn],type:mn,rules:[{conditions:[kn,En],type:mn,rules:[{endpoint:{url:"https://messaging-chime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Cn,headers:Cn},type:vn}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:gn}]},{conditions:Tn,type:mn,rules:[{conditions:[kn],type:mn,rules:[{type:mn,rules:[{endpoint:{url:"https://messaging-chime-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Cn,headers:Cn},type:vn}]}]},{error:"FIPS is enabled but this partition does not support FIPS",type:gn}]},{conditions:xn,type:mn,rules:[{conditions:[En],type:mn,rules:[{endpoint:{url:"https://messaging-chime.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Cn,headers:Cn},type:vn}]},{error:"DualStack is enabled but this partition does not support DualStack",type:gn}]},{endpoint:{url:"https://messaging-chime.{Region}.{PartitionResult#dnsSuffix}",properties:Cn,headers:Cn},type:vn}]}]},Mn=(e,t={})=>((e,t)=>{const{endpointParams:n,logger:i}=t,{parameters:r,rules:o}=e;t.logger?.debug?.(Pt,`Initial EndpointParams: ${Ot(n)}`);const s=Object.entries(r).filter((([,e])=>null!=e.default)).map((([e,t])=>[e,t.default]));if(s.length>0)for(const[e,t]of s)n[e]=n[e]??t;const a=Object.entries(r).filter((([,e])=>e.required)).map((([e])=>e));for(const e of a)if(null==n[e])throw new Rt(`Missing required parameter: '${e}'`);const l=cn(o,{endpointParams:n,logger:i,referenceRecord:{}});if(t.endpointParams?.Endpoint)try{const e=new URL(t.endpointParams.Endpoint),{protocol:n,port:i}=e;l.url.protocol=n,l.url.port=i}catch(e){}return t.logger?.debug?.(Pt,`Resolved endpoint: ${Ot(l)}`),l})(In,{endpointParams:e,logger:t.logger}),An=["in-region","cross-region","mobile","standard","legacy"];class Pn extends ze{constructor(e){var t;const n=(e=>{const{region:t,useFipsEndpoint:n}=e;if(!t)throw new Error("Region is missing");return{...e,region:async()=>{if("string"==typeof t)return a(t);const e=await t();return a(e)},useFipsEndpoint:async()=>{const e="string"==typeof t?t:await t();return!!s(e)||("function"!=typeof n?Promise.resolve(!!n):n())}}})((t=(e=>{const t=(({defaultsMode:e}={})=>Z((async()=>{const t="function"==typeof e?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve((()=>{const e=("undefined"!=typeof window&&window?.navigator?.userAgent?Et().parse(window.navigator.userAgent):void 0)?.platform?.type;return"tablet"===e||"mobile"===e})()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${An.join(", ")}, got ${t}`)}})))(e),n=()=>t().then(lt),i=(e=>({apiVersion:"2021-05-15",base64Decoder:e?.base64Decoder??yt,base64Encoder:e?.base64Encoder??St,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Mn,logger:e?.logger??new Be,serviceId:e?.serviceId??"Chime SDK Messaging",urlParser:e?.urlParser??w}))(e);return{...i,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??Ct,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??_t({serviceId:i.serviceId,clientVersion:"3.245.0"}),maxAttempts:e?.maxAttempts??3,region:e?.region??(()=>Promise.reject("Region is missing")),requestHandler:e?.requestHandler??new gt(n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||"STANDARD"),sha256:e?.sha256??ft.Sha256,streamCollector:e?.streamCollector??wt,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(!1)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(!1)),utf8Decoder:e?.utf8Decoder??Tt.fromUtf8,utf8Encoder:e?.utf8Encoder??Tt.toUtf8}})(e),{...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"chime"})),i=(e=>{const{retryStrategy:t}=e,n=S(e.maxAttempts??3);return{...e,maxAttempts:n,retryStrategy:async()=>t||(await S(e.retryMode)()===x.ADAPTIVE?new L(n):new F(n))}})((e=>{const t=e.tls??!0,{endpoint:n}=e,i=null!=n?async()=>(e=>"object"==typeof e?"url"in e?w(e.url):e:w(e))(await S(n)()):void 0,r=!!n;return{...e,endpoint:i,tls:t,isCustomEndpoint:r,useDualstackEndpoint:S(e.useDualstackEndpoint??!1),useFipsEndpoint:S(e.useFipsEndpoint??!1)}})(n)),r=(e=>{const t=e.credentials?"function"==typeof(o=e.credentials)?Z(o,(e=>void 0!==e.expiration&&e.expiration.getTime()-Date.now()<3e5),(e=>void 0!==e.expiration)):S(o):e.credentialDefaultProvider(e),{signingEscapePath:n=!0,systemClockOffset:i=e.systemClockOffset||0,sha256:r}=e;var o;let s;return s=e.signer?S(e.signer):e.regionInfoProvider?()=>S(e.region)().then((async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t])).then((([i,o])=>{const{signingRegion:s,signingService:a}=i;e.signingRegion=e.signingRegion||s||o,e.signingName=e.signingName||a||e.serviceId;const l={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:r,uriEscapePath:n};return new(e.signerConstructor||Te)(l)})):async i=>{const o=(i=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await S(e.region)(),properties:{}},i)).signingRegion,s=i.signingName;e.signingRegion=e.signingRegion||o,e.signingName=e.signingName||s||e.serviceId;const a={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:r,uriEscapePath:n};return new(e.signerConstructor||Te)(a)},{...e,systemClockOffset:i,signingEscapePath:n,credentials:t,signer:s}})(i),o=(u=r,{...u,customUserAgent:"string"==typeof u.customUserAgent?[[u.customUserAgent]]:u.customUserAgent});var u,h;super(o),this.config=o,this.middlewareStack.use((e=>({applyToStack:t=>{t.add((e=>(t,n)=>async i=>{let r=await e.retryStrategy();const o=await e.maxAttempts();if(!(e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess)(r))return r?.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",r.mode]]),r.retry(t,i);{let e=await r.acquireInitialRetryToken(n.partition_id),a=new Error,c=0,d=0;const{request:u}=i;for(l.isInstance(u)&&(u.headers["amz-sdk-invocation-id"]=q());;)try{l.isInstance(u)&&(u.headers["amz-sdk-request"]=`attempt=${c+1}; max=${o}`);const{response:n,output:s}=await t(i);return r.recordSuccess(e),s.$metadata.attempts=c+1,s.$metadata.totalRetryDelay=d,{response:n,output:s}}catch(t){const n=K(t);a=(s=t)instanceof Error?s:s instanceof Object?Object.assign(new Error,s):"string"==typeof s?new Error(s):new Error(`AWS SDK error wrapper for ${s}`);try{e=await r.refreshRetryTokenForRetry(e,n)}catch(e){throw a.$metadata||(a.$metadata={}),a.$metadata.attempts=c+1,a.$metadata.totalRetryDelay=d,a}c=e.getRetryCount();const i=e.getRetryDelay();d+=i,await new Promise((e=>setTimeout(e,i)))}}var s})(e),J)}}))(this.config)),this.middlewareStack.use((e=>({applyToStack:t=>{var n;t.add((n=e.bodyLengthChecker,e=>async t=>{const i=t.request;if(l.isInstance(i)){const{body:e,headers:t}=i;if(e&&-1===Object.keys(t).map((e=>e.toLowerCase())).indexOf(c))try{const t=n(e);i.headers={...i.headers,[c]:String(t)}}catch(e){}}return e({...t,request:i})}),d)}}))(this.config)),this.middlewareStack.use((e=>({applyToStack:t=>{t.add((e=>t=>async n=>{if(!l.isInstance(n.request))return t(n);const{request:i}=n,{handlerProtocol:r=""}=e.requestHandler.metadata||{};return r.indexOf("h2")>=0&&!i.headers[":authority"]?(delete i.headers.host,i.headers[":authority"]=""):i.headers.host||(i.headers.host=i.hostname),t(n)})(e),C)}}))(this.config)),this.middlewareStack.use((this.config,{applyToStack:e=>{e.add(((e,t)=>async n=>{const i=await e(n),{clientName:r,commandName:o,logger:s,inputFilterSensitiveLog:a,outputFilterSensitiveLog:l,dynamoDbDocumentClientOptions:c={}}=t,{overrideInputFilterSensitiveLog:d,overrideOutputFilterSensitiveLog:u}=c;if(!s)return i;if("function"==typeof s.info){const{$metadata:e,...t}=i.output;s.info({clientName:r,commandName:o,input:(d??a)(n.input),output:(u??l)(t),metadata:e})}return i}),k)}})),this.middlewareStack.use((e=>({applyToStack:t=>{t.add((e=>t=>async n=>{const{request:i}=n;if(!l.isInstance(i)||"node"!==e.runtime||i.headers.hasOwnProperty(_))return t(n);const r=E.env.AWS_LAMBDA_FUNCTION_NAME,o=E.env._X_AMZN_TRACE_ID,s=e=>"string"==typeof e&&e.length>0;return s(r)&&s(o)&&(i.headers[_]=o),t({...n,request:i})})(e),T)}}))(this.config)),this.middlewareStack.use((e=>({applyToStack:t=>{t.addRelativeTo((e=>(t,n)=>async function(i){if(!l.isInstance(i.request))return t(i);const r=n.endpointV2?.properties?.authSchemes?.[0],o="sigv4a"===r?.name?r?.signingRegionSet?.join(","):void 0,s=await e.signer(r),a=await t({...i,request:await s.sign(i.request,{signingDate:Me(e.systemClockOffset),signingRegion:o||n.signing_region,signingService:n.signing_service})}).catch((t=>{const n=t.ServerTime??Pe(t.$response);throw n&&(e.systemClockOffset=Ae(n,e.systemClockOffset)),t})),c=Pe(a.response);return c&&(e.systemClockOffset=Ae(c,e.systemClockOffset)),a})(e),Oe)}}))(this.config)),this.middlewareStack.use((h=this.config,{applyToStack:e=>{var t;e.add((t=h,(e,n)=>async i=>{const{request:r}=i;if(!l.isInstance(r))return e(i);const{headers:o}=r,s=n?.userAgent?.map(Fe)||[],a=(await t.defaultUserAgentProvider()).map(Fe),c=t?.customUserAgent?.map(Fe)||[],d=[...a,...s,...c].join(" "),u=[...a.filter((e=>e.startsWith("aws-sdk-"))),...c].join(" ");return"browser"!==t.runtime?(u&&(o[Ne]=o[Ne]?`${o[Re]} ${u}`:u),o[Re]=d):o[Ne]=d,e({...i,request:r})}),Le)}}))}destroy(){super.destroy()}}class On extends rt{constructor(e){super(e),Object.setPrototypeOf(this,On.prototype)}}var Rn,Nn,Dn,Fn,Ln,Bn,Un,Vn,jn,zn,$n,Wn,Hn,qn;!function(e){e.ALL="ALL",e.FILTERED="FILTERED",e.NONE="NONE"}(Rn||(Rn={})),function(e){e.DEFAULT="DEFAULT",e.HIDDEN="HIDDEN"}(Nn||(Nn={})),function(e){e.AccessDenied="AccessDenied",e.BadRequest="BadRequest",e.Conflict="Conflict",e.Forbidden="Forbidden",e.NotFound="NotFound",e.PhoneNumberAssociationsExist="PhoneNumberAssociationsExist",e.PreconditionFailed="PreconditionFailed",e.ResourceLimitExceeded="ResourceLimitExceeded",e.ServiceFailure="ServiceFailure",e.ServiceUnavailable="ServiceUnavailable",e.Throttled="Throttled",e.Throttling="Throttling",e.Unauthorized="Unauthorized",e.Unprocessable="Unprocessable",e.VoiceConnectorGroupAssociationsExist="VoiceConnectorGroupAssociationsExist"}(Dn||(Dn={}));class Kn extends On{constructor(e){super({name:"BadRequestException",$fault:"client",...e}),this.name="BadRequestException",this.$fault="client",Object.setPrototypeOf(this,Kn.prototype),this.Code=e.Code,this.Message=e.Message}}class Gn extends On{constructor(e){super({name:"ConflictException",$fault:"client",...e}),this.name="ConflictException",this.$fault="client",Object.setPrototypeOf(this,Gn.prototype),this.Code=e.Code,this.Message=e.Message}}class Jn extends On{constructor(e){super({name:"ForbiddenException",$fault:"client",...e}),this.name="ForbiddenException",this.$fault="client",Object.setPrototypeOf(this,Jn.prototype),this.Code=e.Code,this.Message=e.Message}}class Qn extends On{constructor(e){super({name:"NotFoundException",$fault:"client",...e}),this.name="NotFoundException",this.$fault="client",Object.setPrototypeOf(this,Qn.prototype),this.Code=e.Code,this.Message=e.Message}}class Yn extends On{constructor(e){super({name:"ServiceFailureException",$fault:"server",...e}),this.name="ServiceFailureException",this.$fault="server",Object.setPrototypeOf(this,Yn.prototype),this.Code=e.Code,this.Message=e.Message}}class Zn extends On{constructor(e){super({name:"ServiceUnavailableException",$fault:"server",...e}),this.name="ServiceUnavailableException",this.$fault="server",Object.setPrototypeOf(this,Zn.prototype),this.Code=e.Code,this.Message=e.Message}}class Xn extends On{constructor(e){super({name:"ThrottledClientException",$fault:"client",...e}),this.name="ThrottledClientException",this.$fault="client",Object.setPrototypeOf(this,Xn.prototype),this.Code=e.Code,this.Message=e.Message}}class ei extends On{constructor(e){super({name:"UnauthorizedClientException",$fault:"client",...e}),this.name="UnauthorizedClientException",this.$fault="client",Object.setPrototypeOf(this,ei.prototype),this.Code=e.Code,this.Message=e.Message}}class ti extends On{constructor(e){super({name:"ResourceLimitExceededException",$fault:"client",...e}),this.name="ResourceLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,ti.prototype),this.Code=e.Code,this.Message=e.Message}}!function(e){e.RESTRICTED="RESTRICTED",e.UNRESTRICTED="UNRESTRICTED"}(Fn||(Fn={})),function(e){e.PRIVATE="PRIVATE",e.PUBLIC="PUBLIC"}(Ln||(Ln={})),function(e){e.ASYNC="ASYNC"}(Bn||(Bn={})),function(e){e.ABORT="ABORT",e.CONTINUE="CONTINUE"}(Un||(Un={})),function(e){e.DEFAULT="DEFAULT",e.VOIP="VOIP"}(Vn||(Vn={})),function(e){e.NON_PERSISTENT="NON_PERSISTENT",e.PERSISTENT="PERSISTENT"}(jn||(jn={})),function(e){e.DENIED="DENIED",e.FAILED="FAILED",e.PENDING="PENDING",e.SENT="SENT"}(zn||(zn={})),function(e){e.CONTROL="CONTROL",e.STANDARD="STANDARD"}($n||($n={})),function(e){e.ASCENDING="ASCENDING",e.DESCENDING="DESCENDING"}(Wn||(Wn={})),function(e){e.MEMBERS="MEMBERS"}(Hn||(Hn={})),function(e){e.EQUALS="EQUALS",e.INCLUDES="INCLUDES"}(qn||(qn={}));const ni=e=>({...e}),ii=e=>({...e}),ri=e=>({...e,...e.Name&&{Name:We}}),oi=e=>({...e,...e.InvitedBy&&{InvitedBy:ri(e.InvitedBy)},...e.Members&&{Members:e.Members.map((e=>ri(e)))}}),si=e=>({...e}),ai=e=>({...e}),li=e=>({...e,...e.BatchChannelMemberships&&{BatchChannelMemberships:oi(e.BatchChannelMemberships)}}),ci=e=>({...e}),di=e=>({...e,...e.Name&&{Name:We},...e.Metadata&&{Metadata:We},...e.CreatedBy&&{CreatedBy:ri(e.CreatedBy)}}),ui=e=>({...e,...e.Name&&{Name:We},...e.Metadata&&{Metadata:We}}),hi=e=>({...e,...e.Member&&{Member:ri(e.Member)},...e.CreatedBy&&{CreatedBy:ri(e.CreatedBy)}}),pi=e=>({...e,...e.Member&&{Member:ri(e.Member)}}),fi=e=>({...e}),mi=e=>({...e}),gi=e=>({...e,...e.Name&&{Name:We}}),vi=e=>({...e,...e.Processors&&{Processors:e.Processors.map((e=>gi(e)))},...e.Name&&{Name:We}}),bi=e=>({...e,...e.StringValues&&{StringValues:We}}),yi=e=>({...e,...e.Title&&{Title:We},...e.Body&&{Body:We}}),Si=e=>({...e,...e.Content&&{Content:We},...e.Metadata&&{Metadata:We},...e.PushNotification&&{PushNotification:yi(e.PushNotification)},...e.MessageAttributes&&{MessageAttributes:Object.entries(e.MessageAttributes).reduce(((e,[t,n])=>(e[t]=bi(n),e)),{})}}),wi=e=>({...e,...e.ChannelMessage&&{ChannelMessage:Si(e.ChannelMessage)}}),Ci=e=>({...e}),ki=e=>({...e,...e.Name&&{Name:We},...e.Processors&&{Processors:e.Processors.map((e=>gi(e)))}}),Ei=e=>({...e,...e.InvitedBy&&{InvitedBy:ri(e.InvitedBy)},...e.Member&&{Member:ri(e.Member)}}),_i=e=>({...e,...e.Name&&{Name:We},...e.Metadata&&{Metadata:We}}),Ti=e=>({...e,...e.ChannelSummary&&{ChannelSummary:_i(e.ChannelSummary)}}),xi=e=>({...e,...e.FilterRule&&{FilterRule:We}}),Ii=e=>({...e,...e.PushNotifications&&{PushNotifications:xi(e.PushNotifications)}}),Mi=e=>({...e,...e.Member&&{Member:ri(e.Member)}}),Ai=e=>({...e}),Pi=e=>({...e,...e.Content&&{Content:We},...e.Metadata&&{Metadata:We},...e.Sender&&{Sender:ri(e.Sender)},...e.MessageAttributes&&{MessageAttributes:Object.entries(e.MessageAttributes).reduce(((e,[t,n])=>(e[t]=bi(n),e)),{})}}),Oi=e=>({...e,...e.Content&&{Content:We},...e.Metadata&&{Metadata:We},...e.Sender&&{Sender:ri(e.Sender)},...e.MessageAttributes&&{MessageAttributes:Object.entries(e.MessageAttributes).reduce(((e,[t,n])=>(e[t]=bi(n),e)),{})}}),Ri=e=>({...e,...e.ChannelSummary&&{ChannelSummary:_i(e.ChannelSummary)}}),Ni=e=>({...e,...e.Moderator&&{Moderator:ri(e.Moderator)},...e.CreatedBy&&{CreatedBy:ri(e.CreatedBy)}}),Di=e=>({...e,...e.Moderator&&{Moderator:ri(e.Moderator)}}),Fi=e=>({...e,...e.Key&&{Key:We},...e.Value&&{Value:We}}),Li=e=>({...e,...e.Name&&{Name:We},...e.Metadata&&{Metadata:We},...e.ClientRequestToken&&{ClientRequestToken:We},...e.Tags&&{Tags:e.Tags.map((e=>Fi(e)))},...e.ChannelId&&{ChannelId:We}}),Bi=e=>({...e}),Ui=e=>({...e}),Vi=e=>({...e,...e.Member&&{Member:ri(e.Member)}}),ji=e=>({...e,...e.Processors&&{Processors:e.Processors.map((e=>gi(e)))},...e.Name&&{Name:We},...e.Tags&&{Tags:e.Tags.map((e=>Fi(e)))},...e.ClientRequestToken&&{ClientRequestToken:We}}),zi=e=>({...e}),$i=e=>({...e}),Wi=e=>({...e,...e.Member&&{Member:ri(e.Member)}}),Hi=e=>({...e}),qi=e=>({...e,...e.ChannelModerator&&{ChannelModerator:ri(e.ChannelModerator)}}),Ki=e=>({...e}),Gi=e=>({...e}),Ji=e=>({...e}),Qi=e=>({...e}),Yi=e=>({...e}),Zi=e=>({...e}),Xi=e=>({...e}),er=e=>({...e,...e.Channel&&{Channel:di(e.Channel)}}),tr=e=>({...e}),nr=e=>({...e,...e.ChannelBan&&{ChannelBan:hi(e.ChannelBan)}}),ir=e=>({...e}),rr=e=>({...e,...e.ChannelFlow&&{ChannelFlow:vi(e.ChannelFlow)}}),or=e=>({...e}),sr=e=>({...e,...e.ChannelMembership&&{ChannelMembership:Ei(e.ChannelMembership)}}),ar=e=>({...e}),lr=e=>({...e,...e.ChannelMembership&&{ChannelMembership:Ti(e.ChannelMembership)}}),cr=e=>({...e}),dr=e=>({...e,...e.Channel&&{Channel:Ri(e.Channel)}}),ur=e=>({...e}),hr=e=>({...e,...e.ChannelModerator&&{ChannelModerator:Ni(e.ChannelModerator)}}),pr=e=>({...e}),fr=e=>({...e}),mr=e=>({...e,...e.Member&&{Member:ri(e.Member)},...e.Preferences&&{Preferences:Ii(e.Preferences)}}),gr=e=>({...e}),vr=e=>({...e,...e.ChannelMessage&&{ChannelMessage:Pi(e.ChannelMessage)}}),br=e=>({...e}),yr=e=>({...e}),Sr=e=>({...e}),wr=e=>({...e}),Cr=e=>({...e}),kr=e=>({...e,...e.NextToken&&{NextToken:We}}),Er=e=>({...e,...e.NextToken&&{NextToken:We},...e.ChannelBans&&{ChannelBans:e.ChannelBans.map((e=>pi(e)))}}),_r=e=>({...e,...e.NextToken&&{NextToken:We}}),Tr=e=>({...e,...e.ChannelFlows&&{ChannelFlows:e.ChannelFlows.map((e=>ki(e)))},...e.NextToken&&{NextToken:We}}),xr=e=>({...e,...e.NextToken&&{NextToken:We}}),Ir=e=>({...e,...e.ChannelMemberships&&{ChannelMemberships:e.ChannelMemberships.map((e=>Mi(e)))},...e.NextToken&&{NextToken:We}}),Mr=e=>({...e,...e.NextToken&&{NextToken:We}}),Ar=e=>({...e,...e.ChannelMemberships&&{ChannelMemberships:e.ChannelMemberships.map((e=>Ti(e)))},...e.NextToken&&{NextToken:We}}),Pr=e=>({...e,...e.NextToken&&{NextToken:We}}),Or=e=>({...e,...e.NextToken&&{NextToken:We},...e.ChannelMessages&&{ChannelMessages:e.ChannelMessages.map((e=>Oi(e)))}}),Rr=e=>({...e,...e.NextToken&&{NextToken:We}}),Nr=e=>({...e,...e.NextToken&&{NextToken:We},...e.ChannelModerators&&{ChannelModerators:e.ChannelModerators.map((e=>Di(e)))}}),Dr=e=>({...e,...e.NextToken&&{NextToken:We}}),Fr=e=>({...e,...e.Channels&&{Channels:e.Channels.map((e=>_i(e)))},...e.NextToken&&{NextToken:We}}),Lr=e=>({...e,...e.NextToken&&{NextToken:We}}),Br=e=>({...e,...e.Channels&&{Channels:e.Channels.map((e=>ui(e)))},...e.NextToken&&{NextToken:We}}),Ur=e=>({...e,...e.NextToken&&{NextToken:We}}),Vr=e=>({...e,...e.Channels&&{Channels:e.Channels.map((e=>Ri(e)))},...e.NextToken&&{NextToken:We}}),jr=e=>({...e,...e.NextToken&&{NextToken:We}}),zr=e=>({...e}),$r=e=>({...e,...e.NextToken&&{NextToken:We}}),Wr=e=>({...e}),Hr=e=>({...e,...e.Tags&&{Tags:e.Tags.map((e=>Fi(e)))}}),qr=e=>({...e,...e.Preferences&&{Preferences:Ii(e.Preferences)}}),Kr=e=>({...e,...e.Member&&{Member:ri(e.Member)},...e.Preferences&&{Preferences:Ii(e.Preferences)}}),Gr=e=>({...e}),Jr=e=>({...e}),Qr=e=>({...e}),Yr=e=>({...e,...e.NextToken&&{NextToken:We}}),Zr=e=>({...e,...e.Channels&&{Channels:e.Channels.map((e=>_i(e)))},...e.NextToken&&{NextToken:We}}),Xr=e=>({...e,...e.Content&&{Content:We},...e.Metadata&&{Metadata:We},...e.ClientRequestToken&&{ClientRequestToken:We},...e.PushNotification&&{PushNotification:yi(e.PushNotification)},...e.MessageAttributes&&{MessageAttributes:Object.entries(e.MessageAttributes).reduce(((e,[t,n])=>(e[t]=bi(n),e)),{})}}),eo=e=>({...e}),to=e=>({...e,...e.Tags&&{Tags:e.Tags.map((e=>Fi(e)))}}),no=e=>({...e,...e.TagKeys&&{TagKeys:We}}),io=e=>({...e,...e.Name&&{Name:We},...e.Metadata&&{Metadata:We}}),ro=e=>({...e}),oo=e=>({...e,...e.Processors&&{Processors:e.Processors.map((e=>gi(e)))},...e.Name&&{Name:We}}),so=e=>({...e}),ao=e=>({...e,...e.Content&&{Content:We},...e.Metadata&&{Metadata:We}}),lo=e=>({...e}),co=e=>({...e}),uo=e=>({...e}),ho=dt,po=async(e,t)=>{const n=ho({}),i=e.body;null!=i.Code&&(n.Code=Xe(i.Code)),null!=i.Message&&(n.Message=Xe(i.Message));const r=new Kn({$metadata:is(e),...n});return ot(r,e.body)},fo=async(e,t)=>{const n=ho({}),i=e.body;null!=i.Code&&(n.Code=Xe(i.Code)),null!=i.Message&&(n.Message=Xe(i.Message));const r=new Gn({$metadata:is(e),...n});return ot(r,e.body)},mo=async(e,t)=>{const n=ho({}),i=e.body;null!=i.Code&&(n.Code=Xe(i.Code)),null!=i.Message&&(n.Message=Xe(i.Message));const r=new Jn({$metadata:is(e),...n});return ot(r,e.body)},go=async(e,t)=>{const n=ho({}),i=e.body;null!=i.Code&&(n.Code=Xe(i.Code)),null!=i.Message&&(n.Message=Xe(i.Message));const r=new Qn({$metadata:is(e),...n});return ot(r,e.body)},vo=async(e,t)=>{const n=ho({}),i=e.body;null!=i.Code&&(n.Code=Xe(i.Code)),null!=i.Message&&(n.Message=Xe(i.Message));const r=new ti({$metadata:is(e),...n});return ot(r,e.body)},bo=async(e,t)=>{const n=ho({}),i=e.body;null!=i.Code&&(n.Code=Xe(i.Code)),null!=i.Message&&(n.Message=Xe(i.Message));const r=new Yn({$metadata:is(e),...n});return ot(r,e.body)},yo=async(e,t)=>{const n=ho({}),i=e.body;null!=i.Code&&(n.Code=Xe(i.Code)),null!=i.Message&&(n.Message=Xe(i.Message));const r=new Zn({$metadata:is(e),...n});return ot(r,e.body)},So=async(e,t)=>{const n=ho({}),i=e.body;null!=i.Code&&(n.Code=Xe(i.Code)),null!=i.Message&&(n.Message=Xe(i.Message));const r=new Xn({$metadata:is(e),...n});return ot(r,e.body)},wo=async(e,t)=>{const n=ho({}),i=e.body;null!=i.Code&&(n.Code=Xe(i.Code)),null!=i.Message&&(n.Message=Xe(i.Message));const r=new ei({$metadata:is(e),...n});return ot(r,e.body)},Co=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),ko=(e,t)=>({...null!=e.PushNotifications&&{PushNotifications:Do(e.PushNotifications,t)}}),Eo=(e,t)=>({...null!=e.Content&&{Content:e.Content},...null!=e.MessageAttributes&&{MessageAttributes:Mo(e.MessageAttributes,t)},...null!=e.MessageId&&{MessageId:e.MessageId},...null!=e.Metadata&&{Metadata:e.Metadata},...null!=e.PushNotification&&{PushNotification:No(e.PushNotification,t)},...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId}}),_o=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),To=(e,t)=>({...null!=e.MaximumSubChannels&&{MaximumSubChannels:e.MaximumSubChannels},...null!=e.MinimumMembershipPercentage&&{MinimumMembershipPercentage:e.MinimumMembershipPercentage},...null!=e.TargetMembershipsPerSubChannel&&{TargetMembershipsPerSubChannel:e.TargetMembershipsPerSubChannel}}),xo=(e,t)=>({...null!=e.InvocationType&&{InvocationType:e.InvocationType},...null!=e.ResourceArn&&{ResourceArn:e.ResourceArn}}),Io=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),Mo=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>(null===i||(e[n]=Po(i,t)),e)),{}),Ao=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),Po=(e,t)=>({...null!=e.StringValues&&{StringValues:Ao(e.StringValues)}}),Oo=(e,t)=>({...null!=e.Lambda&&{Lambda:xo(e.Lambda)}}),Ro=(e,t)=>e.filter((e=>null!=e)).map((e=>((e,t)=>({...null!=e.Configuration&&{Configuration:Oo(e.Configuration)},...null!=e.ExecutionOrder&&{ExecutionOrder:e.ExecutionOrder},...null!=e.FallbackAction&&{FallbackAction:e.FallbackAction},...null!=e.Name&&{Name:e.Name}}))(e))),No=(e,t)=>({...null!=e.Body&&{Body:e.Body},...null!=e.Title&&{Title:e.Title},...null!=e.Type&&{Type:e.Type}}),Do=(e,t)=>({...null!=e.AllowNotifications&&{AllowNotifications:e.AllowNotifications},...null!=e.FilterRule&&{FilterRule:e.FilterRule}}),Fo=(e,t)=>e.filter((e=>null!=e)).map((e=>((e,t)=>({...null!=e.Key&&{Key:e.Key},...null!=e.Operator&&{Operator:e.Operator},...null!=e.Values&&{Values:Lo(e.Values,t)}}))(e,t))),Lo=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),Bo=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),Uo=(e,t)=>e.filter((e=>null!=e)).map((e=>((e,t)=>({...null!=e.Key&&{Key:e.Key},...null!=e.Value&&{Value:e.Value}}))(e))),Vo=(e,t)=>({ReadMarkerTimestamp:null!=e.ReadMarkerTimestamp?Ye(it(qe(e.ReadMarkerTimestamp))):void 0,SubChannelId:Xe(e.SubChannelId),Type:Xe(e.Type)}),jo=(e,t)=>({AppInstanceUserMembershipSummary:null!=e.AppInstanceUserMembershipSummary?Vo(e.AppInstanceUserMembershipSummary):void 0,ChannelSummary:null!=e.ChannelSummary?Ho(e.ChannelSummary,t):void 0}),zo=(e,t)=>({PushNotifications:null!=e.PushNotifications?ns(e.PushNotifications,t):void 0}),$o=(e,t)=>({Detail:Xe(e.Detail),Value:Xe(e.Value)}),Wo=(e,t)=>({ChannelSummary:null!=e.ChannelSummary?Ho(e.ChannelSummary,t):void 0}),Ho=(e,t)=>({ChannelArn:Xe(e.ChannelArn),LastMessageTimestamp:null!=e.LastMessageTimestamp?Ye(it(qe(e.LastMessageTimestamp))):void 0,Metadata:Xe(e.Metadata),Mode:Xe(e.Mode),Name:Xe(e.Name),Privacy:Xe(e.Privacy)}),qo=(e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:Ho(e,t))),Ko=(e,t)=>({MaximumSubChannels:Ge(e.MaximumSubChannels),MinimumMembershipPercentage:Ge(e.MinimumMembershipPercentage),TargetMembershipsPerSubChannel:Ge(e.TargetMembershipsPerSubChannel)}),Go=(e,t)=>({Arn:Xe(e.Arn),Name:Xe(e.Name)}),Jo=(e,t)=>({InvocationType:Xe(e.InvocationType),ResourceArn:Xe(e.ResourceArn)}),Qo=(e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:Go(e))),Yo=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>(null===i||(e[n]=Xo(i,t)),e)),{}),Zo=(e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:Xe(e))),Xo=(e,t)=>({StringValues:null!=e.StringValues?Zo(e.StringValues):void 0}),es=(e,t)=>({Lambda:null!=e.Lambda?Jo(e.Lambda):void 0}),ts=(e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({Configuration:null!=e.Configuration?es(e.Configuration):void 0,ExecutionOrder:Ge(e.ExecutionOrder),FallbackAction:Xe(e.FallbackAction),Name:Xe(e.Name)}))(e))),ns=(e,t)=>({AllowNotifications:Xe(e.AllowNotifications),FilterRule:Xe(e.FilterRule)}),is=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),rs=(e=new Uint8Array,t)=>e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array),os=e=>!(null==e||""===e||Object.getOwnPropertyNames(e).includes("length")&&0==e.length||Object.getOwnPropertyNames(e).includes("size")&&0==e.size),ss=(e,t)=>((e,t)=>rs(e,t).then((e=>t.utf8Encoder(e))))(e,t).then((e=>e.length?JSON.parse(e):{})),as=async(e,t)=>{const n=await ss(e,t);return n.message=n.message??n.Message,n},ls=(e,t)=>{const n=e=>{let t=e;return"number"==typeof t&&(t=t.toString()),t.indexOf(",")>=0&&(t=t.split(",")[0]),t.indexOf(":")>=0&&(t=t.split(":")[0]),t.indexOf("#")>=0&&(t=t.split("#")[1]),t},i=(r=e.headers,Object.keys(r).find((e=>e.toLowerCase()==="x-amzn-errortype".toLowerCase())));var r;return void 0!==i?n(e.headers[i]):void 0!==t.code?n(t.code):void 0!==t.__type?n(t.__type):void 0};class cs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,cs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"AssociateChannelFlowCommand",inputFilterSensitiveLog:ii,outputFilterSensitiveLog:e=>e},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let a,c=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/channel-flow`;return c=pt(c,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=JSON.stringify({...null!=e.ChannelFlowArn&&{ChannelFlowArn:e.ChannelFlowArn}}),new l({protocol:i,hostname:n,port:r,method:"PUT",headers:s,path:c,body:a})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await go(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)});return await rs(e.body,t),n})(e,t)}}class ds extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,ds.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"BatchCreateChannelMembershipCommand",inputFilterSensitiveLog:si,outputFilterSensitiveLog:li},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/memberships`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const c=ho({operation:[,"batch-create"]});let d;return d=JSON.stringify({...null!=e.MemberArns&&{MemberArns:Io(e.MemberArns)},...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId},...null!=e.Type&&{Type:e.Type}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:s,path:a,query:c,body:d})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await go(n);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await vo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.BatchChannelMemberships&&(n.BatchChannelMemberships=((e,t)=>({ChannelArn:Xe(e.ChannelArn),InvitedBy:null!=e.InvitedBy?Go(e.InvitedBy):void 0,Members:null!=e.Members?Qo(e.Members):void 0,SubChannelId:Xe(e.SubChannelId),Type:Xe(e.Type)}))(i.BatchChannelMemberships)),null!=i.Errors&&(n.Errors=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({ErrorCode:Xe(e.ErrorCode),ErrorMessage:Xe(e.ErrorMessage),MemberArn:Xe(e.MemberArn)}))(e))))(i.Errors)),n})(e,t)}}class us extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,us.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ChannelFlowCallbackCommand",inputFilterSensitiveLog:wi,outputFilterSensitiveLog:Ci},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint();let s=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}`;s=pt(s,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const a=ho({operation:[,"channel-flow-callback"]});let c;return c=JSON.stringify({CallbackId:e.CallbackId??q(),...null!=e.ChannelMessage&&{ChannelMessage:Eo(e.ChannelMessage,t)},...null!=e.DeleteResource&&{DeleteResource:e.DeleteResource}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:{"content-type":"application/json"},path:s,query:a,body:c})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.CallbackId&&(n.CallbackId=Xe(i.CallbackId)),null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),n})(e,t)}}class hs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,hs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"CreateChannelBanCommand",inputFilterSensitiveLog:Ui,outputFilterSensitiveLog:Vi},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let a,c=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/bans`;return c=pt(c,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=JSON.stringify({...null!=e.MemberArn&&{MemberArn:e.MemberArn}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:s,path:c,body:a})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(201!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await vo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.Member&&(n.Member=Go(i.Member)),n})(e,t)}}class ps extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,ps.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"CreateChannelCommand",inputFilterSensitiveLog:Li,outputFilterSensitiveLog:Bi},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer}),a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels`;let c;return c=JSON.stringify({...null!=e.AppInstanceArn&&{AppInstanceArn:e.AppInstanceArn},...null!=e.ChannelId&&{ChannelId:e.ChannelId},ClientRequestToken:e.ClientRequestToken??q(),...null!=e.ElasticChannelConfiguration&&{ElasticChannelConfiguration:To(e.ElasticChannelConfiguration)},...null!=e.MemberArns&&{MemberArns:Co(e.MemberArns)},...null!=e.Metadata&&{Metadata:e.Metadata},...null!=e.Mode&&{Mode:e.Mode},...null!=e.ModeratorArns&&{ModeratorArns:_o(e.ModeratorArns)},...null!=e.Name&&{Name:e.Name},...null!=e.Privacy&&{Privacy:e.Privacy},...null!=e.Tags&&{Tags:Uo(e.Tags)}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:s,path:a,body:c})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(201!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await vo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),n})(e,t)}}class fs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,fs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"CreateChannelFlowCommand",inputFilterSensitiveLog:ji,outputFilterSensitiveLog:zi},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channel-flows`;let a;return a=JSON.stringify({...null!=e.AppInstanceArn&&{AppInstanceArn:e.AppInstanceArn},...null!=e.ClientRequestToken&&{ClientRequestToken:e.ClientRequestToken},...null!=e.Name&&{Name:e.Name},...null!=e.Processors&&{Processors:Ro(e.Processors)},...null!=e.Tags&&{Tags:Uo(e.Tags)}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:{"content-type":"application/json"},path:s,body:a})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(201!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await vo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelFlowArn&&(n.ChannelFlowArn=Xe(i.ChannelFlowArn)),n})(e,t)}}class ms extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,ms.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"CreateChannelMembershipCommand",inputFilterSensitiveLog:$i,outputFilterSensitiveLog:Wi},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let a,c=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/memberships`;return c=pt(c,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=JSON.stringify({...null!=e.MemberArn&&{MemberArn:e.MemberArn},...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId},...null!=e.Type&&{Type:e.Type}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:s,path:c,body:a})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(201!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await go(n);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await vo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.Member&&(n.Member=Go(i.Member)),null!=i.SubChannelId&&(n.SubChannelId=Xe(i.SubChannelId)),n})(e,t)}}class gs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,gs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"CreateChannelModeratorCommand",inputFilterSensitiveLog:Hi,outputFilterSensitiveLog:qi},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let a,c=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/moderators`;return c=pt(c,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=JSON.stringify({...null!=e.ChannelModeratorArn&&{ChannelModeratorArn:e.ChannelModeratorArn}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:s,path:c,body:a})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(201!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await vo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.ChannelModerator&&(n.ChannelModerator=Go(i.ChannelModerator)),n})(e,t)}}class vs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,vs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelBanCommand",inputFilterSensitiveLog:Gi,outputFilterSensitiveLog:e=>e},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/bans/{MemberArn}`;return a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1),new l({protocol:i,hostname:n,port:r,method:"DELETE",headers:s,path:a,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(204!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)});return await rs(e.body,t),n})(e,t)}}class bs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,bs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelCommand",inputFilterSensitiveLog:Ki,outputFilterSensitiveLog:e=>e},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const c=ho({"sub-channel-id":[,e.SubChannelId]});return new l({protocol:i,hostname:n,port:r,method:"DELETE",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(204!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)});return await rs(e.body,t),n})(e,t)}}class ys extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,ys.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelFlowCommand",inputFilterSensitiveLog:Ji,outputFilterSensitiveLog:e=>e},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint();let s=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channel-flows/{ChannelFlowArn}`;return s=pt(s,e,"ChannelFlowArn",(()=>e.ChannelFlowArn),"{ChannelFlowArn}",!1),new l({protocol:i,hostname:n,port:r,method:"DELETE",headers:{},path:s,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(204!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)});return await rs(e.body,t),n})(e,t)}}class Ss extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Ss.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelMembershipCommand",inputFilterSensitiveLog:Qi,outputFilterSensitiveLog:e=>e},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/memberships/{MemberArn}`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1);const c=ho({"sub-channel-id":[,e.SubChannelId]});return new l({protocol:i,hostname:n,port:r,method:"DELETE",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(204!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)});return await rs(e.body,t),n})(e,t)}}class ws extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,ws.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelMessageCommand",inputFilterSensitiveLog:Yi,outputFilterSensitiveLog:e=>e},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/messages/{MessageId}`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"MessageId",(()=>e.MessageId),"{MessageId}",!1);const c=ho({"sub-channel-id":[,e.SubChannelId]});return new l({protocol:i,hostname:n,port:r,method:"DELETE",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(204!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)});return await rs(e.body,t),n})(e,t)}}class Cs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Cs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelModeratorCommand",inputFilterSensitiveLog:Zi,outputFilterSensitiveLog:e=>e},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/moderators/{ChannelModeratorArn}`;return a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"ChannelModeratorArn",(()=>e.ChannelModeratorArn),"{ChannelModeratorArn}",!1),new l({protocol:i,hostname:n,port:r,method:"DELETE",headers:s,path:a,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(204!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)});return await rs(e.body,t),n})(e,t)}}class ks extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,ks.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelBanCommand",inputFilterSensitiveLog:tr,outputFilterSensitiveLog:nr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/bans/{MemberArn}`;return a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1),new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await go(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelBan&&(n.ChannelBan=((e,t)=>({ChannelArn:Xe(e.ChannelArn),CreatedBy:null!=e.CreatedBy?Go(e.CreatedBy):void 0,CreatedTimestamp:null!=e.CreatedTimestamp?Ye(it(qe(e.CreatedTimestamp))):void 0,Member:null!=e.Member?Go(e.Member):void 0}))(i.ChannelBan)),n})(e,t)}}class Es extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Es.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelCommand",inputFilterSensitiveLog:Xi,outputFilterSensitiveLog:er},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}`;return a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.Channel&&(n.Channel=((e,t)=>({ChannelArn:Xe(e.ChannelArn),ChannelFlowArn:Xe(e.ChannelFlowArn),CreatedBy:null!=e.CreatedBy?Go(e.CreatedBy):void 0,CreatedTimestamp:null!=e.CreatedTimestamp?Ye(it(qe(e.CreatedTimestamp))):void 0,ElasticChannelConfiguration:null!=e.ElasticChannelConfiguration?Ko(e.ElasticChannelConfiguration):void 0,LastMessageTimestamp:null!=e.LastMessageTimestamp?Ye(it(qe(e.LastMessageTimestamp))):void 0,LastUpdatedTimestamp:null!=e.LastUpdatedTimestamp?Ye(it(qe(e.LastUpdatedTimestamp))):void 0,Metadata:Xe(e.Metadata),Mode:Xe(e.Mode),Name:Xe(e.Name),Privacy:Xe(e.Privacy)}))(i.Channel)),n})(e,t)}}class _s extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,_s.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelFlowCommand",inputFilterSensitiveLog:ir,outputFilterSensitiveLog:rr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint();let s=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channel-flows/{ChannelFlowArn}`;return s=pt(s,e,"ChannelFlowArn",(()=>e.ChannelFlowArn),"{ChannelFlowArn}",!1),new l({protocol:i,hostname:n,port:r,method:"GET",headers:{},path:s,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelFlow&&(n.ChannelFlow=((e,t)=>({ChannelFlowArn:Xe(e.ChannelFlowArn),CreatedTimestamp:null!=e.CreatedTimestamp?Ye(it(qe(e.CreatedTimestamp))):void 0,LastUpdatedTimestamp:null!=e.LastUpdatedTimestamp?Ye(it(qe(e.LastUpdatedTimestamp))):void 0,Name:Xe(e.Name),Processors:null!=e.Processors?ts(e.Processors):void 0}))(i.ChannelFlow)),n})(e,t)}}class Ts extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Ts.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelMembershipCommand",inputFilterSensitiveLog:or,outputFilterSensitiveLog:sr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/memberships/{MemberArn}`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1);const c=ho({"sub-channel-id":[,e.SubChannelId]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await go(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelMembership&&(n.ChannelMembership=((e,t)=>({ChannelArn:Xe(e.ChannelArn),CreatedTimestamp:null!=e.CreatedTimestamp?Ye(it(qe(e.CreatedTimestamp))):void 0,InvitedBy:null!=e.InvitedBy?Go(e.InvitedBy):void 0,LastUpdatedTimestamp:null!=e.LastUpdatedTimestamp?Ye(it(qe(e.LastUpdatedTimestamp))):void 0,Member:null!=e.Member?Go(e.Member):void 0,SubChannelId:Xe(e.SubChannelId),Type:Xe(e.Type)}))(i.ChannelMembership)),n})(e,t)}}class xs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,xs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelMembershipForAppInstanceUserCommand",inputFilterSensitiveLog:ar,outputFilterSensitiveLog:lr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const c=ho({scope:[,"app-instance-user-membership"],"app-instance-user-arn":[,Ye(e.AppInstanceUserArn,"AppInstanceUserArn")]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelMembership&&(n.ChannelMembership=jo(i.ChannelMembership,t)),n})(e,t)}}class Is extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Is.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelModeratedByAppInstanceUserCommand",inputFilterSensitiveLog:cr,outputFilterSensitiveLog:dr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const c=ho({scope:[,"app-instance-user-moderated-channel"],"app-instance-user-arn":[,Ye(e.AppInstanceUserArn,"AppInstanceUserArn")]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.Channel&&(n.Channel=Wo(i.Channel,t)),n})(e,t)}}class Ms extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Ms.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelModeratorCommand",inputFilterSensitiveLog:ur,outputFilterSensitiveLog:hr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/moderators/{ChannelModeratorArn}`;return a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"ChannelModeratorArn",(()=>e.ChannelModeratorArn),"{ChannelModeratorArn}",!1),new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await go(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelModerator&&(n.ChannelModerator=((e,t)=>({ChannelArn:Xe(e.ChannelArn),CreatedBy:null!=e.CreatedBy?Go(e.CreatedBy):void 0,CreatedTimestamp:null!=e.CreatedTimestamp?Ye(it(qe(e.CreatedTimestamp))):void 0,Moderator:null!=e.Moderator?Go(e.Moderator):void 0}))(i.ChannelModerator)),n})(e,t)}}class As extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,As.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DisassociateChannelFlowCommand",inputFilterSensitiveLog:pr,outputFilterSensitiveLog:e=>e},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/channel-flow/{ChannelFlowArn}`;return a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"ChannelFlowArn",(()=>e.ChannelFlowArn),"{ChannelFlowArn}",!1),new l({protocol:i,hostname:n,port:r,method:"DELETE",headers:s,path:a,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(204!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await go(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)});return await rs(e.body,t),n})(e,t)}}class Ps extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Ps.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"GetChannelMembershipPreferencesCommand",inputFilterSensitiveLog:fr,outputFilterSensitiveLog:mr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/memberships/{MemberArn}/preferences`;return a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1),new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.Member&&(n.Member=Go(i.Member)),null!=i.Preferences&&(n.Preferences=zo(i.Preferences,t)),n})(e,t)}}class Os extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Os.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"GetChannelMessageCommand",inputFilterSensitiveLog:gr,outputFilterSensitiveLog:vr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/messages/{MessageId}`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"MessageId",(()=>e.MessageId),"{MessageId}",!1);const c=ho({"sub-channel-id":[,e.SubChannelId]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await go(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelMessage&&(n.ChannelMessage=((e,t)=>({ChannelArn:Xe(e.ChannelArn),Content:Xe(e.Content),CreatedTimestamp:null!=e.CreatedTimestamp?Ye(it(qe(e.CreatedTimestamp))):void 0,LastEditedTimestamp:null!=e.LastEditedTimestamp?Ye(it(qe(e.LastEditedTimestamp))):void 0,LastUpdatedTimestamp:null!=e.LastUpdatedTimestamp?Ye(it(qe(e.LastUpdatedTimestamp))):void 0,MessageAttributes:null!=e.MessageAttributes?Yo(e.MessageAttributes,t):void 0,MessageId:Xe(e.MessageId),Metadata:Xe(e.Metadata),Persistence:Xe(e.Persistence),Redacted:He(e.Redacted),Sender:null!=e.Sender?Go(e.Sender):void 0,Status:null!=e.Status?$o(e.Status):void 0,SubChannelId:Xe(e.SubChannelId),Type:Xe(e.Type)}))(i.ChannelMessage,t)),n})(e,t)}}class Rs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Rs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"GetChannelMessageStatusCommand",inputFilterSensitiveLog:br,outputFilterSensitiveLog:yr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/messages/{MessageId}`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"MessageId",(()=>e.MessageId),"{MessageId}",!1);const c=ho({scope:[,"message-status"],"sub-channel-id":[,e.SubChannelId]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.Status&&(n.Status=$o(i.Status)),n})(e,t)}}class Ns extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Ns.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"GetMessagingSessionEndpointCommand",inputFilterSensitiveLog:Sr,outputFilterSensitiveLog:Cr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=`${o?.endsWith("/")?o.slice(0,-1):o||""}/endpoints/messaging-session`;let a;return a="",new l({protocol:i,hostname:n,port:r,method:"GET",headers:{"content-type":"application/json"},path:s,body:""})})(0,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.Endpoint&&(n.Endpoint=((e,t)=>({Url:Xe(e.Url)}))(i.Endpoint)),n})(e,t)}}class Ds extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Ds.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelBansCommand",inputFilterSensitiveLog:kr,outputFilterSensitiveLog:Er},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/bans`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const c=ho({"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.ChannelBans&&(n.ChannelBans=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({Member:null!=e.Member?Go(e.Member):void 0}))(e))))(i.ChannelBans)),null!=i.NextToken&&(n.NextToken=Xe(i.NextToken)),n})(e,t)}}class Fs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Fs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelFlowsCommand",inputFilterSensitiveLog:_r,outputFilterSensitiveLog:Tr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channel-flows`,a=ho({"app-instance-arn":[,Ye(e.AppInstanceArn,"AppInstanceArn")],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:{},path:s,query:a,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelFlows&&(n.ChannelFlows=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({ChannelFlowArn:Xe(e.ChannelFlowArn),Name:Xe(e.Name),Processors:null!=e.Processors?ts(e.Processors):void 0}))(e))))(i.ChannelFlows)),null!=i.NextToken&&(n.NextToken=Xe(i.NextToken)),n})(e,t)}}class Ls extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Ls.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelMembershipsCommand",inputFilterSensitiveLog:xr,outputFilterSensitiveLog:Ir},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/memberships`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const c=ho({type:[,e.Type],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken],"sub-channel-id":[,e.SubChannelId]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.ChannelMemberships&&(n.ChannelMemberships=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({Member:null!=e.Member?Go(e.Member):void 0}))(e))))(i.ChannelMemberships)),null!=i.NextToken&&(n.NextToken=Xe(i.NextToken)),n})(e,t)}}class Bs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Bs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelMembershipsForAppInstanceUserCommand",inputFilterSensitiveLog:Mr,outputFilterSensitiveLog:Ar},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer}),a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels`,c=ho({scope:[,"app-instance-user-memberships"],"app-instance-user-arn":[,e.AppInstanceUserArn],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelMemberships&&(n.ChannelMemberships=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:jo(e,t))))(i.ChannelMemberships,t)),null!=i.NextToken&&(n.NextToken=Xe(i.NextToken)),n})(e,t)}}class Us extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Us.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelMessagesCommand",inputFilterSensitiveLog:Pr,outputFilterSensitiveLog:Or},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/messages`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const c=ho({"sort-order":[,e.SortOrder],"not-before":[()=>void 0!==e.NotBefore,()=>(e.NotBefore.toISOString().split(".")[0]+"Z").toString()],"not-after":[()=>void 0!==e.NotAfter,()=>(e.NotAfter.toISOString().split(".")[0]+"Z").toString()],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken],"sub-channel-id":[,e.SubChannelId]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.ChannelMessages&&(n.ChannelMessages=((e,t)=>{const n=(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({Content:Xe(e.Content),CreatedTimestamp:null!=e.CreatedTimestamp?Ye(it(qe(e.CreatedTimestamp))):void 0,LastEditedTimestamp:null!=e.LastEditedTimestamp?Ye(it(qe(e.LastEditedTimestamp))):void 0,LastUpdatedTimestamp:null!=e.LastUpdatedTimestamp?Ye(it(qe(e.LastUpdatedTimestamp))):void 0,MessageAttributes:null!=e.MessageAttributes?Yo(e.MessageAttributes,t):void 0,MessageId:Xe(e.MessageId),Metadata:Xe(e.Metadata),Redacted:He(e.Redacted),Sender:null!=e.Sender?Go(e.Sender):void 0,Status:null!=e.Status?$o(e.Status):void 0,Type:Xe(e.Type)}))(e,t)));return n})(i.ChannelMessages,t)),null!=i.NextToken&&(n.NextToken=Xe(i.NextToken)),null!=i.SubChannelId&&(n.SubChannelId=Xe(i.SubChannelId)),n})(e,t)}}class Vs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Vs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelModeratorsCommand",inputFilterSensitiveLog:Rr,outputFilterSensitiveLog:Nr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/moderators`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const c=ho({"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.ChannelModerators&&(n.ChannelModerators=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({Moderator:null!=e.Moderator?Go(e.Moderator):void 0}))(e))))(i.ChannelModerators)),null!=i.NextToken&&(n.NextToken=Xe(i.NextToken)),n})(e,t)}}class js extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,js.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelsAssociatedWithChannelFlowCommand",inputFilterSensitiveLog:Lr,outputFilterSensitiveLog:Br},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels`,a=ho({scope:[,"channel-flow-associations"],"channel-flow-arn":[,Ye(e.ChannelFlowArn,"ChannelFlowArn")],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:{},path:s,query:a,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.Channels&&(n.Channels=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({ChannelArn:Xe(e.ChannelArn),Metadata:Xe(e.Metadata),Mode:Xe(e.Mode),Name:Xe(e.Name),Privacy:Xe(e.Privacy)}))(e))))(i.Channels)),null!=i.NextToken&&(n.NextToken=Xe(i.NextToken)),n})(e,t)}}class zs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,zs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelsCommand",inputFilterSensitiveLog:Dr,outputFilterSensitiveLog:Fr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer}),a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels`,c=ho({"app-instance-arn":[,Ye(e.AppInstanceArn,"AppInstanceArn")],privacy:[,e.Privacy],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.Channels&&(n.Channels=qo(i.Channels,t)),null!=i.NextToken&&(n.NextToken=Xe(i.NextToken)),n})(e,t)}}class $s extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,$s.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelsModeratedByAppInstanceUserCommand",inputFilterSensitiveLog:Ur,outputFilterSensitiveLog:Vr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer}),a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels`,c=ho({scope:[,"app-instance-user-moderated-channels"],"app-instance-user-arn":[,e.AppInstanceUserArn],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.Channels&&(n.Channels=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:Wo(e,t))))(i.Channels,t)),null!=i.NextToken&&(n.NextToken=Xe(i.NextToken)),n})(e,t)}}class Ws extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Ws.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListSubChannelsCommand",inputFilterSensitiveLog:jr,outputFilterSensitiveLog:$r},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/subchannels`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const c=ho({"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:s,path:a,query:c,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.NextToken&&(n.NextToken=Xe(i.NextToken)),null!=i.SubChannels&&(n.SubChannels=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({MembershipCount:Ge(e.MembershipCount),SubChannelId:Xe(e.SubChannelId)}))(e))))(i.SubChannels)),n})(e,t)}}class Hs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Hs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListTagsForResourceCommand",inputFilterSensitiveLog:Wr,outputFilterSensitiveLog:Hr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=`${o?.endsWith("/")?o.slice(0,-1):o||""}/tags`,a=ho({arn:[,Ye(e.ResourceARN,"ResourceARN")]});return new l({protocol:i,hostname:n,port:r,method:"GET",headers:{},path:s,query:a,body:void 0})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.Tags&&(n.Tags=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({Key:Xe(e.Key),Value:Xe(e.Value)}))(e))))(i.Tags)),n})(e,t)}}class qs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,qs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"PutChannelMembershipPreferencesCommand",inputFilterSensitiveLog:qr,outputFilterSensitiveLog:Kr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let a,c=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/memberships/{MemberArn}/preferences`;return c=pt(c,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),c=pt(c,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1),a=JSON.stringify({...null!=e.Preferences&&{Preferences:ko(e.Preferences,t)}}),new l({protocol:i,hostname:n,port:r,method:"PUT",headers:s,path:c,body:a})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.Member&&(n.Member=Go(i.Member)),null!=i.Preferences&&(n.Preferences=zo(i.Preferences,t)),n})(e,t)}}class Ks extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Ks.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"RedactChannelMessageCommand",inputFilterSensitiveLog:Gr,outputFilterSensitiveLog:Jr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/messages/{MessageId}`;a=pt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=pt(a,e,"MessageId",(()=>e.MessageId),"{MessageId}",!1);const c=ho({operation:[,"redact"]});let d;return d=JSON.stringify({...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:s,path:a,query:c,body:d})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.MessageId&&(n.MessageId=Xe(i.MessageId)),null!=i.SubChannelId&&(n.SubChannelId=Xe(i.SubChannelId)),n})(e,t)}}class Gs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Gs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"SearchChannelsCommand",inputFilterSensitiveLog:Yr,outputFilterSensitiveLog:Zr},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer}),a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels`,c=ho({operation:[,"search"],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});let d;return d=JSON.stringify({...null!=e.Fields&&{Fields:Fo(e.Fields,t)}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:s,path:a,query:c,body:d})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.Channels&&(n.Channels=qo(i.Channels,t)),null!=i.NextToken&&(n.NextToken=Xe(i.NextToken)),n})(e,t)}}class Js extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Js.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"SendChannelMessageCommand",inputFilterSensitiveLog:Xr,outputFilterSensitiveLog:eo},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let a,c=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/messages`;return c=pt(c,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=JSON.stringify({ClientRequestToken:e.ClientRequestToken??q(),...null!=e.Content&&{Content:e.Content},...null!=e.MessageAttributes&&{MessageAttributes:Mo(e.MessageAttributes,t)},...null!=e.Metadata&&{Metadata:e.Metadata},...null!=e.Persistence&&{Persistence:e.Persistence},...null!=e.PushNotification&&{PushNotification:No(e.PushNotification,t)},...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId},...null!=e.Type&&{Type:e.Type}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:s,path:c,body:a})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(201!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.MessageId&&(n.MessageId=Xe(i.MessageId)),null!=i.Status&&(n.Status=$o(i.Status)),null!=i.SubChannelId&&(n.SubChannelId=Xe(i.SubChannelId)),n})(e,t)}}class Qs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Qs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"TagResourceCommand",inputFilterSensitiveLog:to,outputFilterSensitiveLog:e=>e},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=`${o?.endsWith("/")?o.slice(0,-1):o||""}/tags`,a=ho({operation:[,"tag-resource"]});let c;return c=JSON.stringify({...null!=e.ResourceARN&&{ResourceARN:e.ResourceARN},...null!=e.Tags&&{Tags:Uo(e.Tags)}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:{"content-type":"application/json"},path:s,query:a,body:c})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(204!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await vo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)});return await rs(e.body,t),n})(e,t)}}class Ys extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Ys.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"UntagResourceCommand",inputFilterSensitiveLog:no,outputFilterSensitiveLog:e=>e},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=`${o?.endsWith("/")?o.slice(0,-1):o||""}/tags`,a=ho({operation:[,"untag-resource"]});let c;return c=JSON.stringify({...null!=e.ResourceARN&&{ResourceARN:e.ResourceARN},...null!=e.TagKeys&&{TagKeys:Bo(e.TagKeys)}}),new l({protocol:i,hostname:n,port:r,method:"POST",headers:{"content-type":"application/json"},path:s,query:a,body:c})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(204!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)});return await rs(e.body,t),n})(e,t)}}class Zs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Zs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"UpdateChannelCommand",inputFilterSensitiveLog:io,outputFilterSensitiveLog:ro},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let a,c=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}`;return c=pt(c,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=JSON.stringify({...null!=e.Metadata&&{Metadata:e.Metadata},...null!=e.Mode&&{Mode:e.Mode},...null!=e.Name&&{Name:e.Name}}),new l({protocol:i,hostname:n,port:r,method:"PUT",headers:s,path:c,body:a})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),n})(e,t)}}class Xs extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,Xs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"UpdateChannelFlowCommand",inputFilterSensitiveLog:oo,outputFilterSensitiveLog:so},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint();let s,a=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channel-flows/{ChannelFlowArn}`;return a=pt(a,e,"ChannelFlowArn",(()=>e.ChannelFlowArn),"{ChannelFlowArn}",!1),s=JSON.stringify({...null!=e.Name&&{Name:e.Name},...null!=e.Processors&&{Processors:Ro(e.Processors)}}),new l({protocol:i,hostname:n,port:r,method:"PUT",headers:{"content-type":"application/json"},path:a,body:s})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelFlowArn&&(n.ChannelFlowArn=Xe(i.ChannelFlowArn)),n})(e,t)}}class ea extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,ea.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"UpdateChannelMessageCommand",inputFilterSensitiveLog:ao,outputFilterSensitiveLog:lo},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let a,c=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/messages/{MessageId}`;return c=pt(c,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),c=pt(c,e,"MessageId",(()=>e.MessageId),"{MessageId}",!1),a=JSON.stringify({...null!=e.Content&&{Content:e.Content},...null!=e.Metadata&&{Metadata:e.Metadata},...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId}}),new l({protocol:i,hostname:n,port:r,method:"PUT",headers:s,path:c,body:a})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.MessageId&&(n.MessageId=Xe(i.MessageId)),null!=i.Status&&(n.Status=$o(i.Status)),null!=i.SubChannelId&&(n.SubChannelId=Xe(i.SubChannelId)),n})(e,t)}}class ta extends $e{constructor(e){super(),this.input=e}static getEndpointParameterInstructions(){return{UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}}}resolveMiddleware(e,t,n){this.middlewareStack.use(p(t,this.serialize,this.deserialize)),this.middlewareStack.use(y(t,ta.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,o={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"UpdateChannelReadMarkerCommand",inputFilterSensitiveLog:co,outputFilterSensitiveLog:uo},{requestHandler:s}=t;return i.resolve((e=>s.handle(e.request,n||{})),o)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:o}=await t.endpoint(),s=ho({},os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let a,c=`${o?.endsWith("/")?o.slice(0,-1):o||""}/channels/{ChannelArn}/readMarker`;return c=pt(c,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),a=JSON.stringify({...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId}}),new l({protocol:i,hostname:n,port:r,method:"PUT",headers:s,path:c,body:a})})(e,t)}deserialize(e,t){return(async(e,t)=>{if(200!==e.statusCode&&e.statusCode>=300)return(async(e,t)=>{const n={...e,body:await as(e.body,t)},i=ls(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await po(n);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await fo(n);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await mo(n);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await bo(n);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await yo(n);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await So(n);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await wo(n);default:const t=n.body;st({output:e,parsedBody:t,exceptionCtor:On,errorCode:i})}})(e,t);const n=ho({$metadata:is(e)}),i=Ye(Ze(await ss(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Xe(i.ChannelArn)),null!=i.SubChannelId&&(n.SubChannelId=Xe(i.SubChannelId)),n})(e,t)}}class na extends Pn{associateChannelFlow(e,t,n){const i=new cs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}batchCreateChannelMembership(e,t,n){const i=new ds(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}channelFlowCallback(e,t,n){const i=new us(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}createChannel(e,t,n){const i=new ps(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}createChannelBan(e,t,n){const i=new hs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}createChannelFlow(e,t,n){const i=new fs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}createChannelMembership(e,t,n){const i=new ms(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}createChannelModerator(e,t,n){const i=new gs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}deleteChannel(e,t,n){const i=new bs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}deleteChannelBan(e,t,n){const i=new vs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}deleteChannelFlow(e,t,n){const i=new ys(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}deleteChannelMembership(e,t,n){const i=new Ss(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}deleteChannelMessage(e,t,n){const i=new ws(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}deleteChannelModerator(e,t,n){const i=new Cs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}describeChannel(e,t,n){const i=new Es(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}describeChannelBan(e,t,n){const i=new ks(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}describeChannelFlow(e,t,n){const i=new _s(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}describeChannelMembership(e,t,n){const i=new Ts(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}describeChannelMembershipForAppInstanceUser(e,t,n){const i=new xs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}describeChannelModeratedByAppInstanceUser(e,t,n){const i=new Is(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}describeChannelModerator(e,t,n){const i=new Ms(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}disassociateChannelFlow(e,t,n){const i=new As(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}getChannelMembershipPreferences(e,t,n){const i=new Ps(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}getChannelMessage(e,t,n){const i=new Os(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}getChannelMessageStatus(e,t,n){const i=new Rs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}getMessagingSessionEndpoint(e,t,n){const i=new Ns(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}listChannelBans(e,t,n){const i=new Ds(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}listChannelFlows(e,t,n){const i=new Fs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}listChannelMemberships(e,t,n){const i=new Ls(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}listChannelMembershipsForAppInstanceUser(e,t,n){const i=new Bs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}listChannelMessages(e,t,n){const i=new Us(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}listChannelModerators(e,t,n){const i=new Vs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}listChannels(e,t,n){const i=new zs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}listChannelsAssociatedWithChannelFlow(e,t,n){const i=new js(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}listChannelsModeratedByAppInstanceUser(e,t,n){const i=new $s(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}listSubChannels(e,t,n){const i=new Ws(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}listTagsForResource(e,t,n){const i=new Hs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}putChannelMembershipPreferences(e,t,n){const i=new qs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}redactChannelMessage(e,t,n){const i=new Ks(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}searchChannels(e,t,n){const i=new Gs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}sendChannelMessage(e,t,n){const i=new Js(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}tagResource(e,t,n){const i=new Qs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}untagResource(e,t,n){const i=new Ys(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}updateChannel(e,t,n){const i=new Zs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}updateChannelFlow(e,t,n){const i=new Xs(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}updateChannelMessage(e,t,n){const i=new ea(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}updateChannelReadMarker(e,t,n){const i=new ta(e);if("function"==typeof t)this.send(i,t);else{if("function"!=typeof n)return this.send(i,t);if("object"!=typeof t)throw new Error("Expect http options but get "+typeof t);this.send(i,t||{},n)}}}const ia=async(e,t,...n)=>await e.send(new Ds(t),...n),ra=async(e,t,...n)=>await e.listChannelBans(t,...n);async function*oa(e,t,...n){let i,r=e.startingToken||void 0,o=!0;for(;o;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof na)i=await ra(e.client,t,...n);else{if(!(e.client instanceof Pn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await ia(e.client,t,...n)}yield i;const s=r;r=i.NextToken,o=!(!r||e.stopOnSameToken&&r===s)}}const sa=async(e,t,...n)=>await e.send(new Fs(t),...n),aa=async(e,t,...n)=>await e.listChannelFlows(t,...n);async function*la(e,t,...n){let i,r=e.startingToken||void 0,o=!0;for(;o;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof na)i=await aa(e.client,t,...n);else{if(!(e.client instanceof Pn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await sa(e.client,t,...n)}yield i;const s=r;r=i.NextToken,o=!(!r||e.stopOnSameToken&&r===s)}}const ca=async(e,t,...n)=>await e.send(new Bs(t),...n),da=async(e,t,...n)=>await e.listChannelMembershipsForAppInstanceUser(t,...n);async function*ua(e,t,...n){let i,r=e.startingToken||void 0,o=!0;for(;o;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof na)i=await da(e.client,t,...n);else{if(!(e.client instanceof Pn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await ca(e.client,t,...n)}yield i;const s=r;r=i.NextToken,o=!(!r||e.stopOnSameToken&&r===s)}}const ha=async(e,t,...n)=>await e.send(new Ls(t),...n),pa=async(e,t,...n)=>await e.listChannelMemberships(t,...n);async function*fa(e,t,...n){let i,r=e.startingToken||void 0,o=!0;for(;o;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof na)i=await pa(e.client,t,...n);else{if(!(e.client instanceof Pn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await ha(e.client,t,...n)}yield i;const s=r;r=i.NextToken,o=!(!r||e.stopOnSameToken&&r===s)}}const ma=async(e,t,...n)=>await e.send(new Us(t),...n),ga=async(e,t,...n)=>await e.listChannelMessages(t,...n);async function*va(e,t,...n){let i,r=e.startingToken||void 0,o=!0;for(;o;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof na)i=await ga(e.client,t,...n);else{if(!(e.client instanceof Pn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await ma(e.client,t,...n)}yield i;const s=r;r=i.NextToken,o=!(!r||e.stopOnSameToken&&r===s)}}const ba=async(e,t,...n)=>await e.send(new Vs(t),...n),ya=async(e,t,...n)=>await e.listChannelModerators(t,...n);async function*Sa(e,t,...n){let i,r=e.startingToken||void 0,o=!0;for(;o;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof na)i=await ya(e.client,t,...n);else{if(!(e.client instanceof Pn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await ba(e.client,t,...n)}yield i;const s=r;r=i.NextToken,o=!(!r||e.stopOnSameToken&&r===s)}}const wa=async(e,t,...n)=>await e.send(new js(t),...n),Ca=async(e,t,...n)=>await e.listChannelsAssociatedWithChannelFlow(t,...n);async function*ka(e,t,...n){let i,r=e.startingToken||void 0,o=!0;for(;o;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof na)i=await Ca(e.client,t,...n);else{if(!(e.client instanceof Pn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await wa(e.client,t,...n)}yield i;const s=r;r=i.NextToken,o=!(!r||e.stopOnSameToken&&r===s)}}const Ea=async(e,t,...n)=>await e.send(new $s(t),...n),_a=async(e,t,...n)=>await e.listChannelsModeratedByAppInstanceUser(t,...n);async function*Ta(e,t,...n){let i,r=e.startingToken||void 0,o=!0;for(;o;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof na)i=await _a(e.client,t,...n);else{if(!(e.client instanceof Pn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await Ea(e.client,t,...n)}yield i;const s=r;r=i.NextToken,o=!(!r||e.stopOnSameToken&&r===s)}}const xa=async(e,t,...n)=>await e.send(new zs(t),...n),Ia=async(e,t,...n)=>await e.listChannels(t,...n);async function*Ma(e,t,...n){let i,r=e.startingToken||void 0,o=!0;for(;o;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof na)i=await Ia(e.client,t,...n);else{if(!(e.client instanceof Pn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await xa(e.client,t,...n)}yield i;const s=r;r=i.NextToken,o=!(!r||e.stopOnSameToken&&r===s)}}const Aa=async(e,t,...n)=>await e.send(new Ws(t),...n),Pa=async(e,t,...n)=>await e.listSubChannels(t,...n);async function*Oa(e,t,...n){let i,r=e.startingToken||void 0,o=!0;for(;o;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof na)i=await Pa(e.client,t,...n);else{if(!(e.client instanceof Pn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await Aa(e.client,t,...n)}yield i;const s=r;r=i.NextToken,o=!(!r||e.stopOnSameToken&&r===s)}}const Ra=async(e,t,...n)=>await e.send(new Gs(t),...n),Na=async(e,t,...n)=>await e.searchChannels(t,...n);async function*Da(e,t,...n){let i,r=e.startingToken||void 0,o=!0;for(;o;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof na)i=await Na(e.client,t,...n);else{if(!(e.client instanceof Pn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await Ra(e.client,t,...n)}yield i;const s=r;r=i.NextToken,o=!(!r||e.stopOnSameToken&&r===s)}}},3538:(e,t,n)=>{"use strict";n.r(t),n.d(t,{fromHex:()=>o,toHex:()=>s});const i={},r={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();1===t.length&&(t=`0${t}`),i[e]=t,r[t]=e}function o(e){if(e.length%2!=0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){const i=e.slice(n,n+2).toLowerCase();if(!(i in r))throw new Error(`Cannot decode unrecognized sequence ${i} as hexadecimal`);t[n/2]=r[i]}return t}function s(e){let t="";for(let n=0;n<e.byteLength;n++)t+=i[e[n]];return t}},6495:(e,t,n)=>{"use strict";n.r(t),n.d(t,{locateWindow:()=>r});const i={};function r(){return"undefined"!=typeof window?window:"undefined"!=typeof self?self:i}},470:(e,t,n)=>{"use strict";n.r(t),n.d(t,{fromUtf8:()=>i,toUtf8:()=>r});const i=e=>"function"==typeof TextEncoder?function(e){return(new TextEncoder).encode(e)}(e):(e=>{const t=[];for(let n=0,i=e.length;n<i;n++){const i=e.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192,63&i|128);else if(n+1<e.length&&55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))){const r=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n));t.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else t.push(i>>12|224,i>>6&63|128,63&i|128)}return Uint8Array.from(t)})(e),r=e=>"function"==typeof TextDecoder?function(e){return new TextDecoder("utf-8").decode(e)}(e):(e=>{let t="";for(let n=0,i=e.length;n<i;n++){const i=e[n];if(i<128)t+=String.fromCharCode(i);else if(192<=i&&i<224){const r=e[++n];t+=String.fromCharCode((31&i)<<6|63&r)}else if(240<=i&&i<365){const r="%"+[i,e[++n],e[++n],e[++n]].map((e=>e.toString(16))).join("%");t+=decodeURIComponent(r)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t})(e)},4537:e=>{"use strict";e.exports=function(e,t){for(var n=new Array(arguments.length-1),i=0,r=2,o=!0;r<arguments.length;)n[i++]=arguments[r++];return new Promise((function(r,s){n[i]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),n=0;n<t.length;)t[n++]=arguments[n];r.apply(null,t)}};try{e.apply(t||null,n)}catch(e){o&&(o=!1,s(e))}}))}},7419:(e,t)=>{"use strict";var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&"="===e.charAt(t);)++n;return Math.ceil(3*e.length)/4-n};for(var i=new Array(64),r=new Array(123),o=0;o<64;)r[i[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(e,t,n){for(var r,o=null,s=[],a=0,l=0;t<n;){var c=e[t++];switch(l){case 0:s[a++]=i[c>>2],r=(3&c)<<4,l=1;break;case 1:s[a++]=i[r|c>>4],r=(15&c)<<2,l=2;break;case 2:s[a++]=i[r|c>>6],s[a++]=i[63&c],l=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return l&&(s[a++]=i[r],s[a++]=61,1===l&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";n.decode=function(e,t,n){for(var i,o=n,a=0,l=0;l<e.length;){var c=e.charCodeAt(l++);if(61===c&&a>1)break;if(void 0===(c=r[c]))throw Error(s);switch(a){case 0:i=c,a=1;break;case 1:t[n++]=i<<2|(48&c)>>4,i=c,a=2;break;case 2:t[n++]=(15&i)<<4|(60&c)>>2,i=c,a=3;break;case 3:t[n++]=(3&i)<<6|c,a=0}}if(1===a)throw Error(s);return n-o},n.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,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||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 n=this._listeners[e],i=0;i<n.length;)n[i].fn===t?n.splice(i,1):++i;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,n)}return this}},945:e=>{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),n=new Uint8Array(t.buffer),i=128===n[3];function r(e,i,r){t[0]=e,i[r]=n[0],i[r+1]=n[1],i[r+2]=n[2],i[r+3]=n[3]}function o(e,i,r){t[0]=e,i[r]=n[3],i[r+1]=n[2],i[r+2]=n[1],i[r+3]=n[0]}function s(e,i){return n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],n[3]=e[i+3],t[0]}function a(e,i){return n[3]=e[i],n[2]=e[i+1],n[1]=e[i+2],n[0]=e[i+3],t[0]}e.writeFloatLE=i?r:o,e.writeFloatBE=i?o:r,e.readFloatLE=i?s:a,e.readFloatBE=i?a:s}():function(){function t(e,t,n,i){var r=t<0?1:0;if(r&&(t=-t),0===t)e(1/t>0?0:2147483648,n,i);else if(isNaN(t))e(2143289344,n,i);else if(t>34028234663852886e22)e((r<<31|2139095040)>>>0,n,i);else if(t<11754943508222875e-54)e((r<<31|Math.round(t/1401298464324817e-60))>>>0,n,i);else{var o=Math.floor(Math.log(t)/Math.LN2);e((r<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,n,i)}}function s(e,t,n){var i=e(t,n),r=2*(i>>31)+1,o=i>>>23&255,s=8388607&i;return 255===o?s?NaN:r*(1/0):0===o?1401298464324817e-60*r*s:r*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,i),e.readFloatLE=s.bind(null,r),e.readFloatBE=s.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),n=new Uint8Array(t.buffer),i=128===n[7];function r(e,i,r){t[0]=e,i[r]=n[0],i[r+1]=n[1],i[r+2]=n[2],i[r+3]=n[3],i[r+4]=n[4],i[r+5]=n[5],i[r+6]=n[6],i[r+7]=n[7]}function o(e,i,r){t[0]=e,i[r]=n[7],i[r+1]=n[6],i[r+2]=n[5],i[r+3]=n[4],i[r+4]=n[3],i[r+5]=n[2],i[r+6]=n[1],i[r+7]=n[0]}function s(e,i){return n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],n[3]=e[i+3],n[4]=e[i+4],n[5]=e[i+5],n[6]=e[i+6],n[7]=e[i+7],t[0]}function a(e,i){return n[7]=e[i],n[6]=e[i+1],n[5]=e[i+2],n[4]=e[i+3],n[3]=e[i+4],n[2]=e[i+5],n[1]=e[i+6],n[0]=e[i+7],t[0]}e.writeDoubleLE=i?r:o,e.writeDoubleBE=i?o:r,e.readDoubleLE=i?s:a,e.readDoubleBE=i?a:s}():function(){function t(e,t,n,i,r,o){var s=i<0?1:0;if(s&&(i=-i),0===i)e(0,r,o+t),e(1/i>0?0:2147483648,r,o+n);else if(isNaN(i))e(0,r,o+t),e(2146959360,r,o+n);else if(i>17976931348623157e292)e(0,r,o+t),e((s<<31|2146435072)>>>0,r,o+n);else{var a;if(i<22250738585072014e-324)e((a=i/5e-324)>>>0,r,o+t),e((s<<31|a/4294967296)>>>0,r,o+n);else{var l=Math.floor(Math.log(i)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(a=i*Math.pow(2,-l))>>>0,r,o+t),e((s<<31|l+1023<<20|1048576*a&1048575)>>>0,r,o+n)}}}function s(e,t,n,i,r){var o=e(i,r+t),s=e(i,r+n),a=2*(s>>31)+1,l=s>>>20&2047,c=4294967296*(1048575&s)+o;return 2047===l?c?NaN:a*(1/0):0===l?5e-324*a*c:a*Math.pow(2,l-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,i,4,0),e.readDoubleLE=s.bind(null,r,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function n(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}function i(e,t,n){t[n]=e>>>24,t[n+1]=e>>>16&255,t[n+2]=e>>>8&255,t[n+3]=255&e}function r(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},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,n){var i=n||8192,r=i>>>1,o=null,s=i;return function(n){if(n<1||n>r)return e(n);s+n>i&&(o=e(i),s=0);var a=t.call(o,s,s+=n);return 7&s&&(s=1+(7|s)),a}}},4997:(e,t)=>{"use strict";var n=t;n.length=function(e){for(var t=0,n=0,i=0;i<e.length;++i)(n=e.charCodeAt(i))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&e.charCodeAt(i+1))?(++i,t+=4):t+=3;return t},n.read=function(e,t,n){if(n-t<1)return"";for(var i,r=null,o=[],s=0;t<n;)(i=e[t++])<128?o[s++]=i:i>191&&i<224?o[s++]=(31&i)<<6|63&e[t++]:i>239&&i<365?(i=((7&i)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(i>>10),o[s++]=56320+(1023&i)):o[s++]=(15&i)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,o)),s=0);return r?(s&&r.push(String.fromCharCode.apply(String,o.slice(0,s))),r.join("")):String.fromCharCode.apply(String,o.slice(0,s))},n.write=function(e,t,n){for(var i,r,o=n,s=0;s<e.length;++s)(i=e.charCodeAt(s))<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296==(64512&i)&&56320==(64512&(r=e.charCodeAt(s+1)))?(i=65536+((1023&i)<<10)+(1023&r),++s,t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128);return n-o}},8599:e=>{"use strict";const{AbortController:t,AbortSignal:n}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=n,e.exports.default=t},8320:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3922);t.default=class{constructor(e,t,n,i=1e3,r=200){this.realtimeController=e,this.selfAttendeeId=t,this.hasBandwidthPriorityCallback=n,this.waitIntervalMs=i,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,n){if(!this.needUpdate(n))return;const i=[],r=Object.keys(this.speakerScores);for(let e=0;e<r.length;e++){const t=r[e];i.push({attendeeId:t,activeScore:this.speakerScores[t]})}const o=i.sort(((e,t)=>t.activeScore-e.activeScore)).filter((function(e){return e.activeScore>0})).map((function(e){return e.attendeeId}));this.activeSpeakers=o,t(o);const s=o.length>0&&o[0]===this.selfAttendeeId&&e.prioritizeVideoSendBandwidthForActiveSpeaker();this.hasBandwidthPriority!==s&&(this.hasBandwidthPriority=s,this.hasBandwidthPriorityCallback(s))}updateScore(e,t,n,i,r){const o=e.calculateScore(n,i,r);this.speakerScores[n]!==o&&(this.speakerScores[n]=o,this.mostRecentUpdateTimestamp[n]=Date.now(),this.updateActiveSpeakers(e,t,n))}subscribe(e,t,n,i){const o=(n,i)=>{if(!i)return this.speakerScores[n]=0,this.mostRecentUpdateTimestamp[n]=Date.now(),void this.updateActiveSpeakers(e,t,n);this.realtimeController.realtimeSubscribeToVolumeIndicator(n,((n,i,r,o)=>{this.mostRecentUpdateTimestamp[n]=Date.now(),null!==r&&(this.speakerMuteState[n]=r),this.updateScore(e,t,n,i,r)}))};this.detectorCallbackToHandler.set(t,o);const s=new r.default(this.updateIntervalMs);if(s.start((()=>{for(const n in this.speakerScores)Date.now()-this.mostRecentUpdateTimestamp[n]>this.waitIntervalMs&&this.updateScore(e,t,n,0,this.speakerMuteState[n])})),this.detectorCallbackToActivityTimer.set(t,s),n&&i){const e=new r.default(i);e.start((()=>{n(this.speakerScores)})),this.detectorCallbackToScoresTimer.set(t,e)}this.realtimeController.realtimeSubscribeToAttendeeIdPresence(o)}unsubscribe(e){const t=this.detectorCallbackToHandler.get(e);this.detectorCallbackToHandler.delete(e),t&&this.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(t);const n=this.detectorCallbackToActivityTimer.get(e);n&&(n.stop(),this.detectorCallbackToActivityTimer.delete(e));const i=this.detectorCallbackToScoresTimer.get(e);i&&(i.stop(),this.detectorCallbackToHandler.delete(e))}destroy(){return i(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,n=.2,i=.2){this.speakerWeight=e,this.cutoffThreshold=t,this.silenceThreshold=n,this.takeoverRate=i,this.volumes={}}calculateScore(e,t,n){(n||null===t)&&(t=0),this.volumes.hasOwnProperty(e)||(this.volumes[e]=0),t=t>this.silenceThreshold?1:0;const i=this.volumes[e]*this.speakerWeight+t*(1-this.speakerWeight);this.volumes[e]=i;for(const n in this.volumes)n!==e&&(this.volumes[n]=Math.max(this.volumes[n]-this.takeoverRate*t,0));return i<this.cutoffThreshold?0:i}prioritizeVideoSendBandwidthForActiveSpeaker(){return!0}}},7535:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(e,t){this.appName=e,this.appVersion=t}static create(e,t){const i=/^[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(!i.test(e))throw new Error(`appName must satisfy ${i} 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 n(e,t)}}t.default=n},7602:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},6802:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543),o=n(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 i(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 i(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 i(this,void 0,void 0,(function*(){if(e&&!this.browserBehavior.supportsSetSinkId())throw new Error("Cannot select audio output device. This browser does not support setSinkId.");return this.audioDevice=e,this.bindAudioMix()}))}forEachObserver(e){for(const t of this.observers)o.default.nextTick((()=>{e(t)}))}bindAudioMix(){var e,t;return i(this,void 0,void 0,(function*(){if(!this.audioElement)return;const n=this.audioElement.srcObject;this.audioStream&&(this.audioElement.srcObject=this.audioStream),n!==this.audioStream&&this.forEachObserver((e=>{n&&e.meetingAudioStreamBecameInactive(n),this.audioStream&&e.meetingAudioStreamBecameActive(this.audioStream)}));const i=(null===(e=this.audioDevice)||void 0===e?void 0:e.deviceId)!==this.audioElement.sinkId;if(i&&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 o=this.audioElement,s=this.audioStream;if(this.browserBehavior.hasChromiumWebRTC()&&(o.srcObject=null),i)try{yield o.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()&&(o.srcObject=s)}))}getCurrentMeetingAudioStream(){return i(this,void 0,void 0,(function*(){return this.audioStream}))}addAudioMixObserver(e){return i(this,void 0,void 0,(function*(){this.observers.add(e)}))}removeAudioMixObserver(e){return i(this,void 0,void 0,(function*(){this.observers.delete(e)}))}audioOutputDidChange(e){return i(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 n{constructor(e=null){this.audioBitrateBps=e}static fullbandSpeechMono(){return new n(4e4)}static fullbandMusicMono(){return new n(64e3)}static fullbandMusicStereo(){return new n(128e3)}isStereo(){return 128e3===this.audioBitrateBps}}t.default=n},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,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(8320),o=n(6802),s=n(3765),a=n(543),l=n(6688),c=n(8581),d=n(3789),u=n(5687),h=n(5723),p=n(214),f=n(7500),m=n(983),g=n(7797),v=n(9678),b=n(3860),y=n(9553),S=n(3013),w=n(1208),C=n(9416),k=n(9101),E=n(289),_=n(8597),T=n(8358),x=n(3216),I=n(7408),M=n(5482),A=n(1129),P=n(6240),O=n(1960),R=n(6180),N=n(2748),D=n(1981),F=n(4543),L=n(8556),B=n(9945),U=n(1209),V=n(5547),j=n(120),z=n(9560),$=n(9485),W=n(7079),H=n(4833),q=n(5275),K=n(5924),G=n(250),J=n(6171),Q=n(365),Y=n(7377),Z=n(5785),X=n(9354),ee=n(8660),te=n(1133),ne=n(5185),ie=n(2880),re=n(1508),oe=n(1318),se=n(4242),ae=n(2958),le=n(4922),ce=n(4450),de=n(4442),ue=n(9751),he=n(1876);class pe{constructor(e,t,n,i,r,a){this._audioProfile=new s.default,this.connectionHealthData=new l.default,this.observerQueue=new Set,this.meetingSessionContext=new he.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=n,this._realtimeController=new m.default(i),this._realtimeController.realtimeSetLocalAttendeeId(e.credentials.attendeeId,e.credentials.externalUserId),this._mediaStreamBroker=i,this._reconnectController=r,this._videoTileController=new ae.default(new le.default,this,this._logger),this._audioMixController=new o.default(this._logger),this._mediaStreamBroker.addMediaStreamBrokerObserver(this._audioMixController),this.meetingSessionContext.logger=this._logger,this._eventController=a}destroy(){return i(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)g.default.nextTick((()=>{this.observerQueue.has(t)&&e(t)}))}initSignalingClient(){this.connectionHealthData.reset(),this.meetingSessionContext.signalingClient||(this.meetingSessionContext=new he.default,this.meetingSessionContext.logger=this.logger,this.meetingSessionContext.eventController=this.eventController,this.meetingSessionContext.browserBehavior=new a.default,this.meetingSessionContext.videoSendCodecPreferences=this.videoSendCodecPreferences,this.meetingSessionContext.meetingSessionConfiguration=this.configuration,this.meetingSessionContext.signalingClient=new w.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=()=>i(this,void 0,void 0,(function*(){this.logger.info("Early connection closed; discarding signaling task."),this.signalingTask=void 0,this.uninstallPreStartObserver()}));this.preStartObserver={handleSignalingClientEvent(t){t.type===C.default.WebSocketClosed&&e()}},this.meetingSessionContext.signalingClient.registerObserver(this.preStartObserver)})).catch((e=>{this.logger.error(`Signaling task pre-start failed: ${e}`),this.signalingTask=void 0}))}start(e){this.startReturningPromise(e).then((()=>{this.logger.info("start completed")})).catch((e=>{this.logger.error(`start failed: ${e}`)}))}startReturningPromise(e){return!0===(null==e?void 0:e.signalingOnly)?this.prestart():(this.activeSpeakerDetector,new Promise(((e,t)=>{this.sessionStateController.perform(b.default.Connect,(()=>{this.actionConnect(!1).then(e).catch(t)}))})))}connectWithPromises(e){const t=this.meetingSessionContext;this.monitorTask=new D.default(t,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData);const n=this.monitorTask.once(),i=new U.default(t).once();this.receiveIndexTask=new z.default(t),this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();const r=new W.default(this.logger,"Signaling",[this.createOrReuseSignalingTask(),new N.default(t),new $.default(t),new O.default(t),new V.default(t),this.receiveIndexTask]).once(),o=new M.default(t).once(r),s=new T.default(t).once(o,i),a=new A.default(t).once(s),l=new H.default(t).once(a),c=new P.default(t).once(l),d=new K.default(t).once(c);return new W.default(this.logger,this.wrapTaskName("AudioVideoStart"),[n,((e,t)=>new G.default(this.logger,t,e))(this.configuration.connectionTimeoutMs,new W.default(this.logger,"Peer",[d,e?new G.default(this.logger,new L.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 z.default(this.meetingSessionContext),this.monitorTask=new D.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 U.default(this.meetingSessionContext),new G.default(this.logger,new W.default(this.logger,"Media",[new W.default(this.logger,"Signaling",[new F.default(this.meetingSessionContext),new N.default(this.meetingSessionContext),new $.default(this.meetingSessionContext),new O.default(this.meetingSessionContext),new V.default(this.meetingSessionContext),this.receiveIndexTask]),new W.default(this.logger,"Peer",[new M.default(this.meetingSessionContext),new T.default(this.meetingSessionContext),new A.default(this.meetingSessionContext),new H.default(this.meetingSessionContext),new P.default(this.meetingSessionContext),new K.default(this.meetingSessionContext),e?new G.default(this.logger,new L.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 i(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 a.default).hasChromiumWebRTC();const n=!!this.configuration.urls.audioHostURL;if(n?this.enableSimulcast?(this.logger.info("Using transceiver controller with simulcast support"),new p.default(this.configuration.credentials.attendeeId).hasModality(p.default.MODALITY_CONTENT)?this.meetingSessionContext.transceiverController=new Y.default(this.logger,this.meetingSessionContext.browserBehavior):this.meetingSessionContext.transceiverController=new Z.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 ue.default(this.logger,this._realtimeController,pe.MIN_VOLUME_DECIBELS,pe.MAX_VOLUME_DECIBELS,this.configuration.credentials.attendeeId),this.meetingSessionContext.videoTileController=this._videoTileController,this.meetingSessionContext.videoDownlinkBandwidthPolicy=this.configuration.videoDownlinkBandwidthPolicy,this.meetingSessionContext.videoUplinkBandwidthPolicy=this.configuration.videoUplinkBandwidthPolicy,this.meetingSessionContext.enableSimulcast=this.enableSimulcast,this.enableSimulcast){let e=this.meetingSessionContext.videoUplinkBandwidthPolicy;e||(e=new ce.default(this.configuration.credentials.attendeeId,this.meetingSessionContext.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy=e),e.addObserver(this),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new ie.default(this.meetingSessionContext.logger)),this.meetingSessionContext.videoStreamIndex=new se.default(this.logger)}else this.meetingSessionContext.enableSimulcast=!1,this.meetingSessionContext.videoStreamIndex=new oe.default(this.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy||(this.meetingSessionContext.videoUplinkBandwidthPolicy=new de.default(this.configuration.credentials.attendeeId,!this.meetingSessionContext.browserBehavior.disableResolutionScaleDown(),this.meetingSessionContext.logger,this.meetingSessionContext.browserBehavior)),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new ne.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 h.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 _.default(this,this.logger),this.meetingSessionContext.connectionMonitor=new c.default(this,this._realtimeController,this.connectionHealthData,new f.default(this.meetingSessionContext.signalingClient,pe.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=n&&this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs>0;let o;this.logger.info("Needs to wait for attendee presence? "+r),o=this.usePromises?this.connectWithPromises(r):this.connectWithTasks(r);try{yield o.run(),this.connectionHealthData.setConnectionStartTime(),this._mediaStreamBroker.addMediaStreamBrokerObserver(this),this.sessionStateController.perform(b.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 d.default(this.getMeetingStatusCode(e)||u.default.TaskFailed);if(this.logger.info(`Start failed: ${t} due to error ${e}.`),this.sessionStateController.state()===y.default.NotConnected)return void this.logger.info("Start failed and not connected. Not cleaning up.");this.sessionStateController.perform(b.default.Fail,(()=>i(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 G.default(this.logger,new F.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs).once()),this.signalingTask}actionFinishConnecting(){this.signalingTask=void 0,this.meetingSessionContext.videoDuplexMode=E.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()===y.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(b.default.Disconnect,(()=>{this._reconnectController.disableReconnect(),this.logger.info("attendee left meeting, session will not be reconnected"),this.actionDisconnect(new d.default(u.default.Left),!1,null).then(e).catch(t)}))}))}stop(){this.stopReturningPromise()}actionDisconnect(e,t,n){return i(this,void 0,void 0,(function*(){try{yield new W.default(this.logger,this.wrapTaskName("AudioVideoStop"),[new G.default(this.logger,new R.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)]).run()}catch(e){this.logger.info("fail to stop")}try{const e=[new G.default(this.logger,new I.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(b.default.FinishDisconnecting,(()=>{t||(this.meetingSessionContext.signalingClient=null,this.notifyStop(e,n))}))}))}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 n=this.sessionStateController.perform(b.default.Update,(()=>{this.actionUpdateWithRenegotiation(!0)}));return n===S.default.Transitioned||n===S.default.DeferredTransition}updateRemoteVideosFromLastVideosToReceive(){var e,t;const n=this.meetingSessionContext;if((null===(e=n.videosToReceive)||void 0===e?void 0:e.empty())||(null===(t=n.lastVideosToReceive)||void 0===t?void 0:t.empty()))return!1;if(!(n.transceiverController&&n.transceiverController.getMidForStreamId&&n.transceiverController.setStreamIdForMid&&n.videosToReceive.forEach&&n.signalingClient.remoteVideoUpdate&&n.videoStreamIndex.overrideStreamIdMappings))return!1;let i=[];const r=new Map;let o=[];if(null===n.lastVideosToReceive)i=n.videosToReceive.array();else{const e=n.videoStreamIndex;n.videosToReceive.forEach((t=>{if(n.lastVideosToReceive.contain(t))return;let o=!1;n.lastVideosToReceive.forEach((n=>{o||e.StreamIdsInSameGroup(n,t)&&(r.set(n,t),o=!0)})),o||i.push(t)})),o=n.lastVideosToReceive.array().filter((e=>{const t=n.videosToReceive.contain(e),i=r.has(e);return!t&&!i}))}this.logger.info(`Request to update remote videos with added: ${i}, updated: ${[...r.entries()]}, removed: ${o}`);const s=[];for(const[e,t]of r.entries()){const i=new k.default;if(i.streamId=t,i.attendeeId=n.videoStreamIndex.attendeeIdForStreamId(t),i.mid=n.transceiverController.getMidForStreamId(e),void 0===i.mid)return this.logger.info(`No MID found for stream ID ${e}, cannot update stream without renegotiation`),!1;if(s.push(i),n.transceiverController.setStreamIdForMid(i.mid,t),n.videoStreamIndex.overrideStreamIdMappings(e,t),n.videoTileController.haveVideoTileForAttendeeId(i.attendeeId)){const e=n.videoTileController.getVideoTileForAttendeeId(i.attendeeId);if(!e.setStreamId)return!1;e.setStreamId(t)}}return 0!==s.length&&n.signalingClient.remoteVideoUpdate(s,[]),0===i.length&&0===o.length&&(n.videoStreamIndex.subscribeFrameSent(),!0)}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=()=>i(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()})),n=this.sessionStateController.perform(b.default.Update,(()=>{t()}));return n===S.default.Transitioned||n===S.default.DeferredTransition}replaceLocalVideo(e){return i(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 n=t.state(),i=e.getVideoTracks()[0].getSettings();t.bindVideoStream(n.boundAttendeeId,!0,e,i.width,i.height,n.streamId,n.boundExternalUserId)}yield this.meetingSessionContext.transceiverController.setVideoInput(e.getVideoTracks()[0]),this.meetingSessionContext.activeVideoInput=e,this.logger.info("Local video input is updated")}))}replaceLocalAudio(e){return i(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 i(this,void 0,void 0,(function*(){this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();try{yield new W.default(this.logger,this.wrapTaskName("AudioVideoUpdate"),[new j.default(this.meetingSessionContext),new G.default(this.logger,new W.default(this.logger,"UpdateSession",[new T.default(this.meetingSessionContext),new A.default(this.meetingSessionContext),new H.default(this.meetingSessionContext),new P.default(this.meetingSessionContext),new K.default(this.meetingSessionContext),new q.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),e&&this.sessionStateController.perform(b.default.FinishUpdating,(()=>{this.actionFinishUpdating()}))}catch(e){this.sessionStateController.perform(b.default.FinishUpdating,(()=>{const t=new d.default(this.getMeetingStatusCode(e)||u.default.TaskFailed);t.statusCode()!==u.default.IncompatibleSDP&&this.logger.info("failed to update audio-video session"),this.handleMeetingSessionStatus(t,e)}))}}))}notifyStop(e,t){var n;if(this.forEachObserver((t=>{ee.Maybe.of(t.audioVideoDidStop).map((n=>n.bind(t)(e)))})),this.promotedToPrimaryMeeting&&t&&this.forEachObserver((e=>{this.promotedToPrimaryMeeting=!1,ee.Maybe.of(e.audioVideoWasDemotedFromPrimaryMeeting).map((t=>t.bind(e)(new d.default(u.default.SignalingInternalServerError))))})),this.eventController){const{signalingOpenDurationMs:i,poorConnectionCount:r,startTimeMs:o,iceGatheringDurationMs:s,attendeePresenceDurationMs:a,meetingStartDurationMs:l}=this.meetingSessionContext,c={maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,meetingDurationMs:null===o?0:Math.round(Date.now()-o),meetingStatus:u.default[e.statusCode()],signalingOpenDurationMs:i,iceGatheringDurationMs:s,attendeePresenceDurationMs:a,poorConnectionCount:r,meetingStartDurationMs:l,retryCount:this.totalRetryCount},d=t&&t.message||(null===(n=e.toString)||void 0===n?void 0:n.call(e))||"";0===c.meetingDurationMs?(c.meetingErrorMessage=d,delete c.meetingDurationMs,delete c.attendeePresenceDurationMs,delete c.meetingStartDurationMs,this.eventController.publishEvent("meetingStartFailed",c)):e.isFailure()||e.isAudioConnectionFailure()?(c.meetingErrorMessage=d,this.eventController.publishEvent("meetingFailed",c)):this.eventController.publishEvent("meetingEnded",c)}}actionFinishUpdating(){if(!this.meetingSessionContext.enableSimulcast)if(this.useUpdateTransceiverControllerForUplink)this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();else{const e=this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0];this.enforceBandwidthLimitationForSender(e)}this.monitorTask.resumeResubscribeCheck(),this.receiveIndexTask.resumeIngestion(),this.logger.info("updated audio-video session")}reconnect(e,t){const n=this._reconnectController.retryWithBackoff((()=>i(this,void 0,void 0,(function*(){this.sessionStateController.state()===y.default.NotConnected?this.sessionStateController.perform(b.default.Connect,(()=>{this.actionConnect(!0)})):this.sessionStateController.perform(b.default.Reconnect,(()=>{this.actionReconnect(e)})),this.totalRetryCount+=1}))),(()=>{this.logger.info("canceled retry")}));return n||this.sessionStateController.perform(b.default.Fail,(()=>{this.actionDisconnect(e,!1,t)})),n}actionReconnect(e){return i(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 G.default(this.logger,new W.default(this.logger,"Media",[new x.default(this.meetingSessionContext),new W.default(this.logger,"Signaling",[new F.default(this.meetingSessionContext),new O.default(this.meetingSessionContext),new V.default(this.meetingSessionContext)]),new M.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs),new j.default(this.meetingSessionContext),new G.default(this.logger,new W.default(this.logger,"UpdateSession",[new T.default(this.meetingSessionContext),new A.default(this.meetingSessionContext),new H.default(this.meetingSessionContext),new P.default(this.meetingSessionContext),new K.default(this.meetingSessionContext),new q.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),this.sessionStateController.perform(b.default.FinishConnecting,(()=>{if(this.eventController){const{signalingOpenDurationMs:t,poorConnectionCount:n,startTimeMs:i,iceGatheringDurationMs:r,attendeePresenceDurationMs:o,meetingStartDurationMs:s}=this.meetingSessionContext,a={maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,meetingDurationMs:Math.round(Date.now()-i),meetingStatus:u.default[e.statusCode()],signalingOpenDurationMs:t,iceGatheringDurationMs:r,attendeePresenceDurationMs:o,poorConnectionCount:n,meetingStartDurationMs:s,retryCount:this.totalRetryCount};this.eventController.publishEvent("meetingReconnected",a)}this.actionFinishConnecting()}))}catch(e){this.sessionStateController.perform(b.default.FinishConnecting,(()=>{this.logger.info("failed to reconnect audio-video session");const t=new d.default(this.getMeetingStatusCode(e)||u.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 i(this,void 0,void 0,(function*(){yield this.meetingSessionContext.transceiverController.setVideoSendingBitrateKbps(e)}))}handleMeetingSessionStatus(e,t){if(this.logger.info(`handling status: ${u.default[e.statusCode()]}`),e.isTerminal()||this.meetingSessionContext.statsCollector&&this.meetingSessionContext.statsCollector.logMeetingSessionStatus(e),e.statusCode()===u.default.IncompatibleSDP)return this.restartLocalVideo((()=>{this.logger.info("handled incompatible SDP by attempting to restart video")})),!0;if(e.statusCode()===u.default.VideoCallSwitchToViewOnly)return this._videoTileController.removeLocalVideoTile(),this.forEachObserver((e=>{ee.Maybe.of(e.videoSendDidBecomeUnavailable).map((t=>t.bind(e)()))})),!1;if(e.statusCode()===u.default.AudioVideoWasRemovedFromPrimaryMeeting)return this.forEachObserver((t=>{ee.Maybe.of(t.audioVideoWasDemotedFromPrimaryMeeting).map((n=>n.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 n=this.reconnect(e,t);return n?this.logger.warn(`will retry due to status code ${u.default[e.statusCode()]}${t?` and error: ${t.message}`:""}`):this.logger.error(`failed with status code ${u.default[e.statusCode()]}${t?` and error: ${t.message}`:""}`),n}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 i(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 n=this.meetingSessionContext.videoUplinkBandwidthPolicy.maxBandwidthKbps();t!==n&&(this.logger.info(`video send bandwidth priority ${e} max has changed from ${t} kbps to ${n} kbps`),yield this.enforceBandwidthLimitationForSender(n))}}))}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((n=>n.bind(t)(e)))}))}promoteToPrimaryMeeting(e){return this.actionPromoteToPrimaryMeeting(e)}actionPromoteToPrimaryMeeting(e){return i(this,void 0,void 0,(function*(){let t=new d.default(u.default.SignalingRequestFailed);return yield new W.default(this.logger,this.wrapTaskName("PromoteToPrimaryMeeting"),[new G.default(this.logger,new B.default(this.meetingSessionContext,e,(e=>{t=e})),this.configuration.connectionTimeoutMs)]).run(),this.promotedToPrimaryMeeting=t.statusCode()===u.default.OK,t}))}demoteFromPrimaryMeeting(){this.meetingSessionContext.signalingClient.demoteFromPrimaryMeeting(),this.forEachObserver((e=>{ee.Maybe.of(e.audioVideoWasDemotedFromPrimaryMeeting).map((t=>t.bind(e)(new d.default(u.default.OK))))}))}videoInputDidChange(e){return i(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 i(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=pe,pe.MIN_VOLUME_DECIBELS=-42,pe.MAX_VOLUME_DECIBELS=-14,pe.PING_PONG_INTERVAL_MS=1e4},9836:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8434),r=n(3831),o=n(209),s=n(4015),a=n(589),l=n(8015),c=n(3789),d=n(5687),u=n(6057),h=n(9141),p=n(7631),f=n(9059);class m extends f.default{constructor(e){const t=new a.default;t.meetingId="",t.externalMeetingId="",t.credentials=new l.default,t.credentials.attendeeId="",t.credentials.joinToken="",t.urls=new u.default,t.urls.turnControlURL="",t.urls.audioHostURL="",t.urls.signalingURL="wss://localhost/";const n=new o.default;super(e||t,n,new p.default(new o.default),new s.default,new h.default(0,new i.default(0,0,0)),new r.default(e||t,n))}setAudioProfile(e){}start(){}stop(){}promoteToPrimaryMeeting(e){return Promise.resolve(new c.default(d.default.OK))}demoteFromPrimaryMeeting(){}}t.default=m},8538:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(7170);t.default=class{constructor(e,t,n,i,r,o){this.audioVideoController=e,this.videoTileController=t,this.realtimeController=n,this.audioMixController=i,this.deviceController=r,this.contentShareController=o}addObserver(e){this.audioVideoController.addObserver(e),this.trace("addObserver")}removeObserver(e){this.audioVideoController.removeObserver(e),this.trace("removeObserver")}setAudioProfile(e){this.trace("setAudioProfile",e),this.audioVideoController.setAudioProfile(e)}start(e){this.audioVideoController.start(e),this.trace("start")}stop(){this.audioVideoController.stop(),this.trace("stop")}getRTCPeerConnectionStats(e){return this.trace("getRTCPeerConnectionStats",e?e.id:null),this.audioVideoController.getRTCPeerConnectionStats(e)}bindAudioElement(e){const t=this.audioMixController.bindAudioElement(e);return this.trace("bindAudioElement",e.id,t),t}unbindAudioElement(){this.audioMixController.unbindAudioElement(),this.trace("unbindAudioElement")}getCurrentMeetingAudioStream(){return this.trace("getCurrentConferenceStream"),this.audioMixController.getCurrentMeetingAudioStream()}addAudioMixObserver(e){this.trace("addAudioMixObserver"),this.audioMixController.addAudioMixObserver(e)}removeAudioMixObserver(e){this.trace("removeAudioMixObserver"),this.audioMixController.removeAudioMixObserver(e)}bindVideoElement(e,t){this.videoTileController.bindVideoElement(e,t),this.trace("bindVideoElement",{tileId:e,videoElementId:t.id})}unbindVideoElement(e,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,n){this.realtimeController.realtimeSendDataMessage(e,t,n),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,n,i){this.audioVideoController.activeSpeakerDetector.subscribe(e,t,n,i),this.trace("subscribeToActiveSpeakerDetector")}unsubscribeFromActiveSpeakerDetector(e){this.audioVideoController.activeSpeakerDetector.unsubscribe(e),this.trace("unsubscribeFromActiveSpeakerDetector")}listAudioInputDevices(e=!1){return i(this,void 0,void 0,(function*(){const t=yield this.deviceController.listAudioInputDevices(e);return this.trace("listAudioInputDevices",e,t),t}))}listVideoInputDevices(e=!1){return i(this,void 0,void 0,(function*(){const t=yield this.deviceController.listVideoInputDevices(e);return this.trace("listVideoInputDevices",e,t),t}))}listAudioOutputDevices(e=!1){return i(this,void 0,void 0,(function*(){const t=yield this.deviceController.listAudioOutputDevices(e);return this.trace("listAudioOutputDevices",e,t),t}))}startAudioInput(e){return i(this,void 0,void 0,(function*(){return this.trace("startAudioInput",e),this.deviceController.startAudioInput(e)}))}stopAudioInput(){return i(this,void 0,void 0,(function*(){return this.trace("stopAudioInput"),this.deviceController.stopAudioInput()}))}startVideoInput(e){return i(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 i(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,n){this.deviceController.chooseVideoInputQuality(e,t,n),this.trace("chooseVideoInputQuality",{width:e,height:t,frameRate:n})}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 n=this.contentShareController.startContentShareFromScreenCapture(e,t);return this.trace("startContentShareFromScreenCapture"),n}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,n){let i=`API/DefaultAudioVideoFacade/${this.audioVideoController.configuration.meetingId}/${this.audioVideoController.configuration.credentials.attendeeId}/${e}`;void 0!==t&&(i+=` ${JSON.stringify(t)}`),void 0!==n&&(i+=` -> ${JSON.stringify(n)}`),this.audioVideoController.logger.info(i)}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,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(8074),o=n(9734);class s 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 n=this.blurredImage,{canvasCtx:i,targetCanvas:r}=this,{width:o,height:s}=r;t&&n?(this.scaledCanvas.getContext("2d").putImageData(t,0,0),this.blurCanvasCtx.putImageData(this.blurredImage,0,0),i.save(),i.clearRect(0,0,o,s),i.drawImage(this.scaledCanvas,0,0,o,s),i.globalCompositeOperation="source-in",i.drawImage(e,0,0,o,s),i.globalCompositeOperation="destination-over",i.drawImage(this.blurCanvas,0,0,o,s),i.restore()):i.clearRect(0,0,o,s)}setBlurStrength(e){if(super.setBlurStrength(e),this.worker){this.modelInitialized=!1,this.worker.postMessage({msg:"destroy"});const e=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:e.path,inputHeight:e.input.height,inputWidth:e.input.width,inputChannels:4,modelRangeMin:e.input.range[0],modelRangeMax:e.input.range[1],blurPixels:this.blurAmount}})}}setBlurPixels(){this.blurAmount=o.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:540}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}handleInitialize(e){if(this.logger.info(`received initialize message: ${this.stringify(e)}`),!e.payload)return this.logger.error("failed to initialize module"),void this.initWorkerPromise.reject(new Error("failed to initialize the module"));const t=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:t.path,inputHeight:t.input.height,inputWidth:t.input.width,inputChannels:4,modelRangeMin:t.input.range[0],modelRangeMax:t.input.range[1],blurPixels:this.blurAmount}}),this.initWorkerPromise.resolve({})}handlePredict(e){this.blurredImage=e.payload.blurOutput,super.handlePredict(e)}destroy(){const e=Object.create(null,{destroy:{get:()=>super.destroy}});var t;return i(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=s},8074:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1851),o=n(9734),s=n(9852);class a extends r.default{constructor(e,t){super("background blur",e,t,new s.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:n,targetCanvas:i}=this,{width:r,height:o}=i;n.save(),n.clearRect(0,0,r,o),n.drawImage(this.scaledCanvas,0,0,r,o),n.globalCompositeOperation="source-in",n.drawImage(e,0,0,r,o),n.globalCompositeOperation="destination-over",n.filter=`blur(${this.blurAmount}px)`,n.drawImage(e,0,0,i.width,i.height),n.restore()}setBlurStrength(e){this._blurStrength=e,this.logger.info(`blur strength set to ${this._blurStrength}`),this.setBlurPixels()}setBlurPixels(){this.blurAmount=o.BlurStrengthMapper.getBlurAmount(this._blurStrength,{height:this.sourceHeight}),this.logger.info(`background blur amount set to ${this.blurAmount}`)}addObserver(e){this.delegate.addObserver(e)}removeObserver(e){this.delegate.removeObserver(e)}static isSupported(){return i(this,void 0,void 0,(function*(){const e=document.createElement("canvas"),t=void 0!==e.getContext("2d").filter;return e.remove(),t}))}}t.default=a},9734:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlurStrengthMapper=void 0;class n{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=n,n.BLUR_STRENGTH_DIVISOR=540,t.default={LOW:7,MEDIUM:15,HIGH:30}},1260:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4243),o=n(8030),s=n(813),a=n(2801),l=n(179),c=n(8074),d=n(9734);class u extends a.default{setBlurStrength(){}loadAssets(){return i(this,void 0,void 0,(function*(){}))}addObserver(){}removeObserver(){}}class h extends r.default{static create(e,t){return i(this,void 0,void 0,(function*(){e=h.resolveSpec(e),t=h.resolveOptions(t);const{logger:n}=t,i=yield h.isSupported(e,t);if(n.info(`processor is ${i?"":"not"} supported`),!i)return n.warn("Using no-op processor because background blur is not supported"),new u;let r;return(yield c.default.isSupported())?(n.info("Using browser-provided background blur"),r=new c.default(e,t)):(n.info("Using built-in background blur"),r=new l.default(e,t)),yield r.loadAssets(),r}))}static resolveOptions(e={}){let t=Object.assign({},e);return t.blurStrength||(t.blurStrength=d.default.MEDIUM),t.logger||(t.logger=new o.default("BackgroundBlurProcessor",s.default.INFO)),t=super.resolveOptions(t),t}static isSupported(e,t){return e=h.resolveSpec(e),t=h.resolveOptions(t),super.isSupported(e,t)}}t.default=h},9852:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4627);class r extends i.default{}t.default=r},22:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(){this.path=null,this.input=null,this.output=null}static builder(){return new n}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=n},3368:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,n,i){this.delegate=e,this.reportingPeriodMillis=t,this.filterCPUUtilization=n,this.logger=i,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 n=this.filterCount,i=this.filterTotalMillis;if(this.filterCount=0,this.filterTotalMillis=0,this.lastReportedEventTimestamp=e,0===this.framerate||0===n)return;const r=Math.round(i/n),o=Math.round(this.framerate*(t/1e3))-n,s=Math.round(100*i/t);r>=this.filterDurationNotifyMillis&&this.delegate.filterFrameDurationHigh({framesDropped:o,avgFilterDurationMillis:r,framerate:this.framerate,periodMillis:t}),s>=this.filterCPUUtilization&&this.delegate.filterCPUUtilizationHigh({cpuUtilization:s,filterMillis:i,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,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundFilterMonitor=void 0;const r=n(5021),o=n(9807),s=n(3368);class a{constructor(){this.value=void 0,this.resolve=null}whenNext(){return this.promise||(this.promise=new Promise((e=>this.resolve=e))),this.promise}next(e){this.value=e,this.resolve(e),delete this.promise}}class l{constructor(e,t,n,i){this.targetCanvas=document.createElement("canvas"),this.canvasCtx=this.targetCanvas.getContext("2d"),this.canvasVideoFrameBuffer=new o.default(this.targetCanvas),this.mask$=new a,this.sourceWidth=0,this.sourceHeight=0,this.frameNumber=0,this.videoFramesPerFilterUpdate=1,this.initWorkerPromise=l.createWorkerPromise(),this.loadModelPromise=l.createWorkerPromise(),this.modelInitialized=!1,this.destroyed=!1,this.filterType=e,this.validateSpec(t),this.validateOptions(n),this.spec=t,this.logger=n.logger,this.delegate=i,this.initCPUMonitor(n)}static createWorkerPromise(){const e={resolve:null,reject:null,promise:null};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),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 s.default(this.delegate,e.reportingPeriodMillis,e.filterCPUUtilization,this.logger),this.cpuMonitor=new c(5e3,{reduceCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.min(this.videoFramesPerFilterUpdate+1,10))},increaseCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.max(this.videoFramesPerFilterUpdate-1,1))}}),this.delegate.addObserver(this.cpuMonitor)}stringify(e){return JSON.stringify(e,null,2)}handleInitialize(e){if(this.logger.info(`received initialize message: ${this.stringify(e)}`),!e.payload)return this.logger.error("failed to initialize module"),void this.initWorkerPromise.reject(new Error("failed to initialize the module"));const t=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:t.path,inputHeight:t.input.height,inputWidth:t.input.width,inputChannels:4,modelRangeMin:t.input.range[0],modelRangeMax:t.input.range[1],blurPixels:0}}),this.initWorkerPromise.resolve({})}handleLoadModel(e){if(this.logger.info(`received load model message: ${this.stringify(e)}`),2!==e.payload)return this.logger.error("failed to load model! status: "+e.payload),void this.loadModelPromise.reject(new Error("failed to load model! status: "+e.payload));this.modelInitialized=!0,this.loadModelPromise.resolve({})}handlePredict(e){this.mask$.next(e.payload.output)}handleWorkerEvent(e){const t=e.data;switch(t.msg){case"initialize":this.handleInitialize(t);break;case"loadModel":this.handleLoadModel(t);break;case"predict":this.handlePredict(t);break;default:this.logger.info(`unexpected event msg: ${this.stringify(t)}`)}}loadAssets(){return i(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 i(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 n=t.width,i=t.height;if(0===n||0===i)return e;0===this.sourceWidth&&(this.sourceWidth=n,this.sourceHeight=i,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===n&&this.sourceHeight===i||(this.sourceWidth=n,this.sourceHeight=i,this.targetCanvas.width=this.sourceWidth,this.targetCanvas.height=this.sourceHeight);try{this.frameCounter.filterSubmitted();let e=this.mask$.value;const n=this.spec.model.input.width/t.width,i=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(n,i),r.drawImage(t,0,0),r.restore();const o=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:o},[o.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,n,r;return i(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===(n=this.targetCanvas)||void 0===n||n.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=l;class c{constructor(e,t){this.monitoringPeriodMillis=e,this.observer=t,this.lastCPUChangeTimestamp=0}filterCPUUtilizationHigh(){const e=Date.now();e-this.lastCPUChangeTimestamp>=this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=e,this.observer.reduceCPUUtilization())}frameReceived(){const e=Date.now();e-this.lastCPUChangeTimestamp>=2*this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=e,this.observer.increaseCPUUtilization())}}t.BackgroundFilterMonitor=c},4243:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5021),o=n(9424),s=n(22),a=n(543),l=n(4046),c=()=>s.default.builder().withSelfieSegmentationDefaults().build(),d="https://static.sdkassets.chime.aws",u={worker:`${d}/bgblur/workers/worker.js`,wasm:`${d}/bgblur/wasm/_cwt-wasm.wasm`,simd:`${d}/bgblur/wasm/_cwt-wasm-simd.wasm`};t.default=class{static defaultAssetSpec(){const e=l.default.sdkVersionSemVer;return{assetGroup:`sdk-${e.major}.${e.minor}`}}static createUrlWithParams(e,t){const n=new URL(e),i=Object.keys(t);for(const e of i)void 0!==t[e]&&n.searchParams.set(e,t[e]);return n.toString()}static resolveSpec(e){const{paths:t=u,model:n=c(),assetGroup:i=this.defaultAssetSpec().assetGroup,revisionID:r=this.defaultAssetSpec().revisionID}=e||{},o={assetGroup:i,revisionID:r,sdk:encodeURIComponent(l.default.sdkVersion),ua:encodeURIComponent(l.default.sdkUserAgentLowResolution)};return t.worker=this.createUrlWithParams(t.worker,o),t.wasm=this.createUrlWithParams(t.wasm,o),t.simd=this.createUrlWithParams(t.simd,o),n.path=this.createUrlWithParams(n.path,o),{paths:t,model:n,assetGroup:i,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:n}=t;return"undefined"==typeof globalThis?(n.info("Browser does not have globalThis."),Promise.resolve(!1)):(new a.default).supportsBackgroundFilter()?o.supportsWASM(globalThis,n)?this.supportsBackgroundFilter(globalThis,e,n):(n.info("Browser does not support WASM."),Promise.resolve(!1)):(n.info("Browser is not supported."),Promise.resolve(!1))}static supportsBackgroundFilter(e=globalThis,t,n){return i(this,void 0,void 0,(function*(){if(!o.supportsWorker(e,n))return n.info("Browser does not support web workers."),!1;const i=t.paths.worker;try{const e=yield r.loadWorker(i,"BackgroundFilterWorker",{},null);try{e.terminate()}catch(e){n.info(`Failed to terminate worker. ${e.message}`)}return!0}catch(e){return n.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 n of this.observers)null===(t=n.filterFrameDurationHigh)||void 0===t||t.call(n,e)}filterCPUUtilizationHigh(e){var t;for(const n of this.observers)null===(t=n.filterCPUUtilizationHigh)||void 0===t||t.call(n,e)}}},9392:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1851),o=n(1447);class s extends r.default{constructor(e,t){super("background replacement",e,t,new o.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 i(this,void 0,void 0,(function*(){this.replacementBlob=e,this.replacementImage=yield s.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:n,targetCanvas:i}=this,{width:r,height:o}=i;n.save(),n.clearRect(0,0,r,o),n.drawImage(this.scaledCanvas,0,0,r,o),n.globalCompositeOperation="source-in",n.drawImage(e,0,0,r,o),n.globalCompositeOperation="destination-over",n.drawImage(this.replacementImage,0,0,i.width,i.height),n.restore()}static loadImageExecutor(e,t,n){const i=new Image;i.crossOrigin="Anonymous",i.addEventListener("load",(()=>{e(i)}),!1),i.addEventListener("error",(e=>{t(new Error(`Could not load replacement image ${i.src}: ${e.message}`))}),!1),i.src=n}static loadImage(e){return i(this,void 0,void 0,(function*(){return new Promise(((t,n)=>this.loadImageExecutor(t,n,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 i(this,void 0,void 0,(function*(){this.replacementImage=yield s.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 i(this,void 0,void 0,(function*(){e.destroy.call(this),this.revokeReplacementObjectUrl()}))}}t.default=s},9854:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4243),o=n(8030),s=n(813),a=n(2801),l=n(9392);class c extends a.default{loadAssets(){return i(this,void 0,void 0,(function*(){}))}addObserver(){}removeObserver(){}setImageBlob(){return i(this,void 0,void 0,(function*(){}))}}class d extends r.default{static create(e,t){return i(this,void 0,void 0,(function*(){e=this.resolveSpec(e),t=this.resolveOptions(t),yield this.resolveOptionsAsync(t);const{logger:n}=t;if(!(yield d.isSupported(e,t)))return n.warn("Using no-op processor because background replacement is not supported"),new c;n.info("Using background replacement filter");const i=new l.default(e,t);return yield i.loadAssets(),i}))}static resolveOptions(e={}){const t=Object.assign({},e);return t.logger||(t.logger=new o.default("BackgroundReplacementProcessor",s.default.INFO)),super.resolveOptions(t)}static resolveOptionsAsync(e){return i(this,void 0,void 0,(function*(){if(!e.imageBlob){const t=document.createElement("canvas");t.width=100,t.height=100;const n=t.getContext("2d");n.fillStyle="blue",n.fillRect(0,0,100,100);const i=yield new Promise((e=>{t.toBlob(e)}));e.imageBlob=i}}))}static isSupported(e,t){const n=Object.create(null,{isSupported:{get:()=>super.isSupported}});return i(this,void 0,void 0,(function*(){e=this.resolveSpec(e),t=this.resolveOptions(t),yield this.resolveOptionsAsync(t);const i=t.imageBlob,r=URL.createObjectURL(i);try{yield l.default.loadImage(r)}catch(e){return t.logger.info(`Failed to fetch load replacement image ${e.message}`),!1}finally{URL.revokeObjectURL(r)}return n.isSupported.call(this,e,t)}))}}t.default=d},1447:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4627);class r extends i.default{}t.default=r},8434:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,n){this.fixedWaitMs=e,this.shortBackoffMs=t,this.longBackoffMs=n,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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8434),r=n(7300);t.default=class{constructor(e,t,n){this.fixedWaitMs=e,this.shortBackoffMs=t,this.longBackoffMs=n}create(){return new i.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs)}createWithLimit(e){return new r.default(this.fixedWaitMs,this.shortBackoffMs,this.longBackoffMs,e)}}},7300:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8434);class r extends i.default{constructor(e,t,n,i){super(e,t,n),this.limit=i,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,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3631),o=n(2238);class s{constructor(){this.browser=r.detect(),this.uaParserResult=navigator&&navigator.userAgent?new o.UAParser(navigator.userAgent).getResult():null,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])}osMajorVersion(){return parseInt(this.uaParserResult.os.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()}requiresPlaybackLatencyHintForAudioContext(){return-1!==navigator.userAgent.indexOf("Windows")}supportsCanvasCapturedStreamPlayback(){return!this.isIOSSafari()&&!this.isIOSChrome()&&!this.isIOSFirefox()||this.osMajorVersion()>=s.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK}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()<this.browserSupport[this.browser.name]||"firefox"===this.browser.name&&this.isAndroid())}isSimulcastSupported(){return this.hasChromiumWebRTC()}supportDownlinkBandwidthEstimation(){return!this.isFirefox()}supportString(){if(this.isAndroid())return`${this.browserName.chrome} ${this.browserSupport.chrome}+, ${this.browserName.samsung} ${this.browserSupport.samsung}+`;const e=[];for(const t in this.browserSupport)e.push(`${this.browserName[t]} ${this.browserSupport[t]}+`);return e.join(", ")}supportedVideoCodecs(){return i(this,void 0,void 0,(function*(){const e=new RTCPeerConnection;return e.addTransceiver("video",{direction:"inactive",streams:[]}),(yield e.createOffer({offerToReceiveVideo:!0})).sdp.split("\r\n").filter((e=>e.includes("a=rtpmap:"))).map((e=>e.replace(/.* /,"").replace(/\/.*/,""))).filter(((e,t,n)=>n.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)}}t.default=s,s.MIN_IOS_SUPPORT_CANVAS_STREAM_PLAYBACK=16},4571:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(289),r=n(6196),o=n(9496),s=n(2306);class a{constructor(e,t,n){this.logger=e,this.videoStreamIndex=t,this.selfAttendeeId=n,this.globalMetricReport=new s.default,this.streamMetricReports={},this.rtcStatsReport={},this.currentTimestampMs=0,this.previousTimestampMs=0,this.currentSsrcs={},this.identityValue=(e,t)=>{const n=t?this.streamMetricReports[t]:this.globalMetricReport;return Number(n.currentMetrics[e])},this.decoderLossPercent=(e,t)=>{const n=this.streamMetricReports[t],i=n.currentMetrics.concealedSamples-(n.previousMetrics.concealedSamples||0),r=n.currentMetrics.totalSamplesReceived-(n.previousMetrics.totalSamplesReceived||0);return r<=0||r-i<=0?0:i/r*100},this.packetLossPercent=(e,t)=>{const n=this.streamMetricReports[t],i=n.currentMetrics[e]-(n.previousMetrics[e]||0),r=n.currentMetrics.packetsLost-(n.previousMetrics.packetsLost||0),o=i+r;return o<=0||r<=0?0:100*r/o},this.jitterBufferMs=(e,t)=>{const n=this.streamMetricReports[t],i=n.currentMetrics.jitterBufferDelay-(n.previousMetrics.jitterBufferDelay||0),r=n.currentMetrics.jitterBufferEmittedCount-(n.previousMetrics.jitterBufferEmittedCount||0);return i<=0||r<=0?0:i/r*1e3},this.countPerSecond=(e,t)=>{const n=t?this.streamMetricReports[t]:this.globalMetricReport;let i=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(i<=0)return 0;this.previousTimestampMs<=0&&(i=1);const r=n.currentMetrics[e]-(n.previousMetrics[e]||0);return r<=0?0:Math.trunc(r/i)},this.bitsPerSecond=(e,t)=>{const n=t?this.streamMetricReports[t]:this.globalMetricReport;let i=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(i<=0)return 0;this.previousTimestampMs<=0&&(i=1);const r=8*(n.currentMetrics[e]-(n.previousMetrics[e]||0));return r<=0?0:Math.trunc(r/i)},this.secondsToMilliseconds=(e,t)=>{const n=t?this.streamMetricReports[t]:this.globalMetricReport;return Number(1e3*n.currentMetrics[e])},this.averageTimeSpentPerSecondInMilliseconds=(e,t)=>{const n=t?this.streamMetricReports[t]:this.globalMetricReport;let i=(this.currentTimestampMs-this.previousTimestampMs)/1e3;if(i<=0)return 0;this.previousTimestampMs<=0&&(i=1);const r=n.currentMetrics[e]-(n.previousMetrics[e]||0);return r<=0?0:1e3*r/i},this.isHardwareImplementation=(e,t)=>{const n=this.streamMetricReports[t],i=String(n.currentStringMetrics[e]),r=i.includes("ExternalDecoder")||i.includes("ExternalEncoder")||i.includes("EncodeAccelerator")||i.includes("DecodeAccelerator"),o=i.includes("fallback from");return r&&!o?1:0},this.globalMetricMap={retransmittedBytesSent:{transform:this.identityValue,type:i.SdkMetric.Type.VIDEO_RETRANSMIT_BITRATE},totalEncodedBytesTarget:{transform:this.identityValue,type:i.SdkMetric.Type.VIDEO_TARGET_ENCODER_BITRATE},totalPacketSendDelay:{transform:this.identityValue,type:i.SdkMetric.Type.VIDEO_BUCKET_DELAY_MS},packetsDiscardedOnSend:{transform:this.countPerSecond,type:i.SdkMetric.Type.SOCKET_DISCARDED_PPS},availableIncomingBitrate:{transform:this.identityValue,type:i.SdkMetric.Type.VIDEO_AVAILABLE_RECEIVE_BANDWIDTH},availableOutgoingBitrate:{transform:this.identityValue,type:i.SdkMetric.Type.VIDEO_AVAILABLE_SEND_BANDWIDTH},currentRoundTripTime:{transform:this.secondsToMilliseconds,type:i.SdkMetric.Type.STUN_RTT_MS}},this.audioUpstreamMetricMap={jitter:{transform:this.secondsToMilliseconds,type:i.SdkMetric.Type.RTC_MIC_JITTER_MS},packetsSent:{transform:this.countPerSecond,type:i.SdkMetric.Type.RTC_MIC_PPS},bytesSent:{transform:this.bitsPerSecond,type:i.SdkMetric.Type.RTC_MIC_BITRATE},roundTripTime:{transform:this.secondsToMilliseconds,type:i.SdkMetric.Type.RTC_MIC_RTT_MS},packetsLost:{transform:this.packetLossPercent,type:i.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:i.SdkMetric.Type.RTC_SPK_FRACTION_DECODER_LOSS_PERCENT},packetsReceived:{transform:this.countPerSecond,type:i.SdkMetric.Type.RTC_SPK_PPS},packetsLost:{transform:this.packetLossPercent,type:i.SdkMetric.Type.RTC_SPK_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},jitter:{transform:this.secondsToMilliseconds,type:i.SdkMetric.Type.RTC_SPK_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:i.SdkMetric.Type.RTC_SPK_JITTER_BUFFER_MS},bytesReceived:{transform:this.bitsPerSecond,type:i.SdkMetric.Type.RTC_SPK_BITRATE}},this.videoUpstreamMetricMap={roundTripTime:{transform:this.secondsToMilliseconds,type:i.SdkMetric.Type.VIDEO_SENT_RTT_MS},nackCount:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_NACKS_RECEIVED},pliCount:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_PLIS_RECEIVED},firCount:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_FIRS_RECEIVED},framesPerSecond:{transform:this.identityValue,type:i.SdkMetric.Type.VIDEO_INPUT_FPS},framesEncoded:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_ENCODE_FPS},packetsSent:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_SENT_PPS},packetsLost:{transform:this.packetLossPercent,type:i.SdkMetric.Type.VIDEO_SENT_FRACTION_PACKET_LOST_PERCENT,source:"packetsSent"},bytesSent:{transform:this.bitsPerSecond,type:i.SdkMetric.Type.VIDEO_SENT_BITRATE},qpSum:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_SENT_QP_SUM},frameHeight:{transform:this.identityValue,type:i.SdkMetric.Type.VIDEO_ENCODE_HEIGHT},frameWidth:{transform:this.identityValue,type:i.SdkMetric.Type.VIDEO_ENCODE_WIDTH},jitter:{transform:this.secondsToMilliseconds},totalEncodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:i.SdkMetric.Type.VIDEO_ENCODE_MS},encoderImplementation:{transform:this.isHardwareImplementation,type:i.SdkMetric.Type.VIDEO_ENCODER_IS_HARDWARE}},this.videoDownstreamMetricMap={packetsReceived:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_RECEIVED_PPS},packetsLost:{transform:this.packetLossPercent,type:i.SdkMetric.Type.VIDEO_RECEIVED_FRACTION_PACKET_LOST_PERCENT,source:"packetsReceived"},framesReceived:{transform:this.identityValue,type:i.SdkMetric.Type.VIDEO_RECEIVED_FPS},framesDecoded:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_DECODE_FPS},nackCount:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_NACKS_SENT},firCount:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_FIRS_SENT},pliCount:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_PLIS_SENT},bytesReceived:{transform:this.bitsPerSecond,type:i.SdkMetric.Type.VIDEO_RECEIVED_BITRATE},jitter:{transform:this.secondsToMilliseconds,type:i.SdkMetric.Type.VIDEO_RECEIVED_JITTER_MS},jitterBufferDelay:{transform:this.countPerSecond},jitterBufferEmittedCount:{transform:this.countPerSecond},jitterBufferMs:{transform:this.jitterBufferMs,type:i.SdkMetric.Type.VIDEO_JITTER_BUFFER_MS},qpSum:{transform:this.countPerSecond,type:i.SdkMetric.Type.VIDEO_RECEIVED_QP_SUM},frameHeight:{transform:this.identityValue,type:i.SdkMetric.Type.VIDEO_DECODE_HEIGHT},frameWidth:{transform:this.identityValue,type:i.SdkMetric.Type.VIDEO_DECODE_WIDTH},totalDecodeTime:{transform:this.averageTimeSpentPerSecondInMilliseconds,type:i.SdkMetric.Type.VIDEO_DECODE_MS},decoderImplementation:{transform:this.isHardwareImplementation,type:i.SdkMetric.Type.VIDEO_DECODER_IS_HARDWARE}},this.streamDimensionMap={encoderImplementation:i.SdkStreamDimension.Type.VIDEO_ENCODER_NAME,decoderImplementation:i.SdkStreamDimension.Type.VIDEO_DECODER_NAME},this.observableVideoMetricSpec={videoUpstreamBitrate:{source:"bytesSent",media:o.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamPacketsSent:{source:"packetsSent",media:o.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamPacketLossPercent:{source:"packetsLost",media:o.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamFramesEncodedPerSecond:{source:"framesEncoded",media:o.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamFrameHeight:{source:"frameHeight",media:o.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamFrameWidth:{source:"frameWidth",media:o.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamJitterMs:{source:"jitter",media:o.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamRoundTripTimeMs:{source:"roundTripTime",media:o.default.VIDEO,dir:r.default.UPSTREAM},videoDownstreamBitrate:{source:"bytesReceived",media:o.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamPacketLossPercent:{source:"packetsLost",media:o.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamPacketsReceived:{source:"packetsReceived",media:o.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamFramesDecodedPerSecond:{source:"framesDecoded",media:o.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamFrameHeight:{source:"frameHeight",media:o.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamFrameWidth:{source:"frameWidth",media:o.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamJitterMs:{source:"jitter",media:o.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamDelayMs:{source:"jitterBufferMs",media:o.default.VIDEO,dir:r.default.DOWNSTREAM}},this.observableMetricSpec={audioPacketsReceived:{source:"packetsReceived",media:o.default.AUDIO,dir:r.default.DOWNSTREAM},audioPacketsReceivedFractionLoss:{source:"packetsLost",media:o.default.AUDIO,dir:r.default.DOWNSTREAM},audioDecoderLoss:{source:"decoderLoss",media:o.default.AUDIO,dir:r.default.DOWNSTREAM},audioPacketsSent:{source:"packetsSent",media:o.default.AUDIO,dir:r.default.UPSTREAM},audioPacketLossPercent:{source:"packetsLost",media:o.default.AUDIO,dir:r.default.UPSTREAM},audioUpstreamRoundTripTimeMs:{source:"roundTripTime",media:o.default.AUDIO,dir:r.default.UPSTREAM},videoUpstreamBitrate:{source:"bytesSent",media:o.default.VIDEO,dir:r.default.UPSTREAM},videoPacketSentPerSecond:{source:"packetsSent",media:o.default.VIDEO,dir:r.default.UPSTREAM},audioSpeakerDelayMs:{source:"jitterBufferMs",media:o.default.AUDIO,dir:r.default.DOWNSTREAM},audioUpstreamJitterMs:{source:"jitter",media:o.default.AUDIO,dir:r.default.UPSTREAM},audioDownstreamJitterMs:{source:"jitter",media:o.default.AUDIO,dir:r.default.DOWNSTREAM},nackCountReceivedPerSecond:{source:"nackCount",media:o.default.VIDEO,dir:r.default.UPSTREAM},availableOutgoingBitrate:{source:"availableOutgoingBitrate"},availableIncomingBitrate:{source:"availableIncomingBitrate"},currentRoundTripTimeMs:{source:"currentRoundTripTime"}}}getMetricMap(e,t){switch(e){case o.default.AUDIO:switch(t){case r.default.UPSTREAM:return this.audioUpstreamMetricMap;case r.default.DOWNSTREAM:return this.audioDownstreamMetricMap}case o.default.VIDEO:switch(t){case r.default.UPSTREAM:return this.videoUpstreamMetricMap;case r.default.DOWNSTREAM:return this.videoDownstreamMetricMap}default:return this.globalMetricMap}}getStreamDimensionMap(){return this.streamDimensionMap}getObservableMetricValue(e){const t=this.observableMetricSpec[e],n=this.getMetricMap(t.media,t.dir)[t.source],{transform:i,source:r}=n;if(!t.hasOwnProperty("media"))return i(r||t.source);for(const e in this.streamMetricReports){const n=this.streamMetricReports[e];if(n.direction===t.dir&&n.mediaType===t.media)return i(r||t.source,Number(e))}return 0}getObservableVideoMetricValue(e,t){const n=this.observableVideoMetricSpec[e],i=this.getMetricMap(n.media,n.dir)[n.source],{transform:r,source:o}=i;return r(o||n.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===o.default.VIDEO){const n={};for(const e in this.observableVideoMetricSpec)if(this.observableVideoMetricSpec[e].dir===this.streamMetricReports[t].direction){const i=this.getObservableVideoMetricValue(e,Number(t));isNaN(i)||(n[e]=i)}const i=this.streamMetricReports[t].streamId,r=i?this.videoStreamIndex.attendeeIdForStreamId(i):this.selfAttendeeId;e[r]=e[r]?e[r]:{},e[r][t]=n}return e}getRTCStatsReport(){return this.rtcStatsReport}clone(){const e=new a(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=a},6196:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ClientMetricReportDirection=void 0,function(e){e[e.UPSTREAM=0]="UPSTREAM",e[e.DOWNSTREAM=1]="DOWNSTREAM"}(n=t.ClientMetricReportDirection||(t.ClientMetricReportDirection={})),t.default=n},9496:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ClientMetricReportMediaType=void 0,function(e){e[e.AUDIO=0]="AUDIO",e[e.VIDEO=1]="VIDEO"}(n=t.ClientMetricReportMediaType||(t.ClientMetricReportMediaType={})),t.default=n},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={},this.currentStringMetrics={}}}},2811:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.previousMetrics={},this.currentMetrics={},this.currentStringMetrics={}}}},3940:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,n){this.minHealth=e.minHealth,this.maxHealth=e.maxHealth,this.currentHealth=e.initialHealth,this.currentData=t.clone(),this.name=n}minimumHealth(){return this.minHealth}maximumHealth(){return this.maxHealth}health(){return this.maximumHealth()}update(e){this.currentData=e}getConnectionHealthData(){return this.currentData.clone()}healthy(){return this.health()>this.minimumHealth()}healthIfChanged(){const e=this.health();return e!==this.currentHealth?(this.currentHealth=e,e):null}}},6688:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(){this.connectionStartTimestampMs=0,this.consecutiveStatsWithNoPackets=0,this.consecutiveStatsWithNoAudioPacketsSent=0,this.lastPacketLossInboundTimestampMs=0,this.lastGoodSignalTimestampMs=0,this.lastWeakSignalTimestampMs=0,this.lastNoSignalTimestampMs=0,this.consecutiveMissedPongs=0,this.packetsReceivedInLastMinute=[],this.fractionPacketsLostInboundInLastMinute=[],this.audioSpeakerDelayMs=0,this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}static isTimestampRecent(e,t){return Date.now()<e+t}setConnectionStartTime(){this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}reset(){this.connectionStartTimestampMs=0,this.consecutiveStatsWithNoPackets=0,this.consecutiveStatsWithNoAudioPacketsSent=0,this.lastPacketLossInboundTimestampMs=0,this.lastGoodSignalTimestampMs=0,this.lastWeakSignalTimestampMs=0,this.lastNoSignalTimestampMs=0,this.consecutiveMissedPongs=0,this.packetsReceivedInLastMinute=[],this.fractionPacketsLostInboundInLastMinute=[],this.audioSpeakerDelayMs=0,this.connectionStartTimestampMs=Date.now(),this.lastGoodSignalTimestampMs=Date.now()}isConnectionStartRecent(e){return n.isTimestampRecent(this.connectionStartTimestampMs,e)}isLastPacketLossRecent(e){return n.isTimestampRecent(this.lastPacketLossInboundTimestampMs,e)}isGoodSignalRecent(e){return n.isTimestampRecent(this.lastGoodSignalTimestampMs,e)}isWeakSignalRecent(e){return n.isTimestampRecent(this.lastWeakSignalTimestampMs,e)}isNoSignalRecent(e){return n.isTimestampRecent(this.lastNoSignalTimestampMs,e)}clone(){const e=new n;return e.connectionStartTimestampMs=this.connectionStartTimestampMs,e.consecutiveStatsWithNoPackets=this.consecutiveStatsWithNoPackets,e.consecutiveStatsWithNoAudioPacketsSent=this.consecutiveStatsWithNoAudioPacketsSent,e.lastPacketLossInboundTimestampMs=this.lastPacketLossInboundTimestampMs,e.lastGoodSignalTimestampMs=this.lastGoodSignalTimestampMs,e.lastWeakSignalTimestampMs=this.lastWeakSignalTimestampMs,e.lastNoSignalTimestampMs=this.lastNoSignalTimestampMs,e.consecutiveMissedPongs=this.consecutiveMissedPongs,e.packetsReceivedInLastMinute=this.packetsReceivedInLastMinute.slice(0),e.fractionPacketsLostInboundInLastMinute=this.fractionPacketsLostInboundInLastMinute.slice(0),e.audioSpeakerDelayMs=this.audioSpeakerDelayMs,e}setConsecutiveMissedPongs(e){this.consecutiveMissedPongs=e}setConsecutiveStatsWithNoPackets(e){this.consecutiveStatsWithNoPackets=e}setConsecutiveStatsWithNoAudioPacketsSent(e){this.consecutiveStatsWithNoAudioPacketsSent=e}setLastPacketLossInboundTimestampMs(e){this.lastPacketLossInboundTimestampMs=e}setLastNoSignalTimestampMs(e){this.lastNoSignalTimestampMs=e}setLastWeakSignalTimestampMs(e){this.lastWeakSignalTimestampMs=e}setLastGoodSignalTimestampMs(e){this.lastGoodSignalTimestampMs=e}setAudioSpeakerDelayMs(e){this.audioSpeakerDelayMs=e}}t.default=n},3731:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.minHealth=0,this.maxHealth=1,this.initialHealth=1,this.connectionUnhealthyThreshold=25,this.noSignalThresholdTimeMs=1e4,this.connectionWaitTimeMs=1e4,this.zeroBarsNoSignalTimeMs=5e3,this.oneBarWeakSignalTimeMs=5e3,this.twoBarsTimeMs=5e3,this.threeBarsTimeMs=1e4,this.fourBarsTimeMs=2e4,this.fiveBarsTimeMs=6e4,this.cooldownTimeMs=6e4,this.pastSamplesToConsider=15,this.goodSignalTimeMs=15e3,this.fractionalLoss=.5,this.packetsExpected=50,this.maximumTimesToWarn=2,this.missedPongsLowerThreshold=1,this.missedPongsUpperThreshold=4,this.maximumAudioDelayMs=6e4,this.maximumAudioDelayDataPoints=10,this.sendingAudioFailureSamplesToConsider=2,this.sendingAudioFailureInitialWaitTimeMs=3e3}}},9708:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3940);class r extends i.default{constructor(e,t,n){super(t,n,"Reconnection Health"),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 n=this.audioDelayPointsOverMaximum>r.MAXIMUM_AUDIO_DELAY_DATA_POINTS;return n&&(this.audioDelayPointsOverMaximum=0),e||t||n?(this.logger.warn(`reconnection recommended due to: no packets received: ${e}, missed pongs: ${t}, bad audio delay: ${n}`),0):1}}t.default=r},2977:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3940);class r extends i.default{constructor(e,t,n){super(t,n,"Sending Audio Health"),this.logger=e,this.sendingAudioFailureSamplesToConsider=t.sendingAudioFailureSamplesToConsider>0?t.sendingAudioFailureSamplesToConsider:1,this.sendingAudioFailureInitialWaitTimeMs=t.sendingAudioFailureInitialWaitTimeMs,this.maximumTimesToWarn=t.maximumTimesToWarn,this.coolDownTimeMs=t.cooldownTimeMs,this.lastWarnTimestampMs=0,this.warnCount=0}isSendingAudioUnhealthy(){const e=!this.currentData.isConnectionStartRecent(this.sendingAudioFailureInitialWaitTimeMs),t=this.currentData.consecutiveStatsWithNoAudioPacketsSent>=this.sendingAudioFailureSamplesToConsider;return e&&t}health(){if(this.isSendingAudioUnhealthy()){const e=Date.now()-this.lastWarnTimestampMs<this.coolDownTimeMs;return this.currentHealth>this.minimumHealth()&&!e?(this.logger.warn(`Sending Audio is unhealthy for ${this.sendingAudioFailureSamplesToConsider} seconds consecutively.`),this.warnCount++,this.warnCount>this.maximumTimesToWarn?(this.logger.warn("SendingAudioFailure health policy maximum warnings breached. Falling back to reporting healthy."),this.maximumHealth()):(this.lastWarnTimestampMs=Date.now(),this.minimumHealth())):this.currentHealth}return this.maximumHealth()}}t.default=r},1922:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3940);class r extends i.default{constructor(e,t){super(e,t,"Unusable Audio Warning"),this.coolDownTimeMs=e.cooldownTimeMs,this.pastSamplesToConsider=e.pastSamplesToConsider,this.fractionalLoss=e.fractionalLoss,this.packetsExpected=e.packetsExpected,this.maximumTimesToWarn=e.maximumTimesToWarn,this.lastWarnTimestampMs=0,this.warnCount=0}calculateFractionalLoss(){if(this.currentData.packetsReceivedInLastMinute.length<this.pastSamplesToConsider)return 0;const e=this.pastSamplesToConsider,t=e*this.packetsExpected;let n=0;for(let t=0;t<e;t++)n+=this.currentData.packetsReceivedInLastMinute[t];return Math.min(Math.max(1-n/t,0),1)}health(){return Date.now()-this.lastWarnTimestampMs<this.coolDownTimeMs?this.currentHealth:this.calculateFractionalLoss()>=this.fractionalLoss?0!==this.currentHealth&&(this.lastWarnTimestampMs=Date.now(),this.warnCount++,this.warnCount>this.maximumTimesToWarn)?1:0:1}}t.default=r},8581:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8660);t.default=class{constructor(e,t,n,i,r){this.audioVideoController=e,this.realtimeController=t,this.connectionHealthData=n,this.pingPong=i,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,n){this.connectionHealthData.setConsecutiveMissedPongs(0),this.statsCollector.logLatency("ping_pong",t),this.statsCollector.logLatency("ping_pong_clock_skew",n),this.updateConnectionHealth()}didMissPongs(){this.connectionHealthData.setConsecutiveMissedPongs(this.connectionHealthData.consecutiveMissedPongs+1),this.updateConnectionHealth()}metricsDidReceive(e){let t=0,n=0;const i=e.getObservableMetrics(),r=i.audioPacketsReceived,o=i.audioPacketsReceivedFractionLoss,s=i.audioSpeakerDelayMs;"number"!=typeof s||isNaN(s)||this.connectionHealthData.setAudioSpeakerDelayMs(s),"number"==typeof r&&"number"==typeof o&&(t=r,n=o,t<0||n<0||(this.addToMinuteWindow(this.connectionHealthData.packetsReceivedInLastMinute,t),this.addToMinuteWindow(this.connectionHealthData.fractionPacketsLostInboundInLastMinute,n),t>0?(this.hasSeenValidPacketMetricsBefore=!0,this.connectionHealthData.setConsecutiveStatsWithNoPackets(0)):this.hasSeenValidPacketMetricsBefore&&this.connectionHealthData.setConsecutiveStatsWithNoPackets(this.connectionHealthData.consecutiveStatsWithNoPackets+1),(0===t||n>0)&&this.connectionHealthData.setLastPacketLossInboundTimestampMs(Date.now()),"number"==typeof i.audioPacketsSent&&this.updateAudioPacketsSentInConnectionHealth(i.audioPacketsSent),this.updateConnectionHealth()))}updateAudioPacketsSentInConnectionHealth(e){e>0?this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(0):this.connectionHealthData.setConsecutiveStatsWithNoAudioPacketsSent(this.connectionHealthData.consecutiveStatsWithNoAudioPacketsSent+1)}addToMinuteWindow(e,t){e.unshift(t),e.length>60&&e.pop()}updateConnectionHealth(){this.audioVideoController.forEachObserver((e=>{i.Maybe.of(e.connectionHealthDidChange).map((t=>t.bind(e)(this.connectionHealthData.clone())))}))}}},8890:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Modality="#content"}(n||(n={})),t.default=n},8370:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543),o=n(4142);class s{constructor(e){this.logger=e}get mediaStream(){return this._mediaStream}set mediaStream(e){this._mediaStream=e}acquireAudioInputStream(){return i(this,void 0,void 0,(function*(){return 0===this._mediaStream.getAudioTracks().length?(this.logger.info("No audio stream available. Synthesizing an audio stream."),o.default.synthesizeAudioDevice(0)):this._mediaStream}))}acquireVideoInputStream(){return i(this,void 0,void 0,(function*(){return this._mediaStream}))}acquireDisplayInputStream(e){return i(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 i(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||s.defaultFrameRate}}),e&&{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:t||s.defaultFrameRate}})}}toggleMediaStream(e){let t=!1;if(this.mediaStream)for(let n=0;n<this.mediaStream.getTracks().length;n++)this.mediaStream.getTracks()[n].enabled!==e&&(this.mediaStream.getTracks()[n].enabled=e,t=!0);return t}cleanup(){if(this.mediaStream)for(let e=0;e<this.mediaStream.getTracks().length;e++)this.mediaStream.getTracks()[e].stop();this.mediaStream=null}muteLocalAudioInputStream(){throw new Error("unsupported")}unmuteLocalAudioInputStream(){throw new Error("unsupported")}addMediaStreamBrokerObserver(e){}removeMediaStreamBrokerObserver(e){}}t.default=s,s.defaultFrameRate=15},8023:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(589),o=n(8015),s=n(214),a=n(7797),l=n(8660),c=n(3879),d=n(8890);t.default=class{constructor(e,t,n){this.mediaStreamBroker=e,this.contentAudioVideo=t,this.attendeeAudioVideo=n,this.observerQueue=new Set,this.destroyed=!1,this.contentAudioVideo.addObserver(this),this.setupContentShareEvents()}static createContentShareMeetingSessionConfigure(e){const t=new r.default;return t.meetingId=e.meetingId,t.externalMeetingId=e.externalMeetingId,t.urls=e.urls,t.credentials=new o.default,t.credentials.attendeeId=e.credentials.attendeeId+d.default.Modality,t.credentials.externalUserId=e.credentials.externalUserId,t.credentials.joinToken=e.credentials.joinToken+d.default.Modality,t}setContentAudioProfile(e){this.contentAudioVideo.setAudioProfile(e)}enableSimulcastForContentShare(e,t){e?(this.contentAudioVideo.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!0,this.contentAudioVideo.configuration.videoUplinkBandwidthPolicy=new c.default(this.contentAudioVideo.logger,t)):(this.contentAudioVideo.configuration.enableSimulcastForUnifiedPlanChromiumBasedBrowsers=!1,this.contentAudioVideo.configuration.videoUplinkBandwidthPolicy=void 0)}startContentShare(e){return i(this,void 0,void 0,(function*(){if(e){this.mediaStreamBroker.mediaStream=e;for(let e=0;e<this.mediaStreamBroker.mediaStream.getTracks().length;e++)this.mediaStreamBroker.mediaStream.getTracks()[e].addEventListener("ended",(()=>{this.stopContentShare()}));this.contentAudioVideo.start()}}))}startContentShareFromScreenCapture(e,t){return i(this,void 0,void 0,(function*(){const n=yield this.mediaStreamBroker.acquireScreenCaptureDisplayInputStream(e,t);return yield this.startContentShare(n),n}))}pauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!1)&&this.forEachContentShareObserver((e=>{l.Maybe.of(e.contentShareDidPause).map((t=>t.call(e)))}))}unpauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!0)&&this.forEachContentShareObserver((e=>{l.Maybe.of(e.contentShareDidUnpause).map((t=>t.call(e)))}))}setContentShareVideoCodecPreferences(e){this.contentAudioVideo.setVideoCodecSendPreferences(e)}destroy(){return i(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)a.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=>{l.Maybe.of(e.contentShareDidStop).map((t=>t.call(e)))}))}setupContentShareEvents(){this.attendeeAudioVideo.realtimeController.realtimeSubscribeToAttendeeIdPresence(((e,t,n,i)=>{const r=new s.default(e).hasModality(s.default.MODALITY_CONTENT),o=new s.default(e).base()===this.attendeeAudioVideo.configuration.credentials.attendeeId;if(!r||!o||!t||this.contentShareTile)return;const a=this.mediaStreamBroker.mediaStream;if(null==a?void 0:a.getVideoTracks().length){this.contentShareTile=this.attendeeAudioVideo.videoTileController.addVideoTile();const e=a.getVideoTracks()[0];let t,n;if(e.getSettings){const i=e.getSettings();t=i.width,n=i.height}else{const i=e.getCapabilities();t=i.width,n=i.height}this.contentShareTile.bindVideoStream(this.contentAudioVideo.configuration.credentials.attendeeId,!1,a,t,n,null,this.contentAudioVideo.configuration.credentials.externalUserId)}this.forEachContentShareObserver((e=>{l.Maybe.of(e.contentShareDidStart).map((t=>t.call(e)))}))}))}}},7237:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class i{static register(){"document"in n.g&&document.addEventListener&&i.shouldRegisterCSPMonitor&&(i.added||(document.addEventListener("securitypolicyviolation",i.listener),i.added=!0))}static unregister(){"document"in n.g&&document.removeEventListener&&(document.removeEventListener("securitypolicyviolation",i.listener),i.loggers=new Set,i.added=!1)}static disable(){i.shouldRegisterCSPMonitor=!1,i.unregister()}static addLogger(e){e&&i.loggers.add(e)}static removeLogger(e){e&&i.loggers.delete(e)}}t.default=i,i.loggers=new Set,i.shouldRegisterCSPMonitor=!0,i.added=!1,i.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 i.loggers)e.error(t);0===i.loggers.size&&console.error(t)}},1018:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,n,i,r,o){this.timestampMs=e,this.topic=t,this.data=n,this.senderAttendeeId=i,this.senderExternalUserId=r,this.throttled=!!o}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,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543),o=n(6354),s=n(7797),a=n(1515),l=n(8660),c=n(3327),d=n(1746),u=n(8128),h=n(5348),p=n(1238),f=n(3110),m=n(4842),g=n(6991),v=n(6950),b=n(4500),y=n(7170);class S{constructor(e,t,n=new r.default,i){this.logger=e,this.browserBehavior=n,this.eventController=i,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 a.default,this.videoInputTaskQueue=new a.default,this.muted=!1,this.mediaStreamMuteObserver=(e,t)=>{for(const n of this.deviceChangeObservers)s.default.nextTick((()=>{this.deviceChangeObservers.has(n)&&n.audioInputMuteStateChanged&&n.audioInputMuteStateChanged(e,t)}))},this.alreadyHandlingDeviceChange=!1;const{enableWebAudio:l=!1,useMediaConstraintsFallback:c=!0}=t||{};this.useWebAudio=l,this.useMediaConstraintsFallback=c,this.videoInputQualitySettings=new b.default(S.defaultVideoWidth,S.defaultVideoHeight,S.defaultVideoFrameRate);const d=this.browserBehavior.requiresResolutionAlignment(this.videoInputQualitySettings.videoWidth,this.videoInputQualitySettings.videoHeight);this.videoInputQualitySettings.videoWidth=d[0],this.videoInputQualitySettings.videoHeight=d[1],this.logger.info(`DefaultDeviceController video dimension ${this.videoInputQualitySettings.videoWidth} x ${this.videoInputQualitySettings.videoHeight}`);try{this.mediaDeviceWrapper=(new o.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 i(this,void 0,void 0,(function*(){this.stopWatchingDeviceChanges(),yield this.stopAudioInput(),yield this.stopVideoInput()}))}listAudioInputDevices(e=!1){return i(this,void 0,void 0,(function*(){const t=yield this.listDevicesOfKind("audioinput",e);return this.trace("listAudioInputDevices",e,t),t}))}listVideoInputDevices(e=!1){return i(this,void 0,void 0,(function*(){const t=yield this.listDevicesOfKind("videoinput",e);return this.trace("listVideoInputDevices",e,t),t}))}listAudioOutputDevices(e=!1){return i(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 i(this,void 0,void 0,(function*(){return yield this.audioInputTaskQueue.add((()=>this.startAudioInputTask(e)))}))}startAudioInputTask(e){var t;return i(this,void 0,void 0,(function*(){if(void 0!==e)try{return d.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 i(this,void 0,void 0,(function*(){return this.audioInputTaskQueue.add((()=>this.stopAudioInputTask()))}))}stopAudioInputTask(){return i(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 i(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 n=S.getAudioContext();if(n instanceof OfflineAudioContext);else switch(n.state){case"running":break;case"closed":throw new Error("Cannot choose a transform device with a closed audio context.");case"suspended":yield n.resume()}let i;try{i=yield e.createAudioNode(n)}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,i)}))}chooseVideoTransformInputDevice(e){var t;return i(this,void 0,void 0,(function*(){if(e===this.chosenVideoTransformDevice)return void this.logger.info("Reselecting same VideoTransformDevice");const n=this.chosenVideoTransformDevice;n&&this.logger.info("Switched from previous VideoTransformDevice");const i=!!n,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"),i&&n.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 i(this,void 0,void 0,(function*(){return yield this.videoInputTaskQueue.add((()=>this.startVideoInputTask(e)))}))}startVideoInputTask(e){return i(this,void 0,void 0,(function*(){if(e)try{return y.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 i(this,void 0,void 0,(function*(){return this.videoInputTaskQueue.add((()=>this.stopVideoInputTask()))}))}stopVideoInputTask(){return i(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 i(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 n=null===(t=null===(e=this.transform)||void 0===e?void 0:e.nodes)||void 0===t?void 0:t.end;if(n){const e=n.context.createAnalyser();return e.removeOriginalInputs=()=>{try{n.disconnect(e)}catch(e){}},n.connect(e),e}return this.createAnalyserNodeForRawAudioInput()}createAnalyserNodeForRawAudioInput(){return this.activeDevices.audio?this.createAnalyserNodeForStream(this.activeDevices.audio.stream):null}createAnalyserNodeForStream(e){const t=S.getAudioContext(),n=t.createAnalyser(),i=t.createMediaStreamSource(e);return i.connect(n),this.trace("createAnalyserNodeForAudioInput"),n.removeOriginalInputs=()=>{try{i.disconnect(n)}catch(e){}},n}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);c.default.connectVideoStreamToVideoElement(this.chosenVideoTransformDevice?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream,e,!0),this.trace("startVideoPreviewForVideoInput",e.id)}stopVideoPreviewForVideoInput(e){c.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=S.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,n){const i=this.browserBehavior.requiresResolutionAlignment(e,t);this.videoInputQualitySettings=new b.default(i[0],i[1],n)}getVideoInputQualitySettings(){return this.videoInputQualitySettings}acquireAudioInputStream(){return i(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 i(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 i(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 n=t.endedCallback,i=t.trackMuteCallback,r=t.trackUnmuteCallback;for(const o of t.stream.getTracks())o.stop(),n&&o.removeEventListener("ended",n),i&&o.removeEventListener("mute",i),r&&o.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 n=this.activeDevices.audio;if(this.useWebAudio&&(n=this.getMediaStreamDestinationNode()),n){for(const t of n.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 n=t;return"string"==typeof n.exact||Array.isArray(n.exact)?n.exact:void 0}static createEmptyAudioDevice(){return S.synthesizeAudioDevice(0)}static synthesizeAudioDevice(e){const t=S.getAudioContext(),n=t.createMediaStreamDestination();if(e){const i=t.createGain();i.gain.value=.1,i.connect(n);const r=t.createOscillator();r.frequency.value=e,r.connect(i),r.start()}else{const e=t.createBufferSource();try{e.buffer=t.createBuffer(1,5*t.sampleRate,t.sampleRate)}catch(n){if(!n||"NotSupportedError"!==n.name)throw n;e.buffer=t.createBuffer(1,5*S.defaultSampleRate,S.defaultSampleRate)}e.buffer.getChannelData(0)[0]=3e-4,e.loop=!0,e.connect(n),e.start()}return n.stream}listDevicesOfKind(e,t){return i(this,void 0,void 0,(function*(){return!t&&null!==this.deviceInfoCache&&this.isWatchingForDeviceChanges()||(yield this.updateDeviceInfoCacheFromBrowser()),this.listCachedDevicesOfKind(e)}))}updateDeviceInfoCacheFromBrowser(){var e,t;return i(this,void 0,void 0,(function*(){if("undefined"==typeof MediaDeviceInfo)return void(this.deviceInfoCache=[]);let n=yield navigator.mediaDevices.enumerateDevices(),i=!0;for(const e of n)if(!e.label){i=!1;break}if(!i)try{this.logger.info("attempting to trigger media device labels since they are hidden");const e=yield this.deviceLabelTrigger();n=yield navigator.mediaDevices.enumerateDevices();for(const t of e.getTracks())t.stop()}catch(n){this.logger.info("unable to get media device labels"),null===(e=this.eventController)||void 0===e||e.publishEvent("audioInputFailed",{audioInputErrorMessage:this.getErrorMessage(n)}),null===(t=this.eventController)||void 0===t||t.publishEvent("videoInputFailed",{videoInputErrorMessage:this.getErrorMessage(n)})}this.logger.debug(`Update device info cache with devices: ${JSON.stringify(n)}`),this.deviceInfoCache=n}))}listCachedDevicesOfKind(e){const t=[];if(this.deviceInfoCache)for(const n of this.deviceInfoCache)n.kind===e&&t.push(n);return t}handleDeviceChange(){return i(this,void 0,void 0,(function*(){if(null===this.deviceInfoCache)return;if(this.alreadyHandlingDeviceChange)return void s.default.nextTick((()=>{this.handleDeviceChange()}));this.alreadyHandlingDeviceChange=!0;const e=this.listCachedDevicesOfKind("audioinput"),t=this.listCachedDevicesOfKind("videoinput"),n=this.listCachedDevicesOfKind("audiooutput");yield this.updateDeviceInfoCacheFromBrowser();const i=this.listCachedDevicesOfKind("audioinput"),r=this.listCachedDevicesOfKind("videoinput"),o=this.listCachedDevicesOfKind("audiooutput");this.forEachObserver((s=>{this.areDeviceListsEqual(e,i)||l.Maybe.of(s.audioInputsChanged).map((e=>e.bind(s)(i))),this.areDeviceListsEqual(t,r)||l.Maybe.of(s.videoInputsChanged).map((e=>e.bind(s)(r))),this.areDeviceListsEqual(n,o)||l.Maybe.of(s.audioOutputsChanged).map((e=>e.bind(s)(o)))})),this.alreadyHandlingDeviceChange=!1}))}handleDeviceStreamEnded(e,t){return i(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=>{l.Maybe.of(e.audioInputStreamEnded).map((n=>n.bind(e)(t)))})):this.forEachObserver((e=>{l.Maybe.of(e.videoInputStreamEnded).map((n=>n.bind(e)(t)))}))}))}forEachObserver(e){for(const t of this.deviceChangeObservers)s.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,n){var i,r,o,s;let a;return"audio"===e?(a=null==n?void 0:n.audio.streamId,!!a&&a===(null===(r=null===(i=t.constraints)||void 0===i?void 0:i.audio)||void 0===r?void 0:r.streamId)):(a=null==n?void 0:n.video.streamId,!!a&&a===(null===(s=null===(o=null==t?void 0:t.constraints)||void 0===o?void 0:o.video)||void 0===s?void 0:s.streamId))}hasSameGroupId(e,t,n){if(""===e)return!0;const i=S.getIntrinsicDeviceId(n);return this.logger.debug(`Checking deviceIds ${i} of type ${typeof i} with groupId ${e}`),"string"==typeof i&&e===this.getGroupIdFromDeviceId(t,i)}getGroupIdFromDeviceId(e,t){if(null!==this.deviceInfoCache){const n=this.listCachedDevicesOfKind(`${e}input`).find((e=>e.deviceId===t));if(n&&n.groupId)return this.logger.debug(`GroupId of deviceId ${t} found in cache is ${n.groupId}`),n.groupId}return this.logger.debug(`GroupId of deviceId ${t} found in cache is empty`),""}handleGetUserMediaError(e,t){if(!e)throw new h.default(e);switch(e.name){case"NotReadableError":case"TrackStartError":throw new f.default(e);case"NotFoundError":case"DevicesNotFoundError":throw new p.default(e);case"NotAllowedError":case"PermissionDeniedError":case"SecurityError":throw t&&t<S.permissionDeniedOriginDetectionThresholdMs?new g.default(e,"Permission denied by browser"):new g.default(e,"Permission denied by user");case"OverconstrainedError":case"ConstraintNotSatisfiedError":throw new m.default(e);case"TypeError":throw new v.default(e);default:throw new h.default(e)}}matchesDeviceSelection(e,t,n,i){return!!(n&&n.stream.active&&(this.hasSameMediaStreamId(e,n,i)||null!==n.groupId&&this.hasSameGroupId(n.groupId,e,t)))&&(this.logger.debug(`Compare current device constraint ${JSON.stringify(n.constraints)} to proposed constraints ${JSON.stringify(i)}`),n.matchesConstraints(i))}chooseInputIntrinsicDevice(e,t){var n,r;return i(this,void 0,void 0,(function*(){const i=this.getMediaStreamConstraints(e,t);if(this.matchesDeviceSelection(e,t,this.activeDevices[e],i))return void this.logger.info(`reusing existing ${e} input device`);this.activeDevices[e]&&this.activeDevices[e].stream&&this.stopTracksAndRemoveCallbacks(e);const o=Date.now(),s=new u.default;try{this.logger.info(`requesting new ${e} device with constraint ${JSON.stringify(i)}`);const n=this.intrinsicDeviceAsMediaStream(t);"audio"===e&&null===t?(s.stream=S.createEmptyAudioDevice(),s.constraints=null):n?(this.logger.info(`using media stream ${n.id} for ${e} device`),s.stream=n,s.constraints=i):(s.stream=yield navigator.mediaDevices.getUserMedia(i),s.constraints=i),yield this.handleNewInputDevice(e,s)}catch(a){const l=this.getErrorMessage(a);"audio"===e?null===(n=this.eventController)||void 0===n||n.publishEvent("audioInputFailed",{audioInputErrorMessage:l}):null===(r=this.eventController)||void 0===r||r.publishEvent("videoInputFailed",{videoInputErrorMessage:l}),this.logger.error(`failed to get ${e} device for constraints ${JSON.stringify(i)}: ${l}`);let c=!0;if(a&&"constraint"in a&&(this.logger.error(`Over-constrained by constraint: ${a.constraint}`),this.useMediaConstraintsFallback)){const n=this.getMediaStreamConstraints(e,t,!0),r=JSON.stringify(n);if(r!==JSON.stringify(i)){this.logger.info(`retry requesting new ${e} device with minimal constraint ${r}`);try{s.stream=yield navigator.mediaDevices.getUserMedia(n),s.constraints=n,yield this.handleNewInputDevice(e,s),c=!1}catch(t){this.logger.error(`failed to get ${e} device for constraints ${r}: ${this.getErrorMessage(t)}`)}}}if(c){if("audio"===e){this.logger.info(`choosing null ${e} device instead`);try{s.stream=S.createEmptyAudioDevice(),s.constraints=null,yield this.handleNewInputDevice(e,s)}catch(t){this.logger.error(`failed to choose null ${e} device. ${t.name}: ${t.message}`)}}this.handleGetUserMediaError(a,Date.now()-o)}}finally{this.watchForDeviceChangesIfNecessary()}}))}getErrorMessage(e){return e?e.name&&e.message?`${e.name}: ${e.message}`:e.name?e.name:e.message?e.message:"UnknownError":"UnknownError"}handleNewInputDevice(e,t){var n;return i(this,void 0,void 0,(function*(){this.logger.info(`got ${e} device for constraints ${JSON.stringify(t.constraints)}`);const i=null===(n=this.getMediaTrackSettings(t.stream))||void 0===n?void 0:n.deviceId;t.groupId=i?this.getGroupIdFromDeviceId(e,i):"",this.activeDevices[e]=t,this.logger.debug(`Set activeDevice to ${JSON.stringify(t)}`),this.watchForDeviceChangesIfNecessary();const r=t.stream.getTracks()[0];if(r&&(t.endedCallback=()=>{this.activeDevices[e]&&this.activeDevices[e].stream===t.stream&&(this.handleDeviceStreamEnded(e,i),delete t.endedCallback)},r.addEventListener("ended",t.endedCallback,{once:!0})),"audio"===e){const e=t.stream.getAudioTracks()[0];if(e){const n=e.getSettings().deviceId||t.stream;t.trackMuteCallback=()=>{this.mediaStreamMuteObserver(n,!0)},t.trackUnmuteCallback=()=>{this.mediaStreamMuteObserver(n,!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,n,i){if(i&&1===this.listCachedDevicesOfKind(`${e}input`).length)return!0;const r={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?r.deviceId=t:r.deviceId={exact:t},n&&(r.groupId=n),i?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:S.defaultSampleRate}),this.supportSampleSizeConstraint()&&(r.sampleSize={ideal:S.defaultSampleSize}),this.supportChannelCountConstraint()&&(r.channelCount={ideal:S.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,n=!1){let i={};if(!t)return null;const r=this.intrinsicDeviceAsMediaStream(t);if(r)return i.streamId=r.id,this.getMediaStreamConstraintsFromTrackConstraints(e,i);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")),i=this.calculateMediaStreamConstraints(e,t,r,n),this.getMediaStreamConstraintsFromTrackConstraints(e,i)}return function(e){return"object"==typeof e&&"deviceId"in e&&"groupId"in e&&"kind"in e&&"label"in e}(t)?(i=this.calculateMediaStreamConstraints(e,t.deviceId,t.groupId,n),this.getMediaStreamConstraintsFromTrackConstraints(e,i)):(i=t,this.getMediaStreamConstraintsFromTrackConstraints(e,i))}deviceInfoFromDeviceId(e,t){if(null===this.deviceInfoCache)return null;for(const n of this.deviceInfoCache)if(n.kind===e&&n.deviceId===t)return n;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 n=this.getMediaTrackSettings(e);if(!n.deviceId)return!1;const i=S.getIntrinsicDeviceId(t);return"string"==typeof i&&n.deviceId===i}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 n,i;null===(i=null===(n=this.transform)||void 0===n?void 0:n.nodes)||void 0===i||i.end.disconnect(),this.transform={nodes:t,device:e};const r=null==t?void 0:t.end,o=this.getMediaStreamDestinationNode();this.logger.debug(`Connecting transform node ${r} to destination ${o}.`),null==r||r.connect(o),this.reconnectAudioInputs()}removeTransform(){var e;const t=this.transform;if(t)return null===(e=this.transform.nodes)||void 0===e||e.end.disconnect(),this.transform=void 0,this.reconnectAudioInputs(),t}attachAudioInputStreamToAudioContext(e){var t;null===(t=this.audioInputSourceNode)||void 0===t||t.disconnect(),this.audioInputSourceNode=S.getAudioContext().createMediaStreamSource(e);const n=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(n)}getMediaStreamDestinationNode(){return this.audioInputDestinationNode||(this.audioInputDestinationNode=S.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 setDefaultLatencyHint(e){S.defaultLatencyHint=e}static getAudioContext(){if(!S.audioContext){const e={};navigator.mediaDevices.getSupportedConstraints().sampleRate&&(e.sampleRate=S.defaultSampleRate),(new r.default).requiresPlaybackLatencyHintForAudioContext()&&(e.latencyHint="playback"),S.defaultLatencyHint&&(e.latencyHint=S.defaultLatencyHint),S.audioContext=new(window.AudioContext||window.webkitAudioContext)(e)}return S.audioContext}static closeAudioContext(){if(S.audioContext)try{S.audioContext.close()}catch(e){}S.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,n){let i=`API/DefaultDeviceController/${e}`;void 0!==t&&(i+=` ${JSON.stringify(t)}`),void 0!==n&&(i+=` -> ${JSON.stringify(n)}`),this.logger.info(i)}}t.default=S,S.permissionDeniedOriginDetectionThresholdMs=500,S.defaultVideoWidth=960,S.defaultVideoHeight=540,S.defaultVideoFrameRate=15,S.defaultSampleRate=48e3,S.defaultSampleSize=16,S.defaultChannelCount=1,S.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 n extends Error{constructor(e,t){super(t||"Error fetching device."),this.cause=e,this.name="GetUserMediaError"}}t.default=n},6154:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoOpDeviceControllerWithEventController=void 0;const r=n(4015);class o extends r.default{constructor(e){super(),this.destroyed=!1}destroy(){return i(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,n){}getVideoInputQualitySettings(){return null}}t.default=o,t.NoOpDeviceControllerWithEventController=class extends o{constructor(e){super(),this.eventController=e}}},1238:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5348);class r extends i.default{constructor(e){super(e),this.name="NotFoundError"}}t.default=r},3110:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5348);class r extends i.default{constructor(e){super(e),this.name="NotReadableError"}}t.default=r},4842:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5348);class r extends i.default{constructor(e,t){super(e),this.constraint=t,this.name="OverconstrainedError"}}t.default=r},6991:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5348);class r extends i.default{constructor(e,t){super(e,t),this.name="PermissionDeniedError"}}t.default=r},7786:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.inner=e}mute(e){return n(this,void 0,void 0,(function*(){}))}stop(){var e;return n(this,void 0,void 0,(function*(){null===(e=this.node)||void 0===e||e.disconnect()}))}intrinsicDevice(){return n(this,void 0,void 0,(function*(){return this.inner}))}createAudioNode(e){var t;return n(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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5348);class r extends i.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,n){this.videoWidth=e,this.videoHeight=t,this.videoFrameRate=n}}},7170:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isVideoTransformDevice=void 0,t.isVideoTransformDevice=function(e){return!!e&&"object"==typeof e&&"transformStream"in e&&"stop"in e&&"intrinsicDevice"in e}},8236:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.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 n=matchMedia(`(resolution: ${this.devicePixelRatioSource.devicePixelRatio()}dppx)`);"function"==typeof n.addEventListener?(n.addEventListener("change",this.mediaQueryListener),this.mediaQueryList=n):"function"==typeof n.addListener?(n.addListener(this.mediaQueryListener),this.mediaQueryList=n):t.warn("ignoring DefaultDevicePixelRatioMonitor")}destroy(){return n(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,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))},r=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(t,"__esModule",{value:!0});const o=n(8434),s=n(3922),a=n(8627),l=n(8690);class c{constructor(e,t,n,o,s){this.buffer=[],this.bufferSize=0,this.maxBufferItemCapacityBytes=0,this.ingestionEventSize=0,this.flushIntervalMs=0,this.flushSize=0,this.failedIngestionEvents=[],this.retryCountLimit=15,this.lock=!1,this.cancellableEvents=new Map,this.attributesToFilter=["externalUserId","externalMeetingId","timestampMs"],this.deepCopyCurrentIngestionEvent=e=>({type:e.type,v:e.v,payloads:[...e.payloads]}),this.sendEvents=()=>i(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 n=!1;const i=Date.now();"firefox"===this.metadata.browserName.toLowerCase()&&this.cancellableEvents.set(i,e);try{this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - sending body ${t}`);const r=yield this.send(t);if(this.cancellableEvents.delete(i),r.ok)try{const e=yield r.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - send successful events: ${t} message: ${JSON.stringify(e)}`)}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 ${r.status}`),n=!0}catch(e){n=!0,this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Error in sending events ${t} to the ingestion endpoint ${e}`)}finally{this.lock=!1}n&&(this.cancellableEvents.delete(i),this.failedIngestionEvents.push(...e))}));const l=new a.default(s).getParserResult(),{browserMajorVersion:c}=l,d=r(l,["browserMajorVersion"]),u=t.toJSON(),{type:h,v:p}=u,f=r(u,["type","v"]);this.authenticationToken=t.getAuthenticationToken(),this.metadata=Object.assign(Object.assign({},d),f),Object.keys(this.metadata).forEach((e=>this.attributesToFilter.push(e))),this.type=h,this.v=p,this.ingestionURL=n,this.logger=s,this.importantEvents=new Set(o);const{maxBufferCapacityKb:m,totalBufferItems:g,flushSize:v,flushIntervalMs:b,retryCountLimit:y}=e;this.maxBufferCapacityBytes=1024*m,this.totalBufferItems=g,this.maxBufferItemCapacityBytes=Math.round(this.maxBufferCapacityBytes/g),this.flushIntervalMs=b,this.flushSize=v,this.retryCountLimit=y,this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent(),this.beaconEventListener=e=>this.beaconEventHandler(e),this.addEventListeners()}addEventListeners(){this.beaconEventListener&&"window"in n.g&&window.addEventListener&&"document"in n.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 n.g&&window.removeEventListener&&"document"in n.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 s.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 i(this,void 0,void 0,(function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - received event ${JSON.stringify(e)}`);const{name:t,ts:n,attributes:i}=e,r=i&&this.filterAttributes(i,this.attributesToFilter),o=Object.assign({name:t,ts:n},r);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - event after filtering attributes ${JSON.stringify(o)}`);const s=this.getSize(o);if(s>c.MAX_ITEM_SIZE_BYTES_ALLOWED)throw new Error(`Event Reporting - Item to be added has size ${s} bytes. Item cannot exceed max item size allowed of ${c.MAX_ITEM_SIZE_BYTES_ALLOWED} bytes.`);if(this.importantEvents.has(t))return this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - sending important event ${JSON.stringify(o)}`),void this.sendEventImmediately({name:t,ts:n,attributes:r});if(this.isFull())throw this.logger.warn("Event Reporting - Event buffer is full"),new Error("Buffer full");if(this.currentIngestionEvent.payloads.push(o),this.ingestionEventSize+=s,this.bufferItemThresholdReached(s)){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 n=new Set(t);return Object.keys(e).filter((e=>n.has(e))).forEach((t=>delete e[t])),e}initializeAndGetCurrentIngestionEvent(){const e={type:this.type,v:this.v,payloads:[]};return this.ingestionEventSize=this.getSize(e),e}bufferItemThresholdReached(e){return e+this.ingestionEventSize>=this.maxBufferItemCapacityBytes||this.currentIngestionEvent.payloads.length===c.MAX_PAYLOAD_ITEMS}getSize(e){let t=0;if("object"==typeof e)for(const[n,i]of Object.entries(e))t+=this.getPrimitiveSize(n),t+=this.getSize(i);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 i(this,void 0,void 0,(function*(){this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - important event received ${JSON.stringify(e)}`);const{name:t,ts:n,attributes:i}=e,r={type:this.type,v:this.v,payloads:[Object.assign({name:t,ts:n},i)]};let o=!1,s=null;const a=this.makeRequestBody([r]);try{if(s=yield this.send(a),s.ok){try{const e=yield s.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - send successful event: ${a}, message: ${JSON.stringify(e)}`)}catch(e){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Error reading OK response ${e} for event ${a}`)}return}this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Failed to send an important event ${a} with response status ${s.status}`),o=!0}catch(e){this.logger.warn(`Event Reporting - There may be a failure in sending an important event ${a} to the ingestion endpoint ${e}.`),o=!0;try{if("firefox"===this.metadata.browserName.toLowerCase()){const e=this.makeBeaconRequestBody([r]);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - beaconing data out ${e}`),o=!navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,e)}}catch(e){this.logger.warn(`Event Reporting - Error sending beacon for an important event ${a}`),o=!0}}o&&(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - pushing to failed events ${a}`),this.failedIngestionEvents.push(r))}))}send(e){return i(this,void 0,void 0,(function*(){const t=new o.default(c.RETRY_FIXED_BACKOFF_WAIT_MS,c.RETRY_SHORT_BACKOFF_MS,c.RETRY_LONG_BACKOFF_MS);try{let n=0;for(;n<this.retryCountLimit;){const i=yield fetch(this.ingestionURL,{method:"POST",headers:{Authorization:`Bearer ${this.authenticationToken}`},body:e});if(i.ok||!c.SENDING_FAILURE_CODES.has(i.status))return i;if(this.logger.warn(`Will retry sending failure for ${e} due to status code ${i.status}.`),n++,n<this.retryCountLimit){const e=t.nextBackoffAmountMs();yield l.wait(e)}}if(n===this.retryCountLimit)throw new Error(`Retry count limit reached for ${e}`)}catch(e){throw e}}))}sendBeacon(){return i(this,void 0,void 0,(function*(){const e=this.buffer;if(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out buffer events ${JSON.stringify(e)}`),this.buffer=[],this.currentIngestionEvent.payloads.length>0){const t=this.deepCopyCurrentIngestionEvent(this.currentIngestionEvent);e.push(t),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out current ingestion event ${JSON.stringify(t)}`),this.currentIngestionEvent=this.initializeAndGetCurrentIngestionEvent()}if(this.failedIngestionEvents.length>0){const t=this.failedIngestionEvents.map((e=>this.deepCopyCurrentIngestionEvent(e)));e.push(...t),this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendBeacon - clearing out any failed ingestion event ${JSON.stringify(t)}`),this.failedIngestionEvents=[]}if(this.cancellableEvents.size>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 i(this,void 0,void 0,(function*(){this.stop(),this.reset()}))}}t.default=c,c.SENDING_FAILURE_CODES=new Set([408,429,500,502,503,504]),c.RETRY_FIXED_BACKOFF_WAIT_MS=0,c.RETRY_SHORT_BACKOFF_MS=1e3,c.RETRY_LONG_BACKOFF_MS=15e3,c.MAX_PAYLOAD_ITEMS=2,c.MAX_ITEM_SIZE_BYTES_ALLOWED=3e3},7700:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e=5e3,t=2,n=64,i=100,r=15){this.flushIntervalMs=e,this.flushSize=t,this.maxBufferCapacityKb=n,this.totalBufferItems=i,this.retryCountLimit=r}}},3831:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(2238),o=n(146),s=n(5680),a=n(6366),l=n(9385),c=n(7797),d=n(4046),u=n(731);class h{constructor(e,t,n){var i,o,s,a,l,c,d;this.meetingHistoryStates=[],this.observerSet=new Set,this.destroyed=!1,this.logger=t,this.configuration=e,this.setupEventReporter(e,t,n);try{this.parserResult=navigator&&navigator.userAgent?new r.UAParser(navigator.userAgent).getResult():null}catch(e){this.logger.error(e.message)}this.browserMajorVersion=(null===(s=null===(o=null===(i=this.parserResult)||void 0===i?void 0:i.browser)||void 0===o?void 0:o.version)||void 0===s?void 0:s.split(".")[0])||h.UNAVAILABLE,this.browserName=(null===(a=this.parserResult)||void 0===a?void 0:a.browser.name)||h.UNAVAILABLE,this.browserVersion=(null===(l=this.parserResult)||void 0===l?void 0:l.browser.version)||h.UNAVAILABLE,this.deviceName=[(null===(c=this.parserResult)||void 0===c?void 0:c.device.vendor)||"",(null===(d=this.parserResult)||void 0===d?void 0:d.device.model)||""].join(" ").trim()||h.UNAVAILABLE}addObserver(e){this.observerSet.add(e)}removeObserver(e){this.observerSet.delete(e)}forEachObserver(e){for(const t of this.observerSet)c.default.nextTick((()=>{this.observerSet.has(t)&&e(t)}))}publishEvent(e,t){return i(this,void 0,void 0,(function*(){const n=Date.now();this.meetingHistoryStates.push({name:e,timestampMs:n});const i=Object.freeze(Object.assign(this.getAttributes(n),t));this.forEachObserver((t=>{t.eventDidReceive(e,i)})),this.reportEvent(e,n,t)}))}reportEvent(e,t,n){var r;return i(this,void 0,void 0,(function*(){let i;try{n&&(i=u.default(n)),yield null===(r=this.eventReporter)||void 0===r?void 0:r.reportEvent(t,e,i)}catch(e){this.logger.error(`Error reporting event ${e}`)}}))}setupEventReporter(e,t,n){if(n)this._eventReporter=n;else if(e.urls){const n=e.urls.eventIngestionURL;if(n){this.logger.info("Event ingestion URL is present in the configuration");const{meetingId:i,credentials:{attendeeId:r,joinToken:o}}=e,c=new l.default(i,r,o),d=new s.default(c,n);this._eventReporter=new a.default(d,t)}}}getAttributes(e){var t,n;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)||h.UNAVAILABLE,osVersion:(null===(n=this.parserResult)||void 0===n?void 0:n.os.version)||h.UNAVAILABLE,sdkVersion:d.default.sdkVersion,sdkName:d.default.sdkName,timestampMs:e}}get eventReporter(){return this._eventReporter}destroy(){return i(this,void 0,void 0,(function*(){o.isDestroyable(this.eventReporter)&&(yield this.eventReporter.destroy()),this.logger=void 0,this.configuration=void 0,this._eventReporter=void 0,this.destroyed=!0}))}}t.default=h,h.UNAVAILABLE="Unavailable"},731:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=e=>{const t={};for(const[n,i]of Object.entries(e))if(null!=i&&""!==i){if("number"!=typeof i&&"string"!=typeof i)throw new TypeError("Unhandled type received while flattening attributes.");t[n]=i}return t}},5680:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7700);t.default=class{constructor(e,t,n=new i.default){this.eventsClientConfiguration=e,this.ingestionURL=t,this.eventBufferConfiguration=n}}},6366:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(146),o=n(3520);t.default=class{constructor(e,t){this.reportingEvents=!1,this.importantEvents=["meetingEnded","meetingFailed","meetingStartFailed","audioInputFailed","videoInputFailed","meetingStartSucceeded"],this.destroyed=!1;const{eventsClientConfiguration:n,ingestionURL:i,eventBufferConfiguration:r}=e,{eventsToIgnore:s}=n;this.eventBuffer=new o.default(r,n,i,this.importantEvents,t),this.logger=t,this.eventsToIgnore=s,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,n){return i(this,void 0,void 0,(function*(){if(this.logger.debug(`Event Reporting - DefaultMeetingEventReporter - event received in reportEvent ${e}, ${t}, ${JSON.stringify(n)}`),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:n})}catch(e){this.logger.error(`Event Reporting - Error adding event to buffer ${e}`)}}))}destroy(){return i(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,n){}start(){}stop(){}}},9385:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,n,i=[]){this.type="Meet",this.v=1,this.meetingId=e,this.attendeeId=t,this.eventsToIgnore=i,this.authenticationToken=n}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,n)=>{"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.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.PrefetchSortBy=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.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=t.SendingAudioFailureConnectionHealthPolicy=t.SendAndReceiveDataMessagesTask=void 0,t.isVideoTransformDevice=t.isDestroyable=t.isAudioTransformDevice=t.ZLIBTextCompressor=t.WebSocketReadyState=t.WaitForAttendeePresenceTask=t.VoiceFocusTransformDevice=t.VoiceFocusDeviceTransformer=t.VideoTileState=t.VideoStreamDescription=t.VideoSource=void 0;const i=n(5185);t.AllHighestVideoBandwidthPolicy=i.default;const r=n(7535);t.ApplicationMetadata=r.default;const o=n(7797);t.AsyncScheduler=o.default;const s=n(8358);t.AttachMediaInputTask=s.default;const a=n(7602);t.Attendee=a.default;const l=n(9880);t.AudioLogEvent=l.default;const c=n(3765);t.AudioProfile=c.default;const d=n(1876);t.AudioVideoControllerState=d.default;const u=n(9734);t.BackgroundBlurStrength=u.default;const h=n(1260);t.BackgroundBlurVideoFrameProcessor=h.default;const p=n(4243);t.BackgroundFilterVideoFrameProcessor=p.default;const f=n(9854);t.BackgroundReplacementVideoFrameProcessor=f.default;const m=n(3940);t.BaseConnectionHealthPolicy=m.default;const g=n(1789);t.BaseTask=g.default;const v=n(9394);t.BitrateParameters=v.default;const b=n(7237);t.CSPMonitor=b.default;const y=n(9807);t.CanvasVideoFrameBuffer=y.default;const S=n(2084);t.CheckAudioConnectivityFeedback=S.default;const w=n(8892);t.CheckAudioInputFeedback=w.default;const C=n(9333);t.CheckAudioOutputFeedback=C.default;const k=n(1087);t.CheckCameraResolutionFeedback=k.default;const E=n(2606);t.CheckContentShareConnectivityFeedback=E.default;const _=n(7415);t.CheckNetworkTCPConnectivityFeedback=_.default;const T=n(4299);t.CheckNetworkUDPConnectivityFeedback=T.default;const x=n(6818);t.CheckVideoConnectivityFeedback=x.default;const I=n(1737);t.CheckVideoInputFeedback=I.default;const M=n(3216);t.CleanRestartedSessionTask=M.default;const A=n(7408);t.CleanStoppedSessionTask=A.default;const P=n(4571);t.ClientMetricReport=P.default;const O=n(6196);t.ClientMetricReportDirection=O.default;const R=n(9496);t.ClientMetricReportMediaType=R.default;const N=n(2770);t.ClientVideoStreamReceivingReport=N.default;const D=n(6688);t.ConnectionHealthData=D.default;const F=n(3731);t.ConnectionHealthPolicyConfiguration=F.default;const L=n(8030);t.ConsoleLogger=L.default;const B=n(8890);t.ContentShareConstants=B.default;const U=n(8370);t.ContentShareMediaStreamBroker=U.default;const V=n(5482);t.CreatePeerConnectionTask=V.default;const j=n(1129);t.CreateSDPTask=j.default;const z=n(1018);t.DataMessage=z.default;const $=n(8320);t.DefaultActiveSpeakerDetector=$.default;const W=n(2363);t.DefaultActiveSpeakerPolicy=W.default;const H=n(6802);t.DefaultAudioMixController=H.default;const q=n(9059);t.DefaultAudioVideoController=q.default;const K=n(8538);t.DefaultAudioVideoFacade=K.default;const G=n(543);t.DefaultBrowserBehavior=G.default;const J=n(8023);t.DefaultContentShareController=J.default;const Q=n(4142);t.DefaultDeviceController=Q.default;const Y=n(8236);t.DefaultDevicePixelRatioMonitor=Y.default;const Z=n(3831);t.DefaultEventController=Z.default;const X=n(6354);t.DefaultMediaDeviceFactory=X.default;const ee=n(6366);t.DefaultMeetingEventReporter=ee.default;const te=n(3980);t.DefaultMeetingReadinessChecker=te.default;const ne=n(4202);t.DefaultMeetingSession=ne.default;const ie=n(8947);t.DefaultMessagingSession=ie.default;const re=n(214);t.DefaultModality=re.default;const oe=n(7500);t.DefaultPingPong=oe.default;const se=n(983);t.DefaultRealtimeController=se.default;const ae=n(9141);t.DefaultReconnectController=ae.default;const le=n(9678);t.DefaultSessionStateController=le.default;const ce=n(334);t.DefaultSigV4=ce.default;const de=n(1208);t.DefaultSignalingClient=de.default;const ue=n(4450);t.DefaultSimulcastUplinkPolicy=ue.default;const he=n(3879);t.DefaultSimulcastUplinkPolicyForContentShare=he.default;const pe=n(365);t.DefaultTransceiverController=pe.default;const fe=n(5308);t.DefaultTranscriptionController=fe.default;const me=n(8627);t.DefaultUserAgentParser=me.default;const ge=n(1133);t.DefaultVideoCaptureAndEncodeParameter=ge.default;const ve=n(8919);t.DefaultVideoFrameProcessorPipeline=ve.default;const be=n(1508);t.DefaultVideoStreamIdSet=be.default;const ye=n(1318);t.DefaultVideoStreamIndex=ye.default;const Se=n(3327);t.DefaultVideoTile=Se.default;const we=n(2958);t.DefaultVideoTileController=we.default;const Ce=n(4922);t.DefaultVideoTileFactory=Ce.default;const ke=n(7673);t.DefaultVideoTransformDevice=ke.default;const Ee=n(9751);t.DefaultVolumeIndicatorAdapter=Ee.default;const _e=n(7631);t.DefaultWebSocketAdapter=_e.default;const Te=n(9190);t.DevicePixelRatioWindowSource=Te.default;const xe=n(8128);t.DeviceSelection=xe.default;const Ie=n(7700);t.EventBufferConfiguration=Ie.default;const Me=n(5680);t.EventIngestionConfiguration=Me.default;const Ae=n(6240);t.FinishGatheringICECandidatesTask=Ae.default;const Pe=n(8434);t.FullJitterBackoff=Pe.default;const Oe=n(5640);t.FullJitterBackoffFactory=Oe.default;const Re=n(7300);t.FullJitterLimitedBackoff=Re.default;const Ne=n(5348);t.GetUserMediaError=Ne.default;const De=n(2306);t.GlobalMetricReport=De.default;const Fe=n(3520);t.InMemoryJSONEventBuffer=Fe.default;const Le=n(3922);t.IntervalScheduler=Le.default;const Be=n(1960);t.JoinAndReceiveIndexTask=Be.default;const Ue=n(6180);t.LeaveAndReceiveLeaveAckTask=Ue.default;const Ve=n(2748);t.ListenForVolumeIndicatorsTask=Ve.default;const je=n(293);t.Log=je.default;const ze=n(813);t.LogLevel=ze.default;const $e=n(4236);t.MediaDeviceProxyHandler=$e.default;const We=n(9385);t.MeetingEventsClientConfiguration=We.default;const He=n(3990);t.MeetingReadinessCheckerConfiguration=He.default;const qe=n(589);t.MeetingSessionConfiguration=qe.default;const Ke=n(8015);t.MeetingSessionCredentials=Ke.default;const Ge=n(7604);t.MeetingSessionLifecycleEvent=Ge.default;const Je=n(1296);t.MeetingSessionLifecycleEventCondition=Je.default;const Qe=n(3789);t.MeetingSessionStatus=Qe.default;const Ye=n(5687);t.MeetingSessionStatusCode=Ye.default;const Ze=n(7215);t.MeetingSessionTURNCredentials=Ze.default;const Xe=n(6057);t.MeetingSessionURLs=Xe.default;const et=n(5723);t.MeetingSessionVideoAvailability=et.default;const tt=n(9358);t.Message=tt.default;const nt=n(4323);t.MessagingSessionConfiguration=nt.default;const it=n(22);t.ModelSpecBuilder=it.default;const rt=n(1981);t.MonitorTask=rt.default;const ot=n(9938);t.MultiLogger=ot.default;const st=n(4442);t.NScaleVideoUplinkBandwidthPolicy=st.default;const at=n(9836);t.NoOpAudioVideoController=at.default;const lt=n(209);t.NoOpDebugLogger=lt.default;const ct=n(6154);t.NoOpDeviceController=ct.default;const dt=n(732);t.NoOpEventReporter=dt.default;const ut=n(7434);t.NoOpLogger=ut.default;const ht=n(4015);t.NoOpMediaStreamBroker=ht.default;const pt=n(8831);t.NoOpTask=pt.default;const ft=n(3663);t.NoOpVideoElementFactory=ft.default;const mt=n(2801);t.NoOpVideoFrameProcessor=mt.default;const gt=n(5319);t.NoVideoDownlinkBandwidthPolicy=gt.default;const vt=n(657);t.NoVideoUplinkBandwidthPolicy=vt.default;const bt=n(1238);t.NotFoundError=bt.default;const yt=n(3110);t.NotReadableError=yt.default;const St=n(1124);t.OnceTask=St.default;const wt=n(4543);t.OpenSignalingConnectionTask=wt.default;const Ct=n(4842);t.OverconstrainedError=Ct.default;const kt=n(5013);t.POSTLogger=kt.default;const Et=n(8556);t.ParallelGroupTask=Et.default;const _t=n(6991);t.PermissionDeniedError=_t.default;const Tt=n(106);t.PrefetchOn=Tt.default;const xt=n(3938);t.PrefetchSortBy=xt.default;const It=n(1515);t.PromiseQueue=It.default;const Mt=n(9945);t.PromoteToPrimaryMeetingTask=Mt.default;const At=n(5910);t.RealtimeAttendeePositionInFrame=At.default;const Pt=n(9825);t.RealtimeState=Pt.default;const Ot=n(9576);t.RealtimeVolumeIndicator=Ot.default;const Rt=n(1209);t.ReceiveAudioInputTask=Rt.default;const Nt=n(5547);t.ReceiveTURNCredentialsTask=Nt.default;const Dt=n(120);t.ReceiveVideoInputTask=Dt.default;const Ft=n(9560);t.ReceiveVideoStreamIndexTask=Ft.default;const Lt=n(9708);t.ReconnectionHealthPolicy=Lt.default;const Bt=n(4191);t.RunnableTask=Bt.default;const Ut=n(326);t.SDP=Ut.default;const Vt=n(4076);t.SDPCandidateType=Vt.default;const jt=n(1944);t.SDPMediaSection=jt.default;const zt=n(9485);t.SendAndReceiveDataMessagesTask=zt.default;const $t=n(2977);t.SendingAudioFailureConnectionHealthPolicy=$t.default;const Wt=n(7079);t.SerialGroupTask=Wt.default;const Ht=n(7103);t.ServerSideNetworkAdaption=Ht.default;const qt=n(3860);t.SessionStateControllerAction=qt.default;const Kt=n(6850);t.SessionStateControllerDeferPriority=Kt.default;const Gt=n(9553);t.SessionStateControllerState=Gt.default;const Jt=n(3013);t.SessionStateControllerTransitionResult=Jt.default;const Qt=n(4833);t.SetLocalDescriptionTask=Qt.default;const Yt=n(5275);t.SetRemoteDescriptionTask=Yt.default;const Zt=n(8581);t.SignalingAndMetricsConnectionMonitor=Zt.default;const Xt=n(3920);t.SignalingClientConnectionRequest=Xt.default;const en=n(2902);t.SignalingClientEvent=en.default;const tn=n(9416);t.SignalingClientEventType=tn.default;const nn=n(2168);t.SignalingClientJoin=nn.default;const rn=n(6729);t.SignalingClientSubscribe=rn.default;const on=n(9101);t.SignalingClientVideoSubscriptionConfiguration=on.default;const sn=n(7377);t.SimulcastContentShareTransceiverController=sn.default;const an=n(7606);t.SimulcastLayers=an.default;const ln=n(5785);t.SimulcastTransceiverController=ln.default;const cn=n(4242);t.SimulcastVideoStreamIndex=cn.default;const dn=n(7786);t.SingleNodeAudioTransformDevice=dn.default;const un=n(2811);t.StreamMetricReport=un.default;const hn=n(5924);t.SubscribeAndReceiveSubscribeAckTask=hn.default;const pn=n(2721);t.TargetDisplaySize=pn.default;const fn=n(4456);t.TaskStatus=fn.default;const mn=n(4929);t.TimeoutScheduler=mn.default;const gn=n(250);t.TimeoutTask=gn.default;const vn=n(4739);t.Transcript=vn.default;const bn=n(2471);t.TranscriptAlternative=bn.default;const yn=n(7210);t.TranscriptEntity=yn.default;const Sn=n(1741);t.TranscriptItem=Sn.default;const wn=n(6864);t.TranscriptItemType=wn.default;const Cn=n(9063);t.TranscriptLanguageWithScore=Cn.default;const kn=n(5323);t.TranscriptResult=kn.default;const En=n(1288);t.TranscriptionStatus=En.default;const _n=n(1326);t.TranscriptionStatusType=_n.default;const Tn=n(6950);t.TypeError=Tn.default;const xn=n(1922);t.UnusableAudioWarningConnectionHealthPolicy=xn.default;const In=n(4046);t.Versioning=In.default;const Mn=n(2880);t.VideoAdaptiveProbePolicy=Mn.default;const An=n(2330);t.VideoCodecCapability=An.default;const Pn=n(155);t.VideoLogEvent=Pn.default;const On=n(9354);t.VideoOnlyTransceiverController=On.default;const Rn=n(1754);t.VideoPreference=Rn.default;const Nn=n(1819);t.VideoPreferences=Nn.default;const Dn=n(4992);t.VideoPriorityBasedPolicy=Dn.default;const Fn=n(1034);t.VideoPriorityBasedPolicyConfig=Fn.default;const Ln=n(4500);t.VideoQualitySettings=Ln.default;const Bn=n(60);t.VideoSource=Bn.default;const Un=n(6876);t.VideoStreamDescription=Un.default;const Vn=n(7804);t.VideoTileState=Vn.default;const jn=n(2497);t.VoiceFocusDeviceTransformer=jn.default;const zn=n(8878);t.VoiceFocusTransformDevice=zn.default;const $n=n(6171);t.WaitForAttendeePresenceTask=$n.default;const Wn=n(7387);t.WebSocketReadyState=Wn.default;const Hn=n(3320);t.ZLIBTextCompressor=Hn.default;const qn=n(1819);Object.defineProperty(t,"MutableVideoPreferences",{enumerable:!0,get:function(){return qn.MutableVideoPreferences}});const Kn=n(8660);Object.defineProperty(t,"Some",{enumerable:!0,get:function(){return Kn.Some}}),Object.defineProperty(t,"None",{enumerable:!0,get:function(){return Kn.None}}),Object.defineProperty(t,"Maybe",{enumerable:!0,get:function(){return Kn.Maybe}});const Gn=n(1746);Object.defineProperty(t,"isAudioTransformDevice",{enumerable:!0,get:function(){return Gn.isAudioTransformDevice}});const Jn=n(146);Object.defineProperty(t,"isDestroyable",{enumerable:!0,get:function(){return Jn.isDestroyable}});const Qn=n(7170);Object.defineProperty(t,"isVideoTransformDevice",{enumerable:!0,get:function(){return Qn.isVideoTransformDevice}})},8030:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(813);t.default=class{constructor(e,t=i.default.WARN){this.name=e,this.level=t}info(e){this.log(i.default.INFO,e)}warn(e){this.log(i.default.WARN,e)}error(e){this.log(i.default.ERROR,e)}debug(e){i.default.DEBUG<this.level||("string"==typeof e?this.log(i.default.DEBUG,e):e?this.log(i.default.DEBUG,e()):this.log(i.default.DEBUG,""+e))}setLogLevel(e){this.level=e}getLogLevel(){return this.level}log(e,t){if(e<this.level)return;const n=`${(new Date).toISOString()} [${i.default[e]}] ${this.name} - ${t}`;switch(e){case i.default.ERROR:console.error(n);break;case i.default.WARN:console.warn(n);break;case i.default.DEBUG:console.debug(n.replace(/\\r\\n/g,"\n"));break;case i.default.INFO:console.info(n)}}}},293:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,n,i){this.sequenceNumber=e,this.message=t,this.timestampMs=n,this.logLevel=i}}},813:(e,t)=>{"use strict";var n;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"}(n=t.LogLevel||(t.LogLevel={})),t.default=n},9938:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(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,n;n="string"==typeof e?e:e?()=>(t||(t=e()),t):""+e;for(const e of this._loggers)e.debug(n)}setLogLevel(e){for(const t of this._loggers)t.setLogLevel(e)}getLogLevel(){for(const e of this._loggers)return e.getLogLevel();return i.default.OFF}}},209:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(813),r=n(7434);class o extends r.default{constructor(){super(i.default.DEBUG)}}t.default=o},7434:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(813);t.default=class{constructor(e=i.default.OFF){this.level=e}info(e){}warn(e){}error(e){}debug(e){i.default.DEBUG<this.level||"string"!=typeof e&&e()}setLogLevel(e){this.level=e}getLogLevel(){return this.level}}},5013:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3922),o=n(293),s=n(813);class a{constructor(e){this.logCapture=[],this.lock=!1,this.sequenceNumber=0;const{url:t,batchSize:n=a.BATCH_SIZE,intervalMs:i=a.INTERVAL_MS,logLevel:r=s.default.WARN,metadata:o,headers:l}=e;this.url=t,this.batchSize=n,this.intervalMs=i,this.logLevel=r,this.metadata=o,this.headers=l,this.start(),this.eventListener=()=>{this.stop()},this.addEventListener()}addEventListener(){this.eventListener&&"window"in n.g&&window.addEventListener&&window.addEventListener("unload",this.eventListener)}removeEventListener(){this.eventListener&&"window"in n.g&&window.removeEventListener&&window.removeEventListener("unload",this.eventListener)}debug(e){s.default.DEBUG<this.logLevel||("string"==typeof e?this.log(s.default.DEBUG,e):e?this.log(s.default.DEBUG,e()):this.log(s.default.DEBUG,""+e))}info(e){this.log(s.default.INFO,e)}warn(e){this.log(s.default.WARN,e)}error(e){this.log(s.default.ERROR,e)}setLogLevel(e){this.logLevel=e}getLogLevel(){return this.logLevel}getLogCaptureSize(){return this.logCapture.length}start(){this.addEventListener(),this.intervalScheduler=new r.default(this.intervalMs),this.intervalScheduler.start((()=>i(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 i(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<this.logLevel)return;const n=Date.now();this.logCapture.push(new o.default(this.sequenceNumber,t,n,s.default[e])),this.sequenceNumber+=1}}t.default=a,a.BATCH_SIZE=85,a.INTERVAL_MS=2e3},6354:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4236);t.default=class{constructor(){this.isMediaDevicesSupported="undefined"!=typeof navigator&&!!navigator.mediaDevices}create(){if(this.isMediaDevicesSupported)return new Proxy(navigator.mediaDevices,new i.default);throw new Error("navigator.mediaDevices is not supported")}}},4236:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(7797),o=n(3922);class s{constructor(){this.scheduler=null,this.devices=null,this.deviceChangeListeners=new Set,this.get=(e,t,n)=>{if(!Reflect.has(e,t))return;if(!("ondevicechange"in navigator.mediaDevices)){if("addEventListener"===t)return this.patchAddEventListener(e,t,n);if("removeEventListener"===t)return this.patchRemoveEventListener(e,t,n)}const i=Reflect.get(e,t,n);return"function"==typeof i?i.bind(e):i},this.patchAddEventListener=(e,t,n)=>{const i=Reflect.get(e,t,n);return(t,n,r)=>{if("devicechange"!==t)return Reflect.apply(i,e,[t,n,r]);this.deviceChangeListeners.add(n),this.scheduler||(this.scheduler=new o.default(s.INTERVAL_MS),this.scheduler.start(this.pollDeviceLists))}},this.patchRemoveEventListener=(e,t,n)=>{const i=Reflect.get(e,t,n);return(t,n,r)=>{if("devicechange"!==t)return Reflect.apply(i,e,[t,n,r]);this.deviceChangeListeners.delete(n),0===this.deviceChangeListeners.size&&this.scheduler&&(this.scheduler.stop(),this.scheduler=null)}},this.pollDeviceLists=()=>i(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 i(this,void 0,void 0,(function*(){return(yield navigator.mediaDevices.enumerateDevices()).sort(((e,t)=>e.deviceId<t.deviceId?1:e.deviceId>t.deviceId?-1:0))}))}handleDeviceChangeEvent(){for(const e of this.deviceChangeListeners)r.default.nextTick((()=>{if(this.deviceChangeListeners.has(e)){const t=new Event("devicechange");"function"==typeof e?e(t):e.handleEvent(t)}}))}}t.default=s,s.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 n;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"}(n=t.CheckAudioConnectivityFeedback||(t.CheckAudioConnectivityFeedback={})),t.default=n},8892:(e,t)=>{"use strict";var n;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"}(n=t.CheckAudioInputFeedback||(t.CheckAudioInputFeedback={})),t.default=n},9333:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.CheckAudioOutputFeedback=void 0,function(e){e[e.Succeeded=0]="Succeeded",e[e.Failed=1]="Failed"}(n=t.CheckAudioOutputFeedback||(t.CheckAudioOutputFeedback={})),t.default=n},1087:(e,t)=>{"use strict";var n;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"}(n=t.CheckCameraResolutionFeedback||(t.CheckCameraResolutionFeedback={})),t.default=n},2606:(e,t)=>{"use strict";var n;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"}(n=t.CheckContentShareConnectivityFeedback||(t.CheckContentShareConnectivityFeedback={})),t.default=n},7415:(e,t)=>{"use strict";var n;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"}(n=t.CheckNetworkTCPConnectivityFeedback||(t.CheckNetworkTCPConnectivityFeedback={})),t.default=n},4299:(e,t)=>{"use strict";var n;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"}(n=t.CheckNetworkUDPConnectivityFeedback||(t.CheckNetworkUDPConnectivityFeedback={})),t.default=n},6818:(e,t)=>{"use strict";var n;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"}(n=t.CheckVideoConnectivityFeedback||(t.CheckVideoConnectivityFeedback={})),t.default=n},1737:(e,t)=>{"use strict";var n;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"}(n=t.CheckVideoInputFeedback||(t.CheckVideoInputFeedback={})),t.default=n},3980:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(6802),o=n(543),s=n(4142),a=n(6991),l=n(1789),c=n(250),d=n(2084),u=n(8892),h=n(9333),p=n(1087),f=n(2606),m=n(7415),g=n(4299),v=n(6818),b=n(1737),y=n(3990);class S{constructor(e,t,n=new y.default){this.logger=e,this.meetingSession=t,this.configuration=n,this.browserBehavior=new o.default}static delay(e){return i(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,e)))}))}checkAudioInput(e){return i(this,void 0,void 0,(function*(){try{return yield this.meetingSession.audioVideo.startAudioInput(e),yield this.meetingSession.audioVideo.stopAudioInput(),u.default.Succeeded}catch(e){return this.logger.error(`MeetingReadinessChecker: Audio input check failed with error ${e}`),e instanceof a.default?u.default.PermissionDenied:u.default.Failed}}))}checkAudioOutput(e,t,n=null){return i(this,void 0,void 0,(function*(){try{const i=e?s.default.getIntrinsicDeviceId(e):"";return yield this.playTone(i,this.configuration.audioOutputFrequency,n),(yield t())?h.default.Succeeded:h.default.Failed}catch(e){return this.logger.error(`MeetingReadinessChecker: Audio output check failed with error: ${e}`),h.default.Failed}finally{this.stopTone()}}))}playTone(e,t,n){return i(this,void 0,void 0,(function*(){const i=this.configuration.audioOutputGain;this.oscillatorNode&&this.stopTone(),this.audioContext=s.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 o=this.audioContext.currentTime+.1;this.gainNode.gain.linearRampToValueAtTime(0,o),this.gainNode.gain.linearRampToValueAtTime(i,o+.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(n||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.configuration.audioOutputGain,t=this.audioContext.currentTime;this.gainNode.gain.linearRampToValueAtTime(e,t+.1+1),this.gainNode.gain.linearRampToValueAtTime(0,t+.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 i(this,void 0,void 0,(function*(){try{return yield this.meetingSession.audioVideo.startVideoInput(e),yield this.meetingSession.audioVideo.stopVideoInput(),b.default.Succeeded}catch(e){return this.logger.error(`MeetingReadinessChecker: Video check failed with error ${e}`),e instanceof a.default?b.default.PermissionDenied:b.default.Failed}}))}checkCameraResolution(e,t,n){return i(this,void 0,void 0,(function*(){let i;try{const r=s.default.getIntrinsicDeviceId(e),o={video:this.calculateVideoConstraint(r,t,n)};i=yield navigator.mediaDevices.getUserMedia(o)}catch(e){return this.logger.error(`MeetingReadinessChecker: Camera resolution check with width: ${t} height ${n} failed with error ${e}`),e&&"OverconstrainedError"===e.name?p.default.ResolutionNotSupported:e&&"NotAllowedError"===e.name?p.default.PermissionDenied:p.default.Failed}finally{i&&i.getTracks().forEach((function(e){e.stop()}))}return p.default.Succeeded}))}calculateVideoConstraint(e,t,n){const i=this.browserBehavior.requiresResolutionAlignment(t,n),r={};return this.browserBehavior.requiresNoExactMediaStreamConstraints()?(r.deviceId=e,r.width=t,r.height=n):(r.deviceId={exact:e},r.width={exact:i[0]},r.height={exact:i[1]}),r}checkContentShareConnectivity(e){return i(this,void 0,void 0,(function*(){let t=!1,n=!1;const r={contentShareDidStart:()=>{t=!0}},o={audioVideoDidStart:()=>{n=!0}};try{return this.meetingSession.audioVideo.addObserver(o),this.meetingSession.audioVideo.start(),this.meetingSession.audioVideo.addContentShareObserver(r),yield this.meetingSession.audioVideo.startContentShareFromScreenCapture(e),yield this.executeTimeoutTask((()=>i(this,void 0,void 0,(function*(){return n&&t})))),n?(yield this.stopMeeting(),t?f.default.Succeeded:f.default.TimedOut):f.default.ConnectionFailed}catch(e){return this.logger.error(`MeetingReadinessChecker: Content share check failed with error ${e}`),"NotAllowedError"===e.name?f.default.PermissionDenied:f.default.Failed}finally{this.meetingSession.audioVideo.removeObserver(o),this.meetingSession.audioVideo.stopContentShare(),this.meetingSession.audioVideo.removeContentShareObserver(r)}}))}checkAudioConnectivity(e){return i(this,void 0,void 0,(function*(){let t=!1;const n=this.meetingSession.audioVideo,r=(e,n,i,r)=>{e===this.meetingSession.configuration.credentials.attendeeId&&n&&(t=!0)};try{yield n.startAudioInput(e)}catch(e){return this.logger.error(`MeetingReadinessChecker: Failed to get audio input device with error ${e}`),e instanceof a.default?d.default.AudioInputPermissionDenied:d.default.AudioInputRequestFailed}return n.realtimeSubscribeToAttendeeIdPresence(r),(yield this.startMeeting())?(yield this.executeTimeoutTask((()=>i(this,void 0,void 0,(function*(){return t})))),n.realtimeUnsubscribeToAttendeeIdPresence(r),yield this.stopMeeting(),yield this.meetingSession.audioVideo.stopAudioInput(),t?d.default.Succeeded:d.default.AudioNotReceived):(n.realtimeUnsubscribeToAttendeeIdPresence(r),yield this.meetingSession.audioVideo.stopAudioInput(),d.default.ConnectionFailed)}))}checkVideoConnectivity(e){return i(this,void 0,void 0,(function*(){const t=this.meetingSession.audioVideo;let n=0;const r={metricsDidReceive(e){e.getRTCStatsReport().forEach((e=>{"outbound-rtp"===e.type&&"video"===e.mediaType&&(n=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 a.default?v.default.VideoInputPermissionDenied:v.default.VideoInputRequestFailed}return t.addObserver(r),(yield this.startMeeting())?(t.startLocalVideoTile(),yield this.executeTimeoutTask((()=>i(this,void 0,void 0,(function*(){return n>0})))),yield t.stopVideoInput(),yield this.stopMeeting(),t.removeObserver(r),n<=0?v.default.VideoNotSent:v.default.Succeeded):v.default.ConnectionFailed}))}checkNetworkUDPConnectivity(){return i(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}`),g.default.MeetingSessionURLsNotInitialized}this.meetingSession.configuration.urls.urlRewriter=e=>{const t=this.originalURLRewriter(e);return t.includes("transport=tcp")?"":t};const n=this.meetingSession.audioVideo;return n.addObserver(t),(yield this.startMeeting())?(yield this.executeTimeoutTask((()=>i(this,void 0,void 0,(function*(){return e})))),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),n.removeObserver(t),e?g.default.Succeeded:g.default.ICENegotiationFailed):(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,g.default.ConnectionFailed)}))}checkNetworkTCPConnectivity(){return i(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=udp")?"":t};const n=this.meetingSession.audioVideo;return n.addObserver(t),(yield this.startMeeting())?(yield this.executeTimeoutTask((()=>i(this,void 0,void 0,(function*(){return e})))),this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,yield this.stopMeeting(),n.removeObserver(t),e?m.default.Succeeded:m.default.ICENegotiationFailed):(this.meetingSession.configuration.urls.urlRewriter=this.originalURLRewriter,m.default.ConnectionFailed)}))}startMeeting(){return i(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((()=>i(this,void 0,void 0,(function*(){return e})))),this.meetingSession.audioVideo.removeObserver(t),e}))}stopMeeting(){return i(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((()=>i(this,void 0,void 0,(function*(){return e})))),this.meetingSession.audioVideo.removeObserver(t),e}))}executeTimeoutTask(e){return i(this,void 0,void 0,(function*(){let t=!1;class n extends l.default{constructor(e,t){super(e),this.waitDurationMs=t,this.isCancelled=!1}cancel(){this.isCancelled=!0}run(){return i(this,void 0,void 0,(function*(){for(;!this.isCancelled;){if(yield e()){t=!0;break}yield S.delay(this.waitDurationMs)}}))}}const r=new c.default(this.logger,new n(this.logger,this.configuration.waitDurationMs),this.configuration.timeoutMs);return yield r.run(),t}))}}t.default=S},3990:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.timeoutMs=1e4,this.waitDurationMs=3e3,this.audioOutputFrequency=440,this.audioOutputGain=.1}}},4202:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9059),o=n(8538),s=n(8434),a=n(543),l=n(8370),c=n(8023),d=n(7237),u=n(146),h=n(3831),p=n(9141),f=n(7631);t.default=class{constructor(e,t,n,i){this._eventController=i,this._configuration=e,this._logger=t,this.checkBrowserSupportAndFeatureConfiguration(),d.default.addLogger(this._logger),d.default.register(),this._eventController||(this._eventController=new h.default(e,t)),n.eventController||(n.eventController=this.eventController),this.audioVideoController=new r.default(this._configuration,this._logger,new f.default(this._logger),n,new p.default(this._configuration.reconnectTimeoutMs,new s.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs)),this.eventController),this._deviceController=n;const a=new l.default(this._logger);this.contentShareController=new c.default(a,new r.default(c.default.createContentShareMeetingSessionConfigure(this._configuration),this._logger,new f.default(this._logger),a,new p.default(this._configuration.reconnectTimeoutMs,new s.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs))),this.audioVideoController),this.audioVideoFacade=new o.default(this.audioVideoController,this.audioVideoController.videoTileController,this.audioVideoController.realtimeController,this.audioVideoController.audioMixController,this._deviceController,this.contentShareController)}get configuration(){return this._configuration}get logger(){return this._logger}get audioVideo(){return this.audioVideoFacade}get contentShare(){return this.contentShareController}get deviceController(){return this._deviceController}get eventController(){return this._eventController}destroy(){return i(this,void 0,void 0,(function*(){u.isDestroyable(this.contentShareController)&&(yield this.contentShareController.destroy()),u.isDestroyable(this.audioVideoController)&&(yield this.audioVideoController.destroy()),u.isDestroyable(this.eventController)&&(yield this.eventController.destroy()),d.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 a.default,t=`${e.name()} ${e.majorVersion()} (${e.version()})`;if(this.logger.info(`browser is ${t}`),e.isSupported()||this.logger.warn(`this browser is not currently supported. Stability may suffer. Supported browsers are: ${e.supportString()}.`),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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3731),r=n(8690),o=n(8015),s=n(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 i.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 s.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 o.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:"<redacted>"}}}},7604:(e,t)=>{"use strict";var n;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"}(n=t.MeetingSessionLifecycleEvent||(t.MeetingSessionLifecycleEvent={})),t.default=n},1296:(e,t)=>{"use strict";var n;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"}(n=t.MeetingSessionLifecycleEventCondition||(t.MeetingSessionLifecycleEventCondition={})),t.default=n},3789:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(289),r=n(5687);class o{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===i.SdkSignalFrame.Type.AUDIO_STATUS?e.audioStatus?this.fromAudioStatus(e.audioStatus.audioStatus):new o(r.default.SignalingRequestFailed):e.type===i.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE?new o(r.default.AudioVideoWasRemovedFromPrimaryMeeting):new o(r.default.OK)}static fromAudioStatus(e){switch(e){case 200:return new o(r.default.OK);case 301:return new o(r.default.AudioJoinedFromAnotherDevice);case 302:return new o(r.default.AudioDisconnectAudio);case 403:return new o(r.default.AudioAuthenticationRejected);case 409:return new o(r.default.AudioCallAtCapacity);case 410:return new o(r.default.MeetingEnded);case 411:return new o(r.default.AudioAttendeeRemoved);case 500:return new o(r.default.AudioInternalServerError);case 503:return new o(r.default.AudioServiceUnavailable);default:return 2===Math.floor(e/100)?new o(r.default.OK):new o(r.default.AudioDisconnected)}}static fromSignalingStatus(e){switch(e){case 206:return new o(r.default.VideoCallSwitchToViewOnly);case 509:return new o(r.default.VideoCallAtSourceCapacity);case 403:return new o(r.default.AudioAuthenticationRejected);case 409:return new o(r.default.AudioCallAtCapacity);default:switch(Math.floor(e/100)){case 2:return new o(r.default.OK);case 4:return new o(r.default.SignalingBadRequest);case 5:return new o(r.default.SignalingInternalServerError);default:return new o(r.default.SignalingRequestFailed)}}}}t.default=o},5687:(e,t)=>{"use strict";var n;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"}(n=t.MeetingSessionStatusCode||(t.MeetingSessionStatusCode={})),t.default=n},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 n{constructor(){this.remoteVideoAvailable=!1,this.canStartLocalVideo=!1}equal(e){return this.remoteVideoAvailable===e.remoteVideoAvailable&&this.canStartLocalVideo===e.canStartLocalVideo}clone(){const e=new n;return e.remoteVideoAvailable=this.remoteVideoAvailable,e.canStartLocalVideo=this.canStartLocalVideo,e}}t.default=n},9358:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,n){this.type=e,this.headers=t,this.payload=n}}},8947:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5891),o=n(8434),s=n(7237),a=n(9358),l=n(9141),c=n(7797),d=n(334),u=n(7631),h=n(7387),p=n(106);t.default=class{constructor(e,t,n,i,r){this.configuration=e,this.logger=t,this.webSocket=n,this.reconnectController=i,this.sigV4=r,this.observerQueue=new Set,this.webSocket||(this.webSocket=new u.default(this.logger)),this.reconnectController||(this.reconnectController=new l.default(e.reconnectTimeoutMs,new o.default(e.reconnectFixedWaitMs,e.reconnectShortBackoffMs,e.reconnectLongBackoffMs))),this.sigV4||(this.sigV4=new d.default(this.configuration.chimeClient)),s.default.addLogger(this.logger),s.default.register(),this.preBootstrapMessages=[]}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 i(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(),s.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 i(this,void 0,void 0,(function*(){return yield this.startConnectingInternal(e),yield new Promise(((e,t)=>{this.bootstrapResolved=e,this.bootstrapRejected=t}))}))}startConnectingInternal(e){var t;return i(this,void 0,void 0,(function*(){let n=this.configuration.endpointUrl;if(e||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),e||void 0===n)try{if(this.configuration.chimeClient.getMessagingSessionEndpoint instanceof Function){const e=yield this.configuration.chimeClient.getMessagingSessionEndpoint();n=(null===(t=e.Endpoint)||void 0===t?void 0:t.Url)?e.Endpoint.Url:(yield this.configuration.chimeClient.getMessagingSessionEndpoint().promise()).Endpoint.Url}else n=(yield this.configuration.chimeClient.send(new r.GetMessagingSessionEndpointCommand({}))).Endpoint.Url;this.logger.debug(`Messaging endpoint resolved to: ${n}`)}catch(e){this.logger.error(`Messaging Session failed to resolve endpoint: ${e}`);const t=new CloseEvent("close",{wasClean:!1,code:4999,reason:"Failed to get messaging session endpoint URL",bubbles:!1});return void this.closeEventHandler(t)}const i=yield this.prepareWebSocketUrl(n);this.logger.info(`opening connection to ${i}`),e||this.reconnectController.reset(),this.reconnectController.hasStartedConnectionAttempt()?this.reconnectController.startedConnectionAttempt(!1):this.reconnectController.startedConnectionAttempt(!0),this.webSocket.create(i,[],!0),this.forEachObserver((t=>{t.messagingSessionDidStartConnecting&&t.messagingSessionDidStartConnecting(e)})),this.setUpEventListeners()}))}prepareWebSocketUrl(e){return i(this,void 0,void 0,(function*(){const t=new Map;return t.set("userArn",[this.configuration.userArn]),t.set("sessionId",[this.configuration.messagingSessionId]),this.configuration.prefetchOn===p.default.Connect&&t.set("prefetch-on",[p.default.Connect]),this.configuration.prefetchSortBy&&t.set("prefetch-sort-by",[this.configuration.prefetchSortBy]),yield this.sigV4.signURL("GET","wss","chime",e,"/connect","",t)}))}isClosed(){return this.webSocket.readyState()===h.default.None||this.webSocket.readyState()===h.default.Closed}openEventHandler(){this.reconnectController.reset(),this.isSessionEstablished=!1}receiveMessageHandler(e){try{const t=JSON.parse(e),n=t.Headers["x-amz-chime-event-type"],i=new a.default(n,t.Headers,t.Payload||null);if(this.isSessionEstablished||"SESSION_ESTABLISHED"!==n){if(!this.isSessionEstablished)return void this.preBootstrapMessages.push(i)}else{this.forEachObserver((e=>{e.messagingSessionDidStart&&e.messagingSessionDidStart()})),this.bootstrapResolved(),this.isSessionEstablished=!0;const e=this.preBootstrapMessages.length;for(let t=0;t<e;t++){const e=this.preBootstrapMessages.shift();this.forEachObserver((t=>{this.sendMessageToObserver(t,e)}))}}this.forEachObserver((e=>{this.sendMessageToObserver(e,i)}))}catch(e){this.logger.error(`Messaging parsing failed: ${e}`)}}sendMessageToObserver(e,t){e.messagingSessionDidReceiveMessage&&e.messagingSessionDidReceiveMessage(t)}retryConnection(){return this.reconnectController.retryWithBackoff((()=>i(this,void 0,void 0,(function*(){yield this.startConnecting(!0)}))),null)}closeEventHandler(e){this.logger.info(`WebSocket close: ${e.code} ${e.reason}`),4999!==e.code&&this.webSocket.destroy(),!this.isClosing&&this.canReconnect(e.code)&&this.retryConnection()||(this.isClosing=!1,this.isSessionEstablished?this.forEachObserver((t=>{t.messagingSessionDidStop&&t.messagingSessionDidStop(e)})):this.bootstrapRejected(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,n,i){this.userArn=e,this.messagingSessionId=t,this.endpointUrl=n,this.chimeClient=i,this.reconnectTimeoutMs=1e4,this.reconnectFixedWaitMs=0,this.reconnectShortBackoffMs=1e3,this.reconnectLongBackoffMs=5e3,this.prefetchOn=void 0,this.prefetchSortBy=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 n;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Connect="connect"}(n||(n={})),t.default=n},3938:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Unread="unread",e.LastMessageTimestamp="last-message-timestamp"}(n||(n={})),t.default=n},214:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(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=i.default.Modality[0],r.MODALITY_CONTENT=i.default.Modality.substr(1)},7500:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7797),r=n(3922),o=n(9416),s=n(289),a=n(8660);t.default=class{constructor(e,t,n){this.signalingClient=e,this.intervalMs=t,this.logger=n,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)i.default.nextTick((()=>{this.observerQueue.has(t)&&e(t)}))}start(){this.stop(),this.signalingClient.registerObserver(this),this.signalingClient.ready()&&this.startPingInterval()}stop(){this.stopPingInterval(),this.signalingClient.removeObserver(this)}startPingInterval(){this.intervalScheduler.start((()=>{this.ping()})),this.ping()}stopPingInterval(){this.intervalScheduler.stop(),this.pingId=0,this.consecutivePongsUnaccountedFor=0}ping(){this.consecutivePongsUnaccountedFor>0&&(this.logger.warn(`missed pong ${this.consecutivePongsUnaccountedFor} time(s)`),this.forEachObserver((e=>{a.Maybe.of(e.didMissPongs).map((t=>t.bind(e)(this.consecutivePongsUnaccountedFor)))}))),this.consecutivePongsUnaccountedFor+=1,this.pingId=this.pingId+1&4294967295;const e=s.SdkPingPongFrame.create();e.pingId=this.pingId,e.type=s.SdkPingPongType.PING,this.pingTimestampLocalMs=this.signalingClient.pingPong(e),this.logger.debug((()=>`sent ping ${this.pingId}`))}pong(e){const t=s.SdkPingPongFrame.create();t.pingId=e,t.type=s.SdkPingPongType.PONG,this.signalingClient.pingPong(t)}handleSignalingClientEvent(e){switch(e.type){case o.default.WebSocketOpen:this.startPingInterval();break;case o.default.WebSocketFailed:case o.default.WebSocketError:this.logger.warn(`stopped pinging (${o.default[e.type]})`),this.stopPingInterval();break;case o.default.WebSocketClosing:case o.default.WebSocketClosed:this.logger.info(`stopped pinging (${o.default[e.type]})`),this.stopPingInterval();break;case o.default.ReceivedSignalFrame:if(e.message.type!==s.SdkSignalFrame.Type.PING_PONG)break;if(e.message.pingPong.type===s.SdkPingPongType.PONG){const t=e.message.pingPong.pingId;if(t!==this.pingId){this.logger.warn(`unexpected ping id ${t} (expected ${this.pingId})`);break}let n;if(this.consecutivePongsUnaccountedFor=0,"number"!=typeof e.message.timestampMs)break;n=e.message.timestampMs,this.logger.debug((()=>`received pong ${t} with timestamp ${n}`));const i=e.timestampMs-this.pingTimestampLocalMs,r=Math.round(n-i/2),o=this.pingTimestampLocalMs-r;this.logger.info(`local clock skew estimate=${o}ms from ping-pong time=${i}ms`),this.forEachObserver((e=>{a.Maybe.of(e.didReceivePong).map((n=>n.bind(e)(t,o,i)))}))}else this.pong(e.message.pingPong.pingId)}}}},983:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(5308),r=n(9825),o=n(9576);t.default=class{constructor(e,t){this.mediaStreamBroker=e,this.state=new r.default,this._transcriptionController=t||new i.default(this)}realtimeSetLocalAttendeeId(e,t){this.state.localAttendeeId=e,this.state.localExternalUserId=t}realtimeSetAttendeeIdPresence(e,t,n,i,r){try{t&&(this.state.attendeeIdToExternalUserId[e]=n);for(const o of this.state.attendeeIdChangesCallbacks)o(e,t,n,i,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 n=this.state.volumeIndicatorCallbacks[e].indexOf(t);n>=0&&this.state.volumeIndicatorCallbacks[e].splice(n,1)}else delete this.state.volumeIndicatorCallbacks[e]}realtimeUpdateVolumeIndicator(e,t,n,i,r){try{n=this.applyLocalMuteOverride(e,n);const o=this.getVolumeIndicatorState(e);let s=!1,a=!1,l=!1;null!==n&&o.muted!==n&&(o.muted=n,a=!0,o.muted&&0!==o.volume&&(o.volume=0,s=!0)),o.muted||null===t||(o.volume!==t&&(o.volume=t,s=!0),null===o.muted&&(o.muted=!1,a=!0)),null!==i&&o.signalStrength!==i&&(o.signalStrength=i,l=!0),this.sendVolumeIndicatorChange(e,s,a,l,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,n){try{for(const i of this.state.sendDataMessageCallbacks)i(e,t,n)}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 n=this.state.localAttendeeId,i=this.state.muted;return e!==n?t:"activeDevices"in this.mediaStreamBroker&&this.mediaStreamBroker.activeDevices.audio?i:t}sendVolumeIndicatorChange(e,t,n,i,r){if(this.sendLocalSignalStrengthChange(e,i),!this.state.volumeIndicatorCallbacks.hasOwnProperty(e))return;const s=this.getVolumeIndicatorState(e),a=new o.default;if(t&&(a.volume=s.volume),n&&(a.muted=s.muted),i&&(a.signalStrength=s.signalStrength),!this.stateIsEmpty(a))for(const t of this.state.volumeIndicatorCallbacks[e])t(e,a.volume,a.muted,a.signalStrength,r)}sendLocalSignalStrengthChange(e,t){if(!t)return;if(e!==this.state.localAttendeeId)return;const n=this.getVolumeIndicatorState(e).signalStrength;if(null!==n)for(const e of this.state.localSignalStrengthChangeCallbacks)e(n)}getVolumeIndicatorState(e){return this.state.volumeIndicatorState.hasOwnProperty(e)||(this.state.volumeIndicatorState[e]=new o.default),this.state.volumeIndicatorState[e]}stateIsEmpty(e){return null===e.volume&&null===e.muted&&null===e.signalStrength}onError(e){try{for(const t of this.state.fatalErrorCallbacks)t(e)}catch(t){try{console.error(e),console.error(t)}catch(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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(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 n=this.shouldReconnect&&!this.hasPastReconnectDeadline();return n&&(this.backoffCancel=t,this.backoffTimer=new i.default(this.backoffPolicy.nextBackoffAmountMs()),this.backoffTimer.start((()=>{this.backoffCancel=null,e()}))),n}shouldOnlyRestartPeerConnection(){return this.onlyRestartPeerConnection}clone(){return new r(this.reconnectTimeoutMs,this.backoffPolicy)}setLastActiveTimestampMs(e){this.lastActiveTimestampMs=e}}t.default=r},7797:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4929);class r extends i.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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4076),r=n(1944),o=n(2330);class s{constructor(e){this.sdp=e}clone(){return new s(this.sdp)}static isRTPCandidate(e){const t=/candidate[:](\S+) (\d+)/g.exec(e);return null!==t&&"1"===t[2]}static linesToSDP(e){return new s(e.join(s.CRLF))}static candidateTypeFromString(e){switch(e){case i.default.Host:return i.default.Host;case i.default.ServerReflexive:return i.default.ServerReflexive;case i.default.PeerReflexive:return i.default.PeerReflexive;case i.default.Relay:return i.default.Relay}return null}static candidateType(e){const t=/a[=]candidate[:].* typ ([a-z]+) /g.exec(e);return null===t?null:s.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()+s.CRLF))}static findActiveCameraSection(e){let t=0,n=!1;for(const i of e){if(/^m=video/.test(i)&&(i.indexOf("sendrecv")>-1||-1===i.indexOf("sendonly")&&-1===i.indexOf("recvonly")&&-1===i.indexOf("inactive"))){n=!0;break}t++}return!1===n&&(t=-1),t}static extractSSRCsFromFIDGroupLine(e){return/^a=ssrc-group:FID\s(.+)/.exec(e)[1]}static matchPrefix(e,t){return s.splitLines(e).filter((e=>0===e.indexOf(t)))}lines(){return this.sdp.split(s.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 s.linesToSDP(this.lines().filter((t=>s.candidateType(t)!==e)))}withoutServerReflexiveCandidates(){return this.withoutCandidateType(i.default.ServerReflexive)}withAudioMaxAverageBitrate(e){if(!e)return this.clone();e=Math.trunc(Math.min(Math.max(e,s.rfc7587LowestBitrate),s.rfc7587HighestBitrate));const t=this.lines(),n=s.findOpusFmtpAttributes(t),i=s.updateOpusFmtpAttributes(t,n,[`maxaveragebitrate=${e}`]);return s.linesToSDP(i)}withStereoAudio(){const e=this.lines(),t=s.findOpusFmtpAttributes(e),n=s.updateOpusFmtpAttributes(e,t,["stereo=1","sprop-stereo=1"]);return s.linesToSDP(n)}static findOpusFmtpAttributes(e){const t=/^a=rtpmap:\s*(\d+)\s+opus\/48000/;let n=!1;const i=[];for(const r of e)if(r.startsWith("m=audio")&&(i.push(null),n=!0),r.startsWith("m=video")&&(n=!1),n){const e=t.exec(r);null!==e&&(i[i.length-1]=`a=fmtp:${e[1]} `)}return i}static updateOpusFmtpAttributes(e,t,n){const i=[];let r=0,o=null;for(const s of e)if(s.startsWith("m=audio")&&(o=t[r],r++),s.startsWith("m=video")&&(o=null),o&&s.startsWith(o)){const e=s.slice(o.length).split(";"),t=[];for(const i of e)n.findIndex((e=>e.startsWith(i.split("=")[0])))<0&&t.push(i);for(const e of n)t.push(e);i.push(o+t.join(";"))}else i.push(s);return i}withUnifiedPlanFormat(){let e=this.sdp;return e.includes("mozilla")?this.clone():(e=e.replace("o=-","o=mozilla-chrome"),new s(e))}getUniqueRtpHeaderExtensionId(e){const t=[];for(const n of e)if(/^a=extmap:/.test(n.trim())){const e=+n.split("a=extmap:")[1].split(" ")[0];t.includes(e)||t.push(e)}t.sort(((e,t)=>e-t));let n=0;for(const e of t){if(e-n>1)return n+1;n=e}return 14===n?-1:n+1}withVideoLayersAllocationRtpHeaderExtension(e){const t="http://www.webrtc.org/experiments/rtp-hdrext/video-layers-allocation00",n=e?e.getRtpHeaderExtensionId(t):-1,i=-1===n?this.getUniqueRtpHeaderExtensionId(s.splitLines(this.sdp)):n,r=s.splitSections(this.sdp),o=[];for(let e of r){if(/^m=video/.test(e)&&-1===s.getRtpHeaderExtensionIdInSection(e,t)){const n=s.splitLines(e),r=[];if(-1===i||this.hasRtpHeaderExtensionId(i)){o.push(e);continue}for(const e of n)if(r.push(e),/^a=sendrecv/.test(e.trim())){const e="a=extmap:"+i+" "+t;r.push(e)}e=r.join(s.CRLF)+s.CRLF}else if(-1!==n&&/^m=video/.test(e)&&s.getRtpHeaderExtensionIdInSection(e,t)!==n){const i=s.splitLines(e),r=[];for(const e of i)if(/^a=extmap:/.test(e.trim())&&e.split("a=extmap:")[1].split(" ")[1]===t){if(!this.hasRtpHeaderExtensionId(n)){const e="a=extmap:"+n+" "+t;r.push(e)}}else r.push(e);e=r.join(s.CRLF)+s.CRLF}o.push(e)}const a=o.join("");return new s(a)}ssrcForVideoSendingSection(){const e=this.sdp,t=s.splitSections(e);if(t.length<2)return"";const n=s.findActiveCameraSection(t);if(-1===n)return"";const i=s.matchPrefix(t[n],"a=ssrc-group:FID ");if(i.length<1)return"";const r=s.extractSSRCsFromFIDGroupLine(i[0]),[o]=r.split(" ").map((e=>parseInt(e,10)));return o.toString()}videoSendSectionHasDifferentSSRC(e){const t=this.ssrcForVideoSendingSection(),n=e.ssrcForVideoSendingSection();return""!==t&&""!==n&&parseInt(t,10)!==parseInt(n,10)}removeH264SupportFromSendSection(){const e=this.sdp,t=s.splitSections(e),n=s.findActiveCameraSection(t);if(-1===n)return new s(this.sdp);const i=t[n],r=s.splitLines(i),o=[],a=new Map;r.forEach((e=>{if(/^a=rtpmap:/.test(e)){const t=/^a=rtpmap:([0-9]+)\s/.exec(e);t&&e.toLowerCase().includes("h264")&&o.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),n=parseInt(t[2],10);a.has(n)?a.get(n).push(e):a.set(n,[e])}}}));const l=new Set;for(const e of o){l.add(e);const t=a.get(e);if(t)for(const e of t)l.add(e)}if(o.length>0){const e=r[0].split(" ");r[0]=e.filter((e=>!l.has(parseInt(e)))).join(" ")}const c=r.filter((e=>{if(!e.includes("rtpmap")&&!e.includes("rtcp-fb")&&!e.includes("fmtp"))return!0;for(const t of l)if(e.includes(t.toString()))return!1;return!0}));t[n]=c.join(s.CRLF)+s.CRLF;const d=t.join("");return new s(d)}mediaSections(){const e=s.splitSections(this.sdp);if(e.length<2)return[];const t=[];for(let n=1;n<e.length;n++){const i=new r.default,o=s.splitLines(e[n]);for(const e of o){const t=s.mediaType(e);if(void 0!==t){i.mediaType=t;continue}const n=s.direction(e);if(void 0!==n){i.direction=n;continue}const r=s.mid(e);void 0===r||(i.mid=r)}t.push(i)}return t}static getRtpHeaderExtensionIdInSection(e,t){const n=s.splitLines(e);for(const e of n)if(/^a=extmap:/.test(e.trim())){const n=e.split("a=extmap:")[1].split(" "),i=+n[0];if(n[1]===t)return i}return-1}getRtpHeaderExtensionId(e){const t=s.splitSections(this.sdp);for(const n of t)if(/^m=video/.test(n)){const t=s.getRtpHeaderExtensionIdInSection(n,e);if(-1!==t)return t}return-1}hasRtpHeaderExtensionId(e){const t=s.splitLines(this.sdp);for(const n of t)if(/^a=extmap:/.test(n.trim())&&+n.split("a=extmap:")[1].split(" ")[0]===e)return!0;return!1}withVideoSendCodecPreferences(e){const t=this.sdp,n=s.splitSections(t),i=s.findActiveCameraSection(n);if(-1===i)return new s(this.sdp);n[i]=this.sectionWithCodecPreferences(n[i],e);const r=n.join("");return new s(r)}sectionWithCodecPreferences(e,t){const n=new Map,i=s.splitLines(e);i.forEach((e=>{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 o=!1;if(void 0!==r.codecCapability.sdpFmtpLine){for(const e of i)if(e.startsWith(`a=fmtp:${t[1]} ${r.codecCapability.sdpFmtpLine}`)){o=!0;break}}else o=!0;if(o){n.set(r.codecName,t[1]);break}}}));const r=new Set(n.values()),o=i[0].split(" ").filter((e=>!r.has(e))),a=Array.from(n.values()).sort(((e,i)=>t.findIndex((t=>n.get(t.codecName)===e))-t.findIndex((e=>n.get(e.codecName)===i))));return o.splice(3,0,...a.values()),i[0]=o.join(" "),i.join(s.CRLF)+s.CRLF}highestPriorityVideoSendCodec(){const e=this.sdp,t=s.splitSections(e),n=s.findActiveCameraSection(t);if(-1===n)return;const i=s.splitLines(t[n]),r=i[0].split(" ");if(r.length<4)return;const a=r[3];let l,c,d;for(const e of i){const t=/^a=rtpmap:([0-9]+)\s/.exec(e);if(null===t||t.length<2||t[1]!==a)continue;const n=e.split(" ")[1].split("/");if(!(void 0===n||n.length<2)){l=n[0],c=n[1];for(const e of i)if(e.startsWith(`a=fmtp:${a}`)){const t=e.split(" ");if(void 0===t||t.length<2)return;d=t[1]}break}}return void 0!==l?new o.default(l,{clockRate:parseInt(c),mimeType:`video/${l}`,sdpFmtpLine:d}):void 0}}t.default=s,s.CRLF="\r\n",s.rfc7587LowestBitrate=6e3,s.rfc7587HighestBitrate=51e4},4076:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.SDPCandidateType=void 0,function(e){e.Host="host",e.ServerReflexive="srflx",e.PeerReflexive="prflx",e.Relay="relay"}(n=t.SDPCandidateType||(t.SDPCandidateType={})),t.default=n},1944:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},2330:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(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 i.SdkVideoCodecCapability.VP8:return this.vp8();case i.SdkVideoCodecCapability.H264_CONSTRAINED_BASELINE_PROFILE:return this.h264ConstrainedBaselineProfile();default:return}}}t.default=r},3320:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(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 n={memLevel:r.Z_MEM_LEVEL,dictionary:t};return i.deflateRaw(e,n)}decompress(e,t){if(t.length>0){const e=Math.min(t.length,r.MAX_DICTIONARY_SIZE);t=t.slice(0,e)}const n={to:"string",dictionary:t,chunkSize:4096};let o="";try{o=i.inflateRaw(e,n)}catch(e){this.logger.error(`failed to decompress the string with error: [${e}]`)}return o}}t.default=r,r.Z_MEM_LEVEL=9,r.MAX_DICTIONARY_SIZE=31744},9678:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3860),r=n(6850),o=n(9553),s=n(3013);t.default=class{constructor(e){this.logger=e,this.currentState=o.SessionStateControllerState.NotConnected,this.deferredAction=null,this.deferredWork=null}perform(e,t){const n=this.currentState;if(n===o.SessionStateControllerState.NotConnected&&e===i.SessionStateControllerAction.Connect)this.transition(o.SessionStateControllerState.Connecting,e);else if(n===o.SessionStateControllerState.Connecting&&e===i.SessionStateControllerAction.Fail)this.transition(o.SessionStateControllerState.Disconnecting,e);else if(n===o.SessionStateControllerState.Connecting&&e===i.SessionStateControllerAction.FinishConnecting)this.transition(o.SessionStateControllerState.Connected,e);else if(n===o.SessionStateControllerState.Connected&&e===i.SessionStateControllerAction.Disconnect)this.transition(o.SessionStateControllerState.Disconnecting,e);else if(n===o.SessionStateControllerState.Connected&&e===i.SessionStateControllerAction.Reconnect)this.transition(o.SessionStateControllerState.Connecting,e);else if(n===o.SessionStateControllerState.Connected&&e===i.SessionStateControllerAction.Fail)this.transition(o.SessionStateControllerState.Disconnecting,e);else if(n===o.SessionStateControllerState.Connected&&e===i.SessionStateControllerAction.Update)this.transition(o.SessionStateControllerState.Updating,e);else if(n===o.SessionStateControllerState.Updating&&e===i.SessionStateControllerAction.Fail)this.transition(o.SessionStateControllerState.Disconnecting,e);else if(n===o.SessionStateControllerState.Updating&&e===i.SessionStateControllerAction.FinishUpdating)this.transition(o.SessionStateControllerState.Connected,e);else{if(n!==o.SessionStateControllerState.Disconnecting||e!==i.SessionStateControllerAction.FinishDisconnecting)return this.canDefer(e)?(this.logger.info(`deferring transition from ${o.SessionStateControllerState[this.currentState]} with ${i.SessionStateControllerAction[e]}`),this.deferAction(e,t),s.SessionStateControllerTransitionResult.DeferredTransition):(this.logger.warn(`no transition found from ${o.SessionStateControllerState[this.currentState]} with ${i.SessionStateControllerAction[e]}`),s.SessionStateControllerTransitionResult.NoTransitionAvailable);this.transition(o.SessionStateControllerState.NotConnected,e)}try{t()}catch(t){return this.logger.error(`error during state ${o.SessionStateControllerState[this.currentState]} with action ${i.SessionStateControllerAction[e]}: ${t}`),this.logger.info(`rolling back transition to ${o.SessionStateControllerState[n]}`),this.currentState=n,s.SessionStateControllerTransitionResult.TransitionFailed}return this.performDeferredAction(),s.SessionStateControllerTransitionResult.Transitioned}state(){return this.currentState}transition(e,t){this.logger.info(`transitioning from ${o.SessionStateControllerState[this.currentState]} to ${o.SessionStateControllerState[e]} with ${i.SessionStateControllerAction[t]}`),this.currentState=e}deferPriority(e){switch(e){case i.SessionStateControllerAction.Disconnect:return r.SessionStateControllerDeferPriority.VeryHigh;case i.SessionStateControllerAction.Fail:return r.SessionStateControllerDeferPriority.High;case i.SessionStateControllerAction.Reconnect:return r.SessionStateControllerDeferPriority.Medium;case i.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===o.SessionStateControllerState.Connecting||this.currentState===o.SessionStateControllerState.Updating)}performDeferredAction(){if(!this.deferredAction)return;const e=this.deferredAction,t=this.deferredWork;this.deferredAction=null,this.deferredWork=null,this.logger.info(`performing deferred action ${i.SessionStateControllerAction[e]}`),this.perform(e,t)!==s.SessionStateControllerTransitionResult.Transitioned&&this.logger.info(`unable to perform deferred action ${i.SessionStateControllerAction[e]} in state ${o.SessionStateControllerState[this.currentState]}`)}}},3860:(e,t)=>{"use strict";var n;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"}(n=t.SessionStateControllerAction||(t.SessionStateControllerAction={})),t.default=n},6850:(e,t)=>{"use strict";var n;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"}(n=t.SessionStateControllerDeferPriority||(t.SessionStateControllerDeferPriority={})),t.default=n},9553:(e,t)=>{"use strict";var n;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"}(n=t.SessionStateControllerState||(t.SessionStateControllerState={})),t.default=n},3013:(e,t)=>{"use strict";var n;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"}(n=t.SessionStateControllerTransitionResult||(t.SessionStateControllerTransitionResult={})),t.default=n},1208:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(543),r=n(4929),o=n(289),s=n(4046),a=n(7387),l=n(7103),c=n(2902),d=n(9416);class u{constructor(e,t){this.webSocket=e,this.logger=t,this.unloadHandler=null,this.closeEventHandler=e=>{this.deactivatePageUnloadHandler(),this.resetConnection(),this.sendEvent(new c.default(this,d.default.WebSocketClosed,null,e.code,e.reason)),this.serviceConnectionRequestQueue()},this.observerQueue=new Set,this.connectionRequestQueue=[],this.resetConnection(),this.logger.debug((()=>"signaling client init")),this.audioSessionId=this.generateNewAudioSessionId()}registerObserver(e){this.logger.debug((()=>"registering signaling client observer")),this.observerQueue.add(e)}removeObserver(e){this.logger.debug((()=>"removing signaling client observer")),this.observerQueue.delete(e)}openConnection(e){this.logger.info("adding connection request to queue: "+e.url()),this.connectionRequestQueue.push(e),this.closeConnection()}pingPong(e){this.logger.debug((()=>"sending ping"));const t=o.SdkSignalFrame.create();return t.type=o.SdkSignalFrame.Type.PING_PONG,t.pingPong=e,this.sendMessage(t),t.timestampMs}join(e){this.logger.info("sending join");const t=o.SdkJoinFrame.create();t.protocolVersion=2,t.flags=o.SdkJoinFlags.HAS_STREAM_UPDATE;const n=new i.default,r={platformName:n.name(),platformVersion:n.version(),clientSource:s.default.sdkName,chimeSdkVersion:s.default.sdkVersion};if(e.applicationMetadata){const{appName:t,appVersion:n}=e.applicationMetadata;r.appName=t,r.appVersion=n}t.clientDetails=o.SdkClientDetails.create(r),t.audioSessionId=this.audioSessionId,t.wantsCompressedSdp=u.CLIENT_SUPPORTS_COMPRESSION,t.serverSideNetworkAdaption=l.convertServerSideNetworkAdaptionEnumToSignaled(e.serverSideNetworkAdaption),e.serverSideNetworkAdaption===l.default.BandwidthProbing&&(t.wantsServerSideNetworkProbingOnReceiveSideEstimator=!0),t.supportedServerSideNetworkAdaptions=e.supportedServerSideNetworkAdaptions.map(l.convertServerSideNetworkAdaptionEnumToSignaled);const a=o.SdkSignalFrame.create();a.type=o.SdkSignalFrame.Type.JOIN,a.join=t,this.sendMessage(a)}subscribe(e){const t=o.SdkSubscribeFrame.create();if(t.sendStreams=[],t.sdpOffer=e.sdpOffer,e.connectionTypeHasVideo&&(t.receiveStreamIds=e.receiveStreamIds),e.audioHost&&(t.audioCheckin=e.audioCheckin,t.audioHost=e.audioHost,t.audioMuted=e.audioMuted,!e.audioCheckin)){const n=o.SdkStreamDescriptor.create();n.mediaType=o.SdkStreamMediaType.AUDIO,n.trackLabel="AmazonChimeExpressAudio",n.attendeeId=e.attendeeId,n.streamId=1,n.groupId=1,n.framerate=15,n.maxBitrateKbps=600,n.avgBitrateBps=4e5,t.sendStreams.push(n)}if(t.compressedSdpOffer=e.compressedSdpOffer,t.duplex=o.SdkStreamServiceType.RX,e.localVideoEnabled){t.duplex=o.SdkStreamServiceType.DUPLEX;for(let n=0;n<e.videoStreamDescriptions.length;n++){const i=e.videoStreamDescriptions[n].clone();i.attendeeId=e.attendeeId,t.sendStreams.push(i.toStreamDescriptor())}}e.videoSubscriptionConfiguration.length>0&&(t.videoSubscriptionConfiguration=e.videoSubscriptionConfiguration.map(this.convertVideoSubscriptionConfiguration));const n=o.SdkSignalFrame.create();n.type=o.SdkSignalFrame.Type.SUBSCRIBE,n.sub=t,this.sendMessage(n)}remoteVideoUpdate(e,t){const n=o.SdkRemoteVideoUpdateFrame.create();n.addedOrUpdatedVideoSubscriptions=e.map(this.convertVideoSubscriptionConfiguration),n.removedVideoSubscriptionMids=t;const i=o.SdkSignalFrame.create();i.type=o.SdkSignalFrame.Type.REMOTE_VIDEO_UPDATE,i.remoteVideoUpdate=n,this.sendMessage(i)}convertVideoSubscriptionConfiguration(e){const t=new o.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=o.SdkSignalFrame.create();e.type=o.SdkSignalFrame.Type.LEAVE,e.leave=o.SdkLeaveFrame.create(),this.sendMessage(e),this.logger.debug((()=>"sent leave"))}sendClientMetrics(e){const t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.CLIENT_METRIC,t.clientMetric=e,this.sendMessage(t)}sendDataMessage(e){const t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.DATA_MESSAGE,t.dataMessage=e,this.sendMessage(t)}closeConnection(){var e,t;if(this.webSocket.readyState()!==a.default.None&&this.webSocket.readyState()!==a.default.Closed){this.isClosing=!0,this.sendEvent(new c.default(this,d.default.WebSocketClosing,null));const n=new r.default(u.CLOSE_EVENT_TIMEOUT_MS),i=e=>{var t,r;null===(r=(t=this.webSocket).removeEventListener)||void 0===r||r.call(t,"close",i),n.stop(),this.closeEventHandler(e)};null===(t=(e=this.webSocket).removeEventListener)||void 0===t||t.call(e,"close",this.closeEventHandler),this.webSocket.addEventListener("close",i),n.start((()=>{i(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()===a.default.Open&&!this.isClosing&&this.wasOpened}mute(e){const t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.AUDIO_CONTROL;const n=o.SdkAudioControlFrame.create();n.muted=e,t.audioControl=n,this.sendMessage(t)}pause(e){const t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.PAUSE,t.pause=o.SdkPauseResumeFrame.create(),t.pause.streamIds=e,this.sendMessage(t)}resume(e){const t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.RESUME,t.pause=o.SdkPauseResumeFrame.create(),t.pause.streamIds=e,this.sendMessage(t)}resetConnection(){this.webSocket.destroy(),this.wasOpened=!1}sendMessage(e){e.timestampMs=Date.now(),this.logger.debug((()=>`sending: ${JSON.stringify(e)}`));const t=this.prependWithFrameTypeRTC(o.SdkSignalFrame.encode(e).finish());if(this.ready()){if(!this.webSocket.send(t))return void this.sendEvent(new c.default(this,d.default.WebSocketSendMessageFailure,null));this.sendEvent(new c.default(this,d.default.WebSocketSentMessage,null))}else this.sendEvent(new c.default(this,d.default.WebSocketSkippedMessage,null))}receiveMessage(e){let t;try{t=o.SdkSignalFrame.decode(e)}catch(t){return this.logger.info(`failed to decode: ${e}`),void this.sendEvent(new c.default(this,d.default.ProtocolDecodeFailure,null))}this.logger.debug((()=>`received: ${JSON.stringify(t)}`)),this.webSocket.readyState()===a.default.Open?this.sendEvent(new c.default(this,d.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!==u.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]=u.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 c.default(this,d.default.WebSocketConnecting,null))}sendEvent(e){switch(e.type){case d.default.WebSocketMessage:case d.default.ReceivedSignalFrame:case d.default.WebSocketSentMessage:this.logger.debug((()=>`notifying event: ${d.default[e.type]}`));break;case d.default.WebSocketSkippedMessage:this.logger.debug((()=>`notifying event: ${d.default[e.type]}, websocket state=${a.default[this.webSocket.readyState()]}`));break;default:this.logger.info(`notifying event: ${d.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 c.default(this,d.default.WebSocketOpen,null))})),this.webSocket.addEventListener("message",(e=>{this.sendEvent(new c.default(this,d.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 c.default(this,d.default.WebSocketError,null))):(this.logger.error("failed to connect"),this.sendEvent(new c.default(this,d.default.WebSocketFailed,null))):this.logger.info("ignoring error closing signaling while connecting")}))}activatePageUnloadHandler(){this.unloadHandler=()=>{this.leave()};const e=n.g;e.window&&e.window.addEventListener&&window.addEventListener("unload",this.unloadHandler)}deactivatePageUnloadHandler(){const e=n.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=o.SdkMeetingSessionCredentials.create();t.attendeeId=e.attendeeId,t.externalUserId=e.externalUserId,t.joinToken=e.joinToken;const n=o.SdkPrimaryMeetingJoinFrame.create();n.credentials=t;const i=o.SdkSignalFrame.create();i.type=o.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN,i.primaryMeetingJoin=n,this.sendMessage(i)}demoteFromPrimaryMeeting(){const e=o.SdkPrimaryMeetingLeaveFrame.create(),t=o.SdkSignalFrame.create();t.type=o.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE,t.primaryMeetingLeave=e,this.sendMessage(t)}}t.default=u,u.FRAME_TYPE_RTC=5,u.CLOSE_EVENT_TIMEOUT_MS=2e3,u.CLIENT_SUPPORTS_COMPRESSION=!0},7103:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertServerSideNetworkAdaptionEnumToSignaled=t.convertServerSideNetworkAdaptionEnumFromSignaled=t.ServerSideNetworkAdaption=void 0;const i=n(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 i.SdkServerSideNetworkAdaption.DEFAULT:return r.Default;case i.SdkServerSideNetworkAdaption.NONE:return r.None;case i.SdkServerSideNetworkAdaption.BANDWIDTH_PROBING:return r.BandwidthProbing}},t.convertServerSideNetworkAdaptionEnumToSignaled=function(e){switch(e){case r.Default:return i.SdkServerSideNetworkAdaption.DEFAULT;case r.None:return i.SdkServerSideNetworkAdaption.NONE;case r.BandwidthProbing:return i.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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9416);t.default=class{constructor(e,t,n,i,r){this.client=e,this.type=t,this.message=n,this.closeCode=i,this.closeReason=r,this.timestampMs=Date.now()}isConnectionTerminated(){switch(this.type){case i.default.WebSocketFailed:case i.default.WebSocketError:case i.default.WebSocketClosing:case i.default.WebSocketClosed:return!0;default:return!1}}}},9416:(e,t)=>{"use strict";var n;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"}(n=t.SignalingClientEventType||(t.SignalingClientEventType={})),t.default=n},2168:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7103);t.default=class{constructor(e){this.applicationMetadata=e,this.serverSideNetworkAdaption=i.default.Default,this.supportedServerSideNetworkAdaptions=[]}}},6729:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e,t,n,i,r,o,s,a,l,c){this.attendeeId=e,this.sdpOffer=t,this.audioHost=n,this.audioMuted=i,this.audioCheckin=r,this.receiveStreamIds=o,this.localVideoEnabled=s,this.videoStreamDescriptions=a,this.connectionTypeHasVideo=l,this.compressedSdpOffer=c,this.videoSubscriptionConfiguration=[]}}},9101:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},289:(e,t,n)=>{"use strict";var i,r,o=n(2100),s=o.Reader,a=o.Writer,l=o.util,c=o.roots.default||(o.roots.default={});c.SdkSignalFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}var t,n;return e.prototype.timestampMs=l.Long?l.Long.fromBits(0,0,!0):0,e.prototype.type=1,e.prototype.error=null,e.prototype.join=null,e.prototype.joinack=null,e.prototype.sub=null,e.prototype.suback=null,e.prototype.index=null,e.prototype.pause=null,e.prototype.leave=null,e.prototype.leaveAck=null,e.prototype.bitrates=null,e.prototype.audioControl=null,e.prototype.audioMetadata=null,e.prototype.audioStreamIdInfo=null,e.prototype.pingPong=null,e.prototype.audioStatus=null,e.prototype.clientMetric=null,e.prototype.dataMessage=null,e.prototype.remoteVideoUpdate=null,e.prototype.primaryMeetingJoin=null,e.prototype.primaryMeetingJoinAck=null,e.prototype.primaryMeetingLeave=null,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),t.uint32(8).uint64(e.timestampMs),t.uint32(16).int32(e.type),null!=e.error&&Object.hasOwnProperty.call(e,"error")&&c.SdkErrorFrame.encode(e.error,t.uint32(26).fork()).ldelim(),null!=e.join&&Object.hasOwnProperty.call(e,"join")&&c.SdkJoinFrame.encode(e.join,t.uint32(34).fork()).ldelim(),null!=e.joinack&&Object.hasOwnProperty.call(e,"joinack")&&c.SdkJoinAckFrame.encode(e.joinack,t.uint32(42).fork()).ldelim(),null!=e.sub&&Object.hasOwnProperty.call(e,"sub")&&c.SdkSubscribeFrame.encode(e.sub,t.uint32(50).fork()).ldelim(),null!=e.suback&&Object.hasOwnProperty.call(e,"suback")&&c.SdkSubscribeAckFrame.encode(e.suback,t.uint32(58).fork()).ldelim(),null!=e.index&&Object.hasOwnProperty.call(e,"index")&&c.SdkIndexFrame.encode(e.index,t.uint32(66).fork()).ldelim(),null!=e.pause&&Object.hasOwnProperty.call(e,"pause")&&c.SdkPauseResumeFrame.encode(e.pause,t.uint32(82).fork()).ldelim(),null!=e.leave&&Object.hasOwnProperty.call(e,"leave")&&c.SdkLeaveFrame.encode(e.leave,t.uint32(90).fork()).ldelim(),null!=e.leaveAck&&Object.hasOwnProperty.call(e,"leaveAck")&&c.SdkLeaveAckFrame.encode(e.leaveAck,t.uint32(98).fork()).ldelim(),null!=e.bitrates&&Object.hasOwnProperty.call(e,"bitrates")&&c.SdkBitrateFrame.encode(e.bitrates,t.uint32(114).fork()).ldelim(),null!=e.audioControl&&Object.hasOwnProperty.call(e,"audioControl")&&c.SdkAudioControlFrame.encode(e.audioControl,t.uint32(138).fork()).ldelim(),null!=e.audioMetadata&&Object.hasOwnProperty.call(e,"audioMetadata")&&c.SdkAudioMetadataFrame.encode(e.audioMetadata,t.uint32(146).fork()).ldelim(),null!=e.audioStreamIdInfo&&Object.hasOwnProperty.call(e,"audioStreamIdInfo")&&c.SdkAudioStreamIdInfoFrame.encode(e.audioStreamIdInfo,t.uint32(154).fork()).ldelim(),null!=e.pingPong&&Object.hasOwnProperty.call(e,"pingPong")&&c.SdkPingPongFrame.encode(e.pingPong,t.uint32(162).fork()).ldelim(),null!=e.audioStatus&&Object.hasOwnProperty.call(e,"audioStatus")&&c.SdkAudioStatusFrame.encode(e.audioStatus,t.uint32(170).fork()).ldelim(),null!=e.clientMetric&&Object.hasOwnProperty.call(e,"clientMetric")&&c.SdkClientMetricFrame.encode(e.clientMetric,t.uint32(178).fork()).ldelim(),null!=e.dataMessage&&Object.hasOwnProperty.call(e,"dataMessage")&&c.SdkDataMessageFrame.encode(e.dataMessage,t.uint32(186).fork()).ldelim(),null!=e.remoteVideoUpdate&&Object.hasOwnProperty.call(e,"remoteVideoUpdate")&&c.SdkRemoteVideoUpdateFrame.encode(e.remoteVideoUpdate,t.uint32(202).fork()).ldelim(),null!=e.primaryMeetingJoin&&Object.hasOwnProperty.call(e,"primaryMeetingJoin")&&c.SdkPrimaryMeetingJoinFrame.encode(e.primaryMeetingJoin,t.uint32(210).fork()).ldelim(),null!=e.primaryMeetingJoinAck&&Object.hasOwnProperty.call(e,"primaryMeetingJoinAck")&&c.SdkPrimaryMeetingJoinAckFrame.encode(e.primaryMeetingJoinAck,t.uint32(218).fork()).ldelim(),null!=e.primaryMeetingLeave&&Object.hasOwnProperty.call(e,"primaryMeetingLeave")&&c.SdkPrimaryMeetingLeaveFrame.encode(e.primaryMeetingLeave,t.uint32(226).fork()).ldelim(),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkSignalFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.timestampMs=e.uint64();break;case 2:i.type=e.int32();break;case 3:i.error=c.SdkErrorFrame.decode(e,e.uint32());break;case 4:i.join=c.SdkJoinFrame.decode(e,e.uint32());break;case 5:i.joinack=c.SdkJoinAckFrame.decode(e,e.uint32());break;case 6:i.sub=c.SdkSubscribeFrame.decode(e,e.uint32());break;case 7:i.suback=c.SdkSubscribeAckFrame.decode(e,e.uint32());break;case 8:i.index=c.SdkIndexFrame.decode(e,e.uint32());break;case 10:i.pause=c.SdkPauseResumeFrame.decode(e,e.uint32());break;case 11:i.leave=c.SdkLeaveFrame.decode(e,e.uint32());break;case 12:i.leaveAck=c.SdkLeaveAckFrame.decode(e,e.uint32());break;case 14:i.bitrates=c.SdkBitrateFrame.decode(e,e.uint32());break;case 17:i.audioControl=c.SdkAudioControlFrame.decode(e,e.uint32());break;case 18:i.audioMetadata=c.SdkAudioMetadataFrame.decode(e,e.uint32());break;case 19:i.audioStreamIdInfo=c.SdkAudioStreamIdInfoFrame.decode(e,e.uint32());break;case 20:i.pingPong=c.SdkPingPongFrame.decode(e,e.uint32());break;case 21:i.audioStatus=c.SdkAudioStatusFrame.decode(e,e.uint32());break;case 22:i.clientMetric=c.SdkClientMetricFrame.decode(e,e.uint32());break;case 23:i.dataMessage=c.SdkDataMessageFrame.decode(e,e.uint32());break;case 25:i.remoteVideoUpdate=c.SdkRemoteVideoUpdateFrame.decode(e,e.uint32());break;case 26:i.primaryMeetingJoin=c.SdkPrimaryMeetingJoinFrame.decode(e,e.uint32());break;case 27:i.primaryMeetingJoinAck=c.SdkPrimaryMeetingJoinAckFrame.decode(e,e.uint32());break;case 28:i.primaryMeetingLeave=c.SdkPrimaryMeetingLeaveFrame.decode(e,e.uint32());break;default:e.skipType(7&r)}}if(!i.hasOwnProperty("timestampMs"))throw l.ProtocolError("missing required 'timestampMs'",{instance:i});if(!i.hasOwnProperty("type"))throw l.ProtocolError("missing required 'type'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(!(l.isInteger(e.timestampMs)||e.timestampMs&&l.isInteger(e.timestampMs.low)&&l.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=c.SdkErrorFrame.verify(e.error))?"error."+t:null!=e.join&&e.hasOwnProperty("join")&&(t=c.SdkJoinFrame.verify(e.join))?"join."+t:null!=e.joinack&&e.hasOwnProperty("joinack")&&(t=c.SdkJoinAckFrame.verify(e.joinack))?"joinack."+t:null!=e.sub&&e.hasOwnProperty("sub")&&(t=c.SdkSubscribeFrame.verify(e.sub))?"sub."+t:null!=e.suback&&e.hasOwnProperty("suback")&&(t=c.SdkSubscribeAckFrame.verify(e.suback))?"suback."+t:null!=e.index&&e.hasOwnProperty("index")&&(t=c.SdkIndexFrame.verify(e.index))?"index."+t:null!=e.pause&&e.hasOwnProperty("pause")&&(t=c.SdkPauseResumeFrame.verify(e.pause))?"pause."+t:null!=e.leave&&e.hasOwnProperty("leave")&&(t=c.SdkLeaveFrame.verify(e.leave))?"leave."+t:null!=e.leaveAck&&e.hasOwnProperty("leaveAck")&&(t=c.SdkLeaveAckFrame.verify(e.leaveAck))?"leaveAck."+t:null!=e.bitrates&&e.hasOwnProperty("bitrates")&&(t=c.SdkBitrateFrame.verify(e.bitrates))?"bitrates."+t:null!=e.audioControl&&e.hasOwnProperty("audioControl")&&(t=c.SdkAudioControlFrame.verify(e.audioControl))?"audioControl."+t:null!=e.audioMetadata&&e.hasOwnProperty("audioMetadata")&&(t=c.SdkAudioMetadataFrame.verify(e.audioMetadata))?"audioMetadata."+t:null!=e.audioStreamIdInfo&&e.hasOwnProperty("audioStreamIdInfo")&&(t=c.SdkAudioStreamIdInfoFrame.verify(e.audioStreamIdInfo))?"audioStreamIdInfo."+t:null!=e.pingPong&&e.hasOwnProperty("pingPong")&&(t=c.SdkPingPongFrame.verify(e.pingPong))?"pingPong."+t:null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&(t=c.SdkAudioStatusFrame.verify(e.audioStatus))?"audioStatus."+t:null!=e.clientMetric&&e.hasOwnProperty("clientMetric")&&(t=c.SdkClientMetricFrame.verify(e.clientMetric))?"clientMetric."+t:null!=e.dataMessage&&e.hasOwnProperty("dataMessage")&&(t=c.SdkDataMessageFrame.verify(e.dataMessage))?"dataMessage."+t:null!=e.remoteVideoUpdate&&e.hasOwnProperty("remoteVideoUpdate")&&(t=c.SdkRemoteVideoUpdateFrame.verify(e.remoteVideoUpdate))?"remoteVideoUpdate."+t:null!=e.primaryMeetingJoin&&e.hasOwnProperty("primaryMeetingJoin")&&(t=c.SdkPrimaryMeetingJoinFrame.verify(e.primaryMeetingJoin))?"primaryMeetingJoin."+t:null!=e.primaryMeetingJoinAck&&e.hasOwnProperty("primaryMeetingJoinAck")&&(t=c.SdkPrimaryMeetingJoinAckFrame.verify(e.primaryMeetingJoinAck))?"primaryMeetingJoinAck."+t:null!=e.primaryMeetingLeave&&e.hasOwnProperty("primaryMeetingLeave")&&(t=c.SdkPrimaryMeetingLeaveFrame.verify(e.primaryMeetingLeave))?"primaryMeetingLeave."+t:null},e.fromObject=function(e){if(e instanceof c.SdkSignalFrame)return e;var t=new c.SdkSignalFrame;switch(null!=e.timestampMs&&(l.Long?(t.timestampMs=l.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 l.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=c.SdkErrorFrame.fromObject(e.error)}if(null!=e.join){if("object"!=typeof e.join)throw TypeError(".SdkSignalFrame.join: object expected");t.join=c.SdkJoinFrame.fromObject(e.join)}if(null!=e.joinack){if("object"!=typeof e.joinack)throw TypeError(".SdkSignalFrame.joinack: object expected");t.joinack=c.SdkJoinAckFrame.fromObject(e.joinack)}if(null!=e.sub){if("object"!=typeof e.sub)throw TypeError(".SdkSignalFrame.sub: object expected");t.sub=c.SdkSubscribeFrame.fromObject(e.sub)}if(null!=e.suback){if("object"!=typeof e.suback)throw TypeError(".SdkSignalFrame.suback: object expected");t.suback=c.SdkSubscribeAckFrame.fromObject(e.suback)}if(null!=e.index){if("object"!=typeof e.index)throw TypeError(".SdkSignalFrame.index: object expected");t.index=c.SdkIndexFrame.fromObject(e.index)}if(null!=e.pause){if("object"!=typeof e.pause)throw TypeError(".SdkSignalFrame.pause: object expected");t.pause=c.SdkPauseResumeFrame.fromObject(e.pause)}if(null!=e.leave){if("object"!=typeof e.leave)throw TypeError(".SdkSignalFrame.leave: object expected");t.leave=c.SdkLeaveFrame.fromObject(e.leave)}if(null!=e.leaveAck){if("object"!=typeof e.leaveAck)throw TypeError(".SdkSignalFrame.leaveAck: object expected");t.leaveAck=c.SdkLeaveAckFrame.fromObject(e.leaveAck)}if(null!=e.bitrates){if("object"!=typeof e.bitrates)throw TypeError(".SdkSignalFrame.bitrates: object expected");t.bitrates=c.SdkBitrateFrame.fromObject(e.bitrates)}if(null!=e.audioControl){if("object"!=typeof e.audioControl)throw TypeError(".SdkSignalFrame.audioControl: object expected");t.audioControl=c.SdkAudioControlFrame.fromObject(e.audioControl)}if(null!=e.audioMetadata){if("object"!=typeof e.audioMetadata)throw TypeError(".SdkSignalFrame.audioMetadata: object expected");t.audioMetadata=c.SdkAudioMetadataFrame.fromObject(e.audioMetadata)}if(null!=e.audioStreamIdInfo){if("object"!=typeof e.audioStreamIdInfo)throw TypeError(".SdkSignalFrame.audioStreamIdInfo: object expected");t.audioStreamIdInfo=c.SdkAudioStreamIdInfoFrame.fromObject(e.audioStreamIdInfo)}if(null!=e.pingPong){if("object"!=typeof e.pingPong)throw TypeError(".SdkSignalFrame.pingPong: object expected");t.pingPong=c.SdkPingPongFrame.fromObject(e.pingPong)}if(null!=e.audioStatus){if("object"!=typeof e.audioStatus)throw TypeError(".SdkSignalFrame.audioStatus: object expected");t.audioStatus=c.SdkAudioStatusFrame.fromObject(e.audioStatus)}if(null!=e.clientMetric){if("object"!=typeof e.clientMetric)throw TypeError(".SdkSignalFrame.clientMetric: object expected");t.clientMetric=c.SdkClientMetricFrame.fromObject(e.clientMetric)}if(null!=e.dataMessage){if("object"!=typeof e.dataMessage)throw TypeError(".SdkSignalFrame.dataMessage: object expected");t.dataMessage=c.SdkDataMessageFrame.fromObject(e.dataMessage)}if(null!=e.remoteVideoUpdate){if("object"!=typeof e.remoteVideoUpdate)throw TypeError(".SdkSignalFrame.remoteVideoUpdate: object expected");t.remoteVideoUpdate=c.SdkRemoteVideoUpdateFrame.fromObject(e.remoteVideoUpdate)}if(null!=e.primaryMeetingJoin){if("object"!=typeof e.primaryMeetingJoin)throw TypeError(".SdkSignalFrame.primaryMeetingJoin: object expected");t.primaryMeetingJoin=c.SdkPrimaryMeetingJoinFrame.fromObject(e.primaryMeetingJoin)}if(null!=e.primaryMeetingJoinAck){if("object"!=typeof e.primaryMeetingJoinAck)throw TypeError(".SdkSignalFrame.primaryMeetingJoinAck: object expected");t.primaryMeetingJoinAck=c.SdkPrimaryMeetingJoinAckFrame.fromObject(e.primaryMeetingJoinAck)}if(null!=e.primaryMeetingLeave){if("object"!=typeof e.primaryMeetingLeave)throw TypeError(".SdkSignalFrame.primaryMeetingLeave: object expected");t.primaryMeetingLeave=c.SdkPrimaryMeetingLeaveFrame.fromObject(e.primaryMeetingLeave)}return t},e.toObject=function(e,t){t||(t={});var n={};if(t.defaults){if(l.Long){var i=new l.Long(0,0,!0);n.timestampMs=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else n.timestampMs=t.longs===String?"0":0;n.type=t.enums===String?"JOIN":1,n.error=null,n.join=null,n.joinack=null,n.sub=null,n.suback=null,n.index=null,n.pause=null,n.leave=null,n.leaveAck=null,n.bitrates=null,n.audioControl=null,n.audioMetadata=null,n.audioStreamIdInfo=null,n.pingPong=null,n.audioStatus=null,n.clientMetric=null,n.dataMessage=null,n.remoteVideoUpdate=null,n.primaryMeetingJoin=null,n.primaryMeetingJoinAck=null,n.primaryMeetingLeave=null}return null!=e.timestampMs&&e.hasOwnProperty("timestampMs")&&("number"==typeof e.timestampMs?n.timestampMs=t.longs===String?String(e.timestampMs):e.timestampMs:n.timestampMs=t.longs===String?l.Long.prototype.toString.call(e.timestampMs):t.longs===Number?new l.LongBits(e.timestampMs.low>>>0,e.timestampMs.high>>>0).toNumber(!0):e.timestampMs),null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?c.SdkSignalFrame.Type[e.type]:e.type),null!=e.error&&e.hasOwnProperty("error")&&(n.error=c.SdkErrorFrame.toObject(e.error,t)),null!=e.join&&e.hasOwnProperty("join")&&(n.join=c.SdkJoinFrame.toObject(e.join,t)),null!=e.joinack&&e.hasOwnProperty("joinack")&&(n.joinack=c.SdkJoinAckFrame.toObject(e.joinack,t)),null!=e.sub&&e.hasOwnProperty("sub")&&(n.sub=c.SdkSubscribeFrame.toObject(e.sub,t)),null!=e.suback&&e.hasOwnProperty("suback")&&(n.suback=c.SdkSubscribeAckFrame.toObject(e.suback,t)),null!=e.index&&e.hasOwnProperty("index")&&(n.index=c.SdkIndexFrame.toObject(e.index,t)),null!=e.pause&&e.hasOwnProperty("pause")&&(n.pause=c.SdkPauseResumeFrame.toObject(e.pause,t)),null!=e.leave&&e.hasOwnProperty("leave")&&(n.leave=c.SdkLeaveFrame.toObject(e.leave,t)),null!=e.leaveAck&&e.hasOwnProperty("leaveAck")&&(n.leaveAck=c.SdkLeaveAckFrame.toObject(e.leaveAck,t)),null!=e.bitrates&&e.hasOwnProperty("bitrates")&&(n.bitrates=c.SdkBitrateFrame.toObject(e.bitrates,t)),null!=e.audioControl&&e.hasOwnProperty("audioControl")&&(n.audioControl=c.SdkAudioControlFrame.toObject(e.audioControl,t)),null!=e.audioMetadata&&e.hasOwnProperty("audioMetadata")&&(n.audioMetadata=c.SdkAudioMetadataFrame.toObject(e.audioMetadata,t)),null!=e.audioStreamIdInfo&&e.hasOwnProperty("audioStreamIdInfo")&&(n.audioStreamIdInfo=c.SdkAudioStreamIdInfoFrame.toObject(e.audioStreamIdInfo,t)),null!=e.pingPong&&e.hasOwnProperty("pingPong")&&(n.pingPong=c.SdkPingPongFrame.toObject(e.pingPong,t)),null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&(n.audioStatus=c.SdkAudioStatusFrame.toObject(e.audioStatus,t)),null!=e.clientMetric&&e.hasOwnProperty("clientMetric")&&(n.clientMetric=c.SdkClientMetricFrame.toObject(e.clientMetric,t)),null!=e.dataMessage&&e.hasOwnProperty("dataMessage")&&(n.dataMessage=c.SdkDataMessageFrame.toObject(e.dataMessage,t)),null!=e.remoteVideoUpdate&&e.hasOwnProperty("remoteVideoUpdate")&&(n.remoteVideoUpdate=c.SdkRemoteVideoUpdateFrame.toObject(e.remoteVideoUpdate,t)),null!=e.primaryMeetingJoin&&e.hasOwnProperty("primaryMeetingJoin")&&(n.primaryMeetingJoin=c.SdkPrimaryMeetingJoinFrame.toObject(e.primaryMeetingJoin,t)),null!=e.primaryMeetingJoinAck&&e.hasOwnProperty("primaryMeetingJoinAck")&&(n.primaryMeetingJoinAck=c.SdkPrimaryMeetingJoinAckFrame.toObject(e.primaryMeetingJoinAck,t)),null!=e.primaryMeetingLeave&&e.hasOwnProperty("primaryMeetingLeave")&&(n.primaryMeetingLeave=c.SdkPrimaryMeetingLeaveFrame.toObject(e.primaryMeetingLeave,t)),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e.Type=(t={},(n=Object.create(t))[t[1]="JOIN"]=1,n[t[2]="JOIN_ACK"]=2,n[t[3]="SUBSCRIBE"]=3,n[t[4]="SUBSCRIBE_ACK"]=4,n[t[5]="INDEX"]=5,n[t[7]="PAUSE"]=7,n[t[8]="RESUME"]=8,n[t[9]="LEAVE"]=9,n[t[10]="LEAVE_ACK"]=10,n[t[13]="BITRATES"]=13,n[t[16]="AUDIO_CONTROL"]=16,n[t[17]="AUDIO_METADATA"]=17,n[t[18]="AUDIO_STREAM_ID_INFO"]=18,n[t[19]="PING_PONG"]=19,n[t[20]="AUDIO_STATUS"]=20,n[t[21]="CLIENT_METRIC"]=21,n[t[22]="DATA_MESSAGE"]=22,n[t[24]="REMOTE_VIDEO_UPDATE"]=24,n[t[25]="PRIMARY_MEETING_JOIN"]=25,n[t[26]="PRIMARY_MEETING_JOIN_ACK"]=26,n[t[27]="PRIMARY_MEETING_LEAVE"]=27,n),e}(),c.SdkErrorFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.status=0,e.prototype.description="",e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.status&&Object.hasOwnProperty.call(e,"status")&&t.uint32(8).uint32(e.status),null!=e.description&&Object.hasOwnProperty.call(e,"description")&&t.uint32(18).string(e.description),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkErrorFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.status=e.uint32();break;case 2:i.description=e.string();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.status&&e.hasOwnProperty("status")&&!l.isInteger(e.status)?"status: integer expected":null!=e.description&&e.hasOwnProperty("description")&&!l.isString(e.description)?"description: string expected":null},e.fromObject=function(e){if(e instanceof c.SdkErrorFrame)return e;var t=new c.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 n={};return t.defaults&&(n.status=0,n.description=""),null!=e.status&&e.hasOwnProperty("status")&&(n.status=e.status),null!=e.description&&e.hasOwnProperty("description")&&(n.description=e.description),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkJoinFlags=(i={},(r=Object.create(i))[i[2]="HAS_STREAM_UPDATE"]=2,r[i[16]="COMPLETE_VIDEO_SOURCES_LIST"]=16,r[i[32]="EXCLUDE_SELF_CONTENT_IN_INDEX"]=32,r),c.SdkClientDetails=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.appName="",e.prototype.appVersion="",e.prototype.deviceModel="",e.prototype.deviceMake="",e.prototype.platformName="",e.prototype.platformVersion="",e.prototype.clientSource="",e.prototype.chimeSdkVersion="",e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.appName&&Object.hasOwnProperty.call(e,"appName")&&t.uint32(10).string(e.appName),null!=e.appVersion&&Object.hasOwnProperty.call(e,"appVersion")&&t.uint32(18).string(e.appVersion),null!=e.deviceModel&&Object.hasOwnProperty.call(e,"deviceModel")&&t.uint32(26).string(e.deviceModel),null!=e.deviceMake&&Object.hasOwnProperty.call(e,"deviceMake")&&t.uint32(34).string(e.deviceMake),null!=e.platformName&&Object.hasOwnProperty.call(e,"platformName")&&t.uint32(42).string(e.platformName),null!=e.platformVersion&&Object.hasOwnProperty.call(e,"platformVersion")&&t.uint32(50).string(e.platformVersion),null!=e.clientSource&&Object.hasOwnProperty.call(e,"clientSource")&&t.uint32(58).string(e.clientSource),null!=e.chimeSdkVersion&&Object.hasOwnProperty.call(e,"chimeSdkVersion")&&t.uint32(66).string(e.chimeSdkVersion),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkClientDetails;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.appName=e.string();break;case 2:i.appVersion=e.string();break;case 3:i.deviceModel=e.string();break;case 4:i.deviceMake=e.string();break;case 5:i.platformName=e.string();break;case 6:i.platformVersion=e.string();break;case 7:i.clientSource=e.string();break;case 8:i.chimeSdkVersion=e.string();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.appName&&e.hasOwnProperty("appName")&&!l.isString(e.appName)?"appName: string expected":null!=e.appVersion&&e.hasOwnProperty("appVersion")&&!l.isString(e.appVersion)?"appVersion: string expected":null!=e.deviceModel&&e.hasOwnProperty("deviceModel")&&!l.isString(e.deviceModel)?"deviceModel: string expected":null!=e.deviceMake&&e.hasOwnProperty("deviceMake")&&!l.isString(e.deviceMake)?"deviceMake: string expected":null!=e.platformName&&e.hasOwnProperty("platformName")&&!l.isString(e.platformName)?"platformName: string expected":null!=e.platformVersion&&e.hasOwnProperty("platformVersion")&&!l.isString(e.platformVersion)?"platformVersion: string expected":null!=e.clientSource&&e.hasOwnProperty("clientSource")&&!l.isString(e.clientSource)?"clientSource: string expected":null!=e.chimeSdkVersion&&e.hasOwnProperty("chimeSdkVersion")&&!l.isString(e.chimeSdkVersion)?"chimeSdkVersion: string expected":null},e.fromObject=function(e){if(e instanceof c.SdkClientDetails)return e;var t=new c.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 n={};return t.defaults&&(n.appName="",n.appVersion="",n.deviceModel="",n.deviceMake="",n.platformName="",n.platformVersion="",n.clientSource="",n.chimeSdkVersion=""),null!=e.appName&&e.hasOwnProperty("appName")&&(n.appName=e.appName),null!=e.appVersion&&e.hasOwnProperty("appVersion")&&(n.appVersion=e.appVersion),null!=e.deviceModel&&e.hasOwnProperty("deviceModel")&&(n.deviceModel=e.deviceModel),null!=e.deviceMake&&e.hasOwnProperty("deviceMake")&&(n.deviceMake=e.deviceMake),null!=e.platformName&&e.hasOwnProperty("platformName")&&(n.platformName=e.platformName),null!=e.platformVersion&&e.hasOwnProperty("platformVersion")&&(n.platformVersion=e.platformVersion),null!=e.clientSource&&e.hasOwnProperty("clientSource")&&(n.clientSource=e.clientSource),null!=e.chimeSdkVersion&&e.hasOwnProperty("chimeSdkVersion")&&(n.chimeSdkVersion=e.chimeSdkVersion),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.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}(),c.SdkJoinFrame=function(){function e(e){if(this.supportedServerSideNetworkAdaptions=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.protocolVersion=2,e.prototype.maxNumOfVideos=0,e.prototype.flags=0,e.prototype.clientDetails=null,e.prototype.audioSessionId=l.Long?l.Long.fromBits(0,0,!0):0,e.prototype.wantsCompressedSdp=!1,e.prototype.wantsServerSideNetworkProbingOnReceiveSideEstimator=!1,e.prototype.serverSideNetworkAdaption=1,e.prototype.supportedServerSideNetworkAdaptions=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.protocolVersion&&Object.hasOwnProperty.call(e,"protocolVersion")&&t.uint32(8).uint32(e.protocolVersion),null!=e.maxNumOfVideos&&Object.hasOwnProperty.call(e,"maxNumOfVideos")&&t.uint32(16).uint32(e.maxNumOfVideos),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(24).uint32(e.flags),null!=e.clientDetails&&Object.hasOwnProperty.call(e,"clientDetails")&&c.SdkClientDetails.encode(e.clientDetails,t.uint32(34).fork()).ldelim(),null!=e.audioSessionId&&Object.hasOwnProperty.call(e,"audioSessionId")&&t.uint32(48).uint64(e.audioSessionId),null!=e.wantsCompressedSdp&&Object.hasOwnProperty.call(e,"wantsCompressedSdp")&&t.uint32(56).bool(e.wantsCompressedSdp),null!=e.wantsServerSideNetworkProbingOnReceiveSideEstimator&&Object.hasOwnProperty.call(e,"wantsServerSideNetworkProbingOnReceiveSideEstimator")&&t.uint32(64).bool(e.wantsServerSideNetworkProbingOnReceiveSideEstimator),null!=e.serverSideNetworkAdaption&&Object.hasOwnProperty.call(e,"serverSideNetworkAdaption")&&t.uint32(80).int32(e.serverSideNetworkAdaption),null!=e.supportedServerSideNetworkAdaptions&&e.supportedServerSideNetworkAdaptions.length)for(var n=0;n<e.supportedServerSideNetworkAdaptions.length;++n)t.uint32(88).int32(e.supportedServerSideNetworkAdaptions[n]);return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkJoinFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.protocolVersion=e.uint32();break;case 2:i.maxNumOfVideos=e.uint32();break;case 3:i.flags=e.uint32();break;case 4:i.clientDetails=c.SdkClientDetails.decode(e,e.uint32());break;case 6:i.audioSessionId=e.uint64();break;case 7:i.wantsCompressedSdp=e.bool();break;case 8:i.wantsServerSideNetworkProbingOnReceiveSideEstimator=e.bool();break;case 10:i.serverSideNetworkAdaption=e.int32();break;case 11:if(i.supportedServerSideNetworkAdaptions&&i.supportedServerSideNetworkAdaptions.length||(i.supportedServerSideNetworkAdaptions=[]),2==(7&r))for(var o=e.uint32()+e.pos;e.pos<o;)i.supportedServerSideNetworkAdaptions.push(e.int32());else i.supportedServerSideNetworkAdaptions.push(e.int32());break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.protocolVersion&&e.hasOwnProperty("protocolVersion")&&!l.isInteger(e.protocolVersion))return"protocolVersion: integer expected";if(null!=e.maxNumOfVideos&&e.hasOwnProperty("maxNumOfVideos")&&!l.isInteger(e.maxNumOfVideos))return"maxNumOfVideos: integer expected";if(null!=e.flags&&e.hasOwnProperty("flags")&&!l.isInteger(e.flags))return"flags: integer expected";if(null!=e.clientDetails&&e.hasOwnProperty("clientDetails")){var t=c.SdkClientDetails.verify(e.clientDetails);if(t)return"clientDetails."+t}if(null!=e.audioSessionId&&e.hasOwnProperty("audioSessionId")&&!(l.isInteger(e.audioSessionId)||e.audioSessionId&&l.isInteger(e.audioSessionId.low)&&l.isInteger(e.audioSessionId.high)))return"audioSessionId: integer|Long expected";if(null!=e.wantsCompressedSdp&&e.hasOwnProperty("wantsCompressedSdp")&&"boolean"!=typeof e.wantsCompressedSdp)return"wantsCompressedSdp: boolean expected";if(null!=e.wantsServerSideNetworkProbingOnReceiveSideEstimator&&e.hasOwnProperty("wantsServerSideNetworkProbingOnReceiveSideEstimator")&&"boolean"!=typeof e.wantsServerSideNetworkProbingOnReceiveSideEstimator)return"wantsServerSideNetworkProbingOnReceiveSideEstimator: boolean expected";if(null!=e.serverSideNetworkAdaption&&e.hasOwnProperty("serverSideNetworkAdaption"))switch(e.serverSideNetworkAdaption){default:return"serverSideNetworkAdaption: enum value expected";case 1:case 2:case 3:}if(null!=e.supportedServerSideNetworkAdaptions&&e.hasOwnProperty("supportedServerSideNetworkAdaptions")){if(!Array.isArray(e.supportedServerSideNetworkAdaptions))return"supportedServerSideNetworkAdaptions: array expected";for(var n=0;n<e.supportedServerSideNetworkAdaptions.length;++n)switch(e.supportedServerSideNetworkAdaptions[n]){default:return"supportedServerSideNetworkAdaptions: enum value[] expected";case 1:case 2:case 3:}}return null},e.fromObject=function(e){if(e instanceof c.SdkJoinFrame)return e;var t=new c.SdkJoinFrame;if(null!=e.protocolVersion&&(t.protocolVersion=e.protocolVersion>>>0),null!=e.maxNumOfVideos&&(t.maxNumOfVideos=e.maxNumOfVideos>>>0),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.clientDetails){if("object"!=typeof e.clientDetails)throw TypeError(".SdkJoinFrame.clientDetails: object expected");t.clientDetails=c.SdkClientDetails.fromObject(e.clientDetails)}switch(null!=e.audioSessionId&&(l.Long?(t.audioSessionId=l.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 l.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 n=0;n<e.supportedServerSideNetworkAdaptions.length;++n)switch(e.supportedServerSideNetworkAdaptions[n]){default:case"DEFAULT":case 1:t.supportedServerSideNetworkAdaptions[n]=1;break;case"NONE":case 2:t.supportedServerSideNetworkAdaptions[n]=2;break;case"BANDWIDTH_PROBING":case 3:t.supportedServerSideNetworkAdaptions[n]=3}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.supportedServerSideNetworkAdaptions=[]),t.defaults){if(n.protocolVersion=2,n.maxNumOfVideos=0,n.flags=0,n.clientDetails=null,l.Long){var i=new l.Long(0,0,!0);n.audioSessionId=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else n.audioSessionId=t.longs===String?"0":0;n.wantsCompressedSdp=!1,n.wantsServerSideNetworkProbingOnReceiveSideEstimator=!1,n.serverSideNetworkAdaption=t.enums===String?"DEFAULT":1}if(null!=e.protocolVersion&&e.hasOwnProperty("protocolVersion")&&(n.protocolVersion=e.protocolVersion),null!=e.maxNumOfVideos&&e.hasOwnProperty("maxNumOfVideos")&&(n.maxNumOfVideos=e.maxNumOfVideos),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),null!=e.clientDetails&&e.hasOwnProperty("clientDetails")&&(n.clientDetails=c.SdkClientDetails.toObject(e.clientDetails,t)),null!=e.audioSessionId&&e.hasOwnProperty("audioSessionId")&&("number"==typeof e.audioSessionId?n.audioSessionId=t.longs===String?String(e.audioSessionId):e.audioSessionId:n.audioSessionId=t.longs===String?l.Long.prototype.toString.call(e.audioSessionId):t.longs===Number?new l.LongBits(e.audioSessionId.low>>>0,e.audioSessionId.high>>>0).toNumber(!0):e.audioSessionId),null!=e.wantsCompressedSdp&&e.hasOwnProperty("wantsCompressedSdp")&&(n.wantsCompressedSdp=e.wantsCompressedSdp),null!=e.wantsServerSideNetworkProbingOnReceiveSideEstimator&&e.hasOwnProperty("wantsServerSideNetworkProbingOnReceiveSideEstimator")&&(n.wantsServerSideNetworkProbingOnReceiveSideEstimator=e.wantsServerSideNetworkProbingOnReceiveSideEstimator),null!=e.serverSideNetworkAdaption&&e.hasOwnProperty("serverSideNetworkAdaption")&&(n.serverSideNetworkAdaption=t.enums===String?c.SdkServerSideNetworkAdaption[e.serverSideNetworkAdaption]:e.serverSideNetworkAdaption),e.supportedServerSideNetworkAdaptions&&e.supportedServerSideNetworkAdaptions.length){n.supportedServerSideNetworkAdaptions=[];for(var r=0;r<e.supportedServerSideNetworkAdaptions.length;++r)n.supportedServerSideNetworkAdaptions[r]=t.enums===String?c.SdkServerSideNetworkAdaption[e.supportedServerSideNetworkAdaptions[r]]:e.supportedServerSideNetworkAdaptions[r]}return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkJoinAckFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.turnCredentials=null,e.prototype.videoSubscriptionLimit=0,e.prototype.wantsCompressedSdp=!1,e.prototype.defaultServerSideNetworkAdaption=1,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.turnCredentials&&Object.hasOwnProperty.call(e,"turnCredentials")&&c.SdkTurnCredentials.encode(e.turnCredentials,t.uint32(10).fork()).ldelim(),null!=e.videoSubscriptionLimit&&Object.hasOwnProperty.call(e,"videoSubscriptionLimit")&&t.uint32(16).uint32(e.videoSubscriptionLimit),null!=e.wantsCompressedSdp&&Object.hasOwnProperty.call(e,"wantsCompressedSdp")&&t.uint32(24).bool(e.wantsCompressedSdp),null!=e.defaultServerSideNetworkAdaption&&Object.hasOwnProperty.call(e,"defaultServerSideNetworkAdaption")&&t.uint32(32).int32(e.defaultServerSideNetworkAdaption),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkJoinAckFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.turnCredentials=c.SdkTurnCredentials.decode(e,e.uint32());break;case 2:i.videoSubscriptionLimit=e.uint32();break;case 3:i.wantsCompressedSdp=e.bool();break;case 4:i.defaultServerSideNetworkAdaption=e.int32();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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=c.SdkTurnCredentials.verify(e.turnCredentials);if(t)return"turnCredentials."+t}if(null!=e.videoSubscriptionLimit&&e.hasOwnProperty("videoSubscriptionLimit")&&!l.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 c.SdkJoinAckFrame)return e;var t=new c.SdkJoinAckFrame;if(null!=e.turnCredentials){if("object"!=typeof e.turnCredentials)throw TypeError(".SdkJoinAckFrame.turnCredentials: object expected");t.turnCredentials=c.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 n={};return t.defaults&&(n.turnCredentials=null,n.videoSubscriptionLimit=0,n.wantsCompressedSdp=!1,n.defaultServerSideNetworkAdaption=t.enums===String?"DEFAULT":1),null!=e.turnCredentials&&e.hasOwnProperty("turnCredentials")&&(n.turnCredentials=c.SdkTurnCredentials.toObject(e.turnCredentials,t)),null!=e.videoSubscriptionLimit&&e.hasOwnProperty("videoSubscriptionLimit")&&(n.videoSubscriptionLimit=e.videoSubscriptionLimit),null!=e.wantsCompressedSdp&&e.hasOwnProperty("wantsCompressedSdp")&&(n.wantsCompressedSdp=e.wantsCompressedSdp),null!=e.defaultServerSideNetworkAdaption&&e.hasOwnProperty("defaultServerSideNetworkAdaption")&&(n.defaultServerSideNetworkAdaption=t.enums===String?c.SdkServerSideNetworkAdaption[e.defaultServerSideNetworkAdaption]:e.defaultServerSideNetworkAdaption),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkLeaveFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkLeaveFrame;e.pos<n;){var r=e.uint32();e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null},e.fromObject=function(e){return e instanceof c.SdkLeaveFrame?e:new c.SdkLeaveFrame},e.toObject=function(){return{}},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkLeaveAckFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkLeaveAckFrame;e.pos<n;){var r=e.uint32();e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null},e.fromObject=function(e){return e instanceof c.SdkLeaveAckFrame?e:new c.SdkLeaveAckFrame},e.toObject=function(){return{}},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkStreamServiceType=function(){var e={},t=Object.create(e);return t[e[1]="RX"]=1,t[e[2]="TX"]=2,t[e[3]="DUPLEX"]=3,t}(),c.SdkStreamMediaType=function(){var e={},t=Object.create(e);return t[e[1]="AUDIO"]=1,t[e[2]="VIDEO"]=2,t}(),c.SdkSubscribeFrame=function(){function e(e){if(this.sendStreams=[],this.receiveStreamIds=[],this.videoSubscriptionConfiguration=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.duplex=1,e.prototype.sendStreams=l.emptyArray,e.prototype.receiveStreamIds=l.emptyArray,e.prototype.sdpOffer="",e.prototype.audioHost="",e.prototype.audioCheckin=!1,e.prototype.audioMuted=!1,e.prototype.compressedSdpOffer=l.newBuffer([]),e.prototype.videoSubscriptionConfiguration=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.duplex&&Object.hasOwnProperty.call(e,"duplex")&&t.uint32(8).int32(e.duplex),null!=e.sendStreams&&e.sendStreams.length)for(var n=0;n<e.sendStreams.length;++n)c.SdkStreamDescriptor.encode(e.sendStreams[n],t.uint32(18).fork()).ldelim();if(null!=e.receiveStreamIds&&e.receiveStreamIds.length)for(n=0;n<e.receiveStreamIds.length;++n)t.uint32(24).uint32(e.receiveStreamIds[n]);if(null!=e.sdpOffer&&Object.hasOwnProperty.call(e,"sdpOffer")&&t.uint32(34).string(e.sdpOffer),null!=e.audioHost&&Object.hasOwnProperty.call(e,"audioHost")&&t.uint32(42).string(e.audioHost),null!=e.audioCheckin&&Object.hasOwnProperty.call(e,"audioCheckin")&&t.uint32(48).bool(e.audioCheckin),null!=e.audioMuted&&Object.hasOwnProperty.call(e,"audioMuted")&&t.uint32(56).bool(e.audioMuted),null!=e.compressedSdpOffer&&Object.hasOwnProperty.call(e,"compressedSdpOffer")&&t.uint32(66).bytes(e.compressedSdpOffer),null!=e.videoSubscriptionConfiguration&&e.videoSubscriptionConfiguration.length)for(n=0;n<e.videoSubscriptionConfiguration.length;++n)c.SdkVideoSubscriptionConfiguration.encode(e.videoSubscriptionConfiguration[n],t.uint32(74).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkSubscribeFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.duplex=e.int32();break;case 2:i.sendStreams&&i.sendStreams.length||(i.sendStreams=[]),i.sendStreams.push(c.SdkStreamDescriptor.decode(e,e.uint32()));break;case 3:if(i.receiveStreamIds&&i.receiveStreamIds.length||(i.receiveStreamIds=[]),2==(7&r))for(var o=e.uint32()+e.pos;e.pos<o;)i.receiveStreamIds.push(e.uint32());else i.receiveStreamIds.push(e.uint32());break;case 4:i.sdpOffer=e.string();break;case 5:i.audioHost=e.string();break;case 6:i.audioCheckin=e.bool();break;case 7:i.audioMuted=e.bool();break;case 8:i.compressedSdpOffer=e.bytes();break;case 9:i.videoSubscriptionConfiguration&&i.videoSubscriptionConfiguration.length||(i.videoSubscriptionConfiguration=[]),i.videoSubscriptionConfiguration.push(c.SdkVideoSubscriptionConfiguration.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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.sendStreams&&e.hasOwnProperty("sendStreams")){if(!Array.isArray(e.sendStreams))return"sendStreams: array expected";for(var t=0;t<e.sendStreams.length;++t)if(n=c.SdkStreamDescriptor.verify(e.sendStreams[t]))return"sendStreams."+n}if(null!=e.receiveStreamIds&&e.hasOwnProperty("receiveStreamIds")){if(!Array.isArray(e.receiveStreamIds))return"receiveStreamIds: array expected";for(t=0;t<e.receiveStreamIds.length;++t)if(!l.isInteger(e.receiveStreamIds[t]))return"receiveStreamIds: integer[] expected"}if(null!=e.sdpOffer&&e.hasOwnProperty("sdpOffer")&&!l.isString(e.sdpOffer))return"sdpOffer: string expected";if(null!=e.audioHost&&e.hasOwnProperty("audioHost")&&!l.isString(e.audioHost))return"audioHost: string expected";if(null!=e.audioCheckin&&e.hasOwnProperty("audioCheckin")&&"boolean"!=typeof e.audioCheckin)return"audioCheckin: boolean expected";if(null!=e.audioMuted&&e.hasOwnProperty("audioMuted")&&"boolean"!=typeof e.audioMuted)return"audioMuted: boolean expected";if(null!=e.compressedSdpOffer&&e.hasOwnProperty("compressedSdpOffer")&&!(e.compressedSdpOffer&&"number"==typeof e.compressedSdpOffer.length||l.isString(e.compressedSdpOffer)))return"compressedSdpOffer: buffer expected";if(null!=e.videoSubscriptionConfiguration&&e.hasOwnProperty("videoSubscriptionConfiguration")){if(!Array.isArray(e.videoSubscriptionConfiguration))return"videoSubscriptionConfiguration: array expected";for(t=0;t<e.videoSubscriptionConfiguration.length;++t){var n;if(n=c.SdkVideoSubscriptionConfiguration.verify(e.videoSubscriptionConfiguration[t]))return"videoSubscriptionConfiguration."+n}}return null},e.fromObject=function(e){if(e instanceof c.SdkSubscribeFrame)return e;var t=new c.SdkSubscribeFrame;switch(e.duplex){case"RX":case 1:t.duplex=1;break;case"TX":case 2:t.duplex=2;break;case"DUPLEX":case 3:t.duplex=3}if(e.sendStreams){if(!Array.isArray(e.sendStreams))throw TypeError(".SdkSubscribeFrame.sendStreams: array expected");t.sendStreams=[];for(var n=0;n<e.sendStreams.length;++n){if("object"!=typeof e.sendStreams[n])throw TypeError(".SdkSubscribeFrame.sendStreams: object expected");t.sendStreams[n]=c.SdkStreamDescriptor.fromObject(e.sendStreams[n])}}if(e.receiveStreamIds){if(!Array.isArray(e.receiveStreamIds))throw TypeError(".SdkSubscribeFrame.receiveStreamIds: array expected");for(t.receiveStreamIds=[],n=0;n<e.receiveStreamIds.length;++n)t.receiveStreamIds[n]=e.receiveStreamIds[n]>>>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?l.base64.decode(e.compressedSdpOffer,t.compressedSdpOffer=l.newBuffer(l.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=[],n=0;n<e.videoSubscriptionConfiguration.length;++n){if("object"!=typeof e.videoSubscriptionConfiguration[n])throw TypeError(".SdkSubscribeFrame.videoSubscriptionConfiguration: object expected");t.videoSubscriptionConfiguration[n]=c.SdkVideoSubscriptionConfiguration.fromObject(e.videoSubscriptionConfiguration[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.sendStreams=[],n.receiveStreamIds=[],n.videoSubscriptionConfiguration=[]),t.defaults&&(n.duplex=t.enums===String?"RX":1,n.sdpOffer="",n.audioHost="",n.audioCheckin=!1,n.audioMuted=!1,t.bytes===String?n.compressedSdpOffer="":(n.compressedSdpOffer=[],t.bytes!==Array&&(n.compressedSdpOffer=l.newBuffer(n.compressedSdpOffer)))),null!=e.duplex&&e.hasOwnProperty("duplex")&&(n.duplex=t.enums===String?c.SdkStreamServiceType[e.duplex]:e.duplex),e.sendStreams&&e.sendStreams.length){n.sendStreams=[];for(var i=0;i<e.sendStreams.length;++i)n.sendStreams[i]=c.SdkStreamDescriptor.toObject(e.sendStreams[i],t)}if(e.receiveStreamIds&&e.receiveStreamIds.length)for(n.receiveStreamIds=[],i=0;i<e.receiveStreamIds.length;++i)n.receiveStreamIds[i]=e.receiveStreamIds[i];if(null!=e.sdpOffer&&e.hasOwnProperty("sdpOffer")&&(n.sdpOffer=e.sdpOffer),null!=e.audioHost&&e.hasOwnProperty("audioHost")&&(n.audioHost=e.audioHost),null!=e.audioCheckin&&e.hasOwnProperty("audioCheckin")&&(n.audioCheckin=e.audioCheckin),null!=e.audioMuted&&e.hasOwnProperty("audioMuted")&&(n.audioMuted=e.audioMuted),null!=e.compressedSdpOffer&&e.hasOwnProperty("compressedSdpOffer")&&(n.compressedSdpOffer=t.bytes===String?l.base64.encode(e.compressedSdpOffer,0,e.compressedSdpOffer.length):t.bytes===Array?Array.prototype.slice.call(e.compressedSdpOffer):e.compressedSdpOffer),e.videoSubscriptionConfiguration&&e.videoSubscriptionConfiguration.length)for(n.videoSubscriptionConfiguration=[],i=0;i<e.videoSubscriptionConfiguration.length;++i)n.videoSubscriptionConfiguration[i]=c.SdkVideoSubscriptionConfiguration.toObject(e.videoSubscriptionConfiguration[i],t);return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkSubscribeAckFrame=function(){function e(e){if(this.allocations=[],this.tracks=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.duplex=1,e.prototype.allocations=l.emptyArray,e.prototype.sdpAnswer="",e.prototype.tracks=l.emptyArray,e.prototype.compressedSdpAnswer=l.newBuffer([]),e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.duplex&&Object.hasOwnProperty.call(e,"duplex")&&t.uint32(8).int32(e.duplex),null!=e.allocations&&e.allocations.length)for(var n=0;n<e.allocations.length;++n)c.SdkStreamAllocation.encode(e.allocations[n],t.uint32(18).fork()).ldelim();if(null!=e.sdpAnswer&&Object.hasOwnProperty.call(e,"sdpAnswer")&&t.uint32(26).string(e.sdpAnswer),null!=e.tracks&&e.tracks.length)for(n=0;n<e.tracks.length;++n)c.SdkTrackMapping.encode(e.tracks[n],t.uint32(34).fork()).ldelim();return null!=e.compressedSdpAnswer&&Object.hasOwnProperty.call(e,"compressedSdpAnswer")&&t.uint32(42).bytes(e.compressedSdpAnswer),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkSubscribeAckFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.duplex=e.int32();break;case 2:i.allocations&&i.allocations.length||(i.allocations=[]),i.allocations.push(c.SdkStreamAllocation.decode(e,e.uint32()));break;case 3:i.sdpAnswer=e.string();break;case 4:i.tracks&&i.tracks.length||(i.tracks=[]),i.tracks.push(c.SdkTrackMapping.decode(e,e.uint32()));break;case 5:i.compressedSdpAnswer=e.bytes();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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<e.allocations.length;++t)if(n=c.SdkStreamAllocation.verify(e.allocations[t]))return"allocations."+n}if(null!=e.sdpAnswer&&e.hasOwnProperty("sdpAnswer")&&!l.isString(e.sdpAnswer))return"sdpAnswer: string expected";if(null!=e.tracks&&e.hasOwnProperty("tracks")){if(!Array.isArray(e.tracks))return"tracks: array expected";for(t=0;t<e.tracks.length;++t){var n;if(n=c.SdkTrackMapping.verify(e.tracks[t]))return"tracks."+n}}return null!=e.compressedSdpAnswer&&e.hasOwnProperty("compressedSdpAnswer")&&!(e.compressedSdpAnswer&&"number"==typeof e.compressedSdpAnswer.length||l.isString(e.compressedSdpAnswer))?"compressedSdpAnswer: buffer expected":null},e.fromObject=function(e){if(e instanceof c.SdkSubscribeAckFrame)return e;var t=new c.SdkSubscribeAckFrame;switch(e.duplex){case"RX":case 1:t.duplex=1;break;case"TX":case 2:t.duplex=2;break;case"DUPLEX":case 3:t.duplex=3}if(e.allocations){if(!Array.isArray(e.allocations))throw TypeError(".SdkSubscribeAckFrame.allocations: array expected");t.allocations=[];for(var n=0;n<e.allocations.length;++n){if("object"!=typeof e.allocations[n])throw TypeError(".SdkSubscribeAckFrame.allocations: object expected");t.allocations[n]=c.SdkStreamAllocation.fromObject(e.allocations[n])}}if(null!=e.sdpAnswer&&(t.sdpAnswer=String(e.sdpAnswer)),e.tracks){if(!Array.isArray(e.tracks))throw TypeError(".SdkSubscribeAckFrame.tracks: array expected");for(t.tracks=[],n=0;n<e.tracks.length;++n){if("object"!=typeof e.tracks[n])throw TypeError(".SdkSubscribeAckFrame.tracks: object expected");t.tracks[n]=c.SdkTrackMapping.fromObject(e.tracks[n])}}return null!=e.compressedSdpAnswer&&("string"==typeof e.compressedSdpAnswer?l.base64.decode(e.compressedSdpAnswer,t.compressedSdpAnswer=l.newBuffer(l.base64.length(e.compressedSdpAnswer)),0):e.compressedSdpAnswer.length&&(t.compressedSdpAnswer=e.compressedSdpAnswer)),t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.allocations=[],n.tracks=[]),t.defaults&&(n.duplex=t.enums===String?"RX":1,n.sdpAnswer="",t.bytes===String?n.compressedSdpAnswer="":(n.compressedSdpAnswer=[],t.bytes!==Array&&(n.compressedSdpAnswer=l.newBuffer(n.compressedSdpAnswer)))),null!=e.duplex&&e.hasOwnProperty("duplex")&&(n.duplex=t.enums===String?c.SdkStreamServiceType[e.duplex]:e.duplex),e.allocations&&e.allocations.length){n.allocations=[];for(var i=0;i<e.allocations.length;++i)n.allocations[i]=c.SdkStreamAllocation.toObject(e.allocations[i],t)}if(null!=e.sdpAnswer&&e.hasOwnProperty("sdpAnswer")&&(n.sdpAnswer=e.sdpAnswer),e.tracks&&e.tracks.length)for(n.tracks=[],i=0;i<e.tracks.length;++i)n.tracks[i]=c.SdkTrackMapping.toObject(e.tracks[i],t);return null!=e.compressedSdpAnswer&&e.hasOwnProperty("compressedSdpAnswer")&&(n.compressedSdpAnswer=t.bytes===String?l.base64.encode(e.compressedSdpAnswer,0,e.compressedSdpAnswer.length):t.bytes===Array?Array.prototype.slice.call(e.compressedSdpAnswer):e.compressedSdpAnswer),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkIndexFrame=function(){function e(e){if(this.sources=[],this.pausedAtSourceIds=[],this.supportedReceiveCodecIntersection=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.atCapacity=!1,e.prototype.sources=l.emptyArray,e.prototype.pausedAtSourceIds=l.emptyArray,e.prototype.numParticipants=0,e.prototype.supportedReceiveCodecIntersection=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.atCapacity&&Object.hasOwnProperty.call(e,"atCapacity")&&t.uint32(8).bool(e.atCapacity),null!=e.sources&&e.sources.length)for(var n=0;n<e.sources.length;++n)c.SdkStreamDescriptor.encode(e.sources[n],t.uint32(18).fork()).ldelim();if(null!=e.pausedAtSourceIds&&e.pausedAtSourceIds.length)for(n=0;n<e.pausedAtSourceIds.length;++n)t.uint32(24).uint32(e.pausedAtSourceIds[n]);if(null!=e.numParticipants&&Object.hasOwnProperty.call(e,"numParticipants")&&t.uint32(32).uint32(e.numParticipants),null!=e.supportedReceiveCodecIntersection&&e.supportedReceiveCodecIntersection.length)for(n=0;n<e.supportedReceiveCodecIntersection.length;++n)t.uint32(40).int32(e.supportedReceiveCodecIntersection[n]);return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkIndexFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.atCapacity=e.bool();break;case 2:i.sources&&i.sources.length||(i.sources=[]),i.sources.push(c.SdkStreamDescriptor.decode(e,e.uint32()));break;case 3:if(i.pausedAtSourceIds&&i.pausedAtSourceIds.length||(i.pausedAtSourceIds=[]),2==(7&r))for(var o=e.uint32()+e.pos;e.pos<o;)i.pausedAtSourceIds.push(e.uint32());else i.pausedAtSourceIds.push(e.uint32());break;case 4:i.numParticipants=e.uint32();break;case 5:if(i.supportedReceiveCodecIntersection&&i.supportedReceiveCodecIntersection.length||(i.supportedReceiveCodecIntersection=[]),2==(7&r))for(o=e.uint32()+e.pos;e.pos<o;)i.supportedReceiveCodecIntersection.push(e.int32());else i.supportedReceiveCodecIntersection.push(e.int32());break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.atCapacity&&e.hasOwnProperty("atCapacity")&&"boolean"!=typeof e.atCapacity)return"atCapacity: boolean expected";if(null!=e.sources&&e.hasOwnProperty("sources")){if(!Array.isArray(e.sources))return"sources: array expected";for(var t=0;t<e.sources.length;++t){var n=c.SdkStreamDescriptor.verify(e.sources[t]);if(n)return"sources."+n}}if(null!=e.pausedAtSourceIds&&e.hasOwnProperty("pausedAtSourceIds")){if(!Array.isArray(e.pausedAtSourceIds))return"pausedAtSourceIds: array expected";for(t=0;t<e.pausedAtSourceIds.length;++t)if(!l.isInteger(e.pausedAtSourceIds[t]))return"pausedAtSourceIds: integer[] expected"}if(null!=e.numParticipants&&e.hasOwnProperty("numParticipants")&&!l.isInteger(e.numParticipants))return"numParticipants: integer expected";if(null!=e.supportedReceiveCodecIntersection&&e.hasOwnProperty("supportedReceiveCodecIntersection")){if(!Array.isArray(e.supportedReceiveCodecIntersection))return"supportedReceiveCodecIntersection: array expected";for(t=0;t<e.supportedReceiveCodecIntersection.length;++t)switch(e.supportedReceiveCodecIntersection[t]){default:return"supportedReceiveCodecIntersection: enum value[] expected";case 1:case 3:}}return null},e.fromObject=function(e){if(e instanceof c.SdkIndexFrame)return e;var t=new c.SdkIndexFrame;if(null!=e.atCapacity&&(t.atCapacity=Boolean(e.atCapacity)),e.sources){if(!Array.isArray(e.sources))throw TypeError(".SdkIndexFrame.sources: array expected");t.sources=[];for(var n=0;n<e.sources.length;++n){if("object"!=typeof e.sources[n])throw TypeError(".SdkIndexFrame.sources: object expected");t.sources[n]=c.SdkStreamDescriptor.fromObject(e.sources[n])}}if(e.pausedAtSourceIds){if(!Array.isArray(e.pausedAtSourceIds))throw TypeError(".SdkIndexFrame.pausedAtSourceIds: array expected");for(t.pausedAtSourceIds=[],n=0;n<e.pausedAtSourceIds.length;++n)t.pausedAtSourceIds[n]=e.pausedAtSourceIds[n]>>>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=[],n=0;n<e.supportedReceiveCodecIntersection.length;++n)switch(e.supportedReceiveCodecIntersection[n]){default:case"VP8":case 1:t.supportedReceiveCodecIntersection[n]=1;break;case"H264_CONSTRAINED_BASELINE_PROFILE":case 3:t.supportedReceiveCodecIntersection[n]=3}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.sources=[],n.pausedAtSourceIds=[],n.supportedReceiveCodecIntersection=[]),t.defaults&&(n.atCapacity=!1,n.numParticipants=0),null!=e.atCapacity&&e.hasOwnProperty("atCapacity")&&(n.atCapacity=e.atCapacity),e.sources&&e.sources.length){n.sources=[];for(var i=0;i<e.sources.length;++i)n.sources[i]=c.SdkStreamDescriptor.toObject(e.sources[i],t)}if(e.pausedAtSourceIds&&e.pausedAtSourceIds.length)for(n.pausedAtSourceIds=[],i=0;i<e.pausedAtSourceIds.length;++i)n.pausedAtSourceIds[i]=e.pausedAtSourceIds[i];if(null!=e.numParticipants&&e.hasOwnProperty("numParticipants")&&(n.numParticipants=e.numParticipants),e.supportedReceiveCodecIntersection&&e.supportedReceiveCodecIntersection.length)for(n.supportedReceiveCodecIntersection=[],i=0;i<e.supportedReceiveCodecIntersection.length;++i)n.supportedReceiveCodecIntersection[i]=t.enums===String?c.SdkVideoCodecCapability[e.supportedReceiveCodecIntersection[i]]:e.supportedReceiveCodecIntersection[i];return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkPauseResumeFrame=function(){function e(e){if(this.streamIds=[],this.groupIds=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.streamIds=l.emptyArray,e.prototype.groupIds=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.streamIds&&e.streamIds.length)for(var n=0;n<e.streamIds.length;++n)t.uint32(8).uint32(e.streamIds[n]);if(null!=e.groupIds&&e.groupIds.length)for(n=0;n<e.groupIds.length;++n)t.uint32(16).uint32(e.groupIds[n]);return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkPauseResumeFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:if(i.streamIds&&i.streamIds.length||(i.streamIds=[]),2==(7&r))for(var o=e.uint32()+e.pos;e.pos<o;)i.streamIds.push(e.uint32());else i.streamIds.push(e.uint32());break;case 2:if(i.groupIds&&i.groupIds.length||(i.groupIds=[]),2==(7&r))for(o=e.uint32()+e.pos;e.pos<o;)i.groupIds.push(e.uint32());else i.groupIds.push(e.uint32());break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.streamIds&&e.hasOwnProperty("streamIds")){if(!Array.isArray(e.streamIds))return"streamIds: array expected";for(var t=0;t<e.streamIds.length;++t)if(!l.isInteger(e.streamIds[t]))return"streamIds: integer[] expected"}if(null!=e.groupIds&&e.hasOwnProperty("groupIds")){if(!Array.isArray(e.groupIds))return"groupIds: array expected";for(t=0;t<e.groupIds.length;++t)if(!l.isInteger(e.groupIds[t]))return"groupIds: integer[] expected"}return null},e.fromObject=function(e){if(e instanceof c.SdkPauseResumeFrame)return e;var t=new c.SdkPauseResumeFrame;if(e.streamIds){if(!Array.isArray(e.streamIds))throw TypeError(".SdkPauseResumeFrame.streamIds: array expected");t.streamIds=[];for(var n=0;n<e.streamIds.length;++n)t.streamIds[n]=e.streamIds[n]>>>0}if(e.groupIds){if(!Array.isArray(e.groupIds))throw TypeError(".SdkPauseResumeFrame.groupIds: array expected");for(t.groupIds=[],n=0;n<e.groupIds.length;++n)t.groupIds[n]=e.groupIds[n]>>>0}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.streamIds=[],n.groupIds=[]),e.streamIds&&e.streamIds.length){n.streamIds=[];for(var i=0;i<e.streamIds.length;++i)n.streamIds[i]=e.streamIds[i]}if(e.groupIds&&e.groupIds.length)for(n.groupIds=[],i=0;i<e.groupIds.length;++i)n.groupIds[i]=e.groupIds[i];return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkBitrateFrame=function(){function e(e){if(this.bitrates=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.bitrates=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.bitrates&&e.bitrates.length)for(var n=0;n<e.bitrates.length;++n)c.SdkBitrate.encode(e.bitrates[n],t.uint32(10).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkBitrateFrame;e.pos<n;){var r=e.uint32();r>>>3==1?(i.bitrates&&i.bitrates.length||(i.bitrates=[]),i.bitrates.push(c.SdkBitrate.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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<e.bitrates.length;++t){var n=c.SdkBitrate.verify(e.bitrates[t]);if(n)return"bitrates."+n}}return null},e.fromObject=function(e){if(e instanceof c.SdkBitrateFrame)return e;var t=new c.SdkBitrateFrame;if(e.bitrates){if(!Array.isArray(e.bitrates))throw TypeError(".SdkBitrateFrame.bitrates: array expected");t.bitrates=[];for(var n=0;n<e.bitrates.length;++n){if("object"!=typeof e.bitrates[n])throw TypeError(".SdkBitrateFrame.bitrates: object expected");t.bitrates[n]=c.SdkBitrate.fromObject(e.bitrates[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.bitrates=[]),e.bitrates&&e.bitrates.length){n.bitrates=[];for(var i=0;i<e.bitrates.length;++i)n.bitrates[i]=c.SdkBitrate.toObject(e.bitrates[i],t)}return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkStreamDescriptor=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.streamId=0,e.prototype.framerate=0,e.prototype.maxBitrateKbps=0,e.prototype.trackLabel="",e.prototype.groupId=0,e.prototype.avgBitrateBps=0,e.prototype.attendeeId="",e.prototype.mediaType=1,e.prototype.externalUserId="",e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.streamId&&Object.hasOwnProperty.call(e,"streamId")&&t.uint32(8).uint32(e.streamId),null!=e.framerate&&Object.hasOwnProperty.call(e,"framerate")&&t.uint32(16).uint32(e.framerate),null!=e.maxBitrateKbps&&Object.hasOwnProperty.call(e,"maxBitrateKbps")&&t.uint32(24).uint32(e.maxBitrateKbps),null!=e.trackLabel&&Object.hasOwnProperty.call(e,"trackLabel")&&t.uint32(34).string(e.trackLabel),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(48).uint32(e.groupId),null!=e.avgBitrateBps&&Object.hasOwnProperty.call(e,"avgBitrateBps")&&t.uint32(56).uint32(e.avgBitrateBps),null!=e.attendeeId&&Object.hasOwnProperty.call(e,"attendeeId")&&t.uint32(66).string(e.attendeeId),null!=e.mediaType&&Object.hasOwnProperty.call(e,"mediaType")&&t.uint32(72).int32(e.mediaType),null!=e.externalUserId&&Object.hasOwnProperty.call(e,"externalUserId")&&t.uint32(82).string(e.externalUserId),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkStreamDescriptor;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.streamId=e.uint32();break;case 2:i.framerate=e.uint32();break;case 3:i.maxBitrateKbps=e.uint32();break;case 4:i.trackLabel=e.string();break;case 6:i.groupId=e.uint32();break;case 7:i.avgBitrateBps=e.uint32();break;case 8:i.attendeeId=e.string();break;case 9:i.mediaType=e.int32();break;case 10:i.externalUserId=e.string();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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")&&!l.isInteger(e.streamId))return"streamId: integer expected";if(null!=e.framerate&&e.hasOwnProperty("framerate")&&!l.isInteger(e.framerate))return"framerate: integer expected";if(null!=e.maxBitrateKbps&&e.hasOwnProperty("maxBitrateKbps")&&!l.isInteger(e.maxBitrateKbps))return"maxBitrateKbps: integer expected";if(null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!l.isString(e.trackLabel))return"trackLabel: string expected";if(null!=e.groupId&&e.hasOwnProperty("groupId")&&!l.isInteger(e.groupId))return"groupId: integer expected";if(null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&!l.isInteger(e.avgBitrateBps))return"avgBitrateBps: integer expected";if(null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!l.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")&&!l.isString(e.externalUserId)?"externalUserId: string expected":null},e.fromObject=function(e){if(e instanceof c.SdkStreamDescriptor)return e;var t=new c.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 n={};return t.defaults&&(n.streamId=0,n.framerate=0,n.maxBitrateKbps=0,n.trackLabel="",n.groupId=0,n.avgBitrateBps=0,n.attendeeId="",n.mediaType=t.enums===String?"AUDIO":1,n.externalUserId=""),null!=e.streamId&&e.hasOwnProperty("streamId")&&(n.streamId=e.streamId),null!=e.framerate&&e.hasOwnProperty("framerate")&&(n.framerate=e.framerate),null!=e.maxBitrateKbps&&e.hasOwnProperty("maxBitrateKbps")&&(n.maxBitrateKbps=e.maxBitrateKbps),null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&(n.trackLabel=e.trackLabel),null!=e.groupId&&e.hasOwnProperty("groupId")&&(n.groupId=e.groupId),null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&(n.avgBitrateBps=e.avgBitrateBps),null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&(n.attendeeId=e.attendeeId),null!=e.mediaType&&e.hasOwnProperty("mediaType")&&(n.mediaType=t.enums===String?c.SdkStreamMediaType[e.mediaType]:e.mediaType),null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&(n.externalUserId=e.externalUserId),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkStreamAllocation=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.trackLabel="",e.prototype.streamId=0,e.prototype.groupId=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.trackLabel&&Object.hasOwnProperty.call(e,"trackLabel")&&t.uint32(10).string(e.trackLabel),null!=e.streamId&&Object.hasOwnProperty.call(e,"streamId")&&t.uint32(16).uint32(e.streamId),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(24).uint32(e.groupId),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkStreamAllocation;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.trackLabel=e.string();break;case 2:i.streamId=e.uint32();break;case 3:i.groupId=e.uint32();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!l.isString(e.trackLabel)?"trackLabel: string expected":null!=e.streamId&&e.hasOwnProperty("streamId")&&!l.isInteger(e.streamId)?"streamId: integer expected":null!=e.groupId&&e.hasOwnProperty("groupId")&&!l.isInteger(e.groupId)?"groupId: integer expected":null},e.fromObject=function(e){if(e instanceof c.SdkStreamAllocation)return e;var t=new c.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 n={};return t.defaults&&(n.trackLabel="",n.streamId=0,n.groupId=0),null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&(n.trackLabel=e.trackLabel),null!=e.streamId&&e.hasOwnProperty("streamId")&&(n.streamId=e.streamId),null!=e.groupId&&e.hasOwnProperty("groupId")&&(n.groupId=e.groupId),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkTrackMapping=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.streamId=0,e.prototype.ssrc=0,e.prototype.trackLabel="",e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.streamId&&Object.hasOwnProperty.call(e,"streamId")&&t.uint32(8).uint32(e.streamId),null!=e.ssrc&&Object.hasOwnProperty.call(e,"ssrc")&&t.uint32(16).uint32(e.ssrc),null!=e.trackLabel&&Object.hasOwnProperty.call(e,"trackLabel")&&t.uint32(26).string(e.trackLabel),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkTrackMapping;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.streamId=e.uint32();break;case 2:i.ssrc=e.uint32();break;case 3:i.trackLabel=e.string();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.streamId&&e.hasOwnProperty("streamId")&&!l.isInteger(e.streamId)?"streamId: integer expected":null!=e.ssrc&&e.hasOwnProperty("ssrc")&&!l.isInteger(e.ssrc)?"ssrc: integer expected":null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!l.isString(e.trackLabel)?"trackLabel: string expected":null},e.fromObject=function(e){if(e instanceof c.SdkTrackMapping)return e;var t=new c.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 n={};return t.defaults&&(n.streamId=0,n.ssrc=0,n.trackLabel=""),null!=e.streamId&&e.hasOwnProperty("streamId")&&(n.streamId=e.streamId),null!=e.ssrc&&e.hasOwnProperty("ssrc")&&(n.ssrc=e.ssrc),null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&(n.trackLabel=e.trackLabel),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkBitrate=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.sourceStreamId=0,e.prototype.avgBitrateBps=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.sourceStreamId&&Object.hasOwnProperty.call(e,"sourceStreamId")&&t.uint32(8).uint32(e.sourceStreamId),null!=e.avgBitrateBps&&Object.hasOwnProperty.call(e,"avgBitrateBps")&&t.uint32(16).uint32(e.avgBitrateBps),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkBitrate;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.sourceStreamId=e.uint32();break;case 2:i.avgBitrateBps=e.uint32();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.sourceStreamId&&e.hasOwnProperty("sourceStreamId")&&!l.isInteger(e.sourceStreamId)?"sourceStreamId: integer expected":null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&!l.isInteger(e.avgBitrateBps)?"avgBitrateBps: integer expected":null},e.fromObject=function(e){if(e instanceof c.SdkBitrate)return e;var t=new c.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 n={};return t.defaults&&(n.sourceStreamId=0,n.avgBitrateBps=0),null!=e.sourceStreamId&&e.hasOwnProperty("sourceStreamId")&&(n.sourceStreamId=e.sourceStreamId),null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&(n.avgBitrateBps=e.avgBitrateBps),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkAudioControlFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.muted=!1,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.muted&&Object.hasOwnProperty.call(e,"muted")&&t.uint32(8).bool(e.muted),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkAudioControlFrame;e.pos<n;){var r=e.uint32();r>>>3==1?i.muted=e.bool():e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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 c.SdkAudioControlFrame)return e;var t=new c.SdkAudioControlFrame;return null!=e.muted&&(t.muted=Boolean(e.muted)),t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.muted=!1),null!=e.muted&&e.hasOwnProperty("muted")&&(n.muted=e.muted),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkAudioMetadataFrame=function(){function e(e){if(this.attendeeStates=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.attendeeStates=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.attendeeStates&&e.attendeeStates.length)for(var n=0;n<e.attendeeStates.length;++n)c.SdkAudioAttendeeState.encode(e.attendeeStates[n],t.uint32(10).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkAudioMetadataFrame;e.pos<n;){var r=e.uint32();r>>>3==1?(i.attendeeStates&&i.attendeeStates.length||(i.attendeeStates=[]),i.attendeeStates.push(c.SdkAudioAttendeeState.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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<e.attendeeStates.length;++t){var n=c.SdkAudioAttendeeState.verify(e.attendeeStates[t]);if(n)return"attendeeStates."+n}}return null},e.fromObject=function(e){if(e instanceof c.SdkAudioMetadataFrame)return e;var t=new c.SdkAudioMetadataFrame;if(e.attendeeStates){if(!Array.isArray(e.attendeeStates))throw TypeError(".SdkAudioMetadataFrame.attendeeStates: array expected");t.attendeeStates=[];for(var n=0;n<e.attendeeStates.length;++n){if("object"!=typeof e.attendeeStates[n])throw TypeError(".SdkAudioMetadataFrame.attendeeStates: object expected");t.attendeeStates[n]=c.SdkAudioAttendeeState.fromObject(e.attendeeStates[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.attendeeStates=[]),e.attendeeStates&&e.attendeeStates.length){n.attendeeStates=[];for(var i=0;i<e.attendeeStates.length;++i)n.attendeeStates[i]=c.SdkAudioAttendeeState.toObject(e.attendeeStates[i],t)}return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkAudioAttendeeState=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.audioStreamId=0,e.prototype.volume=0,e.prototype.muted=!1,e.prototype.signalStrength=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.audioStreamId&&Object.hasOwnProperty.call(e,"audioStreamId")&&t.uint32(8).uint32(e.audioStreamId),null!=e.volume&&Object.hasOwnProperty.call(e,"volume")&&t.uint32(16).uint32(e.volume),null!=e.muted&&Object.hasOwnProperty.call(e,"muted")&&t.uint32(24).bool(e.muted),null!=e.signalStrength&&Object.hasOwnProperty.call(e,"signalStrength")&&t.uint32(32).uint32(e.signalStrength),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkAudioAttendeeState;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.audioStreamId=e.uint32();break;case 2:i.volume=e.uint32();break;case 3:i.muted=e.bool();break;case 4:i.signalStrength=e.uint32();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&!l.isInteger(e.audioStreamId)?"audioStreamId: integer expected":null!=e.volume&&e.hasOwnProperty("volume")&&!l.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")&&!l.isInteger(e.signalStrength)?"signalStrength: integer expected":null},e.fromObject=function(e){if(e instanceof c.SdkAudioAttendeeState)return e;var t=new c.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 n={};return t.defaults&&(n.audioStreamId=0,n.volume=0,n.muted=!1,n.signalStrength=0),null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&(n.audioStreamId=e.audioStreamId),null!=e.volume&&e.hasOwnProperty("volume")&&(n.volume=e.volume),null!=e.muted&&e.hasOwnProperty("muted")&&(n.muted=e.muted),null!=e.signalStrength&&e.hasOwnProperty("signalStrength")&&(n.signalStrength=e.signalStrength),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkAudioStreamIdInfoFrame=function(){function e(e){if(this.streams=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.streams=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.streams&&e.streams.length)for(var n=0;n<e.streams.length;++n)c.SdkAudioStreamIdInfo.encode(e.streams[n],t.uint32(10).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkAudioStreamIdInfoFrame;e.pos<n;){var r=e.uint32();r>>>3==1?(i.streams&&i.streams.length||(i.streams=[]),i.streams.push(c.SdkAudioStreamIdInfo.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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<e.streams.length;++t){var n=c.SdkAudioStreamIdInfo.verify(e.streams[t]);if(n)return"streams."+n}}return null},e.fromObject=function(e){if(e instanceof c.SdkAudioStreamIdInfoFrame)return e;var t=new c.SdkAudioStreamIdInfoFrame;if(e.streams){if(!Array.isArray(e.streams))throw TypeError(".SdkAudioStreamIdInfoFrame.streams: array expected");t.streams=[];for(var n=0;n<e.streams.length;++n){if("object"!=typeof e.streams[n])throw TypeError(".SdkAudioStreamIdInfoFrame.streams: object expected");t.streams[n]=c.SdkAudioStreamIdInfo.fromObject(e.streams[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.streams=[]),e.streams&&e.streams.length){n.streams=[];for(var i=0;i<e.streams.length;++i)n.streams[i]=c.SdkAudioStreamIdInfo.toObject(e.streams[i],t)}return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkAudioStreamIdInfo=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.audioStreamId=0,e.prototype.attendeeId="",e.prototype.muted=!1,e.prototype.externalUserId="",e.prototype.dropped=!1,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.audioStreamId&&Object.hasOwnProperty.call(e,"audioStreamId")&&t.uint32(8).uint32(e.audioStreamId),null!=e.attendeeId&&Object.hasOwnProperty.call(e,"attendeeId")&&t.uint32(18).string(e.attendeeId),null!=e.muted&&Object.hasOwnProperty.call(e,"muted")&&t.uint32(24).bool(e.muted),null!=e.externalUserId&&Object.hasOwnProperty.call(e,"externalUserId")&&t.uint32(34).string(e.externalUserId),null!=e.dropped&&Object.hasOwnProperty.call(e,"dropped")&&t.uint32(40).bool(e.dropped),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkAudioStreamIdInfo;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.audioStreamId=e.uint32();break;case 2:i.attendeeId=e.string();break;case 3:i.muted=e.bool();break;case 4:i.externalUserId=e.string();break;case 5:i.dropped=e.bool();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&!l.isInteger(e.audioStreamId)?"audioStreamId: integer expected":null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!l.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")&&!l.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 c.SdkAudioStreamIdInfo)return e;var t=new c.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 n={};return t.defaults&&(n.audioStreamId=0,n.attendeeId="",n.muted=!1,n.externalUserId="",n.dropped=!1),null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&(n.audioStreamId=e.audioStreamId),null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&(n.attendeeId=e.attendeeId),null!=e.muted&&e.hasOwnProperty("muted")&&(n.muted=e.muted),null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&(n.externalUserId=e.externalUserId),null!=e.dropped&&e.hasOwnProperty("dropped")&&(n.dropped=e.dropped),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkPingPongType=function(){var e={},t=Object.create(e);return t[e[1]="PING"]=1,t[e[2]="PONG"]=2,t}(),c.SdkPingPongFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.type=1,e.prototype.pingId=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),t.uint32(8).int32(e.type),t.uint32(16).uint32(e.pingId),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkPingPongFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.type=e.int32();break;case 2:i.pingId=e.uint32();break;default:e.skipType(7&r)}}if(!i.hasOwnProperty("type"))throw l.ProtocolError("missing required 'type'",{instance:i});if(!i.hasOwnProperty("pingId"))throw l.ProtocolError("missing required 'pingId'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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 l.isInteger(e.pingId)?null:"pingId: integer expected"},e.fromObject=function(e){if(e instanceof c.SdkPingPongFrame)return e;var t=new c.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 n={};return t.defaults&&(n.type=t.enums===String?"PING":1,n.pingId=0),null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?c.SdkPingPongType[e.type]:e.type),null!=e.pingId&&e.hasOwnProperty("pingId")&&(n.pingId=e.pingId),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkAudioStatusFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.audioStatus=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.audioStatus&&Object.hasOwnProperty.call(e,"audioStatus")&&t.uint32(8).uint32(e.audioStatus),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkAudioStatusFrame;e.pos<n;){var r=e.uint32();r>>>3==1?i.audioStatus=e.uint32():e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&!l.isInteger(e.audioStatus)?"audioStatus: integer expected":null},e.fromObject=function(e){if(e instanceof c.SdkAudioStatusFrame)return e;var t=new c.SdkAudioStatusFrame;return null!=e.audioStatus&&(t.audioStatus=e.audioStatus>>>0),t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.audioStatus=0),null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&(n.audioStatus=e.audioStatus),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkMetric=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.type=1,e.prototype.value=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(8).int32(e.type),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&t.uint32(17).double(e.value),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkMetric;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.type=e.int32();break;case 2:i.value=e.double();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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:case 88:case 89:}return null!=e.value&&e.hasOwnProperty("value")&&"number"!=typeof e.value?"value: number expected":null},e.fromObject=function(e){if(e instanceof c.SdkMetric)return e;var t=new c.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_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;break;case"VIDEO_ENCODER_IS_HARDWARE":case 88:t.type=88;break;case"VIDEO_DECODER_IS_HARDWARE":case 89:t.type=89}return null!=e.value&&(t.value=Number(e.value)),t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.type=t.enums===String?"VIDEO_ACTUAL_ENCODER_BITRATE":1,n.value=0),null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?c.SdkMetric.Type[e.type]:e.type),null!=e.value&&e.hasOwnProperty("value")&&(n.value=t.json&&!isFinite(e.value)?String(e.value):e.value),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.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_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[88]="VIDEO_ENCODER_IS_HARDWARE"]=88,t[e[89]="VIDEO_DECODER_IS_HARDWARE"]=89,t}(),e}(),c.SdkStreamMetricFrame=function(){function e(e){if(this.metrics=[],this.dimensions=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.streamId=0,e.prototype.groupId=0,e.prototype.metrics=l.emptyArray,e.prototype.dimensions=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.streamId&&Object.hasOwnProperty.call(e,"streamId")&&t.uint32(24).uint32(e.streamId),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(32).uint32(e.groupId),null!=e.metrics&&e.metrics.length)for(var n=0;n<e.metrics.length;++n)c.SdkMetric.encode(e.metrics[n],t.uint32(42).fork()).ldelim();if(null!=e.dimensions&&e.dimensions.length)for(n=0;n<e.dimensions.length;++n)c.SdkStreamDimension.encode(e.dimensions[n],t.uint32(50).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkStreamMetricFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 3:i.streamId=e.uint32();break;case 4:i.groupId=e.uint32();break;case 5:i.metrics&&i.metrics.length||(i.metrics=[]),i.metrics.push(c.SdkMetric.decode(e,e.uint32()));break;case 6:i.dimensions&&i.dimensions.length||(i.dimensions=[]),i.dimensions.push(c.SdkStreamDimension.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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")&&!l.isInteger(e.streamId))return"streamId: integer expected";if(null!=e.groupId&&e.hasOwnProperty("groupId")&&!l.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<e.metrics.length;++t)if(n=c.SdkMetric.verify(e.metrics[t]))return"metrics."+n}if(null!=e.dimensions&&e.hasOwnProperty("dimensions")){if(!Array.isArray(e.dimensions))return"dimensions: array expected";for(t=0;t<e.dimensions.length;++t){var n;if(n=c.SdkStreamDimension.verify(e.dimensions[t]))return"dimensions."+n}}return null},e.fromObject=function(e){if(e instanceof c.SdkStreamMetricFrame)return e;var t=new c.SdkStreamMetricFrame;if(null!=e.streamId&&(t.streamId=e.streamId>>>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 n=0;n<e.metrics.length;++n){if("object"!=typeof e.metrics[n])throw TypeError(".SdkStreamMetricFrame.metrics: object expected");t.metrics[n]=c.SdkMetric.fromObject(e.metrics[n])}}if(e.dimensions){if(!Array.isArray(e.dimensions))throw TypeError(".SdkStreamMetricFrame.dimensions: array expected");for(t.dimensions=[],n=0;n<e.dimensions.length;++n){if("object"!=typeof e.dimensions[n])throw TypeError(".SdkStreamMetricFrame.dimensions: object expected");t.dimensions[n]=c.SdkStreamDimension.fromObject(e.dimensions[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.metrics=[],n.dimensions=[]),t.defaults&&(n.streamId=0,n.groupId=0),null!=e.streamId&&e.hasOwnProperty("streamId")&&(n.streamId=e.streamId),null!=e.groupId&&e.hasOwnProperty("groupId")&&(n.groupId=e.groupId),e.metrics&&e.metrics.length){n.metrics=[];for(var i=0;i<e.metrics.length;++i)n.metrics[i]=c.SdkMetric.toObject(e.metrics[i],t)}if(e.dimensions&&e.dimensions.length)for(n.dimensions=[],i=0;i<e.dimensions.length;++i)n.dimensions[i]=c.SdkStreamDimension.toObject(e.dimensions[i],t);return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkClientMetricFrame=function(){function e(e){if(this.globalMetrics=[],this.streamMetricFrames=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.globalMetrics=l.emptyArray,e.prototype.streamMetricFrames=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.globalMetrics&&e.globalMetrics.length)for(var n=0;n<e.globalMetrics.length;++n)c.SdkMetric.encode(e.globalMetrics[n],t.uint32(10).fork()).ldelim();if(null!=e.streamMetricFrames&&e.streamMetricFrames.length)for(n=0;n<e.streamMetricFrames.length;++n)c.SdkStreamMetricFrame.encode(e.streamMetricFrames[n],t.uint32(18).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkClientMetricFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.globalMetrics&&i.globalMetrics.length||(i.globalMetrics=[]),i.globalMetrics.push(c.SdkMetric.decode(e,e.uint32()));break;case 2:i.streamMetricFrames&&i.streamMetricFrames.length||(i.streamMetricFrames=[]),i.streamMetricFrames.push(c.SdkStreamMetricFrame.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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<e.globalMetrics.length;++t)if(n=c.SdkMetric.verify(e.globalMetrics[t]))return"globalMetrics."+n}if(null!=e.streamMetricFrames&&e.hasOwnProperty("streamMetricFrames")){if(!Array.isArray(e.streamMetricFrames))return"streamMetricFrames: array expected";for(t=0;t<e.streamMetricFrames.length;++t){var n;if(n=c.SdkStreamMetricFrame.verify(e.streamMetricFrames[t]))return"streamMetricFrames."+n}}return null},e.fromObject=function(e){if(e instanceof c.SdkClientMetricFrame)return e;var t=new c.SdkClientMetricFrame;if(e.globalMetrics){if(!Array.isArray(e.globalMetrics))throw TypeError(".SdkClientMetricFrame.globalMetrics: array expected");t.globalMetrics=[];for(var n=0;n<e.globalMetrics.length;++n){if("object"!=typeof e.globalMetrics[n])throw TypeError(".SdkClientMetricFrame.globalMetrics: object expected");t.globalMetrics[n]=c.SdkMetric.fromObject(e.globalMetrics[n])}}if(e.streamMetricFrames){if(!Array.isArray(e.streamMetricFrames))throw TypeError(".SdkClientMetricFrame.streamMetricFrames: array expected");for(t.streamMetricFrames=[],n=0;n<e.streamMetricFrames.length;++n){if("object"!=typeof e.streamMetricFrames[n])throw TypeError(".SdkClientMetricFrame.streamMetricFrames: object expected");t.streamMetricFrames[n]=c.SdkStreamMetricFrame.fromObject(e.streamMetricFrames[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.globalMetrics=[],n.streamMetricFrames=[]),e.globalMetrics&&e.globalMetrics.length){n.globalMetrics=[];for(var i=0;i<e.globalMetrics.length;++i)n.globalMetrics[i]=c.SdkMetric.toObject(e.globalMetrics[i],t)}if(e.streamMetricFrames&&e.streamMetricFrames.length)for(n.streamMetricFrames=[],i=0;i<e.streamMetricFrames.length;++i)n.streamMetricFrames[i]=c.SdkStreamMetricFrame.toObject(e.streamMetricFrames[i],t);return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkStreamDimension=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.type=1,e.prototype.value=null,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(8).int32(e.type),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&c.SdkDimensionValue.encode(e.value,t.uint32(18).fork()).ldelim(),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkStreamDimension;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.type=e.int32();break;case 2:i.value=c.SdkDimensionValue.decode(e,e.uint32());break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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:}if(null!=e.value&&e.hasOwnProperty("value")){var t=c.SdkDimensionValue.verify(e.value);if(t)return"value."+t}return null},e.fromObject=function(e){if(e instanceof c.SdkStreamDimension)return e;var t=new c.SdkStreamDimension;switch(e.type){case"VIDEO_ENCODER_NAME":case 1:t.type=1;break;case"VIDEO_DECODER_NAME":case 2:t.type=2}if(null!=e.value){if("object"!=typeof e.value)throw TypeError(".SdkStreamDimension.value: object expected");t.value=c.SdkDimensionValue.fromObject(e.value)}return t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.type=t.enums===String?"VIDEO_ENCODER_NAME":1,n.value=null),null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?c.SdkStreamDimension.Type[e.type]:e.type),null!=e.value&&e.hasOwnProperty("value")&&(n.value=c.SdkDimensionValue.toObject(e.value,t)),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e.Type=function(){var e={},t=Object.create(e);return t[e[1]="VIDEO_ENCODER_NAME"]=1,t[e[2]="VIDEO_DECODER_NAME"]=2,t}(),e}(),c.SdkDimensionValue=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.stringValue="",e.prototype.boolValue=!1,e.prototype.uintValue=l.Long?l.Long.fromBits(0,0,!0):0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.stringValue&&Object.hasOwnProperty.call(e,"stringValue")&&t.uint32(10).string(e.stringValue),null!=e.boolValue&&Object.hasOwnProperty.call(e,"boolValue")&&t.uint32(16).bool(e.boolValue),null!=e.uintValue&&Object.hasOwnProperty.call(e,"uintValue")&&t.uint32(24).uint64(e.uintValue),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkDimensionValue;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.stringValue=e.string();break;case 2:i.boolValue=e.bool();break;case 3:i.uintValue=e.uint64();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.stringValue&&e.hasOwnProperty("stringValue")&&!l.isString(e.stringValue)?"stringValue: string expected":null!=e.boolValue&&e.hasOwnProperty("boolValue")&&"boolean"!=typeof e.boolValue?"boolValue: boolean expected":null!=e.uintValue&&e.hasOwnProperty("uintValue")&&!(l.isInteger(e.uintValue)||e.uintValue&&l.isInteger(e.uintValue.low)&&l.isInteger(e.uintValue.high))?"uintValue: integer|Long expected":null},e.fromObject=function(e){if(e instanceof c.SdkDimensionValue)return e;var t=new c.SdkDimensionValue;return null!=e.stringValue&&(t.stringValue=String(e.stringValue)),null!=e.boolValue&&(t.boolValue=Boolean(e.boolValue)),null!=e.uintValue&&(l.Long?(t.uintValue=l.Long.fromValue(e.uintValue)).unsigned=!0:"string"==typeof e.uintValue?t.uintValue=parseInt(e.uintValue,10):"number"==typeof e.uintValue?t.uintValue=e.uintValue:"object"==typeof e.uintValue&&(t.uintValue=new l.LongBits(e.uintValue.low>>>0,e.uintValue.high>>>0).toNumber(!0))),t},e.toObject=function(e,t){t||(t={});var n={};if(t.defaults)if(n.stringValue="",n.boolValue=!1,l.Long){var i=new l.Long(0,0,!0);n.uintValue=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else n.uintValue=t.longs===String?"0":0;return null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(n.stringValue=e.stringValue),null!=e.boolValue&&e.hasOwnProperty("boolValue")&&(n.boolValue=e.boolValue),null!=e.uintValue&&e.hasOwnProperty("uintValue")&&("number"==typeof e.uintValue?n.uintValue=t.longs===String?String(e.uintValue):e.uintValue:n.uintValue=t.longs===String?l.Long.prototype.toString.call(e.uintValue):t.longs===Number?new l.LongBits(e.uintValue.low>>>0,e.uintValue.high>>>0).toNumber(!0):e.uintValue),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkDataMessageFrame=function(){function e(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.messages=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.messages&&e.messages.length)for(var n=0;n<e.messages.length;++n)c.SdkDataMessagePayload.encode(e.messages[n],t.uint32(10).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkDataMessageFrame;e.pos<n;){var r=e.uint32();r>>>3==1?(i.messages&&i.messages.length||(i.messages=[]),i.messages.push(c.SdkDataMessagePayload.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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<e.messages.length;++t){var n=c.SdkDataMessagePayload.verify(e.messages[t]);if(n)return"messages."+n}}return null},e.fromObject=function(e){if(e instanceof c.SdkDataMessageFrame)return e;var t=new c.SdkDataMessageFrame;if(e.messages){if(!Array.isArray(e.messages))throw TypeError(".SdkDataMessageFrame.messages: array expected");t.messages=[];for(var n=0;n<e.messages.length;++n){if("object"!=typeof e.messages[n])throw TypeError(".SdkDataMessageFrame.messages: object expected");t.messages[n]=c.SdkDataMessagePayload.fromObject(e.messages[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.messages=[]),e.messages&&e.messages.length){n.messages=[];for(var i=0;i<e.messages.length;++i)n.messages[i]=c.SdkDataMessagePayload.toObject(e.messages[i],t)}return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkDataMessagePayload=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.topic="",e.prototype.data=l.newBuffer([]),e.prototype.lifetimeMs=0,e.prototype.senderAttendeeId="",e.prototype.ingestTimeNs=l.Long?l.Long.fromBits(0,0,!1):0,e.prototype.senderExternalUserId="",e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.topic&&Object.hasOwnProperty.call(e,"topic")&&t.uint32(10).string(e.topic),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(18).bytes(e.data),null!=e.lifetimeMs&&Object.hasOwnProperty.call(e,"lifetimeMs")&&t.uint32(24).uint32(e.lifetimeMs),null!=e.senderAttendeeId&&Object.hasOwnProperty.call(e,"senderAttendeeId")&&t.uint32(34).string(e.senderAttendeeId),null!=e.ingestTimeNs&&Object.hasOwnProperty.call(e,"ingestTimeNs")&&t.uint32(40).int64(e.ingestTimeNs),null!=e.senderExternalUserId&&Object.hasOwnProperty.call(e,"senderExternalUserId")&&t.uint32(50).string(e.senderExternalUserId),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkDataMessagePayload;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.topic=e.string();break;case 2:i.data=e.bytes();break;case 3:i.lifetimeMs=e.uint32();break;case 4:i.senderAttendeeId=e.string();break;case 5:i.ingestTimeNs=e.int64();break;case 6:i.senderExternalUserId=e.string();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.topic&&e.hasOwnProperty("topic")&&!l.isString(e.topic)?"topic: string expected":null!=e.data&&e.hasOwnProperty("data")&&!(e.data&&"number"==typeof e.data.length||l.isString(e.data))?"data: buffer expected":null!=e.lifetimeMs&&e.hasOwnProperty("lifetimeMs")&&!l.isInteger(e.lifetimeMs)?"lifetimeMs: integer expected":null!=e.senderAttendeeId&&e.hasOwnProperty("senderAttendeeId")&&!l.isString(e.senderAttendeeId)?"senderAttendeeId: string expected":null!=e.ingestTimeNs&&e.hasOwnProperty("ingestTimeNs")&&!(l.isInteger(e.ingestTimeNs)||e.ingestTimeNs&&l.isInteger(e.ingestTimeNs.low)&&l.isInteger(e.ingestTimeNs.high))?"ingestTimeNs: integer|Long expected":null!=e.senderExternalUserId&&e.hasOwnProperty("senderExternalUserId")&&!l.isString(e.senderExternalUserId)?"senderExternalUserId: string expected":null},e.fromObject=function(e){if(e instanceof c.SdkDataMessagePayload)return e;var t=new c.SdkDataMessagePayload;return null!=e.topic&&(t.topic=String(e.topic)),null!=e.data&&("string"==typeof e.data?l.base64.decode(e.data,t.data=l.newBuffer(l.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&&(l.Long?(t.ingestTimeNs=l.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 l.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 n={};if(t.defaults){if(n.topic="",t.bytes===String?n.data="":(n.data=[],t.bytes!==Array&&(n.data=l.newBuffer(n.data))),n.lifetimeMs=0,n.senderAttendeeId="",l.Long){var i=new l.Long(0,0,!1);n.ingestTimeNs=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else n.ingestTimeNs=t.longs===String?"0":0;n.senderExternalUserId=""}return null!=e.topic&&e.hasOwnProperty("topic")&&(n.topic=e.topic),null!=e.data&&e.hasOwnProperty("data")&&(n.data=t.bytes===String?l.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")&&(n.lifetimeMs=e.lifetimeMs),null!=e.senderAttendeeId&&e.hasOwnProperty("senderAttendeeId")&&(n.senderAttendeeId=e.senderAttendeeId),null!=e.ingestTimeNs&&e.hasOwnProperty("ingestTimeNs")&&("number"==typeof e.ingestTimeNs?n.ingestTimeNs=t.longs===String?String(e.ingestTimeNs):e.ingestTimeNs:n.ingestTimeNs=t.longs===String?l.Long.prototype.toString.call(e.ingestTimeNs):t.longs===Number?new l.LongBits(e.ingestTimeNs.low>>>0,e.ingestTimeNs.high>>>0).toNumber():e.ingestTimeNs),null!=e.senderExternalUserId&&e.hasOwnProperty("senderExternalUserId")&&(n.senderExternalUserId=e.senderExternalUserId),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkTurnCredentials=function(){function e(e){if(this.uris=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.username="",e.prototype.password="",e.prototype.ttl=0,e.prototype.uris=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.username&&Object.hasOwnProperty.call(e,"username")&&t.uint32(10).string(e.username),null!=e.password&&Object.hasOwnProperty.call(e,"password")&&t.uint32(18).string(e.password),null!=e.ttl&&Object.hasOwnProperty.call(e,"ttl")&&t.uint32(24).uint32(e.ttl),null!=e.uris&&e.uris.length)for(var n=0;n<e.uris.length;++n)t.uint32(34).string(e.uris[n]);return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkTurnCredentials;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.username=e.string();break;case 2:i.password=e.string();break;case 3:i.ttl=e.uint32();break;case 4:i.uris&&i.uris.length||(i.uris=[]),i.uris.push(e.string());break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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")&&!l.isString(e.username))return"username: string expected";if(null!=e.password&&e.hasOwnProperty("password")&&!l.isString(e.password))return"password: string expected";if(null!=e.ttl&&e.hasOwnProperty("ttl")&&!l.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<e.uris.length;++t)if(!l.isString(e.uris[t]))return"uris: string[] expected"}return null},e.fromObject=function(e){if(e instanceof c.SdkTurnCredentials)return e;var t=new c.SdkTurnCredentials;if(null!=e.username&&(t.username=String(e.username)),null!=e.password&&(t.password=String(e.password)),null!=e.ttl&&(t.ttl=e.ttl>>>0),e.uris){if(!Array.isArray(e.uris))throw TypeError(".SdkTurnCredentials.uris: array expected");t.uris=[];for(var n=0;n<e.uris.length;++n)t.uris[n]=String(e.uris[n])}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.uris=[]),t.defaults&&(n.username="",n.password="",n.ttl=0),null!=e.username&&e.hasOwnProperty("username")&&(n.username=e.username),null!=e.password&&e.hasOwnProperty("password")&&(n.password=e.password),null!=e.ttl&&e.hasOwnProperty("ttl")&&(n.ttl=e.ttl),e.uris&&e.uris.length){n.uris=[];for(var i=0;i<e.uris.length;++i)n.uris[i]=e.uris[i]}return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkTranscriptItem=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.content="",e.prototype.endTime=l.Long?l.Long.fromBits(0,0,!1):0,e.prototype.speakerAttendeeId="",e.prototype.speakerExternalUserId="",e.prototype.startTime=l.Long?l.Long.fromBits(0,0,!1):0,e.prototype.type=1,e.prototype.vocabularyFilterMatch=!1,e.prototype.confidence=0,e.prototype.stable=!1,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.content&&Object.hasOwnProperty.call(e,"content")&&t.uint32(10).string(e.content),null!=e.endTime&&Object.hasOwnProperty.call(e,"endTime")&&t.uint32(16).int64(e.endTime),null!=e.speakerAttendeeId&&Object.hasOwnProperty.call(e,"speakerAttendeeId")&&t.uint32(26).string(e.speakerAttendeeId),null!=e.speakerExternalUserId&&Object.hasOwnProperty.call(e,"speakerExternalUserId")&&t.uint32(34).string(e.speakerExternalUserId),null!=e.startTime&&Object.hasOwnProperty.call(e,"startTime")&&t.uint32(40).int64(e.startTime),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(48).int32(e.type),null!=e.vocabularyFilterMatch&&Object.hasOwnProperty.call(e,"vocabularyFilterMatch")&&t.uint32(56).bool(e.vocabularyFilterMatch),null!=e.confidence&&Object.hasOwnProperty.call(e,"confidence")&&t.uint32(65).double(e.confidence),null!=e.stable&&Object.hasOwnProperty.call(e,"stable")&&t.uint32(72).bool(e.stable),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkTranscriptItem;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.content=e.string();break;case 2:i.endTime=e.int64();break;case 3:i.speakerAttendeeId=e.string();break;case 4:i.speakerExternalUserId=e.string();break;case 5:i.startTime=e.int64();break;case 6:i.type=e.int32();break;case 7:i.vocabularyFilterMatch=e.bool();break;case 8:i.confidence=e.double();break;case 9:i.stable=e.bool();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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")&&!l.isString(e.content))return"content: string expected";if(null!=e.endTime&&e.hasOwnProperty("endTime")&&!(l.isInteger(e.endTime)||e.endTime&&l.isInteger(e.endTime.low)&&l.isInteger(e.endTime.high)))return"endTime: integer|Long expected";if(null!=e.speakerAttendeeId&&e.hasOwnProperty("speakerAttendeeId")&&!l.isString(e.speakerAttendeeId))return"speakerAttendeeId: string expected";if(null!=e.speakerExternalUserId&&e.hasOwnProperty("speakerExternalUserId")&&!l.isString(e.speakerExternalUserId))return"speakerExternalUserId: string expected";if(null!=e.startTime&&e.hasOwnProperty("startTime")&&!(l.isInteger(e.startTime)||e.startTime&&l.isInteger(e.startTime.low)&&l.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 c.SdkTranscriptItem)return e;var t=new c.SdkTranscriptItem;switch(null!=e.content&&(t.content=String(e.content)),null!=e.endTime&&(l.Long?(t.endTime=l.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 l.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&&(l.Long?(t.startTime=l.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 l.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 n={};if(t.defaults){if(n.content="",l.Long){var i=new l.Long(0,0,!1);n.endTime=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else n.endTime=t.longs===String?"0":0;n.speakerAttendeeId="",n.speakerExternalUserId="",l.Long?(i=new l.Long(0,0,!1),n.startTime=t.longs===String?i.toString():t.longs===Number?i.toNumber():i):n.startTime=t.longs===String?"0":0,n.type=t.enums===String?"PRONUNCIATION":1,n.vocabularyFilterMatch=!1,n.confidence=0,n.stable=!1}return null!=e.content&&e.hasOwnProperty("content")&&(n.content=e.content),null!=e.endTime&&e.hasOwnProperty("endTime")&&("number"==typeof e.endTime?n.endTime=t.longs===String?String(e.endTime):e.endTime:n.endTime=t.longs===String?l.Long.prototype.toString.call(e.endTime):t.longs===Number?new l.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber():e.endTime),null!=e.speakerAttendeeId&&e.hasOwnProperty("speakerAttendeeId")&&(n.speakerAttendeeId=e.speakerAttendeeId),null!=e.speakerExternalUserId&&e.hasOwnProperty("speakerExternalUserId")&&(n.speakerExternalUserId=e.speakerExternalUserId),null!=e.startTime&&e.hasOwnProperty("startTime")&&("number"==typeof e.startTime?n.startTime=t.longs===String?String(e.startTime):e.startTime:n.startTime=t.longs===String?l.Long.prototype.toString.call(e.startTime):t.longs===Number?new l.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber():e.startTime),null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?c.SdkTranscriptItem.Type[e.type]:e.type),null!=e.vocabularyFilterMatch&&e.hasOwnProperty("vocabularyFilterMatch")&&(n.vocabularyFilterMatch=e.vocabularyFilterMatch),null!=e.confidence&&e.hasOwnProperty("confidence")&&(n.confidence=t.json&&!isFinite(e.confidence)?String(e.confidence):e.confidence),null!=e.stable&&e.hasOwnProperty("stable")&&(n.stable=e.stable),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e.Type=function(){var e={},t=Object.create(e);return t[e[1]="PRONUNCIATION"]=1,t[e[2]="PUNCTUATION"]=2,t}(),e}(),c.SdkTranscriptEntity=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.category="",e.prototype.confidence=0,e.prototype.content="",e.prototype.endTime=l.Long?l.Long.fromBits(0,0,!1):0,e.prototype.startTime=l.Long?l.Long.fromBits(0,0,!1):0,e.prototype.type="",e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.category&&Object.hasOwnProperty.call(e,"category")&&t.uint32(10).string(e.category),null!=e.confidence&&Object.hasOwnProperty.call(e,"confidence")&&t.uint32(17).double(e.confidence),null!=e.content&&Object.hasOwnProperty.call(e,"content")&&t.uint32(26).string(e.content),null!=e.endTime&&Object.hasOwnProperty.call(e,"endTime")&&t.uint32(32).int64(e.endTime),null!=e.startTime&&Object.hasOwnProperty.call(e,"startTime")&&t.uint32(40).int64(e.startTime),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(50).string(e.type),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkTranscriptEntity;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.category=e.string();break;case 2:i.confidence=e.double();break;case 3:i.content=e.string();break;case 4:i.endTime=e.int64();break;case 5:i.startTime=e.int64();break;case 6:i.type=e.string();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.category&&e.hasOwnProperty("category")&&!l.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")&&!l.isString(e.content)?"content: string expected":null!=e.endTime&&e.hasOwnProperty("endTime")&&!(l.isInteger(e.endTime)||e.endTime&&l.isInteger(e.endTime.low)&&l.isInteger(e.endTime.high))?"endTime: integer|Long expected":null!=e.startTime&&e.hasOwnProperty("startTime")&&!(l.isInteger(e.startTime)||e.startTime&&l.isInteger(e.startTime.low)&&l.isInteger(e.startTime.high))?"startTime: integer|Long expected":null!=e.type&&e.hasOwnProperty("type")&&!l.isString(e.type)?"type: string expected":null},e.fromObject=function(e){if(e instanceof c.SdkTranscriptEntity)return e;var t=new c.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&&(l.Long?(t.endTime=l.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 l.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber())),null!=e.startTime&&(l.Long?(t.startTime=l.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 l.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 n={};if(t.defaults){if(n.category="",n.confidence=0,n.content="",l.Long){var i=new l.Long(0,0,!1);n.endTime=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else n.endTime=t.longs===String?"0":0;l.Long?(i=new l.Long(0,0,!1),n.startTime=t.longs===String?i.toString():t.longs===Number?i.toNumber():i):n.startTime=t.longs===String?"0":0,n.type=""}return null!=e.category&&e.hasOwnProperty("category")&&(n.category=e.category),null!=e.confidence&&e.hasOwnProperty("confidence")&&(n.confidence=t.json&&!isFinite(e.confidence)?String(e.confidence):e.confidence),null!=e.content&&e.hasOwnProperty("content")&&(n.content=e.content),null!=e.endTime&&e.hasOwnProperty("endTime")&&("number"==typeof e.endTime?n.endTime=t.longs===String?String(e.endTime):e.endTime:n.endTime=t.longs===String?l.Long.prototype.toString.call(e.endTime):t.longs===Number?new l.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber():e.endTime),null!=e.startTime&&e.hasOwnProperty("startTime")&&("number"==typeof e.startTime?n.startTime=t.longs===String?String(e.startTime):e.startTime:n.startTime=t.longs===String?l.Long.prototype.toString.call(e.startTime):t.longs===Number?new l.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber():e.startTime),null!=e.type&&e.hasOwnProperty("type")&&(n.type=e.type),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkTranscriptAlternative=function(){function e(e){if(this.items=[],this.entities=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.items=l.emptyArray,e.prototype.transcript="",e.prototype.entities=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.items&&e.items.length)for(var n=0;n<e.items.length;++n)c.SdkTranscriptItem.encode(e.items[n],t.uint32(10).fork()).ldelim();if(null!=e.transcript&&Object.hasOwnProperty.call(e,"transcript")&&t.uint32(18).string(e.transcript),null!=e.entities&&e.entities.length)for(n=0;n<e.entities.length;++n)c.SdkTranscriptEntity.encode(e.entities[n],t.uint32(26).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkTranscriptAlternative;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.items&&i.items.length||(i.items=[]),i.items.push(c.SdkTranscriptItem.decode(e,e.uint32()));break;case 2:i.transcript=e.string();break;case 3:i.entities&&i.entities.length||(i.entities=[]),i.entities.push(c.SdkTranscriptEntity.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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<e.items.length;++t)if(n=c.SdkTranscriptItem.verify(e.items[t]))return"items."+n}if(null!=e.transcript&&e.hasOwnProperty("transcript")&&!l.isString(e.transcript))return"transcript: string expected";if(null!=e.entities&&e.hasOwnProperty("entities")){if(!Array.isArray(e.entities))return"entities: array expected";for(t=0;t<e.entities.length;++t){var n;if(n=c.SdkTranscriptEntity.verify(e.entities[t]))return"entities."+n}}return null},e.fromObject=function(e){if(e instanceof c.SdkTranscriptAlternative)return e;var t=new c.SdkTranscriptAlternative;if(e.items){if(!Array.isArray(e.items))throw TypeError(".SdkTranscriptAlternative.items: array expected");t.items=[];for(var n=0;n<e.items.length;++n){if("object"!=typeof e.items[n])throw TypeError(".SdkTranscriptAlternative.items: object expected");t.items[n]=c.SdkTranscriptItem.fromObject(e.items[n])}}if(null!=e.transcript&&(t.transcript=String(e.transcript)),e.entities){if(!Array.isArray(e.entities))throw TypeError(".SdkTranscriptAlternative.entities: array expected");for(t.entities=[],n=0;n<e.entities.length;++n){if("object"!=typeof e.entities[n])throw TypeError(".SdkTranscriptAlternative.entities: object expected");t.entities[n]=c.SdkTranscriptEntity.fromObject(e.entities[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.items=[],n.entities=[]),t.defaults&&(n.transcript=""),e.items&&e.items.length){n.items=[];for(var i=0;i<e.items.length;++i)n.items[i]=c.SdkTranscriptItem.toObject(e.items[i],t)}if(null!=e.transcript&&e.hasOwnProperty("transcript")&&(n.transcript=e.transcript),e.entities&&e.entities.length)for(n.entities=[],i=0;i<e.entities.length;++i)n.entities[i]=c.SdkTranscriptEntity.toObject(e.entities[i],t);return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkTranscriptLanguageWithScore=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.languageCode="",e.prototype.score=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.languageCode&&Object.hasOwnProperty.call(e,"languageCode")&&t.uint32(10).string(e.languageCode),null!=e.score&&Object.hasOwnProperty.call(e,"score")&&t.uint32(17).double(e.score),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkTranscriptLanguageWithScore;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.languageCode=e.string();break;case 2:i.score=e.double();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.languageCode&&e.hasOwnProperty("languageCode")&&!l.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 c.SdkTranscriptLanguageWithScore)return e;var t=new c.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 n={};return t.defaults&&(n.languageCode="",n.score=0),null!=e.languageCode&&e.hasOwnProperty("languageCode")&&(n.languageCode=e.languageCode),null!=e.score&&e.hasOwnProperty("score")&&(n.score=t.json&&!isFinite(e.score)?String(e.score):e.score),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkTranscriptResult=function(){function e(e){if(this.alternatives=[],this.languageIdentification=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.alternatives=l.emptyArray,e.prototype.channelId="",e.prototype.endTime=l.Long?l.Long.fromBits(0,0,!1):0,e.prototype.isPartial=!1,e.prototype.resultId="",e.prototype.startTime=l.Long?l.Long.fromBits(0,0,!1):0,e.prototype.languageCode="",e.prototype.languageIdentification=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.alternatives&&e.alternatives.length)for(var n=0;n<e.alternatives.length;++n)c.SdkTranscriptAlternative.encode(e.alternatives[n],t.uint32(10).fork()).ldelim();if(null!=e.channelId&&Object.hasOwnProperty.call(e,"channelId")&&t.uint32(18).string(e.channelId),null!=e.endTime&&Object.hasOwnProperty.call(e,"endTime")&&t.uint32(24).int64(e.endTime),null!=e.isPartial&&Object.hasOwnProperty.call(e,"isPartial")&&t.uint32(32).bool(e.isPartial),null!=e.resultId&&Object.hasOwnProperty.call(e,"resultId")&&t.uint32(42).string(e.resultId),null!=e.startTime&&Object.hasOwnProperty.call(e,"startTime")&&t.uint32(48).int64(e.startTime),null!=e.languageCode&&Object.hasOwnProperty.call(e,"languageCode")&&t.uint32(58).string(e.languageCode),null!=e.languageIdentification&&e.languageIdentification.length)for(n=0;n<e.languageIdentification.length;++n)c.SdkTranscriptLanguageWithScore.encode(e.languageIdentification[n],t.uint32(66).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkTranscriptResult;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.alternatives&&i.alternatives.length||(i.alternatives=[]),i.alternatives.push(c.SdkTranscriptAlternative.decode(e,e.uint32()));break;case 2:i.channelId=e.string();break;case 3:i.endTime=e.int64();break;case 4:i.isPartial=e.bool();break;case 5:i.resultId=e.string();break;case 6:i.startTime=e.int64();break;case 7:i.languageCode=e.string();break;case 8:i.languageIdentification&&i.languageIdentification.length||(i.languageIdentification=[]),i.languageIdentification.push(c.SdkTranscriptLanguageWithScore.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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<e.alternatives.length;++t)if(n=c.SdkTranscriptAlternative.verify(e.alternatives[t]))return"alternatives."+n}if(null!=e.channelId&&e.hasOwnProperty("channelId")&&!l.isString(e.channelId))return"channelId: string expected";if(null!=e.endTime&&e.hasOwnProperty("endTime")&&!(l.isInteger(e.endTime)||e.endTime&&l.isInteger(e.endTime.low)&&l.isInteger(e.endTime.high)))return"endTime: integer|Long expected";if(null!=e.isPartial&&e.hasOwnProperty("isPartial")&&"boolean"!=typeof e.isPartial)return"isPartial: boolean expected";if(null!=e.resultId&&e.hasOwnProperty("resultId")&&!l.isString(e.resultId))return"resultId: string expected";if(null!=e.startTime&&e.hasOwnProperty("startTime")&&!(l.isInteger(e.startTime)||e.startTime&&l.isInteger(e.startTime.low)&&l.isInteger(e.startTime.high)))return"startTime: integer|Long expected";if(null!=e.languageCode&&e.hasOwnProperty("languageCode")&&!l.isString(e.languageCode))return"languageCode: string expected";if(null!=e.languageIdentification&&e.hasOwnProperty("languageIdentification")){if(!Array.isArray(e.languageIdentification))return"languageIdentification: array expected";for(t=0;t<e.languageIdentification.length;++t){var n;if(n=c.SdkTranscriptLanguageWithScore.verify(e.languageIdentification[t]))return"languageIdentification."+n}}return null},e.fromObject=function(e){if(e instanceof c.SdkTranscriptResult)return e;var t=new c.SdkTranscriptResult;if(e.alternatives){if(!Array.isArray(e.alternatives))throw TypeError(".SdkTranscriptResult.alternatives: array expected");t.alternatives=[];for(var n=0;n<e.alternatives.length;++n){if("object"!=typeof e.alternatives[n])throw TypeError(".SdkTranscriptResult.alternatives: object expected");t.alternatives[n]=c.SdkTranscriptAlternative.fromObject(e.alternatives[n])}}if(null!=e.channelId&&(t.channelId=String(e.channelId)),null!=e.endTime&&(l.Long?(t.endTime=l.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 l.LongBits(e.endTime.low>>>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&&(l.Long?(t.startTime=l.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 l.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=[],n=0;n<e.languageIdentification.length;++n){if("object"!=typeof e.languageIdentification[n])throw TypeError(".SdkTranscriptResult.languageIdentification: object expected");t.languageIdentification[n]=c.SdkTranscriptLanguageWithScore.fromObject(e.languageIdentification[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.alternatives=[],n.languageIdentification=[]),t.defaults){if(n.channelId="",l.Long){var i=new l.Long(0,0,!1);n.endTime=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else n.endTime=t.longs===String?"0":0;n.isPartial=!1,n.resultId="",l.Long?(i=new l.Long(0,0,!1),n.startTime=t.longs===String?i.toString():t.longs===Number?i.toNumber():i):n.startTime=t.longs===String?"0":0,n.languageCode=""}if(e.alternatives&&e.alternatives.length){n.alternatives=[];for(var r=0;r<e.alternatives.length;++r)n.alternatives[r]=c.SdkTranscriptAlternative.toObject(e.alternatives[r],t)}if(null!=e.channelId&&e.hasOwnProperty("channelId")&&(n.channelId=e.channelId),null!=e.endTime&&e.hasOwnProperty("endTime")&&("number"==typeof e.endTime?n.endTime=t.longs===String?String(e.endTime):e.endTime:n.endTime=t.longs===String?l.Long.prototype.toString.call(e.endTime):t.longs===Number?new l.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber():e.endTime),null!=e.isPartial&&e.hasOwnProperty("isPartial")&&(n.isPartial=e.isPartial),null!=e.resultId&&e.hasOwnProperty("resultId")&&(n.resultId=e.resultId),null!=e.startTime&&e.hasOwnProperty("startTime")&&("number"==typeof e.startTime?n.startTime=t.longs===String?String(e.startTime):e.startTime:n.startTime=t.longs===String?l.Long.prototype.toString.call(e.startTime):t.longs===Number?new l.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber():e.startTime),null!=e.languageCode&&e.hasOwnProperty("languageCode")&&(n.languageCode=e.languageCode),e.languageIdentification&&e.languageIdentification.length)for(n.languageIdentification=[],r=0;r<e.languageIdentification.length;++r)n.languageIdentification[r]=c.SdkTranscriptLanguageWithScore.toObject(e.languageIdentification[r],t);return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkTranscript=function(){function e(e){if(this.results=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.results=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.results&&e.results.length)for(var n=0;n<e.results.length;++n)c.SdkTranscriptResult.encode(e.results[n],t.uint32(10).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkTranscript;e.pos<n;){var r=e.uint32();r>>>3==1?(i.results&&i.results.length||(i.results=[]),i.results.push(c.SdkTranscriptResult.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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<e.results.length;++t){var n=c.SdkTranscriptResult.verify(e.results[t]);if(n)return"results."+n}}return null},e.fromObject=function(e){if(e instanceof c.SdkTranscript)return e;var t=new c.SdkTranscript;if(e.results){if(!Array.isArray(e.results))throw TypeError(".SdkTranscript.results: array expected");t.results=[];for(var n=0;n<e.results.length;++n){if("object"!=typeof e.results[n])throw TypeError(".SdkTranscript.results: object expected");t.results[n]=c.SdkTranscriptResult.fromObject(e.results[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.results=[]),e.results&&e.results.length){n.results=[];for(var i=0;i<e.results.length;++i)n.results[i]=c.SdkTranscriptResult.toObject(e.results[i],t)}return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkTranscriptionStatus=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.type=1,e.prototype.eventTime=l.Long?l.Long.fromBits(0,0,!1):0,e.prototype.transcriptionRegion="",e.prototype.transcriptionConfiguration="",e.prototype.message="",e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(8).int32(e.type),null!=e.eventTime&&Object.hasOwnProperty.call(e,"eventTime")&&t.uint32(16).int64(e.eventTime),null!=e.transcriptionRegion&&Object.hasOwnProperty.call(e,"transcriptionRegion")&&t.uint32(26).string(e.transcriptionRegion),null!=e.transcriptionConfiguration&&Object.hasOwnProperty.call(e,"transcriptionConfiguration")&&t.uint32(34).string(e.transcriptionConfiguration),null!=e.message&&Object.hasOwnProperty.call(e,"message")&&t.uint32(42).string(e.message),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkTranscriptionStatus;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.type=e.int32();break;case 2:i.eventTime=e.int64();break;case 3:i.transcriptionRegion=e.string();break;case 4:i.transcriptionConfiguration=e.string();break;case 5:i.message=e.string();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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")&&!(l.isInteger(e.eventTime)||e.eventTime&&l.isInteger(e.eventTime.low)&&l.isInteger(e.eventTime.high))?"eventTime: integer|Long expected":null!=e.transcriptionRegion&&e.hasOwnProperty("transcriptionRegion")&&!l.isString(e.transcriptionRegion)?"transcriptionRegion: string expected":null!=e.transcriptionConfiguration&&e.hasOwnProperty("transcriptionConfiguration")&&!l.isString(e.transcriptionConfiguration)?"transcriptionConfiguration: string expected":null!=e.message&&e.hasOwnProperty("message")&&!l.isString(e.message)?"message: string expected":null},e.fromObject=function(e){if(e instanceof c.SdkTranscriptionStatus)return e;var t=new c.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&&(l.Long?(t.eventTime=l.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 l.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 n={};if(t.defaults){if(n.type=t.enums===String?"STARTED":1,l.Long){var i=new l.Long(0,0,!1);n.eventTime=t.longs===String?i.toString():t.longs===Number?i.toNumber():i}else n.eventTime=t.longs===String?"0":0;n.transcriptionRegion="",n.transcriptionConfiguration="",n.message=""}return null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?c.SdkTranscriptionStatus.Type[e.type]:e.type),null!=e.eventTime&&e.hasOwnProperty("eventTime")&&("number"==typeof e.eventTime?n.eventTime=t.longs===String?String(e.eventTime):e.eventTime:n.eventTime=t.longs===String?l.Long.prototype.toString.call(e.eventTime):t.longs===Number?new l.LongBits(e.eventTime.low>>>0,e.eventTime.high>>>0).toNumber():e.eventTime),null!=e.transcriptionRegion&&e.hasOwnProperty("transcriptionRegion")&&(n.transcriptionRegion=e.transcriptionRegion),null!=e.transcriptionConfiguration&&e.hasOwnProperty("transcriptionConfiguration")&&(n.transcriptionConfiguration=e.transcriptionConfiguration),null!=e.message&&e.hasOwnProperty("message")&&(n.message=e.message),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.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}(),c.SdkTranscriptEvent=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}var t;return e.prototype.status=null,e.prototype.transcript=null,Object.defineProperty(e.prototype,"Event",{get:l.oneOfGetter(t=["status","transcript"]),set:l.oneOfSetter(t)}),e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.status&&Object.hasOwnProperty.call(e,"status")&&c.SdkTranscriptionStatus.encode(e.status,t.uint32(10).fork()).ldelim(),null!=e.transcript&&Object.hasOwnProperty.call(e,"transcript")&&c.SdkTranscript.encode(e.transcript,t.uint32(18).fork()).ldelim(),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkTranscriptEvent;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.status=c.SdkTranscriptionStatus.decode(e,e.uint32());break;case 2:i.transcript=c.SdkTranscript.decode(e,e.uint32());break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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,n=c.SdkTranscriptionStatus.verify(e.status)))return"status."+n;if(null!=e.transcript&&e.hasOwnProperty("transcript")){if(1===t.Event)return"Event: multiple values";var n;if(t.Event=1,n=c.SdkTranscript.verify(e.transcript))return"transcript."+n}return null},e.fromObject=function(e){if(e instanceof c.SdkTranscriptEvent)return e;var t=new c.SdkTranscriptEvent;if(null!=e.status){if("object"!=typeof e.status)throw TypeError(".SdkTranscriptEvent.status: object expected");t.status=c.SdkTranscriptionStatus.fromObject(e.status)}if(null!=e.transcript){if("object"!=typeof e.transcript)throw TypeError(".SdkTranscriptEvent.transcript: object expected");t.transcript=c.SdkTranscript.fromObject(e.transcript)}return t},e.toObject=function(e,t){t||(t={});var n={};return null!=e.status&&e.hasOwnProperty("status")&&(n.status=c.SdkTranscriptionStatus.toObject(e.status,t),t.oneofs&&(n.Event="status")),null!=e.transcript&&e.hasOwnProperty("transcript")&&(n.transcript=c.SdkTranscript.toObject(e.transcript,t),t.oneofs&&(n.Event="transcript")),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkTranscriptFrame=function(){function e(e){if(this.events=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.events=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.events&&e.events.length)for(var n=0;n<e.events.length;++n)c.SdkTranscriptEvent.encode(e.events[n],t.uint32(10).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkTranscriptFrame;e.pos<n;){var r=e.uint32();r>>>3==1?(i.events&&i.events.length||(i.events=[]),i.events.push(c.SdkTranscriptEvent.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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<e.events.length;++t){var n=c.SdkTranscriptEvent.verify(e.events[t]);if(n)return"events."+n}}return null},e.fromObject=function(e){if(e instanceof c.SdkTranscriptFrame)return e;var t=new c.SdkTranscriptFrame;if(e.events){if(!Array.isArray(e.events))throw TypeError(".SdkTranscriptFrame.events: array expected");t.events=[];for(var n=0;n<e.events.length;++n){if("object"!=typeof e.events[n])throw TypeError(".SdkTranscriptFrame.events: object expected");t.events[n]=c.SdkTranscriptEvent.fromObject(e.events[n])}}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.events=[]),e.events&&e.events.length){n.events=[];for(var i=0;i<e.events.length;++i)n.events[i]=c.SdkTranscriptEvent.toObject(e.events[i],t)}return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkRemoteVideoUpdateFrame=function(){function e(e){if(this.addedOrUpdatedVideoSubscriptions=[],this.removedVideoSubscriptionMids=[],e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.addedOrUpdatedVideoSubscriptions=l.emptyArray,e.prototype.removedVideoSubscriptionMids=l.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=a.create()),null!=e.addedOrUpdatedVideoSubscriptions&&e.addedOrUpdatedVideoSubscriptions.length)for(var n=0;n<e.addedOrUpdatedVideoSubscriptions.length;++n)c.SdkVideoSubscriptionConfiguration.encode(e.addedOrUpdatedVideoSubscriptions[n],t.uint32(10).fork()).ldelim();if(null!=e.removedVideoSubscriptionMids&&e.removedVideoSubscriptionMids.length)for(n=0;n<e.removedVideoSubscriptionMids.length;++n)t.uint32(18).string(e.removedVideoSubscriptionMids[n]);return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkRemoteVideoUpdateFrame;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.addedOrUpdatedVideoSubscriptions&&i.addedOrUpdatedVideoSubscriptions.length||(i.addedOrUpdatedVideoSubscriptions=[]),i.addedOrUpdatedVideoSubscriptions.push(c.SdkVideoSubscriptionConfiguration.decode(e,e.uint32()));break;case 2:i.removedVideoSubscriptionMids&&i.removedVideoSubscriptionMids.length||(i.removedVideoSubscriptionMids=[]),i.removedVideoSubscriptionMids.push(e.string());break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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<e.addedOrUpdatedVideoSubscriptions.length;++t){var n=c.SdkVideoSubscriptionConfiguration.verify(e.addedOrUpdatedVideoSubscriptions[t]);if(n)return"addedOrUpdatedVideoSubscriptions."+n}}if(null!=e.removedVideoSubscriptionMids&&e.hasOwnProperty("removedVideoSubscriptionMids")){if(!Array.isArray(e.removedVideoSubscriptionMids))return"removedVideoSubscriptionMids: array expected";for(t=0;t<e.removedVideoSubscriptionMids.length;++t)if(!l.isString(e.removedVideoSubscriptionMids[t]))return"removedVideoSubscriptionMids: string[] expected"}return null},e.fromObject=function(e){if(e instanceof c.SdkRemoteVideoUpdateFrame)return e;var t=new c.SdkRemoteVideoUpdateFrame;if(e.addedOrUpdatedVideoSubscriptions){if(!Array.isArray(e.addedOrUpdatedVideoSubscriptions))throw TypeError(".SdkRemoteVideoUpdateFrame.addedOrUpdatedVideoSubscriptions: array expected");t.addedOrUpdatedVideoSubscriptions=[];for(var n=0;n<e.addedOrUpdatedVideoSubscriptions.length;++n){if("object"!=typeof e.addedOrUpdatedVideoSubscriptions[n])throw TypeError(".SdkRemoteVideoUpdateFrame.addedOrUpdatedVideoSubscriptions: object expected");t.addedOrUpdatedVideoSubscriptions[n]=c.SdkVideoSubscriptionConfiguration.fromObject(e.addedOrUpdatedVideoSubscriptions[n])}}if(e.removedVideoSubscriptionMids){if(!Array.isArray(e.removedVideoSubscriptionMids))throw TypeError(".SdkRemoteVideoUpdateFrame.removedVideoSubscriptionMids: array expected");for(t.removedVideoSubscriptionMids=[],n=0;n<e.removedVideoSubscriptionMids.length;++n)t.removedVideoSubscriptionMids[n]=String(e.removedVideoSubscriptionMids[n])}return t},e.toObject=function(e,t){t||(t={});var n={};if((t.arrays||t.defaults)&&(n.addedOrUpdatedVideoSubscriptions=[],n.removedVideoSubscriptionMids=[]),e.addedOrUpdatedVideoSubscriptions&&e.addedOrUpdatedVideoSubscriptions.length){n.addedOrUpdatedVideoSubscriptions=[];for(var i=0;i<e.addedOrUpdatedVideoSubscriptions.length;++i)n.addedOrUpdatedVideoSubscriptions[i]=c.SdkVideoSubscriptionConfiguration.toObject(e.addedOrUpdatedVideoSubscriptions[i],t)}if(e.removedVideoSubscriptionMids&&e.removedVideoSubscriptionMids.length)for(n.removedVideoSubscriptionMids=[],i=0;i<e.removedVideoSubscriptionMids.length;++i)n.removedVideoSubscriptionMids[i]=e.removedVideoSubscriptionMids[i];return n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkVideoSubscriptionConfiguration=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.mid="",e.prototype.attendeeId="",e.prototype.streamId=0,e.prototype.priority=0,e.prototype.targetBitrateKbps=0,e.prototype.groupId=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),t.uint32(10).string(e.mid),null!=e.attendeeId&&Object.hasOwnProperty.call(e,"attendeeId")&&t.uint32(18).string(e.attendeeId),null!=e.streamId&&Object.hasOwnProperty.call(e,"streamId")&&t.uint32(24).uint32(e.streamId),null!=e.priority&&Object.hasOwnProperty.call(e,"priority")&&t.uint32(32).uint32(e.priority),null!=e.targetBitrateKbps&&Object.hasOwnProperty.call(e,"targetBitrateKbps")&&t.uint32(40).uint32(e.targetBitrateKbps),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(48).uint32(e.groupId),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkVideoSubscriptionConfiguration;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.mid=e.string();break;case 2:i.attendeeId=e.string();break;case 3:i.streamId=e.uint32();break;case 4:i.priority=e.uint32();break;case 5:i.targetBitrateKbps=e.uint32();break;case 6:i.groupId=e.uint32();break;default:e.skipType(7&r)}}if(!i.hasOwnProperty("mid"))throw l.ProtocolError("missing required 'mid'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":l.isString(e.mid)?null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!l.isString(e.attendeeId)?"attendeeId: string expected":null!=e.streamId&&e.hasOwnProperty("streamId")&&!l.isInteger(e.streamId)?"streamId: integer expected":null!=e.priority&&e.hasOwnProperty("priority")&&!l.isInteger(e.priority)?"priority: integer expected":null!=e.targetBitrateKbps&&e.hasOwnProperty("targetBitrateKbps")&&!l.isInteger(e.targetBitrateKbps)?"targetBitrateKbps: integer expected":null!=e.groupId&&e.hasOwnProperty("groupId")&&!l.isInteger(e.groupId)?"groupId: integer expected":null:"mid: string expected"},e.fromObject=function(e){if(e instanceof c.SdkVideoSubscriptionConfiguration)return e;var t=new c.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 n={};return t.defaults&&(n.mid="",n.attendeeId="",n.streamId=0,n.priority=0,n.targetBitrateKbps=0,n.groupId=0),null!=e.mid&&e.hasOwnProperty("mid")&&(n.mid=e.mid),null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&(n.attendeeId=e.attendeeId),null!=e.streamId&&e.hasOwnProperty("streamId")&&(n.streamId=e.streamId),null!=e.priority&&e.hasOwnProperty("priority")&&(n.priority=e.priority),null!=e.targetBitrateKbps&&e.hasOwnProperty("targetBitrateKbps")&&(n.targetBitrateKbps=e.targetBitrateKbps),null!=e.groupId&&e.hasOwnProperty("groupId")&&(n.groupId=e.groupId),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkPrimaryMeetingJoinFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.credentials=null,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.credentials&&Object.hasOwnProperty.call(e,"credentials")&&c.SdkMeetingSessionCredentials.encode(e.credentials,t.uint32(10).fork()).ldelim(),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkPrimaryMeetingJoinFrame;e.pos<n;){var r=e.uint32();r>>>3==1?i.credentials=c.SdkMeetingSessionCredentials.decode(e,e.uint32()):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(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=c.SdkMeetingSessionCredentials.verify(e.credentials);if(t)return"credentials."+t}return null},e.fromObject=function(e){if(e instanceof c.SdkPrimaryMeetingJoinFrame)return e;var t=new c.SdkPrimaryMeetingJoinFrame;if(null!=e.credentials){if("object"!=typeof e.credentials)throw TypeError(".SdkPrimaryMeetingJoinFrame.credentials: object expected");t.credentials=c.SdkMeetingSessionCredentials.fromObject(e.credentials)}return t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.credentials=null),null!=e.credentials&&e.hasOwnProperty("credentials")&&(n.credentials=c.SdkMeetingSessionCredentials.toObject(e.credentials,t)),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkPrimaryMeetingJoinAckFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkPrimaryMeetingJoinAckFrame;e.pos<n;){var r=e.uint32();e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null},e.fromObject=function(e){return e instanceof c.SdkPrimaryMeetingJoinAckFrame?e:new c.SdkPrimaryMeetingJoinAckFrame},e.toObject=function(){return{}},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkPrimaryMeetingLeaveFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkPrimaryMeetingLeaveFrame;e.pos<n;){var r=e.uint32();e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null},e.fromObject=function(e){return e instanceof c.SdkPrimaryMeetingLeaveFrame?e:new c.SdkPrimaryMeetingLeaveFrame},e.toObject=function(){return{}},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.SdkMeetingSessionCredentials=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n<t.length;++n)null!=e[t[n]]&&(this[t[n]]=e[t[n]])}return e.prototype.attendeeId="",e.prototype.externalUserId="",e.prototype.joinToken="",e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=a.create()),null!=e.attendeeId&&Object.hasOwnProperty.call(e,"attendeeId")&&t.uint32(10).string(e.attendeeId),null!=e.externalUserId&&Object.hasOwnProperty.call(e,"externalUserId")&&t.uint32(18).string(e.externalUserId),null!=e.joinToken&&Object.hasOwnProperty.call(e,"joinToken")&&t.uint32(26).string(e.joinToken),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,i=new c.SdkMeetingSessionCredentials;e.pos<n;){var r=e.uint32();switch(r>>>3){case 1:i.attendeeId=e.string();break;case 2:i.externalUserId=e.string();break;case 3:i.joinToken=e.string();break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!l.isString(e.attendeeId)?"attendeeId: string expected":null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&!l.isString(e.externalUserId)?"externalUserId: string expected":null!=e.joinToken&&e.hasOwnProperty("joinToken")&&!l.isString(e.joinToken)?"joinToken: string expected":null},e.fromObject=function(e){if(e instanceof c.SdkMeetingSessionCredentials)return e;var t=new c.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 n={};return t.defaults&&(n.attendeeId="",n.externalUserId="",n.joinToken=""),null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&(n.attendeeId=e.attendeeId),null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&(n.externalUserId=e.externalUserId),null!=e.joinToken&&e.hasOwnProperty("joinToken")&&(n.joinToken=e.joinToken),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),c.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=c,l.Long=void 0,o.configure()},334:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1938),o=n(3538),s=n(4046);t.default=class{constructor(e){this.chimeClient=e}makeTwoDigits(e){return e>9?e.toString():"0"+e.toString()}hmac(e,t){const n=new r.Sha256(t);return n.update(e),n.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,n,r){return i(this,void 0,void 0,(function*(){const i=yield this.hmac(t,"AWS4"+e),o=yield this.hmac(n,i),s=yield this.hmac(r,o);return yield this.hmac("aws4_request",s)}))}signURL(e,t,n,r,a,l,c){return i(this,void 0,void 0,(function*(){const i=this.getDateTimeString(),d=this.getDateString(i);let u="";u=this.chimeClient.config.region instanceof Function?yield this.chimeClient.config.region():this.chimeClient.config.region;const h="host:"+r.toLowerCase()+"\n",p=d+"/"+u+"/"+n+"/aws4_request";let f;f=this.chimeClient.config.credentials instanceof Function?yield this.chimeClient.config.credentials():this.chimeClient.config.credentials;let m=new Map;m.set("X-Amz-Algorithm",["AWS4-HMAC-SHA256"]),m.set("X-Amz-Credential",[encodeURIComponent(f.accessKeyId+"/"+p)]),m.set("X-Amz-Date",[i]),m.set("X-Amz-Expires",["10"]),m.set("X-Amz-SignedHeaders",["host"]),f.sessionToken&&m.set("X-Amz-Security-Token",[encodeURIComponent(f.sessionToken)]),m.set(s.default.X_AMZN_VERSION,[encodeURIComponent(s.default.sdkVersion)]),m.set(s.default.X_AMZN_USER_AGENT,[encodeURIComponent(s.default.sdkUserAgentLowResolution)]),null==c||c.forEach(((e,t)=>{const n=encodeURIComponent(t);e.sort().forEach((e=>{m.has(n)||m.set(n,[]),m.get(n).push(encodeURIComponent(e))}))}));let g="";m=new Map([...m.entries()].sort()),m.forEach(((e,t)=>{e.forEach((e=>{g.length&&(g+="&"),g+=t+"="+e}))}));const v=e+"\n"+a+"\n"+g+"\n"+h+"\nhost\n"+o.toHex(yield this.hmac(l)),b=o.toHex(yield this.hmac(v)),y="AWS4-HMAC-SHA256\n"+i+"\n"+d+"/"+u+"/"+n+"/aws4_request\n"+b,S=yield this.getSignatureKey(f.secretAccessKey,d,u,n),w=o.toHex(yield this.hmac(y,S));return t+"://"+r+a+"?"+g+"&X-Amz-Signature="+w}))}}},7606:(e,t)=>{"use strict";var n;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"}(n=t.SimulcastLayers||(t.SimulcastLayers={})),t.default=n},9880:(e,t)=>{"use strict";var n;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"}(n=t.AudioLogEvent||(t.AudioLogEvent={})),t.default=n},8597:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4571),o=n(6196),s=n(9496),a=n(2811),l=n(7604),c=n(1296),d=n(3922),u=n(289),h=n(8660),p=n(9880),f=n(155);class m{constructor(e,t,n=m.INTERVAL_MS){this.audioVideoController=e,this.logger=t,this.interval=n,this.intervalScheduler=null,this.metricsAddTime=(e,t,n)=>{},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,n){const i=this.toSuffix(e);this.logEventTime("meeting"+i,t,n)}logStateTimeout(e,t){const n=this.toSuffix(e);this.logEvent("meeting_session_state_timeout",Object.assign(Object.assign({},t),{state:`state${n}`}))}logAudioEvent(e,t){const n="audio"+this.toSuffix(p.default[e]);this.logEvent(n,t)}logVideoEvent(e,t){const n="video"+this.toSuffix(f.default[e]);this.logEvent(n,t)}logEventTime(e,t,n={}){const i=Object.assign(Object.assign({},n),{call_id:this.audioVideoController.configuration.meetingId,client_type:m.CLIENT_TYPE,metric_type:"latency"});this.logger.debug((()=>`[StatsCollector] ${e}: ${JSON.stringify(i)}`)),this.metricsAddTime(e,t,i)}logMeetingSessionStatus(e){const t=`${e.statusCode()}`;this.logEvent(t);const n={status:t,status_code:`${e.statusCode()}`};this.logEvent("meeting_session_status",n),e.isTerminal()&&this.logEvent("meeting_session_stopped",n),e.isAudioConnectionFailure()&&this.logEvent("meeting_session_audio_failed",n),e.isFailure()&&this.logEvent("meeting_session_failed",n)}logLifecycleEvent(e,t){const n={lifecycle_event:`lifecycle${this.toSuffix(l.default[e])}`,lifecycle_event_code:`${e}`,lifecycle_event_condition:`condition${this.toSuffix(c.default[t])}`,lifecycle_event_condition_code:`${t}`};this.logEvent("meeting_session_lifecycle",n)}logEvent(e,t={}){const n=Object.assign(Object.assign({},t),{call_id:this.audioVideoController.configuration.meetingId,client_type:m.CLIENT_TYPE});this.logger.debug((()=>`[StatsCollector] ${e}: ${JSON.stringify(n)}`)),this.metricsLogEvent(e,n)}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 d.default(this.interval),this.intervalScheduler.start((()=>i(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 n=t?this.clientMetricReport.streamMetricReports[Number(e.ssrc)]:this.clientMetricReport.globalMetricReport;let i;i=t?this.clientMetricReport.getMetricMap(n.mediaType,n.direction):this.clientMetricReport.getMetricMap();for(const t in e)t in i&&("number"==typeof e[t]?(n.previousMetrics[t]=n.currentMetrics[t],n.currentMetrics[t]=e[t]):"string"==typeof e[t]?n.currentStringMetrics[t]=e[t]:this.logger.error(`Unknown metric value type ${typeof e[t]} for metric ${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 a.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()}addStreamMetricDimensionFrames(e,t){const n=this.clientMetricReport.getStreamDimensionMap();for(const i in t.currentStringMetrics)if(i in n){const r=u.SdkStreamDimension.create();r.type=n[i];const o=u.SdkDimensionValue.create();o.stringValue=t.currentStringMetrics[i],r.value=o,e.dimensions.push(r)}}addMetricFrame(e,t,n,i){const r=n.type,o=n.transform,s=n.source,a=t.streamMetricFrames.length,l=t.streamMetricFrames[a-1];if(r){const n=u.SdkMetric.create();n.type=r,n.value=o(s||e,i),i?l.metrics.push(n):t.globalMetrics.push(n)}}addGlobalMetricsToProtobuf(e){const t=this.clientMetricReport.getMetricMap();for(const n in this.clientMetricReport.globalMetricReport.currentMetrics)this.addMetricFrame(n,e,t[n])}addStreamMetricsToProtobuf(e){for(const t in this.clientMetricReport.streamMetricReports){const n=this.clientMetricReport.streamMetricReports[t],i=u.SdkStreamMetricFrame.create();i.streamId=n.streamId,i.metrics=[],this.addStreamMetricDimensionFrames(i,n),e.streamMetricFrames.push(i);const r=this.clientMetricReport.getMetricMap(n.mediaType,n.direction);for(const i in n.currentMetrics)this.addMetricFrame(i,e,r[i],Number(t));for(const i in n.currentStringMetrics)this.addMetricFrame(i,e,r[i],Number(t))}}makeClientMetricProtobuf(){const e=u.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?s.default.AUDIO:s.default.VIDEO}getDirectionType(e){const{type:t}=e;return"inbound-rtp"===t||"remote-outbound-rtp"===t?o.default.DOWNSTREAM:o.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)===o.default.DOWNSTREAM&&this.getMediaType(e)===s.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 n of e)this.isValidRawMetricReport(n)&&t.push(n);return t}handleRawMetricReports(e){const t=this.filterRawMetricReports(e);this.logger.debug((()=>`Filtered raw metrics : ${JSON.stringify(t)}`)),this.processRawMetricReports(t);const n=this.makeClientMetricProtobuf();this.sendClientMetricProtobuf(n),this.audioVideoController.forEachObserver((e=>{h.Maybe.of(e.metricsDidReceive).map((t=>t.bind(e)(this.clientMetricReport.clone())))}))}getStatsWrapper(){return i(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=m,m.INTERVAL_MS=1e3,m.CLIENT_TYPE="amazon-chime-sdk-js"},155:(e,t)=>{"use strict";var n;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"}(n=t.VideoLogEvent||(t.VideoLogEvent={})),t.default=n},8358:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(155),o=n(1789);class s extends o.default{constructor(e){super(e.logger),this.context=e,this.taskName="AttachMediaInputTask"}run(){return i(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 n=t.getAudioTracks();this.context.logger.info("attaching audio track to peer connection"),yield e.setAudioInput(n.length?n[0]:null)}else yield e.setAudioInput(null),this.context.logger.info("no audio track");const n=this.context.activeVideoInput;if(n){const t=n.getVideoTracks(),i=t.length?t[0]:null;if(this.context.logger.info("attaching video track to peer connection"),yield e.setVideoInput(i),this.context.enableSimulcast&&this.context.videoUplinkBandwidthPolicy){const t=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();e.setEncodingParameters(t)}i&&(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=s},1789:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1124),o=n(4456);t.default=class{constructor(e){this.logger=e,this.taskName="BaseTask",this.parentTask=null,this.status=o.default.IDLE,this.run=this.baseRun.bind(this,this.run),this.cancel=this.baseCancel.bind(this,this.cancel)}once(...e){return new 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 i(this,void 0,void 0,(function*(){try{const t=Date.now();switch(this.logger.info(`running task ${this.name()}`),this.status){case o.default.RUNNING:this.logAndThrow(`${this.name()} is already running`);case o.default.CANCELED:this.logAndThrow(`${this.name()} was canceled before running`);case o.default.FINISHED:this.logAndThrow(`${this.name()} was already finished`)}this.status=o.default.RUNNING,yield e.call(this),this.logger.info(`${this.name()} took ${Math.round(Date.now()-t)} ms`)}catch(e){throw e}finally{this.status!==o.default.CANCELED&&(this.status=o.default.FINISHED)}}))}baseCancel(e){this.status!==o.default.CANCELED&&this.status!==o.default.FINISHED?(this.logger.info(`canceling task ${this.name()}`),this.status=o.default.CANCELED,e.call(this)):this.logger.info(`Not canceling ${this.name()}: state is ${this.status}`)}}},3216:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1789);class o extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="CleanRestartedSessionTask"}run(){return i(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=o},7408:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9416),o=n(1789);class s extends o.default{constructor(e){super(e.logger),this.context=e,this.taskName="CleanStoppedSessionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return i(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 n=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=n,this.context.signalingClient.registerObserver(n)}))}}t.default=s},5482:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1789);class o 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 n=e.streams[0];"audio"===t.kind?this.context.audioMixController.bindAudioStream(n):"video"!==t.kind||this.trackIsVideoInput(t)||this.addRemoteVideoTrack(t,n)}}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 i(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 n;const i=t.id,r=this.context.videoStreamIndex.attendeeIdForTrack(i);let o,s;if(this.context.videoTileController.getVideoTileForAttendeeId?(s=this.context.videoTileController.getVideoTileForAttendeeId(r),o=!!(null===(n=null==s?void 0:s.state())||void 0===n?void 0:n.boundVideoStream)):o=this.context.videoTileController.haveVideoTileForAttendeeId(r),o)return void this.context.logger.info(`Not adding remote track. Already have tile for attendeeId: ${r}`);s||(s=this.context.videoTileController.addVideoTile(),this.logger.info(`Created video tile ${s.id()}`));let a,l,c=this.context.videoStreamIndex.streamIdForTrack(i);void 0===c&&(this.logger.warn(`stream not found for tile=${s.id()} track=${i}`),c=null);for(let n=0;n<this.trackEvents.length;n++){const i=this.trackEvents[n],r=t.getVideoTracks();if(r&&r.length){const t=r[0],n=()=>{this.context.logger.info(`received the ${i} event for tile=${s.id()} id=${e.id} streamId=${c}`),"ended"===i&&this.removeRemoteVideoTrack(e,s.state())};t.addEventListener(i,n),this.removeVideoTrackEventListeners[e.id]||(this.removeVideoTrackEventListeners[e.id]=[]),this.removeVideoTrackEventListeners[e.id].push((()=>{t.removeEventListener(i,n)}))}}if(e.getSettings){const t=e.getSettings();a=t.width,l=t.height}else{const t=e.getCapabilities();a=t.width,l=t.height}const d=this.context.videoStreamIndex.externalUserIdForTrack(i);s.bindVideoStream(r,!1,t,a,l,c,d),this.logger.info(`video track added, use tile=${s.id()} track=${i} streamId=${c}`);const u="removetrack",h=t,p=()=>this.removeRemoteVideoTrack(e,s.state());this.removeTrackRemovedEventListeners[e.id]=()=>{h.removeEventListener(u,p),delete this.removeTrackRemovedEventListeners[e.id]},h.addEventListener(u,p)}removeRemoteVideoTrack(e,t){if(this.removeTrackRemovedEventListeners.hasOwnProperty(e.id)){this.removeTrackRemovedEventListeners[e.id]();for(const t of this.removeVideoTrackEventListeners[e.id])t();delete this.removeVideoTrackEventListeners[e.id]}this.logger.info(`video track ended, removing tile=${t.tileId} id=${e.id} stream=${t.streamId}`),t.streamId?this.context.videosPaused.remove(t.streamId):this.logger.warn(`no stream found for tile=${t.tileId}`),this.context.videoTileController.removeVideoTile(t.tileId)}}t.default=o,o.REMOVE_HANDLER_INTERVAL_MS=1e4},1129:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5687),o=n(326),s=n(1789);class a extends s.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(),n=e||t;return this.context.logger.info(`uses video: ${n} (enabled: true, sending: ${e}, receiving: ${t})`),n}run(){return i(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,n)=>i(this,void 0,void 0,(function*(){this.cancelPromise=e=>{n(e)};try{if(this.context.sdpOfferInit=yield this.context.peer.createOffer(e),this.context.logger.info("peer connection created offer"),this.context.previousSdpOffer&&new o.default(this.context.sdpOfferInit.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 n(e)}t()}catch(e){n(e)}finally{delete this.cancelPromise}}))))}))}}t.default=a},6240:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5687),o=n(326),s=n(1789);class a extends s.default{constructor(e,t=a.CHROME_VPN_TIMEOUT_MS){super(e.logger),this.context=e,this.chromeVpnTimeoutMs=t,this.taskName="FinishGatheringICECandidatesTask"}removeEventListener(){this.context.peer&&(this.context.peer.removeEventListener("icecandidate",this.context.iceCandidateHandler),this.context.turnCredentials||this.context.peer.removeEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler))}cancel(){let e;this.context.browserBehavior.requiresIceCandidateGatheringTimeoutWorkaround()&&this.chromeVpnTimeoutMs<this.context.meetingSessionConfiguration.connectionTimeoutMs&&Date.now()-this.startTimestampMs>this.chromeVpnTimeoutMs&&(e=new Error(`canceling ${this.name()} due to the meeting status code: ${r.default.ICEGatheringTimeoutWorkaround}`)),this.cancelPromise&&(e=e||new Error(`canceling ${this.name()}`),this.cancelPromise(e),delete this.cancelPromise)}run(){return i(this,void 0,void 0,(function*(){if(this.context.peer||this.logAndThrow("session does not have peer connection; bypass ice gathering"),this.context.browserBehavior.requiresCheckForSdpConnectionAttributes()){if(new o.default(this.context.peer.localDescription.sdp).hasCandidatesForAllMLines())return void this.context.logger.info(`ice gathering already complete; bypass gathering, current local description ${this.context.peer.localDescription.sdp}`)}else this.context.logger.info(`iOS device does not require checking for connection attributes in SDP, current local description ${this.context.peer.localDescription.sdp}`);if(!this.context.browserBehavior.hasFirefoxWebRTC()&&"complete"!==this.context.peer.iceGatheringState||!new o.default(this.context.peer.localDescription.sdp).hasCandidates())try{yield new Promise(((e,t)=>{this.cancelPromise=e=>{this.removeEventListener(),t(e)},this.context.turnCredentials||(this.context.iceGatheringStateEventHandler=()=>{if("complete"===this.context.peer.iceGatheringState)return this.removeEventListener(),e(),void delete this.cancelPromise},this.context.peer.addEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler)),this.context.iceCandidateHandler=n=>{if(this.context.logger.info(`ice candidate: ${n.candidate?n.candidate.candidate:"(null)"} state: ${this.context.peer.iceGatheringState}`),n.candidate&&(o.default.isRTPCandidate(n.candidate.candidate)&&this.context.iceCandidates.push(n.candidate),this.context.turnCredentials&&this.context.iceCandidates.length>=1))return this.context.logger.info("gathered at least one relay candidate"),this.removeEventListener(),e(),void delete this.cancelPromise;"complete"===this.context.peer.iceGatheringState&&(this.context.logger.info("done gathering ice candidates"),this.removeEventListener(),new o.default(this.context.peer.localDescription.sdp).hasCandidates()&&0!==this.context.iceCandidates.length?(e(),delete this.cancelPromise):(t(new Error("no ice candidates were gathered")),delete this.cancelPromise))},this.context.peer.addEventListener("icecandidate",this.context.iceCandidateHandler),this.startTimestampMs=Date.now()}))}catch(e){throw e}finally{this.startTimestampMs&&(this.context.iceGatheringDurationMs=Math.round(Date.now()-this.startTimestampMs))}else this.context.logger.info("ice gathering state is complete and candidates are in SDP; bypass gathering")}))}}t.default=a,a.CHROME_VPN_TIMEOUT_MS=5e3},1960:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3789),o=n(5687),s=n(7215),a=n(7103),l=n(9416),c=n(2168),d=n(289),u=n(1789);class h extends u.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 i(this,void 0,void 0,(function*(){const e=yield new Promise(((e,t)=>{const n=this.context;n.turnCredentials=null;const i=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===l.default.WebSocketClosed){let e=`The signaling connection was closed with code ${t.closeCode} and reason: ${t.closeReason}`;n.logger.warn(e);let i=o.default.SignalingBadRequest;return 4410===t.closeCode?(e="The meeting already ended.",n.logger.warn(e),i=o.default.MeetingEnded):t.closeCode>=4500&&t.closeCode<4600&&(i=o.default.SignalingInternalServerError),void n.audioVideoController.handleMeetingSessionStatus(new r.default(i),new Error(e))}if(t.type!==l.default.ReceivedSignalFrame)return;if(t.message.type===d.SdkSignalFrame.Type.JOIN_ACK){const e=t.message.joinack;if(e&&e.videoSubscriptionLimit&&(n.videoSubscriptionLimit=e.videoSubscriptionLimit),n.serverSupportsCompression=null==e?void 0:e.wantsCompressedSdp,void 0!==(null==e?void 0:e.defaultServerSideNetworkAdaption)&&e.defaultServerSideNetworkAdaption!==a.default.Default&&void 0!==n.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption){const t=e.defaultServerSideNetworkAdaption;n.logger.info(`Overriding server side network adaption value to ${t}`),n.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption(a.convertServerSideNetworkAdaptionEnumFromSignaled(t))}return void(e&&e.turnCredentials?(n.turnCredentials=new s.default,n.turnCredentials.username=e.turnCredentials.username,n.turnCredentials.password=e.turnCredentials.password,n.turnCredentials.ttl=e.turnCredentials.ttl,n.turnCredentials.uris=e.turnCredentials.uris.map((e=>n.meetingSessionConfiguration.urls.urlRewriter(e))).filter((e=>!!e))):n.logger.error("missing TURN credentials in JoinAckFrame"))}if(t.message.type!==d.SdkSignalFrame.Type.INDEX)return;this.signalingClient.removeObserver(this);const i=t.message.index;e(i)}}(this.context.signalingClient);this.context.signalingClient.registerObserver(i),this.taskCanceler=i,this.context.previousSdpAnswerAsString="",this.context.previousSdpOffer=null,this.context.serverSupportsCompression=!1;const u=new c.default(this.context.meetingSessionConfiguration.applicationMetadata);void 0!==this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&void 0!==this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions&&(u.serverSideNetworkAdaption=this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption(),u.supportedServerSideNetworkAdaptions=this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions()),this.context.signalingClient.join(u)}));this.context.logger.info(`received first index ${JSON.stringify(e)}`),this.context.indexFrame=e}))}}t.default=h},6180:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9416),o=n(289),s=n(1789);class a extends s.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 i(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 n=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===o.SdkSignalFrame.Type.LEAVE_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("got leave ack"),e())}}(this.context.signalingClient,this.context.logger);this.taskCanceler=n,this.context.signalingClient.registerObserver(n)}))}}t.default=a},2748:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9416),o=n(289),s=n(1789);class a extends s.default{constructor(e){super(e.logger),this.context=e,this.taskName="ListenForVolumeIndicatorsTask",this.realtimeMuteAndUnmuteHandler=e=>{this.context.signalingClient.mute(e)}}run(){return i(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===o.SdkSignalFrame.Type.AUDIO_STREAM_ID_INFO){const t=e.message.audioStreamIdInfo;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioStreamIdInfo(t)}else if(e.message.type===o.SdkSignalFrame.Type.AUDIO_METADATA){const t=e.message.audioMetadata;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioMetadata(t)}}}t.default=a},1981:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(6196),o=n(9496),s=n(2770),a=n(9708),l=n(2977),c=n(1922),d=n(3789),u=n(5687),h=n(9416),p=n(289),f=n(9880),m=n(8660),g=n(1789);class v extends g.default{constructor(e,t,n){super(e.logger),this.context=e,this.initialConnectionHealthData=n,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,n=this.prevSignalStrength<1,i=t?n?null:f.default.RedmicStartLoss:n?f.default.RedmicEndLoss:null;i&&this.context.statsCollector.logAudioEvent(i),this.prevSignalStrength=e},this.realtimeFatalErrorCallback=e=>{this.logger.error(`realtime error: ${e}: ${e.stack}`),this.context.audioVideoController.handleMeetingSessionStatus(new d.default(u.default.RealtimeApiFailed),e)},this.realtimeAttendeeIdPresenceHandler=(e,t)=>{var n;const i=this.context.meetingSessionConfiguration.credentials.attendeeId;this.logger.info(`attendeePresenceReceived: ${i}`),i===e&&t&&!this.presenceHandlerCalled&&(this.presenceHandlerCalled=!0,this.context.attendeePresenceDurationMs=Date.now()-this.context.startAudioVideoTimestamp,null===(n=this.context.eventController)||void 0===n||n.publishEvent("attendeePresenceReceived",{attendeePresenceDurationMs:this.context.attendeePresenceDurationMs}))},this.generateBaseAudioVideoEventAttributes=()=>{const{signalingOpenDurationMs:e,startTimeMs:t,iceGatheringDurationMs:n,attendeePresenceDurationMs:i,meetingStartDurationMs:r}=this.context;return{meetingDurationMs:null===t?0:Math.round(Date.now()-t),signalingOpenDurationMs:e,iceGatheringDurationMs:n,attendeePresenceDurationMs:i,meetingStartDurationMs:r}},this.generateAudioVideoEventAttributesForReceivingAudioDropped=()=>{const e=this.generateBaseAudioVideoEventAttributes();return Object.assign(Object.assign({},e),{maxVideoTileCount:this.context.maxVideoTileCount,poorConnectionCount:this.context.poorConnectionCount})},this.reconnectionHealthPolicy=new a.default(e.logger,Object.assign({},t),this.initialConnectionHealthData.clone()),this.unusableAudioWarningHealthPolicy=new c.default(Object.assign({},t),this.initialConnectionHealthData.clone()),this.sendingAudioFailureHealthPolicy=new l.default(e.logger,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 i(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 n=t.availableOutgoingBitrate,i=t.nackCountReceivedPerSecond;let r=!1;this.context.videoDownlinkBandwidthPolicy.updateMetrics(e);const o=this.context.videoDownlinkBandwidthPolicy.wantsResubscribe();if(r=r||o,o){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=${o}; videosToReceive=[${this.context.videosToReceive.array()}]`)}if(this.context.videoTileController.hasStartedLocalVideoTile()){this.context.videoUplinkBandwidthPolicy.updateConnectionMetric({uplinkKbps:n/1e3,nackCountPerSecond:i});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 n=t.streamMetricReports;if(!n)return;const i=e.getObservableMetrics();this.currentVideoDownlinkBandwidthEstimationKbps=i.availableIncomingBitrate;const a=new Map,l=new Map;for(const e in n)n[e].mediaType===o.default.VIDEO&&n[e].direction===r.default.DOWNSTREAM&&a.set(n[e].streamId,n[e]);let c=!1;for(const e of this.currentAvailableStreamAvgBitrates.bitrates)if(a.has(e.sourceStreamId)){const t=a.get(e.sourceStreamId),n=this.context.videoStreamIndex.attendeeIdForStreamId(e.sourceStreamId);if(!n)continue;const i=new s.default,r=t.previousMetrics.bytesReceived,o=t.currentMetrics.bytesReceived;if(!r||!o)continue;const d=8*(o-r)/1e3;i.expectedAverageBitrateKbps=e.avgBitrateBps/1e3,i.receivedAverageBitrateKbps=d,i.attendeeId=n,d<e.avgBitrateBps/1e3*v.DEFAULT_DOWNLINK_CALLRATE_UNDERSHOOT_FACTOR&&(c=!0),l.set(n,i)}c&&this.logger.info(`One or more video streams are not receiving expected amounts of data ${JSON.stringify(Array.from(l.values()))}`)}connectionHealthDidChange(e){0===e.consecutiveMissedPongs&&this.context.reconnectController&&this.context.reconnectController.setLastActiveTimestampMs(Date.now()),this.applyHealthPolicy(this.reconnectionHealthPolicy,e,(()=>{this.context.audioVideoController.handleMeetingSessionStatus(new d.default(u.default.ConnectionHealthReconnect),null)})),this.applyHealthPolicy(this.unusableAudioWarningHealthPolicy,e,(()=>{var e;this.context.poorConnectionCount+=1;const t=this.generateAudioVideoEventAttributesForReceivingAudioDropped();null===(e=this.context.eventController)||void 0===e||e.publishEvent("receivingAudioDropped",t),this.context.videoTileController.haveVideoTilesWithStreams()?this.context.audioVideoController.forEachObserver((e=>{m.Maybe.of(e.connectionDidSuggestStopVideo).map((t=>t.bind(e)()))})):this.context.audioVideoController.forEachObserver((e=>{m.Maybe.of(e.connectionDidBecomePoor).map((t=>t.bind(e)()))}))}),(()=>{this.context.audioVideoController.forEachObserver((e=>{m.Maybe.of(e.connectionDidBecomeGood).map((t=>t.bind(e)()))}))})),this.applyHealthPolicy(this.sendingAudioFailureHealthPolicy,e,(()=>{var e;const t=this.generateBaseAudioVideoEventAttributes();null===(e=this.context.eventController)||void 0===e||e.publishEvent("sendingAudioFailed",t)}),(()=>{var e;const t=this.generateBaseAudioVideoEventAttributes();null===(e=this.context.eventController)||void 0===e||e.publishEvent("sendingAudioRecovered",t)}))}applyHealthPolicy(e,t,n,i){e.update(t);const r=e.healthIfChanged();null!==r&&(this.logger.info(`${e.name} value is now ${r}`),r<=e.minimumHealth()?m.Maybe.of(n).map((e=>e.bind(this)())):m.Maybe.of(i).map((e=>e.bind(this)())))}handleBitrateFrame(e){let t=0;this.currentAvailableStreamAvgBitrates=e,this.logger.debug((()=>`simulcast: bitrates from server ${JSON.stringify(e)}`));for(const n of e.bitrates)this.context.videosToReceive.contain(n.sourceStreamId)&&(t+=n.avgBitrateBps);t/=1e3,this.currentVideoDownlinkBandwidthEstimationKbps*v.DEFAULT_DOWNLINK_CALLRATE_OVERSHOOT_FACTOR<t&&this.logger.info(`Downlink bandwidth pressure is high: estimated bandwidth ${this.currentVideoDownlinkBandwidthEstimationKbps}Kbps, required bandwidth ${t}Kbps`)}handleSignalingClientEvent(e){var t;if(e.type===h.default.WebSocketClosed&&(4410===e.closeCode||e.closeCode>=4500&&e.closeCode<4600)||e.type===h.default.WebSocketError||e.type===h.default.WebSocketFailed){if(!this.hasSignalingError){const e=this.generateAudioVideoEventAttributesForReceivingAudioDropped();null===(t=this.context.eventController)||void 0===t||t.publishEvent("signalingDropped",e),this.hasSignalingError=!0}}else e.type===h.default.WebSocketOpen&&(this.hasSignalingError=!1);if(e.type===h.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=d.default.fromSignalFrame(e.message);e.message.type!==p.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&t.statusCode()!==u.default.OK&&this.context.audioVideoController.handleMeetingSessionStatus(t,null)}}}t.default=v,v.DEFAULT_DOWNLINK_CALLRATE_OVERSHOOT_FACTOR=2,v.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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(813),r=n(7797);t.default=class{constructor(e,t,n){this.logger=e,this.task=t,this.dependencies=n,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()>i.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,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3920),o=n(9416),s=n(1789);class a extends s.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 i(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 n=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(n){switch(n.type){case o.default.WebSocketOpen:this.signalingClient.removeObserver(this),e();break;case o.default.WebSocketFailed:this.signalingClient.removeObserver(this),t(new Error("WebSocket connection failed"))}}}(this.context.signalingClient);this.context.signalingClient.registerObserver(n),this.taskCanceler=n}))}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=a},8556:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1789);class o extends r.default{constructor(e,t,n){super(e),this.taskName=t,this.tasksToRunParallel=n;for(const e of n)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 i(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 n=0;n<e.length;n++){try{yield e[n]}catch(e){t.push(`task ${this.tasksToRunParallel[n].name()} failed: ${e.message}`)}this.logger.info(`parallel group task ${this.name()} completed subtask ${this.tasksToRunParallel[n].name()}`)}if(t.length>0){const e=t.join(", ");this.logAndThrow(`parallel group task ${this.name()} failed for tasks: ${e}`)}this.logger.info(`parallel group task ${this.name()} completed`)}))}}t.default=o},9945:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3204),o=n(9416),s=n(289),a=n(1789);class l extends a.default{constructor(e,t,n){super(e.logger),this.context=e,this.credentials=t,this.completionCallback=n,this.taskName="PromoteToPrimaryMeetingTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return i(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 n=new class{constructor(e,t,n){this.signalingClient=e,this.completionCallback=t,this.logger=n}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===o.default.ReceivedSignalFrame&&t.message.type===s.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=n,this.context.signalingClient.registerObserver(n)}))}}t.default=l},1209:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1789);class o extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveAudioInputTask"}run(){var e,t;return i(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 n;try{n=yield this.context.mediaStreamBroker.acquireAudioInputStream()}catch(e){this.context.logger.warn("could not acquire audio input from current device")}n?this.context.activeAudioInput=n:this.context.logger.warn("an audio input is not available")}))}}t.default=o},5547:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5687),o=n(7215),s=n(214),a=n(4046),l=n(1789);class c extends l.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 i(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 s.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,n)=>i(this,void 0,void 0,(function*(){this.cancelPromise=e=>{n(e)};try{const i=yield fetch(a.default.urlWithVersion(this.url),e);if(this.context.logger.info("received TURN credentials"),i.status&&403===i.status)return void n(new Error(`canceling ${this.name()} due to the meeting status code: ${r.default.TURNCredentialsForbidden}`));if(i.status&&404===i.status)return void n(new Error(`canceling ${this.name()} due to the meeting status code: ${r.default.MeetingEnded}`));t(yield i.json())}catch(e){n(e)}finally{delete this.cancelPromise}}))));this.context.turnCredentials=new o.default,this.context.turnCredentials.password=t.password,this.context.turnCredentials.ttl=t.ttl,this.context.turnCredentials.uris=t.uris.map((e=>this.context.meetingSessionConfiguration.urls.urlRewriter(e))).filter((e=>!!e)),this.context.turnCredentials.username=t.username}))}}t.default=c},120:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(214),o=n(289),s=n(1789);class a extends s.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveVideoInputTask"}run(){return i(this,void 0,void 0,(function*(){const e=this.context.videoDuplexMode===o.SdkStreamServiceType.RX||this.context.videoDuplexMode===o.SdkStreamServiceType.DUPLEX;if(this.context.videoTileController.hasStartedLocalVideoTile()?this.context.videoDuplexMode=e?o.SdkStreamServiceType.DUPLEX:o.SdkStreamServiceType.TX:this.context.videoDuplexMode=e?o.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 n;try{n=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=n,n){const i=n.getVideoTracks();if(!i||0===i.length)return;const o=this.context.meetingSessionConfiguration.credentials.attendeeId,s=new r.default(o).hasModality(r.default.MODALITY_CONTENT),a=i[0].getSettings();if(this.context.enableSimulcast&&!s){const t=this.context.videoUplinkBandwidthPolicy.chooseMediaTrackConstraints();this.context.logger.info(`simulcast: choose constraint ${JSON.stringify(t)}`);try{yield i[0].applyConstraints(t)}catch(e){this.context.logger.info("simulcast: pass video without more constraint")}}const l=this.context.audioVideoController.configuration.credentials.externalUserId;t.bindVideoStream(o,!0,n,a.width,a.height,null,l);for(let e=0;e<i.length;e++){const t=i[e];this.logger.info(`using video device label=${t.label} id=${t.id}`),this.context.videoDeviceInformation.current_camera_name=t.label,this.context.videoDeviceInformation.current_camera_id=t.id}}}))}}t.default=a},9560:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5723),o=n(214),s=n(2330),a=n(9416),l=n(289),c=n(8660),d=n(1789);class u extends d.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveVideoStreamIndexTask",this.isIngestionPaused=!1,this.pendingIndex=null}removeObserver(){this.context.signalingClient.removeObserver(this)}run(){return i(this,void 0,void 0,(function*(){this.handleIndexFrame(this.context.indexFrame),this.context.signalingClient.registerObserver(this),this.context.removableObservers.push(this)}))}handleSignalingClientEvent(e){if(e.type!==a.default.ReceivedSignalFrame||e.message.type!==l.SdkSignalFrame.Type.INDEX)return;const t=e.message.index;this.context.logger.info(`received new index ${JSON.stringify(t)}`),this.handleIndexFrame(t)}pauseIngestion(){this.isIngestionPaused=!0}resumeIngestion(){this.isIngestionPaused&&(this.isIngestionPaused=!1,this.pendingIndex&&(this.context.logger.info("Resuming index ingestion with pending index"),this.handleIndexFrame(this.pendingIndex)))}handleIndexFrame(e){if(!e)return;if(this.isIngestionPaused)return this.context.logger.info("Index ingestion is paused, setting most recent index as pending"),void(this.pendingIndex=e);this.pendingIndex=null;const t=this.context.audioVideoController.configuration.credentials.attendeeId;e.sources=e.sources.filter((e=>{const n=new o.default(e.attendeeId);return!(n.base()===t&&n.hasModality(o.default.MODALITY_CONTENT))}));const{videoStreamIndex:n,videoDownlinkBandwidthPolicy:i,videoUplinkBandwidthPolicy:r}=this.context,s=n.allVideoSendingSourcesExcludingSelf(t);n.integrateIndexFrame(e),i.updateIndex(n),r.updateIndex(n),this.resubscribe(i,r),this.updateVideoAvailability(e),this.handleIndexVideosPausedAtSource(),e.supportedReceiveCodecIntersection.length>0&&this.handleSupportedVideoReceiveCodecIntersection(e);const a=n.allVideoSendingSourcesExcludingSelf(t);this.areVideoSourcesEqual(s,a)||this.context.audioVideoController.forEachObserver((e=>{c.Maybe.of(e.remoteVideoSourcesDidChange).map((t=>t.bind(e)(a)))}))}areVideoSourcesEqual(e,t){if(e.length!==t.length)return!1;const n=(e,t)=>e.attendee.attendeeId.localeCompare(t.attendee.attendeeId),i=[...e].sort(n),r=[...t].sort(n);for(let e=0;e<i.length;e++)if(i[e].attendee.attendeeId!==r[e].attendee.attendeeId)return!1;return!0}resubscribe(e,t){const n=e.wantsResubscribe(),i=(this.context.videoDuplexMode===l.SdkStreamServiceType.TX||this.context.videoDuplexMode===l.SdkStreamServiceType.DUPLEX)&&t.wantsResubscribe(),r=n||i;if(this.logger.info(`should resubscribe: ${r} (downlink: ${n} uplink: ${i})`),!r)return;const o=e.chooseSubscriptions();this.context.videosToReceive=o.truncate(this.context.videoSubscriptionLimit),o.size()>this.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.context.videoCaptureAndEncodeParameter=t.chooseCaptureAndEncodeParameters(),this.logger.info(`trigger resubscribe for up=${i} down=${n}; 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=>{c.Maybe.of(e.videoAvailabilityDidChange).map((n=>n.bind(e)(t.clone())))})))}handleSupportedVideoReceiveCodecIntersection(e){if(void 0===this.context.videoSendCodecPreferences)return;const t=[];let n=!1;for(const i of this.context.videoSendCodecPreferences){let r=!1;for(const n of e.supportedReceiveCodecIntersection)if(i.equals(s.default.fromSignaled(n))){r=!0,t.push(i);break}!r&&i.equals(this.context.currentVideoSendCodec)&&(n=!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),n&&this.context.audioVideoController.update({needsRenegotiation:!0})}handleIndexVideosPausedAtSource(){const e=this.context.videoStreamIndex.streamsPausedAtSource();for(const t of this.context.videoTileController.getAllVideoTiles()){const n=t.state();e.contain(n.streamId)?t.markPoorConnection()&&this.logger.info(`marks the tile ${n.tileId} as having a poor connection`):t.unmarkPoorConnection()&&this.logger.info(`unmarks the tile ${n.tileId} as having a poor connection`)}}}t.default=u},4191:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1789);class r extends i.default{constructor(e,t,n="RunnableTask"){super(e),this.fn=t,this.taskName=n}run(){return this.fn().then((()=>{}))}}t.default=r},9485:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1018),o=n(9416),s=n(289),a=n(1789);class l extends a.default{constructor(e){super(e.logger),this.context=e,this.taskName="SendAndReceiveDataMessagesTask",this.sendDataMessageHandler=(e,t,n)=>{if(this.context.signalingClient.ready()){let i;i=t instanceof Uint8Array?t:"string"==typeof t?(new TextEncoder).encode(t):(new TextEncoder).encode(JSON.stringify(t)),this.validateDataMessage(e,i,n);const r=s.SdkDataMessagePayload.create();r.topic=e,r.lifetimeMs=n,r.data=i;const o=s.SdkDataMessageFrame.create();o.messages=[r],this.context.signalingClient.sendDataMessage(o)}else this.context.logger.error("Signaling client is not ready")}}run(){return i(this,void 0,void 0,(function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToSendDataMessage(this.sendDataMessageHandler)}))}removeObserver(){this.context.realtimeController.realtimeUnsubscribeFromSendDataMessage(this.sendDataMessageHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(e){if(e.type===o.default.ReceivedSignalFrame&&e.message.type===s.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,n){if(!l.TOPIC_REGEX.test(e))throw new Error("Invalid topic");if(t.length>l.DATA_SIZE)throw new Error("Data size has to be less than 2048 bytes");if(n&&n<0)throw new Error("The life time of the message has to be non negative")}}t.default=l,l.TOPIC_REGEX=new RegExp(/^[a-zA-Z0-9_-]{1,36}$/),l.DATA_SIZE=2048},7079:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1789),o=n(4456);class s extends r.default{constructor(e,t,n){super(e),this.taskName=t,this.tasksToRunSerially=n,this.currentTask=null;for(const e of n)e.setParent(this)}cancel(){this.currentTask&&(this.logger.info(`canceling serial group task ${this.name()} subtask ${this.currentTask.name()}`),this.currentTask.cancel())}run(){return i(this,void 0,void 0,(function*(){for(const e of this.tasksToRunSerially){this.getStatus()===o.default.CANCELED&&this.logAndThrow(`serial group task ${this.name()} was canceled`);try{this.logger.info(`serial group task ${this.name()} running subtask ${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=s},4833:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543),o=n(326),s=n(1789);class a extends s.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 i(this,void 0,void 0,(function*(){const e=this.context.peer;let t=this.context.sdpOfferInit.sdp;this.context.browserBehavior.supportsVideoLayersAllocationRtpHeaderExtension()&&(t=new o.default(t).withVideoLayersAllocationRtpHeaderExtension(this.context.previousSdpOffer).sdp),(new r.default).requiresDisablingH264Encoding()&&(t=new o.default(t).removeH264SupportFromSendSection().sdp),void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(t=new o.default(t).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.audioProfile&&(t=new o.default(t).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(t=new o.default(t).withStereoAudio().sdp)),this.logger.debug((()=>`local description is >>>${t}<<<`));const n={type:"offer",sdp:t,toJSON:null};yield new Promise(((t,r)=>i(this,void 0,void 0,(function*(){this.cancelPromise=e=>{r(e)};try{yield e.setLocalDescription(n),t()}catch(e){r(e)}finally{delete this.cancelPromise}})))),this.context.logger.info("set local description")}))}}t.default=a},5275:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(326),o=n(1789);class s extends o.default{constructor(e){super(e.logger),this.context=e,this.taskName="SetRemoteDescriptionTask"}cancel(){this.cancelICEPromise&&this.cancelICEPromise()}run(){return i(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,n)=>i(this,void 0,void 0,(function*(){const i=()=>{"connected"!==this.context.peer.iceConnectionState&&"completed"!==this.context.peer.iceConnectionState||(this.context.peer.removeEventListener("iceconnectionstatechange",i),t())};this.cancelICEPromise=()=>{this.context.peer&&this.context.peer.removeEventListener("iceconnectionstatechange",i),n(new Error(`${this.name()} got canceled while waiting for the ICE connection state`))},this.context.peer.addEventListener("iceconnectionstatechange",i);try{yield this.context.peer.setRemoteDescription(e),this.logger.info("set remote description, waiting for ICE connection"),i()}catch(e){n(e)}}))))}}t.default=s},5924:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3789),o=n(5687),s=n(326),a=n(3320),l=n(7103),c=n(9416),d=n(6729),u=n(9101),h=n(289),p=n(1789);class f extends p.default{constructor(e){super(e.logger),this.context=e,this.taskName="SubscribeAndReceiveSubscribeAckTask",this.taskCanceler=null,this.textCompressor=new a.default(e.logger)}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return i(this,void 0,void 0,(function*(){let e="";if(this.context.peer&&this.context.peer.localDescription&&(e=new s.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 n={rid:"hi",maxBitrate:1e3*t,maxFramerate:e,active:!0};this.context.videoStreamIndex.integrateUplinkPolicyDecision([n])}this.context.videoStreamIndex.subscribeFrameSent();const t=this.fixUpSubscriptionOrder(e,this.context.videoSubscriptions),n=this.context.videoDuplexMode===h.SdkStreamServiceType.TX||this.context.videoDuplexMode===h.SdkStreamServiceType.DUPLEX;let i;const r=e;if(this.context.serverSupportsCompression){const t=this.context.previousSdpOffer?this.context.previousSdpOffer.sdp:"";i=this.textCompressor.compress(r,t),this.context.logger.info(`Compressed the SDP message from ${r.length} to ${i.length} bytes.`),e=""}this.context.previousSdpOffer=new s.default(r);const o=new d.default(this.context.meetingSessionConfiguration.credentials.attendeeId,e,this.context.meetingSessionConfiguration.urls.audioHostURL,this.context.realtimeController.realtimeIsLocalAudioMuted(),!1,t,n,this.context.videoStreamIndex.localStreamDescriptions(),!0,i);void 0!==this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption()!==l.default.None&&void 0!==this.context.videoDownlinkBandwidthPolicy.getVideoPreferences&&(o.videoSubscriptionConfiguration=this.convertVideoPreferencesToVideoSubscriptionConfiguration(t,this.context.videoDownlinkBandwidthPolicy.getVideoPreferences())),this.context.logger.info(`sending subscribe: ${JSON.stringify(o)}`),this.context.signalingClient.subscribe(o);const a=yield this.receiveSubscribeAck();this.context.logger.info(`got subscribe ack: ${JSON.stringify(a)}`);let c="";a.compressedSdpAnswer&&a.compressedSdpAnswer.length?(c=this.textCompressor.decompress(a.compressedSdpAnswer,this.context.previousSdpAnswerAsString),0===c.length&&(this.context.sdpAnswer="",this.context.previousSdpAnswerAsString="",this.logAndThrow("Error occurred while trying to decompress the SDP answer.")),this.context.logger.info(`Decompressed the SDP message from ${a.compressedSdpAnswer.length} to ${c.length} bytes.`),this.context.sdpAnswer=c):this.context.sdpAnswer=a.sdpAnswer,this.context.previousSdpAnswerAsString=this.context.sdpAnswer,this.context.videoStreamIndex.integrateSubscribeAckFrame(a)}))}fixUpSubscriptionOrder(e,t){if(void 0===this.context.transceiverController.getMidForStreamId)return t;const n=new Map;for(const e of t){const t=this.context.transceiverController.getMidForStreamId(e);void 0!==t?n.set(t,e):0!==e&&this.logger.warn(`Could not find MID for stream ID: ${e}`)}const i=new s.default(e).mediaSections(),r=[];for(const e of i)if("video"===e.mediaType)if("recvonly"===e.direction){const t=n.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 n=new Array,i=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 n=this.context.videoStreamIndex.attendeeIdForStreamId(t);i.set(n,e),r.set(n,this.context.videoStreamIndex.groupIdForStreamId(t))}for(const e of t){const t=new u.default,o=i.get(e.attendeeId);void 0!==o?(t.mid=o,t.attendeeId=e.attendeeId,t.groupId=r.get(e.attendeeId),t.priority=Number.MAX_SAFE_INTEGER-e.priority,t.targetBitrateKbps=e.targetSizeToBitrateKbps(e.targetSize),n.push(t)):this.context.logger.warn(`Could not find MID for attendee ID: ${e.attendeeId}`)}return n}receiveSubscribeAck(){return new Promise(((e,t)=>{const n=this.context,i=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}`;n.logger.warn(e);let i=o.default.TaskFailed;return t.closeCode>=4500&&t.closeCode<4600&&(i=o.default.SignalingInternalServerError),void n.audioVideoController.handleMeetingSessionStatus(new r.default(i),new Error(e))}if(t.type!==c.default.ReceivedSignalFrame||t.message.type!==h.SdkSignalFrame.Type.SUBSCRIBE_ACK)return;this.signalingClient.removeObserver(this);const i=t.message.suback;e(i)}}(this.context.signalingClient);this.context.signalingClient.registerObserver(i),this.taskCanceler=i}))}}t.default=f},4456:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.IDLE="IDLE",e.RUNNING="RUNNING",e.CANCELED="CANCELED",e.FINISHED="FINISHED"}(n||(n={})),t.default=n},250:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4929),o=n(1789);class s extends o.default{constructor(e,t,n){super(e),this.taskToRunBeforeTimeout=t,this.timeoutMs=n,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 i(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=s},6171:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5687),o=n(1789);class s extends o.default{constructor(e){super(e.logger),this.context=e,this.taskName="WaitForAttendeePresenceTask"}cancel(){if(this.cancelPromise){const e=new Error(`canceling ${this.name()} due to the meeting status code: ${r.default.NoAttendeePresent}`);this.cancelPromise(e),delete this.cancelPromise}}run(){return i(this,void 0,void 0,(function*(){const e=this.context.meetingSessionConfiguration.credentials.attendeeId;return new Promise(((t,n)=>{const i=(n,r,o,s,a)=>{e===n&&r&&(this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(i),t(),delete this.cancelPromise)};this.cancelPromise=e=>{this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(i),n(e)},this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(i)}))}))}}t.default=s},365:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.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 n(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 n=Array.from(e.values()),i=t.getParameters();if(i.encodings&&0!==i.encodings.length)for(const e of i.encodings)for(const t of n){if((e.rid||t.rid)&&e.rid!==t.rid)continue;let n;for(n in t)"rid"!==n&&"codecPayloadType"!==n&&t.hasOwnProperty(n)&&(e[n]=t[n])}else i.encodings=n;yield t.setParameters(i)}))}localAudioTransceiver(){return this._localAudioTransceiver}localVideoTransceiver(){return this._localCameraTransceiver}setVideoSendingBitrateKbps(e){return n(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 n=t.getParameters();n.encodings||(n.encodings=[{}]);for(const t of n.encodings)t.maxBitrate=1e3*e;yield t.setParameters(n)}))}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 n(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 n(this,void 0,void 0,(function*(){yield this.setTransceiverInput(this._localAudioTransceiver,e)}))}setVideoInput(e){return n(this,void 0,void 0,(function*(){yield this.setTransceiverInput(this._localCameraTransceiver,e)}))}updateVideoTransceivers(e,t){if(!this.useTransceivers())return t.array();const n=this.peer.getTransceivers();return this.videoSubscriptions=[0],t=t.clone(),this.updateTransceivers(n,e,t),this.logger.debug((()=>this.debugDumpTransceivers())),this.videoSubscriptions}updateTransceivers(e,t,n){const i=n.array();0===e.length||e[0].stop?0!==e.length&&this.updateTransceiverWithStop(e,t,i):(this.logger.info("Updating transceivers without `stop` function"),this.updateTransceiverWithoutStop(e,t,i));for(const e of i){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,n){let i=1;this.videoSubscriptions=[0];for(const r of e){if(r===this._localCameraTransceiver||!this.transceiverIsVideo(r)||!r.mid)continue;let e=!1;const o=t.streamIdForTrack("v_"+r.mid);if("inactive"!==r.direction&&void 0!==o)for(const[s,a]of n.entries())if(t.StreamIdsInSameGroup(o,a)){r.direction="recvonly",this.videoSubscriptions[i]=a,e=!0,this.streamIdToTransceiver.delete(o),this.streamIdToTransceiver.set(a,r),n.splice(s,1);break}if(!e){this.videoSubscriptions[i]=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)}i+=1}}updateTransceiverWithoutStop(e,t,n){let i=1;for(const r of e)if(r!==this._localCameraTransceiver&&this.transceiverIsVideo(r)){if(this.videoSubscriptions[i]=0,"inactive"!==r.direction){const e=t.streamIdForTrack("v_"+r.mid);if(void 0!==e)for(const[o,s]of n.entries())if(t.StreamIdsInSameGroup(e,s)){r.direction="recvonly",this.videoSubscriptions[i]=s,this.streamIdToTransceiver.delete(e),this.streamIdToTransceiver.set(s,r),n.splice(o,1);break}}i+=1}i=1;for(const t of e)if(t!==this._localCameraTransceiver&&this.transceiverIsVideo(t)){if("inactive"===t.direction&&n.length>0){t.direction="recvonly";const e=n.shift();this.videoSubscriptions[i]=e,this.streamIdToTransceiver.set(e,t)}else if(0===this.videoSubscriptions[i]){t.direction="inactive";for(const[e,n]of this.streamIdToTransceiver.entries())t===n&&this.streamIdToTransceiver.delete(e)}i+=1}}getMidForStreamId(e){var t;return null===(t=this.streamIdToTransceiver.get(e))||void 0===t?void 0:t.mid}setStreamIdForMid(e,t){for(const[n,i]of this.streamIdToTransceiver.entries())if(i.mid===e)return this.streamIdToTransceiver.delete(n),void this.streamIdToTransceiver.set(t,i)}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 n of this.peer.getTransceivers())this.transceiverIsVideo(n)&&(e+=`transceiver index=${t} mid=${n.mid} subscription=${this.videoSubscriptions[t]} direction=${n.direction}\n`,t+=1);return e}setTransceiverInput(e,t){return n(this,void 0,void 0,(function*(){e&&(e.direction=t?"sendrecv":"inactive",yield e.sender.replaceTrack(t))}))}}},7377:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5785);class o extends r.default{constructor(e,t){super(e,t);let n=2;this.videoQualityControlParameterMap=new Map;for(let e=0;e<o.NAME_ARR_ASCENDING.length;e++){const t=o.NAME_ARR_ASCENDING[e];this.videoQualityControlParameterMap.set(t,{rid:t,scaleResolutionDownBy:n,maxBitrate:1e3*o.BITRATE_ARR_ASCENDING[e]}),n/=2}}setEncodingParameters(e){return i(this,void 0,void 0,(function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;const t=this._localCameraTransceiver.sender,n=Array.from(e.values());if(n.length<=0)return;const i=t.getParameters();if(i.encodings)for(let t=0;t<i.encodings.length;t++)i.encodings[t].rid===r.default.LOW_LEVEL_NAME&&this.copyEncodingParams(e.get(r.default.LOW_LEVEL_NAME),i.encodings[t]),i.encodings[t].rid===r.default.HIGH_LEVEL_NAME&&this.copyEncodingParams(e.get(r.default.HIGH_LEVEL_NAME),i.encodings[t]);else i.encodings=n;yield t.setParameters(i),this.logVideoTransceiverParameters()}))}}t.default=o,o.NAME_ARR_ASCENDING=["low","hi"],o.BITRATE_ARR_ASCENDING=[300,1200]},5785:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(365);class o extends r.default{constructor(e,t){super(e,t),this.videoQualityControlParameterMap=new Map;let n=4;for(let e=0;e<o.NAME_ARR_ASCENDING.length;e++){const t=o.NAME_ARR_ASCENDING[e];this.videoQualityControlParameterMap.set(t,{rid:t,scaleResolutionDownBy:n,maxBitrate:1e3*o.BITRATE_ARR_ASCENDING[e]}),n/=2}}setEncodingParameters(e){return i(this,void 0,void 0,(function*(){if(!this._localCameraTransceiver||"sendrecv"!==this._localCameraTransceiver.direction)return;const t=this._localCameraTransceiver.sender,n=Array.from(e.values());if(n.length<=0)return;const i=t.getParameters();if(i.encodings)for(let t=0;t<i.encodings.length;t++)i.encodings[t].rid===o.LOW_LEVEL_NAME&&this.copyEncodingParams(e.get(o.LOW_LEVEL_NAME),i.encodings[t]),i.encodings[t].rid===o.MID_LEVEL_NAME&&this.copyEncodingParams(e.get(o.MID_LEVEL_NAME),i.encodings[t]),i.encodings[t].rid===o.HIGH_LEVEL_NAME&&this.copyEncodingParams(e.get(o.HIGH_LEVEL_NAME),i.encodings[t]);else i.encodings=n;yield t.setParameters(i),this.logVideoTransceiverParameters()}))}setVideoSendingBitrateKbps(e){return i(this,void 0,void 0,(function*(){}))}setupLocalTransceivers(){if(this.useTransceivers()&&(this.defaultMediaStream||"undefined"==typeof MediaStream||(this.defaultMediaStream=new MediaStream),this._localAudioTransceiver||(this._localAudioTransceiver=this.peer.addTransceiver("audio",{direction:"inactive",streams:[this.defaultMediaStream]})),!this._localCameraTransceiver)){const e=Array.from(this.videoQualityControlParameterMap.values());this._localCameraTransceiver=this.peer.addTransceiver("video",{direction:"inactive",streams:[this.defaultMediaStream],sendEncodings:e})}}logVideoTransceiverParameters(){const e=this._localCameraTransceiver.sender.getParameters().encodings;let t="simulcast: current encoding parameters \n";for(const n of e)t+=`rid=${n.rid} maxBitrate=${n.maxBitrate} active=${n.active} scaleDownBy=${n.scaleResolutionDownBy} maxFrameRate = ${n.maxFramerate} \n`;this.logger.info(t)}copyEncodingParams(e,t){t.active=e.active,t.maxBitrate=e.maxBitrate,t.scaleResolutionDownBy=e.scaleResolutionDownBy,t.maxFramerate=e.maxFramerate}}t.default=o,o.LOW_LEVEL_NAME="low",o.MID_LEVEL_NAME="mid",o.HIGH_LEVEL_NAME="hi",o.NAME_ARR_ASCENDING=["low","mid","hi"],o.BITRATE_ARR_ASCENDING=[200,400,1100]},9354:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(365);class r extends i.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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TRANSCRIPTION_DATA_MESSAGE_TOPIC=void 0;const i=n(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 i.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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TranscriptEventConverter=void 0;const i=n(289),r=n(4739),o=n(1288),s=n(1326),a=n(6864),l={[i.SdkTranscriptionStatus.Type.STARTED]:s.default.STARTED,[i.SdkTranscriptionStatus.Type.INTERRUPTED]:s.default.INTERRUPTED,[i.SdkTranscriptionStatus.Type.RESUMED]:s.default.RESUMED,[i.SdkTranscriptionStatus.Type.STOPPED]:s.default.STOPPED,[i.SdkTranscriptionStatus.Type.FAILED]:s.default.FAILED};t.TranscriptEventConverter=class{static from(e){let t;try{t=i.SdkTranscriptFrame.decode(e.data)}catch(e){throw new Error("Cannot decode transcript data message: "+e)}const n=[];for(const e of t.events)if(e.status){const t=l[e.status.type];if(!t)continue;const i=new o.default;i.type=t,i.eventTimeMs=e.status.eventTime,i.transcriptionRegion=e.status.transcriptionRegion,i.transcriptionConfiguration=e.status.transcriptionConfiguration,e.status.message&&(i.message=e.status.message),n.push(i)}else if(e.transcript){const t=new r.default;t.results=[];for(const n of e.transcript.results){const e={channelId:n.channelId,isPartial:n.isPartial,resultId:n.resultId,startTimeMs:n.startTime,endTimeMs:n.endTime,alternatives:[]};if(n.languageCode&&(e.languageCode=n.languageCode),n.languageIdentification&&n.languageIdentification.length>0){e.languageIdentification=[];for(const t of n.languageIdentification){const n={languageCode:t.languageCode,score:t.score};e.languageIdentification.push(n)}}for(const t of n.alternatives){const n={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 i.SdkTranscriptItem.Type.PRONUNCIATION:t.type=a.default.PRONUNCIATION;break;case i.SdkTranscriptItem.Type.PUNCTUATION:t.type=a.default.PUNCTUATION}n.items.push(t)}for(const e of t.entities){n.entities||(n.entities=[]);const t={category:e.category,confidence:e.confidence,content:e.content,startTimeMs:e.startTime,endTimeMs:e.endTime};e.type&&(t.type=e.type),n.entities.push(t)}e.alternatives.push(n)}t.results.push(e)}n.push(t)}return n}}},1741:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},6864:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.PRONUNCIATION="pronunciation",e.PUNCTUATION="punctuation"}(n||(n={})),t.default=n},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 n;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.STARTED="started",e.INTERRUPTED="interrupted",e.RESUMED="resumed",e.STOPPED="stopped",e.FAILED="failed"}(n||(n={})),t.default=n},8627:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2238),r=n(4046);class o{constructor(e){var t,n,r,s,a,l,c;try{this.parserResult=navigator&&navigator.userAgent?new i.UAParser(navigator.userAgent).getResult():void 0}catch(t){e.error(t.message)}this.browserMajorVersion=(null===(r=null===(n=null===(t=this.parserResult)||void 0===t?void 0:t.browser)||void 0===n?void 0:n.version)||void 0===r?void 0:r.split(".")[0])||o.UNAVAILABLE,this.browserName=(null===(s=this.parserResult)||void 0===s?void 0:s.browser.name)||o.UNAVAILABLE,this.browserVersion=(null===(a=this.parserResult)||void 0===a?void 0:a.browser.version)||o.UNAVAILABLE,this.deviceName=[(null===(l=this.parserResult)||void 0===l?void 0:l.device.vendor)||"",(null===(c=this.parserResult)||void 0===c?void 0:c.device.model)||""].join(" ").trim()||o.UNAVAILABLE}getParserResult(){var e,t;return{browserMajorVersion:this.browserMajorVersion,browserName:this.browserName,browserVersion:this.browserVersion,deviceName:this.deviceName,osName:(null===(e=this.parserResult)||void 0===e?void 0:e.os.name)||o.UNAVAILABLE,osVersion:(null===(t=this.parserResult)||void 0===t?void 0:t.os.version)||o.UNAVAILABLE,sdkVersion:r.default.sdkVersion,sdkName:r.default.sdkName}}}t.default=o,o.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,n)=>{this.queue=this.queue.then(e).then(t).catch(n)}))}}},8660:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.None=t.Some=t.Maybe=void 0;class n{static of(e){return null==e?r.of():i.of(e)}}t.Maybe=n;class i{constructor(e){this.value=e,this.isSome=!0,this.isNone=!1}map(e){return n.of(e(this.value))}flatMap(e){return e(this.value)}get(){return this.value}getOrElse(e){return this.value}defaulting(e){return n.of(this.getOrElse(e))}static of(e){if(null==e)throw new Error("value is ${value}");return new i(e)}}t.Some=i;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 n.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(((n,i)=>{const r=t[i],o="object"==typeof r?e(r):r;return n[i.toLowerCase()]=o,n}),{})}},4046:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(543),r=n(2336);class o{static get sdkName(){return"amazon-chime-sdk-js"}static get sdkVersion(){return r.default.semverString}static get sdkVersionSemVer(){var e,t,n,i;const o=r.default.semverString.match(/^(?<major>[0-9]+)\.(?<minor>[0-9]+)((?:\.(?<patch>[0-9]+))(?:-(?<preRelease>[a-zA-Z]+(\.[0-9])*))?)?/);return{major:null===(e=null==o?void 0:o.groups)||void 0===e?void 0:e.major,minor:null===(t=null==o?void 0:o.groups)||void 0===t?void 0:t.minor,patch:null===(n=null==o?void 0:o.groups)||void 0===n?void 0:n.patch,preRelease:null===(i=null==o?void 0:o.groups)||void 0===i?void 0:i.preRelease}}static get buildSHA(){return r.default.hash.substr(1)}static get sdkUserAgentLowResolution(){const e=new i.default;return`${e.name()}-${e.majorVersion()}`}static urlWithVersion(e){const t=new URL(e);return t.searchParams.append(o.X_AMZN_VERSION,o.sdkVersion),t.searchParams.append(o.X_AMZN_USER_AGENT,o.sdkUserAgentLowResolution),t.toString()}}t.default=o,o.X_AMZN_VERSION="X-Amzn-Version",o.X_AMZN_USER_AGENT="X-Amzn-User-Agent"},2336:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={hash:"e6cf38a",raw:"v3.10.0",semverString:"3.10.0"}},1133:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(e,t,n,i,r,o=1){this.cameraWidth=e,this.cameraHeight=t,this.cameraFrameRate=n,this.maxEncodeBitrateKbps=i,this.isSimulcast=r,this.scaleResolutionDownBy=o}equal(e){let t=e.captureWidth()===this.cameraWidth&&e.captureHeight()===this.cameraHeight&&e.captureFrameRate()===this.cameraFrameRate&&e.encodeBitrates().length===this.encodeBitrates().length&&e.encodeScaleResolutionDownBy().length===this.encodeScaleResolutionDownBy().length&&e.encodeWidths().length===this.encodeWidths().length&&e.encodeHeights().length===this.encodeHeights().length;if(t)for(let n=0;n<e.encodeWidths().length;n++)if(e.encodeWidths()[n]!==this.encodeWidths()[n]||e.encodeHeights()[n]!==this.encodeHeights()[n]||e.encodeBitrates()[n]!==this.encodeBitrates()[n]||e.encodeScaleResolutionDownBy()[n]!==this.encodeScaleResolutionDownBy()[n])return t=!1,t;return t}clone(){return new n(this.cameraWidth,this.cameraHeight,this.cameraFrameRate,this.maxEncodeBitrateKbps,this.isSimulcast,this.scaleResolutionDownBy)}captureWidth(){return this.cameraWidth}captureHeight(){return this.cameraHeight}captureFrameRate(){return this.cameraFrameRate}encodeBitrates(){return[this.maxEncodeBitrateKbps]}encodeScaleResolutionDownBy(){return[this.scaleResolutionDownBy]}encodeWidths(){return[this.cameraWidth]}encodeHeights(){return[this.cameraHeight]}}t.default=n},5185:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1508);t.default=class{constructor(e){this.selfAttendeeId=e,this.reset()}reset(){this.optimalReceiveSet=new i.default,this.subscribedReceiveSet=new i.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 i.default;if(!this.videoIndex||this.videoIndex.allStreams().empty())return t;const n=e.highestQualityStreamFromEachGroupExcludingSelf(this.selfAttendeeId);if(void 0===this.videoSources)return n;const r=this.videoIndex.remoteStreamDescriptions(),o=new Map;for(const e of r)n.contain(e.streamId)&&o.set(e.attendeeId,e.streamId);for(const e of this.videoSources){const n=e.attendee.attendeeId;o.has(n)&&t.add(o.get(n))}return t}}},5319:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1508);t.default=class{reset(){}updateIndex(e){}updateMetrics(e){}wantsResubscribe(){return!1}chooseSubscriptions(){return new i.default}}},2721:(e,t)=>{"use strict";var n;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"}(n=t.TargetDisplaySize||(t.TargetDisplaySize={})),t.default=n},2880:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8890),r=n(1754),o=n(1819),s=n(4992);class a extends s.default{constructor(e){super(e),this.logger=e,super.shouldPauseTiles=!1,this.videoPreferences=void 0}reset(){super.reset(),super.shouldPauseTiles=!1,this.videoPreferences=void 0}updateIndex(e){super.updateIndex(e);const t=o.VideoPreferences.prepare();let n=!1;const s=e.remoteStreamDescriptions();for(const e of s)t.some((t=>t.attendeeId===e.attendeeId))||(e.attendeeId.endsWith(i.default.Modality)?(t.add(new r.default(e.attendeeId,1)),n=!0):t.add(new r.default(e.attendeeId,2)));n?(this.videoPreferences=t.build(),this.videoPreferencesUpdated=!0):this.videoPreferences=void 0}chooseRemoteVideoSources(e){this.logger.error("chooseRemoteVideoSources should not be called by VideoAdaptiveProbePolicy")}}t.default=a},1754:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(2721);class r{constructor(e,t,n){this.attendeeId=e,this.priority=t,this.targetSize=void 0!==n?n:i.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 i.default.High:return r.HIGH_BITRATE_KBPS;case i.default.Medium:return r.MID_BITRATE_KBPS;case i.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 n{constructor(e=[]){this.items=e}static default(){return new n([])}[Symbol.iterator](){let e=0;const t=this.items;return{next:()=>e<t.length?{done:!1,value:t[e++]}:{done:!0,value:null}}}first(){return this.items[0]}add(e){this.items.push(e)}replaceFirst(e,t){const n=this.items.findIndex(t);-1===n?this.items.push(e):this.has(e)?this.items.splice(n,1):this.items[n]=e}remove(e){this.items=this.items.filter((t=>!t.equals(e)))}clear(){this.items=[]}isEmpty(){return 0===this.items.length}equals(e){if(e===this)return!0;if(e.items.length!==this.items.length)return!1;for(const t of this.items)if(!e.items.some((e=>e.equals(t))))return!1;return!0}has(e){return this.items.some((t=>t.equals(e)))}some(e){return this.items.some(e)}clone(){return new n([...this.items])}sort(){this.items.sort(((e,t)=>e.partialCompare(t)))}modify(){return new i(this)}}class i{constructor(e=new n){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 o(this.builder.build())}}t.MutableVideoPreferences=r;class o{constructor(e){this.items=e}static prepare(){return new r(new i)}static default(){return new o(n.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=o.prepare();for(const t of this.items)e.add(t.clone());return e.build()}}t.VideoPreferences=o,t.default=o},4992:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6196),r=n(9496),o=n(8890),s=n(813),a=n(7103),l=n(1508),c=n(2721),d=n(1754),u=n(1819),h=n(1034);class p{constructor(){this.bandwidthEstimateKbps=0,this.usedBandwidthKbps=0,this.packetsLost=0,this.nackCount=0,this.rttMs=0}}class f{constructor(e,t=h.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 l.default,this.optimalReceiveStreams=[],this.optimalNonPausedReceiveStreams=[],this.subscribedReceiveSet=new l.default,this.subscribedReceiveStreams=[],this.videoPreferences=void 0,this.defaultVideoPreferences=void 0,this.shouldPauseTiles=!0,this.pausedStreamIds=new l.default,this.pausedBwAttendeeIds=new Set,this.videoPreferencesUpdated=!1,this.logCount=0,this.startupPeriod=!0,this.usingPrevTargetRate=!1,this.rateProbeState="Not Probing",this.firstEstimateTimestamp=0,this.lastUpgradeRateKbps=0,this.timeBeforeAllowSubscribeMs=f.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.lastProbeTimestamp=Date.now(),this.timeBeforeAllowProbeMs=f.MIN_TIME_BETWEEN_PROBE_MS,this.downlinkStats=new p,this.prevDownlinkStats=new p,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=u.VideoPreferences.prepare(),n=e.size;let i=c.default.High;n>8?i=c.default.Low:n>4&&(i=c.default.Medium);for(const n of e)t.add(new d.default(n,1,i));this.defaultVideoPreferences=t.build()}updateMetrics(e){if(!this.videoIndex||this.videoIndex.allStreams().empty())return;this.prevDownlinkStats=this.downlinkStats,this.downlinkStats=new p;const t=e.getObservableMetrics();this.downlinkStats.bandwidthEstimateKbps=t.availableIncomingBitrate/1e3;for(const t in e.streamMetricReports){const n=Number.parseInt(t,10),o=e.streamMetricReports[n];o.direction===i.default.DOWNSTREAM&&o.mediaType===r.default.VIDEO&&(o.currentMetrics.hasOwnProperty("nackCount")&&(this.downlinkStats.nackCount+=e.countPerSecond("nackCount",n)),o.currentMetrics.hasOwnProperty("packetsLost")&&(this.downlinkStats.packetsLost+=e.countPerSecond("packetsLost",n)),o.currentMetrics.hasOwnProperty("bytesReceived")&&(this.downlinkStats.usedBandwidthKbps+=e.bitsPerSecond("bytesReceived",n)/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=[],n=this.videoIndex.remoteStreamDescriptions();if(0===n.length||(null===(e=this.videoPreferences)||void 0===e?void 0:e.isEmpty()))return void(this.optimalReceiveStreams=[]);const i=this.rateProbeState;this.cleanBwPausedTiles(n),this.handleAppPausedStreams(t,n);const r=this.availStreamsSameAsLast(n),l=!this.startupPeriod&&r;if(l&&Date.now()-this.lastSubscribeTimestamp<this.timeBeforeAllowSubscribeMs)return;n.sort(((e,t)=>e.maxBitrateKbps===t.maxBitrateKbps?e.streamId-t.streamId:e.maxBitrateKbps-t.maxBitrateKbps));for(const e of n)(0===e.avgBitrateKbps||e.avgBitrateKbps>e.maxBitrateKbps)&&(e.attendeeId.endsWith(o.default.Modality)&&e.maxBitrateKbps<100?e.maxBitrateKbps=e.avgBitrateKbps:e.avgBitrateKbps=e.maxBitrateKbps);const c={targetDownlinkBitrate:0,chosenTotalBitrate:0,deltaToNextUpgrade:0};c.targetDownlinkBitrate=this.determineTargetRate();const d=this.subscribedReceiveSet.size(),u=this.downlinkStats.bandwidthEstimateKbps,h=!this.videoPriorityBasedPolicyConfig.allowSubscribe(d,u);if(this.probeFailed&&(this.probeFailed=!1,this.timeBeforeAllowSubscribeMs=f.MIN_TIME_BETWEEN_SUBSCRIBE_MS,l&&h))return;const p=this.priorityPolicy(c,n,t);let m=0;if(this.serverSideNetworkAdaption!==a.default.None&&this.serverSideNetworkAdaption!==a.default.Default||this.startupPeriod||!r?(this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0):"Probing"===this.rateProbeState?m=this.handleProbe(t,c.targetDownlinkBitrate):0!==c.deltaToNextUpgrade&&(m=this.maybeOverrideOrProbe(t,c,p)),this.prevRemoteInfos=n,this.videoPreferencesUpdated=!1,1===m)return this.logger.info(`bwe: keepSameSubscriptions stats:${JSON.stringify(this.downlinkStats)}`),void(this.prevTargetRateKbps=c.targetDownlinkBitrate);if(2===m){const e=this.calculateSubscribeRate(this.preProbeNonPausedReceiveStreams);return this.optimalReceiveStreams=this.preProbeReceiveStreams.slice(),this.processBwPausedStreams(n,this.preProbeNonPausedReceiveStreams),void this.logger.info("bwe: Use Pre-Probe subscription subscribedRate:"+e)}this.optimalNonPausedReceiveStreams=t.slice();const g=this.pausedBwAttendeeIds.size;this.processBwPausedStreams(n,t),this.logger.getLogLevel()<=s.LogLevel.INFO&&(this.logCount%15==0||this.rateProbeState!==i||this.optimalReceiveStreams.length!==t.length||g!==this.pausedBwAttendeeIds.size)&&(this.logger.info(this.policyStateLogStr(n,c.targetDownlinkBitrate)),this.logCount=0),this.logCount++,this.prevTargetRateKbps=c.targetDownlinkBitrate,this.optimalReceiveStreams=t.slice()}calculateOptimalReceiveSet(){const e=new l.default;this.calculateOptimalReceiveStreams();for(const t of this.optimalReceiveStreams)e.add(t.streamId);if(!this.optimalReceiveSet.equal(e)){const t=this.calculateSubscribeRate(this.optimalReceiveStreams);this.logger.info(`bwe: new streamSelection: ${JSON.stringify(e)} subscribedRate:${t}`)}this.optimalReceiveSet=e}determineTargetRate(){let e=0;const t=Date.now();return 0!==this.downlinkStats.bandwidthEstimateKbps?(0===this.firstEstimateTimestamp&&(this.firstEstimateTimestamp=t),this.startupPeriod&&(this.downlinkStats.bandwidthEstimateKbps>f.DEFAULT_BANDWIDTH_KBPS||this.downlinkStats.packetsLost>0||t-this.firstEstimateTimestamp>f.STARTUP_PERIOD_MS&&this.downlinkStats.bandwidthEstimateKbps<=this.prevDownlinkStats.bandwidthEstimateKbps)&&(this.startupPeriod=!1,this.prevTargetRateKbps=this.downlinkStats.bandwidthEstimateKbps),this.startupPeriod?e=f.DEFAULT_BANDWIDTH_KBPS:"Probing"===this.rateProbeState&&this.downlinkStats.usedBandwidthKbps>this.downlinkStats.bandwidthEstimateKbps&&this.downlinkStats.packetsLost<f.SPURIOUS_PACKET_LOST_THRESHOLD?(this.logger.info(`bwe: In probe state, overriding estimate ${this.downlinkStats.bandwidthEstimateKbps} with actual receive bitrate ${this.downlinkStats.usedBandwidthKbps}`),e=this.downlinkStats.usedBandwidthKbps+f.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS):e=this.downlinkStats.bandwidthEstimateKbps):e=0===this.firstEstimateTimestamp?f.DEFAULT_BANDWIDTH_KBPS:this.prevTargetRateKbps,!this.startupPeriod&&(this.usingPrevTargetRate&&this.downlinkStats.bandwidthEstimateKbps<this.prevTargetRateKbps||this.downlinkStats.bandwidthEstimateKbps<this.prevTargetRateKbps*(100-f.LARGE_RATE_CHANGE_TRIGGER_PERCENT)/100||this.downlinkStats.bandwidthEstimateKbps<this.downlinkStats.usedBandwidthKbps*f.LARGE_RATE_CHANGE_TRIGGER_PERCENT/100)&&0===this.downlinkStats.packetsLost?(this.logger.debug((()=>"bwe: ValidateRate: Using Previous rate "+this.prevTargetRateKbps)),this.usingPrevTargetRate=!0,e=this.prevTargetRateKbps):this.usingPrevTargetRate=!1,e}setProbeState(e){if(this.rateProbeState===e)return!1;const t=Date.now();switch(e){case"Not Probing":this.probePendingStartTimestamp=0;break;case"Probe Pending":if(!(0===this.lastProbeTimestamp||t-this.lastProbeTimestamp>f.MIN_TIME_BETWEEN_PROBE_MS))return!1;this.probePendingStartTimestamp=t;break;case"Probing":if(!(t-this.probePendingStartTimestamp>this.timeBeforeAllowProbeMs))return!1;this.lastProbeTimestamp=t,this.preProbeReceiveStreams=this.subscribedReceiveStreams.slice(),this.preProbeNonPausedReceiveStreams=this.optimalNonPausedReceiveStreams,this.timeBeforeAllowProbeMs=Math.min(2*this.timeBeforeAllowProbeMs,f.MAX_HOLD_BEFORE_PROBE_MS)}return this.logger.info("bwe: setProbeState to "+e+" from "+this.rateProbeState),this.rateProbeState=e,!0}upgradeToStream(e,t){for(let n=0;n<e.length;n++)if(e[n].groupId===t.groupId){const i=t.avgBitrateKbps-e[n].avgBitrateKbps;return this.logger.info("bwe: upgradeStream from "+JSON.stringify(e[n])+" to "+t),this.lastUpgradeRateKbps=i,e[n]=t,i}return e.push(t),this.lastUpgradeRateKbps=t.avgBitrateKbps,this.lastUpgradeRateKbps}handleProbe(e,t){if(Date.now()-this.lastProbeTimestamp>f.MAX_ALLOWED_PROBE_TIME_MS)return this.logger.info("bwe: Canceling probe due to timeout"),this.setProbeState("Not Probing"),0;if(this.downlinkStats.packetsLost>0&&(this.logger.info(`bwe: Probe encountering packets lost:${this.downlinkStats.packetsLost}`),this.downlinkStats.packetsLost>f.SPURIOUS_PACKET_LOST_THRESHOLD))return this.setProbeState("Not Probing"),this.logger.info(`bwe: Canceling probe due to packets lost:${this.downlinkStats.packetsLost}`),this.probeFailed=!0,this.timeBeforeAllowSubscribeMs=3*Math.max(f.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.timeBeforeAllowSubscribeMs),2;const n=this.calculateSubscribeRate(this.optimalReceiveStreams);return this.chosenStreamsSameAsLast(e)||t>n?(this.logger.info("bwe: Probe successful"),this.setProbeState("Not Probing"),this.timeBeforeAllowProbeMs=f.MIN_TIME_BETWEEN_PROBE_MS,0):1}maybeOverrideOrProbe(e,t,n){const i=this.chosenStreamsSameAsLast(e);let r=0;const o=t.targetDownlinkBitrate>f.LOW_BITRATE_THRESHOLD_KBPS?f.TARGET_RATE_CHANGE_TRIGGER_PERCENT:2*f.TARGET_RATE_CHANGE_TRIGGER_PERCENT,s=t.targetDownlinkBitrate*o/100;if(this.targetRateBaselineForDeltaCheckKbps=void 0!==this.targetRateBaselineForDeltaCheckKbps?this.targetRateBaselineForDeltaCheckKbps:this.prevTargetRateKbps,!i&&Math.abs(t.targetDownlinkBitrate-this.targetRateBaselineForDeltaCheckKbps)<s?(this.logger.info("bwe: MaybeOverrideOrProbe: Reuse last decision based on delta rate. {"+JSON.stringify(this.subscribedReceiveSet)+"}"),r=1):this.targetRateBaselineForDeltaCheckKbps=t.targetDownlinkBitrate,this.downlinkStats.packetsLost>this.prevDownlinkStats.packetsLost)return this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0,r;if(i||1===r)switch(this.rateProbeState){case"Not Probing":this.setProbeState("Probe Pending");break;case"Probe Pending":this.setProbeState("Probing")&&(this.upgradeToStream(e,n),r=0)}else this.setProbeState("Not Probing");return r}calculateSubscribeRate(e){let t=0;for(const n of e)this.pausedStreamIds.contain(n.streamId)||this.pausedBwAttendeeIds.has(n.attendeeId)||(t+=n.maxBitrateKbps);return t}handleAppPausedStreams(e,t){if(!this.tileController)return void this.logger.warn("tileController not found!");this.pausedStreamIds=new l.default;const n=this.tileController.getAllRemoteVideoTiles();for(const i of n){const n=i.state();if(n.paused&&!this.pausedBwAttendeeIds.has(n.boundAttendeeId)){let i=t.length;for(;i--;)t[i].attendeeId===n.boundAttendeeId&&(this.logger.info("bwe: removed paused attendee "+n.boundAttendeeId+" streamId: "+t[i].streamId),this.pausedStreamIds.add(t[i].streamId),this.subscribedReceiveSet.contain(t[i].streamId)&&e.push(t[i]),t.splice(i,1))}}}processBwPausedStreams(e,t){if(!this.tileController)return void this.logger.warn("tileController not found!");const n=this.getCurrentVideoPreferences();if(n&&this.shouldPauseTiles){const i=this.tileController.getAllVideoTiles();for(const r of n){const n=this.getVideoTileForAttendeeId(r.attendeeId,i),o=(null==n?void 0:n.state().paused)||!1;if(t.some((e=>e.attendeeId===r.attendeeId)))o&&this.pausedBwAttendeeIds.has(r.attendeeId)&&(this.logger.info(`bwe: unpausing attendee ${r.attendeeId} due to bandwidth`),this.forEachObserver((e=>{e.tileWillBeUnpausedByDownlinkPolicy(n.id())})),this.tileController.unpauseVideoTile(n.id()),this.pausedBwAttendeeIds.delete(r.attendeeId));else{const i=e.some((e=>e.attendeeId===r.attendeeId));if(n&&i){const e=this.optimalReceiveStreams.find((e=>e.attendeeId===r.attendeeId));void 0!==e&&(o||(this.logger.info(`bwe: pausing streamId ${e.streamId} attendee ${r.attendeeId} due to bandwidth`),this.forEachObserver((e=>{e.tileWillBePausedByDownlinkPolicy(n.id())})),this.tileController.pauseVideoTile(n.id())),t.push(e)),this.pausedBwAttendeeIds.add(r.attendeeId)}else if(i){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(),n=this.getCurrentVideoPreferences();for(const i of t){const t=i.state();t.boundVideoStream||(e.some((e=>e.attendeeId===t.boundAttendeeId))?void 0===n||n.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,n){let i;const r=this.getCurrentVideoPreferences(),s=r.highestPriority();let a,l=s;for(;-1!==l;){a=-1;for(const o of r)if(o.priority===l)for(const r of t)r.attendeeId===o.attendeeId&&(n.some((e=>e.groupId===r.groupId))||(e.chosenTotalBitrate+r.avgBitrateKbps<=e.targetDownlinkBitrate?(n.push(r),e.chosenTotalBitrate+=r.avgBitrateKbps):0===e.deltaToNextUpgrade&&(e.deltaToNextUpgrade=r.avgBitrateKbps,i=r)));else if(o.priority>l){a=o.priority;break}for(const s of r)if(s.priority===l){for(const r of t)if(r.attendeeId===s.attendeeId){const a=n.findIndex((e=>e.groupId===r.groupId&&e.maxBitrateKbps<r.maxBitrateKbps));if(-1!==a){const l=r.avgBitrateKbps-n[a].avgBitrateKbps;this.hasSimulcastStreams(t,r.attendeeId,r.groupId)&&this.canUpgrade(r.avgBitrateKbps,s.targetSize,s.targetSizeToBitrateKbps(s.targetSize),r.attendeeId.endsWith(o.default.Modality))?(this.logger.info(`bwe: attendee: ${r.attendeeId} group: ${r.groupId} has simulcast and can upgrade avgBitrate: ${r.avgBitrateKbps} target: ${s.targetSizeToBitrateKbps(s.targetSize)} targetTotalBitrate: ${e.targetDownlinkBitrate}`),e.chosenTotalBitrate+l<=e.targetDownlinkBitrate?(e.chosenTotalBitrate+=l,n[a]=r):0===e.deltaToNextUpgrade&&(e.deltaToNextUpgrade=l,i=r)):this.logger.info("bwe: cannot upgrade stream quality beyond target size")}}}else if(s.priority>l)break;if(l===s&&0!==e.deltaToNextUpgrade)break;l=a}return i}getVideoTileForAttendeeId(e,t){for(const n of t)if(n.state().boundAttendeeId===e)return n;return null}canUpgrade(e,t,n,i){let r=!1;return i?(t===c.default.High||t===c.default.Medium&&e<=n)&&(r=!0):e<=n&&(r=!0),r?(this.logger.info(`bwe: canUpgrade: bitrateKbp: ${e} targetBitrateKbp: ${n}`),!0):(this.logger.info(`bwe: cannot Upgrade: bitrateKbp: ${e} targetBitrateKbp: ${n}`),!1)}hasSimulcastStreams(e,t,n){let i=0;for(const r of e)r.attendeeId===t&&r.groupId===n&&i++;return this.logger.info(`bwe: attendeeId: ${t} groupId: ${n} hasSimulcastStreams: streamCount: ${i}`),i>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 n={targetBitrate:t,subscribedRate:this.calculateSubscribeRate(this.optimalReceiveStreams),probeState:this.rateProbeState,startupPeriod:this.startupPeriod};let i="remoteInfos: [";for(const t of e)i+=`{grpId:${t.groupId} strId:${t.streamId} maxBr:${t.maxBitrateKbps} avgBr:${t.avgBitrateKbps}}, `;i+="]";let r=`bwe: optimalReceiveSet ${JSON.stringify(n)}\nbwe: prev ${JSON.stringify(this.prevDownlinkStats)}\nbwe: now ${JSON.stringify(this.downlinkStats)}\nbwe: ${i}\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[a.default.None,a.default.BandwidthProbing]}getVideoPreferences(){let e=this.getCurrentVideoPreferences();return e||(e=u.VideoPreferences.prepare().build()),e}}t.default=f,f.DEFAULT_BANDWIDTH_KBPS=2800,f.STARTUP_PERIOD_MS=6e3,f.LARGE_RATE_CHANGE_TRIGGER_PERCENT=20,f.TARGET_RATE_CHANGE_TRIGGER_PERCENT=15,f.LOW_BITRATE_THRESHOLD_KBPS=300,f.MIN_TIME_BETWEEN_PROBE_MS=5e3,f.MIN_TIME_BETWEEN_SUBSCRIBE_MS=2e3,f.MAX_HOLD_BEFORE_PROBE_MS=3e4,f.MAX_ALLOWED_PROBE_TIME_MS=6e4,f.SPURIOUS_PACKET_LOST_THRESHOLD=2,f.USED_BANDWIDTH_OVERRIDE_BUFFER_KBPS=100},1034:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(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=i.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 n=0;const i=this.currentNetworkEvent;if(t>this.referenceBitrate)return this.currentNetworkEvent=2,this.referenceBitrate=t,!0;if(t<this.referenceBitrate){if(this.currentNetworkEvent=1,n=this.getSubscribeDelay(this.currentNetworkEvent,e),1!==i)this.bandwidthDecreaseTimestamp=Date.now();else if(Date.now()-this.bandwidthDecreaseTimestamp>n)return this.referenceBitrate=t,!0;return!1}return this.currentNetworkEvent=0,!1}getSubscribeDelay(e,t){let n=r.MINIMUM_DELAY_MS;const i=r.MAXIMUM_DELAY_MS-r.MINIMUM_DELAY_MS,o=this.networkIssueResponseDelayFactor;return 1===e&&(n+=i*o*(1+t/10),n=Math.min(r.MAXIMUM_DELAY_MS,n)),n}}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 n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.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 n(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,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(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=>i(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,n=[];n.push(this.sourceBuffers[0]);try{for(const e of this.processors)n=yield e.process(n)}catch(e){return void this.forEachObserver((e=>{e.processingDidFailToStart&&e.processingDidFailToStart()}))}this.destBuffers=n;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 i=t.width,r=t.height;0!==i&&0!==r&&(this.canvasOutput.width!==i&&this.canvasOutput.height!==r&&(this.canvasOutput.width=i,this.canvasOutput.height=r),this.outputCtx.drawImage(t,0,0,i,r,0,0,i,r),this.hasStarted||(this.hasStarted=!0,this.forEachObserver((e=>{e.processingDidStart&&e.processingDidStart()}))));const o=performance.now()-e,s=2e3/this.framerate-o,a=Math.max(0,1e3/this.framerate-o);s<=0&&this.forEachObserver((e=>{e.processingLatencyTooHigh&&e.processingLatencyTooHigh(o)})),this.lastTimeOut=setTimeout(this.process,a)}))}destroy(){if(this.stop(),this.stages)for(const e of this.stages)e.destroy()}get framerate(){return this.fr}set framerate(e){this.fr=e<0?15:e}stop(){if(this.videoInput.removeEventListener("loadedmetadata",this.process),this.videoInput.srcObject=null,this.destroyInputMediaStreamAndBuffers(),this.outputMediaStream)for(const e of this.outputMediaStream.getVideoTracks())e.stop();this.lastTimeOut&&(clearTimeout(this.lastTimeOut),this.lastTimeOut=void 0),this.hasStarted&&(this.hasStarted=!1,this.forEachObserver((e=>{e.processingDidStop&&e.processingDidStop()})))}addObserver(e){this.observers.add(e)}removeObserver(e){this.observers.delete(e)}getInputMediaStream(){return i(this,void 0,void 0,(function*(){return this.inputVideoStream}))}getActiveOutputMediaStream(){return this.isOutputMediaStreamActive()||(this.outputMediaStream=this.canvasOutput.captureStream(this.framerate),this.cloneInputAudioTracksToOutput()),this.outputMediaStream}setInputMediaStream(e){return i(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 n=new r.default(this.canvasInput);this.sourceBuffers.push(n),this.videoInput.load();try{yield this.videoInput.play()}catch(e){this.logger.warn("Video element play() overrided by another load().")}this.cloneInputAudioTracksToOutput()}))}cloneInputAudioTracksToOutput(){if(this.isOutputMediaStreamActive()&&null!==this.inputVideoStream){for(const e of this.outputMediaStream.getAudioTracks())this.logger.info(`Removing audio track ${e.id} from output stream`),this.outputMediaStream.removeTrack(e);for(const e of this.inputVideoStream.getAudioTracks())this.logger.info(`Adding audio track ${e.id} to output stream`),this.outputMediaStream.addTrack(e)}else this.logger.info("Not cloning input audio tracks to output, do not have media streams ready")}isOutputMediaStreamActive(){return this.outputMediaStream&&this.outputMediaStream.active}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,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543),o=n(8919);class s{constructor(e,t,n,i=new r.default){this.logger=e,this.device=t,this.processors=n,this.browserBehavior=i,this.observers=new Set,this.pipe=new o.default(this.logger,this.processors),this.pipe.addObserver(this)}get outputMediaStream(){return this.pipe.outputMediaStream}chooseNewInnerDevice(e){const t=new s(this.logger,e,this.processors,this.browserBehavior);return t.pipe=this.pipe,t}getInnerDevice(){return this.device}intrinsicDevice(){return i(this,void 0,void 0,(function*(){return this.device}))}transformStream(e){return i(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 i(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=s},2801:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{process(e){return n(this,void 0,void 0,(function*(){return e}))}destroy(){return n(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 n{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(),n=e.array();if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}clone(){return new n(this.array())}remove(e){this.ids.delete(e)}toJSON(){return this.array()}truncate(e){const t=this.array();return new n(t.splice(0,e))}}t.default=n},1318:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(289),r=n(1508),o=n(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 o.default,this.videoStreamDescription.trackLabel="AmazonChimeExpressVideo",this.videoStreamDescription.streamId=2,this.videoStreamDescription.groupId=2}localStreamDescriptions(){return[this.videoStreamDescription.clone()]}convertBpsToKbps(e){return e>0&&e<1e3?1:Math.trunc(e/1e3)}remoteStreamDescriptions(){if(!this.currentIndex||!this.currentIndex.sources)return[];const e=[];return this.currentIndex.sources.forEach((t=>{const n=new o.default;n.attendeeId=t.attendeeId,n.groupId=t.groupId,n.streamId=t.streamId,n.maxBitrateKbps=t.maxBitrateKbps,n.avgBitrateKbps=this.convertBpsToKbps(t.avgBitrateBps),e.push(n)})),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 n=!1;for(const i of e.sources){if(!t.has(i.attendeeId)){t.set(i.attendeeId,i.groupId);continue}const e=t.get(i.attendeeId);e<i.groupId&&(this.logger.warn(`Old group ID ${e} found for attendee ID ${i.attendeeId}, replacing with newer group ID ${i.groupId}`),t.set(i.attendeeId,i.groupId)),n=!0}n&&(this.currentIndex.sources=this.currentIndex.sources.filter((e=>t.get(e.attendeeId)===e.groupId))),this.streamToAttendeeMap=null,this.streamToExternalUserIdMap=null}subscribeFrameSent(){this.indexForSubscribe=this.currentIndex}integrateSubscribeAckFrame(e){this.currentSubscribeAck=e,this.subscribeTrackToStreamMap=this.buildTrackToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToStreamMap=this.buildSSRCToStreamMap(this.currentSubscribeAck),this.subscribeStreamToAttendeeMap=this.buildStreamToAttendeeMap(this.indexForSubscribe),this.subscribeStreamToExternalUserIdMap=this.buildStreamExternalUserIdMap(this.indexForSubscribe)}integrateBitratesFrame(e){if(this.currentIndex)for(const t of e.bitrates){const e=this.currentIndex.sources.find((e=>e.streamId===t.sourceStreamId));void 0!==e&&(e.avgBitrateBps=t.avgBitrateBps)}}allStreams(){const e=new r.default;if(this.currentIndex)for(const t of this.currentIndex.sources)e.add(t.streamId);return e}allVideoSendingSourcesExcludingSelf(e){const t=[],n=new Set;if(this.currentIndex&&this.currentIndex.sources&&this.currentIndex.sources.length)for(const r of this.currentIndex.sources){const{attendeeId:o,externalUserId:s,mediaType:a}=r;o!==e&&a===i.SdkStreamMediaType.VIDEO&&(n.has(o)||(t.push({attendee:{attendeeId:o,externalUserId:s}}),n.add(o)))}return t}streamSelectionUnderBandwidthConstraint(e,t,n,o){const s=new Set;if(this.currentIndex)for(const r of this.currentIndex.sources)r.attendeeId!==e&&r.mediaType===i.SdkStreamMediaType.VIDEO&&(t.has(r.attendeeId)||n.has(r.attendeeId)||s.add(r.attendeeId));const a=this.buildAttendeeToSortedStreamDescriptorMapExcludingSelf(e),l=new Map;let c=0;a.forEach(((e,t)=>{l.set(t,e[0]),c+=e[0].maxBitrateKbps})),c=this.trySelectHighBitrateForAttendees(a,t,c,o,l),this.trySelectHighBitrateForAttendees(a,s,c,o,l);const d=new r.default;for(const e of l.values())d.add(e.streamId);return d}highestQualityStreamFromEachGroupExcludingSelf(e){const t=new r.default;if(this.currentIndex){const n=new Map;for(const t of this.currentIndex.sources)t.attendeeId!==e&&t.mediaType===i.SdkStreamMediaType.VIDEO&&(!n.has(t.groupId)||t.maxBitrateKbps>n.get(t.groupId).maxBitrateKbps)&&n.set(t.groupId,t);for(const e of n.values())t.add(e.streamId)}return t}numberOfVideoPublishingParticipantsExcludingSelf(e){return this.highestQualityStreamFromEachGroupExcludingSelf(e).array().length}numberOfParticipants(){return this.currentIndex.numParticipants?this.currentIndex.numParticipants:-1}attendeeIdForTrack(e){const t=this.streamIdForTrack(e);return void 0!==t&&this.subscribeStreamToAttendeeMap?this.subscribeStreamToAttendeeMap.get(t)||(this.logger.info(`track ${e} (stream ${t}) does not correspond to a known attendee`),""):(this.logger.warn(`no attendee found for track ${e}`),"")}externalUserIdForTrack(e){const t=this.streamIdForTrack(e);return void 0!==t&&this.subscribeStreamToExternalUserIdMap?this.subscribeStreamToExternalUserIdMap.get(t)||(this.logger.info(`track ${e} (stream ${t}) does not correspond to a known externalUserId`),""):(this.logger.warn(`no external user id found for track ${e}`),"")}attendeeIdForStreamId(e){if(!this.streamToAttendeeMap){if(!this.currentIndex)return"";this.streamToAttendeeMap=this.buildStreamToAttendeeMap(this.currentIndex)}return this.streamToAttendeeMap.get(e)||(this.logger.info(`stream ${e}) does not correspond to a known attendee`),"")}groupIdForStreamId(e){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[n,i]of this.subscribeTrackToStreamMap.entries())if(e===i){this.subscribeTrackToStreamMap.set(n,t);break}if(this.subscribeSsrcToStreamMap)for(const[n,i]of this.subscribeSsrcToStreamMap.entries())if(e===i){this.subscribeSsrcToStreamMap.set(n,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 n of e.tracks)n.trackLabel.length>0&&n.streamId>0&&t.set(n.trackLabel,n.streamId);return t}buildSSRCToStreamMap(e){const t=new Map;this.logger.debug((()=>`ssrcMap ${JSON.stringify(e.tracks)}`));for(const n of e.tracks)n.trackLabel.length>0&&n.streamId>0&&t.set(n.ssrc,n.streamId);return t}buildStreamToAttendeeMap(e){const t=new Map;if(e)for(const n of e.sources)t.set(n.streamId,n.attendeeId);return t}buildStreamExternalUserIdMap(e){const t=new Map;if(e)for(const n of e.sources)n.externalUserId&&t.set(n.streamId,n.externalUserId);return t}trySelectHighBitrateForAttendees(e,t,n,i,r){for(const o of t){if(n>=i)break;if(e.has(o)){const t=e.get(o);for(const e of t.reverse())if(n-r.get(o).maxBitrateKbps+e.maxBitrateKbps<i){n=n-r.get(o).maxBitrateKbps+e.maxBitrateKbps,r.set(o,e);break}}}return n}buildAttendeeToSortedStreamDescriptorMapExcludingSelf(e){const t=new Map;if(this.currentIndex)for(const n of this.currentIndex.sources)n.attendeeId!==e&&n.mediaType===i.SdkStreamMediaType.VIDEO&&(t.has(n.attendeeId)?t.get(n.attendeeId).push(n):t.set(n.attendeeId,[n]));return t.forEach(((e,t)=>{e.sort(((e,t)=>e.maxBitrateKbps>t.maxBitrateKbps?1:e.maxBitrateKbps<t.maxBitrateKbps?-1:0))})),t}}},4242:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(289),r=n(1318),o=n(6876);class s 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,n=0;for(let i=0;i<e.length;i++){const r=e[i].maxBitrate/1e3,s=e[i].maxFramerate;if(t&&i!==this._localStreamInfos.length)0===this._localStreamInfos[n].maxBitrateKbps&&r>0&&(this._localStreamInfos[n].timeEnabled=Date.now()),this._localStreamInfos[n].maxBitrateKbps=r,this._localStreamInfos[n].maxFrameRate=s,this._localStreamInfos[n].disabledByUplinkPolicy=0===r,!0===this._localStreamInfos[n].disabledByUplinkPolicy&&(this._localStreamInfos[n].disabledByWebRTC=!1),n++;else{t=!1;const e=new o.default;e.maxBitrateKbps=r,e.maxFrameRate=s,e.disabledByUplinkPolicy=0===r,0!==r&&(e.timeEnabled=Date.now()),this._localStreamInfos.push(e),n++}}t&&this._localStreamInfos.splice(n)}integrateBitratesFrame(e){super.integrateBitratesFrame(e);const t=new Set,n=new Set(this.streamIdToBitrateKbpsMap.keys());for(const n of e.bitrates)t.add(n.sourceStreamId),this.streamIdToBitrateKbpsMap.set(n.sourceStreamId,this.convertBpsToKbps(n.avgBitrateBps));for(const e of n)t.has(e)||(this.streamIdToBitrateKbpsMap.get(e)===s.UNSEEN_STREAM_BITRATE?this.streamIdToBitrateKbpsMap.set(e,s.RECENTLY_INACTIVE_STREAM_BITRATE):this.streamIdToBitrateKbpsMap.set(e,s.NOT_SENDING_STREAM_BITRATE));for(let e=0;e<this._localStreamInfos.length;e++){this._localStreamInfos[e].disabledByWebRTC=!1;const t=this._localStreamInfos[e].streamId;this._localStreamInfos[e].disabledByUplinkPolicy||(this.streamIdToBitrateKbpsMap.has(t)?this.streamIdToBitrateKbpsMap.get(t)===s.NOT_SENDING_STREAM_BITRATE&&this._lastBitRateMsgTime-this._localStreamInfos[e].timeEnabled>s.BitratesMsgFrequencyMs&&(this._localStreamInfos[e].disabledByWebRTC=!0):this._lastBitRateMsgTime-this._localStreamInfos[e].timeEnabled>s.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,n=new Set(this.streamIdToBitrateKbpsMap.keys());for(const e of this.currentIndex.sources)e.mediaType===i.SdkStreamMediaType.VIDEO&&(t.add(e.streamId),this.streamIdToBitrateKbpsMap.has(e.streamId)||this.streamIdToBitrateKbpsMap.set(e.streamId,s.UNSEEN_STREAM_BITRATE));for(const e of n)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 n of e.allocations){if(this._localStreamInfos.length<t+1){this.logger.info("simulcast: allocation has more than number of local streams");break}this._localStreamInfos[t].groupId=n.groupId,this._localStreamInfos[t].streamId=n.streamId,this.streamIdToBitrateKbpsMap.has(n.streamId)||this.streamIdToBitrateKbpsMap.set(n.streamId,s.UNSEEN_STREAM_BITRATE),t++}}}t.default=s,s.UNSEEN_STREAM_BITRATE=-2,s.RECENTLY_INACTIVE_STREAM_BITRATE=-1,s.NOT_SENDING_STREAM_BITRATE=0,s.BitratesMsgFrequencyMs=4e3},6876:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(289);class r{constructor(e,t,n,i,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=n,this.maxBitrateKbps=i,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=i.SdkStreamDescriptor.create();return e.mediaType=i.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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(543),r=n(214),o=n(7804);class s{constructor(e,t,n,i){this.tileController=n,this.devicePixelRatioMonitor=i,this.tileState=new o.default,this.tileState.tileId=e,this.tileState.localTile=t,this.devicePixelRatioMonitor.registerObserver(this)}static connectVideoStreamToVideoElement(e,t,n){const r=n&&"environment"!==e.getVideoTracks()[0].getSettings().facingMode?"rotateY(180deg)":"";if(s.setVideoElementFlag(t,"disablePictureInPicture",n),s.setVideoElementFlag(t,"disableRemotePlayback",n),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 i.default).requiresVideoPlayWorkaround()&&t.paused)){const e=t.play();void 0!==e&&e.catch((e=>{console.warn("Error playing video in Safari",e)})).then((()=>{console.debug("Video played successfully in Safari")}))}}static disconnectVideoStreamFromVideoElement(e,t,n=!1){if(e)if(t)n||(e.srcObject=null,e.style.transform="");else{if(!e.srcObject)return;e.pause(),e.style.transform="",s.setVideoElementFlag(e,"disablePictureInPicture",!1),s.setVideoElementFlag(e,"disableRemotePlayback",!1),e.srcObject=null}}destroy(){this.devicePixelRatioMonitor.removeObserver(this),this.tileState.boundVideoElement&&this.tileState.boundVideoElement.srcObject===this.tileState.boundVideoStream&&s.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,!1),this.tileState=new o.default}devicePixelRatioChanged(e){this.tileState.devicePixelRatio=e,this.sendTileStateUpdate()}id(){return this.tileState.tileId}state(){return this.tileState.clone()}stateRef(){return this.tileState}bindVideoStream(e,t,n,i,o,s,a){let l=!1;this.tileState.boundAttendeeId!==e&&(this.tileState.boundAttendeeId=e,new r.default(e).hasModality(r.default.MODALITY_CONTENT)&&(this.tileState.isContent=!0),l=!0),this.tileState.boundExternalUserId!==a&&(this.tileState.boundExternalUserId=a,l=!0),this.tileState.localTile!==t&&(this.tileState.localTile=t,l=!0),this.tileState.boundVideoStream!==n&&(this.tileState.boundVideoStream=n,l=!0),this.tileState.videoStreamContentWidth!==i&&(this.tileState.videoStreamContentWidth=i,l=!0),this.tileState.videoStreamContentHeight!==o&&(this.tileState.videoStreamContentHeight=o,l=!0),this.tileState.streamId!==s&&(this.tileState.streamId=s,l=!0),l&&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 n=e.getContext("2d");return n.drawImage(t,0,0,e.width,e.height),n.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?s.connectVideoStreamToVideoElement(this.tileState.boundVideoStream,this.tileState.boundVideoElement,this.tileState.localTile):s.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,this.tileState.paused,this.tileController.keepLastFrameWhenPaused)}static setVideoElementFlag(e,t,n){t in e&&(e[t]=n)}}t.default=s},7804:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{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 n;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=n},2958:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(8236),o=n(9190),s=n(8660),a=n(3327);t.default=class{constructor(e,t,n){this.tileFactory=e,this.audioVideoController=t,this.logger=n,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 o.default,this.logger))}discardDevicePixelRatioMonitorIfNotNeeded(){return i(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 n=this.getVideoTile(e);null!==n?n.bindVideoElement(t):this.logger.warn(`Ignoring video element binding for unknown tile id ${e}`)}unbindVideoElement(e,t=!0){const n=this.getVideoTile(e);if(null===n)return void this.logger.warn(`Ignoring video element unbinding for unknown tile id ${e}`);this.logger.info("Unbinding the video element");const i=n.stateRef().boundVideoElement;n.bindVideoElement(null),t&&(this.logger.info("Cleaning up the video element"),a.default.disconnectVideoStreamFromVideoElement(i,!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 n=0,i=0;return t.boundVideoElement&&(n=t.boundVideoElement.clientHeight*t.devicePixelRatio,i=t.boundVideoElement.clientWidth*t.devicePixelRatio),n*i}getAllRemoteVideoTiles(){const e=new Array;return this.tileMap.forEach(((t,n)=>{this.currentLocalTile&&n===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 n=this.tileFactory.makeTile(t,e,this,this.devicePixelRatioMonitor);return this.tileMap.set(t,n),n}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=>{s.Maybe.of(t.videoTileWasRemoved).map((n=>n.bind(t)(e)))})),this.discardDevicePixelRatioMonitorIfNotNeeded()}removeVideoTilesByAttendeeId(e){const t=[];for(const n of this.getAllVideoTiles()){const i=n.state();i.boundAttendeeId===e&&(this.removeVideoTile(i.tileId),t.push(i.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=>{s.Maybe.of(t.videoTileDidUpdate).map((n=>n.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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(3327);t.default=class{makeTile(e,t,n,r){return new i.default(e,t,n,r)}}},9394:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},4450:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(7606),r=n(5785),o=n(8660),s=n(1133),a=n(9394);class l{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=l.defaultUplinkBandwidthKbps,this.startTimeMs=0,this.lastUpdatedMs=Date.now(),this.videoIndex=null,this.currLocalDescriptions=[],this.nextLocalDescriptions=[],this.observerQueue=new Set,this.optimalParameters=new s.default(0,0,0,0,!0),this.parametersInEffect=new s.default(0,0,0,0,!0),this.lastUplinkBandwidthKbps=l.defaultUplinkBandwidthKbps,this.currentQualityMap=this.fillEncodingParamWithBitrates([300,0,1200]),this.newQualityMap=this.fillEncodingParamWithBitrates([300,0,1200])}updateConnectionMetric({uplinkKbps:e=0}){if(isNaN(e))return;0===this.startTimeMs&&(this.startTimeMs=Date.now()),Date.now()-this.startTimeMs<l.startupDurationMs?this.lastUplinkBandwidthKbps=l.defaultUplinkBandwidthKbps:this.lastUplinkBandwidthKbps=e,this.logger.debug((()=>`simulcast: uplink policy update metrics ${this.lastUplinkBandwidthKbps}`));let t=l.holdDownDurationMs;3===this.currentActiveStreams?t=2*l.holdDownDurationMs:(2===this.currentActiveStreams&&e<=l.kMidDisabledRate||1===this.currentActiveStreams&&e<=l.kHiDisabledRate)&&(t=l.holdDownDurationMs/2),Date.now()<this.lastUpdatedMs+t||(this.newQualityMap=this.calculateEncodingParameters(!1))}calculateEncodingParameters(e){const t=[new a.default,new a.default,new a.default];let n=0,i=0;if(0===this.currentActiveStreams?(n=this.lastUplinkBandwidthKbps+1,i=0):1===this.currentActiveStreams?(n=2400,i=l.kHiDisabledRate):2===this.currentActiveStreams?(n=1e3,i=l.kMidDisabledRate):(n=300,i=0),e||this.lastUplinkBandwidthKbps>=n||this.lastUplinkBandwidthKbps<=i){this.shouldDisableSimulcast?(this.newActiveStreams=0,t[0].maxBitrateKbps=0,t[1].maxBitrateKbps=1200,t[2].maxBitrateKbps=0):this.numSenders<=4&&this.lastUplinkBandwidthKbps>=l.kHiDisabledRate?(this.newActiveStreams=1,t[0].maxBitrateKbps=300,t[1].maxBitrateKbps=0,t[2].maxBitrateKbps=1200):this.lastUplinkBandwidthKbps>=l.kMidDisabledRate?(this.newActiveStreams=2,t[0].maxBitrateKbps=this.lastUplinkBandwidthKbps>=350?200:150,t[1].maxBitrateKbps=this.numSenders<=6?600:350,t[2].maxBitrateKbps=0):(this.newActiveStreams=3,t[0].maxBitrateKbps=300,t[1].maxBitrateKbps=0,t[2].maxBitrateKbps=0);const e=t.map(((e,t,n)=>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,n=t!==this.numSenders,i=e.numberOfParticipants(),r=i>=0&&i<=2,o=this.shouldDisableSimulcast!==r;this.numSenders=t,this.shouldDisableSimulcast=r,this.optimalParameters=new s.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1),this.videoIndex=e,this.newQualityMap=this.calculateEncodingParameters(n||o)}wantsResubscribe(){let e=!this.encodingParametersEqual();this.nextLocalDescriptions=this.videoIndex.localStreamDescriptions();for(let t=0;t<this.nextLocalDescriptions.length;t++){const n=this.nextLocalDescriptions[t].streamId;if(0!==n&&n){const i=this.currLocalDescriptions.findIndex((e=>e.streamId===n));-1!==i&&this.nextLocalDescriptions[t].disabledByWebRTC!==this.currLocalDescriptions[i].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,n=r.default.NAME_ARR_ASCENDING,i=e;let o=this.shouldDisableSimulcast?1:4;for(let e=0;e<n.length;e++){const r=n[e];t.set(r,{rid:r,active:i[e]>0,scaleResolutionDownBy:Math.max(o,1),maxBitrate:1e3*i[e]}),o/=2}return t}getQualityMapString(e){let t="";const n=this.videoIndex.localStreamDescriptions();return 3===n.length&&e.forEach((e=>{let i=!1;i="low"===e.rid?n[0].disabledByWebRTC:"mid"===e.rid?n[1].disabledByWebRTC:n[2].disabledByWebRTC,t+=`{ rid: ${e.rid} active:${e.active} disabledByWebRTC: ${i} maxBitrate:${e.maxBitrate}}`})),t}getEncodingSimulcastLayer(e){switch(e){case 0:return i.default.High;case 1:return i.default.LowAndHigh;case 2:return i.default.LowAndMedium;case 3:return i.default.Low}}publishEncodingSimulcastLayer(){const e=this.getEncodingSimulcastLayer(this.activeStreamsToPublish);this.forEachObserver((t=>{o.Maybe.of(t.encodingSimulcastLayersDidChange).map((n=>n.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=l,l.defaultUplinkBandwidthKbps=1200,l.startupDurationMs=6e3,l.holdDownDurationMs=4e3,l.defaultMaxFrameRate=15,l.kHiDisabledRate=700,l.kMidDisabledRate=240},3879:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(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,n,r,o,s,a,l,c,d,u,h;const p=new Map,f=i.default.NAME_ARR_ASCENDING;return p.set(f[0],{rid:f[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===(n=this.encodingParams)||void 0===n?void 0:n.low)||void 0===r?void 0:r.maxBitrateKbps)||300),maxFramerate:(null===(s=null===(o=this.encodingParams)||void 0===o?void 0:o.low)||void 0===s?void 0:s.maxFramerate)||5}),p.set(f[1],{rid:f[1],active:!0,scaleResolutionDownBy:(null===(l=null===(a=this.encodingParams)||void 0===a?void 0:a.high)||void 0===l?void 0:l.scaleResolutionDownBy)||1,maxBitrate:1e3*((null===(d=null===(c=this.encodingParams)||void 0===c?void 0:c.high)||void 0===d?void 0:d.maxBitrateKbps)||1200),maxFramerate:null===(h=null===(u=this.encodingParams)||void 0===u?void 0:u.high)||void 0===h?void 0:h.maxFramerate}),this.getQualityMapString(p),p}updateIndex(e){this.videoIndex=e}wantsResubscribe(){var e,t;let n=!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 i=this.currLocalDescriptions.findIndex((e=>e.streamId===t));-1!==i&&this.nextLocalDescriptions[e].disabledByWebRTC!==this.currLocalDescriptions[i].disabledByWebRTC&&(n=!0)}}return this.currLocalDescriptions=this.nextLocalDescriptions,n}chooseCaptureAndEncodeParameters(){}maxBandwidthKbps(){return 1200}setIdealMaxBandwidthKbps(e){}setHasBandwidthPriority(e){}getQualityMapString(e){var t;let n="";const i=null===(t=this.videoIndex)||void 0===t?void 0:t.localStreamDescriptions();(null==i?void 0:i.length)>0&&(e.forEach((e=>{let t=!1;t="low"===e.rid?i[0].disabledByWebRTC:i[1].disabledByWebRTC,n+=`{ 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: ${n}`))}addObserver(e){}removeObserver(e){}forEachObserver(e){}}},4442:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1133);class o{constructor(e,t=!0,n,i){this.selfAttendeeId=e,this.scaleResolution=t,this.logger=n,this.browserBehavior=i,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(o.encodingMapKey,{maxBitrate:0})}updateConnectionMetric(e){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(e){var t;let n=!0,i=1;this.transceiverController&&(n=this.transceiverController.hasVideoInput());const o=e.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+(n?1:0);if(this.numberOfPublishedVideoSources!==o){if(this.numberOfPublishedVideoSources=o,this.transceiverController){const e=this.getStreamCaptureSetting();e&&(i=this.calculateEncodingParameters(e).scaleResolutionDownBy)}this.optimalParameters=new r.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1,i)}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 i(this,void 0,void 0,(function*(){const e=this.getStreamCaptureSetting();if(!e)return;const t=this.calculateEncodingParameters(e);this.shouldUpdateEndcodingParameters(t)&&(this.encodingParamMap.set(o.encodingMapKey,t),this.transceiverController.setEncodingParameters(this.encodingParamMap))}))}shouldUpdateEndcodingParameters(e){var t,n;const i=null===(n=null===(t=this.transceiverController.localVideoTransceiver().sender.getParameters())||void 0===t?void 0:t.encodings)||void 0===n?void 0:n[0];return e.maxBitrate!==(null==i?void 0:i.maxBitrate)||e.scaleResolutionDownBy!==(null==i?void 0:i.scaleResolutionDownBy)}calculateEncodingParameters(e){var t,n;const i=1e3*this.maxBandwidthKbps();let r=1;if(void 0!==e.height&&void 0!==e.width&&this.scaleResolution&&!this.hasBandwidthPriority&&this.getNumberOfPublishedVideoSources()>2){let i=o.targetHeightArray[Math.min(this.getNumberOfPublishedVideoSources(),o.targetHeightArray.length-1)];480===i&&(null===(t=this.browserBehavior)||void 0===t?void 0:t.disable480pResolutionScaleDown())&&(i=360),r=Math.max(Math.min(e.height,e.width)/i,1),null===(n=this.logger)||void 0===n||n.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:i}}getStreamCaptureSetting(){var e,t,n,i;return null===(i=null===(n=null===(t=null===(e=this.transceiverController)||void 0===e?void 0:e.localVideoTransceiver())||void 0===t?void 0:t.sender)||void 0===n?void 0:n.track)||void 0===i?void 0:i.getSettings()}getNumberOfPublishedVideoSources(){var e;return null!==(e=this.numberOfPublishedVideoSources)&&void 0!==e?e:0}}t.default=o,o.encodingMapKey="video",o.targetHeightArray=[0,0,0,540,540,480,480,480,480,360,360,360,360,270,270,270,270,180,180,180,180,180,180,180,180,180]},657:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(1133);t.default=class{constructor(){}updateConnectionMetric(e){}chooseMediaTrackConstraints(){return{}}chooseEncodingParameters(){return new Map}updateIndex(e){}wantsResubscribe(){return!1}chooseCaptureAndEncodeParameters(){return new i.default(0,0,0,0,!1)}maxBandwidthKbps(){return 0}setIdealMaxBandwidthKbps(e){}setHasBandwidthPriority(e){}}},3928:(e,t)=>{"use strict";function n(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(n(e))}info(...e){this.base.info(n(e))}warn(...e){this.base.warn(n(e))}error(...e){this.base.error(n(e))}}},2497:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VoiceFocusDeviceTransformer=void 0;const r=n(6035),o=n(8690),s=n(4046),a=n(3928),l=n(8878),c=n(851);class d{constructor(e,{preload:t=!0,logger:n,fetchBehavior:i=d.defaultFetchBehavior()},r){this.spec=e,this.supported=!0,this.logger=n,this.vfLogger=n?new a.default(n):void 0,this.preload=t,this.fetchBehavior=i,this.spec=d.augmentSpec(this.spec),r&&(this.configuration=Promise.resolve(r))}static isSupported(e,t){var n,i;const s={fetchBehavior:d.defaultFetchBehavior(),logger:(null==t?void 0:t.logger)?new a.default(t.logger):void 0};if(o.isIFramed()){if(!1===(null==t?void 0:t.allowIFrame))return null===(n=null==t?void 0:t.logger)||void 0===n||n.error("Amazon Voice Focus support check inside iframe: not supported."),Promise.resolve(!1);null===(i=null==t?void 0:t.logger)||void 0===i||i.warn("Amazon Voice Focus support check inside iframe: not recommended.")}return r.VoiceFocus.isSupported(d.augmentSpec(e),s)}static create(e={},t={},n,r,o){var s,a,l;return i(this,void 0,void 0,(function*(){r&&r.Meeting.Meeting&&(r=r.Meeting);const i="AVAILABLE"===(null===(l=null===(a=null===(s=null==r?void 0:r.Meeting)||void 0===s?void 0:s.MeetingFeatures)||void 0===a?void 0:a.Audio)||void 0===l?void 0:l.EchoReduction),o=n&&!0===n.supported&&"ns_es"===n.model.name&&!i,c="ns_es"===e.name&&!i;if(o||c)throw new Error("Echo Reduction requested but not enabled.");const u=new d(e,t,n);return yield u.init(),u}))}static configure(e={},t={}){return i(this,void 0,void 0,(function*(){return new d(e,t,void 0).configure(!0)}))}getConfiguration(){return this.configuration}isSupported(){return this.supported}createTransformDevice(e,t){return i(this,void 0,void 0,(function*(){if(this.supported)try{const n=!0,[i,r]=yield this.allocateVoiceFocus(n),o=Object.assign(Object.assign({},t),{es:"ns_es"===this.spec.name});return new l.default(e,i,r,o)}catch(e){return}}))}static destroyVoiceFocus(e){var t;return i(this,void 0,void 0,(function*(){null===(t=null==e?void 0:e.vf)||void 0===t||t.destroy()}))}static augmentSpec(e){return e&&(e.assetGroup||e.revisionID)?e:Object.assign(Object.assign({},e),{assetGroup:d.currentSDKAssetGroup()})}configure(e=!1){return i(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 i(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 i(this,void 0,void 0,(function*(){const n=new c.default;return this.vf=yield r.VoiceFocus.init(e,{delegate:n,preload:t,logger:this.vfLogger}),[this.vf,n]}))}allocateVoiceFocus(e){return i(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 s.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|[1-9][0-9]*)/)[0]}static majorMinorVersion(){return s.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=d.majorMinorVersion()||"unknown",t=s.default.sdkUserAgentLowResolution;return{escapedQueryString:`sdk=${encodeURIComponent(e)}&ua=${encodeURIComponent(t)}`}}}t.VoiceFocusDeviceTransformer=d,t.default=d},8878:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543);class o{constructor(e,t,n,i,o=!1,s,a=new r.default,l=new Map,c,d){this.device=e,this.voiceFocus=t,this.delegate=n,this.nodeOptions=i,this.failed=o,this.node=s,this.browserBehavior=a,this.farEndStreamToAudioSourceNode=l,this.mixDestNode=c,this.mixSourceNode=d}getInnerDevice(){return this.device}mute(e){return i(this,void 0,void 0,(function*(){this.node&&(e?yield this.node.disable():yield this.node.enable())}))}stop(){return i(this,void 0,void 0,(function*(){this.node&&(this.node.disconnect(),yield this.node.stop())}))}chooseNewInnerDevice(e){return i(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 o(e,this.voiceFocus,this.delegate,this.nodeOptions,this.failed,this.node,this.browserBehavior,this.farEndStreamToAudioSourceNode,this.mixDestNode,this.mixSourceNode):this;var t}))}intrinsicDevice(){return i(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 n;return n=!this.nodeOptions||void 0===this.nodeOptions.agc||this.nodeOptions.agc.useBuiltInAGC,t.autoGainControl=n,t.googAutoGainControl=n,t.googAutoGainControl2=n,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,n;return i(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 i=Object.assign({enabled:!0,agc:{useVoiceFocusAGC:!1}},this.nodeOptions);try{if(null===(n=this.node)||void 0===n||n.disconnect(),this.node=yield this.voiceFocus.createNode(e,i),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 i(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 i(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 i(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 i(this,void 0,void 0,(function*(){null===(t=this.farEndStreamToAudioSourceNode.get(e))||void 0===t||t.disconnect(),this.farEndStreamToAudioSourceNode.delete(e)}))}meetingAudioStreamBecameActive(e){return i(this,void 0,void 0,(function*(){this.addFarEndStream(e)}))}meetingAudioStreamBecameInactive(e){return i(this,void 0,void 0,(function*(){this.removeFarendStream(e)}))}assignFarEndStreamToAudioSourceNode(e){const t=this.node.context.createMediaStreamSource(e);t.channelCount=1,t.channelCountMode="explicit",this.farEndStreamToAudioSourceNode.set(e,t),t.connect(this.mixDestNode,0)}createMixSourceNode(){this.mixSourceNode=this.node.context.createMediaStreamSource(this.mixDestNode.stream),this.mixSourceNode.channelCount=1,this.mixSourceNode.channelCountMode="explicit",this.mixSourceNode.connect(this.node,0,1)}}t.default=o},851:(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 n;for(const i of this.observers)null===(n=i.voiceFocusFellBackToInnerStream)||void 0===n||n.call(i,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 n{constructor(e,t,n,i,r){this.logger=e,this.realtimeController=t,this.minVolumeDecibels=n,this.maxVolumeDecibels=i,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 n of e.streams){const i=!!n.attendeeId,r=!!n.externalUserId,o=n.hasOwnProperty("muted"),s=!!n.dropped;if(i){this.attendeeIdToStreamId[n.attendeeId]&&this.attendeeIdToStreamId[n.attendeeId]<n.audioStreamId&&delete this.attendeeIdToStreamId[n.attendeeId],this.streamIdToAttendeeId[n.audioStreamId]=n.attendeeId;const i=r?n.externalUserId:n.attendeeId;this.streamIdToExternalUserId[n.audioStreamId]=i,this.attendeeIdToStreamId[n.attendeeId]=n.audioStreamId,this.realtimeController.realtimeSetAttendeeIdPresence(n.attendeeId,!0,i,!1,{attendeeIndex:t++,attendeesInFrame:e.streams.length})}if(o){const e=this.streamIdToAttendeeId[n.audioStreamId],t=this.streamIdToExternalUserId[n.audioStreamId];this.realtimeController.realtimeUpdateVolumeIndicator(e,null,n.muted,null,t)}if(!i&&!o){const i=this.streamIdToAttendeeId[n.audioStreamId];if(i){const r=this.streamIdToExternalUserId[n.audioStreamId];delete this.streamIdToAttendeeId[n.audioStreamId],delete this.streamIdToExternalUserId[n.audioStreamId],delete this.warnedAboutMissingStreamIdMapping[n.audioStreamId],this.attendeeIdToStreamId[i]===n.audioStreamId&&delete this.attendeeIdToStreamId[i];let o=!1;for(const e of Object.keys(this.streamIdToAttendeeId)){const t=parseInt(e);if(t>n.audioStreamId&&this.streamIdToAttendeeId[t]===i){o=!0;break}}o||this.realtimeController.realtimeSetAttendeeIdPresence(i,!1,r,s,{attendeeIndex:t++,attendeesInFrame:e.streams.length})}}}this.sessionReconnected&&(this.cleanUpState(e),this.sessionReconnected=!1)}cleanUpState(e){const t=Object.values(this.streamIdToAttendeeId),n=e.streams.map((e=>e.attendeeId)),i=t.filter((e=>!n.includes(e)));for(const[e,t]of i.entries()){const n=this.attendeeIdToStreamId[t],i=this.streamIdToExternalUserId[n];delete this.streamIdToAttendeeId[n],delete this.streamIdToExternalUserId[n],delete this.warnedAboutMissingStreamIdMapping[n],delete this.attendeeIdToStreamId[t],t!==this.selfAttendeeId?this.realtimeController.realtimeSetAttendeeIdPresence(t,!1,i,!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,n=null;for(const i of e.attendeeStates){const e=this.attendeeIdForStreamId(i.audioStreamId);i.hasOwnProperty("volume")&&(null===t&&(t={}),null!==e&&(t[e]=this.normalizedVolume(i))),i.hasOwnProperty("signalStrength")&&(null===n&&(n={}),null!==e&&(n[e]=this.normalizedSignalStrength(i)))}this.applyRealtimeUpdatesForAudioMetadata(t,n)}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/n.MAX_SIGNAL_STRENGTH_LEVELS;return Math.min(Math.max(t,0),1)}applyRealtimeUpdatesForAudioMetadata(e,t){for(const i in this.streamIdToAttendeeId){const r=this.streamIdToAttendeeId[i],o=this.streamIdToExternalUserId[i];let s=null,a=null;null!==e&&(s=e.hasOwnProperty(r)?e[r]:n.IMPLICIT_VOLUME),null!==t&&(a=t.hasOwnProperty(r)?t[r]:n.IMPLICIT_SIGNAL_STRENGTH),null===s&&null===a||this.realtimeController.realtimeUpdateVolumeIndicator(r,s,null,a,o)}}attendeeIdForStreamId(e){return 0===e?null:this.streamIdToAttendeeId[e]||(this.warnedAboutMissingStreamIdMapping[e]||(this.warnedAboutMissingStreamIdMapping[e]=!0,this.logger.warn(`volume indicator stream id ${e} seen before being defined`)),null)}}t.default=n,n.MAX_SIGNAL_STRENGTH_LEVELS=2,n.IMPLICIT_VOLUME=0,n.IMPLICIT_SIGNAL_STRENGTH=1},7631:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(4046),r=n(7387);t.default=class{constructor(e){this.logger=e}create(e,t,n){this.connection=new WebSocket(n?e:i.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 n;null===(n=this.connection)||void 0===n||n.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 n;null===(n=this.connection)||void 0===n||n.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 n;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"}(n=t.WebSocketReadyState||(t.WebSocketReadyState={})),t.default=n},5995:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.decideModel=t.measureAndDecideExecutionApproach=void 0;const r=n(5021),o=n(9424),s={wasm:{noSupport:.07,inline:{c100:1,c50:.36,c20:.16,c10:.07},worker:{c100:.5,c50:.18,c20:.08,c10:.06}},simd:{noSupport:.1,inline:{c100:1,c50:.43,c20:.3,c10:.2},worker:{c100:.5,c50:.21,c20:.15,c10:.1}}};class a{constructor(e,t){this.fetchConfig=e,this.logger=t;const n=`${e.paths.workers}estimator-v1.js`;this.fetchBehavior={headers:e.headers,escapedQueryString:e.escapedQueryString},this.worker=r.loadWorker(n,"VoiceFocusEstimator",this.fetchBehavior,t)}roundtrip(e,t,n){return new Promise(((i,r)=>{this.worker.then((r=>{let o;o=e=>{const{message:s,key:a}=e.data;s===t&&a===n&&(r.removeEventListener("message",o),i(e.data))},r.addEventListener("message",o),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",n=e||`${this.fetchConfig.paths.wasm}simd-v1.wasm`,i={message:"supports-simd",fetchBehavior:this.fetchBehavior,path:n,key:t};return this.roundtrip(i,"simd-support",t).then((e=>e.supports))}measure(e,t){const n=`${this.fetchConfig.paths.wasm}bench-v1.wasm`,i=`${this.fetchConfig.paths.wasm}bench-v1_simd.wasm`,r=e?i:n,o=`bench:${e}`,s={message:"measure",fetchBehavior:this.fetchBehavior,budget:t,path:r,key:o};return this.roundtrip(s,"measurement",o).then((e=>{if(e.measurement)return e.measurement;throw new Error("Failed to measure.")}))}stop(){this.worker.then((e=>{var t;null===(t=this.logger)||void 0===t||t.debug("Stopping estimator worker."),e.terminate()})).catch((e=>{}))}}const l=(e,t,n,r)=>i(void 0,void 0,void 0,(function*(){const i={supportsSIMD:e,supportsSAB:o.supportsSharedArrayBuffer(globalThis,window,n),duration:-1};if(e)return null==n||n.info("Supports SIMD: true (force)"),i;const s=!r,l=r||new a(t,n);try{const t=!o.isOldChrome(window,n)&&(yield l.supportsSIMD());return null==n||n.info(`Supports SIMD: ${t} (force: ${e})`),i.supportsSIMD=t,i}finally{s&&l.stop()}}));t.measureAndDecideExecutionApproach=(e,t,n,r=s)=>i(void 0,void 0,void 0,(function*(){let c=e.executionPreference;const{usagePreference:d,variantPreference:u,namePreference:h,simdPreference:p,estimatorBudget:f,executionQuantaPreference:m}=e;"interactivity"===d&&"inline"!==c&&(null==n||n.debug(`Overriding execution preference ${c} to reflect interactivity preference.`),c="inline");const g="force"===p,v="auto"!==u,b="auto"!==c;let y;try{y=v&&b?yield l(g,t,n):yield((e,t,n,r)=>i(void 0,void 0,void 0,(function*(){const i=new a(t,r);try{const o=yield l(e,t,r,i);if(o.supportsSIMD)try{return o.duration=yield i.measure(!0,n),null==r||r.info("SIMD timing:",o.duration),o}catch(e){null==r||r.warn("Failed SIMD estimation; falling back to non-SIMD."),o.supportsSIMD=!1}return o.duration=yield i.measure(!1,n),null==r||r.info("No-SIMD timing:",o.duration),o}catch(e){throw null==r||r.error("Could not feature check.",e),e}finally{i.stop()}})))(g,t,f,n)}catch(e){throw null==n||n.error("Could not load estimator.",e),new Error("Could not load Voice Focus estimator.")}return(({supportsSIMD:e,supportsSAB:t,duration:n,executionPreference:i="auto",simdPreference:r,variantPreference:a="auto",namePreference:l="default",usagePreference:c,executionQuantaPreference:d=3},u=s,h)=>{const p="force"===r||"disable"!==r&&e,f=-1!==n,m=f?(p?2.5:2.63)/n:0,g=p?u.simd:u.wasm,v=f?((e,t)=>1===e?.6:"quality"===t?.65*e:.5*e)(d,c)*m:0,b=f?.7*m:0,y=l,S=e=>({supported:!1,reason:e});if(f){if(m<g.noSupport)return S(`Performance score ${m} worse than threshold ${g.noSupport}.`)}else if("auto"===i||"auto"===a)return S(`Missing explicit execution (${i}) or variant (${a}) preference, but no scoring performed.`);null==h||h.debug(`Bench duration ${n} yields inline score ${v} and worker score ${b}.`);const w=(e,t,n)=>({supported:!0,useSIMD:p,processor:e,executionApproach:t,variant:n,executionQuanta:"inline"===t?d:void 0,name:y}),C=(e,t,n)=>"auto"!==t?!f||e>n[t]?t:"failed":e>n.c100?"c100":e>n.c50?"c50":e>n.c20?"c20":e>n.c10?"c10":"failed",k=e=>{switch(e||"auto"){case"auto":{let e=k("inline"),t=k("worker");return null==h||h.debug(`Reducing auto preference: ${JSON.stringify(e)} vs ${JSON.stringify(t)}`),!1===e.supported||!1===t.supported?t:e.variant===t.variant||"c50"===e.variant?e:t}case"worker":return o.supportsSharedArrayBuffer(globalThis,window,h)?k("worker-sab"):k("worker-postMessage");case"inline":{const e=C(v,a,g.inline);return"failed"===e?S(`Performance score ${v} not sufficient for inline use with variant preference ${a}.`):w("voicefocus-inline-processor","inline",e)}case"worker-sab":{if(!t){const e="Requested worker-sab but no SharedArrayBuffer support.";return null==h||h.warn(e),{supported:!1,reason:e}}const e=C(b,a,g.worker);return"failed"===e?S(`Performance score ${b} not sufficient for worker use with variant preference ${a}.`):w("voicefocus-worker-sab-processor","worker-sab",e)}case"worker-postMessage":{const e=C(b,a,g.worker);if("failed"===e)return S(`Performance score ${b} not sufficient for worker use.`);if("ns_es"===y){const e="Requested echo suppression but postMessage executor does not support it.";return null==h||h.warn(e),{supported:!1,reason:e}}return w("voicefocus-worker-postMessage-processor","worker-postMessage",e)}}};return k(i)})(Object.assign(Object.assign({},y),{simdPreference:p,executionPreference:c,variantPreference:u,namePreference:h,usagePreference:d,executionQuantaPreference:m}),r,n)})),t.decideModel=({category:e,name:t,variant:n,simd:i,url:r})=>`${e}-${t}-${n}-v1${i?"_simd":""}`},623:(e,t)=>{"use strict";function n(e,t,n){if(!n)return fetch(e,t);const o=r(e,n),s=i(t,n);return fetch(o,s)}function i(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 n=-1!==e.lastIndexOf("?");return`${e}${n?"&":"?"}${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=n,t.withRequestHeaders=i,t.withQueryString=r,t.addQueryParams=function(e,t){const n=Object.keys(t);if(!n.length)return e;const i=new URLSearchParams(null==e?void 0:e.escapedQueryString);for(const e of n)i.append(e,t[e]);return Object.assign(Object.assign({},e),{escapedQueryString:i.toString()})};const o={method:"HEAD",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"origin"};t.resolveURL=function(e,t){return n(e,o,t).then((t=>t.redirected?t.url:e))},t.isValidAssetGroup=function(e){return!!e&&/^[-.a-zA-Z0-9]+$/.test(e)},t.isValidRevisionID=function(e){return!!e&&/^[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{22}$/.test(e)}},5021:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loadWorker=void 0;const i=n(623),r={method:"GET",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"};t.loadWorker=(e,t,n,o)=>{null==o||o.debug(`Loading ${t} worker from ${e}.`);let s=!1;try{s=self.origin===new URL(e).origin}catch(e){null==o||o.error("Could not compare origins.",e)}if(s){const r=i.withQueryString(e,n);return Promise.resolve(new Worker(r,{name:t}))}return i.fetchWithBehavior(e,r,n).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,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.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=n(5021);t.isSafari=(e=globalThis)=>{const t=e.navigator.userAgent,n=t.match(/Safari\//),i=t.match(/Chrom(?:e|ium)\//);return!(!n||i)},t.supportsWASMPostMessage=(e=globalThis)=>!t.isSafari(e)&&(!((e=globalThis)=>!!e.navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)/))(e)||(o(e)||0)<95),t.supportsVoiceFocusWorker=(e=globalThis,n,o)=>i(void 0,void 0,void 0,(function*(){if(!t.supportsWorker(e,o))return!1;const i=`${n.paths.workers}worker-v1.js`;try{const e=yield r.loadWorker(i,"VoiceFocusTestWorker",n,o);try{e.terminate()}catch(e){null==o||o.debug("Failed to terminate worker.",e)}return!0}catch(e){return null==o||o.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,n)=>{try{return!(!e.SharedArrayBuffer||!t.chrome&&!e.crossOriginIsolated)}catch(e){return null==n||n.info("Does not support SharedArrayBuffer."),!1}},t.supportsWASMStreaming=(e=globalThis,t)=>{var n;try{return!!(null===(n=e.WebAssembly)||void 0===n?void 0:n.compileStreaming)}catch(e){return null==t||t.info("Does not support WASM streaming compilation",e),!1}};const o=(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 n=o(e);return!!n&&n<90&&(null==t||t.debug(`Chrome ${n} has incomplete SIMD support.`),!0)}},103:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VoiceFocusAudioWorkletNode=void 0;class n extends("undefined"!=typeof globalThis&&globalThis.AudioWorkletNode||class{}){}t.VoiceFocusAudioWorkletNode=n},6035:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getAudioInput=t.createAudioContext=t.VoiceFocus=void 0;const r=n(5995),o=n(623),s=n(5021),a=n(9424),l=n(2633),c=n(1678),d=n(271),u={useVoiceFocusAGC:!1,useBuiltInAGC:!0},h="stable-v1",p="https://static.sdkassets.chime.aws",f={processors:`${p}/processors/`,workers:`${p}/workers/`,wasm:`${p}/wasm/`,models:`${p}/wasm/`},m={latencyHint:0},g={channelCount:1,echoCancellation:!0,googEchoCancellation:!0,noiseSuppression:!1,googNoiseSuppression:!1,googHighpassFilter:!1,googTypingNoiseDetection:!1},v=Object.assign(Object.assign({},g),{autoGainControl:!0,googAutoGainControl:!0,googAutoGainControl2:!0}),b=Object.assign(Object.assign({},g),{autoGainControl:!1,googAutoGainControl:!1,googAutoGainControl2:!1}),y={"voicefocus-worker-sab-processor":{file:"worklet-worker-sab-processor-v1.js",node:c.default},"voicefocus-worker-postMessage-processor":{file:"worklet-worker-postMessage-processor-v1.js",node:d.default},"voicefocus-inline-processor":{file:"worklet-inline-processor-v1.js",node:l.default}},S=(e,t)=>{if(void 0!==e&&!o.isValidAssetGroup(e))throw new Error(`Invalid asset group ${e}`);if(void 0!==t&&!o.isValidRevisionID(t))throw new Error(`Invalid revision ID ${t}`)},w=(e,t)=>`${t.models}${r.decideModel(e)}.wasm`;class C{constructor(e,t,n,i,r){this.processorURL=t,this.nodeConstructor=n,this.nodeOptions=i,this.executionQuanta=r,this.internal={worker:e,nodeOptions:i,isDestroyed:!1}}static isSupported(e,t){const{fetchBehavior:n,logger:i}=t||{};if("undefined"==typeof globalThis)return null==i||i.debug("Browser does not have globalThis."),Promise.resolve(!1);if(!a.supportsAudioWorklet(globalThis,i))return null==i||i.debug("Browser does not support Audio Worklet."),Promise.resolve(!1);if(!a.supportsWASM(globalThis,i))return null==i||i.debug("Browser does not support WASM."),Promise.resolve(!1);a.supportsWASMStreaming(globalThis,i)||null==i||i.debug("Browser does not support streaming WASM compilation.");const{assetGroup:r=h,revisionID:s,paths:l=f}=e||{};S(r,s);const c=s?{revisionID:s}:{assetGroup:r},d=o.addQueryParams(n,c),u=Object.assign(Object.assign({},d),{paths:l});return a.supportsVoiceFocusWorker(globalThis,u,i)}static mungeExecutionPreference(e,t){const n=void 0===e||"auto"===e;if(a.isSafari(globalThis)){if(n||"inline"===e)return"inline";if(!n)throw new Error(`Unsupported execution preference ${e}`)}if("worker-sab"===e&&!a.supportsSharedArrayBuffer(globalThis,globalThis,t))throw new Error(`Unsupported execution preference ${e}`);return e||"auto"}static configure(e,t){return i(this,void 0,void 0,(function*(){const{fetchBehavior:n,preResolve:i,logger:s}=t||{},{category:a="voicefocus",name:l="default",variant:c="auto",assetGroup:d=h,revisionID:u,simd:p="detect",executionPreference:m="auto",executionQuantaPreference:g,usagePreference:v="interactivity",estimatorBudget:b=100,paths:y=f,thresholds:C}=e||{};if(null==s||s.debug("Configuring Voice Focus with spec",e),void 0!==a&&"voicefocus"!==a)throw new Error(`Unrecognized category ${a}`);if(void 0!==l&&"default"!==l&&"ns_es"!==l)throw new Error(`Unrecognized feature name ${l}`);if(void 0!==c&&!["auto","c100","c50","c20","c10"].includes(c))throw new Error(`Unrecognized feature variant ${c}`);if(void 0!==g&&![1,2,3].includes(g))throw new Error(`Unrecognized execution quanta preference ${g}`);if(S(d,u),void 0!==p&&!["detect","force","disable"].includes(p))throw new Error(`Unrecognized SIMD option ${p}`);if(void 0!==m&&!["auto","inline","worker","worker-sab","worker-postMessage"].includes(m))throw new Error(`Unrecognized execution preference ${m}`);if(void 0!==v&&!["quality","interactivity"].includes(v))throw new Error(`Unrecognized usage preference ${v}`);const k={executionPreference:this.mungeExecutionPreference(m,s),usagePreference:v,executionQuantaPreference:g,variantPreference:c,namePreference:l,simdPreference:p,estimatorBudget:b},E=u?{revisionID:u}:{assetGroup:d},_=o.addQueryParams(n,E),T=Object.assign({paths:y},_),x=yield r.measureAndDecideExecutionApproach(k,T,s,C);if(!1===x.supported)return{supported:!1,reason:x.reason};null==s||s.info("Decided execution approach",x);const{useSIMD:I,processor:M,variant:A,executionQuanta:P}=x,O={category:a||"voicefocus",name:l||"default",variant:A,simd:I};if(i){const e=w(O,y);O.url=yield o.resolveURL(e,_)}return{fetchConfig:T,model:O,processor:M,executionQuanta:P,supported:!0}}))}static init(e,{delegate:t,preload:n=!0,logger:r}){return i(this,void 0,void 0,(function*(){if(!1===e.supported)throw new Error("Voice Focus not supported. Reason: "+e.reason);const{model:i,processor:o,fetchConfig:l,executionQuanta:c}=e,{simd:d,name:u}=i,{paths:h}=l;if("voicefocus-inline-processor"!==o&&"voicefocus-worker-postMessage-processor"!==o&&"voicefocus-worker-sab-processor"!==o)throw new Error(`Unknown processor ${o}`);const p=i.url||w(i,h);null==r||r.debug(`Using model URL ${p}.`);const f=`${h.wasm}audio_buffer-v1${d?"_simd":""}.wasm`,m=`${h.wasm}resampler-v1${d?"_simd":""}.wasm`,g=`${h.workers}worker-v1.js`,{file:v,node:b}=y[o],S=`${h.processors}${v}`,k=yield s.loadWorker(g,"VoiceFocusWorker",l,r);if(n){null==r||r.debug("Preloading",p);let e=a.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";k.postMessage({message:e,preload:!0,key:"model",fetchBehavior:l,path:p})}const E=new C(k,S,b,{processor:o,worker:k,audioBufferURL:f,resamplerURL:m,fetchBehavior:l,modelURL:p,delegate:t,logger:r,numberOfInputs:"ns_es"===u?2:1},c);return Promise.resolve(E)}))}createNode(e,t){var n;if(this.internal.isDestroyed)throw new Error("Unable to create node because VoiceFocus worker has been destroyed.");const{voiceFocusSampleRate:i=(16e3===e.sampleRate?16e3:48e3),enabled:r=!0,agc:s=u}=t||{},a=null==t?void 0:t.es,l={voiceFocusSampleRate:i,enabled:r,sendBufferCount:10,prefill:6,agc:s,executionQuanta:this.executionQuanta,supportFarendStream:a},c=o.withQueryString(this.processorURL,null===(n=this.nodeOptions)||void 0===n?void 0:n.fetchBehavior);return e.audioWorklet.addModule(c).then((()=>new this.nodeConstructor(e,Object.assign(Object.assign({},this.nodeOptions),{processorOptions:l}))))}applyToStream(e,t,n){return i(this,void 0,void 0,(function*(){if(this.internal.isDestroyed)throw new Error("Unable to apply stream because VoiceFocus worker has been destroyed");const i=t.createMediaStreamSource(e),r=yield this.applyToSourceNode(i,t,n),o=t.createMediaStreamDestination();return r.connect(o),{node:r,source:i,destination:o,stream:o.stream}}))}applyToSourceNode(e,t,n){return i(this,void 0,void 0,(function*(){const i=yield this.createNode(t,n);return e.connect(i),i}))}destroy(){this.internal.worker?.terminate(),this.internal.isDestroyed=!0}}t.VoiceFocus=C,t.createAudioContext=(e=m)=>new(window.AudioContext||window.webkitAudioContext)(e),t.getAudioInput=(e,t,n)=>i(void 0,void 0,void 0,(function*(){var i,r;const{constraints:o,spec:s,delegate:a,preload:l=!0,options:c}=t,{logger:d}=n,h=yield C.configure(s,n);if(!h.supported)return null===(i=n.logger)||void 0===i||i.warn("Voice Focus not supported; returning standard stream."),window.navigator.mediaDevices.getUserMedia(o);const p=yield C.init(h,{delegate:a,preload:l,logger:d}),f=(null===(r=t.options)||void 0===r?void 0:r.agc)||u,m=yield window.navigator.mediaDevices.getUserMedia(((e,t)=>{let n;if(n=t.useBuiltInAGC?v:b,!e)return{audio:n};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?n:Object.assign(Object.assign({},e.audio),n)})})(o,f));return p.applyToStream(m,e,c).then((e=>e.stream))}))},2633:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9424),o=n(103);class s extends o.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.cpuWarningCount=0,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:n,worker:i,fetchBehavior:o,logger:s,delegate:a}=t;this.logger=s,this.port.onmessage=this.onProcessorMessage.bind(this),this.delegate=a,s&&s.debug("VoiceFocusInlineNode:",n),this.worker=i,this.worker.onmessage=this.onWorkerMessage.bind(this);const l=r.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:l,key:"model",fetchBehavior:o,path:n})}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 i(this,void 0,void 0,(function*(){this.port.postMessage({message:"enable"})}))}disable(){return i(this,void 0,void 0,(function*(){this.port.postMessage({message:"disable"})}))}stop(){var e;return i(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,n,i;const r=e.data;if("cpu"===r.message){this.cpuWarningCount++;const e=Date.now(),i=this.cpuWarningLastTriggered||e,o=Math.abs(e-i);(!this.cpuWarningLastTriggered||o>5e3)&&(null===(t=this.logger)||void 0===t||t.warn(`CPU warning (count: ${this.cpuWarningCount}):`,r.message),this.cpuWarningCount=0,this.cpuWarningLastTriggered=e),null===(n=this.delegate)||void 0===n||n.onCPUWarning()}else null===(i=this.logger)||void 0===i||i.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=s},271:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9424),o=n(103);class s extends o.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.channelCountMode="explicit",this.channelCount=1;const{modelURL:n,audioBufferURL:i,worker:o,fetchBehavior:s,delegate:a}=t;this.delegate=a,this.worker=o,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:l,agc:c,supportFarendStream:d}=t.processorOptions;this.worker.postMessage({message:"init",approach:"postMessage",frames:16e3===e.sampleRate?160:480,enabled:l,agc:c,fetchBehavior:s,model:n,supportFarendStream:d});const u=r.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:u,key:"buffer",fetchBehavior:s,path:i})}enable(){return i(this,void 0,void 0,(function*(){this.worker.postMessage({message:"enable"})}))}disable(){return i(this,void 0,void 0,(function*(){this.worker.postMessage({message:"disable"})}))}stop(){return i(this,void 0,void 0,(function*(){try{this.worker.postMessage({message:"stop"})}catch(e){}this.disconnect()}))}onWorkerMessage(e){var t;const n=e.data;switch(n.message){case"ready":this.port.postMessage({message:"ready",shared:n.shared},n.shared?Object.values(n.shared):[]);break;case"data":if(!n.buffer)return;this.port.postMessage({message:"data",buffer:n.buffer},[n.buffer]);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(n);break;case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;default:return}}onProcessorMessage(e){var t;const n=e.data;switch(n.message){case"data":if(!n.buffer)return;this.worker.postMessage({message:"data",buffer:n.buffer},[n.buffer]);break;case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(n);break;default:return}}}t.default=s},1678:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9424),o=n(103);class s extends o.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.channelCountMode="explicit",this.channelCount=1;const{modelURL:n,resamplerURL:i,worker:o,fetchBehavior:s,delegate:a}=t;this.delegate=a,this.worker=o,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:l,supportFarendStream:c}=t.processorOptions;this.worker.postMessage({message:"init",approach:"sab",frames:16e3===e.sampleRate?160:480,enabled:l,model:n,supportFarendStream:c});const d=r.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:d,key:"resampler",fetchBehavior:s,path:i})}enable(){return i(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 i(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 i(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 n=e.data;switch(n.message){case"ready":if(!n.shared)throw new Error("No shared state.");this.state=new Int32Array(n.shared.state),this.port.postMessage(n);break;case"stopped":this.worker.terminate();break;case"module-buffer":case"module":case"processing":this.port.postMessage(n);break;case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;default:return}}onProcessorMessage(e){var t;const n=e.data;switch(n.message){case"cpu":null===(t=this.delegate)||void 0===t||t.onCPUWarning();break;case"prepare-for-frames":this.worker.postMessage(n)}}}t.default=s},9742:(e,t)=>{"use strict";t.byteLength=function(e){var t=l(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,o=l(e),s=o[0],a=o[1],c=new r(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),d=0,u=a>0?s-4:s;for(n=0;n<u;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],c[d++]=t>>16&255,c[d++]=t>>8&255,c[d++]=255&t;return 2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[d++]=255&t),1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[d++]=t>>8&255,c[d++]=255&t),c},t.fromByteArray=function(e){for(var t,i=e.length,r=i%3,o=[],s=16383,a=0,l=i-r;a<l;a+=s)o.push(c(e,a,a+s>l?l:a+s));return 1===r?(t=e[i-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)n[s]=o[s],i[o.charCodeAt(s)]=s;function l(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,i){for(var r,o,s=[],a=t;a<i;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(n[(o=r)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},1206:function(e){e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=90)}({17:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i=n(18),r=function(){function e(){}return e.getFirstMatch=function(e,t){var n=t.match(e);return n&&n.length>0&&n[1]||""},e.getSecondMatch=function(e,t){var n=t.match(e);return n&&n.length>1&&n[2]||""},e.matchAndReturnConst=function(e,t,n){if(e.test(t))return n},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,n,i){void 0===i&&(i=!1);var r=e.getVersionPrecision(t),o=e.getVersionPrecision(n),s=Math.max(r,o),a=0,l=e.map([t,n],(function(t){var n=s-e.getVersionPrecision(t),i=t+new Array(n+1).join(".0");return e.map(i.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(i&&(a=s-Math.min(r,o)),s-=1;s>=a;){if(l[0][s]>l[1][s])return 1;if(l[0][s]===l[1][s]){if(s===a)return 0;s-=1}else if(l[0][s]<l[1][s])return-1}},e.map=function(e,t){var n,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n+=1)i.push(t(e[n]));return i},e.find=function(e,t){var n,i;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,i=e.length;n<i;n+=1){var r=e[n];if(t(r,n))return r}},e.assign=function(e){for(var t,n,i=e,r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var a=function(){var e=o[t];"object"==typeof e&&null!==e&&Object.keys(e).forEach((function(t){i[t]=e[t]}))};for(t=0,n=o.length;t<n;t+=1)a();return e},e.getBrowserAlias=function(e){return i.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return i.BROWSER_MAP[e]||""},e}();t.default=r,e.exports=t.default},18:function(e,t,n){"use strict";t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i,r=(i=n(91))&&i.__esModule?i:{default:i},o=n(18),s=function(){function e(){}var t;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new r.default(e,t)},e.parse=function(e){return new r.default(e).getResult()},(t=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}])&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e,t),e}();t.default=s,e.exports=t.default},91:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i=l(n(92)),r=l(n(93)),o=l(n(94)),s=l(n(95)),a=l(n(17));function l(e){return e&&e.__esModule?e:{default:e}}var c=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=a.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=a.default.find(r.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=a.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=a.default.find(s.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return a.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,n={},i=0,r={},o=0;if(Object.keys(e).forEach((function(t){var s=e[t];"string"==typeof s?(r[t]=s,o+=1):"object"==typeof s&&(n[t]=s,i+=1)})),i>0){var s=Object.keys(n),l=a.default.find(s,(function(e){return t.isOS(e)}));if(l){var c=this.satisfies(n[l]);if(void 0!==c)return c}var d=a.default.find(s,(function(e){return t.isPlatform(e)}));if(d){var u=this.satisfies(n[d]);if(void 0!==u)return u}}if(o>0){var h=Object.keys(r),p=a.default.find(h,(function(e){return t.isBrowser(e,!0)}));if(void 0!==p)return this.compareVersion(r[p])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),r=a.default.getBrowserTypeByAlias(i);return t&&r&&(i=r.toLowerCase()),i===n},t.compareVersion=function(e){var t=[0],n=e,i=!1,r=this.getBrowserVersion();if("string"==typeof r)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(i=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(i=!0,n=e.substr(1)),t.indexOf(a.default.compareVersions(r,n,i))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=c,e.exports=t.default},92:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i,r=(i=n(17))&&i.__esModule?i:{default:i},o=/version\/(\d+(\.?_?\d+)+)/i,s=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=r.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},n=r.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},n=r.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},n=r.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},n=r.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},n=r.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},n=r.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},n=r.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=r.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},n=r.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},n=r.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},n=r.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},n=r.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},n=r.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},n=r.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},n=r.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},n=r.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},n=r.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},n=r.default.getFirstMatch(o,e)||r.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},n=r.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},n=r.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},n=r.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},n=r.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},n=r.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},n=r.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},n=r.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},n=r.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},n=r.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t={name:"Android Browser"},n=r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=r.default.getFirstMatch(o,e);return n&&(t.version=n),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:r.default.getFirstMatch(t,e),version:r.default.getSecondMatch(t,e)}}}];t.default=s,e.exports=t.default},93:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i,r=(i=n(17))&&i.__esModule?i:{default:i},o=n(18),s=[{test:[/Roku\/DVP/],describe:function(e){var t=r.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=r.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=r.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=r.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},n=r.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe:function(e){var t=r.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=r.default.getMacOSVersionName(t),i={name:o.OS_MAP.MacOS,version:t};return n&&(i.versionName=n),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=r.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe:function(e){var t=r.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=r.default.getAndroidVersionName(t),i={name:o.OS_MAP.Android,version:t};return n&&(i.versionName=n),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=r.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:o.OS_MAP.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=r.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||r.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||r.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=r.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=r.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=r.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=s,e.exports=t.default},94:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i,r=(i=n(17))&&i.__esModule?i:{default:i},o=n(18),s=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=r.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe:function(e){var t=r.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=s,e.exports=t.default},95:function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var i,r=(i=n(17))&&i.__esModule?i:{default:i},o=n(18),s=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=r.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},n=r.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},n=r.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:function(e){var t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},n=r.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},n=r.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=s,e.exports=t.default}})},5420:(e,t,n)=>{var i=n(8764).Buffer,r=Object.prototype.toString,o=void 0!==i&&"function"==typeof i.alloc&&"function"==typeof i.allocUnsafe&&"function"==typeof i.from;e.exports=function(e,t,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return s=e,"ArrayBuffer"===r.call(s).slice(8,-1)?function(e,t,n){t>>>=0;var r=e.byteLength-t;if(r<0)throw new RangeError("'offset' is out of bounds");if(void 0===n)n=r;else if((n>>>=0)>r)throw new RangeError("'length' is out of bounds");return o?i.from(e.slice(t,t+n)):new i(new Uint8Array(e.slice(t,t+n)))}(e,t,n):"string"==typeof e?function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!i.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');return o?i.from(e,t):new i(e,t)}(e,t):o?i.from(e):new i(e);var s}},8764:(e,t,n)=>{"use strict";const i=n(9742),r=n(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return c(e,t,n)}function c(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|m(e,t);let i=a(n);const r=i.write(e,t);return r!==n&&(i=i.slice(0,r)),i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(J(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return h(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 p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(J(e,SharedArrayBuffer)||e&&J(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return l.from(i,t,n);const r=function(e){if(l.isBuffer(e)){const t=0|f(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||Q(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function d(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 u(e){return d(e),a(e<0?0:0|f(e))}function h(e){const t=e.length<0?0:0|f(e.length),n=a(t);for(let i=0;i<t;i+=1)n[i]=255&e[i];return n}function p(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(i,l.prototype),i}function f(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function m(e,t){if(l.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 n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return K(e).length;default:if(r)return i?-1:q(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return M(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function v(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function b(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Q(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,i,r){let o,s=1,a=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,a/=2,l/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(r){let i=-1;for(o=n;o<a;o++)if(c(e,o)===c(t,-1===i?0:o-i)){if(-1===i&&(i=o),o-i+1===l)return i*s}else-1!==i&&(o-=o-i),i=-1}else for(n+l>a&&(n=a-l),o=n;o>=0;o--){let n=!0;for(let i=0;i<l;i++)if(c(e,o+i)!==c(t,i)){n=!1;break}if(n)return o}return-1}function S(e,t,n,i){n=Number(n)||0;const r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;const o=t.length;let s;for(i>o/2&&(i=o/2),s=0;s<i;++s){const i=parseInt(t.substr(2*s,2),16);if(Q(i))return s;e[n+s]=i}return s}function w(e,t,n,i){return G(q(t,e.length-n),e,n,i)}function C(e,t,n,i){return G(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function k(e,t,n,i){return G(K(t),e,n,i)}function E(e,t,n,i){return G(function(e,t){let n,i,r;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),i=n>>8,r=n%256,o.push(r),o.push(i);return o}(t,e.length-n),e,n,i)}function _(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);const i=[];let r=t;for(;r<n;){const t=e[r];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(r+s<=n){let n,i,a,l;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[r+1],128==(192&n)&&(l=(31&t)<<6|63&n,l>127&&(o=l));break;case 3:n=e[r+1],i=e[r+2],128==(192&n)&&128==(192&i)&&(l=(15&t)<<12|(63&n)<<6|63&i,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:n=e[r+1],i=e[r+2],a=e[r+3],128==(192&n)&&128==(192&i)&&128==(192&a)&&(l=(15&t)<<18|(63&n)<<12|(63&i)<<6|63&a,l>65535&&l<1114112&&(o=l))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|1023&o),i.push(o),r+=s}return function(e){const t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);let n="",i=0;for(;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=x));return n}(i)}t.kMaxLength=s,l.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,n){return function(e,t,n){return d(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},l.allocUnsafe=function(e){return u(e)},l.allocUnsafeSlow=function(e){return u(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(J(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),J(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let r=0,o=Math.min(n,i);r<o;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const i=l.allocUnsafe(t);let r=0;for(n=0;n<e.length;++n){let t=e[n];if(J(t,Uint8Array))r+t.length>i.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(i,r)):Uint8Array.prototype.set.call(i,t,r);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,r)}r+=t.length}return i},l.byteLength=m,l.prototype._isBuffer=!0,l.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;t<e;t+=2)v(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)v(this,t,t+3),v(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)v(this,t,t+7),v(this,t+1,t+6),v(this,t+2,t+5),v(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):g.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let e="";const n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},o&&(l.prototype[o]=l.prototype.inspect),l.prototype.compare=function(e,t,n,i,r){if(J(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.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===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(r>>>=0)-(i>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),c=this.slice(i,r),d=e.slice(t,n);for(let e=0;e<a;++e)if(c[e]!==d[e]){o=c[e],s=d[e];break}return o<s?-1:s<o?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return b(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return b(this,e,t,n,!1)},l.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return S(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":case"latin1":case"binary":return C(this,e,t,n);case"base64":return k(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const x=4096;function I(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function M(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function A(e,t,n){const i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);let r="";for(let i=t;i<n;++i)r+=Y[e[i]];return r}function P(e,t,n){const i=e.slice(t,n);let r="";for(let e=0;e<i.length-1;e+=2)r+=String.fromCharCode(i[e]+256*i[e+1]);return r}function O(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,i,r,o){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<o)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function N(e,t,n,i,r){z(t,i,r,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function D(e,t,n,i,r){z(t,i,r,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function F(e,t,n,i,r,o){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,i,o){return t=+t,n>>>=0,o||F(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function B(e,t,n,i,o){return t=+t,n>>>=0,o||F(e,0,n,8),r.write(e,t,n,i,52,8),n+8}l.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const i=this.subarray(e,t);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let i=this[e],r=1,o=0;for(;++o<t&&(r*=256);)i+=this[e+o]*r;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let i=this[e+--t],r=1;for(;t>0&&(r*=256);)i+=this[e+--t]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=Z((function(e){$(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,r=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(i)+(BigInt(r)<<BigInt(32))})),l.prototype.readBigUInt64BE=Z((function(e){$(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],r=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(i)<<BigInt(32))+BigInt(r)})),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let i=this[e],r=1,o=0;for(;++o<t&&(r*=256);)i+=this[e+o]*r;return r*=128,i>=r&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||O(e,t,this.length);let i=t,r=1,o=this[e+--i];for(;i>0&&(r*=256);)o+=this[e+--i]*r;return r*=128,o>=r&&(o-=Math.pow(2,8*t)),o},l.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=Z((function(e){$(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=Z((function(e){$(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||O(e,4,this.length),r.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),r.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),r.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),r.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,i){e=+e,t>>>=0,n>>>=0,i||R(this,e,t,n,Math.pow(2,8*n)-1,0);let r=1,o=0;for(this[t]=255&e;++o<n&&(r*=256);)this[t+o]=e/r&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,i){e=+e,t>>>=0,n>>>=0,i||R(this,e,t,n,Math.pow(2,8*n)-1,0);let r=n-1,o=1;for(this[t+r]=255&e;--r>=0&&(o*=256);)this[t+r]=e/o&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(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},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(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},l.prototype.writeBigUInt64LE=Z((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Z((function(e,t=0){return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}let r=0,o=1,s=0;for(this[t]=255&e;++r<n&&(o*=256);)e<0&&0===s&&0!==this[t+r-1]&&(s=1),this[t+r]=(e/o>>0)-s&255;return t+n},l.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}let r=n-1,o=1,s=0;for(this[t+r]=255&e;--r>=0&&(o*=256);)e<0&&0===s&&0!==this[t+r+1]&&(s=1),this[t+r]=(e/o>>0)-s&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(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},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(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},l.prototype.writeBigInt64LE=Z((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Z((function(e,t=0){return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,i){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);const r=i-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),r},l.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){const t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let r;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(r=t;r<n;++r)this[r]=e;else{const o=l.isBuffer(e)?e:l.from(e,i),s=o.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(r=0;r<n-t;++r)this[r+t]=o[r%s]}return this};const U={};function V(e,t,n){U[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function j(e){let t="",n=e.length;const i="-"===e[0]?1:0;for(;n>=i+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function z(e,t,n,i,r,o){if(e>n||e<t){const i="bigint"==typeof t?"n":"";let r;throw r=o>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(o+1)}${i}`:`>= -(2${i} ** ${8*(o+1)-1}${i}) and < 2 ** ${8*(o+1)-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new U.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){$(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||W(t,e.length-(n+1))}(i,r,o)}function $(e,t){if("number"!=typeof e)throw new U.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,n){if(Math.floor(e)!==e)throw $(e,n),new U.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new U.ERR_BUFFER_OUT_OF_BOUNDS;throw new U.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),V("ERR_OUT_OF_RANGE",(function(e,t,n){let i=`The value of "${e}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=j(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=j(r)),r+="n"),i+=` It must be ${t}. Received ${r}`,i}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function q(e,t){let n;t=t||1/0;const i=e.length;let r=null;const o=[];for(let s=0;s<i;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function K(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,i){let r;for(r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=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 Y=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let r=0;r<16;++r)t[i+r]=e[n]+e[r]}return t}();function Z(e){return"undefined"==typeof BigInt?X:e}function X(){throw new Error("BigInt not supported")}},3631:(e,t,n)=>{"use strict";n.r(t),n.d(t,{BotInfo:()=>l,BrowserInfo:()=>o,NodeInfo:()=>s,ReactNativeInfo:()=>c,SearchBotDeviceInfo:()=>a,browserName:()=>m,detect:()=>p,detectOS:()=>v,getNodeVersion:()=>b,parseUserAgent:()=>g});var i=n(4155),r=function(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},o=function(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"},s=function(e){this.version=e,this.type="node",this.name="node",this.os=i.platform},a=function(e,t,n,i){this.name=e,this.version=t,this.os=n,this.bot=i,this.type="bot-device"},l=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},c=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},d=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,u=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],h=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function p(e){return e?g(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new c:"undefined"!=typeof navigator?g(navigator.userAgent):b()}function f(e){return""!==e&&u.reduce((function(t,n){var i=n[0],r=n[1];if(t)return t;var o=r.exec(e);return!!o&&[i,o]}),!1)}function m(e){var t=f(e);return t?t[0]:null}function g(e){var t=f(e);if(!t)return null;var n=t[0],i=t[1];if("searchbot"===n)return new l;var s=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);s?s.length<3&&(s=r(r([],s,!0),function(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}(3-s.length),!0)):s=[];var c=s.join("."),u=v(e),h=d.exec(e);return h&&h[1]?new a(n,c,u,h[1]):new o(n,c,u)}function v(e){for(var t=0,n=h.length;t<n;t++){var i=h[t],r=i[0];if(i[1].exec(e))return r}return null}function b(){return void 0!==i&&i.version?new s(i.version.slice(1)):null}},7187:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.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 o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,o),i(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,r)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function c(e,t,n,i){var r,o,s,c;if(a(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),(r=l(e))>0&&s.length>r&&!s.warned){s.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=s.length,c=d,console&&console.warn&&console.warn(c)}return e}function d(){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 u(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=d.bind(i);return r.listener=n,i.wrapFn=r,r}function h(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):f(r,r.length)}function p(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function f(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function m(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(o){i.once&&e.removeEventListener(t,r),n(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var c=l.length,d=f(l,c);for(n=0;n<c;++n)i(d[n],this,t)}return!0},o.prototype.addListener=function(e,t){return c(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return c(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,u(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,u(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,i,r,o,s;if(a(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,o=Object.keys(n);for(i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},645:(e,t)=>{t.read=function(e,t,n,i,r){var o,s,a=8*r-i-1,l=(1<<a)-1,c=l>>1,d=-7,u=n?r-1:0,h=n?-1:1,p=e[t+u];for(u+=h,o=p&(1<<-d)-1,p>>=-d,d+=a;d>0;o=256*o+e[t+u],u+=h,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=i;d>0;s=256*s+e[t+u],u+=h,d-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,i),o-=c}return(p?-1:1)*s*Math.pow(2,o-i)},t.write=function(e,t,n,i,r,o){var s,a,l,c=8*o-r-1,d=(1<<c)-1,u=d>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+u>=1?h/l:h*Math.pow(2,1-u))*l>=2&&(s++,l/=2),s+u>=d?(a=0,s=d):s+u>=1?(a=(t*l-1)*Math.pow(2,r),s+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,r),s=0));r>=8;e[n+p]=255&a,p+=f,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;e[n+p]=255&s,p+=f,s/=256,c-=8);e[n+p-f]|=128*m}},5717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},3900:function(e,t,n){"use strict";var i,r=this&&this.__extends||(i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(4050),a=o(n(5420)),l=function(e){function t(t){void 0===t&&(t={objectMode:!1});var n=e.call(this,{objectMode:t.objectMode})||this;n.audioInput=null,n.recording=!0;var i=t.stream,r=t.objectMode,o=t.bufferSize,s=t.context;n.objectMode=r,n.bufferSize=o||void 0===window.AudioContext?4096:null;var a=window.AudioContext||window.webkitAudioContext;return n.context=s||new a,n.recorder=n.context.createScriptProcessor(o,1,1),n.recorder.connect(n.context.destination),i&&n.setStream(i),setTimeout((function(){n.emit("format",{channels:1,bitDepth:32,sampleRate:n.context.sampleRate,signed:!0,float:!0})}),0),n}return r(t,e),t.prototype.setStream=function(e){var t=this;this.stream=e,this.audioInput=this.context.createMediaStreamSource(e),this.audioInput.connect(this.recorder),this.recorder.onaudioprocess=function(e){t.recording&&t.push(t.objectMode?e.inputBuffer:a.default(e.inputBuffer.getChannelData(0).buffer))}},t.prototype.pauseRecording=function(){this.recording=!1},t.prototype.playRecording=function(){this.recording=!0},t.prototype.stop=function(){if("closed"!==this.context.state){try{this.stream.getTracks()[0].stop()}catch(e){}this.recorder.disconnect(),this.audioInput&&this.audioInput.disconnect();try{this.context.close()}catch(e){}this.recording=!1,this.push(null),this.emit("close")}},t.prototype._read=function(){},t.toRaw=function(e){return new Float32Array(e.buffer)},t}(s.Readable);t.default=l},7526:e=>{"use strict";var t={};function n(e,n,i){i||(i=Error);var r=function(e){var t,i;function r(t,i,r){return e.call(this,function(e,t,i){return"string"==typeof n?n:n(e,t,i)}(t,i,r))||this}return i=e,(t=r).prototype=Object.create(i.prototype),t.prototype.constructor=t,t.__proto__=i,r}(i);r.prototype.name=i.name,r.prototype.code=e,t[e]=r}function i(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}n("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,n){var r,o,s,a,l;if("string"==typeof t&&(o="not ",t.substr(0,o.length)===o)?(r="must not be",t=t.replace(/^not /,"")):r="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))s="The ".concat(e," ").concat(r," ").concat(i(t,"type"));else{var c=("number"!=typeof l&&(l=0),l+".".length>(a=e).length||-1===a.indexOf(".",l)?"argument":"property");s='The "'.concat(e,'" ').concat(c," ").concat(r," ").concat(i(t,"type"))}return s+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},2665:(e,t,n)=>{"use strict";var i=n(4155),r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=d;var o=n(5689),s=n(5270);n(5717)(d,o);for(var a=r(s.prototype),l=0;l<a.length;l++){var c=a[l];d.prototype[c]||(d.prototype[c]=s.prototype[c])}function d(e){if(!(this instanceof d))return new d(e);o.call(this,e),s.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",u)))}function u(){this._writableState.ended||i.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(d.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(d.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(d.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},9197:(e,t,n)=>{"use strict";e.exports=r;var i=n(2865);function r(e){if(!(this instanceof r))return new r(e);i.call(this,e)}n(5717)(r,i),r.prototype._transform=function(e,t,n){n(null,e)}},5689:(e,t,n)=>{"use strict";var i,r=n(4155);e.exports=_,_.ReadableState=E,n(7187).EventEmitter;var o,s=function(e,t){return e.listeners(t).length},a=n(6832),l=n(8764).Buffer,c=n.g.Uint8Array||function(){},d=n(7531);o=d&&d.debuglog?d.debuglog("stream"):function(){};var u,h,p,f=n(4210),m=n(7056),g=n(9226).getHighWaterMark,v=n(7526).q,b=v.ERR_INVALID_ARG_TYPE,y=v.ERR_STREAM_PUSH_AFTER_EOF,S=v.ERR_METHOD_NOT_IMPLEMENTED,w=v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(5717)(_,a);var C=m.errorOrDestroy,k=["error","close","destroy","pause","resume"];function E(e,t,r){i=i||n(2665),e=e||{},"boolean"!=typeof r&&(r=t instanceof i),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",r),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(u||(u=n(2553).StringDecoder),this.decoder=new u(e.encoding),this.encoding=e.encoding)}function _(e){if(i=i||n(2665),!(this instanceof _))return new _(e);var t=this instanceof i;this._readableState=new E(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function T(e,t,n,i,r){o("readableAddChunk",t);var s,a=e._readableState;if(null===t)a.reading=!1,function(e,t){if(o("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?A(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,P(e)))}}(e,a);else if(r||(s=function(e,t){var n,i;return i=t,l.isBuffer(i)||i instanceof c||"string"==typeof t||void 0===t||e.objectMode||(n=new b("chunk",["string","Buffer","Uint8Array"],t)),n}(a,t)),s)C(e,s);else if(a.objectMode||t&&t.length>0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),i)a.endEmitted?C(e,new w):x(e,a,t,!0);else if(a.ended)C(e,new y);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?x(e,a,t,!1):O(e,a)):x(e,a,t,!1)}else i||(a.reading=!1,O(e,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function x(e,t,n,i){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&A(e)),O(e,t)}Object.defineProperty(_.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){t(e)},_.prototype.push=function(e,t){var n,i=this._readableState;return i.objectMode?n=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=l.from(e,t),t=""),n=!0),T(this,e,t,!1,n)},_.prototype.unshift=function(e){return T(this,e,null,!0,!1)},_.prototype.isPaused=function(){return!1===this._readableState.flowing},_.prototype.setEncoding=function(e){u||(u=n(2553).StringDecoder);var t=new u(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var i=this._readableState.buffer.head,r="";null!==i;)r+=t.write(i.data),i=i.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var I=1073741824;function M(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(P,e))}function P(e){var t=e._readableState;o("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,L(e)}function O(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(o("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function N(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function D(e){o("readable nexttick read 0"),e.read(0)}function F(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),L(e),t.flowing&&!t.reading&&e.read(0)}function L(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function U(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(V,t,e))}function V(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function j(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return n;return-1}_.prototype.read=function(e){o("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?U(this):A(this),null;if(0===(e=M(e,t))&&t.ended)return 0===t.length&&U(this),null;var i,r=t.needReadable;return o("need readable",r),(0===t.length||t.length-e<t.highWaterMark)&&o("length less than watermark",r=!0),t.ended||t.reading?o("reading or ended",r=!1):r&&(o("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=M(n,t))),null===(i=e>0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&U(this)),null!==i&&this.emit("data",i),i},_.prototype._read=function(e){C(this,new S("_read()"))},_.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,o("pipe count=%d opts=%j",i.pipesCount,t);var a=t&&!1===t.end||e===r.stdout||e===r.stderr?m:l;function l(){o("onend"),e.end()}i.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",(function t(r,s){o("onunpipe"),r===n&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),e.removeListener("close",p),e.removeListener("finish",f),e.removeListener("drain",c),e.removeListener("error",h),e.removeListener("unpipe",t),n.removeListener("end",l),n.removeListener("end",m),n.removeListener("data",u),d=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||c())}));var c=function(e){return function(){var t=e._readableState;o("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,L(e))}}(n);e.on("drain",c);var d=!1;function u(t){o("ondata");var r=e.write(t);o("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==j(i.pipes,e))&&!d&&(o("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function h(t){o("onerror",t),m(),e.removeListener("error",h),0===s(e,"error")&&C(e,t)}function p(){e.removeListener("finish",f),m()}function f(){o("onfinish"),e.removeListener("close",p),m()}function m(){o("unpipe"),n.unpipe(e)}return n.on("data",u),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",p),e.once("finish",f),e.emit("pipe",n),i.flowing||(o("pipe resume"),n.resume()),e},_.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<r;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=j(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},_.prototype.on=function(e,t){var n=a.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,o("on readable",i.length,i.reading),i.length?A(this):i.reading||r.nextTick(D,this))),n},_.prototype.addListener=_.prototype.on,_.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(N,this),n},_.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(N,this),t},_.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(F,e,t))}(this,e)),e.paused=!1,this},_.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},_.prototype.wrap=function(e){var t=this,n=this._readableState,i=!1;for(var r in e.on("end",(function(){if(o("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(r){o("wrapped data"),n.decoder&&(r=n.decoder.write(r)),n.objectMode&&null==r||(n.objectMode||r&&r.length)&&(t.push(r)||(i=!0,e.pause()))})),e)void 0===this[r]&&"function"==typeof e[r]&&(this[r]=function(t){return function(){return e[t].apply(e,arguments)}}(r));for(var s=0;s<k.length;s++)e.on(k[s],this.emit.bind(this,k[s]));return this._read=function(t){o("wrapped _read",t),i&&(i=!1,e.resume())},this},"function"==typeof Symbol&&(_.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=n(468)),h(this)}),Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(_.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(_.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),_._fromList=B,Object.defineProperty(_.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(_.from=function(e,t){return void 0===p&&(p=n(2881)),p(_,e,t)})},2865:(e,t,n)=>{"use strict";e.exports=d;var i=n(7526).q,r=i.ERR_METHOD_NOT_IMPLEMENTED,o=i.ERR_MULTIPLE_CALLBACK,s=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=i.ERR_TRANSFORM_WITH_LENGTH_0,l=n(2665);function c(e,t){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(null===i)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),i(e);var r=this._readableState;r.reading=!1,(r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}function d(e){if(!(this instanceof d))return new d(e);l.call(this,e),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",u)}function u(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(t,n){h(e,t,n)}))}function h(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new a;if(e._transformState.transforming)throw new s;return e.push(null)}n(5717)(d,l),d.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},d.prototype._transform=function(e,t,n){n(new r("_transform()"))},d.prototype._write=function(e,t,n){var i=this._transformState;if(i.writecb=n,i.writechunk=e,i.writeencoding=t,!i.transforming){var r=this._readableState;(i.needTransform||r.needReadable||r.length<r.highWaterMark)&&this._read(r.highWaterMark)}},d.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},d.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,(function(e){t(e)}))}},5270:(e,t,n)=>{"use strict";var i,r=n(4155);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var i=e.entry;for(e.entry=null;i;){var r=i.callback;t.pendingcb--,r(void 0),i=i.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=_,_.WritableState=E;var s,a={deprecate:n(4927)},l=n(6832),c=n(8764).Buffer,d=n.g.Uint8Array||function(){},u=n(7056),h=n(9226).getHighWaterMark,p=n(7526).q,f=p.ERR_INVALID_ARG_TYPE,m=p.ERR_METHOD_NOT_IMPLEMENTED,g=p.ERR_MULTIPLE_CALLBACK,v=p.ERR_STREAM_CANNOT_PIPE,b=p.ERR_STREAM_DESTROYED,y=p.ERR_STREAM_NULL_VALUES,S=p.ERR_STREAM_WRITE_AFTER_END,w=p.ERR_UNKNOWN_ENCODING,C=u.errorOrDestroy;function k(){}function E(e,t,s){i=i||n(2665),e=e||{},"boolean"!=typeof s&&(s=t instanceof i),this.objectMode=!!e.objectMode,s&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,i,o){--t.pendingcb,n?(r.nextTick(o,i),r.nextTick(P,e,t),e._writableState.errorEmitted=!0,C(e,i)):(o(i),e._writableState.errorEmitted=!0,C(e,i),P(e,t))}(e,n,i,t,o);else{var s=M(n)||e.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||I(e,n),i?r.nextTick(x,e,n,s,o):x(e,n,s,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function _(e){var t=this instanceof(i=i||n(2665));if(!t&&!s.call(_,this))return new _(e);this._writableState=new E(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),l.call(this)}function T(e,t,n,i,r,o,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new b("write")):n?e._writev(r,t.onwrite):e._write(r,o,t.onwrite),t.sync=!1}function x(e,t,n,i){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,i(),P(e,t)}function I(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var i=t.bufferedRequestCount,r=new Array(i),s=t.corkedRequestsFree;s.entry=n;for(var a=0,l=!0;n;)r[a]=n,n.isBuf||(l=!1),n=n.next,a+=1;r.allBuffers=l,T(e,t,!0,t.length,r,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,d=n.encoding,u=n.callback;if(T(e,t,!1,t.objectMode?1:c.length,c,d,u),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function M(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function A(e,t){e._final((function(n){t.pendingcb--,n&&C(e,n),t.prefinished=!0,e.emit("prefinish"),P(e,t)}))}function P(e,t){var n=M(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,r.nextTick(A,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return n}n(5717)(_,l),E.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(E.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(e){return!!s.call(this,e)||this===_&&e&&e._writableState instanceof E}})):s=function(e){return e instanceof this},_.prototype.pipe=function(){C(this,new v)},_.prototype.write=function(e,t,n){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=e,c.isBuffer(i)||i instanceof d);return a&&!c.isBuffer(e)&&(e=function(e){return c.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=k),o.ending?function(e,t){var n=new S;C(e,n),r.nextTick(t,n)}(this,n):(a||function(e,t,n,i){var o;return null===n?o=new y:"string"==typeof n||t.objectMode||(o=new f("chunk",["string","Buffer"],n)),!o||(C(e,o),r.nextTick(i,o),!1)}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,n,i,r,o){if(!n){var s=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=c.from(t,n)),t}(t,i,r);i!==s&&(n=!0,r="buffer",i=s)}var a=t.objectMode?1:i.length;t.length+=a;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:r,isBuf:n,callback:o,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,a,i,r,o);return l}(this,o,a,e,t,n)),s},_.prototype.cork=function(){this._writableState.corked++},_.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||I(this,e))},_.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new w(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(_.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new m("_write()"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,P(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(_.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(_.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=u.destroy,_.prototype._undestroy=u.undestroy,_.prototype._destroy=function(e,t){t(e)}},468:(e,t,n)=>{"use strict";var i,r=n(4155);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s=n(2478),a=Symbol("lastResolve"),l=Symbol("lastReject"),c=Symbol("error"),d=Symbol("ended"),u=Symbol("lastPromise"),h=Symbol("handlePromise"),p=Symbol("stream");function f(e,t){return{value:e,done:t}}function m(e){var t=e[a];if(null!==t){var n=e[p].read();null!==n&&(e[u]=null,e[a]=null,e[l]=null,t(f(n,!1)))}}function g(e){r.nextTick(m,e)}var v=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((o(i={get stream(){return this[p]},next:function(){var e=this,t=this[c];if(null!==t)return Promise.reject(t);if(this[d])return Promise.resolve(f(void 0,!0));if(this[p].destroyed)return new Promise((function(t,n){r.nextTick((function(){e[c]?n(e[c]):t(f(void 0,!0))}))}));var n,i=this[u];if(i)n=new Promise(function(e,t){return function(n,i){e.then((function(){t[d]?n(f(void 0,!0)):t[h](n,i)}),i)}}(i,this));else{var o=this[p].read();if(null!==o)return Promise.resolve(f(o,!1));n=new Promise(this[h])}return this[u]=n,n}},Symbol.asyncIterator,(function(){return this})),o(i,"return",(function(){var e=this;return new Promise((function(t,n){e[p].destroy(null,(function(e){e?n(e):t(f(void 0,!0))}))}))})),i),v);e.exports=function(e){var t,n=Object.create(b,(o(t={},p,{value:e,writable:!0}),o(t,a,{value:null,writable:!0}),o(t,l,{value:null,writable:!0}),o(t,c,{value:null,writable:!0}),o(t,d,{value:e._readableState.endEmitted,writable:!0}),o(t,h,{value:function(e,t){var i=n[p].read();i?(n[u]=null,n[a]=null,n[l]=null,e(f(i,!1))):(n[a]=e,n[l]=t)},writable:!0}),t));return n[u]=null,s(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[l];return null!==t&&(n[u]=null,n[a]=null,n[l]=null,t(e)),void(n[c]=e)}var i=n[a];null!==i&&(n[u]=null,n[a]=null,n[l]=null,i(f(void 0,!0))),n[d]=!0})),e.on("readable",g.bind(null,n)),n}},4210:(e,t,n)=>{"use strict";function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=n(8764).Buffer,s=n(1801).inspect,a=s&&s.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t;return t=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,i,r=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=r,i=a,o.prototype.copy.call(t,n,i),a+=s.data.length,s=s.next;return r}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,i=t.data;for(e-=i.length;t=t.next;){var r=t.data,o=e>r.length?r.length:e;if(o===r.length?i+=r:i+=r.slice(0,e),0==(e-=o)){o===r.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=r.slice(o));break}++n}return this.length-=n,i}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,i=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var r=n.data,s=e>r.length?r.length:e;if(r.copy(t,t.length-e,0,s),0==(e-=s)){s===r.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=r.slice(s));break}++i}return this.length-=i,t}},{key:a,value:function(e,t){return s(this,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}],t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),e}()},7056:(e,t,n)=>{"use strict";var i=n(4155);function r(e,t){s(e,t),o(e)}function o(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function s(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,a=this._readableState&&this._readableState.destroyed,l=this._writableState&&this._writableState.destroyed;return a||l?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(s,this,e)):i.nextTick(s,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?n._writableState?n._writableState.errorEmitted?i.nextTick(o,n):(n._writableState.errorEmitted=!0,i.nextTick(r,n,e)):i.nextTick(r,n,e):t?(i.nextTick(o,n),t(e)):i.nextTick(o,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,i=e._writableState;n&&n.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}}},2478:(e,t,n)=>{"use strict";var i=n(7526).q.ERR_STREAM_PREMATURE_CLOSE;function r(){}e.exports=function e(t,n,o){if("function"==typeof n)return e(t,null,n);n||(n={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];e.apply(this,i)}}}(o||r);var s=n.readable||!1!==n.readable&&t.readable,a=n.writable||!1!==n.writable&&t.writable,l=function(){t.writable||d()},c=t._writableState&&t._writableState.finished,d=function(){a=!1,c=!0,s||o.call(t)},u=t._readableState&&t._readableState.endEmitted,h=function(){s=!1,u=!0,a||o.call(t)},p=function(e){o.call(t,e)},f=function(){var e;return s&&!u?(t._readableState&&t._readableState.ended||(e=new i),o.call(t,e)):a&&!c?(t._writableState&&t._writableState.ended||(e=new i),o.call(t,e)):void 0},m=function(){t.req.on("finish",d)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",d),t.on("abort",f),t.req?m():t.on("request",m)):a&&!t._writableState&&(t.on("end",l),t.on("close",l)),t.on("end",h),t.on("finish",d),!1!==n.error&&t.on("error",p),t.on("close",f),function(){t.removeListener("complete",d),t.removeListener("abort",f),t.removeListener("request",m),t.req&&t.req.removeListener("finish",d),t.removeListener("end",l),t.removeListener("close",l),t.removeListener("finish",d),t.removeListener("end",h),t.removeListener("error",p),t.removeListener("close",f)}}},2881:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},4153:(e,t,n)=>{"use strict";var i,r=n(7526).q,o=r.ERR_MISSING_ARGS,s=r.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function l(e,t,r,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var a=!1;e.on("close",(function(){a=!0})),void 0===i&&(i=n(2478)),i(e,{readable:t,writable:r},(function(e){if(e)return o(e);a=!0,o()}));var l=!1;return function(t){if(!a&&!l)return l=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new s("pipe"))}}function c(e){e()}function d(e,t){return e.pipe(t)}function u(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}e.exports=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i,r=u(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new o("streams");var s=t.map((function(e,n){var o=n<t.length-1;return l(e,o,n>0,(function(e){i||(i=e),e&&s.forEach(c),o||(s.forEach(c),r(i))}))}));return t.reduce(d)}},9226:(e,t,n)=>{"use strict";var i=n(7526).q.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,n,r){var o=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,r,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new i(r?n:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},6832:(e,t,n)=>{e.exports=n(7187).EventEmitter},4050:(e,t,n)=>{(t=e.exports=n(5689)).Stream=t,t.Readable=t,t.Writable=n(5270),t.Duplex=n(2665),t.Transform=n(2865),t.PassThrough=n(9197),t.finished=n(2478),t.pipeline=n(4153)},9591:(e,t,n)=>{"use strict";const{Deflate:i,deflate:r,deflateRaw:o,gzip:s}=n(4555),{Inflate:a,inflate:l,inflateRaw:c,ungzip:d}=n(8843),u=n(1619);e.exports.Deflate=i,e.exports.deflate=r,e.exports.deflateRaw=o,e.exports.gzip=s,e.exports.Inflate=a,e.exports.inflate=l,e.exports.inflateRaw=c,e.exports.ungzip=d,e.exports.constants=u},4555:(e,t,n)=>{"use strict";const i=n(405),r=n(6247),o=n(9373),s=n(8898),a=n(2292),l=Object.prototype.toString,{Z_NO_FLUSH:c,Z_SYNC_FLUSH:d,Z_FULL_FLUSH:u,Z_FINISH:h,Z_OK:p,Z_STREAM_END:f,Z_DEFAULT_COMPRESSION:m,Z_DEFAULT_STRATEGY:g,Z_DEFLATED:v}=n(1619);function b(e){this.options=r.assign({level:m,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:g},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;let n=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==p)throw new Error(s[n]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?o.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=i.deflateSetDictionary(this.strm,e),n!==p)throw new Error(s[n]);this._dict_set=!0}}function y(e,t){const n=new b(t);if(n.push(e,!0),n.err)throw n.msg||s[n.err];return n.result}b.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let s,a;if(this.ended)return!1;for(a=t===~~t?t:!0===t?h:c,"string"==typeof e?n.input=o.string2buf(e):"[object ArrayBuffer]"===l.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;)if(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===d||a===u)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(s=i.deflate(n,a),s===f)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),s=i.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===p;if(0!==n.avail_out){if(a>0&&n.next_out>0)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else if(0===n.avail_in)break}else this.onData(n.output)}return!0},b.prototype.onData=function(e){this.chunks.push(e)},b.prototype.onEnd=function(e){e===p&&(this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},e.exports.Deflate=b,e.exports.deflate=y,e.exports.deflateRaw=function(e,t){return(t=t||{}).raw=!0,y(e,t)},e.exports.gzip=function(e,t){return(t=t||{}).gzip=!0,y(e,t)},e.exports.constants=n(1619)},8843:(e,t,n)=>{"use strict";const i=n(6351),r=n(6247),o=n(9373),s=n(8898),a=n(2292),l=n(2401),c=Object.prototype.toString,{Z_NO_FLUSH:d,Z_FINISH:u,Z_OK:h,Z_STREAM_END:p,Z_NEED_DICT:f,Z_STREAM_ERROR:m,Z_DATA_ERROR:g,Z_MEM_ERROR:v}=n(1619);function b(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 a,this.strm.avail_out=0;let n=i.inflateInit2(this.strm,t.windowBits);if(n!==h)throw new Error(s[n]);if(this.header=new l,i.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=o.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=i.inflateSetDictionary(this.strm,t.dictionary),n!==h)))throw new Error(s[n])}function y(e,t){const n=new b(t);if(n.push(e),n.err)throw n.msg||s[n.err];return n.result}b.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,s=this.options.dictionary;let a,l,b;if(this.ended)return!1;for(l=t===~~t?t:!0===t?u:d,"[object ArrayBuffer]"===c.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){for(0===n.avail_out&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),a=i.inflate(n,l),a===f&&s&&(a=i.inflateSetDictionary(n,s),a===h?a=i.inflate(n,l):a===g&&(a=f));n.avail_in>0&&a===p&&n.state.wrap>0&&0!==e[n.next_in];)i.inflateReset(n),a=i.inflate(n,l);switch(a){case m:case g:case f:case v:return this.onEnd(a),this.ended=!0,!1}if(b=n.avail_out,n.next_out&&(0===n.avail_out||a===p))if("string"===this.options.to){let e=o.utf8border(n.output,n.next_out),t=n.next_out-e,i=o.buf2string(n.output,e);n.next_out=t,n.avail_out=r-t,t&&n.output.set(n.output.subarray(e,e+t),0),this.onData(i)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(a!==h||0!==b){if(a===p)return a=i.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},b.prototype.onData=function(e){this.chunks.push(e)},b.prototype.onEnd=function(e){e===h&&("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=b,e.exports.inflate=y,e.exports.inflateRaw=function(e,t){return(t=t||{}).raw=!0,y(e,t)},e.exports.ungzip=y,e.exports.constants=n(1619)},6247:e=>{"use strict";const t=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);e.exports.assign=function(e){const n=Array.prototype.slice.call(arguments,1);for(;n.length;){const i=n.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(const n in i)t(i,n)&&(e[n]=i[n])}}return e},e.exports.flattenChunks=e=>{let t=0;for(let n=0,i=e.length;n<i;n++)t+=e[n].length;const n=new Uint8Array(t);for(let t=0,i=0,r=e.length;t<r;t++){let r=e[t];n.set(r,i),i+=r.length}return n}},9373:e=>{"use strict";let t=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){t=!1}const n=new Uint8Array(256);for(let e=0;e<256;e++)n[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;n[254]=n[254]=1,e.exports.string2buf=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,i,r,o,s=e.length,a=0;for(r=0;r<s;r++)n=e.charCodeAt(r),55296==(64512&n)&&r+1<s&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),a+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(a),o=0,r=0;o<a;r++)n=e.charCodeAt(r),55296==(64512&n)&&r+1<s&&(i=e.charCodeAt(r+1),56320==(64512&i)&&(n=65536+(n-55296<<10)+(i-56320),r++)),n<128?t[o++]=n:n<2048?(t[o++]=192|n>>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},e.exports.buf2string=(e,i)=>{const r=i||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,i));let o,s;const a=new Array(2*r);for(s=0,o=0;o<r;){let t=e[o++];if(t<128){a[s++]=t;continue}let i=n[t];if(i>4)a[s++]=65533,o+=i-1;else{for(t&=2===i?31:3===i?15:7;i>1&&o<r;)t=t<<6|63&e[o++],i--;i>1?a[s++]=65533:t<65536?a[s++]=t:(t-=65536,a[s++]=55296|t>>10&1023,a[s++]=56320|1023&t)}}return((e,n)=>{if(n<65534&&e.subarray&&t)return String.fromCharCode.apply(null,e.length===n?e:e.subarray(0,n));let i="";for(let t=0;t<n;t++)i+=String.fromCharCode(e[t]);return i})(a,s)},e.exports.utf8border=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let i=t-1;for(;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+n[e[i]]>t?i:t}},6069:e=>{"use strict";e.exports=(e,t,n,i)=>{let r=65535&e|0,o=e>>>16&65535|0,s=0;for(;0!==n;){s=n>2e3?2e3:n,n-=s;do{r=r+t[i++]|0,o=o+r|0}while(--s);r%=65521,o%=65521}return r|o<<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 n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());e.exports=(e,n,i,r)=>{const o=t,s=r+i;e^=-1;for(let t=r;t<s;t++)e=e>>>8^o[255&(e^n[t])];return-1^e}},405:(e,t,n)=>{"use strict";const{_tr_init:i,_tr_stored_block:r,_tr_flush_block:o,_tr_tally:s,_tr_align:a}=n(342),l=n(6069),c=n(2869),d=n(8898),{Z_NO_FLUSH:u,Z_PARTIAL_FLUSH:h,Z_FULL_FLUSH:p,Z_FINISH:f,Z_BLOCK:m,Z_OK:g,Z_STREAM_END:v,Z_STREAM_ERROR:b,Z_DATA_ERROR:y,Z_BUF_ERROR:S,Z_DEFAULT_COMPRESSION:w,Z_FILTERED:C,Z_HUFFMAN_ONLY:k,Z_RLE:E,Z_FIXED:_,Z_DEFAULT_STRATEGY:T,Z_UNKNOWN:x,Z_DEFLATED:I}=n(1619),M=258,A=262,P=42,O=113,R=666,N=(e,t)=>(e.msg=d[t],t),D=e=>2*e-(e>4?9:0),F=e=>{let t=e.length;for(;--t>=0;)e[t]=0},L=e=>{let t,n,i,r=e.w_size;t=e.hash_size,i=t;do{n=e.head[--i],e.head[i]=n>=r?n-r:0}while(--t);t=r,i=t;do{n=e.prev[--i],e.prev[i]=n>=r?n-r:0}while(--t)};let B=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const U=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},V=(e,t)=>{o(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,U(e.strm)},j=(e,t)=>{e.pending_buf[e.pending++]=t},z=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},$=(e,t,n,i)=>{let r=e.avail_in;return r>i&&(r=i),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),n),1===e.state.wrap?e.adler=l(e.adler,t,r,n):2===e.state.wrap&&(e.adler=c(e.adler,t,r,n)),e.next_in+=r,e.total_in+=r,r)},W=(e,t)=>{let n,i,r=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-A?e.strstart-(e.w_size-A):0,c=e.window,d=e.w_mask,u=e.prev,h=e.strstart+M;let p=c[o+s-1],f=c[o+s];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(n=t,c[n+s]===f&&c[n+s-1]===p&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&o<h);if(i=M-(h-o),o=h-M,i>s){if(e.match_start=t,s=i,i>=a)break;p=c[o+s-1],f=c[o+s]}}}while((t=u[t&d])>l&&0!=--r);return s<=e.lookahead?s:e.lookahead},H=e=>{const t=e.w_size;let n,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-A)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),L(e),i+=t),0===e.strm.avail_in)break;if(n=$(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=3)for(r=e.strstart-e.insert,e.ins_h=e.window[r],e.ins_h=B(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=B(e,e.ins_h,e.window[r+3-1]),e.prev[r&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=r,r++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<A&&0!==e.strm.avail_in)},q=(e,t)=>{let n,i,o,s=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,l=e.strm.avail_in;do{if(n=65535,o=e.bi_valid+42>>3,e.strm.avail_out<o)break;if(o=e.strm.avail_out-o,i=e.strstart-e.block_start,n>i+e.strm.avail_in&&(n=i+e.strm.avail_in),n>o&&(n=o),n<s&&(0===n&&t!==f||t===u||n!==i+e.strm.avail_in))break;a=t===f&&n===i+e.strm.avail_in?1:0,r(e,0,0,a),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,U(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&($(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===a);return l-=e.strm.avail_in,l&&(l>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=l&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-l,e.strm.next_in),e.strstart),e.strstart+=l,e.insert+=l>e.w_size-e.insert?e.w_size-e.insert:l),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==u&&t!==f&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(o=e.window_size-e.strstart,e.strm.avail_in>o&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,o+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),o>e.strm.avail_in&&(o=e.strm.avail_in),o&&($(e.strm,e.window,e.strstart,o),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.high_water<e.strstart&&(e.high_water=e.strstart),o=e.bi_valid+42>>3,o=e.pending_buf_size-o>65535?65535:e.pending_buf_size-o,s=o>e.w_size?e.w_size:o,i=e.strstart-e.block_start,(i>=s||(i||t===f)&&t!==u&&0===e.strm.avail_in&&i<=o)&&(n=i>o?o:i,a=t===f&&0===e.strm.avail_in&&n===i?1:0,r(e,e.block_start,n,a),e.block_start+=n,U(e.strm)),a?3:1)},K=(e,t)=>{let n,i;for(;;){if(e.lookahead<A){if(H(e),e.lookahead<A&&t===u)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=B(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-A&&(e.match_length=W(e,n)),e.match_length>=3)if(i=s(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=B(e,e.ins_h,e.window[e.strstart+3-1]),n=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=B(e,e.ins_h,e.window[e.strstart+1]);else i=s(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(V(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===f?(V(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(V(e,!1),0===e.strm.avail_out)?1:2},G=(e,t)=>{let n,i,r;for(;;){if(e.lookahead<A){if(H(e),e.lookahead<A&&t===u)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=B(e,e.ins_h,e.window[e.strstart+3-1]),n=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!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-A&&(e.match_length=W(e,n),e.match_length<=5&&(e.strategy===C||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,i=s(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=B(e,e.ins_h,e.window[e.strstart+3-1]),n=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++,i&&(V(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=s(e,0,e.window[e.strstart-1]),i&&V(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&&(i=s(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===f?(V(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(V(e,!1),0===e.strm.avail_out)?1:2};function J(e,t,n,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=r}const Q=[new J(0,0,0,0,q),new J(4,4,8,4,K),new J(4,5,16,8,K),new J(4,6,32,32,K),new J(4,4,16,16,G),new J(8,16,32,32,G),new J(8,16,128,128,G),new J(8,32,128,256,G),new J(32,128,258,1024,G),new J(32,258,258,4096,G)];function Y(){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=I,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),F(this.dyn_ltree),F(this.dyn_dtree),F(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),F(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),F(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Z=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==P&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==O&&t.status!==R?1:0},X=e=>{if(Z(e))return N(e,b);e.total_in=e.total_out=0,e.data_type=x;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?P:O,e.adler=2===t.wrap?0:1,t.last_flush=-2,i(t),g},ee=e=>{const t=X(e);var n;return t===g&&((n=e.state).window_size=2*n.w_size,F(n.head),n.max_lazy_match=Q[n.level].max_lazy,n.good_match=Q[n.level].good_length,n.nice_match=Q[n.level].nice_length,n.max_chain_length=Q[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=2,n.match_available=0,n.ins_h=0),t},te=(e,t,n,i,r,o)=>{if(!e)return b;let s=1;if(t===w&&(t=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),r<1||r>9||n!==I||i<8||i>15||t<0||t>9||o<0||o>_||8===i&&1!==s)return N(e,b);8===i&&(i=9);const a=new Y;return e.state=a,a.strm=e,a.status=P,a.wrap=s,a.gzhead=null,a.w_bits=i,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=r+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<r+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=o,a.method=n,ee(e)};e.exports.deflateInit=(e,t)=>te(e,t,I,15,8,T),e.exports.deflateInit2=te,e.exports.deflateReset=ee,e.exports.deflateResetKeep=X,e.exports.deflateSetHeader=(e,t)=>Z(e)||2!==e.state.wrap?b:(e.state.gzhead=t,g),e.exports.deflate=(e,t)=>{if(Z(e)||t>m||t<0)return e?N(e,b):b;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===R&&t!==f)return N(e,0===e.avail_out?S:b);const i=n.last_flush;if(n.last_flush=t,0!==n.pending){if(U(e),0===e.avail_out)return n.last_flush=-1,g}else if(0===e.avail_in&&D(t)<=D(i)&&t!==f)return N(e,S);if(n.status===R&&0!==e.avail_in)return N(e,S);if(n.status===P&&0===n.wrap&&(n.status=O),n.status===P){let t=I+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=k||n.level<2?0:n.level<6?1:6===n.level?2:3,t|=i<<6,0!==n.strstart&&(t|=32),t+=31-t%31,z(n,t),0!==n.strstart&&(z(n,e.adler>>>16),z(n,65535&e.adler)),e.adler=1,n.status=O,U(e),0!==n.pending)return n.last_flush=-1,g}if(57===n.status)if(e.adler=0,j(n,31),j(n,139),j(n,8),n.gzhead)j(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),j(n,255&n.gzhead.time),j(n,n.gzhead.time>>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,9===n.level?2:n.strategy>=k||n.level<2?4:0),j(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,255&n.gzhead.extra.length),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=c(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,9===n.level?2:n.strategy>=k||n.level<2?4:0),j(n,3),n.status=O,U(e),0!==n.pending)return n.last_flush=-1,g;if(69===n.status){if(n.gzhead.extra){let t=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let r=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=c(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=r,U(e),0!==n.pending)return n.last_flush=-1,g;t=0,i-=r}let r=new Uint8Array(n.gzhead.extra);n.pending_buf.set(r.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>t&&(e.adler=c(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=c(e.adler,n.pending_buf,n.pending-i,i)),U(e),0!==n.pending)return n.last_flush=-1,g;i=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,j(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=c(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=c(e.adler,n.pending_buf,n.pending-i,i)),U(e),0!==n.pending)return n.last_flush=-1,g;i=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,j(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=c(e.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(U(e),0!==n.pending))return n.last_flush=-1,g;j(n,255&e.adler),j(n,e.adler>>8&255),e.adler=0}if(n.status=O,U(e),0!==n.pending)return n.last_flush=-1,g}if(0!==e.avail_in||0!==n.lookahead||t!==u&&n.status!==R){let i=0===n.level?q(n,t):n.strategy===k?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(H(e),0===e.lookahead)){if(t===u)return 1;break}if(e.match_length=0,n=s(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(V(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===f?(V(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(V(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===E?((e,t)=>{let n,i,r,o;const a=e.window;for(;;){if(e.lookahead<=M){if(H(e),e.lookahead<=M&&t===u)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,i=a[r],i===a[++r]&&i===a[++r]&&i===a[++r])){o=e.strstart+M;do{}while(i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&i===a[++r]&&r<o);e.match_length=M-(o-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=s(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=s(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(V(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===f?(V(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(V(e,!1),0===e.strm.avail_out)?1:2})(n,t):Q[n.level].func(n,t);if(3!==i&&4!==i||(n.status=R),1===i||3===i)return 0===e.avail_out&&(n.last_flush=-1),g;if(2===i&&(t===h?a(n):t!==m&&(r(n,0,0,!1),t===p&&(F(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),U(e),0===e.avail_out))return n.last_flush=-1,g}return t!==f?g:n.wrap<=0?v:(2===n.wrap?(j(n,255&e.adler),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,255&e.total_in),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(z(n,e.adler>>>16),z(n,65535&e.adler)),U(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?g:v)},e.exports.deflateEnd=e=>{if(Z(e))return b;const t=e.state.status;return e.state=null,t===O?N(e,y):g},e.exports.deflateSetDictionary=(e,t)=>{let n=t.length;if(Z(e))return b;const i=e.state,r=i.wrap;if(2===r||1===r&&i.status!==P||i.lookahead)return b;if(1===r&&(e.adler=l(e.adler,t,n,0)),i.wrap=0,n>=i.w_size){0===r&&(F(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(n-i.w_size,n),0),t=e,n=i.w_size}const o=e.avail_in,s=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,H(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=B(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,H(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=s,e.input=a,e.avail_in=o,i.wrap=r,g},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";const t=16209;e.exports=function(e,n){let i,r,o,s,a,l,c,d,u,h,p,f,m,g,v,b,y,S,w,C,k,E,_,T;const x=e.state;i=e.next_in,_=e.input,r=i+(e.avail_in-5),o=e.next_out,T=e.output,s=o-(n-e.avail_out),a=o+(e.avail_out-257),l=x.dmax,c=x.wsize,d=x.whave,u=x.wnext,h=x.window,p=x.hold,f=x.bits,m=x.lencode,g=x.distcode,v=(1<<x.lenbits)-1,b=(1<<x.distbits)-1;e:do{f<15&&(p+=_[i++]<<f,f+=8,p+=_[i++]<<f,f+=8),y=m[p&v];t:for(;;){if(S=y>>>24,p>>>=S,f-=S,S=y>>>16&255,0===S)T[o++]=65535&y;else{if(!(16&S)){if(0==(64&S)){y=m[(65535&y)+(p&(1<<S)-1)];continue t}if(32&S){x.mode=16191;break e}e.msg="invalid literal/length code",x.mode=t;break e}w=65535&y,S&=15,S&&(f<S&&(p+=_[i++]<<f,f+=8),w+=p&(1<<S)-1,p>>>=S,f-=S),f<15&&(p+=_[i++]<<f,f+=8,p+=_[i++]<<f,f+=8),y=g[p&b];n:for(;;){if(S=y>>>24,p>>>=S,f-=S,S=y>>>16&255,!(16&S)){if(0==(64&S)){y=g[(65535&y)+(p&(1<<S)-1)];continue n}e.msg="invalid distance code",x.mode=t;break e}if(C=65535&y,S&=15,f<S&&(p+=_[i++]<<f,f+=8,f<S&&(p+=_[i++]<<f,f+=8)),C+=p&(1<<S)-1,C>l){e.msg="invalid distance too far back",x.mode=t;break e}if(p>>>=S,f-=S,S=o-s,C>S){if(S=C-S,S>d&&x.sane){e.msg="invalid distance too far back",x.mode=t;break e}if(k=0,E=h,0===u){if(k+=c-S,S<w){w-=S;do{T[o++]=h[k++]}while(--S);k=o-C,E=T}}else if(u<S){if(k+=c+u-S,S-=u,S<w){w-=S;do{T[o++]=h[k++]}while(--S);if(k=0,u<w){S=u,w-=S;do{T[o++]=h[k++]}while(--S);k=o-C,E=T}}}else if(k+=u-S,S<w){w-=S;do{T[o++]=h[k++]}while(--S);k=o-C,E=T}for(;w>2;)T[o++]=E[k++],T[o++]=E[k++],T[o++]=E[k++],w-=3;w&&(T[o++]=E[k++],w>1&&(T[o++]=E[k++]))}else{k=o-C;do{T[o++]=T[k++],T[o++]=T[k++],T[o++]=T[k++],w-=3}while(w>2);w&&(T[o++]=T[k++],w>1&&(T[o++]=T[k++]))}break}}break}}while(i<r&&o<a);w=f>>3,i-=w,f-=w<<3,p&=(1<<f)-1,e.next_in=i,e.next_out=o,e.avail_in=i<r?r-i+5:5-(i-r),e.avail_out=o<a?a-o+257:257-(o-a),x.hold=p,x.bits=f}},6351:(e,t,n)=>{"use strict";const i=n(6069),r=n(2869),o=n(4264),s=n(9241),{Z_FINISH:a,Z_BLOCK:l,Z_TREES:c,Z_OK:d,Z_STREAM_END:u,Z_NEED_DICT:h,Z_STREAM_ERROR:p,Z_DATA_ERROR:f,Z_MEM_ERROR:m,Z_BUF_ERROR:g,Z_DEFLATED:v}=n(1619),b=16180,y=16190,S=16191,w=16192,C=16194,k=16199,E=16200,_=16206,T=16209,x=16210,I=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function M(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const A=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<b||t.mode>16211?1:0},P=e=>{if(A(e))return p;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=b,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,d},O=e=>{if(A(e))return p;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,P(e)},R=(e,t)=>{let n;if(A(e))return p;const i=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?p:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,O(e))},N=(e,t)=>{if(!e)return p;const n=new M;e.state=n,n.strm=e,n.window=null,n.mode=b;const i=R(e,t);return i!==d&&(e.state=null),i};let D,F,L=!0;const B=e=>{if(L){D=new Int32Array(512),F=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(s(1,e.lens,0,288,D,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(2,e.lens,0,32,F,0,e.work,{bits:5}),L=!1}e.lencode=D,e.lenbits=9,e.distcode=F,e.distbits=5},U=(e,t,n,i)=>{let r;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),i>=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>i&&(r=i),o.window.set(t.subarray(n-i,n-i+r),o.wnext),(i-=r)?(o.window.set(t.subarray(n-i,n),0),o.wnext=i,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=r))),0};e.exports.inflateReset=O,e.exports.inflateReset2=R,e.exports.inflateResetKeep=P,e.exports.inflateInit=e=>N(e,15),e.exports.inflateInit2=N,e.exports.inflate=(e,t)=>{let n,M,P,O,R,N,D,F,L,V,j,z,$,W,H,q,K,G,J,Q,Y,Z,X=0;const ee=new Uint8Array(4);let te,ne;const ie=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(A(e)||!e.output||!e.input&&0!==e.avail_in)return p;n=e.state,n.mode===S&&(n.mode=w),R=e.next_out,P=e.output,D=e.avail_out,O=e.next_in,M=e.input,N=e.avail_in,F=n.hold,L=n.bits,V=N,j=D,Z=d;e:for(;;)switch(n.mode){case b:if(0===n.wrap){n.mode=w;break}for(;L<16;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}if(2&n.wrap&&35615===F){0===n.wbits&&(n.wbits=15),n.check=0,ee[0]=255&F,ee[1]=F>>>8&255,n.check=r(n.check,ee,2,0),F=0,L=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&F)<<8)+(F>>8))%31){e.msg="incorrect header check",n.mode=T;break}if((15&F)!==v){e.msg="unknown compression method",n.mode=T;break}if(F>>>=4,L-=4,Y=8+(15&F),0===n.wbits&&(n.wbits=Y),Y>15||Y>n.wbits){e.msg="invalid window size",n.mode=T;break}n.dmax=1<<n.wbits,n.flags=0,e.adler=n.check=1,n.mode=512&F?16189:S,F=0,L=0;break;case 16181:for(;L<16;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}if(n.flags=F,(255&n.flags)!==v){e.msg="unknown compression method",n.mode=T;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=T;break}n.head&&(n.head.text=F>>8&1),512&n.flags&&4&n.wrap&&(ee[0]=255&F,ee[1]=F>>>8&255,n.check=r(n.check,ee,2,0)),F=0,L=0,n.mode=16182;case 16182:for(;L<32;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}n.head&&(n.head.time=F),512&n.flags&&4&n.wrap&&(ee[0]=255&F,ee[1]=F>>>8&255,ee[2]=F>>>16&255,ee[3]=F>>>24&255,n.check=r(n.check,ee,4,0)),F=0,L=0,n.mode=16183;case 16183:for(;L<16;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}n.head&&(n.head.xflags=255&F,n.head.os=F>>8),512&n.flags&&4&n.wrap&&(ee[0]=255&F,ee[1]=F>>>8&255,n.check=r(n.check,ee,2,0)),F=0,L=0,n.mode=16184;case 16184:if(1024&n.flags){for(;L<16;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}n.length=F,n.head&&(n.head.extra_len=F),512&n.flags&&4&n.wrap&&(ee[0]=255&F,ee[1]=F>>>8&255,n.check=r(n.check,ee,2,0)),F=0,L=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(z=n.length,z>N&&(z=N),z&&(n.head&&(Y=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(M.subarray(O,O+z),Y)),512&n.flags&&4&n.wrap&&(n.check=r(n.check,M,z,O)),N-=z,O+=z,n.length-=z),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===N)break e;z=0;do{Y=M[O+z++],n.head&&Y&&n.length<65536&&(n.head.name+=String.fromCharCode(Y))}while(Y&&z<N);if(512&n.flags&&4&n.wrap&&(n.check=r(n.check,M,z,O)),N-=z,O+=z,Y)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=16187;case 16187:if(4096&n.flags){if(0===N)break e;z=0;do{Y=M[O+z++],n.head&&Y&&n.length<65536&&(n.head.comment+=String.fromCharCode(Y))}while(Y&&z<N);if(512&n.flags&&4&n.wrap&&(n.check=r(n.check,M,z,O)),N-=z,O+=z,Y)break e}else n.head&&(n.head.comment=null);n.mode=16188;case 16188:if(512&n.flags){for(;L<16;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}if(4&n.wrap&&F!==(65535&n.check)){e.msg="header crc mismatch",n.mode=T;break}F=0,L=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=S;break;case 16189:for(;L<32;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}e.adler=n.check=I(F),F=0,L=0,n.mode=y;case y:if(0===n.havedict)return e.next_out=R,e.avail_out=D,e.next_in=O,e.avail_in=N,n.hold=F,n.bits=L,h;e.adler=n.check=1,n.mode=S;case S:if(t===l||t===c)break e;case w:if(n.last){F>>>=7&L,L-=7&L,n.mode=_;break}for(;L<3;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}switch(n.last=1&F,F>>>=1,L-=1,3&F){case 0:n.mode=16193;break;case 1:if(B(n),n.mode=k,t===c){F>>>=2,L-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=T}F>>>=2,L-=2;break;case 16193:for(F>>>=7&L,L-=7&L;L<32;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}if((65535&F)!=(F>>>16^65535)){e.msg="invalid stored block lengths",n.mode=T;break}if(n.length=65535&F,F=0,L=0,n.mode=C,t===c)break e;case C:n.mode=16195;case 16195:if(z=n.length,z){if(z>N&&(z=N),z>D&&(z=D),0===z)break e;P.set(M.subarray(O,O+z),R),N-=z,O+=z,D-=z,R+=z,n.length-=z;break}n.mode=S;break;case 16196:for(;L<14;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}if(n.nlen=257+(31&F),F>>>=5,L-=5,n.ndist=1+(31&F),F>>>=5,L-=5,n.ncode=4+(15&F),F>>>=4,L-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=T;break}n.have=0,n.mode=16197;case 16197:for(;n.have<n.ncode;){for(;L<3;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}n.lens[ie[n.have++]]=7&F,F>>>=3,L-=3}for(;n.have<19;)n.lens[ie[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,te={bits:n.lenbits},Z=s(0,n.lens,0,19,n.lencode,0,n.work,te),n.lenbits=te.bits,Z){e.msg="invalid code lengths set",n.mode=T;break}n.have=0,n.mode=16198;case 16198:for(;n.have<n.nlen+n.ndist;){for(;X=n.lencode[F&(1<<n.lenbits)-1],H=X>>>24,q=X>>>16&255,K=65535&X,!(H<=L);){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}if(K<16)F>>>=H,L-=H,n.lens[n.have++]=K;else{if(16===K){for(ne=H+2;L<ne;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}if(F>>>=H,L-=H,0===n.have){e.msg="invalid bit length repeat",n.mode=T;break}Y=n.lens[n.have-1],z=3+(3&F),F>>>=2,L-=2}else if(17===K){for(ne=H+3;L<ne;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}F>>>=H,L-=H,Y=0,z=3+(7&F),F>>>=3,L-=3}else{for(ne=H+7;L<ne;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}F>>>=H,L-=H,Y=0,z=11+(127&F),F>>>=7,L-=7}if(n.have+z>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=T;break}for(;z--;)n.lens[n.have++]=Y}}if(n.mode===T)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=T;break}if(n.lenbits=9,te={bits:n.lenbits},Z=s(1,n.lens,0,n.nlen,n.lencode,0,n.work,te),n.lenbits=te.bits,Z){e.msg="invalid literal/lengths set",n.mode=T;break}if(n.distbits=6,n.distcode=n.distdyn,te={bits:n.distbits},Z=s(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,te),n.distbits=te.bits,Z){e.msg="invalid distances set",n.mode=T;break}if(n.mode=k,t===c)break e;case k:n.mode=E;case E:if(N>=6&&D>=258){e.next_out=R,e.avail_out=D,e.next_in=O,e.avail_in=N,n.hold=F,n.bits=L,o(e,j),R=e.next_out,P=e.output,D=e.avail_out,O=e.next_in,M=e.input,N=e.avail_in,F=n.hold,L=n.bits,n.mode===S&&(n.back=-1);break}for(n.back=0;X=n.lencode[F&(1<<n.lenbits)-1],H=X>>>24,q=X>>>16&255,K=65535&X,!(H<=L);){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}if(q&&0==(240&q)){for(G=H,J=q,Q=K;X=n.lencode[Q+((F&(1<<G+J)-1)>>G)],H=X>>>24,q=X>>>16&255,K=65535&X,!(G+H<=L);){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}F>>>=G,L-=G,n.back+=G}if(F>>>=H,L-=H,n.back+=H,n.length=K,0===q){n.mode=16205;break}if(32&q){n.back=-1,n.mode=S;break}if(64&q){e.msg="invalid literal/length code",n.mode=T;break}n.extra=15&q,n.mode=16201;case 16201:if(n.extra){for(ne=n.extra;L<ne;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}n.length+=F&(1<<n.extra)-1,F>>>=n.extra,L-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;X=n.distcode[F&(1<<n.distbits)-1],H=X>>>24,q=X>>>16&255,K=65535&X,!(H<=L);){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}if(0==(240&q)){for(G=H,J=q,Q=K;X=n.distcode[Q+((F&(1<<G+J)-1)>>G)],H=X>>>24,q=X>>>16&255,K=65535&X,!(G+H<=L);){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}F>>>=G,L-=G,n.back+=G}if(F>>>=H,L-=H,n.back+=H,64&q){e.msg="invalid distance code",n.mode=T;break}n.offset=K,n.extra=15&q,n.mode=16203;case 16203:if(n.extra){for(ne=n.extra;L<ne;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}n.offset+=F&(1<<n.extra)-1,F>>>=n.extra,L-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=T;break}n.mode=16204;case 16204:if(0===D)break e;if(z=j-D,n.offset>z){if(z=n.offset-z,z>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=T;break}z>n.wnext?(z-=n.wnext,$=n.wsize-z):$=n.wnext-z,z>n.length&&(z=n.length),W=n.window}else W=P,$=R-n.offset,z=n.length;z>D&&(z=D),D-=z,n.length-=z;do{P[R++]=W[$++]}while(--z);0===n.length&&(n.mode=E);break;case 16205:if(0===D)break e;P[R++]=n.length,D--,n.mode=E;break;case _:if(n.wrap){for(;L<32;){if(0===N)break e;N--,F|=M[O++]<<L,L+=8}if(j-=D,e.total_out+=j,n.total+=j,4&n.wrap&&j&&(e.adler=n.check=n.flags?r(n.check,P,j,R-j):i(n.check,P,j,R-j)),j=D,4&n.wrap&&(n.flags?F:I(F))!==n.check){e.msg="incorrect data check",n.mode=T;break}F=0,L=0}n.mode=16207;case 16207:if(n.wrap&&n.flags){for(;L<32;){if(0===N)break e;N--,F+=M[O++]<<L,L+=8}if(4&n.wrap&&F!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=T;break}F=0,L=0}n.mode=16208;case 16208:Z=u;break e;case T:Z=f;break e;case x:return m;default:return p}return e.next_out=R,e.avail_out=D,e.next_in=O,e.avail_in=N,n.hold=F,n.bits=L,(n.wsize||j!==e.avail_out&&n.mode<T&&(n.mode<_||t!==a))&&U(e,e.output,e.next_out,j-e.avail_out)?(n.mode=x,m):(V-=e.avail_in,j-=e.avail_out,e.total_in+=V,e.total_out+=j,n.total+=j,4&n.wrap&&j&&(e.adler=n.check=n.flags?r(n.check,P,j,e.next_out-j):i(n.check,P,j,e.next_out-j)),e.data_type=n.bits+(n.last?64:0)+(n.mode===S?128:0)+(n.mode===k||n.mode===C?256:0),(0===V&&0===j||t===a)&&Z===d&&(Z=g),Z)},e.exports.inflateEnd=e=>{if(A(e))return p;let t=e.state;return t.window&&(t.window=null),e.state=null,d},e.exports.inflateGetHeader=(e,t)=>{if(A(e))return p;const n=e.state;return 0==(2&n.wrap)?p:(n.head=t,t.done=!1,d)},e.exports.inflateSetDictionary=(e,t)=>{const n=t.length;let r,o,s;return A(e)?p:(r=e.state,0!==r.wrap&&r.mode!==y?p:r.mode===y&&(o=1,o=i(o,t,n,0),o!==r.check)?f:(s=U(e,t,n,n),s?(r.mode=x,m):(r.havedict=1,d)))},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]),n=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),i=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,o,s,a,l,c,d,u)=>{const h=u.bits;let p,f,m,g,v,b,y=0,S=0,w=0,C=0,k=0,E=0,_=0,T=0,x=0,I=0,M=null;const A=new Uint16Array(16),P=new Uint16Array(16);let O,R,N,D=null;for(y=0;y<=15;y++)A[y]=0;for(S=0;S<a;S++)A[o[s+S]]++;for(k=h,C=15;C>=1&&0===A[C];C--);if(k>C&&(k=C),0===C)return l[c++]=20971520,l[c++]=20971520,u.bits=1,0;for(w=1;w<C&&0===A[w];w++);for(k<w&&(k=w),T=1,y=1;y<=15;y++)if(T<<=1,T-=A[y],T<0)return-1;if(T>0&&(0===e||1!==C))return-1;for(P[1]=0,y=1;y<15;y++)P[y+1]=P[y]+A[y];for(S=0;S<a;S++)0!==o[s+S]&&(d[P[o[s+S]]++]=S);if(0===e?(M=D=d,b=20):1===e?(M=t,D=n,b=257):(M=i,D=r,b=0),I=0,S=0,y=w,v=c,E=k,_=0,m=-1,x=1<<k,g=x-1,1===e&&x>852||2===e&&x>592)return 1;for(;;){O=y-_,d[S]+1<b?(R=0,N=d[S]):d[S]>=b?(R=D[d[S]-b],N=M[d[S]-b]):(R=96,N=0),p=1<<y-_,f=1<<E,w=f;do{f-=p,l[v+(I>>_)+f]=O<<24|R<<16|N|0}while(0!==f);for(p=1<<y-1;I&p;)p>>=1;if(0!==p?(I&=p-1,I+=p):I=0,S++,0==--A[y]){if(y===C)break;y=o[s+d[S]]}if(y>k&&(I&g)!==m){for(0===_&&(_=k),v+=w,E=y-_,T=1<<E;E+_<C&&(T-=A[E+_],!(T<=0));)E++,T<<=1;if(x+=1<<E,1===e&&x>852||2===e&&x>592)return 1;m=I&g,l[m]=k<<24|E<<16|v-c|0}}return 0!==I&&(l[v+I]=y-_<<24|64<<16|0),u.bits=k,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 n=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]),i=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]),o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=new Array(576);t(s);const a=new Array(60);t(a);const l=new Array(512);t(l);const c=new Array(256);t(c);const d=new Array(29);t(d);const u=new Array(30);function h(e,t,n,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}let p,f,m;function g(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(u);const v=e=>e<256?l[e]:l[256+(e>>>7)],b=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},y=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,b(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},S=(e,t,n)=>{y(e,n[2*t],n[2*t+1])},w=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},C=(e,t,n)=>{const i=new Array(16);let r,o,s=0;for(r=1;r<=15;r++)s=s+n[r-1]<<1,i[r]=s;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=w(i[t]++,t))}},k=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.sym_next=e.matches=0},E=e=>{e.bi_valid>8?b(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},_=(e,t,n,i)=>{const r=2*t,o=2*n;return e[r]<e[o]||e[r]===e[o]&&i[t]<=i[n]},T=(e,t,n)=>{const i=e.heap[n];let r=n<<1;for(;r<=e.heap_len&&(r<e.heap_len&&_(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!_(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i},x=(e,t,r)=>{let o,s,a,l,h=0;if(0!==e.sym_next)do{o=255&e.pending_buf[e.sym_buf+h++],o+=(255&e.pending_buf[e.sym_buf+h++])<<8,s=e.pending_buf[e.sym_buf+h++],0===o?S(e,s,t):(a=c[s],S(e,a+256+1,t),l=n[a],0!==l&&(s-=d[a],y(e,s,l)),o--,a=v(o),S(e,a,r),l=i[a],0!==l&&(o-=u[a],y(e,o,l)))}while(h<e.sym_next);S(e,256,t)},I=(e,t)=>{const n=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.elems;let s,a,l,c=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<o;s++)0!==n[2*s]?(e.heap[++e.heap_len]=c=s,e.depth[s]=0):n[2*s+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[2*l]=1,e.depth[l]=0,e.opt_len--,r&&(e.static_len-=i[2*l+1]);for(t.max_code=c,s=e.heap_len>>1;s>=1;s--)T(e,n,s);l=o;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],T(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=a,n[2*l]=n[2*s]+n[2*a],e.depth[l]=(e.depth[s]>=e.depth[a]?e.depth[s]:e.depth[a])+1,n[2*s+1]=n[2*a+1]=l,e.heap[1]=l++,T(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let c,d,u,h,p,f,m=0;for(h=0;h<=15;h++)e.bl_count[h]=0;for(n[2*e.heap[e.heap_max]+1]=0,c=e.heap_max+1;c<573;c++)d=e.heap[c],h=n[2*n[2*d+1]+1]+1,h>l&&(h=l,m++),n[2*d+1]=h,d>i||(e.bl_count[h]++,p=0,d>=a&&(p=s[d-a]),f=n[2*d],e.opt_len+=f*(h+p),o&&(e.static_len+=f*(r[2*d+1]+p)));if(0!==m){do{for(h=l-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[l]--,m-=2}while(m>0);for(h=l;0!==h;h--)for(d=e.bl_count[h];0!==d;)u=e.heap[--c],u>i||(n[2*u+1]!==h&&(e.opt_len+=(h-n[2*u+1])*n[2*u],n[2*u+1]=h),d--)}})(e,t),C(n,c,e.bl_count)},M=(e,t,n)=>{let i,r,o=-1,s=t[1],a=0,l=7,c=4;for(0===s&&(l=138,c=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)r=s,s=t[2*(i+1)+1],++a<l&&r===s||(a<c?e.bl_tree[2*r]+=a:0!==r?(r!==o&&e.bl_tree[2*r]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,o=r,0===s?(l=138,c=3):r===s?(l=6,c=3):(l=7,c=4))},A=(e,t,n)=>{let i,r,o=-1,s=t[1],a=0,l=7,c=4;for(0===s&&(l=138,c=3),i=0;i<=n;i++)if(r=s,s=t[2*(i+1)+1],!(++a<l&&r===s)){if(a<c)do{S(e,r,e.bl_tree)}while(0!=--a);else 0!==r?(r!==o&&(S(e,r,e.bl_tree),a--),S(e,16,e.bl_tree),y(e,a-3,2)):a<=10?(S(e,17,e.bl_tree),y(e,a-3,3)):(S(e,18,e.bl_tree),y(e,a-11,7));a=0,o=r,0===s?(l=138,c=3):r===s?(l=6,c=3):(l=7,c=4)}};let P=!1;const O=(e,t,n,i)=>{y(e,0+(i?1:0),3),E(e),b(e,n),b(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};e.exports._tr_init=e=>{P||((()=>{let e,t,o,g,v;const b=new Array(16);for(o=0,g=0;g<28;g++)for(d[g]=o,e=0;e<1<<n[g];e++)c[o++]=g;for(c[o-1]=g,v=0,g=0;g<16;g++)for(u[g]=v,e=0;e<1<<i[g];e++)l[v++]=g;for(v>>=7;g<30;g++)for(u[g]=v<<7,e=0;e<1<<i[g]-7;e++)l[256+v++]=g;for(t=0;t<=15;t++)b[t]=0;for(e=0;e<=143;)s[2*e+1]=8,e++,b[8]++;for(;e<=255;)s[2*e+1]=9,e++,b[9]++;for(;e<=279;)s[2*e+1]=7,e++,b[7]++;for(;e<=287;)s[2*e+1]=8,e++,b[8]++;for(C(s,287,b),e=0;e<30;e++)a[2*e+1]=5,a[2*e]=w(e,5);p=new h(s,n,257,286,15),f=new h(a,i,0,30,15),m=new h(new Array(0),r,0,19,7)})(),P=!0),e.l_desc=new g(e.dyn_ltree,p),e.d_desc=new g(e.dyn_dtree,f),e.bl_desc=new g(e.bl_tree,m),e.bi_buf=0,e.bi_valid=0,k(e)},e.exports._tr_stored_block=O,e.exports._tr_flush_block=(e,t,n,i)=>{let r,l,c=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),I(e,e.l_desc),I(e,e.d_desc),c=(e=>{let t;for(M(e,e.dyn_ltree,e.l_desc.max_code),M(e,e.dyn_dtree,e.d_desc.max_code),I(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*o[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,l=e.static_len+3+7>>>3,l<=r&&(r=l)):r=l=n+5,n+4<=r&&-1!==t?O(e,t,n,i):4===e.strategy||l===r?(y(e,2+(i?1:0),3),x(e,s,a)):(y(e,4+(i?1:0),3),((e,t,n,i)=>{let r;for(y(e,t-257,5),y(e,n-1,5),y(e,i-4,4),r=0;r<i;r++)y(e,e.bl_tree[2*o[r]+1],3);A(e,e.dyn_ltree,t-1),A(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,c+1),x(e,e.dyn_ltree,e.dyn_dtree)),k(e),i&&E(e)},e.exports._tr_tally=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(c[n]+256+1)]++,e.dyn_dtree[2*v(t)]++),e.sym_next===e.sym_end),e.exports._tr_align=e=>{y(e,2,3),S(e,256,s),(e=>{16===e.bi_valid?(b(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,n,i=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(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(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(e){t=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var a,l=[],c=!1,d=-1;function u(){c&&a&&(c=!1,a.length?l=a.concat(l):d=-1,l.length&&h())}function h(){if(!c){var e=s(u);c=!0;for(var t=l.length;t;){for(a=l,l=[];++d<t;)a&&a[d].run();d=-1,t=l.length}a=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function f(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new p(e,t)),1!==l.length||c||s(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=f,i.addListener=f,i.once=f,i.off=f,i.removeListener=f,i.removeAllListeners=f,i.emit=f,i.prependListener=f,i.prependOnceListener=f,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},2100:(e,t,n)=>{"use strict";e.exports=n(9482)},9482:(e,t,n)=>{"use strict";var i=t;function r(){i.util._configure(),i.Writer._configure(i.BufferWriter),i.Reader._configure(i.BufferReader)}i.build="minimal",i.Writer=n(1173),i.BufferWriter=n(3155),i.Reader=n(1408),i.BufferReader=n(593),i.util=n(9693),i.rpc=n(5994),i.roots=n(5054),i.configure=r,r()},1408:(e,t,n)=>{"use strict";e.exports=l;var i,r=n(9693),o=r.LongBits,s=r.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function l(e){this.buf=e,this.pos=0,this.len=e.length}var c,d="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new l(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new l(e);throw Error("illegal buffer")},u=function(){return r.Buffer?function(e){return(l.create=function(e){return r.Buffer.isBuffer(e)?new i(e):d(e)})(e)}:d};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function p(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new o(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}l.create=u(),l.prototype._slice=r.Array.prototype.subarray||r.Array.prototype.slice,l.prototype.uint32=(c=4294967295,function(){if(c=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return c;if(c=(c|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return c;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return c}),l.prototype.int32=function(){return 0|this.uint32()},l.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},l.prototype.bool=function(){return 0!==this.uint32()},l.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return p(this.buf,this.pos+=4)},l.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|p(this.buf,this.pos+=4)},l.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},l.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},l.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},l.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},l.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},l.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},l._configure=function(e){i=e,l.create=u(),i._configure();var t=r.Long?"toLong":"toNumber";r.merge(l.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},593:(e,t,n)=>{"use strict";e.exports=o;var i=n(1408);(o.prototype=Object.create(i.prototype)).constructor=o;var r=n(9693);function o(e){i.call(this,e)}o._configure=function(){r.Buffer&&(o.prototype._slice=r.Buffer.prototype.slice)},o.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))},o._configure()},5054:e=>{"use strict";e.exports={}},5994:(e,t,n)=>{"use strict";t.Service=n(7948)},7948:(e,t,n)=>{"use strict";e.exports=r;var i=n(9693);function r(e,t,n){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(n)}(r.prototype=Object.create(i.EventEmitter.prototype)).constructor=r,r.prototype.rpcCall=function e(t,n,r,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return i.asPromise(e,a,t,n,r,o);if(a.rpcImpl)try{return a.rpcImpl(t,n[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,n){if(e)return a.emit("error",e,t),s(e);if(null!==n){if(!(n instanceof r))try{n=r[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",n,t),s(null,n)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(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,n)=>{"use strict";e.exports=r;var i=n(9693);function r(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=r.zero=new r(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=r.zeroHash="\0\0\0\0\0\0\0\0";r.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return t&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new r(n,i)},r.from=function(e){if("number"==typeof e)return r.fromNumber(e);if(i.isString(e)){if(!i.Long)return r.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new r(e.low>>>0,e.high>>>0):o},r.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+4294967296*n)}return this.lo+4294967296*this.hi},r.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;r.fromHash=function(e){return e===s?o:new r((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},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,n=this.hi>>>24;return 0===n?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}},9693:function(e,t,n){"use strict";var i=t;function r(e,t,n){for(var i=Object.keys(t),r=0;r<i.length;++r)void 0!==e[i[r]]&&n||(e[i[r]]=t[i[r]]);return e}function o(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&r(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}i.asPromise=n(4537),i.base64=n(7419),i.EventEmitter=n(9211),i.float=n(945),i.inquire=n(7199),i.utf8=n(4997),i.pool=n(6662),i.LongBits=n(1945),i.isNode=Boolean(void 0!==n.g&&n.g&&n.g.process&&n.g.process.versions&&n.g.process.versions.node),i.global=i.isNode&&n.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},i.isString=function(e){return"string"==typeof e||e instanceof String},i.isObject=function(e){return e&&"object"==typeof e},i.isset=i.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},i.Buffer=function(){try{var e=i.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(e){return"number"==typeof e?i.Buffer?i._Buffer_allocUnsafe(e):new i.Array(e):i.Buffer?i._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},i.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(e){return e?i.LongBits.from(e).toHash():i.LongBits.zeroHash},i.longFromHash=function(e,t){var n=i.LongBits.fromHash(e);return i.Long?i.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},i.merge=r,i.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},i.newError=o,i.ProtocolError=o("ProtocolError"),i.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},i.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i._configure=function(){var e=i.Buffer;e?(i._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},i._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):i._Buffer_from=i._Buffer_allocUnsafe=null}},1173:(e,t,n)=>{"use strict";e.exports=u;var i,r=n(9693),o=r.LongBits,s=r.base64,a=r.utf8;function l(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function c(){}function d(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function u(){this.len=0,this.head=new l(c,0,0),this.tail=this.head,this.states=null}var h=function(){return r.Buffer?function(){return(u.create=function(){return new i})()}:function(){return new u}};function p(e,t,n){t[n]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function m(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function g(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}u.create=h(),u.alloc=function(e){return new r.Array(e)},r.Array!==Array&&(u.alloc=r.pool(u.alloc,r.Array.prototype.subarray)),u.prototype._push=function(e,t,n){return this.tail=this.tail.next=new l(e,t,n),this.len+=t,this},f.prototype=Object.create(l.prototype),f.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},u.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},u.prototype.int32=function(e){return e<0?this._push(m,10,o.fromNumber(e)):this.uint32(e)},u.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},u.prototype.uint64=function(e){var t=o.from(e);return this._push(m,t.length(),t)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(m,t.length(),t)},u.prototype.bool=function(e){return this._push(p,1,e?1:0)},u.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(e){var t=o.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(e){return this._push(r.float.writeFloatLE,4,e)},u.prototype.double=function(e){return this._push(r.float.writeDoubleLE,8,e)};var v=r.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var i=0;i<e.length;++i)t[n+i]=e[i]};u.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(p,1,0);if(r.isString(e)){var n=u.alloc(t=s.length(e));s.decode(e,n,0),e=n}return this.uint32(t)._push(v,t,e)},u.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(p,1,0)},u.prototype.fork=function(){return this.states=new d(this),this.head=this.tail=new l(c,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new l(c,0,0),this.len=0),this},u.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},u.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},u._configure=function(e){i=e,u.create=h(),i._configure()}},3155:(e,t,n)=>{"use strict";e.exports=o;var i=n(1173);(o.prototype=Object.create(i.prototype)).constructor=o;var r=n(9693);function o(){i.call(this)}function s(e,t,n){e.length<40?r.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}o._configure=function(){o.alloc=r._Buffer_allocUnsafe,o.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&"set"===r.Buffer.prototype.set.name?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var i=0;i<e.length;)t[n++]=e[i++]}},o.prototype.bytes=function(e){r.isString(e)&&(e=r._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=r.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},196:(e,t,n)=>{"use strict";const{AbortError:i,codes:r}=n(4381),o=n(8610),{ERR_INVALID_ARG_TYPE:s}=r;e.exports.addAbortSignal=function(t,n){if(((e,t)=>{if("object"!=typeof e||!("aborted"in e))throw new s("signal","AbortSignal",e)})(t),!(i=n)||"function"!=typeof i.pipe)throw new s("stream","stream.Stream",n);var i;return e.exports.addAbortSignalNoValidate(t,n)},e.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const n=()=>{t.destroy(new i(void 0,{cause:e.reason}))};return e.aborted?n():(e.addEventListener("abort",n),o(t,(()=>e.removeEventListener("abort",n)))),t}},7327:(e,t,n)=>{"use strict";const{StringPrototypeSlice:i,SymbolIterator:r,TypedArrayPrototypeSet:o,Uint8Array:s}=n(9061),{Buffer:a}=n(8764),{inspect:l}=n(6087);e.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(0===this.length)return"";let t=this.head,n=""+t.data;for(;null!==(t=t.next);)n+=e+t.data;return n}concat(e){if(0===this.length)return a.alloc(0);const t=a.allocUnsafe(e>>>0);let n=this.head,i=0;for(;n;)o(t,n.data,i),i+=n.data.length,n=n.next;return t}consume(e,t){const n=this.head.data;if(e<n.length){const t=n.slice(0,e);return this.head.data=n.slice(e),t}return e===n.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[r](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t="",n=this.head,r=0;do{const o=n.data;if(!(e>o.length)){e===o.length?(t+=o,++r,n.next?this.head=n.next:this.head=this.tail=null):(t+=i(o,0,e),this.head=n,n.data=i(o,e));break}t+=o,e-=o.length,++r}while(null!==(n=n.next));return this.length-=r,t}_getBuffer(e){const t=a.allocUnsafe(e),n=e;let i=this.head,r=0;do{const a=i.data;if(!(e>a.length)){e===a.length?(o(t,a,n-e),++r,i.next?this.head=i.next:this.head=this.tail=null):(o(t,new s(a.buffer,a.byteOffset,e),n-e),this.head=i,i.data=a.slice(e));break}o(t,a,n-e),e-=a.length,++r}while(null!==(i=i.next));return this.length-=r,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return l(this,{...t,depth:0,customInspect:!1})}}},299:(e,t,n)=>{"use strict";const{pipeline:i}=n(9946),r=n(8672),{destroyer:o}=n(1195),{isNodeStream:s,isReadable:a,isWritable:l}=n(5874),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:d,ERR_MISSING_ARGS:u}}=n(4381);e.exports=function(...e){if(0===e.length)throw new u("streams");if(1===e.length)return r.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=r.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=r.from(e[t])}for(let n=0;n<e.length;++n)if(s(e[n])){if(n<e.length-1&&!a(e[n]))throw new d(`streams[${n}]`,t[n],"must be readable");if(n>0&&!l(e[n]))throw new d(`streams[${n}]`,t[n],"must be writable")}let n,h,p,f,m;const g=e[0],v=i(e,(function(e){const t=f;f=null,t?t(e):e?m.destroy(e):y||b||m.destroy()})),b=!!l(g),y=!!a(v);return m=new r({writableObjectMode:!(null==g||!g.writableObjectMode),readableObjectMode:!(null==v||!v.writableObjectMode),writable:b,readable:y}),b&&(m._write=function(e,t,i){g.write(e,t)?i():n=i},m._final=function(e){g.end(),h=e},g.on("drain",(function(){if(n){const e=n;n=null,e()}})),v.on("finish",(function(){if(h){const e=h;h=null,e()}}))),y&&(v.on("readable",(function(){if(p){const e=p;p=null,e()}})),v.on("end",(function(){m.push(null)})),m._read=function(){for(;;){const e=v.read();if(null===e)return void(p=m._read);if(!m.push(e))return}}),m._destroy=function(e,t){e||null===f||(e=new c),p=null,n=null,h=null,null===f?t(e):(f=t,o(v,e))},m}},1195:(e,t,n)=>{"use strict";const i=n(4155),{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:o},AbortError:s}=n(4381),{Symbol:a}=n(9061),{kDestroyed:l,isDestroyed:c,isFinished:d,isServerRequest:u}=n(5874),h=a("kDestroy"),p=a("kConstruct");function f(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function m(e,t,n){let r=!1;function o(t){if(r)return;r=!0;const o=e._readableState,s=e._writableState;f(t,s,o),s&&(s.closed=!0),o&&(o.closed=!0),"function"==typeof n&&n(t),t?i.nextTick(g,e,t):i.nextTick(v,e)}try{e._destroy(t||null,o)}catch(t){o(t)}}function g(e,t){b(e,t),v(e)}function v(e){const t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(n&&n.emitClose||t&&t.emitClose)&&e.emit("close")}function b(e,t){const n=e._readableState,i=e._writableState;i&&i.errorEmitted||n&&n.errorEmitted||(i&&(i.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit("error",t))}function y(e,t,n){const r=e._readableState,o=e._writableState;if(o&&o.destroyed||r&&r.destroyed)return this;r&&r.autoDestroy||o&&o.autoDestroy?e.destroy(t):t&&(t.stack,o&&!o.errored&&(o.errored=t),r&&!r.errored&&(r.errored=t),n?i.nextTick(b,e,t):b(e,t))}function S(e){let t=!1;function n(n){if(t)return void y(e,null!=n?n:new o);t=!0;const r=e._readableState,s=e._writableState,a=s||r;r&&(r.constructed=!0),s&&(s.constructed=!0),a.destroyed?e.emit(h,n):n?y(e,n,!0):i.nextTick(w,e)}try{e._construct(n)}catch(e){n(e)}}function w(e){e.emit(p)}function C(e){return e&&e.setHeader&&"function"==typeof e.abort}function k(e){e.emit("close")}function E(e,t){e.emit("error",t),i.nextTick(k,e)}e.exports={construct:function(e,t){if("function"!=typeof e._construct)return;const n=e._readableState,r=e._writableState;n&&(n.constructed=!1),r&&(r.constructed=!1),e.once(p,t),e.listenerCount(p)>1||i.nextTick(S,e)},destroyer:function(e,t){e&&!c(e)&&(t||d(e)||(t=new s),u(e)?(e.socket=null,e.destroy(t)):C(e)?e.abort():C(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?i.nextTick(E,e,t):i.nextTick(k,e),e.destroyed||(e[l]=!0))},destroy:function(e,t){const n=this._readableState,i=this._writableState,o=i||n;return i&&i.destroyed||n&&n.destroyed?("function"==typeof t&&t(),this):(f(e,i,n),i&&(i.destroyed=!0),n&&(n.destroyed=!0),o.constructed?m(this,e,t):this.once(h,(function(n){m(this,r(n,e),t)})),this)},undestroy:function(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable)},errorOrDestroy:y}},8672:(e,t,n)=>{"use strict";const{ObjectDefineProperties:i,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:o,ObjectSetPrototypeOf:s}=n(9061);e.exports=c;const a=n(911),l=n(6304);s(c.prototype,a.prototype),s(c,a);{const e=o(l.prototype);for(let t=0;t<e.length;t++){const n=e[t];c.prototype[n]||(c.prototype[n]=l.prototype[n])}}function c(e){if(!(this instanceof c))return new c(e);a.call(this,e),l.call(this,e),e?(this.allowHalfOpen=!1!==e.allowHalfOpen,!1===e.readable&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===e.writable&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}let d,u;function h(){return void 0===d&&(d={}),d}i(c.prototype,{writable:{__proto__:null,...r(l.prototype,"writable")},writableHighWaterMark:{__proto__:null,...r(l.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...r(l.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...r(l.prototype,"writableBuffer")},writableLength:{__proto__:null,...r(l.prototype,"writableLength")},writableFinished:{__proto__:null,...r(l.prototype,"writableFinished")},writableCorked:{__proto__:null,...r(l.prototype,"writableCorked")},writableEnded:{__proto__:null,...r(l.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...r(l.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}}),c.fromWeb=function(e,t){return h().newStreamDuplexFromReadableWritablePair(e,t)},c.toWeb=function(e){return h().newReadableWritablePairFromDuplex(e)},c.from=function(e){return u||(u=n(7946)),u(e,"body")}},7946:(e,t,n)=>{const i=n(4155),r=n(8764),{isReadable:o,isWritable:s,isIterable:a,isNodeStream:l,isReadableNodeStream:c,isWritableNodeStream:d,isDuplexNodeStream:u}=n(5874),h=n(8610),{AbortError:p,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:m}}=n(4381),{destroyer:g}=n(1195),v=n(8672),b=n(911),{createDeferredPromise:y}=n(6087),S=n(6307),w=globalThis.Blob||r.Blob,C=void 0!==w?function(e){return e instanceof w}:function(e){return!1},k=globalThis.AbortController||n(8599).AbortController,{FunctionPrototypeCall:E}=n(9061);class _ extends v{constructor(e){super(e),!1===(null==e?void 0:e.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}function T(e){const t=e.readable&&"function"!=typeof e.readable.read?b.wrap(e.readable):e.readable,n=e.writable;let i,r,a,l,c,d=!!o(t),u=!!s(n);function f(e){const t=l;l=null,t?t(e):e?c.destroy(e):d||u||c.destroy()}return c=new _({readableObjectMode:!(null==t||!t.readableObjectMode),writableObjectMode:!(null==n||!n.writableObjectMode),readable:d,writable:u}),u&&(h(n,(e=>{u=!1,e&&g(t,e),f(e)})),c._write=function(e,t,r){n.write(e,t)?r():i=r},c._final=function(e){n.end(),r=e},n.on("drain",(function(){if(i){const e=i;i=null,e()}})),n.on("finish",(function(){if(r){const e=r;r=null,e()}}))),d&&(h(t,(e=>{d=!1,e&&g(t,e),f(e)})),t.on("readable",(function(){if(a){const e=a;a=null,e()}})),t.on("end",(function(){c.push(null)})),c._read=function(){for(;;){const e=t.read();if(null===e)return void(a=c._read);if(!c.push(e))return}}),c._destroy=function(e,o){e||null===l||(e=new p),a=null,i=null,r=null,null===l?o(e):(l=o,g(n,e),g(t,e))},c}e.exports=function e(t,n){if(u(t))return t;if(c(t))return T({readable:t});if(d(t))return T({writable:t});if(l(t))return T({writable:!1,readable:!1});if("function"==typeof t){const{value:e,write:r,final:o,destroy:s}=function(e){let{promise:t,resolve:n}=y();const r=new k,o=r.signal;return{value:e(async function*(){for(;;){const e=t;t=null;const{chunk:r,done:s,cb:a}=await e;if(i.nextTick(a),s)return;if(o.aborted)throw new p(void 0,{cause:o.reason});({promise:t,resolve:n}=y()),yield r}}(),{signal:o}),write(e,t,i){const r=n;n=null,r({chunk:e,done:!1,cb:i})},final(e){const t=n;n=null,t({done:!0,cb:e})},destroy(e,t){r.abort(),t(e)}}}(t);if(a(e))return S(_,e,{objectMode:!0,write:r,final:o,destroy:s});const l=null==e?void 0:e.then;if("function"==typeof l){let t;const n=E(l,e,(e=>{if(null!=e)throw new m("nully","body",e)}),(e=>{g(t,e)}));return t=new _({objectMode:!0,readable:!1,write:r,final(e){o((async()=>{try{await n,i.nextTick(e,null)}catch(t){i.nextTick(e,t)}}))},destroy:s})}throw new m("Iterable, AsyncIterable or AsyncFunction",n,e)}if(C(t))return e(t.arrayBuffer());if(a(t))return S(_,t,{objectMode:!0,writable:!1});if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return T({readable:null!=t&&t.readable?c(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?d(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});const r=null==t?void 0:t.then;if("function"==typeof r){let e;return E(r,t,(t=>{null!=t&&e.push(t),e.push(null)}),(t=>{g(e,t)})),e=new _({objectMode:!0,writable:!1,read(){}})}throw new f(n,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)}},8610:(e,t,n)=>{const i=n(4155),{AbortError:r,codes:o}=n(4381),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_PREMATURE_CLOSE:a}=o,{kEmptyObject:l,once:c}=n(6087),{validateAbortSignal:d,validateFunction:u,validateObject:h}=n(6547),{Promise:p}=n(9061),{isClosed:f,isReadable:m,isReadableNodeStream:g,isReadableFinished:v,isReadableErrored:b,isWritable:y,isWritableNodeStream:S,isWritableFinished:w,isWritableErrored:C,isNodeStream:k,willEmitClose:E}=n(5874);function _(e){return e.setHeader&&"function"==typeof e.abort}const T=()=>{};function x(e,t,n){var o,p;2===arguments.length?(n=t,t=l):null==t?t=l:h(t,"options"),u(n,"callback"),d(t.signal,"options.signal"),n=c(n);const x=null!==(o=t.readable)&&void 0!==o?o:g(e),I=null!==(p=t.writable)&&void 0!==p?p:S(e);if(!k(e))throw new s("stream","Stream",e);const M=e._writableState,A=e._readableState,P=()=>{e.writable||N()};let O=E(e)&&g(e)===x&&S(e)===I,R=w(e,!1);const N=()=>{R=!0,e.destroyed&&(O=!1),(!O||e.readable&&!x)&&(x&&!D||n.call(e))};let D=v(e,!1);const F=()=>{D=!0,e.destroyed&&(O=!1),(!O||e.writable&&!I)&&(I&&!R||n.call(e))},L=t=>{n.call(e,t)};let B=f(e);const U=()=>{B=!0;const t=C(e)||b(e);return t&&"boolean"!=typeof t?n.call(e,t):x&&!D&&g(e,!0)&&!v(e,!1)?n.call(e,new a):!I||R||w(e,!1)?void n.call(e):n.call(e,new a)},V=()=>{e.req.on("finish",N)};_(e)?(e.on("complete",N),O||e.on("abort",U),e.req?V():e.on("request",V)):I&&!M&&(e.on("end",P),e.on("close",P)),O||"boolean"!=typeof e.aborted||e.on("aborted",U),e.on("end",F),e.on("finish",N),!1!==t.error&&e.on("error",L),e.on("close",U),B?i.nextTick(U):null!=M&&M.errorEmitted||null!=A&&A.errorEmitted?O||i.nextTick(U):(x||O&&!m(e)||!R&&!1!==y(e))&&(I||O&&!y(e)||!D&&!1!==m(e))?A&&e.req&&e.aborted&&i.nextTick(U):i.nextTick(U);const j=()=>{n=T,e.removeListener("aborted",U),e.removeListener("complete",N),e.removeListener("abort",U),e.removeListener("request",V),e.req&&e.req.removeListener("finish",N),e.removeListener("end",P),e.removeListener("close",P),e.removeListener("finish",N),e.removeListener("end",F),e.removeListener("error",L),e.removeListener("close",U)};if(t.signal&&!B){const o=()=>{const i=n;j(),i.call(e,new r(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)i.nextTick(o);else{const i=n;n=c(((...n)=>{t.signal.removeEventListener("abort",o),i.apply(e,n)})),t.signal.addEventListener("abort",o)}}return j}e.exports=x,e.exports.finished=function(e,t){return new p(((n,i)=>{x(e,t,(e=>{e?i(e):n()}))}))}},6307:(e,t,n)=>{"use strict";const i=n(4155),{PromisePrototypeThen:r,SymbolAsyncIterator:o,SymbolIterator:s}=n(9061),{Buffer:a}=n(8764),{ERR_INVALID_ARG_TYPE:l,ERR_STREAM_NULL_VALUES:c}=n(4381).codes;e.exports=function(e,t,n){let d,u;if("string"==typeof t||t instanceof a)return new e({objectMode:!0,...n,read(){this.push(t),this.push(null)}});if(t&&t[o])u=!0,d=t[o]();else{if(!t||!t[s])throw new l("iterable",["Iterable"],t);u=!1,d=t[s]()}const h=new e({objectMode:!0,highWaterMark:1,...n});let p=!1;return h._read=function(){p||(p=!0,async function(){for(;;){try{const{value:e,done:t}=u?await d.next():d.next();if(t)h.push(null);else{const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw p=!1,new c;if(h.push(t))continue;p=!1}}catch(e){h.destroy(e)}break}}())},h._destroy=function(e,t){r(async function(e){const t=null!=e,n="function"==typeof d.throw;if(t&&n){const{value:t,done:n}=await d.throw(e);if(await t,n)return}if("function"==typeof d.return){const{value:e}=await d.return();await e}}(e),(()=>i.nextTick(t,e)),(n=>i.nextTick(t,n||e)))},h}},4870:(e,t,n)=>{"use strict";const{ArrayIsArray:i,ObjectSetPrototypeOf:r}=n(9061),{EventEmitter:o}=n(7187);function s(e){o.call(this,e)}function a(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?i(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}r(s.prototype,o.prototype),r(s,o),s.prototype.pipe=function(e,t){const n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function r(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",r),e._isStdio||t&&!1===t.end||(n.on("end",l),n.on("close",c));let s=!1;function l(){s||(s=!0,e.end())}function c(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function d(e){u(),0===o.listenerCount(this,"error")&&this.emit("error",e)}function u(){n.removeListener("data",i),e.removeListener("drain",r),n.removeListener("end",l),n.removeListener("close",c),n.removeListener("error",d),e.removeListener("error",d),n.removeListener("end",u),n.removeListener("close",u),e.removeListener("close",u)}return a(n,"error",d),a(e,"error",d),n.on("end",u),n.on("close",u),e.on("close",u),e.emit("pipe",n),e},e.exports={Stream:s,prependListener:a}},4382:(e,t,n)=>{"use strict";const i=globalThis.AbortController||n(8599).AbortController,{codes:{ERR_INVALID_ARG_TYPE:r,ERR_MISSING_ARGS:o,ERR_OUT_OF_RANGE:s},AbortError:a}=n(4381),{validateAbortSignal:l,validateInteger:c,validateObject:d}=n(6547),u=n(9061).Symbol("kWeak"),{finished:h}=n(8610),{ArrayPrototypePush:p,MathFloor:f,Number:m,NumberIsNaN:g,Promise:v,PromiseReject:b,PromisePrototypeThen:y,Symbol:S}=n(9061),w=S("kEmpty"),C=S("kEof");function k(e,t){if("function"!=typeof e)throw new r("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal");let n=1;return null!=(null==t?void 0:t.concurrency)&&(n=f(t.concurrency)),c(n,"concurrency",1),async function*(){var r,o;const s=new i,l=this,c=[],d=s.signal,u={signal:d},h=()=>s.abort();let p,f;null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted&&h(),null==t||null===(o=t.signal)||void 0===o||o.addEventListener("abort",h);let m=!1;function g(){m=!0}!async function(){try{for await(let t of l){var i;if(m)return;if(d.aborted)throw new a;try{t=e(t,u)}catch(e){t=b(e)}t!==w&&("function"==typeof(null===(i=t)||void 0===i?void 0:i.catch)&&t.catch(g),c.push(t),p&&(p(),p=null),!m&&c.length&&c.length>=n&&await new v((e=>{f=e})))}c.push(C)}catch(e){const t=b(e);y(t,void 0,g),c.push(t)}finally{var r;m=!0,p&&(p(),p=null),null==t||null===(r=t.signal)||void 0===r||r.removeEventListener("abort",h)}}();try{for(;;){for(;c.length>0;){const e=await c[0];if(e===C)return;if(d.aborted)throw new a;e!==w&&(yield e),c.shift(),f&&(f(),f=null)}await new v((e=>{p=e}))}}finally{s.abort(),m=!0,f&&(f(),f=null)}}.call(this)}async function E(e,t){for await(const n of _.call(this,e,t))return!0;return!1}function _(e,t){if("function"!=typeof e)throw new r("fn",["Function","AsyncFunction"],e);return k.call(this,(async function(t,n){return await e(t,n)?t:w}),t)}class T extends o{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function x(e){if(e=m(e),g(e))return 0;if(e<0)throw new s("number",">= 0",e);return e}e.exports.streamReturningOperators={asIndexedPairs:function(e){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal"),async function*(){let t=0;for await(const i of this){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new a({cause:e.signal.reason});yield[t++,i]}}.call(this)},drop:function(e,t){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),e=x(e),async function*(){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new a;for await(const n of this){var i;if(null!=t&&null!==(i=t.signal)&&void 0!==i&&i.aborted)throw new a;e--<=0&&(yield n)}}.call(this)},filter:_,flatMap:function(e,t){const n=k.call(this,e,t);return async function*(){for await(const e of n)yield*e}.call(this)},map:k,take:function(e,t){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),e=x(e),async function*(){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new a;for await(const n of this){var i;if(null!=t&&null!==(i=t.signal)&&void 0!==i&&i.aborted)throw new a;if(!(e-- >0))return;yield n}}.call(this)}},e.exports.promiseReturningOperators={every:async function(e,t){if("function"!=typeof e)throw new r("fn",["Function","AsyncFunction"],e);return!await E.call(this,(async(...t)=>!await e(...t)),t)},forEach:async function(e,t){if("function"!=typeof e)throw new r("fn",["Function","AsyncFunction"],e);for await(const n of k.call(this,(async function(t,n){return await e(t,n),w}),t));},reduce:async function(e,t,n){var o;if("function"!=typeof e)throw new r("reducer",["Function","AsyncFunction"],e);null!=n&&d(n,"options"),null!=(null==n?void 0:n.signal)&&l(n.signal,"options.signal");let s=arguments.length>1;if(null!=n&&null!==(o=n.signal)&&void 0!==o&&o.aborted){const e=new a(void 0,{cause:n.signal.reason});throw this.once("error",(()=>{})),await h(this.destroy(e)),e}const c=new i,p=c.signal;if(null!=n&&n.signal){const e={once:!0,[u]:this};n.signal.addEventListener("abort",(()=>c.abort()),e)}let f=!1;try{for await(const i of this){var m;if(f=!0,null!=n&&null!==(m=n.signal)&&void 0!==m&&m.aborted)throw new a;s?t=await e(t,i,{signal:p}):(t=i,s=!0)}if(!f&&!s)throw new T}finally{c.abort()}return t},toArray:async function(e){null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal");const t=[];for await(const i of this){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new a(void 0,{cause:e.signal.reason});p(t,i)}return t},some:E,find:async function(e,t){for await(const n of _.call(this,e,t))return n}}},917:(e,t,n)=>{"use strict";const{ObjectSetPrototypeOf:i}=n(9061);e.exports=o;const r=n(1161);function o(e){if(!(this instanceof o))return new o(e);r.call(this,e)}i(o.prototype,r.prototype),i(o,r),o.prototype._transform=function(e,t,n){n(null,e)}},9946:(e,t,n)=>{const i=n(4155),{ArrayIsArray:r,Promise:o,SymbolAsyncIterator:s}=n(9061),a=n(8610),{once:l}=n(6087),c=n(1195),d=n(8672),{aggregateTwoErrors:u,codes:{ERR_INVALID_ARG_TYPE:h,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:f,ERR_STREAM_DESTROYED:m,ERR_STREAM_PREMATURE_CLOSE:g},AbortError:v}=n(4381),{validateFunction:b,validateAbortSignal:y}=n(6547),{isIterable:S,isReadable:w,isReadableNodeStream:C,isNodeStream:k}=n(5874),E=globalThis.AbortController||n(8599).AbortController;let _,T;function x(e,t,n){let i=!1;return e.on("close",(()=>{i=!0})),{destroy:t=>{i||(i=!0,c.destroyer(e,t||new m("pipe")))},cleanup:a(e,{readable:t,writable:n},(e=>{i=!e}))}}function I(e){if(S(e))return e;if(C(e))return async function*(e){T||(T=n(911)),yield*T.prototype[s].call(e)}(e);throw new h("val",["Readable","Iterable","AsyncIterable"],e)}async function M(e,t,n,{end:i}){let r,s=null;const l=e=>{if(e&&(r=e),s){const e=s;s=null,e()}},c=()=>new o(((e,t)=>{r?t(r):s=()=>{r?t(r):e()}}));t.on("drain",l);const d=a(t,{readable:!1},l);try{t.writableNeedDrain&&await c();for await(const n of e)t.write(n)||await c();i&&t.end(),await c(),n()}catch(e){n(r!==e?u(r,e):e)}finally{d(),t.off("drain",l)}}function A(e,t,o){if(1===e.length&&r(e[0])&&(e=e[0]),e.length<2)throw new f("streams");const s=new E,a=s.signal,l=null==o?void 0:o.signal,c=[];function u(){R(new v)}let m,g;y(l,"options.signal"),null==l||l.addEventListener("abort",u);const b=[];let T,A=0;function O(e){R(e,0==--A)}function R(e,n){if(!e||m&&"ERR_STREAM_PREMATURE_CLOSE"!==m.code||(m=e),m||n){for(;b.length;)b.shift()(m);null==l||l.removeEventListener("abort",u),s.abort(),n&&(m||c.forEach((e=>e())),i.nextTick(t,m,g))}}for(let F=0;F<e.length;F++){const L=e[F],B=F<e.length-1,U=F>0,V=B||!1!==(null==o?void 0:o.end),j=F===e.length-1;if(k(L)){if(V){const{destroy:z,cleanup:$}=x(L,B,U);b.push(z),w(L)&&j&&c.push($)}function N(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&O(e)}L.on("error",N),w(L)&&j&&c.push((()=>{L.removeListener("error",N)}))}if(0===F)if("function"==typeof L){if(T=L({signal:a}),!S(T))throw new p("Iterable, AsyncIterable or Stream","source",T)}else T=S(L)||C(L)?L:d.from(L);else if("function"==typeof L)if(T=I(T),T=L(T,{signal:a}),B){if(!S(T,!0))throw new p("AsyncIterable",`transform[${F-1}]`,T)}else{var D;_||(_=n(917));const W=new _({objectMode:!0}),H=null===(D=T)||void 0===D?void 0:D.then;if("function"==typeof H)A++,H.call(T,(e=>{g=e,null!=e&&W.write(e),V&&W.end(),i.nextTick(O)}),(e=>{W.destroy(e),i.nextTick(O,e)}));else{if(!S(T,!0))throw new p("AsyncIterable or Promise","destination",T);A++,M(T,W,O,{end:V})}T=W;const{destroy:q,cleanup:K}=x(T,!1,!0);b.push(q),j&&c.push(K)}else if(k(L)){if(C(T)){A+=2;const G=P(T,L,O,{end:V});w(L)&&j&&c.push(G)}else{if(!S(T))throw new h("val",["Readable","Iterable","AsyncIterable"],T);A++,M(T,L,O,{end:V})}T=L}else T=d.from(L)}return(null!=a&&a.aborted||null!=l&&l.aborted)&&i.nextTick(u),T}function P(e,t,n,{end:i}){let r=!1;return t.on("close",(()=>{r||n(new g)})),e.pipe(t,{end:i}),i?e.once("end",(()=>{r=!0,t.end()})):n(),a(e,{readable:!0,writable:!1},(t=>{const i=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&i&&i.ended&&!i.errored&&!i.errorEmitted?e.once("end",n).once("error",n):n(t)})),a(t,{readable:!1,writable:!0},n)}e.exports={pipelineImpl:A,pipeline:function(...e){return A(e,l(function(e){return b(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(e)))}}},911:(e,t,n)=>{const i=n(4155),{ArrayPrototypeIndexOf:r,NumberIsInteger:o,NumberIsNaN:s,NumberParseInt:a,ObjectDefineProperties:l,ObjectKeys:c,ObjectSetPrototypeOf:d,Promise:u,SafeSet:h,SymbolAsyncIterator:p,Symbol:f}=n(9061);e.exports=U,U.ReadableState=B;const{EventEmitter:m}=n(7187),{Stream:g,prependListener:v}=n(4870),{Buffer:b}=n(8764),{addAbortSignal:y}=n(196),S=n(8610);let w=n(6087).debuglog("stream",(e=>{w=e}));const C=n(7327),k=n(1195),{getHighWaterMark:E,getDefaultHighWaterMark:_}=n(2457),{aggregateTwoErrors:T,codes:{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_OUT_OF_RANGE:M,ERR_STREAM_PUSH_AFTER_EOF:A,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:P}}=n(4381),{validateObject:O}=n(6547),R=f("kPaused"),{StringDecoder:N}=n(2553),D=n(6307);d(U.prototype,g.prototype),d(U,g);const F=()=>{},{errorOrDestroy:L}=k;function B(e,t,i){"boolean"!=typeof i&&(i=t instanceof n(8672)),this.objectMode=!(!e||!e.objectMode),i&&(this.objectMode=this.objectMode||!(!e||!e.readableObjectMode)),this.highWaterMark=e?E(this,e,"readableHighWaterMark",i):_(!1),this.buffer=new C,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[R]=null,this.errorEmitted=!1,this.emitClose=!e||!1!==e.emitClose,this.autoDestroy=!e||!1!==e.autoDestroy,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new N(e.encoding),this.encoding=e.encoding)}function U(e){if(!(this instanceof U))return new U(e);const t=this instanceof n(8672);this._readableState=new B(e,this,t),e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&!t&&y(e.signal,this)),g.call(this,e),k.construct(this,(()=>{this._readableState.needReadable&&H(this,this._readableState)}))}function V(e,t,n,i){w("readableAddChunk",t);const r=e._readableState;let o;if(r.objectMode||("string"==typeof t?(n=n||r.defaultEncoding,r.encoding!==n&&(i&&r.encoding?t=b.from(t,n).toString(r.encoding):(t=b.from(t,n),n=""))):t instanceof b?n="":g._isUint8Array(t)?(t=g._uint8ArrayToBuffer(t),n=""):null!=t&&(o=new x("chunk",["string","Buffer","Uint8Array"],t))),o)L(e,o);else if(null===t)r.reading=!1,function(e,t){if(w("onEofChunk"),!t.ended){if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?$(e):(t.needReadable=!1,t.emittedReadable=!0,W(e))}}(e,r);else if(r.objectMode||t&&t.length>0)if(i)if(r.endEmitted)L(e,new P);else{if(r.destroyed||r.errored)return!1;j(e,r,t,!0)}else if(r.ended)L(e,new A);else{if(r.destroyed||r.errored)return!1;r.reading=!1,r.decoder&&!n?(t=r.decoder.write(t),r.objectMode||0!==t.length?j(e,r,t,!1):H(e,r)):j(e,r,t,!1)}else i||(r.reading=!1,H(e,r));return!r.ended&&(r.length<r.highWaterMark||0===r.length)}function j(e,t,n,i){t.flowing&&0===t.length&&!t.sync&&e.listenerCount("data")>0?(t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&$(e)),H(e,t)}function z(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:s(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function $(e){const t=e._readableState;w("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(w("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(W,e))}function W(e){const t=e._readableState;w("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Q(e)}function H(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,i.nextTick(q,e,t))}function q(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){const n=t.length;if(w("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function K(e){const t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!1===t[R]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function G(e){w("readable nexttick read 0"),e.read(0)}function J(e,t){w("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Q(e),t.flowing&&!t.reading&&e.read(0)}function Q(e){const t=e._readableState;for(w("flow",t.flowing);t.flowing&&null!==e.read(););}function Y(e,t){"function"!=typeof e.read&&(e=U.wrap(e,{objectMode:!0}));const n=async function*(e,t){let n,i=F;function r(t){this===e?(i(),i=F):i=t}e.on("readable",r);const o=S(e,{writable:!1},(e=>{n=e?T(n,e):null,i(),i=F}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else{if(n)throw n;if(null===n)return;await new u(r)}}}catch(e){throw n=T(n,e),n}finally{!n&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==n&&!e._readableState.autoDestroy?(e.off("readable",r),o()):k.destroyer(e,null)}}(e,t);return n.stream=e,n}function Z(e,t){if(0===t.length)return null;let n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function X(e){const t=e._readableState;w("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(ee,t,e))}function ee(e,t){if(w("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)i.nextTick(te,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy()}}function te(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}let ne;function ie(){return void 0===ne&&(ne={}),ne}U.prototype.destroy=k.destroy,U.prototype._undestroy=k.undestroy,U.prototype._destroy=function(e,t){t(e)},U.prototype[m.captureRejectionSymbol]=function(e){this.destroy(e)},U.prototype.push=function(e,t){return V(this,e,t,!1)},U.prototype.unshift=function(e,t){return V(this,e,t,!0)},U.prototype.isPaused=function(){const e=this._readableState;return!0===e[R]||!1===e.flowing},U.prototype.setEncoding=function(e){const t=new N(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const n=this._readableState.buffer;let i="";for(const e of n)i+=t.write(e);return n.clear(),""!==i&&n.push(i),this._readableState.length=i.length,this},U.prototype.read=function(e){w("read",e),void 0===e?e=NaN:o(e)||(e=a(e,10));const t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new M("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}(e)),0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return w("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?X(this):$(this),null;if(0===(e=z(e,t))&&t.ended)return 0===t.length&&X(this),null;let i,r=t.needReadable;if(w("need readable",r),(0===t.length||t.length-e<t.highWaterMark)&&(r=!0,w("length less than watermark",r)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)r=!1,w("reading, ended or constructing",r);else if(r){w("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0);try{this._read(t.highWaterMark)}catch(e){L(this,e)}t.sync=!1,t.reading||(e=z(n,t))}return i=e>0?Z(e,t):null,null===i?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&X(this)),null===i||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",i)),i},U.prototype._read=function(e){throw new I("_read()")},U.prototype.pipe=function(e,t){const n=this,r=this._readableState;1===r.pipes.length&&(r.multiAwaitDrain||(r.multiAwaitDrain=!0,r.awaitDrainWriters=new h(r.awaitDrainWriters?[r.awaitDrainWriters]:[]))),r.pipes.push(e),w("pipe count=%d opts=%j",r.pipes.length,t);const o=t&&!1===t.end||e===i.stdout||e===i.stderr?m:s;function s(){w("onend"),e.end()}let a;r.endEmitted?i.nextTick(o):n.once("end",o),e.on("unpipe",(function t(i,o){w("onunpipe"),i===n&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,w("cleanup"),e.removeListener("close",p),e.removeListener("finish",f),a&&e.removeListener("drain",a),e.removeListener("error",u),e.removeListener("unpipe",t),n.removeListener("end",s),n.removeListener("end",m),n.removeListener("data",d),l=!0,a&&r.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&a())}));let l=!1;function c(){l||(1===r.pipes.length&&r.pipes[0]===e?(w("false write response, pause",0),r.awaitDrainWriters=e,r.multiAwaitDrain=!1):r.pipes.length>1&&r.pipes.includes(e)&&(w("false write response, pause",r.awaitDrainWriters.size),r.awaitDrainWriters.add(e)),n.pause()),a||(a=function(e,t){return function(){const n=e._readableState;n.awaitDrainWriters===t?(w("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(w("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),n.awaitDrainWriters&&0!==n.awaitDrainWriters.size||!e.listenerCount("data")||e.resume()}}(n,e),e.on("drain",a))}function d(t){w("ondata");const n=e.write(t);w("dest.write",n),!1===n&&c()}function u(t){if(w("onerror",t),m(),e.removeListener("error",u),0===e.listenerCount("error")){const n=e._writableState||e._readableState;n&&!n.errorEmitted?L(e,t):e.emit("error",t)}}function p(){e.removeListener("finish",f),m()}function f(){w("onfinish"),e.removeListener("close",p),m()}function m(){w("unpipe"),n.unpipe(e)}return n.on("data",d),v(e,"error",u),e.once("close",p),e.once("finish",f),e.emit("pipe",n),!0===e.writableNeedDrain?r.flowing&&c():r.flowing||(w("pipe resume"),n.resume()),e},U.prototype.unpipe=function(e){const t=this._readableState;if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit("unpipe",this,{hasUnpiped:!1});return this}const n=r(t.pipes,e);return-1===n||(t.pipes.splice(n,1),0===t.pipes.length&&this.pause(),e.emit("unpipe",this,{hasUnpiped:!1})),this},U.prototype.on=function(e,t){const n=g.prototype.on.call(this,e,t),r=this._readableState;return"data"===e?(r.readableListening=this.listenerCount("readable")>0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,w("on readable",r.length,r.reading),r.length?$(this):r.reading||i.nextTick(G,this))),n},U.prototype.addListener=U.prototype.on,U.prototype.removeListener=function(e,t){const n=g.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(K,this),n},U.prototype.off=U.prototype.removeListener,U.prototype.removeAllListeners=function(e){const t=g.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(K,this),t},U.prototype.resume=function(){const e=this._readableState;return e.flowing||(w("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(J,e,t))}(this,e)),e[R]=!1,this},U.prototype.pause=function(){return w("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(w("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[R]=!0,this},U.prototype.wrap=function(e){let t=!1;e.on("data",(n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())})),e.on("end",(()=>{this.push(null)})),e.on("error",(e=>{L(this,e)})),e.on("close",(()=>{this.destroy()})),e.on("destroy",(()=>{this.destroy()})),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};const n=c(e);for(let t=1;t<n.length;t++){const i=n[t];void 0===this[i]&&"function"==typeof e[i]&&(this[i]=e[i].bind(e))}return this},U.prototype[p]=function(){return Y(this)},U.prototype.iterator=function(e){return void 0!==e&&O(e,"options"),Y(this,e)},l(U.prototype,{readable:{__proto__:null,get(){const e=this._readableState;return!(!e||!1===e.readable||e.destroyed||e.errorEmitted||e.endEmitted)},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._readableState.readable||!this._readableState.destroyed&&!this._readableState.errored||this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.objectMode}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return!!this._readableState&&this._readableState.closed}},destroyed:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.destroyed},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.endEmitted}}}),l(B.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return!1!==this[R]},set(e){this[R]=!!e}}}),U._fromList=Z,U.from=function(e,t){return D(U,e,t)},U.fromWeb=function(e,t){return ie().newStreamReadableFromReadableStream(e,t)},U.toWeb=function(e,t){return ie().newReadableStreamFromStreamReadable(e,t)},U.wrap=function(e,t){var n,i;return new U({objectMode:null===(n=null!==(i=e.readableObjectMode)&&void 0!==i?i:e.objectMode)||void 0===n||n,...t,destroy(t,n){k.destroyer(e,t),n(t)}}).wrap(e)}},2457:(e,t,n)=>{"use strict";const{MathFloor:i,NumberIsInteger:r}=n(9061),{ERR_INVALID_ARG_VALUE:o}=n(4381).codes;function s(e){return e?16:16384}e.exports={getHighWaterMark:function(e,t,n,a){const l=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,a,n);if(null!=l){if(!r(l)||l<0)throw new o(a?`options.${n}`:"options.highWaterMark",l);return i(l)}return s(e.objectMode)},getDefaultHighWaterMark:s}},1161:(e,t,n)=>{"use strict";const{ObjectSetPrototypeOf:i,Symbol:r}=n(9061);e.exports=c;const{ERR_METHOD_NOT_IMPLEMENTED:o}=n(4381).codes,s=n(8672),{getHighWaterMark:a}=n(2457);i(c.prototype,s.prototype),i(c,s);const l=r("kCallback");function c(e){if(!(this instanceof c))return new c(e);const t=e?a(this,e,"readableHighWaterMark",!0):null;0===t&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),s.call(this,e),this._readableState.sync=!1,this[l]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",u)}function d(e){"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush(((t,n)=>{t?e?e(t):this.destroy(t):(null!=n&&this.push(n),this.push(null),e&&e())}))}function u(){this._final!==d&&d.call(this)}c.prototype._final=d,c.prototype._transform=function(e,t,n){throw new o("_transform()")},c.prototype._write=function(e,t,n){const i=this._readableState,r=this._writableState,o=i.length;this._transform(e,t,((e,t)=>{e?n(e):(null!=t&&this.push(t),r.ended||o===i.length||i.length<i.highWaterMark?n():this[l]=n)}))},c.prototype._read=function(){if(this[l]){const e=this[l];this[l]=null,e()}}},5874:(e,t,n)=>{"use strict";const{Symbol:i,SymbolAsyncIterator:r,SymbolIterator:o}=n(9061),s=i("kDestroyed"),a=i("kIsErrored"),l=i("kIsReadable"),c=i("kIsDisturbed");function d(e,t=!1){var n;return!(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||t&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(n=e._readableState)||void 0===n?void 0:n.readable)||e._writableState&&!e._readableState)}function u(e){var t;return!(!e||"function"!=typeof e.write||"function"!=typeof e.on||e._readableState&&!1===(null===(t=e._writableState)||void 0===t?void 0:t.writable))}function h(e){return e&&(e._readableState||e._writableState||"function"==typeof e.write&&"function"==typeof e.on||"function"==typeof e.pipe&&"function"==typeof e.on)}function p(e){if(!h(e))return null;const t=e._writableState,n=e._readableState,i=t||n;return!!(e.destroyed||e[s]||null!=i&&i.destroyed)}function f(e){if(!u(e))return null;if(!0===e.writableEnded)return!0;const t=e._writableState;return(null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function m(e,t){if(!d(e))return null;const n=e._readableState;return(null==n||!n.errored)&&("boolean"!=typeof(null==n?void 0:n.endEmitted)?null:!!(n.endEmitted||!1===t&&!0===n.ended&&0===n.length))}function g(e){return e&&null!=e[l]?e[l]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!p(e)&&d(e)&&e.readable&&!m(e)}function v(e){return"boolean"!=typeof(null==e?void 0:e.writable)?null:!p(e)&&u(e)&&e.writable&&!f(e)}function b(e){return"boolean"==typeof e._closed&&"boolean"==typeof e._defaultKeepAlive&&"boolean"==typeof e._removedConnection&&"boolean"==typeof e._removedContLen}function y(e){return"boolean"==typeof e._sent100&&b(e)}e.exports={kDestroyed:s,isDisturbed:function(e){var t;return!(!e||!(null!==(t=e[c])&&void 0!==t?t:e.readableDidRead||e.readableAborted))},kIsDisturbed:c,isErrored:function(e){var t,n,i,r,o,s,l,c,d,u;return!(!e||!(null!==(t=null!==(n=null!==(i=null!==(r=null!==(o=null!==(s=e[a])&&void 0!==s?s:e.readableErrored)&&void 0!==o?o:e.writableErrored)&&void 0!==r?r:null===(l=e._readableState)||void 0===l?void 0:l.errorEmitted)&&void 0!==i?i:null===(c=e._writableState)||void 0===c?void 0:c.errorEmitted)&&void 0!==n?n:null===(d=e._readableState)||void 0===d?void 0:d.errored)&&void 0!==t?t:null===(u=e._writableState)||void 0===u?void 0:u.errored))},kIsErrored:a,isReadable:g,kIsReadable:l,isClosed:function(e){if(!h(e))return null;if("boolean"==typeof e.closed)return e.closed;const t=e._writableState,n=e._readableState;return"boolean"==typeof(null==t?void 0:t.closed)||"boolean"==typeof(null==n?void 0:n.closed)?(null==t?void 0:t.closed)||(null==n?void 0:n.closed):"boolean"==typeof e._closed&&b(e)?e._closed:null},isDestroyed:p,isDuplexNodeStream:function(e){return!(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write)},isFinished:function(e,t){return h(e)?!(!p(e)&&(!1!==(null==t?void 0:t.readable)&&g(e)||!1!==(null==t?void 0:t.writable)&&v(e))):null},isIterable:function(e,t){return null!=e&&(!0===t?"function"==typeof e[r]:!1===t?"function"==typeof e[o]:"function"==typeof e[r]||"function"==typeof e[o])},isReadableNodeStream:d,isReadableEnded:function(e){if(!d(e))return null;if(!0===e.readableEnded)return!0;const t=e._readableState;return!(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)},isReadableFinished:m,isReadableErrored:function(e){var t,n;return h(e)?e.readableErrored?e.readableErrored:null!==(t=null===(n=e._readableState)||void 0===n?void 0:n.errored)&&void 0!==t?t:null:null},isNodeStream:h,isWritable:v,isWritableNodeStream:u,isWritableEnded:f,isWritableFinished:function(e,t){if(!u(e))return null;if(!0===e.writableFinished)return!0;const n=e._writableState;return(null==n||!n.errored)&&("boolean"!=typeof(null==n?void 0:n.finished)?null:!!(n.finished||!1===t&&!0===n.ended&&0===n.length))},isWritableErrored:function(e){var t,n;return h(e)?e.writableErrored?e.writableErrored:null!==(t=null===(n=e._writableState)||void 0===n?void 0:n.errored)&&void 0!==t?t:null:null},isServerRequest:function(e){var t;return"boolean"==typeof e._consuming&&"boolean"==typeof e._dumped&&void 0===(null===(t=e.req)||void 0===t?void 0:t.upgradeOrConnect)},isServerResponse:y,willEmitClose:function(e){if(!h(e))return null;const t=e._writableState,n=e._readableState,i=t||n;return!i&&y(e)||!!(i&&i.autoDestroy&&i.emitClose&&!1===i.closed)}}},6304:(e,t,n)=>{const i=n(4155),{ArrayPrototypeSlice:r,Error:o,FunctionPrototypeSymbolHasInstance:s,ObjectDefineProperty:a,ObjectDefineProperties:l,ObjectSetPrototypeOf:c,StringPrototypeToLowerCase:d,Symbol:u,SymbolHasInstance:h}=n(9061);e.exports=N,N.WritableState=O;const{EventEmitter:p}=n(7187),f=n(4870).Stream,{Buffer:m}=n(8764),g=n(1195),{addAbortSignal:v}=n(196),{getHighWaterMark:b,getDefaultHighWaterMark:y}=n(2457),{ERR_INVALID_ARG_TYPE:S,ERR_METHOD_NOT_IMPLEMENTED:w,ERR_MULTIPLE_CALLBACK:C,ERR_STREAM_CANNOT_PIPE:k,ERR_STREAM_DESTROYED:E,ERR_STREAM_ALREADY_FINISHED:_,ERR_STREAM_NULL_VALUES:T,ERR_STREAM_WRITE_AFTER_END:x,ERR_UNKNOWN_ENCODING:I}=n(4381).codes,{errorOrDestroy:M}=g;function A(){}c(N.prototype,f.prototype),c(N,f);const P=u("kOnFinished");function O(e,t,i){"boolean"!=typeof i&&(i=t instanceof n(8672)),this.objectMode=!(!e||!e.objectMode),i&&(this.objectMode=this.objectMode||!(!e||!e.writableObjectMode)),this.highWaterMark=e?b(this,e,"writableHighWaterMark",i):y(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const r=!(!e||!1!==e.decodeStrings);this.decodeStrings=!r,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=B.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,R(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||!1!==e.emitClose,this.autoDestroy=!e||!1!==e.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[P]=[]}function R(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}function N(e){const t=this instanceof n(8672);if(!t&&!s(N,this))return new N(e);this._writableState=new O(e,this,t),e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&v(e.signal,this)),f.call(this,e),g.construct(this,(()=>{const e=this._writableState;e.writing||z(this,e),W(this,e)}))}function D(e,t,n,r){const o=e._writableState;if("function"==typeof n)r=n,n=o.defaultEncoding;else{if(n){if("buffer"!==n&&!m.isEncoding(n))throw new I(n)}else n=o.defaultEncoding;"function"!=typeof r&&(r=A)}if(null===t)throw new T;if(!o.objectMode)if("string"==typeof t)!1!==o.decodeStrings&&(t=m.from(t,n),n="buffer");else if(t instanceof m)n="buffer";else{if(!f._isUint8Array(t))throw new S("chunk",["string","Buffer","Uint8Array"],t);t=f._uint8ArrayToBuffer(t),n="buffer"}let s;return o.ending?s=new x:o.destroyed&&(s=new E("write")),s?(i.nextTick(r,s),M(e,s,!0),s):(o.pendingcb++,function(e,t,n,i,r){const o=t.objectMode?1:n.length;t.length+=o;const s=t.length<t.highWaterMark;return s||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:n,encoding:i,callback:r}),t.allBuffers&&"buffer"!==i&&(t.allBuffers=!1),t.allNoop&&r!==A&&(t.allNoop=!1)):(t.writelen=o,t.writecb=r,t.writing=!0,t.sync=!0,e._write(n,i,t.onwrite),t.sync=!1),s&&!t.errored&&!t.destroyed}(e,o,t,n,r))}function F(e,t,n,i,r,o,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new E("write")):n?e._writev(r,t.onwrite):e._write(r,o,t.onwrite),t.sync=!1}function L(e,t,n,i){--t.pendingcb,i(n),j(t),M(e,n)}function B(e,t){const n=e._writableState,r=n.sync,o=n.writecb;"function"==typeof o?(n.writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,t?(t.stack,n.errored||(n.errored=t),e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),r?i.nextTick(L,e,n,t,o):L(e,n,t,o)):(n.buffered.length>n.bufferedIndex&&z(e,n),r?null!==n.afterWriteTickInfo&&n.afterWriteTickInfo.cb===o?n.afterWriteTickInfo.count++:(n.afterWriteTickInfo={count:1,cb:o,stream:e,state:n},i.nextTick(U,n.afterWriteTickInfo)):V(e,n,1,o))):M(e,new C)}function U({stream:e,state:t,count:n,cb:i}){return t.afterWriteTickInfo=null,V(e,t,n,i)}function V(e,t,n,i){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));n-- >0;)t.pendingcb--,i();t.destroyed&&j(t),W(e,t)}function j(e){if(e.writing)return;for(let n=e.bufferedIndex;n<e.buffered.length;++n){var t;const{chunk:i,callback:r}=e.buffered[n],o=e.objectMode?1:i.length;e.length-=o,r(null!==(t=e.errored)&&void 0!==t?t:new E("write"))}const n=e[P].splice(0);for(let t=0;t<n.length;t++){var i;n[t](null!==(i=e.errored)&&void 0!==i?i:new E("end"))}R(e)}function z(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;const{buffered:n,bufferedIndex:i,objectMode:o}=t,s=n.length-i;if(!s)return;let a=i;if(t.bufferProcessing=!0,s>1&&e._writev){t.pendingcb-=s-1;const i=t.allNoop?A:e=>{for(let t=a;t<n.length;++t)n[t].callback(e)},o=t.allNoop&&0===a?n:r(n,a);o.allBuffers=t.allBuffers,F(e,t,!0,t.length,o,"",i),R(t)}else{do{const{chunk:i,encoding:r,callback:s}=n[a];n[a++]=null,F(e,t,!1,o?1:i.length,i,r,s)}while(a<n.length&&!t.writing);a===n.length?R(t):a>256?(n.splice(0,a),t.bufferedIndex=0):t.bufferedIndex=a}t.bufferProcessing=!1}function $(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function W(e,t,n){$(t)&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,function(e,t){let n=!1;function r(r){if(n)M(e,null!=r?r:C());else if(n=!0,t.pendingcb--,r){const n=t[P].splice(0);for(let e=0;e<n.length;e++)n[e](r);M(e,r,t.sync)}else $(t)&&(t.prefinished=!0,e.emit("prefinish"),t.pendingcb++,i.nextTick(H,e,t))}t.sync=!0,t.pendingcb++;try{e._final(r)}catch(e){r(e)}t.sync=!1}(e,t)))}(e,t),0===t.pendingcb&&(n?(t.pendingcb++,i.nextTick(((e,t)=>{$(t)?H(e,t):t.pendingcb--}),e,t)):$(t)&&(t.pendingcb++,H(e,t))))}function H(e,t){t.pendingcb--,t.finished=!0;const n=t[P].splice(0);for(let e=0;e<n.length;e++)n[e]();if(e.emit("finish"),t.autoDestroy){const t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||!1===t.readable))&&e.destroy()}}O.prototype.getBuffer=function(){return r(this.buffered,this.bufferedIndex)},a(O.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}}),a(N,h,{__proto__:null,value:function(e){return!!s(this,e)||this===N&&e&&e._writableState instanceof O}}),N.prototype.pipe=function(){M(this,new k)},N.prototype.write=function(e,t,n){return!0===D(this,e,t,n)},N.prototype.cork=function(){this._writableState.corked++},N.prototype.uncork=function(){const e=this._writableState;e.corked&&(e.corked--,e.writing||z(this,e))},N.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=d(e)),!m.isEncoding(e))throw new I(e);return this._writableState.defaultEncoding=e,this},N.prototype._write=function(e,t,n){if(!this._writev)throw new w("_write()");this._writev([{chunk:e,encoding:t}],n)},N.prototype._writev=null,N.prototype.end=function(e,t,n){const r=this._writableState;let s;if("function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e){const n=D(this,e,t);n instanceof o&&(s=n)}return r.corked&&(r.corked=1,this.uncork()),s||(r.errored||r.ending?r.finished?s=new _("end"):r.destroyed&&(s=new E("end")):(r.ending=!0,W(this,r,!0),r.ended=!0)),"function"==typeof n&&(s||r.finished?i.nextTick(n,s):r[P].push(n)),this},l(N.prototype,{closed:{__proto__:null,get(){return!!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get(){return!!this._writableState&&this._writableState.destroyed},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){const e=this._writableState;return!(!e||!1===e.writable||e.destroyed||e.errored||e.ending||e.ended)},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return!!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get(){return!!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return!!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get(){const e=this._writableState;return!!e&&!e.destroyed&&!e.ending&&e.needDrain}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});const q=g.destroy;let K;function G(){return void 0===K&&(K={}),K}N.prototype.destroy=function(e,t){const n=this._writableState;return!n.destroyed&&(n.bufferedIndex<n.buffered.length||n[P].length)&&i.nextTick(j,n),q.call(this,e,t),this},N.prototype._undestroy=g.undestroy,N.prototype._destroy=function(e,t){t(e)},N.prototype[p.captureRejectionSymbol]=function(e){this.destroy(e)},N.fromWeb=function(e,t){return G().newStreamWritableFromWritableStream(e,t)},N.toWeb=function(e){return G().newWritableStreamFromStreamWritable(e)}},6547:(e,t,n)=>{"use strict";const{ArrayIsArray:i,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:o,ArrayPrototypeMap:s,NumberIsInteger:a,NumberIsNaN:l,NumberMAX_SAFE_INTEGER:c,NumberMIN_SAFE_INTEGER:d,NumberParseInt:u,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:p,String:f,StringPrototypeToUpperCase:m,StringPrototypeTrim:g}=n(9061),{hideStackFrames:v,codes:{ERR_SOCKET_BAD_PORT:b,ERR_INVALID_ARG_TYPE:y,ERR_INVALID_ARG_VALUE:S,ERR_OUT_OF_RANGE:w,ERR_UNKNOWN_SIGNAL:C}}=n(4381),{normalizeEncoding:k}=n(6087),{isAsyncFunction:E,isArrayBufferView:_}=n(6087).types,T={},x=/^[0-7]+$/,I=v(((e,t,n=d,i=c)=>{if("number"!=typeof e)throw new y(t,"number",e);if(!a(e))throw new w(t,"an integer",e);if(e<n||e>i)throw new w(t,`>= ${n} && <= ${i}`,e)})),M=v(((e,t,n=-2147483648,i=2147483647)=>{if("number"!=typeof e)throw new y(t,"number",e);if(!a(e))throw new w(t,"an integer",e);if(e<n||e>i)throw new w(t,`>= ${n} && <= ${i}`,e)})),A=v(((e,t,n=!1)=>{if("number"!=typeof e)throw new y(t,"number",e);if(!a(e))throw new w(t,"an integer",e);const i=n?1:0,r=4294967295;if(e<i||e>r)throw new w(t,`>= ${i} && <= ${r}`,e)}));function P(e,t){if("string"!=typeof e)throw new y(t,"string",e)}const O=v(((e,t,n)=>{if(!r(n,e)){const i=o(s(n,(e=>"string"==typeof e?`'${e}'`:f(e))),", ");throw new S(t,e,"must be one of: "+i)}}));function R(e,t,n){return null!=e&&h(e,t)?e[t]:n}const N=v(((e,t,n=null)=>{const r=R(n,"allowArray",!1),o=R(n,"allowFunction",!1);if(!R(n,"nullable",!1)&&null===e||!r&&i(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new y(t,"Object",e)})),D=v(((e,t,n=0)=>{if(!i(e))throw new y(t,"Array",e);if(e.length<n)throw new S(t,e,`must be longer than ${n}`)})),F=v(((e,t="buffer")=>{if(!_(e))throw new y(t,["Buffer","TypedArray","DataView"],e)})),L=v(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new y(t,"AbortSignal",e)})),B=v(((e,t)=>{if("function"!=typeof e)throw new y(t,"Function",e)})),U=v(((e,t)=>{if("function"!=typeof e||E(e))throw new y(t,"Function",e)})),V=v(((e,t)=>{if(void 0!==e)throw new y(t,"undefined",e)}));e.exports={isInt32:function(e){return e===(0|e)},isUint32:function(e){return e===e>>>0},parseFileMode:function(e,t,n){if(void 0===e&&(e=n),"string"==typeof e){if(null===p(x,e))throw new S(t,e,"must be a 32-bit unsigned integer or an octal string");e=u(e,8)}return A(e,t),e},validateArray:D,validateBoolean:function(e,t){if("boolean"!=typeof e)throw new y(t,"boolean",e)},validateBuffer:F,validateEncoding:function(e,t){const n=k(t),i=e.length;if("hex"===n&&i%2!=0)throw new S("encoding",t,`is invalid for data of length ${i}`)},validateFunction:B,validateInt32:M,validateInteger:I,validateNumber:function(e,t,n,i){if("number"!=typeof e)throw new y(t,"number",e);if(null!=n&&e<n||null!=i&&e>i||(null!=n||null!=i)&&l(e))throw new w(t,`${null!=n?`>= ${n}`:""}${null!=n&&null!=i?" && ":""}${null!=i?`<= ${i}`:""}`,e)},validateObject:N,validateOneOf:O,validatePlainFunction:U,validatePort:function(e,t="Port",n=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===g(e).length||+e!=+e>>>0||e>65535||0===e&&!n)throw new b(t,e,n);return 0|e},validateSignalName:function(e,t="signal"){if(P(e,t),void 0===T[e]){if(void 0!==T[m(e)])throw new C(e+" (signals must use all capital letters)");throw new C(e)}},validateString:P,validateUint32:A,validateUndefined:V,validateUnion:function(e,t,n){if(!r(n,e))throw new y(t,`('${o(n,"|")}')`,e)},validateAbortSignal:L}},9827:(e,t,n)=>{"use strict";const i=n(5099),r=n(7854),o=i.Readable.destroy;e.exports=i.Readable,e.exports._uint8ArrayToBuffer=i._uint8ArrayToBuffer,e.exports._isUint8Array=i._isUint8Array,e.exports.isDisturbed=i.isDisturbed,e.exports.isErrored=i.isErrored,e.exports.isReadable=i.isReadable,e.exports.Readable=i.Readable,e.exports.Writable=i.Writable,e.exports.Duplex=i.Duplex,e.exports.Transform=i.Transform,e.exports.PassThrough=i.PassThrough,e.exports.addAbortSignal=i.addAbortSignal,e.exports.finished=i.finished,e.exports.destroy=i.destroy,e.exports.destroy=o,e.exports.pipeline=i.pipeline,e.exports.compose=i.compose,Object.defineProperty(i,"promises",{configurable:!0,enumerable:!0,get:()=>r}),e.exports.Stream=i.Stream,e.exports.default=e.exports},4381:(e,t,n)=>{"use strict";const{format:i,inspect:r,AggregateError:o}=n(6087),s=globalThis.AggregateError||o,a=Symbol("kIsNodeError"),l=["string","function","number","object","Function","Object","boolean","bigint","symbol"],c=/^([A-Z][a-z0-9]*)+$/,d={};function u(e,t){if(!e)throw new d.ERR_INTERNAL_ASSERTION(t)}function h(e){let t="",n=e.length;const i="-"===e[0]?1:0;for(;n>=i+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function p(e,t,n){n||(n=Error);class r extends n{constructor(...n){super(function(e,t,n){if("function"==typeof t)return u(t.length<=n.length,`Code: ${e}; The provided arguments length (${n.length}) does not match the required ones (${t.length}).`),t(...n);const r=(t.match(/%[dfijoOs]/g)||[]).length;return u(r===n.length,`Code: ${e}; The provided arguments length (${n.length}) does not match the required ones (${r}).`),0===n.length?t:i(t,...n)}(e,t,n))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=e,r.prototype[a]=!0,d[e]=r}function f(e){const t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}class m extends Error{constructor(e="The operation was aborted",t){if(void 0!==t&&"object"!=typeof t)throw new d.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}}p("ERR_ASSERTION","%s",Error),p("ERR_INVALID_ARG_TYPE",((e,t,n)=>{u("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let i="The ";e.endsWith(" argument")?i+=`${e} `:i+=`"${e}" ${e.includes(".")?"property":"argument"} `,i+="must be ";const o=[],s=[],a=[];for(const e of t)u("string"==typeof e,"All expected entries have to be of type string"),l.includes(e)?o.push(e.toLowerCase()):c.test(e)?s.push(e):(u("object"!==e,'The value "object" should be written as "Object"'),a.push(e));if(s.length>0){const e=o.indexOf("object");-1!==e&&(o.splice(o,e,1),s.push("Object"))}if(o.length>0){switch(o.length){case 1:i+=`of type ${o[0]}`;break;case 2:i+=`one of type ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();i+=`one of type ${o.join(", ")}, or ${e}`}}(s.length>0||a.length>0)&&(i+=" or ")}if(s.length>0){switch(s.length){case 1:i+=`an instance of ${s[0]}`;break;case 2:i+=`an instance of ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();i+=`an instance of ${s.join(", ")}, or ${e}`}}a.length>0&&(i+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(i+="an "),i+=`${a[0]}`;break;case 2:i+=`one of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();i+=`one of ${a.join(", ")}, or ${e}`}}if(null==n)i+=`. Received ${n}`;else if("function"==typeof n&&n.name)i+=`. Received function ${n.name}`;else if("object"==typeof n){var d;null!==(d=n.constructor)&&void 0!==d&&d.name?i+=`. Received an instance of ${n.constructor.name}`:i+=`. Received ${r(n,{depth:-1})}`}else{let e=r(n,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),i+=`. Received type ${typeof n} (${e})`}return i}),TypeError),p("ERR_INVALID_ARG_VALUE",((e,t,n="is invalid")=>{let i=r(t);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${n}. Received ${i}`}),TypeError),p("ERR_INVALID_RETURN_VALUE",((e,t,n)=>{var i;return`Expected ${e} to be returned from the "${t}" function but got ${null!=n&&null!==(i=n.constructor)&&void 0!==i&&i.name?`instance of ${n.constructor.name}`:"type "+typeof n}.`}),TypeError),p("ERR_MISSING_ARGS",((...e)=>{let t;u(e.length>0,"At least one arg needs to be specified");const n=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const n=e.pop();t+=`The ${e.join(", ")}, and ${n} arguments`}}return`${t} must be specified`}),TypeError),p("ERR_OUT_OF_RANGE",((e,t,n)=>{let i;return u(t,'Missing "range" argument'),Number.isInteger(n)&&Math.abs(n)>2**32?i=h(String(n)):"bigint"==typeof n?(i=String(n),(n>2n**32n||n<-(2n**32n))&&(i=h(i)),i+="n"):i=r(n),`The value of "${e}" is out of range. It must be ${t}. Received ${i}`}),RangeError),p("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),p("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),p("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),p("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),p("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),p("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),p("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),p("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),p("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),p("ERR_STREAM_WRITE_AFTER_END","write after end",Error),p("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),e.exports={AbortError:m,aggregateTwoErrors:f((function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const n=new s([t,e],t.message);return n.code=t.code,n}return e||t})),hideStackFrames:f,codes:d}},9061:e=>{"use strict";e.exports={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,n)=>e.slice(t,n),Error,FunctionPrototypeCall:(e,t,...n)=>e.call(t,...n),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,n)=>Object.defineProperty(e,t,n),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,n)=>e.then(t,n),PromiseReject:e=>Promise.reject(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String,StringPrototypeSlice:(e,t,n)=>e.slice(t,n),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.trim(),Symbol,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet:(e,t,n)=>e.set(t,n),Uint8Array}},6087:(e,t,n)=>{"use strict";const i=n(8764),r=Object.getPrototypeOf((async function(){})).constructor,o=globalThis.Blob||i.Blob,s=void 0!==o?function(e){return e instanceof o}:function(e){return!1};class a extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let n=0;n<e.length;n++)t+=` ${e[n].stack}\n`;super(t),this.name="AggregateError",this.errors=e}}e.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...n){t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){let e,t;return{promise:new Promise(((n,i)=>{e=n,t=i})),resolve:e,reject:t}},promisify:e=>new Promise(((t,n)=>{e(((e,...i)=>e?n(e):t(...i)))})),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,(function(...[e,n]){const i=t.shift();return"f"===n?i.toFixed(6):"j"===n?JSON.stringify(i):"s"===n&&"object"==typeof i?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}},types:{isAsyncFunction:e=>e instanceof r,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:s},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")},5099:(e,t,n)=>{const{Buffer:i}=n(8764),{ObjectDefineProperty:r,ObjectKeys:o,ReflectApply:s}=n(9061),{promisify:{custom:a}}=n(6087),{streamReturningOperators:l,promiseReturningOperators:c}=n(4382),{codes:{ERR_ILLEGAL_CONSTRUCTOR:d}}=n(4381),u=n(299),{pipeline:h}=n(9946),{destroyer:p}=n(1195),f=n(8610),m=n(7854),g=n(5874),v=e.exports=n(4870).Stream;v.isDisturbed=g.isDisturbed,v.isErrored=g.isErrored,v.isReadable=g.isReadable,v.Readable=n(911);for(const S of o(l)){const w=l[S];function b(...e){if(new.target)throw d();return v.Readable.from(s(w,this,e))}r(b,"name",{__proto__:null,value:w.name}),r(b,"length",{__proto__:null,value:w.length}),r(v.Readable.prototype,S,{__proto__:null,value:b,enumerable:!1,configurable:!0,writable:!0})}for(const C of o(c)){const k=c[C];function b(...e){if(new.target)throw d();return s(k,this,e)}r(b,"name",{__proto__:null,value:k.name}),r(b,"length",{__proto__:null,value:k.length}),r(v.Readable.prototype,C,{__proto__:null,value:b,enumerable:!1,configurable:!0,writable:!0})}v.Writable=n(6304),v.Duplex=n(8672),v.Transform=n(1161),v.PassThrough=n(917),v.pipeline=h;const{addAbortSignal:y}=n(196);v.addAbortSignal=y,v.finished=f,v.destroy=p,v.compose=u,r(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>m}),r(h,a,{__proto__:null,enumerable:!0,get:()=>m.pipeline}),r(f,a,{__proto__:null,enumerable:!0,get:()=>m.finished}),v.Stream=v,v._isUint8Array=function(e){return e instanceof Uint8Array},v._uint8ArrayToBuffer=function(e){return i.from(e.buffer,e.byteOffset,e.byteLength)}},7854:(e,t,n)=>{"use strict";const{ArrayPrototypePop:i,Promise:r}=n(9061),{isIterable:o,isNodeStream:s}=n(5874),{pipelineImpl:a}=n(9946),{finished:l}=n(8610);e.exports={finished:l,pipeline:function(...e){return new r(((t,n)=>{let r,l;const c=e[e.length-1];if(c&&"object"==typeof c&&!s(c)&&!o(c)){const t=i(e);r=t.signal,l=t.end}a(e,((e,i)=>{e?n(e):t(i)}),{signal:r,end:l})}))}}},9509:(e,t,n)=>{var i=n(8764),r=i.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=i:(o(i,t),t.Buffer=s),o(r,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},2553:(e,t,n)=>{"use strict";var i=n(9509).Buffer,r=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=c,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=d,this.end=u,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"<22>";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"<22>";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"<22>"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function d(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function u(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"<22>":t},o.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var r=s(t[i]);return r>=0?(r>0&&(e.lastNeed=r-1),r):--i<n||-2===r?0:(r=s(t[i]))>=0?(r>0&&(e.lastNeed=r-2),r):--i<n||-2===r?0:(r=s(t[i]))>=0?(r>0&&(2===r?r=0:e.lastNeed=r-3),r):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},655:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__assign:()=>o,__asyncDelegator:()=>S,__asyncGenerator:()=>y,__asyncValues:()=>w,__await:()=>b,__awaiter:()=>d,__classPrivateFieldGet:()=>_,__classPrivateFieldSet:()=>T,__createBinding:()=>h,__decorate:()=>a,__exportStar:()=>p,__extends:()=>r,__generator:()=>u,__importDefault:()=>E,__importStar:()=>k,__makeTemplateObject:()=>C,__metadata:()=>c,__param:()=>l,__read:()=>m,__rest:()=>s,__spread:()=>g,__spreadArrays:()=>v,__values:()=>f});var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},i(e,t)};function r(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},o.apply(this,arguments)};function s(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function a(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function l(e,t){return function(n,i){t(n,i,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function d(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))}function u(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function h(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}function p(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function f(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function g(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(m(arguments[t]));return e}function v(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,r++)i[r]=o[s];return i}function b(e){return this instanceof b?(this.v=e,this):new b(e)}function y(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){o.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof b?Promise.resolve(n.value.v).then(l,c):d(o[0][2],n)}catch(e){d(o[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function d(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function S(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:b(e[i](t)),done:"return"===i}:r?r(t):t}:r}}function w(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=f(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){!function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)}(i,r,(t=e[n](t)).done,t.value)}))}}}function C(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function k(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function E(e){return e&&e.__esModule?e:{default:e}}function _(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function T(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},2238:function(e,t,n){var i;!function(r,o){"use strict";var s="function",a="undefined",l="object",c="string",d="model",u="name",h="type",p="vendor",f="version",m="architecture",g="console",v="mobile",b="tablet",y="smarttv",S="wearable",w="embedded",C="Amazon",k="Apple",E="ASUS",_="BlackBerry",T="Browser",x="Chrome",I="Firefox",M="Google",A="Huawei",P="LG",O="Microsoft",R="Motorola",N="Opera",D="Samsung",F="Sharp",L="Sony",B="Xiaomi",U="Zebra",V="Facebook",j=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},z=function(e,t){return typeof e===c&&-1!==$(t).indexOf($(e))},$=function(e){return e.toLowerCase()},W=function(e,t){if(typeof e===c)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),typeof t===a?e:e.substring(0,350)},H=function(e,t){for(var n,i,r,a,c,d,u=0;u<t.length&&!c;){var h=t[u],p=t[u+1];for(n=i=0;n<h.length&&!c;)if(c=h[n++].exec(e))for(r=0;r<p.length;r++)d=c[++i],typeof(a=p[r])===l&&a.length>0?2===a.length?typeof a[1]==s?this[a[0]]=a[1].call(this,d):this[a[0]]=a[1]:3===a.length?typeof a[1]!==s||a[1].exec&&a[1].test?this[a[0]]=d?d.replace(a[1],a[2]):o:this[a[0]]=d?a[1].call(this,d,a[2]):o:4===a.length&&(this[a[0]]=d?a[3].call(this,d.replace(a[1],a[2])):o):this[a]=d||o;u+=2}},q=function(e,t){for(var n in t)if(typeof t[n]===l&&t[n].length>0){for(var i=0;i<t[n].length;i++)if(z(t[n][i],e))return"?"===n?o:n}else if(z(t[n],e))return"?"===n?o:n;return e},K={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},G={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,f],[/opios[\/ ]+([\w\.]+)/i],[f,[u,N+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[u,N]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[u,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[f,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+T],f],[/\bfocus\/([\w\.]+)/i],[f,[u,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[u,N+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[u,N+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[u,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[f,[u,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+T]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+T],f],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,V],f],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[u,x+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,x+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[u,"Android "+T]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[f,q,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[u,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,f]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[m,"amd64"]],[/(ia32(?=;))/i],[[m,$]],[/((?:i[346]|x)86)[;\)]/i],[[m,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[m,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[m,"armhf"]],[/windows (ce|mobile); ppc;/i],[[m,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[m,/ower/,"",$]],[/(sun4\w)[;\)]/i],[[m,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[m,$]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[p,D],[h,b]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[p,D],[h,v]],[/\((ip(?:hone|od)[\w ]*);/i],[d,[p,k],[h,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[p,k],[h,b]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[p,A],[h,b]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[p,A],[h,v]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[d,/_/g," "],[p,B],[h,v]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[p,B],[h,b]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[p,"OPPO"],[h,v]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[p,"Vivo"],[h,v]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[d,[p,"Realme"],[h,v]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[p,R],[h,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[p,R],[h,b]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[p,P],[h,b]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[p,P],[h,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[p,"Lenovo"],[h,b]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[p,"Nokia"],[h,v]],[/(pixel c)\b/i],[d,[p,M],[h,b]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[p,M],[h,v]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[p,L],[h,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[p,L],[h,b]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[p,"OnePlus"],[h,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[p,C],[h,b]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[p,C],[h,v]],[/(playbook);[-\w\),; ]+(rim)/i],[d,p,[h,b]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[p,_],[h,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[p,E],[h,b]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[p,E],[h,v]],[/(nexus 9)/i],[d,[p,"HTC"],[h,b]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[d,/_/g," "],[h,v]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[p,"Acer"],[h,b]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[p,"Meizu"],[h,v]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[p,F],[h,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,d,[h,v]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,d,[h,b]],[/(surface duo)/i],[d,[p,O],[h,b]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[p,"Fairphone"],[h,v]],[/(u304aa)/i],[d,[p,"AT&T"],[h,v]],[/\bsie-(\w*)/i],[d,[p,"Siemens"],[h,v]],[/\b(rct\w+) b/i],[d,[p,"RCA"],[h,b]],[/\b(venue[\d ]{2,7}) b/i],[d,[p,"Dell"],[h,b]],[/\b(q(?:mv|ta)\w+) b/i],[d,[p,"Verizon"],[h,b]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[p,"Barnes & Noble"],[h,b]],[/\b(tm\d{3}\w+) b/i],[d,[p,"NuVision"],[h,b]],[/\b(k88) b/i],[d,[p,"ZTE"],[h,b]],[/\b(nx\d{3}j) b/i],[d,[p,"ZTE"],[h,v]],[/\b(gen\d{3}) b.+49h/i],[d,[p,"Swiss"],[h,v]],[/\b(zur\d{3}) b/i],[d,[p,"Swiss"],[h,b]],[/\b((zeki)?tb.*\b) b/i],[d,[p,"Zeki"],[h,b]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],d,[h,b]],[/\b(ns-?\w{0,9}) b/i],[d,[p,"Insignia"],[h,b]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[p,"NextBook"],[h,b]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],d,[h,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],d,[h,v]],[/\b(ph-1) /i],[d,[p,"Essential"],[h,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[p,"Envizen"],[h,b]],[/\b(trio[-\w\. ]+) b/i],[d,[p,"MachSpeed"],[h,b]],[/\btu_(1491) b/i],[d,[p,"Rotor"],[h,b]],[/(shield[\w ]+) b/i],[d,[p,"Nvidia"],[h,b]],[/(sprint) (\w+)/i],[p,d,[h,v]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[p,O],[h,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[p,U],[h,b]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[p,U],[h,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,d,[h,g]],[/droid.+; (shield) bui/i],[d,[p,"Nvidia"],[h,g]],[/(playstation [345portablevi]+)/i],[d,[p,L],[h,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[p,O],[h,g]],[/smart-tv.+(samsung)/i],[p,[h,y]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[p,D],[h,y]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,P],[h,y]],[/(apple) ?tv/i],[p,[d,k+" TV"],[h,y]],[/crkey/i],[[d,x+"cast"],[p,M],[h,y]],[/droid.+aft(\w)( bui|\))/i],[d,[p,C],[h,y]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[p,F],[h,y]],[/(bravia[\w ]+)( bui|\))/i],[d,[p,L],[h,y]],[/(mitv-\w{5}) bui/i],[d,[p,B],[h,y]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[p,W],[d,W],[h,y]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[h,y]],[/((pebble))app/i],[p,d,[h,S]],[/droid.+; (glass) \d/i],[d,[p,M],[h,S]],[/droid.+; (wt63?0{2,3})\)/i],[d,[p,U],[h,S]],[/(quest( 2)?)/i],[d,[p,V],[h,S]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[h,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[d,[h,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[h,b]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[h,b]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[h,v]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[f,q,K]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[f,q,K]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,f],[/\(bb(10);/i],[f,[u,_]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[u,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[u,"webOS"]],[/crkey\/([\d\.]+)/i],[f,[u,x+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[u,"Chromium OS"],f],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,f],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,f]]},J=function(e,t){if(typeof e===l&&(t=e,e=o),!(this instanceof J))return new J(e,t).getResult();var n=e||(typeof r!==a&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),i=t?function(e,t){var n={};for(var i in e)t[i]&&t[i].length%2==0?n[i]=t[i].concat(e[i]):n[i]=e[i];return n}(G,t):G;return this.getBrowser=function(){var e,t={};return t[u]=o,t[f]=o,H.call(t,n,i.browser),t.major=typeof(e=t.version)===c?e.replace(/[^\d\.]/g,"").split(".")[0]:o,t},this.getCPU=function(){var e={};return e[m]=o,H.call(e,n,i.cpu),e},this.getDevice=function(){var e={};return e[p]=o,e[d]=o,e[h]=o,H.call(e,n,i.device),e},this.getEngine=function(){var e={};return e[u]=o,e[f]=o,H.call(e,n,i.engine),e},this.getOS=function(){var e={};return e[u]=o,e[f]=o,H.call(e,n,i.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===c&&e.length>350?W(e,350):e,this},this.setUA(n),this};J.VERSION="1.0.32",J.BROWSER=j([u,f,"major"]),J.CPU=j([m]),J.DEVICE=j([d,p,h,g,v,y,b,S,w]),J.ENGINE=J.OS=j([u,f]),typeof t!==a?(e.exports&&(t=e.exports=J),t.UAParser=J):n.amdO?(i=function(){return J}.call(t,n,t,e))===o||(e.exports=i):typeof r!==a&&(r.UAParser=J);var Q=typeof r!==a&&(r.jQuery||r.Zepto);if(Q&&!Q.ua){var Y=new J;Q.ua=Y.getResult(),Q.ua.get=function(){return Y.getUA()},Q.ua.set=function(e){Y.setUA(e);var t=Y.getResult();for(var n in t)Q.ua[n]=t[n]}}}("object"==typeof window?window:this)},4927:(e,t,n)=>{function i(e){try{if(!n.g.localStorage)return!1}catch(e){return!1}var t=n.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,t){if(i("noDeprecation"))return e;var n=!1;return function(){if(!n){if(i("throwDeprecation"))throw new Error(t);i("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}},8156:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__8156__},1801:()=>{},7531:()=>{}},__webpack_module_cache__={};function __nested_webpack_require_1149691__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__nested_webpack_require_1149691__),n.exports}__nested_webpack_require_1149691__.amdO={},__nested_webpack_require_1149691__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __nested_webpack_require_1149691__.d(t,{a:t}),t},__nested_webpack_require_1149691__.d=(e,t)=>{for(var n in t)__nested_webpack_require_1149691__.o(t,n)&&!__nested_webpack_require_1149691__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__nested_webpack_require_1149691__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__nested_webpack_require_1149691__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__nested_webpack_require_1149691__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{"use strict";__nested_webpack_require_1149691__.r(__webpack_exports__),__nested_webpack_require_1149691__.d(__webpack_exports__,{BufferSize:()=>r,DefaultVoiceChangerClientSetting:()=>c,DefaultVoiceChangerServerSetting:()=>l,DefaultWorkletSetting:()=>d,Framework:()=>s,OnnxExecutionProvider:()=>o,Protocol:()=>t,SampleRate:()=>i,ServerSettingKey:()=>a,VOICE_CHANGER_CLIENT_EXCEPTION:()=>u,VoiceChangerClient:()=>Be,VoiceChangerMode:()=>n,createDummyMediaStream:()=>f,fileSelector:()=>m,fileSelectorAsDataURL:()=>g,useClient:()=>je,validateUrl:()=>v});var e={};__nested_webpack_require_1149691__.r(e),__nested_webpack_require_1149691__.d(e,{Decoder:()=>Ee,Encoder:()=>ke,PacketType:()=>Ce,protocol:()=>we});const t={sio:"sio",rest:"rest"},n={realtime:"realtime","near-realtime":"near-realtime"},i={48e3:48e3},r={256:256,512:512,1024:1024,2048:2048,4096:4096,8192:8192,16384:16384},o={CPUExecutionProvider:"CPUExecutionProvider",CUDAExecutionProvider:"CUDAExecutionProvider",DmlExecutionProvider:"DmlExecutionProvider",OpenVINOExecutionProvider:"OpenVINOExecutionProvider"},s={PyTorch:"PyTorch",ONNX:"ONNX"},a={srcId:"srcId",dstId:"dstId",convertChunkNum:"convertChunkNum",minConvertSize:"minConvertSize",gpu:"gpu",crossFadeOffsetRate:"crossFadeOffsetRate",crossFadeEndRate:"crossFadeEndRate",crossFadeOverlapRate:"crossFadeOverlapRate",framework:"framework",onnxExecutionProvider:"onnxExecutionProvider"},l={convertChunkNum:32,minConvertSize:0,srcId:107,dstId:100,gpu:0,crossFadeLowerValue:.1,crossFadeOffsetRate:.1,crossFadeEndRate:.9,crossFadeOverlapRate:.5,framework:"PyTorch",onnxExecutionProvider:"CPUExecutionProvider"},c={audioInput:null,mmvcServerUrl:"",protocol:"sio",sampleRate:48e3,bufferSize:1024,inputChunkNum:48,speakers:[{id:100,name:"ずんだもん"},{id:107,name:"user"},{id:101,name:"そら"},{id:102,name:"めたん"},{id:103,name:"つむぎ"}],forceVfDisable:!1,voiceChangerMode:"realtime"},d={numTrancateTreshold:188,volTrancateThreshold:5e-4,volTrancateLength:32},u={ERR_SIO_CONNECT_FAILED:"ERR_SIO_CONNECT_FAILED",ERR_SIO_INVALID_RESPONSE:"ERR_SIO_INVALID_RESPONSE",ERR_REST_INVALID_RESPONSE:"ERR_REST_INVALID_RESPONSE",ERR_MIC_STREAM_NOT_INITIALIZED:"ERR_MIC_STREAM_NOT_INITIALIZED"};class h extends AudioWorkletNode{constructor(e,t){super(e,"voice-changer-worklet-processor"),this.postReceivedVoice=e=>{this.port.postMessage({request:e},[e.voice])},this.port.onmessage=this.handleMessage.bind(this),this.listener=t,console.log("[worklet_node][voice-changer-worklet-processor] created.")}handleMessage(e){this.listener.notifyVolume(e.data.volume)}}var p=__nested_webpack_require_1149691__(3204);const f=e=>{const t=e.createMediaStreamDestination(),n=e.createGain();n.gain.value=0,n.connect(t);const i=e.createOscillator();return i.frequency.value=440,i.connect(n),i.start(),t.stream},m=async e=>{const t=document.createElement("input");t.type="file";const n=new Promise(((n,i)=>{t.onchange=t=>{if(t.target instanceof HTMLInputElement==0)return console.log("invalid target!",t.target),i("invalid target"),null;const r=t.target;return r.files&&0!=r.files.length?""!=e&&r.files[0].type.match(e)?(i(`not target file type ${r.files[0].type}`),null):(n(r.files[0]),null):(i("no file selected"),null)},t.click()}));return await n},g=async e=>{const t=await m(e);return t?await new Promise((e=>{const n=new FileReader;n.onload=()=>{console.log("load data",n.result),e(n.result)},n.readAsDataURL(t)})):t},v=e=>e.endsWith("/")?e.substring(0,e.length-1):e;var b=__nested_webpack_require_1149691__(3900),y=__nested_webpack_require_1149691__.n(b);const S=Object.create(null);S.open="0",S.close="1",S.ping="2",S.pong="3",S.message="4",S.upgrade="5",S.noop="6";const w=Object.create(null);Object.keys(S).forEach((e=>{w[S[e]]=e}));const C={type:"error",data:"parser error"},k="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),E="function"==typeof ArrayBuffer,_=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+e)},n.readAsDataURL(e)},T=({type:e,data:t},n,i)=>{return k&&t instanceof Blob?n?i(t):_(t,i):E&&(t instanceof ArrayBuffer||(r=t,"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer))?n?i(t):_(new Blob([t]),i):i(S[e]+(t||""));var r},x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",I="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<x.length;e++)I[x.charCodeAt(e)]=e;const M="function"==typeof ArrayBuffer,A=(e,t)=>{if(M){const n=(e=>{let t,n,i,r,o,s=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const c=new ArrayBuffer(s),d=new Uint8Array(c);for(t=0;t<a;t+=4)n=I[e.charCodeAt(t)],i=I[e.charCodeAt(t+1)],r=I[e.charCodeAt(t+2)],o=I[e.charCodeAt(t+3)],d[l++]=n<<2|i>>4,d[l++]=(15&i)<<4|r>>2,d[l++]=(3&r)<<6|63&o;return c})(e);return P(n,t)}return{base64:!0,data:e}},P=(e,t)=>"blob"===t&&e instanceof ArrayBuffer?new Blob([e]):e,O=(e,t)=>{if("string"!=typeof e)return{type:"message",data:P(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:A(e.substring(1),t)}:w[n]?e.length>1?{type:w[n],data:e.substring(1)}:{type:w[n]}:C},R=String.fromCharCode(30);function N(e){if(e)return function(e){for(var t in N.prototype)e[t]=N.prototype[t];return e}(e)}N.prototype.on=N.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},N.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},N.prototype.off=N.prototype.removeListener=N.prototype.removeAllListeners=N.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r=0;r<i.length;r++)if((n=i[r])===t||n.fn===t){i.splice(r,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},N.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(n){i=0;for(var r=(n=n.slice(0)).length;i<r;++i)n[i].apply(this,t)}return this},N.prototype.emitReserved=N.prototype.emit,N.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},N.prototype.hasListeners=function(e){return!!this.listeners(e).length};const D="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function F(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const L=setTimeout,B=clearTimeout;function U(e,t){t.useNativeTimers?(e.setTimeoutFn=L.bind(D),e.clearTimeoutFn=B.bind(D)):(e.setTimeoutFn=setTimeout.bind(D),e.clearTimeoutFn=clearTimeout.bind(D))}class V extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class j extends N{constructor(e){super(),this.writable=!1,U(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new V(e,t,n)),this}open(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=O(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const z="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),$={};let W,H=0,q=0;function K(e){let t="";do{t=z[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function G(){const e=K(+new Date);return e!==W?(H=0,W=e):e+"."+K(H++)}for(;q<64;q++)$[z[q]]=q;function J(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}let Q=!1;try{Q="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const Y=Q;function Z(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||Y))return new XMLHttpRequest}catch(e){}if(!t)try{return new(D[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}function X(){}const ee=null!=new Z({xdomain:!1}).responseType;class te extends N{constructor(e,t){super(),U(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.create()}create(){const e=F(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new Z(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&t.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(e){}if("POST"===this.method)try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{t.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{4===t.readyState&&(200===t.status||1223===t.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof t.status?t.status:0)}),0))},t.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=te.requestsCount++,te.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=X,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete te.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function ne(){for(let e in te.requests)te.requests.hasOwnProperty(e)&&te.requests[e].abort()}te.requestsCount=0,te.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",ne):"function"==typeof addEventListener&&addEventListener("onpagehide"in D?"pagehide":"unload",ne,!1));const ie="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),re=D.WebSocket||D.MozWebSocket;__nested_webpack_require_1149691__(8764).Buffer;const oe="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),se={websocket:class extends j{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=oe?{}:F(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=oe?new re(e,t,n):t?new re(e,t):new re(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType||"arraybuffer",this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;T(n,this.supportsBinary,(e=>{try{this.ws.send(e)}catch(e){}i&&ie((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let n="";this.opts.port&&("wss"===t&&443!==Number(this.opts.port)||"ws"===t&&80!==Number(this.opts.port))&&(n=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=G()),this.supportsBinary||(e.b64=1);const i=J(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(i.length?"?"+i:"")}check(){return!!re}},polling:class extends j{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port,this.xs=e.secure!==t}const t=e&&e.forceBase64;this.supportsBinary=ee&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(R),i=[];for(let e=0;e<n.length;e++){const r=O(n[e],t);if(i.push(r),"error"===r.type)break}return i})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,i=new Array(n);let r=0;e.forEach(((e,o)=>{T(e,!1,(e=>{i[o]=e,++r===n&&t(i.join(R))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let n="";!1!==this.opts.timestampRequests&&(e[this.opts.timestampParam]=G()),this.supportsBinary||e.sid||(e.b64=1),this.opts.port&&("https"===t&&443!==Number(this.opts.port)||"http"===t&&80!==Number(this.opts.port))&&(n=":"+this.opts.port);const i=J(e);return t+"://"+(-1!==this.opts.hostname.indexOf(":")?"["+this.opts.hostname+"]":this.opts.hostname)+n+this.opts.path+(i.length?"?"+i:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new te(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},ae=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,le=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ce(e){const t=e,n=e.indexOf("["),i=e.indexOf("]");-1!=n&&-1!=i&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));let r=ae.exec(e||""),o={},s=14;for(;s--;)o[le[s]]=r[s]||"";return-1!=n&&-1!=i&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const n=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1),"/"==t.slice(-1)&&n.splice(n.length-1,1),n}(0,o.path),o.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,i){t&&(n[t]=i)})),n}(0,o.query),o}class de extends N{constructor(e,t={}){super(),e&&"object"==typeof e&&(t=e,e=null),e?(e=ce(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=ce(t.host).host),U(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+"/","string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,i=n.length;e<i;e++){let i=n[e].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new se[e](n)}open(){let e;if(this.opts.rememberUpgrade&&de.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(e){let t=this.createTransport(e),n=!1;de.priorWebsocketSuccess=!1;const i=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;de.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function r(){n||(n=!0,c(),t.close(),t=null)}const o=e=>{const n=new Error("probe error: "+e);n.transport=t.name,r(),this.emitReserved("upgradeError",n)};function s(){o("transport closed")}function a(){o("socket closed")}function l(e){t&&e.name!==t.name&&r()}const c=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",s),this.off("close",a),this.off("upgrading",l)};t.once("open",i),t.once("error",o),t.once("close",s),this.once("close",a),this.once("upgrading",l),t.open()}onOpen(){if(this.readyState="open",de.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade&&this.transport.pause){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n<this.writeBuffer.length;n++){const i=this.writeBuffer[n].data;if(i&&(e+="string"==typeof(t=i)?function(e){let t=0,n=0;for(let i=0,r=e.length;i<r;i++)t=e.charCodeAt(i),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(i++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this.maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,i){if("function"==typeof t&&(i=t,t=void 0),"function"==typeof n&&(i=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const r={type:e,data:t,options:n};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}onError(e){de.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const i=e.length;for(;n<i;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}de.protocol=4,de.protocol;const ue="function"==typeof ArrayBuffer,he=Object.prototype.toString,pe="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===he.call(Blob),fe="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===he.call(File);function me(e){return ue&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||pe&&e instanceof Blob||fe&&e instanceof File}function ge(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(ge(e[t]))return!0;return!1}if(me(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return ge(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&ge(e[t]))return!0;return!1}function ve(e){const t=[],n=e.data,i=e;return i.data=be(n,t),i.attachments=t.length,{packet:i,buffers:t}}function be(e,t){if(!e)return e;if(me(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=be(e[i],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=be(e[i],t));return n}return e}function ye(e,t){return e.data=Se(e.data,t),e.attachments=void 0,e}function Se(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Se(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Se(e[n],t));return e}const we=5;var Ce;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(Ce||(Ce={}));class ke{constructor(e){this.replacer=e}encode(e){return e.type!==Ce.EVENT&&e.type!==Ce.ACK||!ge(e)?[this.encodeAsString(e)]:(e.type=e.type===Ce.EVENT?Ce.BINARY_EVENT:Ce.BINARY_ACK,this.encodeAsBinary(e))}encodeAsString(e){let t=""+e.type;return e.type!==Ce.BINARY_EVENT&&e.type!==Ce.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=ve(e),n=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(n),i}}class Ee extends N{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e),t.type===Ce.BINARY_EVENT||t.type===Ce.BINARY_ACK?(this.reconstructor=new _e(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!me(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Ce[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Ce.BINARY_EVENT||n.type===Ce.BINARY_ACK){const i=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const r=e.substring(i,t);if(r!=Number(r)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(r)}if("/"===e.charAt(t+1)){const i=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);n.nsp=e.substring(i,t)}else n.nsp="/";const i=e.charAt(t+1);if(""!==i&&Number(i)==i){const i=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(!Ee.isPayloadValid(n.type,i))throw new Error("invalid payload");n.data=i}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Ce.CONNECT:return"object"==typeof t;case Ce.DISCONNECT:return void 0===t;case Ce.CONNECT_ERROR:return"string"==typeof t||"object"==typeof t;case Ce.EVENT:case Ce.BINARY_EVENT:return Array.isArray(t)&&t.length>0;case Ce.ACK:case Ce.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&this.reconstructor.finishedReconstruction()}}class _e{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=ye(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Te(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const xe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ie extends N{constructor(e,t,n){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Te(e,"open",this.onopen.bind(this)),Te(e,"packet",this.onpacket.bind(this)),Te(e,"error",this.onerror.bind(this)),Te(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(xe.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');t.unshift(e);const n={type:Ce.EVENT,data:t,options:{}};if(n.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,i=t.pop();this._registerAckCallback(e,i),n.id=e}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){const n=this.flags.timeout;if(void 0===n)return void(this.acks[e]=t);const i=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),n);this.acks[e]=(...e)=>{this.io.clearTimeoutFn(i),t.apply(this,[null,...e])}}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this.packet({type:Ce.CONNECT,data:e})})):this.packet({type:Ce.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ce.CONNECT:if(e.data&&e.data.sid){const t=e.data.sid;this.onconnect(t)}else this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ce.EVENT:case Ce.BINARY_EVENT:this.onevent(e);break;case Ce.ACK:case Ce.BINARY_ACK:this.onack(e);break;case Ce.DISCONNECT:this.ondisconnect();break;case Ce.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e)}ack(e){const t=this;let n=!1;return function(...i){n||(n=!0,t.packet({type:Ce.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e){this.id=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ce.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function Me(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Me.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},Me.prototype.reset=function(){this.attempts=0},Me.prototype.setMin=function(e){this.ms=e},Me.prototype.setMax=function(e){this.max=e},Me.prototype.setJitter=function(e){this.jitter=e};class Ae extends N{constructor(t,n){var i;super(),this.nsps={},this.subs=[],t&&"object"==typeof t&&(n=t,t=void 0),(n=n||{}).path=n.path||"/socket.io",this.opts=n,U(this,n),this.reconnection(!1!==n.reconnection),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(i=n.randomizationFactor)&&void 0!==i?i:.5),this.backoff=new Me({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==n.timeout?2e4:n.timeout),this._readyState="closed",this.uri=t;const r=n.parser||e;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==n.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new de(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const i=Te(t,"open",(function(){n.onopen(),e&&e()})),r=Te(t,"error",(t=>{n.cleanup(),n._readyState="closed",this.emitReserved("error",t),e?e(t):n.maybeReconnectOnOpen()}));if(!1!==this._timeout){const e=this._timeout;0===e&&i();const n=this.setTimeoutFn((()=>{i(),t.close(),t.emit("error",new Error("timeout"))}),e);this.opts.autoUnref&&n.unref(),this.subs.push((function(){clearTimeout(n)}))}return this.subs.push(i),this.subs.push(r),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Te(e,"ping",this.onping.bind(this)),Te(e,"data",this.ondata.bind(this)),Te(e,"error",this.onerror.bind(this)),Te(e,"close",this.onclose.bind(this)),Te(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){ie((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n||(n=new Ie(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t)if(this.nsps[e].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((function(){clearTimeout(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Pe={};function Oe(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let i=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),i=ce(e)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const r=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+r+":"+i.port+t,i.href=i.protocol+"://"+r+(n&&n.port===i.port?"":":"+i.port),i}(e,(t=t||{}).path||"/socket.io"),i=n.source,r=n.id,o=n.path,s=Pe[r]&&o in Pe[r].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new Ae(i,t):(Pe[r]||(Pe[r]=new Ae(i,t)),a=Pe[r]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(Oe,{Manager:Ae,Socket:Ie,io:Oe,connect:Oe});var Re=__nested_webpack_require_1149691__(9827),Ne=__nested_webpack_require_1149691__(8764).Buffer;class De extends Re.Duplex{constructor(e,t,n){super(n),this.protocol="sio",this.serverUrl="",this.socket=null,this.voiceChangerMode="realtime",this.inputChunkNum=128,this.requestChunks=[],this.recordChunks=[],this.isRecording=!1,this.bufferStart=0,this.createSocketIO=()=>{this.socket&&this.socket.close(),"sio"===this.protocol&&(this.socket=Oe(this.serverUrl+"/test"),this.socket.on("connect_error",(e=>{this.audioStreamerListeners.notifyException(u.ERR_SIO_CONNECT_FAILED,`[SIO] rconnection failed ${e}`)})),this.socket.on("connect",(()=>console.log(`[SIO] sonnect to ${this.serverUrl}`))),this.socket.on("response",(e=>{const t=Date.now()-e[0],n=e[1];n.byteLength<256?this.audioStreamerListeners.notifyException(u.ERR_SIO_INVALID_RESPONSE,`[SIO] recevied data is too short ${n.byteLength}`):(this.callbacks.onVoiceReceived(this.voiceChangerMode,e[1]),this.audioStreamerListeners.notifyResponseTime(t))})))},this.setServerUrl=e=>{this.serverUrl=e,console.log(`[AudioStreamer] Server Setting:${this.serverUrl} ${this.protocol}`),this.createSocketIO()},this.setProtocol=e=>{this.protocol=e,console.log(`[AudioStreamer] Server Setting:${this.serverUrl} ${this.protocol}`),this.createSocketIO()},this.setInputChunkNum=e=>{this.inputChunkNum=e},this.setVoiceChangerMode=e=>{this.voiceChangerMode=e},this.getSettings=()=>({serverUrl:this.serverUrl,protocol:this.protocol,inputChunkNum:this.inputChunkNum,voiceChangerMode:this.voiceChangerMode}),this._write=(e,t,n)=>{const i=e.getChannelData(0);"realtime"===this.voiceChangerMode?this._write_realtime(i):this._write_record(i),n()},this._write_realtime=e=>{const t=new ArrayBuffer(e.length/2*2),n=new DataView(t);for(let t=0;t<e.length;t++)if(t%2==0){let i=Math.max(-1,Math.min(1,e[t]));i=i<0?32768*i:32767*i,n.setInt16(t/2*2,i,!0)}for(let e=0;e<t.byteLength/256;e++){const n=t.slice(256*e,256*(e+1));this.requestChunks.push(n)}if(this.requestChunks.length<this.inputChunkNum)return;const i=this.requestChunks.reduce(((e,t)=>e+t.byteLength),0),r=new Uint8Array(i);this.requestChunks.reduce(((e,t)=>(r.set(new Uint8Array(t),e),e+t.byteLength)),0),this.sendBuffer(r),this.requestChunks=[],this.audioStreamerListeners.notifySendBufferingTime(Date.now()-this.bufferStart),this.bufferStart=Date.now()},this._write_record=e=>{if(!this.isRecording)return;const t=new ArrayBuffer(2*e.length/2),n=new DataView(t);for(var i=0;i<e.length;i++)if(i%2==0){let t=Math.max(-1,Math.min(1,e[i]));t=t<0?32768*t:32767*t,n.setInt16(i,t,!0)}this.recordChunks.push(t)},this.sendRecordedData=()=>{const e=this.recordChunks.reduce(((e,t)=>e+t.byteLength),0),t=new Uint8Array(e);this.recordChunks.reduce(((e,n)=>(t.set(new Uint8Array(n),e),e+n.byteLength)),0),this.sendBuffer(t)},this.startRecord=()=>{this.recordChunks=[],this.isRecording=!0},this.stopRecord=()=>{this.isRecording=!1},this.sendBuffer=async e=>{const t=Date.now();if("sio"===this.protocol){if(!this.socket)return void console.warn("sio is not initialized");this.socket.emit("request_message",[t,e.buffer])}else{const n=await Fe(this.serverUrl+"/test",t,e.buffer);n.byteLength<256?this.audioStreamerListeners.notifyException(u.ERR_REST_INVALID_RESPONSE,`[REST] recevied data is too short ${n.byteLength}`):(this.callbacks.onVoiceReceived(this.voiceChangerMode,n),this.audioStreamerListeners.notifyResponseTime(Date.now()-t))}},this.callbacks=e,this.audioStreamerListeners=t}}const Fe=async(e,t,n)=>{const i={timestamp:t,buffer:Ne.from(n).toString("base64")},r=JSON.stringify(i),o=await fetch(`${e}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:r}),s=(await o.json()).changedVoiceBase64,a=Ne.from(s,"base64"),l=new ArrayBuffer(a.length),c=new Uint8Array(l);for(let e=0;e<a.length;++e)c[e]=a[e];return l};class Le{constructor(){this.serverUrl="",this.getSettings=async()=>{const e=this.serverUrl+"/info";return await new Promise((t=>{const n=new Request(e,{method:"GET"});fetch(n).then((async e=>{const n=await e.json();t(n)}))}))},this.setServerUrl=e=>{this.serverUrl=e,console.log(`[ServerConfigurator] Server URL: ${this.serverUrl}`)},this.updateSettings=async(e,t)=>{const n=this.serverUrl+"/update_setteings";return await new Promise((async i=>{const r=new FormData;r.append("key",e),r.append("val",t);const o=new Request(n,{method:"POST",body:r});i(await(await fetch(o)).json())}))},this.uploadFile=async(e,t)=>{const n=this.serverUrl+"/upload_file";t(0,!1);const i=1048576,r=[];let o=0;for(let t=0;t<e.size;t+=i)r.push({hash:o++,chunk:e.slice(t,t+i)});const s=r.length;for(;;){const i=[];for(let t=0;t<10;t++){const t=r.shift();if(!t)break;const o=new Promise((i=>{const r=new FormData;r.append("file",t.chunk),r.append("filename",`${e.name}_${t.hash}`);const o=new Request(n,{method:"POST",body:r});fetch(o).then((async e=>{i()}))}));i.push(o)}if(await Promise.all(i),0==r.length)break;t(Math.floor((s-r.length)/(s+1)*100),!1)}return s},this.concatUploadedFile=async(e,t)=>{const n=this.serverUrl+"/concat_uploaded_file";await new Promise((i=>{const r=new FormData;r.append("filename",e.name),r.append("filenameChunkNum",""+t);const o=new Request(n,{method:"POST",body:r});fetch(o).then((async e=>{console.log(await e.text()),i()}))}))},this.loadModel=async(e,t,n)=>{const i=this.serverUrl+"/load_model",r=new Promise((async r=>{const o=new FormData;o.append("pyTorchModelFilename",t?.name||"-"),o.append("onnxModelFilename",n?.name||"-"),o.append("configFilename",e.name);const s=new Request(i,{method:"POST",body:o});r(await(await fetch(s)).json())}));return await r}}}class Be{constructor(e,t,n,i){this.vfEnable=!1,this.vf=null,this.currentDevice=null,this.currentMediaStream=null,this.currentMediaStreamAudioSourceNode=null,this.outputNodeFromVF=null,this.micStream=null,this._isVoiceChanging=!1,this.sslCertified=[],this.callbacks={onVoiceReceived:(e,t)=>{if("realtime"===e){const e={requestType:"voice",voice:t,numTrancateTreshold:0,volTrancateThreshold:0,volTrancateLength:0};return void this.vcNode.postReceivedVoice(e)}console.log("near realtime mode");const n=new Int16Array(t),i=new Float32Array(n.length);n.forEach(((e,t)=>{const n=e>=32768?-(65536-e)/32768:e/32767;i[t]=n}));const r=this.ctx.createBufferSource(),o=this.ctx.createBuffer(1,i.length,24e3);o.getChannelData(0).set(i),r.buffer=o,r.start(),r.connect(this.currentMediaStreamAudioDestinationNode)}},this.isInitialized=async()=>(this.promiseForInitialize&&await this.promiseForInitialize,!0),this.setup=async(e,t,n=!1)=>{if(!this.vcNode)throw console.warn("vc node is not initialized."),"vc node is not initialized.";if(this.currentMediaStream&&(this.currentMediaStream.getTracks().forEach((e=>{e.stop()})),this.currentMediaStream=null),this.currentMediaStream="string"==typeof e?await navigator.mediaDevices.getUserMedia({audio:{deviceId:e}}):e,this.micStream&&(this.micStream.unpipe(),this.micStream.destroy(),this.micStream=null),this.micStream=new(y())({objectMode:!0,bufferSize:t,context:this.ctx}),this.currentDevice&&0==n){this.currentMediaStreamAudioSourceNode=this.ctx.createMediaStreamSource(this.currentMediaStream),this.currentDevice.chooseNewInnerDevice(this.currentMediaStream);const e=await this.currentDevice.createAudioNode(this.ctx);this.currentMediaStreamAudioSourceNode.connect(e.start),e.end.connect(this.outputNodeFromVF),this.micStream.setStream(this.outputNodeFromVF.stream)}else console.log("VF disabled"),this.micStream.setStream(this.currentMediaStream);this.micStream.pipe(this.audioStreamer),this._isVoiceChanging?this.micStream.playRecording():this.micStream.pauseRecording()},this.start=()=>{if(!this.micStream)throw`Exception:${u.ERR_MIC_STREAM_NOT_INITIALIZED}`;this.micStream.playRecording(),this._isVoiceChanging=!0},this.stop=()=>{this.micStream&&(this.micStream.pauseRecording(),this._isVoiceChanging=!1)},this.setServerUrl=(e,t=!1)=>{const n=v(e);n!=`${location.protocol}//${location.host}`&&0!=n.length&&"https:"==location.protocol&&0==this.sslCertified.includes(n)&&t&&(window.confirm("MMVC Server is different from this page's origin. Open tab to open ssl connection. OK? (You can close the opened tab after ssl connection succeed.)")?(window.open(n,"_blank"),this.sslCertified.push(n)):alert("Your voice conversion may fail...")),this.audioStreamer.setServerUrl(n),this.configurator.setServerUrl(n)},this.setProtocol=e=>{this.audioStreamer.setProtocol(e)},this.setInputChunkNum=e=>{this.audioStreamer.setInputChunkNum(e)},this.setVoiceChangerMode=e=>{this.audioStreamer.setVoiceChangerMode(e)},this.configureWorklet=e=>{const t={requestType:"config",voice:new ArrayBuffer(1),numTrancateTreshold:e.numTrancateTreshold,volTrancateThreshold:e.volTrancateThreshold,volTrancateLength:e.volTrancateLength};this.vcNode.postReceivedVoice(t)},this.uploadFile=(e,t)=>this.configurator.uploadFile(e,t),this.concatUploadedFile=(e,t)=>this.configurator.concatUploadedFile(e,t),this.loadModel=(e,t,n)=>this.configurator.loadModel(e,t,n),this.updateServerSettings=(e,t)=>this.configurator.updateSettings(e,t),this.getClientSettings=()=>this.audioStreamer.getSettings(),this.getServerSettings=()=>this.configurator.getSettings(),this.configurator=new Le,this.ctx=e,this.vfEnable=t,this.promiseForInitialize=new Promise((async e=>{const t=URL.createObjectURL(new Blob(['(()=>{"use strict";class t extends AudioWorkletProcessor{constructor(){super(),this.BLOCK_SIZE=128,this.initialized=!1,this.volume=0,this.numTrancateTreshold=150,this.volTrancateThreshold=5e-4,this.volTrancateLength=32,this.volTrancateCount=0,this.playBuffer=[],this.calcVol=(t,e)=>{const s=t.reduce(((t,e)=>t+e*e),0),r=Math.sqrt(s/t.length);return Math.max(r,.95*e)},this.initialized=!0,this.port.onmessage=this.handleMessage.bind(this)}handleMessage(t){const e=t.data.request;if("config"===e.requestType)return this.numTrancateTreshold=e.numTrancateTreshold,this.volTrancateLength=e.volTrancateLength,this.volTrancateThreshold=e.volTrancateThreshold,void console.log("[worklet] worklet configured",e);const s=e.voice,r=new Int16Array(s),o=new Float32Array(r.length);if(r.forEach(((t,e)=>{const s=t>=32768?-(65536-t)/32768:t/32767;o[e]=s})),this.playBuffer.length>this.numTrancateTreshold)for(console.log("[worklet] Buffer truncated");this.playBuffer.length>2;)this.playBuffer.shift();let h;for(let t=0;t<o.length;t++){const e=2*t%this.BLOCK_SIZE;0===e&&(h=new Float32Array(this.BLOCK_SIZE));const s=o[t],r=t+1<o.length?o[t+1]:o[t];h[e]=s,h[e+1]=(s+r)/2,h.length===e+2&&this.playBuffer.push(h)}}process(t,e,s){if(!this.initialized)return console.warn("[worklet] worklet_process not ready"),!0;if(0===this.playBuffer.length)return!0;let r;for(;r=this.playBuffer.shift(),r&&(this.volume=this.calcVol(r,this.volume),this.volume<this.volTrancateThreshold?this.volTrancateCount+=1:this.volTrancateCount=0,!(this.volTrancateCount<this.volTrancateLength||this.volTrancateLength<0)););return r&&(this.port.postMessage({volume:this.volume}),e[0][0].set(r)),!0}}registerProcessor("voice-changer-worklet-processor",t)})();'],{type:"text/javascript"}));if(await this.ctx.audioWorklet.addModule(t),this.vcNode=new h(this.ctx,i),this.currentMediaStreamAudioDestinationNode=this.ctx.createMediaStreamDestination(),this.vcNode.connect(this.currentMediaStreamAudioDestinationNode),this.audioStreamer=new De(this.callbacks,n,{objectMode:!0}),this.audioStreamer.setInputChunkNum(c.inputChunkNum),this.audioStreamer.setVoiceChangerMode(c.voiceChangerMode),this.vfEnable){this.vf=await p.VoiceFocusDeviceTransformer.create({variant:"c20"});const e=f(this.ctx);this.currentDevice=await this.vf.createTransformDevice(e)||null,this.outputNodeFromVF=this.ctx.createMediaStreamDestination()}e()}))}get stream(){return this.currentMediaStreamAudioDestinationNode.stream}get isVoiceChanging(){return this._isVoiceChanging}}var Ue=__nested_webpack_require_1149691__(8156);const Ve={pyTorchModel:null,configFile:null,onnxModel:null},je=e=>{const t=(0,Ue.useRef)(null),[n,i]=(0,Ue.useState)(t.current),r=(0,Ue.useRef)(),o=(0,Ue.useMemo)((()=>new Promise((e=>{r.current=e}))),[]),s=(e=>{const t=(0,Ue.useRef)(c),[n,i]=(0,Ue.useState)(t.current),r=(0,Ue.useMemo)((()=>n=>{e.voiceChangerClient&&(e.voiceChangerClient.setServerUrl(n,!0),t.current.mmvcServerUrl=n,i({...t.current}))}),[e.voiceChangerClient]),o=(0,Ue.useMemo)((()=>n=>{e.voiceChangerClient&&(e.voiceChangerClient.setProtocol(n),t.current.protocol=n,i({...t.current}))}),[e.voiceChangerClient]),s=async()=>{if(e.voiceChangerClient)if(t.current.audioInput&&"none"!=t.current.audioInput)console.log("[useClient] setup!(2)",t.current.audioInput),await e.voiceChangerClient.setup(t.current.audioInput,t.current.bufferSize,t.current.forceVfDisable);else{console.log("[useClient] setup!(1)",t.current.audioInput);const n=f(e.audioContext);await e.voiceChangerClient.setup(n,t.current.bufferSize,t.current.forceVfDisable)}},a=(0,Ue.useMemo)((()=>async n=>{e.voiceChangerClient&&(t.current.audioInput=n,await s(),i({...t.current}))}),[e.voiceChangerClient]),l=(0,Ue.useMemo)((()=>async n=>{e.voiceChangerClient&&(t.current.bufferSize=n,await s(),i({...t.current}))}),[e.voiceChangerClient]),d=(0,Ue.useMemo)((()=>async n=>{e.voiceChangerClient&&(t.current.forceVfDisable=n,await s(),i({...t.current}))}),[e.voiceChangerClient]),u=(0,Ue.useMemo)((()=>n=>{e.voiceChangerClient&&(e.voiceChangerClient.setInputChunkNum(n),t.current.inputChunkNum=n,i({...t.current}))}),[e.voiceChangerClient]),h=(0,Ue.useMemo)((()=>n=>{e.voiceChangerClient&&(e.voiceChangerClient.setVoiceChangerMode(n),t.current.voiceChangerMode=n,i({...t.current}))}),[e.voiceChangerClient]),p=(0,Ue.useMemo)((()=>n=>{e.voiceChangerClient&&(t.current.sampleRate=n,i({...t.current}))}),[e.voiceChangerClient]),m=(0,Ue.useMemo)((()=>n=>{e.voiceChangerClient&&(t.current.speakers=n,i({...t.current}))}),[e.voiceChangerClient]),g=(0,Ue.useMemo)((()=>async()=>{e.voiceChangerClient&&(e.voiceChangerClient.setServerUrl(n.mmvcServerUrl,!0),e.voiceChangerClient.start())}),[n.mmvcServerUrl,e.voiceChangerClient]),v=(0,Ue.useMemo)((()=>async()=>{e.voiceChangerClient&&e.voiceChangerClient.stop()}),[e.voiceChangerClient]),b=(0,Ue.useMemo)((()=>async()=>{e.voiceChangerClient&&await e.voiceChangerClient.getClientSettings()}),[e.voiceChangerClient]);return(0,Ue.useEffect)((()=>{"true"==new URLSearchParams(location.search).get("colab")?(o("rest"),u(64)):(o("sio"),u(32))}),[e.voiceChangerClient]),{setting:n,setServerUrl:r,setProtocol:o,setAudioInput:a,setBufferSize:l,setVfForceDisabled:d,setInputChunkNum:u,setVoiceChangerMode:h,setSampleRate:p,setSpeakers:m,start:g,stop:v,reloadClientSetting:b}})({voiceChangerClient:n,audioContext:e.audioContext}),u=(e=>{const[t,n]=(0,Ue.useState)(d),i=(0,Ue.useMemo)((()=>t=>{e.voiceChangerClient&&(e.voiceChangerClient.configureWorklet(t),n(t))}),[e.voiceChangerClient]);return(0,Ue.useEffect)((()=>{const e=new URLSearchParams(location.search).get("colab");i("true"==e?{numTrancateTreshold:300,volTrancateThreshold:5e-4,volTrancateLength:32}:{numTrancateTreshold:150,volTrancateThreshold:5e-4,volTrancateLength:32})}),[e.voiceChangerClient]),{setting:t,setSetting:i}})({voiceChangerClient:n}),h=(e=>{const t=(0,Ue.useRef)(l),[n,i]=(0,Ue.useState)(t.current),[r,o]=(0,Ue.useState)(),[s,c]=(0,Ue.useState)(Ve),d=async(n,r)=>{if(!e.voiceChangerClient)return!1;const s=await e.voiceChangerClient.updateServerSettings(n,""+r);return o(s),r==s[n]?(i({...t.current,convertChunkNum:s.convertChunkNum,minConvertSize:s.minConvertSize,srcId:s.srcId,dstId:s.dstId,gpu:s.gpu,crossFadeOffsetRate:s.crossFadeOffsetRate,crossFadeEndRate:s.crossFadeEndRate,crossFadeOverlapRate:s.crossFadeOverlapRate,framework:s.framework,onnxExecutionProvider:s.onnxExecutionProvider&&s.onnxExecutionProvider.length>0?s.onnxExecutionProvider[0]:l.onnxExecutionProvider}),!0):(alert(`[ServerSetting] 設定が反映されていません([key:${n}, new:${r}, res:${s[n]}])。モデルの切り替えの場合、処理が非同期で行われるため反映されていないように見える場合があります。サーバコントロールのリロードボタンを押すとGUIに反映されるます。`),!1)},u=(0,Ue.useMemo)((()=>async e=>await d(a.framework,""+e)),[e.voiceChangerClient]),h=(0,Ue.useMemo)((()=>async e=>await d(a.onnxExecutionProvider,""+e)),[e.voiceChangerClient]),p=(0,Ue.useMemo)((()=>async e=>await d(a.srcId,""+e)),[e.voiceChangerClient]),f=(0,Ue.useMemo)((()=>async e=>await d(a.dstId,""+e)),[e.voiceChangerClient]),m=(0,Ue.useMemo)((()=>async e=>await d(a.convertChunkNum,""+e)),[e.voiceChangerClient]),g=(0,Ue.useMemo)((()=>async e=>await d(a.minConvertSize,""+e)),[e.voiceChangerClient]),v=(0,Ue.useMemo)((()=>async e=>await d(a.gpu,""+e)),[e.voiceChangerClient]),b=(0,Ue.useMemo)((()=>async e=>await d(a.crossFadeOffsetRate,""+e)),[e.voiceChangerClient]),y=(0,Ue.useMemo)((()=>async e=>await d(a.crossFadeEndRate,""+e)),[e.voiceChangerClient]),S=(0,Ue.useMemo)((()=>async e=>await d(a.crossFadeOverlapRate,""+e)),[e.voiceChangerClient]),[w,C]=(0,Ue.useState)(0),[k,E]=(0,Ue.useState)(!1),_=(0,Ue.useMemo)((()=>async(t,n)=>{if(!e.voiceChangerClient)return;const i=await e.voiceChangerClient.uploadFile(t,n),r=await e.voiceChangerClient.concatUploadedFile(t,i);console.log("uploaded",i,r)}),[e.voiceChangerClient]),T=(0,Ue.useMemo)((()=>async()=>{if(!s.pyTorchModel&&!s.onnxModel)return void alert("PyTorchモデルとONNXモデルのどちらか一つ以上指定する必要があります。");if(!s.configFile)return void alert("Configファイルを指定する必要があります。");if(!e.voiceChangerClient)return;C(0),E(!0);const t=[s.pyTorchModel,s.onnxModel].filter((e=>null!=e));for(let e=0;e<t.length;e++){const n=1/t.length,i=100*e*n;await _(t[e],((e,t)=>{C(e*n+i)}))}await _(s.configFile,((e,t)=>{console.log(e,t)}));const n=await e.voiceChangerClient.loadModel(s.configFile,s.pyTorchModel,s.onnxModel);console.log(n),C(0),E(!1)}),[s,e.voiceChangerClient]),x=(0,Ue.useMemo)((()=>async()=>{if(!e.voiceChangerClient)return;const n=await e.voiceChangerClient.getServerSettings();o(n),i({...t.current,convertChunkNum:n.convertChunkNum,srcId:n.srcId,dstId:n.dstId,gpu:n.gpu,crossFadeOffsetRate:n.crossFadeOffsetRate,crossFadeEndRate:n.crossFadeEndRate,crossFadeOverlapRate:n.crossFadeOverlapRate,framework:n.framework,onnxExecutionProvider:n.onnxExecutionProvider&&n.onnxExecutionProvider.length>0?n.onnxExecutionProvider[0]:l.onnxExecutionProvider})}),[e.voiceChangerClient]);return(0,Ue.useEffect)((()=>{new URLSearchParams(location.search).get("colab")}),[e.voiceChangerClient]),{setting:n,serverInfo:r,fileUploadSetting:s,setFramework:u,setOnnxExecutionProvider:h,setSrcId:p,setDstId:f,setConvertChunkNum:m,setMinConvertSize:g,setGpu:v,setCrossFadeOffsetRate:b,setCrossFadeEndRate:y,setCrossFadeOverlapRate:S,reloadServerInfo:x,setFileUploadSetting:c,loadModel:T,uploadProgress:w,isUploading:k}})({voiceChangerClient:n}),[p,m]=(0,Ue.useState)(0),[g,v]=(0,Ue.useState)(0),[b,y]=(0,Ue.useState)(0),S=(0,Ue.useRef)(0);return(0,Ue.useEffect)((()=>{(async()=>{if(!e.audioContext)return;const n=new Be(e.audioContext,!0,{notifySendBufferingTime:e=>{m(e)},notifyResponseTime:e=>{v(e)},notifyException:e=>{e.length>0&&(console.log(`error:${e}`),S.current+=1,S.current>200&&(alert("エラーが頻発しています。対象としているフレームワークのモデルがロードされているか確認してください。"),S.current=0))}},{notifyVolume:e=>{y(e)}});await n.isInitialized(),t.current=n,i(t.current),console.log("[useClient] client initialized");const o=document.getElementById(e.audioOutputElementId);o.srcObject=t.current.stream,o.play(),r.current()})()}),[e.audioContext]),{bufferingTime:p,responseTime:g,volume:b,getInfo:(0,Ue.useMemo)((()=>async()=>{await o,await s.reloadClientSetting(),await h.reloadServerInfo()}),[s,h]),clientSetting:s,workletSetting:u,serverSetting:h}}})(),__webpack_exports__})(),module.exports=t(__webpack_require__(294))},90:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var i=n(81),r=n.n(i),o=n(645),s=n.n(o)()(r());s.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);"]),s.push([e.id,"@import url(https://fonts.googleapis.com/css2?family=Yusei+Magic&display=swap);"]),s.push([e.id,':root {\n --text-color: #333;\n --company-color1: rgba(64, 119, 187, 1);\n --company-color2: rgba(29, 47, 78, 1);\n --company-color3: rgba(255, 255, 255, 1);\n --company-color1-alpha: rgba(64, 119, 187, 0.3);\n --company-color2-alpha: rgba(29, 47, 78, 0.3);\n --company-color3-alpha: rgba(255, 255, 255, 0.3);\n --global-shadow-color: rgba(0, 0, 0, 0.4);\n\n --sidebar-transition-time: 0.3s;\n --sidebar-transition-time-quick: 0.1s;\n --sidebar-transition-animation: ease-in-out;\n\n --header-height: 1.5rem;\n --right-sidebar-width: 320px;\n\n --dialog-border-color: rgba(100, 100, 100, 1);\n --dialog-shadow-color: rgba(0, 0, 0, 0.3);\n --dialog-background-color: rgba(255, 255, 255, 1);\n --dialog-primary-color: rgba(19, 70, 209, 1);\n --dialog-active-color: rgba(40, 70, 209, 1);\n --dialog-input-border-color: rgba(200, 200, 200, 1);\n --dialog-submit-button-color: rgba(180, 190, 230, 1);\n --dialog-cancel-button-color: rgba(235, 80, 80, 1);\n\n --body-video-seeker-height: 3rem;\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: "Poppins", sans-serif;\n}\nhtml {\n font-size: 16px;\n}\nbody {\n height: 100%;\n width: 100%;\n color: var(--text-color);\n /* background: linear-gradient(45deg, var(--company-color1) 0, 5%, var(--company-color2) 5% 10%, var(--company-color3) 10% 80%, var(--company-color1) 80% 85%, var(--company-color2) 85% 100%); */\n background: linear-gradient(45deg, var(--company-color1) 0, 1%, var(--company-color2) 1% 5%, var(--company-color3) 5% 80%, var(--company-color1) 80% 85%, var(--company-color2) 85% 100%);\n}\n#app {\n height: 100%;\n width: 100%;\n}\n\n.body {\n height: 100%;\n width: 100%;\n margin: 1rem;\n font-family: "Yusei Magic", sans-serif;\n display: flex;\n flex-direction: column;\n font-size: 1rem;\n overflow-y: scroll;\n}\n.body-row {\n}\n.split-6-4 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-6-4 > div:nth-child(1) {\n left: 0px;\n width: 60%;\n }\n.split-6-4 > div:nth-child(2) {\n left: 60%;\n width: 40%;\n }\n\n.split-4-6 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.split-4-6 > div:nth-child(1) {\n left: 0px;\n width: 40%;\n }\n\n.split-4-6 > div:nth-child(2) {\n left: 40%;\n width: 60%;\n }\n.split-3-7 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-3-7 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.split-3-7 > div:nth-child(2) {\n left: 30%;\n width: 70%;\n }\n\n.split-3-3-4 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.split-3-3-4 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n\n.split-3-3-4 > div:nth-child(2) {\n left: 30%;\n width: 30%;\n }\n\n.split-3-3-4 > div:nth-child(3) {\n left: 60%;\n width: 40%;\n }\n.split-3-1-2-4 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-3-1-2-4 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.split-3-1-2-4 > div:nth-child(2) {\n left: 30%;\n width: 10%;\n }\n.split-3-1-2-4 > div:nth-child(3) {\n left: 40%;\n width: 20%;\n }\n.split-3-1-2-4 > div:nth-child(4) {\n left: 60%;\n width: 40%;\n }\n.split-3-2-2-2-1{\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.split-3-2-2-2-1 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.split-3-2-2-2-1 > div:nth-child(2) {\n left: 30%;\n width: 20%;\n }\n.split-3-2-2-2-1 > div:nth-child(3) {\n left: 50%;\n width: 20%;\n }\n.split-3-2-2-2-1 > div:nth-child(4) {\n left: 70%;\n width: 20%;\n }\n.split-3-2-2-2-1 > div:nth-child(5) {\n left: 90%;\n width: 10%;\n }\n.split-3-1-1-1-4{\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n\n}\n.split-3-1-1-1-4 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.split-3-1-1-1-4 > div:nth-child(2) {\n left: 30%;\n width: 10%;\n }\n.split-3-1-1-1-4 > div:nth-child(3) {\n left: 40%;\n width: 10%;\n }\n.split-3-1-1-1-4 > div:nth-child(4) {\n left: 50%;\n width: 10%;\n }\n.split-3-1-1-1-4 > div:nth-child(5) {\n left: 60%;\n width: 40%;\n }\n.underline {\n border-bottom: 3px solid #333;\n}\n.left-padding-1 {\n padding-left: 1rem;\n}\n.left-padding-2 {\n padding-left: 2rem;\n}\n.left-margin-1 {\n margin-left: 1rem;\n}\n.left-margin-2 {\n margin-left: 2rem;\n}\n.highlight {\n background-color: rgba(200, 200, 255, 0.3);\n}\n.guided{\n /* background-color: rgba(9, 133, 67, 0.3); */\n background-color: rgba(159, 165, 162, 0.1);\n /* border-bottom: 1px solid rgba(9, 133, 67, 0.3); */\n}\n\n.divider {\n height:4px;\n /* background-color: rgba(16, 210, 113, 0.1); */\n background-color: rgba(31, 42, 36, 0.1);\n}\n\n.body-top-title {\n font-size: 3rem;\n}\n.body-top-title-belongings{\n display: flex;\n align-items: flex-end;\n justify-content: flex-start;\n}\n.body-top-title-belongings > div {\n margin-left:10px;\n margin-right:10px;\n }\n.body-top-title-belongings>.belonging-item>.link{\n text-decoration: none;\n }\n.body-top-title-belongings>.belonging-item>.link>span{\n font-size: small;\n }\n\n\n.body-section-title {\n font-size: 1.5rem;\n color: rgb(51, 49, 49);\n}\n.body-sub-section-title {\n font-size: 1.1rem;\n font-weight: 700;\n color: rgb(3, 53, 12);\n}\n\n.body-item-title {\n color: rgb(51, 99, 49);\n}\n.body-item-text {\n color: rgb(30, 30, 30);\n}\n.body-item-text .body-item-text-item{\n padding-left: 1rem;\n }\n.body-item-text-small {\n color: rgb(30, 30, 30);\n font-size: 0.7rem;\n}\n.body-item-input {\n width:90%;\n}\n\n.body-button-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n\n.body-button-container > div {\n margin-left:5px;\n margin-right:5px;\n padding-left:20px;\n padding-right:20px;\n \n }\n\n.body-button-container .body-button {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n cursor:pointer;\n vertical-align:middle;\n }\n\n.body-button-container .body-button:hover{\n border: solid 1px #000;\n }\n\n.body-button-container .body-button-disabled {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n vertical-align:middle;\n background:#ddd;\n }\n\n.body-button-container .body-button-active {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #333;\n border-radius: 2px;\n background:#ada;\n }\n\n.body-button-container .body-button-stanby {\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: solid 1px #999;\n border-radius: 2px;\n background:#aba;\n cursor:pointer;\n }\n\n.body-button-container .body-button-stanby:hover{\n border: solid 1px #000;\n }\n.body-select-container .body-select {\n color: rgb(30, 30, 30);\n }\n',""]);const a=s},645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,r,o){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var c=0;c<e.length;c++){var d=[].concat(e[c]);i&&s[d[0]]||(void 0!==o&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=o),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),r&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=r):d[4]="".concat(r)),t.push(d))}},t}},81:e=>{"use strict";e.exports=function(e){return e[1]}},448:(e,t,n)=>{"use strict";var i=n(294),r=n(840);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,a={};function l(e,t){c(e,t),c(e+"Capture",t)}function c(e,t){for(a[e]=t,e=0;e<t.length;e++)s.add(t[e])}var d=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},f={};function m(e,t,n,i,r,o,s){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var g={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){g[e]=new m(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];g[t]=new m(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){g[e]=new m(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){g[e]=new m(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){g[e]=new m(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){g[e]=new m(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){g[e]=new m(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){g[e]=new m(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){g[e]=new m(e,5,!1,e.toLowerCase(),null,!1,!1)}));var v=/[\-:]([a-z])/g;function b(e){return e[1].toUpperCase()}function y(e,t,n,i){var r=g.hasOwnProperty(t)?g[t]:null;(null!==r?0!==r.type:i||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,i){if(null==t||function(e,t,n,i){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!i&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,i))return!0;if(i)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,r,i)&&(n=null),i||null===r?function(e){return!!u.call(f,e)||!u.call(p,e)&&(h.test(e)?f[e]=!0:(p[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):r.mustUseProperty?e[r.propertyName]=null===n?3!==r.type&&"":n:(t=r.attributeName,i=r.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(r=r.type)||4===r&&!0===n?"":""+n,i?e.setAttributeNS(i,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(v,b);g[t]=new m(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(v,b);g[t]=new m(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(v,b);g[t]=new m(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){g[e]=new m(e,1,!1,e.toLowerCase(),null,!1,!1)})),g.xlinkHref=new m("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){g[e]=new m(e,1,!1,e.toLowerCase(),null,!0,!0)}));var S=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for("react.element"),C=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),T=Symbol.for("react.provider"),x=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),O=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var R=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var N=Symbol.iterator;function D(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=N&&e[N]||e["@@iterator"])?e:null}var F,L=Object.assign;function B(e){if(void 0===F)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);F=t&&t[1]||""}return"\n"+F+e}var U=!1;function V(e,t){if(!e||U)return"";U=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var i=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){i=e}e.call(t.prototype)}else{try{throw Error()}catch(e){i=e}e()}}catch(t){if(t&&i&&"string"==typeof t.stack){for(var r=t.stack.split("\n"),o=i.stack.split("\n"),s=r.length-1,a=o.length-1;1<=s&&0<=a&&r[s]!==o[a];)a--;for(;1<=s&&0<=a;s--,a--)if(r[s]!==o[a]){if(1!==s||1!==a)do{if(s--,0>--a||r[s]!==o[a]){var l="\n"+r[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}}while(1<=s&&0<=a);break}}}finally{U=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?B(e):""}function j(e){switch(e.tag){case 5:return B(e.type);case 16:return B("Lazy");case 13:return B("Suspense");case 19:return B("SuspenseList");case 0:case 2:case 15:return V(e.type,!1);case 11:return V(e.type.render,!1);case 1:return V(e.type,!0);default:return""}}function z(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case k:return"Fragment";case C:return"Portal";case _:return"Profiler";case E:return"StrictMode";case M:return"Suspense";case A:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case x:return(e.displayName||"Context")+".Consumer";case T:return(e._context.displayName||"Context")+".Provider";case I:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case P:return null!==(t=e.displayName||null)?t:z(e.type)||"Memo";case O:t=e._payload,e=e._init;try{return z(e(t))}catch(e){}}return null}function $(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return z(t);case 8:return t===E?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function W(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function H(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function q(e){e._valueTracker||(e._valueTracker=function(e){var t=H(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),i=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var r=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(e){i=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return i},setValue:function(e){i=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function K(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=H(e)?e.checked?"true":"false":e.value),(e=i)!==n&&(t.setValue(e),!0)}function G(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function J(e,t){var n=t.checked;return L({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function Q(e,t){var n=null==t.defaultValue?"":t.defaultValue,i=null!=t.checked?t.checked:t.defaultChecked;n=W(null!=t.value?t.value:n),e._wrapperState={initialChecked:i,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Y(e,t){null!=(t=t.checked)&&y(e,"checked",t,!1)}function Z(e,t){Y(e,t);var n=W(t.value),i=t.type;if(null!=n)"number"===i?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===i||"reset"===i)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,n):t.hasOwnProperty("defaultValue")&&ee(e,t.type,W(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function X(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var i=t.type;if(!("submit"!==i&&"reset"!==i||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ee(e,t,n){"number"===t&&G(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var te=Array.isArray;function ne(e,t,n,i){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&i&&(e[n].defaultSelected=!0)}else{for(n=""+W(n),t=null,r=0;r<e.length;r++){if(e[r].value===n)return e[r].selected=!0,void(i&&(e[r].defaultSelected=!0));null!==t||e[r].disabled||(t=e[r])}null!==t&&(t.selected=!0)}}function ie(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(o(91));return L({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function re(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(o(92));if(te(n)){if(1<n.length)throw Error(o(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:W(n)}}function oe(e,t){var n=W(t.value),i=W(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=i&&(e.defaultValue=""+i)}function se(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function ae(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function le(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?ae(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var ce,de,ue=(de=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((ce=ce||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ce.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,i){MSApp.execUnsafeLocalFunction((function(){return de(e,t)}))}:de);function he(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var pe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fe=["Webkit","ms","Moz","O"];function me(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||pe.hasOwnProperty(e)&&pe[e]?(""+t).trim():t+"px"}function ge(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var i=0===n.indexOf("--"),r=me(n,t[n],i);"float"===n&&(n="cssFloat"),i?e.setProperty(n,r):e[n]=r}}Object.keys(pe).forEach((function(e){fe.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),pe[t]=pe[e]}))}));var ve=L({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function be(e,t){if(t){if(ve[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(o(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(o(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(o(62))}}function ye(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Se=null;function we(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Ce=null,ke=null,Ee=null;function _e(e){if(e=yr(e)){if("function"!=typeof Ce)throw Error(o(280));var t=e.stateNode;t&&(t=wr(t),Ce(e.stateNode,e.type,t))}}function Te(e){ke?Ee?Ee.push(e):Ee=[e]:ke=e}function xe(){if(ke){var e=ke,t=Ee;if(Ee=ke=null,_e(e),t)for(e=0;e<t.length;e++)_e(t[e])}}function Ie(e,t){return e(t)}function Me(){}var Ae=!1;function Pe(e,t,n){if(Ae)return e(t,n);Ae=!0;try{return Ie(e,t,n)}finally{Ae=!1,(null!==ke||null!==Ee)&&(Me(),xe())}}function Oe(e,t){var n=e.stateNode;if(null===n)return null;var i=wr(n);if(null===i)return null;n=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(i=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!i;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(o(231,t,typeof n));return n}var Re=!1;if(d)try{var Ne={};Object.defineProperty(Ne,"passive",{get:function(){Re=!0}}),window.addEventListener("test",Ne,Ne),window.removeEventListener("test",Ne,Ne)}catch(de){Re=!1}function De(e,t,n,i,r,o,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(e){this.onError(e)}}var Fe=!1,Le=null,Be=!1,Ue=null,Ve={onError:function(e){Fe=!0,Le=e}};function je(e,t,n,i,r,o,s,a,l){Fe=!1,Le=null,De.apply(Ve,arguments)}function ze(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function $e(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&null!==(e=e.alternate)&&(t=e.memoizedState),null!==t)return t.dehydrated}return null}function We(e){if(ze(e)!==e)throw Error(o(188))}function He(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=ze(e)))throw Error(o(188));return t!==e?null:e}for(var n=e,i=t;;){var r=n.return;if(null===r)break;var s=r.alternate;if(null===s){if(null!==(i=r.return)){n=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===n)return We(r),e;if(s===i)return We(r),t;s=s.sibling}throw Error(o(188))}if(n.return!==i.return)n=r,i=s;else{for(var a=!1,l=r.child;l;){if(l===n){a=!0,n=r,i=s;break}if(l===i){a=!0,i=r,n=s;break}l=l.sibling}if(!a){for(l=s.child;l;){if(l===n){a=!0,n=s,i=r;break}if(l===i){a=!0,i=s,n=r;break}l=l.sibling}if(!a)throw Error(o(189))}}if(n.alternate!==i)throw Error(o(190))}if(3!==n.tag)throw Error(o(188));return n.stateNode.current===n?e:t}(e))?qe(e):null}function qe(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=qe(e);if(null!==t)return t;e=e.sibling}return null}var Ke=r.unstable_scheduleCallback,Ge=r.unstable_cancelCallback,Je=r.unstable_shouldYield,Qe=r.unstable_requestPaint,Ye=r.unstable_now,Ze=r.unstable_getCurrentPriorityLevel,Xe=r.unstable_ImmediatePriority,et=r.unstable_UserBlockingPriority,tt=r.unstable_NormalPriority,nt=r.unstable_LowPriority,it=r.unstable_IdlePriority,rt=null,ot=null,st=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(at(e)/lt|0)|0},at=Math.log,lt=Math.LN2,ct=64,dt=4194304;function ut(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ht(e,t){var n=e.pendingLanes;if(0===n)return 0;var i=0,r=e.suspendedLanes,o=e.pingedLanes,s=268435455&n;if(0!==s){var a=s&~r;0!==a?i=ut(a):0!=(o&=s)&&(i=ut(o))}else 0!=(s=n&~r)?i=ut(s):0!==o&&(i=ut(o));if(0===i)return 0;if(0!==t&&t!==i&&0==(t&r)&&((r=i&-i)>=(o=t&-t)||16===r&&0!=(4194240&o)))return t;if(0!=(4&i)&&(i|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=i;0<t;)r=1<<(n=31-st(t)),i|=e[n],t&=~r;return i}function pt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function ft(e){return 0!=(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function mt(){var e=ct;return 0==(4194240&(ct<<=1))&&(ct=64),e}function gt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function vt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-st(t)]=n}function bt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-st(n),r=1<<i;r&t|e[i]&t&&(e[i]|=t),n&=~r}}var yt=0;function St(e){return 1<(e&=-e)?4<e?0!=(268435455&e)?16:536870912:4:1}var wt,Ct,kt,Et,_t,Tt=!1,xt=[],It=null,Mt=null,At=null,Pt=new Map,Ot=new Map,Rt=[],Nt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Dt(e,t){switch(e){case"focusin":case"focusout":It=null;break;case"dragenter":case"dragleave":Mt=null;break;case"mouseover":case"mouseout":At=null;break;case"pointerover":case"pointerout":Pt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ot.delete(t.pointerId)}}function Ft(e,t,n,i,r,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:o,targetContainers:[r]},null!==t&&null!==(t=yr(t))&&Ct(t),e):(e.eventSystemFlags|=i,t=e.targetContainers,null!==r&&-1===t.indexOf(r)&&t.push(r),e)}function Lt(e){var t=br(e.target);if(null!==t){var n=ze(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=$e(n)))return e.blockedOn=t,void _t(e.priority,(function(){kt(n)}))}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Bt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=yr(n))&&Ct(t),e.blockedOn=n,!1;var i=new(n=e.nativeEvent).constructor(n.type,n);Se=i,n.target.dispatchEvent(i),Se=null,t.shift()}return!0}function Ut(e,t,n){Bt(e)&&n.delete(t)}function Vt(){Tt=!1,null!==It&&Bt(It)&&(It=null),null!==Mt&&Bt(Mt)&&(Mt=null),null!==At&&Bt(At)&&(At=null),Pt.forEach(Ut),Ot.forEach(Ut)}function jt(e,t){e.blockedOn===t&&(e.blockedOn=null,Tt||(Tt=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,Vt)))}function zt(e){function t(t){return jt(t,e)}if(0<xt.length){jt(xt[0],e);for(var n=1;n<xt.length;n++){var i=xt[n];i.blockedOn===e&&(i.blockedOn=null)}}for(null!==It&&jt(It,e),null!==Mt&&jt(Mt,e),null!==At&&jt(At,e),Pt.forEach(t),Ot.forEach(t),n=0;n<Rt.length;n++)(i=Rt[n]).blockedOn===e&&(i.blockedOn=null);for(;0<Rt.length&&null===(n=Rt[0]).blockedOn;)Lt(n),null===n.blockedOn&&Rt.shift()}var $t=S.ReactCurrentBatchConfig,Wt=!0;function Ht(e,t,n,i){var r=yt,o=$t.transition;$t.transition=null;try{yt=1,Kt(e,t,n,i)}finally{yt=r,$t.transition=o}}function qt(e,t,n,i){var r=yt,o=$t.transition;$t.transition=null;try{yt=4,Kt(e,t,n,i)}finally{yt=r,$t.transition=o}}function Kt(e,t,n,i){if(Wt){var r=Jt(e,t,n,i);if(null===r)Wi(e,t,i,Gt,n),Dt(e,i);else if(function(e,t,n,i,r){switch(t){case"focusin":return It=Ft(It,e,t,n,i,r),!0;case"dragenter":return Mt=Ft(Mt,e,t,n,i,r),!0;case"mouseover":return At=Ft(At,e,t,n,i,r),!0;case"pointerover":var o=r.pointerId;return Pt.set(o,Ft(Pt.get(o)||null,e,t,n,i,r)),!0;case"gotpointercapture":return o=r.pointerId,Ot.set(o,Ft(Ot.get(o)||null,e,t,n,i,r)),!0}return!1}(r,e,t,n,i))i.stopPropagation();else if(Dt(e,i),4&t&&-1<Nt.indexOf(e)){for(;null!==r;){var o=yr(r);if(null!==o&&wt(o),null===(o=Jt(e,t,n,i))&&Wi(e,t,i,Gt,n),o===r)break;r=o}null!==r&&i.stopPropagation()}else Wi(e,t,i,null,n)}}var Gt=null;function Jt(e,t,n,i){if(Gt=null,null!==(e=br(e=we(i))))if(null===(t=ze(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=$e(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Gt=e,null}function Qt(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Ze()){case Xe:return 1;case et:return 4;case tt:case nt:return 16;case it:return 536870912;default:return 16}default:return 16}}var Yt=null,Zt=null,Xt=null;function en(){if(Xt)return Xt;var e,t,n=Zt,i=n.length,r="value"in Yt?Yt.value:Yt.textContent,o=r.length;for(e=0;e<i&&n[e]===r[e];e++);var s=i-e;for(t=1;t<=s&&n[i-t]===r[o-t];t++);return Xt=r.slice(e,1<t?1-t:void 0)}function tn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function nn(){return!0}function rn(){return!1}function on(e){function t(t,n,i,r,o){for(var s in this._reactName=t,this._targetInst=i,this.type=n,this.nativeEvent=r,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(s)&&(t=e[s],this[s]=t?t(r):r[s]);return this.isDefaultPrevented=(null!=r.defaultPrevented?r.defaultPrevented:!1===r.returnValue)?nn:rn,this.isPropagationStopped=rn,this}return L(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=nn)},persist:function(){},isPersistent:nn}),t}var sn,an,ln,cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dn=on(cn),un=L({},cn,{view:0,detail:0}),hn=on(un),pn=L({},un,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_n,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ln&&(ln&&"mousemove"===e.type?(sn=e.screenX-ln.screenX,an=e.screenY-ln.screenY):an=sn=0,ln=e),sn)},movementY:function(e){return"movementY"in e?e.movementY:an}}),fn=on(pn),mn=on(L({},pn,{dataTransfer:0})),gn=on(L({},un,{relatedTarget:0})),vn=on(L({},cn,{animationName:0,elapsedTime:0,pseudoElement:0})),bn=L({},cn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yn=on(bn),Sn=on(L({},cn,{data:0})),wn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Cn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},kn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function En(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=kn[e])&&!!t[e]}function _n(){return En}var Tn=L({},un,{key:function(e){if(e.key){var t=wn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Cn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_n,charCode:function(e){return"keypress"===e.type?tn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),xn=on(Tn),In=on(L({},pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Mn=on(L({},un,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_n})),An=on(L({},cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Pn=L({},pn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),On=on(Pn),Rn=[9,13,27,32],Nn=d&&"CompositionEvent"in window,Dn=null;d&&"documentMode"in document&&(Dn=document.documentMode);var Fn=d&&"TextEvent"in window&&!Dn,Ln=d&&(!Nn||Dn&&8<Dn&&11>=Dn),Bn=String.fromCharCode(32),Un=!1;function Vn(e,t){switch(e){case"keyup":return-1!==Rn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var zn=!1,$n={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Wn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!$n[e.type]:"textarea"===t}function Hn(e,t,n,i){Te(i),0<(t=qi(t,"onChange")).length&&(n=new dn("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var qn=null,Kn=null;function Gn(e){Bi(e,0)}function Jn(e){if(K(Sr(e)))return e}function Qn(e,t){if("change"===e)return t}var Yn=!1;if(d){var Zn;if(d){var Xn="oninput"in document;if(!Xn){var ei=document.createElement("div");ei.setAttribute("oninput","return;"),Xn="function"==typeof ei.oninput}Zn=Xn}else Zn=!1;Yn=Zn&&(!document.documentMode||9<document.documentMode)}function ti(){qn&&(qn.detachEvent("onpropertychange",ni),Kn=qn=null)}function ni(e){if("value"===e.propertyName&&Jn(Kn)){var t=[];Hn(t,Kn,e,we(e)),Pe(Gn,t)}}function ii(e,t,n){"focusin"===e?(ti(),Kn=n,(qn=t).attachEvent("onpropertychange",ni)):"focusout"===e&&ti()}function ri(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Jn(Kn)}function oi(e,t){if("click"===e)return Jn(t)}function si(e,t){if("input"===e||"change"===e)return Jn(t)}var ai="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function li(e,t){if(ai(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var r=n[i];if(!u.call(t,r)||!ai(e[r],t[r]))return!1}return!0}function ci(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function di(e,t){var n,i=ci(e);for(e=0;i;){if(3===i.nodeType){if(n=e+i.textContent.length,e<=t&&n>=t)return{node:i,offset:t-e};e=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=ci(i)}}function ui(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ui(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function hi(){for(var e=window,t=G();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=G((e=t.contentWindow).document)}return t}function pi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function fi(e){var t=hi(),n=e.focusedElem,i=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ui(n.ownerDocument.documentElement,n)){if(null!==i&&pi(n))if(t=i.start,void 0===(e=i.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var r=n.textContent.length,o=Math.min(i.start,r);i=void 0===i.end?o:Math.min(i.end,r),!e.extend&&o>i&&(r=i,i=o,o=r),r=di(n,o);var s=di(n,i);r&&s&&(1!==e.rangeCount||e.anchorNode!==r.node||e.anchorOffset!==r.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&((t=t.createRange()).setStart(r.node,r.offset),e.removeAllRanges(),o>i?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var mi=d&&"documentMode"in document&&11>=document.documentMode,gi=null,vi=null,bi=null,yi=!1;function Si(e,t,n){var i=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;yi||null==gi||gi!==G(i)||(i="selectionStart"in(i=gi)&&pi(i)?{start:i.selectionStart,end:i.selectionEnd}:{anchorNode:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset},bi&&li(bi,i)||(bi=i,0<(i=qi(vi,"onSelect")).length&&(t=new dn("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=gi)))}function wi(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ci={animationend:wi("Animation","AnimationEnd"),animationiteration:wi("Animation","AnimationIteration"),animationstart:wi("Animation","AnimationStart"),transitionend:wi("Transition","TransitionEnd")},ki={},Ei={};function _i(e){if(ki[e])return ki[e];if(!Ci[e])return e;var t,n=Ci[e];for(t in n)if(n.hasOwnProperty(t)&&t in Ei)return ki[e]=n[t];return e}d&&(Ei=document.createElement("div").style,"AnimationEvent"in window||(delete Ci.animationend.animation,delete Ci.animationiteration.animation,delete Ci.animationstart.animation),"TransitionEvent"in window||delete Ci.transitionend.transition);var Ti=_i("animationend"),xi=_i("animationiteration"),Ii=_i("animationstart"),Mi=_i("transitionend"),Ai=new Map,Pi="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Oi(e,t){Ai.set(e,t),l(t,[e])}for(var Ri=0;Ri<Pi.length;Ri++){var Ni=Pi[Ri];Oi(Ni.toLowerCase(),"on"+(Ni[0].toUpperCase()+Ni.slice(1)))}Oi(Ti,"onAnimationEnd"),Oi(xi,"onAnimationIteration"),Oi(Ii,"onAnimationStart"),Oi("dblclick","onDoubleClick"),Oi("focusin","onFocus"),Oi("focusout","onBlur"),Oi(Mi,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Di="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Fi=new Set("cancel close invalid load scroll toggle".split(" ").concat(Di));function Li(e,t,n){var i=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,i,r,s,a,l,c){if(je.apply(this,arguments),Fe){if(!Fe)throw Error(o(198));var d=Le;Fe=!1,Le=null,Be||(Be=!0,Ue=d)}}(i,t,void 0,e),e.currentTarget=null}function Bi(e,t){t=0!=(4&t);for(var n=0;n<e.length;n++){var i=e[n],r=i.event;i=i.listeners;e:{var o=void 0;if(t)for(var s=i.length-1;0<=s;s--){var a=i[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==o&&r.isPropagationStopped())break e;Li(r,a,c),o=l}else for(s=0;s<i.length;s++){if(l=(a=i[s]).instance,c=a.currentTarget,a=a.listener,l!==o&&r.isPropagationStopped())break e;Li(r,a,c),o=l}}}if(Be)throw e=Ue,Be=!1,Ue=null,e}function Ui(e,t){var n=t[mr];void 0===n&&(n=t[mr]=new Set);var i=e+"__bubble";n.has(i)||($i(t,e,2,!1),n.add(i))}function Vi(e,t,n){var i=0;t&&(i|=4),$i(n,e,i,t)}var ji="_reactListening"+Math.random().toString(36).slice(2);function zi(e){if(!e[ji]){e[ji]=!0,s.forEach((function(t){"selectionchange"!==t&&(Fi.has(t)||Vi(t,!1,e),Vi(t,!0,e))}));var t=9===e.nodeType?e:e.ownerDocument;null===t||t[ji]||(t[ji]=!0,Vi("selectionchange",!1,t))}}function $i(e,t,n,i){switch(Qt(t)){case 1:var r=Ht;break;case 4:r=qt;break;default:r=Kt}n=r.bind(null,t,n,e),r=void 0,!Re||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(r=!0),i?void 0!==r?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):void 0!==r?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function Wi(e,t,n,i,r){var o=i;if(0==(1&t)&&0==(2&t)&&null!==i)e:for(;;){if(null===i)return;var s=i.tag;if(3===s||4===s){var a=i.stateNode.containerInfo;if(a===r||8===a.nodeType&&a.parentNode===r)break;if(4===s)for(s=i.return;null!==s;){var l=s.tag;if((3===l||4===l)&&((l=s.stateNode.containerInfo)===r||8===l.nodeType&&l.parentNode===r))return;s=s.return}for(;null!==a;){if(null===(s=br(a)))return;if(5===(l=s.tag)||6===l){i=o=s;continue e}a=a.parentNode}}i=i.return}Pe((function(){var i=o,r=we(n),s=[];e:{var a=Ai.get(e);if(void 0!==a){var l=dn,c=e;switch(e){case"keypress":if(0===tn(n))break e;case"keydown":case"keyup":l=xn;break;case"focusin":c="focus",l=gn;break;case"focusout":c="blur",l=gn;break;case"beforeblur":case"afterblur":l=gn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":l=fn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":l=mn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":l=Mn;break;case Ti:case xi:case Ii:l=vn;break;case Mi:l=An;break;case"scroll":l=hn;break;case"wheel":l=On;break;case"copy":case"cut":case"paste":l=yn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":l=In}var d=0!=(4&t),u=!d&&"scroll"===e,h=d?null!==a?a+"Capture":null:a;d=[];for(var p,f=i;null!==f;){var m=(p=f).stateNode;if(5===p.tag&&null!==m&&(p=m,null!==h&&null!=(m=Oe(f,h))&&d.push(Hi(f,m,p))),u)break;f=f.return}0<d.length&&(a=new l(a,c,null,n,r),s.push({event:a,listeners:d}))}}if(0==(7&t)){if(l="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||n===Se||!(c=n.relatedTarget||n.fromElement)||!br(c)&&!c[fr])&&(l||a)&&(a=r.window===r?r:(a=r.ownerDocument)?a.defaultView||a.parentWindow:window,l?(l=i,null!==(c=(c=n.relatedTarget||n.toElement)?br(c):null)&&(c!==(u=ze(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(l=null,c=i),l!==c)){if(d=fn,m="onMouseLeave",h="onMouseEnter",f="mouse","pointerout"!==e&&"pointerover"!==e||(d=In,m="onPointerLeave",h="onPointerEnter",f="pointer"),u=null==l?a:Sr(l),p=null==c?a:Sr(c),(a=new d(m,f+"leave",l,n,r)).target=u,a.relatedTarget=p,m=null,br(r)===i&&((d=new d(h,f+"enter",c,n,r)).target=p,d.relatedTarget=u,m=d),u=m,l&&c)e:{for(h=c,f=0,p=d=l;p;p=Ki(p))f++;for(p=0,m=h;m;m=Ki(m))p++;for(;0<f-p;)d=Ki(d),f--;for(;0<p-f;)h=Ki(h),p--;for(;f--;){if(d===h||null!==h&&d===h.alternate)break e;d=Ki(d),h=Ki(h)}d=null}else d=null;null!==l&&Gi(s,a,l,d,!1),null!==c&&null!==u&&Gi(s,u,c,d,!0)}if("select"===(l=(a=i?Sr(i):window).nodeName&&a.nodeName.toLowerCase())||"input"===l&&"file"===a.type)var g=Qn;else if(Wn(a))if(Yn)g=si;else{g=ri;var v=ii}else(l=a.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(g=oi);switch(g&&(g=g(e,i))?Hn(s,g,n,r):(v&&v(e,a,i),"focusout"===e&&(v=a._wrapperState)&&v.controlled&&"number"===a.type&&ee(a,"number",a.value)),v=i?Sr(i):window,e){case"focusin":(Wn(v)||"true"===v.contentEditable)&&(gi=v,vi=i,bi=null);break;case"focusout":bi=vi=gi=null;break;case"mousedown":yi=!0;break;case"contextmenu":case"mouseup":case"dragend":yi=!1,Si(s,n,r);break;case"selectionchange":if(mi)break;case"keydown":case"keyup":Si(s,n,r)}var b;if(Nn)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else zn?Vn(e,n)&&(y="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(y="onCompositionStart");y&&(Ln&&"ko"!==n.locale&&(zn||"onCompositionStart"!==y?"onCompositionEnd"===y&&zn&&(b=en()):(Zt="value"in(Yt=r)?Yt.value:Yt.textContent,zn=!0)),0<(v=qi(i,y)).length&&(y=new Sn(y,e,null,n,r),s.push({event:y,listeners:v}),(b||null!==(b=jn(n)))&&(y.data=b))),(b=Fn?function(e,t){switch(e){case"compositionend":return jn(t);case"keypress":return 32!==t.which?null:(Un=!0,Bn);case"textInput":return(e=t.data)===Bn&&Un?null:e;default:return null}}(e,n):function(e,t){if(zn)return"compositionend"===e||!Nn&&Vn(e,t)?(e=en(),Xt=Zt=Yt=null,zn=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ln&&"ko"!==t.locale?null:t.data}}(e,n))&&0<(i=qi(i,"onBeforeInput")).length&&(r=new Sn("onBeforeInput","beforeinput",null,n,r),s.push({event:r,listeners:i}),r.data=b)}Bi(s,t)}))}function Hi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qi(e,t){for(var n=t+"Capture",i=[];null!==e;){var r=e,o=r.stateNode;5===r.tag&&null!==o&&(r=o,null!=(o=Oe(e,n))&&i.unshift(Hi(e,o,r)),null!=(o=Oe(e,t))&&i.push(Hi(e,o,r))),e=e.return}return i}function Ki(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Gi(e,t,n,i,r){for(var o=t._reactName,s=[];null!==n&&n!==i;){var a=n,l=a.alternate,c=a.stateNode;if(null!==l&&l===i)break;5===a.tag&&null!==c&&(a=c,r?null!=(l=Oe(n,o))&&s.unshift(Hi(n,l,a)):r||null!=(l=Oe(n,o))&&s.push(Hi(n,l,a))),n=n.return}0!==s.length&&e.push({event:t,listeners:s})}var Ji=/\r\n?/g,Qi=/\u0000|\uFFFD/g;function Yi(e){return("string"==typeof e?e:""+e).replace(Ji,"\n").replace(Qi,"")}function Zi(e,t,n){if(t=Yi(t),Yi(e)!==t&&n)throw Error(o(425))}function Xi(){}var er=null,tr=null;function nr(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ir="function"==typeof setTimeout?setTimeout:void 0,rr="function"==typeof clearTimeout?clearTimeout:void 0,or="function"==typeof Promise?Promise:void 0,sr="function"==typeof queueMicrotask?queueMicrotask:void 0!==or?function(e){return or.resolve(null).then(e).catch(ar)}:ir;function ar(e){setTimeout((function(){throw e}))}function lr(e,t){var n=t,i=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&8===r.nodeType)if("/$"===(n=r.data)){if(0===i)return e.removeChild(r),void zt(t);i--}else"$"!==n&&"$?"!==n&&"$!"!==n||i++;n=r}while(n);zt(t)}function cr(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function dr(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var ur=Math.random().toString(36).slice(2),hr="__reactFiber$"+ur,pr="__reactProps$"+ur,fr="__reactContainer$"+ur,mr="__reactEvents$"+ur,gr="__reactListeners$"+ur,vr="__reactHandles$"+ur;function br(e){var t=e[hr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[fr]||n[hr]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=dr(e);null!==e;){if(n=e[hr])return n;e=dr(e)}return t}n=(e=n).parentNode}return null}function yr(e){return!(e=e[hr]||e[fr])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function Sr(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(o(33))}function wr(e){return e[pr]||null}var Cr=[],kr=-1;function Er(e){return{current:e}}function _r(e){0>kr||(e.current=Cr[kr],Cr[kr]=null,kr--)}function Tr(e,t){kr++,Cr[kr]=e.current,e.current=t}var xr={},Ir=Er(xr),Mr=Er(!1),Ar=xr;function Pr(e,t){var n=e.type.contextTypes;if(!n)return xr;var i=e.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===t)return i.__reactInternalMemoizedMaskedChildContext;var r,o={};for(r in n)o[r]=t[r];return i&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Or(e){return null!=e.childContextTypes}function Rr(){_r(Mr),_r(Ir)}function Nr(e,t,n){if(Ir.current!==xr)throw Error(o(168));Tr(Ir,t),Tr(Mr,n)}function Dr(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,"function"!=typeof i.getChildContext)return n;for(var r in i=i.getChildContext())if(!(r in t))throw Error(o(108,$(e)||"Unknown",r));return L({},n,i)}function Fr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||xr,Ar=Ir.current,Tr(Ir,e),Tr(Mr,Mr.current),!0}function Lr(e,t,n){var i=e.stateNode;if(!i)throw Error(o(169));n?(e=Dr(e,t,Ar),i.__reactInternalMemoizedMergedChildContext=e,_r(Mr),_r(Ir),Tr(Ir,e)):_r(Mr),Tr(Mr,n)}var Br=null,Ur=!1,Vr=!1;function jr(e){null===Br?Br=[e]:Br.push(e)}function zr(){if(!Vr&&null!==Br){Vr=!0;var e=0,t=yt;try{var n=Br;for(yt=1;e<n.length;e++){var i=n[e];do{i=i(!0)}while(null!==i)}Br=null,Ur=!1}catch(t){throw null!==Br&&(Br=Br.slice(e+1)),Ke(Xe,zr),t}finally{yt=t,Vr=!1}}return null}var $r=[],Wr=0,Hr=null,qr=0,Kr=[],Gr=0,Jr=null,Qr=1,Yr="";function Zr(e,t){$r[Wr++]=qr,$r[Wr++]=Hr,Hr=e,qr=t}function Xr(e,t,n){Kr[Gr++]=Qr,Kr[Gr++]=Yr,Kr[Gr++]=Jr,Jr=e;var i=Qr;e=Yr;var r=32-st(i)-1;i&=~(1<<r),n+=1;var o=32-st(t)+r;if(30<o){var s=r-r%5;o=(i&(1<<s)-1).toString(32),i>>=s,r-=s,Qr=1<<32-st(t)+r|n<<r|i,Yr=o+e}else Qr=1<<o|n<<r|i,Yr=e}function eo(e){null!==e.return&&(Zr(e,1),Xr(e,1,0))}function to(e){for(;e===Hr;)Hr=$r[--Wr],$r[Wr]=null,qr=$r[--Wr],$r[Wr]=null;for(;e===Jr;)Jr=Kr[--Gr],Kr[Gr]=null,Yr=Kr[--Gr],Kr[Gr]=null,Qr=Kr[--Gr],Kr[Gr]=null}var no=null,io=null,ro=!1,oo=null;function so(e,t){var n=Pc(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function ao(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,no=e,io=cr(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,no=e,io=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==Jr?{id:Qr,overflow:Yr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=Pc(18,null,null,0)).stateNode=t,n.return=e,e.child=n,no=e,io=null,!0);default:return!1}}function lo(e){return 0!=(1&e.mode)&&0==(128&e.flags)}function co(e){if(ro){var t=io;if(t){var n=t;if(!ao(e,t)){if(lo(e))throw Error(o(418));t=cr(n.nextSibling);var i=no;t&&ao(e,t)?so(i,n):(e.flags=-4097&e.flags|2,ro=!1,no=e)}}else{if(lo(e))throw Error(o(418));e.flags=-4097&e.flags|2,ro=!1,no=e}}}function uo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;no=e}function ho(e){if(e!==no)return!1;if(!ro)return uo(e),ro=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!nr(e.type,e.memoizedProps)),t&&(t=io)){if(lo(e))throw po(),Error(o(418));for(;t;)so(e,t),t=cr(t.nextSibling)}if(uo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(o(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){io=cr(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}io=null}}else io=no?cr(e.stateNode.nextSibling):null;return!0}function po(){for(var e=io;e;)e=cr(e.nextSibling)}function fo(){io=no=null,ro=!1}function mo(e){null===oo?oo=[e]:oo.push(e)}var go=S.ReactCurrentBatchConfig;function vo(e,t){if(e&&e.defaultProps){for(var n in t=L({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}var bo=Er(null),yo=null,So=null,wo=null;function Co(){wo=So=yo=null}function ko(e){var t=bo.current;_r(bo),e._currentValue=t}function Eo(e,t,n){for(;null!==e;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==i&&(i.childLanes|=t)):null!==i&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===n)break;e=e.return}}function _o(e,t){yo=e,wo=So=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(Sa=!0),e.firstContext=null)}function To(e){var t=e._currentValue;if(wo!==e)if(e={context:e,memoizedValue:t,next:null},null===So){if(null===yo)throw Error(o(308));So=e,yo.dependencies={lanes:0,firstContext:e}}else So=So.next=e;return t}var xo=null;function Io(e){null===xo?xo=[e]:xo.push(e)}function Mo(e,t,n,i){var r=t.interleaved;return null===r?(n.next=n,Io(t)):(n.next=r.next,r.next=n),t.interleaved=n,Ao(e,i)}function Ao(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var Po=!1;function Oo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ro(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function No(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Do(e,t,n){var i=e.updateQueue;if(null===i)return null;if(i=i.shared,0!=(2&Il)){var r=i.pending;return null===r?t.next=t:(t.next=r.next,r.next=t),i.pending=t,Ao(e,n)}return null===(r=i.interleaved)?(t.next=t,Io(i)):(t.next=r.next,r.next=t),i.interleaved=t,Ao(e,n)}function Fo(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,0!=(4194240&n))){var i=t.lanes;n|=i&=e.pendingLanes,t.lanes=n,bt(e,n)}}function Lo(e,t){var n=e.updateQueue,i=e.alternate;if(null!==i&&n===(i=i.updateQueue)){var r=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?r=o=s:o=o.next=s,n=n.next}while(null!==n);null===o?r=o=t:o=o.next=t}else r=o=t;return n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:o,shared:i.shared,effects:i.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Bo(e,t,n,i){var r=e.updateQueue;Po=!1;var o=r.firstBaseUpdate,s=r.lastBaseUpdate,a=r.shared.pending;if(null!==a){r.shared.pending=null;var l=a,c=l.next;l.next=null,null===s?o=c:s.next=c,s=l;var d=e.alternate;null!==d&&(a=(d=d.updateQueue).lastBaseUpdate)!==s&&(null===a?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l)}if(null!==o){var u=r.baseState;for(s=0,d=c=l=null,a=o;;){var h=a.lane,p=a.eventTime;if((i&h)===h){null!==d&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var f=e,m=a;switch(h=t,p=n,m.tag){case 1:if("function"==typeof(f=m.payload)){u=f.call(p,u,h);break e}u=f;break e;case 3:f.flags=-65537&f.flags|128;case 0:if(null==(h="function"==typeof(f=m.payload)?f.call(p,u,h):f))break e;u=L({},u,h);break e;case 2:Po=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(h=r.effects)?r.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===d?(c=d=p,l=u):d=d.next=p,s|=h;if(null===(a=a.next)){if(null===(a=r.shared.pending))break;a=(h=a).next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}if(null===d&&(l=u),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=d,null!==(t=r.shared.interleaved)){r=t;do{s|=r.lane,r=r.next}while(r!==t)}else null===o&&(r.shared.lanes=0);Fl|=s,e.lanes=s,e.memoizedState=u}}function Uo(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var i=e[t],r=i.callback;if(null!==r){if(i.callback=null,i=n,"function"!=typeof r)throw Error(o(191,r));r.call(i)}}}var Vo=(new i.Component).refs;function jo(e,t,n,i){n=null==(n=n(i,t=e.memoizedState))?t:L({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var zo={isMounted:function(e){return!!(e=e._reactInternals)&&ze(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var i=ec(),r=tc(e),o=No(i,r);o.payload=t,null!=n&&(o.callback=n),null!==(t=Do(e,o,r))&&(nc(t,e,r,i),Fo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=ec(),r=tc(e),o=No(i,r);o.tag=1,o.payload=t,null!=n&&(o.callback=n),null!==(t=Do(e,o,r))&&(nc(t,e,r,i),Fo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ec(),i=tc(e),r=No(n,i);r.tag=2,null!=t&&(r.callback=t),null!==(t=Do(e,r,i))&&(nc(t,e,i,n),Fo(t,e,i))}};function $o(e,t,n,i,r,o,s){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(i,o,s):!(t.prototype&&t.prototype.isPureReactComponent&&li(n,i)&&li(r,o))}function Wo(e,t,n){var i=!1,r=xr,o=t.contextType;return"object"==typeof o&&null!==o?o=To(o):(r=Or(t)?Ar:Ir.current,o=(i=null!=(i=t.contextTypes))?Pr(e,r):xr),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=zo,e.stateNode=t,t._reactInternals=e,i&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=o),t}function Ho(e,t,n,i){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,i),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&zo.enqueueReplaceState(t,t.state,null)}function qo(e,t,n,i){var r=e.stateNode;r.props=n,r.state=e.memoizedState,r.refs=Vo,Oo(e);var o=t.contextType;"object"==typeof o&&null!==o?r.context=To(o):(o=Or(t)?Ar:Ir.current,r.context=Pr(e,o)),r.state=e.memoizedState,"function"==typeof(o=t.getDerivedStateFromProps)&&(jo(e,t,o,n),r.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof r.getSnapshotBeforeUpdate||"function"!=typeof r.UNSAFE_componentWillMount&&"function"!=typeof r.componentWillMount||(t=r.state,"function"==typeof r.componentWillMount&&r.componentWillMount(),"function"==typeof r.UNSAFE_componentWillMount&&r.UNSAFE_componentWillMount(),t!==r.state&&zo.enqueueReplaceState(r,r.state,null),Bo(e,n,r,i),r.state=e.memoizedState),"function"==typeof r.componentDidMount&&(e.flags|=4194308)}function Ko(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(o(309));var i=n.stateNode}if(!i)throw Error(o(147,e));var r=i,s=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===s?t.ref:(t=function(e){var t=r.refs;t===Vo&&(t=r.refs={}),null===e?delete t[s]:t[s]=e},t._stringRef=s,t)}if("string"!=typeof e)throw Error(o(284));if(!n._owner)throw Error(o(290,e))}return e}function Go(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Jo(e){return(0,e._init)(e._payload)}function Qo(e){function t(t,n){if(e){var i=t.deletions;null===i?(t.deletions=[n],t.flags|=16):i.push(n)}}function n(n,i){if(!e)return null;for(;null!==i;)t(n,i),i=i.sibling;return null}function i(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function r(e,t){return(e=Rc(e,t)).index=0,e.sibling=null,e}function s(t,n,i){return t.index=i,e?null!==(i=t.alternate)?(i=i.index)<n?(t.flags|=2,n):i:(t.flags|=2,n):(t.flags|=1048576,n)}function a(t){return e&&null===t.alternate&&(t.flags|=2),t}function l(e,t,n,i){return null===t||6!==t.tag?((t=Lc(n,e.mode,i)).return=e,t):((t=r(t,n)).return=e,t)}function c(e,t,n,i){var o=n.type;return o===k?u(e,t,n.props.children,i,n.key):null!==t&&(t.elementType===o||"object"==typeof o&&null!==o&&o.$$typeof===O&&Jo(o)===t.type)?((i=r(t,n.props)).ref=Ko(e,t,n),i.return=e,i):((i=Nc(n.type,n.key,n.props,null,e.mode,i)).ref=Ko(e,t,n),i.return=e,i)}function d(e,t,n,i){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Bc(n,e.mode,i)).return=e,t):((t=r(t,n.children||[])).return=e,t)}function u(e,t,n,i,o){return null===t||7!==t.tag?((t=Dc(n,e.mode,i,o)).return=e,t):((t=r(t,n)).return=e,t)}function h(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=Lc(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case w:return(n=Nc(t.type,t.key,t.props,null,e.mode,n)).ref=Ko(e,null,t),n.return=e,n;case C:return(t=Bc(t,e.mode,n)).return=e,t;case O:return h(e,(0,t._init)(t._payload),n)}if(te(t)||D(t))return(t=Dc(t,e.mode,n,null)).return=e,t;Go(e,t)}return null}function p(e,t,n,i){var r=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==r?null:l(e,t,""+n,i);if("object"==typeof n&&null!==n){switch(n.$$typeof){case w:return n.key===r?c(e,t,n,i):null;case C:return n.key===r?d(e,t,n,i):null;case O:return p(e,t,(r=n._init)(n._payload),i)}if(te(n)||D(n))return null!==r?null:u(e,t,n,i,null);Go(e,n)}return null}function f(e,t,n,i,r){if("string"==typeof i&&""!==i||"number"==typeof i)return l(t,e=e.get(n)||null,""+i,r);if("object"==typeof i&&null!==i){switch(i.$$typeof){case w:return c(t,e=e.get(null===i.key?n:i.key)||null,i,r);case C:return d(t,e=e.get(null===i.key?n:i.key)||null,i,r);case O:return f(e,t,n,(0,i._init)(i._payload),r)}if(te(i)||D(i))return u(t,e=e.get(n)||null,i,r,null);Go(t,i)}return null}function m(r,o,a,l){for(var c=null,d=null,u=o,m=o=0,g=null;null!==u&&m<a.length;m++){u.index>m?(g=u,u=null):g=u.sibling;var v=p(r,u,a[m],l);if(null===v){null===u&&(u=g);break}e&&u&&null===v.alternate&&t(r,u),o=s(v,o,m),null===d?c=v:d.sibling=v,d=v,u=g}if(m===a.length)return n(r,u),ro&&Zr(r,m),c;if(null===u){for(;m<a.length;m++)null!==(u=h(r,a[m],l))&&(o=s(u,o,m),null===d?c=u:d.sibling=u,d=u);return ro&&Zr(r,m),c}for(u=i(r,u);m<a.length;m++)null!==(g=f(u,r,m,a[m],l))&&(e&&null!==g.alternate&&u.delete(null===g.key?m:g.key),o=s(g,o,m),null===d?c=g:d.sibling=g,d=g);return e&&u.forEach((function(e){return t(r,e)})),ro&&Zr(r,m),c}function g(r,a,l,c){var d=D(l);if("function"!=typeof d)throw Error(o(150));if(null==(l=d.call(l)))throw Error(o(151));for(var u=d=null,m=a,g=a=0,v=null,b=l.next();null!==m&&!b.done;g++,b=l.next()){m.index>g?(v=m,m=null):v=m.sibling;var y=p(r,m,b.value,c);if(null===y){null===m&&(m=v);break}e&&m&&null===y.alternate&&t(r,m),a=s(y,a,g),null===u?d=y:u.sibling=y,u=y,m=v}if(b.done)return n(r,m),ro&&Zr(r,g),d;if(null===m){for(;!b.done;g++,b=l.next())null!==(b=h(r,b.value,c))&&(a=s(b,a,g),null===u?d=b:u.sibling=b,u=b);return ro&&Zr(r,g),d}for(m=i(r,m);!b.done;g++,b=l.next())null!==(b=f(m,r,g,b.value,c))&&(e&&null!==b.alternate&&m.delete(null===b.key?g:b.key),a=s(b,a,g),null===u?d=b:u.sibling=b,u=b);return e&&m.forEach((function(e){return t(r,e)})),ro&&Zr(r,g),d}return function e(i,o,s,l){if("object"==typeof s&&null!==s&&s.type===k&&null===s.key&&(s=s.props.children),"object"==typeof s&&null!==s){switch(s.$$typeof){case w:e:{for(var c=s.key,d=o;null!==d;){if(d.key===c){if((c=s.type)===k){if(7===d.tag){n(i,d.sibling),(o=r(d,s.props.children)).return=i,i=o;break e}}else if(d.elementType===c||"object"==typeof c&&null!==c&&c.$$typeof===O&&Jo(c)===d.type){n(i,d.sibling),(o=r(d,s.props)).ref=Ko(i,d,s),o.return=i,i=o;break e}n(i,d);break}t(i,d),d=d.sibling}s.type===k?((o=Dc(s.props.children,i.mode,l,s.key)).return=i,i=o):((l=Nc(s.type,s.key,s.props,null,i.mode,l)).ref=Ko(i,o,s),l.return=i,i=l)}return a(i);case C:e:{for(d=s.key;null!==o;){if(o.key===d){if(4===o.tag&&o.stateNode.containerInfo===s.containerInfo&&o.stateNode.implementation===s.implementation){n(i,o.sibling),(o=r(o,s.children||[])).return=i,i=o;break e}n(i,o);break}t(i,o),o=o.sibling}(o=Bc(s,i.mode,l)).return=i,i=o}return a(i);case O:return e(i,o,(d=s._init)(s._payload),l)}if(te(s))return m(i,o,s,l);if(D(s))return g(i,o,s,l);Go(i,s)}return"string"==typeof s&&""!==s||"number"==typeof s?(s=""+s,null!==o&&6===o.tag?(n(i,o.sibling),(o=r(o,s)).return=i,i=o):(n(i,o),(o=Lc(s,i.mode,l)).return=i,i=o),a(i)):n(i,o)}}var Yo=Qo(!0),Zo=Qo(!1),Xo={},es=Er(Xo),ts=Er(Xo),ns=Er(Xo);function is(e){if(e===Xo)throw Error(o(174));return e}function rs(e,t){switch(Tr(ns,t),Tr(ts,e),Tr(es,Xo),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:le(null,"");break;default:t=le(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}_r(es),Tr(es,t)}function os(){_r(es),_r(ts),_r(ns)}function ss(e){is(ns.current);var t=is(es.current),n=le(t,e.type);t!==n&&(Tr(ts,e),Tr(es,n))}function as(e){ts.current===e&&(_r(es),_r(ts))}var ls=Er(0);function cs(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ds=[];function us(){for(var e=0;e<ds.length;e++)ds[e]._workInProgressVersionPrimary=null;ds.length=0}var hs=S.ReactCurrentDispatcher,ps=S.ReactCurrentBatchConfig,fs=0,ms=null,gs=null,vs=null,bs=!1,ys=!1,Ss=0,ws=0;function Cs(){throw Error(o(321))}function ks(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ai(e[n],t[n]))return!1;return!0}function Es(e,t,n,i,r,s){if(fs=s,ms=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,hs.current=null===e||null===e.memoizedState?aa:la,e=n(i,r),ys){s=0;do{if(ys=!1,Ss=0,25<=s)throw Error(o(301));s+=1,vs=gs=null,t.updateQueue=null,hs.current=ca,e=n(i,r)}while(ys)}if(hs.current=sa,t=null!==gs&&null!==gs.next,fs=0,vs=gs=ms=null,bs=!1,t)throw Error(o(300));return e}function _s(){var e=0!==Ss;return Ss=0,e}function Ts(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===vs?ms.memoizedState=vs=e:vs=vs.next=e,vs}function xs(){if(null===gs){var e=ms.alternate;e=null!==e?e.memoizedState:null}else e=gs.next;var t=null===vs?ms.memoizedState:vs.next;if(null!==t)vs=t,gs=e;else{if(null===e)throw Error(o(310));e={memoizedState:(gs=e).memoizedState,baseState:gs.baseState,baseQueue:gs.baseQueue,queue:gs.queue,next:null},null===vs?ms.memoizedState=vs=e:vs=vs.next=e}return vs}function Is(e,t){return"function"==typeof t?t(e):t}function Ms(e){var t=xs(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var i=gs,r=i.baseQueue,s=n.pending;if(null!==s){if(null!==r){var a=r.next;r.next=s.next,s.next=a}i.baseQueue=r=s,n.pending=null}if(null!==r){s=r.next,i=i.baseState;var l=a=null,c=null,d=s;do{var u=d.lane;if((fs&u)===u)null!==c&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),i=d.hasEagerState?d.eagerState:e(i,d.action);else{var h={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};null===c?(l=c=h,a=i):c=c.next=h,ms.lanes|=u,Fl|=u}d=d.next}while(null!==d&&d!==s);null===c?a=i:c.next=l,ai(i,t.memoizedState)||(Sa=!0),t.memoizedState=i,t.baseState=a,t.baseQueue=c,n.lastRenderedState=i}if(null!==(e=n.interleaved)){r=e;do{s=r.lane,ms.lanes|=s,Fl|=s,r=r.next}while(r!==e)}else null===r&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function As(e){var t=xs(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var i=n.dispatch,r=n.pending,s=t.memoizedState;if(null!==r){n.pending=null;var a=r=r.next;do{s=e(s,a.action),a=a.next}while(a!==r);ai(s,t.memoizedState)||(Sa=!0),t.memoizedState=s,null===t.baseQueue&&(t.baseState=s),n.lastRenderedState=s}return[s,i]}function Ps(){}function Os(e,t){var n=ms,i=xs(),r=t(),s=!ai(i.memoizedState,r);if(s&&(i.memoizedState=r,Sa=!0),i=i.queue,Ws(Ds.bind(null,n,i,e),[e]),i.getSnapshot!==t||s||null!==vs&&1&vs.memoizedState.tag){if(n.flags|=2048,Us(9,Ns.bind(null,n,i,r,t),void 0,null),null===Ml)throw Error(o(349));0!=(30&fs)||Rs(n,t,r)}return r}function Rs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=ms.updateQueue)?(t={lastEffect:null,stores:null},ms.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Ns(e,t,n,i){t.value=n,t.getSnapshot=i,Fs(t)&&Ls(e)}function Ds(e,t,n){return n((function(){Fs(t)&&Ls(e)}))}function Fs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ai(e,n)}catch(e){return!0}}function Ls(e){var t=Ao(e,1);null!==t&&nc(t,e,1,-1)}function Bs(e){var t=Ts();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Is,lastRenderedState:e},t.queue=e,e=e.dispatch=na.bind(null,ms,e),[t.memoizedState,e]}function Us(e,t,n,i){return e={tag:e,create:t,destroy:n,deps:i,next:null},null===(t=ms.updateQueue)?(t={lastEffect:null,stores:null},ms.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function Vs(){return xs().memoizedState}function js(e,t,n,i){var r=Ts();ms.flags|=e,r.memoizedState=Us(1|t,n,void 0,void 0===i?null:i)}function zs(e,t,n,i){var r=xs();i=void 0===i?null:i;var o=void 0;if(null!==gs){var s=gs.memoizedState;if(o=s.destroy,null!==i&&ks(i,s.deps))return void(r.memoizedState=Us(t,n,o,i))}ms.flags|=e,r.memoizedState=Us(1|t,n,o,i)}function $s(e,t){return js(8390656,8,e,t)}function Ws(e,t){return zs(2048,8,e,t)}function Hs(e,t){return zs(4,2,e,t)}function qs(e,t){return zs(4,4,e,t)}function Ks(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Gs(e,t,n){return n=null!=n?n.concat([e]):null,zs(4,4,Ks.bind(null,t,e),n)}function Js(){}function Qs(e,t){var n=xs();t=void 0===t?null:t;var i=n.memoizedState;return null!==i&&null!==t&&ks(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function Ys(e,t){var n=xs();t=void 0===t?null:t;var i=n.memoizedState;return null!==i&&null!==t&&ks(t,i[1])?i[0]:(e=e(),n.memoizedState=[e,t],e)}function Zs(e,t,n){return 0==(21&fs)?(e.baseState&&(e.baseState=!1,Sa=!0),e.memoizedState=n):(ai(n,t)||(n=mt(),ms.lanes|=n,Fl|=n,e.baseState=!0),t)}function Xs(e,t){var n=yt;yt=0!==n&&4>n?n:4,e(!0);var i=ps.transition;ps.transition={};try{e(!1),t()}finally{yt=n,ps.transition=i}}function ea(){return xs().memoizedState}function ta(e,t,n){var i=tc(e);n={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null},ia(e)?ra(t,n):null!==(n=Mo(e,t,n,i))&&(nc(n,e,i,ec()),oa(n,t,i))}function na(e,t,n){var i=tc(e),r={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null};if(ia(e))ra(t,r);else{var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var s=t.lastRenderedState,a=o(s,n);if(r.hasEagerState=!0,r.eagerState=a,ai(a,s)){var l=t.interleaved;return null===l?(r.next=r,Io(t)):(r.next=l.next,l.next=r),void(t.interleaved=r)}}catch(e){}null!==(n=Mo(e,t,r,i))&&(nc(n,e,i,r=ec()),oa(n,t,i))}}function ia(e){var t=e.alternate;return e===ms||null!==t&&t===ms}function ra(e,t){ys=bs=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function oa(e,t,n){if(0!=(4194240&n)){var i=t.lanes;n|=i&=e.pendingLanes,t.lanes=n,bt(e,n)}}var sa={readContext:To,useCallback:Cs,useContext:Cs,useEffect:Cs,useImperativeHandle:Cs,useInsertionEffect:Cs,useLayoutEffect:Cs,useMemo:Cs,useReducer:Cs,useRef:Cs,useState:Cs,useDebugValue:Cs,useDeferredValue:Cs,useTransition:Cs,useMutableSource:Cs,useSyncExternalStore:Cs,useId:Cs,unstable_isNewReconciler:!1},aa={readContext:To,useCallback:function(e,t){return Ts().memoizedState=[e,void 0===t?null:t],e},useContext:To,useEffect:$s,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,js(4194308,4,Ks.bind(null,t,e),n)},useLayoutEffect:function(e,t){return js(4194308,4,e,t)},useInsertionEffect:function(e,t){return js(4,2,e,t)},useMemo:function(e,t){var n=Ts();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var i=Ts();return t=void 0!==n?n(t):t,i.memoizedState=i.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},i.queue=e,e=e.dispatch=ta.bind(null,ms,e),[i.memoizedState,e]},useRef:function(e){return e={current:e},Ts().memoizedState=e},useState:Bs,useDebugValue:Js,useDeferredValue:function(e){return Ts().memoizedState=e},useTransition:function(){var e=Bs(!1),t=e[0];return e=Xs.bind(null,e[1]),Ts().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=ms,r=Ts();if(ro){if(void 0===n)throw Error(o(407));n=n()}else{if(n=t(),null===Ml)throw Error(o(349));0!=(30&fs)||Rs(i,t,n)}r.memoizedState=n;var s={value:n,getSnapshot:t};return r.queue=s,$s(Ds.bind(null,i,s,e),[e]),i.flags|=2048,Us(9,Ns.bind(null,i,s,n,t),void 0,null),n},useId:function(){var e=Ts(),t=Ml.identifierPrefix;if(ro){var n=Yr;t=":"+t+"R"+(n=(Qr&~(1<<32-st(Qr)-1)).toString(32)+n),0<(n=Ss++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=ws++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},la={readContext:To,useCallback:Qs,useContext:To,useEffect:Ws,useImperativeHandle:Gs,useInsertionEffect:Hs,useLayoutEffect:qs,useMemo:Ys,useReducer:Ms,useRef:Vs,useState:function(){return Ms(Is)},useDebugValue:Js,useDeferredValue:function(e){return Zs(xs(),gs.memoizedState,e)},useTransition:function(){return[Ms(Is)[0],xs().memoizedState]},useMutableSource:Ps,useSyncExternalStore:Os,useId:ea,unstable_isNewReconciler:!1},ca={readContext:To,useCallback:Qs,useContext:To,useEffect:Ws,useImperativeHandle:Gs,useInsertionEffect:Hs,useLayoutEffect:qs,useMemo:Ys,useReducer:As,useRef:Vs,useState:function(){return As(Is)},useDebugValue:Js,useDeferredValue:function(e){var t=xs();return null===gs?t.memoizedState=e:Zs(t,gs.memoizedState,e)},useTransition:function(){return[As(Is)[0],xs().memoizedState]},useMutableSource:Ps,useSyncExternalStore:Os,useId:ea,unstable_isNewReconciler:!1};function da(e,t){try{var n="",i=t;do{n+=j(i),i=i.return}while(i);var r=n}catch(e){r="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:r,digest:null}}function ua(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function ha(e,t){try{console.error(t.value)}catch(e){setTimeout((function(){throw e}))}}var pa="function"==typeof WeakMap?WeakMap:Map;function fa(e,t,n){(n=No(-1,n)).tag=3,n.payload={element:null};var i=t.value;return n.callback=function(){Wl||(Wl=!0,Hl=i),ha(0,t)},n}function ma(e,t,n){(n=No(-1,n)).tag=3;var i=e.type.getDerivedStateFromError;if("function"==typeof i){var r=t.value;n.payload=function(){return i(r)},n.callback=function(){ha(0,t)}}var o=e.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){ha(0,t),"function"!=typeof i&&(null===ql?ql=new Set([this]):ql.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function ga(e,t,n){var i=e.pingCache;if(null===i){i=e.pingCache=new pa;var r=new Set;i.set(t,r)}else void 0===(r=i.get(t))&&(r=new Set,i.set(t,r));r.has(n)||(r.add(n),e=_c.bind(null,e,t,n),t.then(e,e))}function va(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function ba(e,t,n,i,r){return 0==(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=No(-1,1)).tag=2,Do(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=r,e)}var ya=S.ReactCurrentOwner,Sa=!1;function wa(e,t,n,i){t.child=null===e?Zo(t,null,n,i):Yo(t,e.child,n,i)}function Ca(e,t,n,i,r){n=n.render;var o=t.ref;return _o(t,r),i=Es(e,t,n,i,o,r),n=_s(),null===e||Sa?(ro&&n&&eo(t),t.flags|=1,wa(e,t,i,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,Wa(e,t,r))}function ka(e,t,n,i,r){if(null===e){var o=n.type;return"function"!=typeof o||Oc(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Nc(n.type,null,i,t,t.mode,r)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Ea(e,t,o,i,r))}if(o=e.child,0==(e.lanes&r)){var s=o.memoizedProps;if((n=null!==(n=n.compare)?n:li)(s,i)&&e.ref===t.ref)return Wa(e,t,r)}return t.flags|=1,(e=Rc(o,i)).ref=t.ref,e.return=t,t.child=e}function Ea(e,t,n,i,r){if(null!==e){var o=e.memoizedProps;if(li(o,i)&&e.ref===t.ref){if(Sa=!1,t.pendingProps=i=o,0==(e.lanes&r))return t.lanes=e.lanes,Wa(e,t,r);0!=(131072&e.flags)&&(Sa=!0)}}return xa(e,t,n,i,r)}function _a(e,t,n){var i=t.pendingProps,r=i.children,o=null!==e?e.memoizedState:null;if("hidden"===i.mode)if(0==(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Tr(Rl,Ol),Ol|=n;else{if(0==(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Tr(Rl,Ol),Ol|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=null!==o?o.baseLanes:n,Tr(Rl,Ol),Ol|=i}else null!==o?(i=o.baseLanes|n,t.memoizedState=null):i=n,Tr(Rl,Ol),Ol|=i;return wa(e,t,r,n),t.child}function Ta(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function xa(e,t,n,i,r){var o=Or(n)?Ar:Ir.current;return o=Pr(t,o),_o(t,r),n=Es(e,t,n,i,o,r),i=_s(),null===e||Sa?(ro&&i&&eo(t),t.flags|=1,wa(e,t,n,r),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r,Wa(e,t,r))}function Ia(e,t,n,i,r){if(Or(n)){var o=!0;Fr(t)}else o=!1;if(_o(t,r),null===t.stateNode)$a(e,t),Wo(t,n,i),qo(t,n,i,r),i=!0;else if(null===e){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,c=n.contextType;c="object"==typeof c&&null!==c?To(c):Pr(t,c=Or(n)?Ar:Ir.current);var d=n.getDerivedStateFromProps,u="function"==typeof d||"function"==typeof s.getSnapshotBeforeUpdate;u||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(a!==i||l!==c)&&Ho(t,s,i,c),Po=!1;var h=t.memoizedState;s.state=h,Bo(t,i,s,r),l=t.memoizedState,a!==i||h!==l||Mr.current||Po?("function"==typeof d&&(jo(t,n,d,i),l=t.memoizedState),(a=Po||$o(t,n,a,i,h,l,c))?(u||"function"!=typeof s.UNSAFE_componentWillMount&&"function"!=typeof s.componentWillMount||("function"==typeof s.componentWillMount&&s.componentWillMount(),"function"==typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"==typeof s.componentDidMount&&(t.flags|=4194308)):("function"==typeof s.componentDidMount&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=l),s.props=i,s.state=l,s.context=c,i=a):("function"==typeof s.componentDidMount&&(t.flags|=4194308),i=!1)}else{s=t.stateNode,Ro(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:vo(t.type,a),s.props=c,u=t.pendingProps,h=s.context,l="object"==typeof(l=n.contextType)&&null!==l?To(l):Pr(t,l=Or(n)?Ar:Ir.current);var p=n.getDerivedStateFromProps;(d="function"==typeof p||"function"==typeof s.getSnapshotBeforeUpdate)||"function"!=typeof s.UNSAFE_componentWillReceiveProps&&"function"!=typeof s.componentWillReceiveProps||(a!==u||h!==l)&&Ho(t,s,i,l),Po=!1,h=t.memoizedState,s.state=h,Bo(t,i,s,r);var f=t.memoizedState;a!==u||h!==f||Mr.current||Po?("function"==typeof p&&(jo(t,n,p,i),f=t.memoizedState),(c=Po||$o(t,n,c,i,h,f,l)||!1)?(d||"function"!=typeof s.UNSAFE_componentWillUpdate&&"function"!=typeof s.componentWillUpdate||("function"==typeof s.componentWillUpdate&&s.componentWillUpdate(i,f,l),"function"==typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(i,f,l)),"function"==typeof s.componentDidUpdate&&(t.flags|=4),"function"==typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof s.componentDidUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=f),s.props=i,s.state=f,s.context=l,i=c):("function"!=typeof s.componentDidUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),i=!1)}return Ma(e,t,n,i,o,r)}function Ma(e,t,n,i,r,o){Ta(e,t);var s=0!=(128&t.flags);if(!i&&!s)return r&&Lr(t,n,!1),Wa(e,t,o);i=t.stateNode,ya.current=t;var a=s&&"function"!=typeof n.getDerivedStateFromError?null:i.render();return t.flags|=1,null!==e&&s?(t.child=Yo(t,e.child,null,o),t.child=Yo(t,null,a,o)):wa(e,t,a,o),t.memoizedState=i.state,r&&Lr(t,n,!0),t.child}function Aa(e){var t=e.stateNode;t.pendingContext?Nr(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Nr(0,t.context,!1),rs(e,t.containerInfo)}function Pa(e,t,n,i,r){return fo(),mo(r),t.flags|=256,wa(e,t,n,i),t.child}var Oa,Ra,Na,Da={dehydrated:null,treeContext:null,retryLane:0};function Fa(e){return{baseLanes:e,cachePool:null,transitions:null}}function La(e,t,n){var i,r=t.pendingProps,s=ls.current,a=!1,l=0!=(128&t.flags);if((i=l)||(i=(null===e||null!==e.memoizedState)&&0!=(2&s)),i?(a=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(s|=1),Tr(ls,1&s),null===e)return co(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0==(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(l=r.children,e=r.fallback,a?(r=t.mode,a=t.child,l={mode:"hidden",children:l},0==(1&r)&&null!==a?(a.childLanes=0,a.pendingProps=l):a=Fc(l,r,0,null),e=Dc(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Fa(n),t.memoizedState=Da,e):Ba(t,l));if(null!==(s=e.memoizedState)&&null!==(i=s.dehydrated))return function(e,t,n,i,r,s,a){if(n)return 256&t.flags?(t.flags&=-257,Ua(e,t,a,i=ua(Error(o(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(s=i.fallback,r=t.mode,i=Fc({mode:"visible",children:i.children},r,0,null),(s=Dc(s,r,a,null)).flags|=2,i.return=t,s.return=t,i.sibling=s,t.child=i,0!=(1&t.mode)&&Yo(t,e.child,null,a),t.child.memoizedState=Fa(a),t.memoizedState=Da,s);if(0==(1&t.mode))return Ua(e,t,a,null);if("$!"===r.data){if(i=r.nextSibling&&r.nextSibling.dataset)var l=i.dgst;return i=l,Ua(e,t,a,i=ua(s=Error(o(419)),i,void 0))}if(l=0!=(a&e.childLanes),Sa||l){if(null!==(i=Ml)){switch(a&-a){case 4:r=2;break;case 16:r=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:r=32;break;case 536870912:r=268435456;break;default:r=0}0!==(r=0!=(r&(i.suspendedLanes|a))?0:r)&&r!==s.retryLane&&(s.retryLane=r,Ao(e,r),nc(i,e,r,-1))}return mc(),Ua(e,t,a,i=ua(Error(o(421))))}return"$?"===r.data?(t.flags|=128,t.child=e.child,t=xc.bind(null,e),r._reactRetry=t,null):(e=s.treeContext,io=cr(r.nextSibling),no=t,ro=!0,oo=null,null!==e&&(Kr[Gr++]=Qr,Kr[Gr++]=Yr,Kr[Gr++]=Jr,Qr=e.id,Yr=e.overflow,Jr=t),(t=Ba(t,i.children)).flags|=4096,t)}(e,t,l,r,i,s,n);if(a){a=r.fallback,l=t.mode,i=(s=e.child).sibling;var c={mode:"hidden",children:r.children};return 0==(1&l)&&t.child!==s?((r=t.child).childLanes=0,r.pendingProps=c,t.deletions=null):(r=Rc(s,c)).subtreeFlags=14680064&s.subtreeFlags,null!==i?a=Rc(i,a):(a=Dc(a,l,n,null)).flags|=2,a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,l=null===(l=e.child.memoizedState)?Fa(n):{baseLanes:l.baseLanes|n,cachePool:null,transitions:l.transitions},a.memoizedState=l,a.childLanes=e.childLanes&~n,t.memoizedState=Da,r}return e=(a=e.child).sibling,r=Rc(a,{mode:"visible",children:r.children}),0==(1&t.mode)&&(r.lanes=n),r.return=t,r.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Ba(e,t){return(t=Fc({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Ua(e,t,n,i){return null!==i&&mo(i),Yo(t,e.child,null,n),(e=Ba(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Va(e,t,n){e.lanes|=t;var i=e.alternate;null!==i&&(i.lanes|=t),Eo(e.return,t,n)}function ja(e,t,n,i,r){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:r}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=i,o.tail=n,o.tailMode=r)}function za(e,t,n){var i=t.pendingProps,r=i.revealOrder,o=i.tail;if(wa(e,t,i.children,n),0!=(2&(i=ls.current)))i=1&i|2,t.flags|=128;else{if(null!==e&&0!=(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Va(e,n,t);else if(19===e.tag)Va(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}i&=1}if(Tr(ls,i),0==(1&t.mode))t.memoizedState=null;else switch(r){case"forwards":for(n=t.child,r=null;null!==n;)null!==(e=n.alternate)&&null===cs(e)&&(r=n),n=n.sibling;null===(n=r)?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),ja(t,!1,r,n,o);break;case"backwards":for(n=null,r=t.child,t.child=null;null!==r;){if(null!==(e=r.alternate)&&null===cs(e)){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}ja(t,!0,n,null,o);break;case"together":ja(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function $a(e,t){0==(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Wa(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Fl|=t.lanes,0==(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(o(153));if(null!==t.child){for(n=Rc(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Rc(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Ha(e,t){if(!ro)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;null!==n;)null!==n.alternate&&(i=n),n=n.sibling;null===i?t||null===e.tail?e.tail=null:e.tail.sibling=null:i.sibling=null}}function qa(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,i=0;if(t)for(var r=e.child;null!==r;)n|=r.lanes|r.childLanes,i|=14680064&r.subtreeFlags,i|=14680064&r.flags,r.return=e,r=r.sibling;else for(r=e.child;null!==r;)n|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function Ka(e,t,n){var i=t.pendingProps;switch(to(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qa(t),null;case 1:case 17:return Or(t.type)&&Rr(),qa(t),null;case 3:return i=t.stateNode,os(),_r(Mr),_r(Ir),us(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),null!==e&&null!==e.child||(ho(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&0==(256&t.flags)||(t.flags|=1024,null!==oo&&(sc(oo),oo=null))),qa(t),null;case 5:as(t);var r=is(ns.current);if(n=t.type,null!==e&&null!=t.stateNode)Ra(e,t,n,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(null===t.stateNode)throw Error(o(166));return qa(t),null}if(e=is(es.current),ho(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[hr]=t,i[pr]=s,e=0!=(1&t.mode),n){case"dialog":Ui("cancel",i),Ui("close",i);break;case"iframe":case"object":case"embed":Ui("load",i);break;case"video":case"audio":for(r=0;r<Di.length;r++)Ui(Di[r],i);break;case"source":Ui("error",i);break;case"img":case"image":case"link":Ui("error",i),Ui("load",i);break;case"details":Ui("toggle",i);break;case"input":Q(i,s),Ui("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},Ui("invalid",i);break;case"textarea":re(i,s),Ui("invalid",i)}for(var l in be(n,s),r=null,s)if(s.hasOwnProperty(l)){var c=s[l];"children"===l?"string"==typeof c?i.textContent!==c&&(!0!==s.suppressHydrationWarning&&Zi(i.textContent,c,e),r=["children",c]):"number"==typeof c&&i.textContent!==""+c&&(!0!==s.suppressHydrationWarning&&Zi(i.textContent,c,e),r=["children",""+c]):a.hasOwnProperty(l)&&null!=c&&"onScroll"===l&&Ui("scroll",i)}switch(n){case"input":q(i),X(i,s,!0);break;case"textarea":q(i),se(i);break;case"select":case"option":break;default:"function"==typeof s.onClick&&(i.onclick=Xi)}i=r,t.updateQueue=i,null!==i&&(t.flags|=4)}else{l=9===r.nodeType?r:r.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=ae(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=l.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof i.is?e=l.createElement(n,{is:i.is}):(e=l.createElement(n),"select"===n&&(l=e,i.multiple?l.multiple=!0:i.size&&(l.size=i.size))):e=l.createElementNS(e,n),e[hr]=t,e[pr]=i,Oa(e,t),t.stateNode=e;e:{switch(l=ye(n,i),n){case"dialog":Ui("cancel",e),Ui("close",e),r=i;break;case"iframe":case"object":case"embed":Ui("load",e),r=i;break;case"video":case"audio":for(r=0;r<Di.length;r++)Ui(Di[r],e);r=i;break;case"source":Ui("error",e),r=i;break;case"img":case"image":case"link":Ui("error",e),Ui("load",e),r=i;break;case"details":Ui("toggle",e),r=i;break;case"input":Q(e,i),r=J(e,i),Ui("invalid",e);break;case"option":default:r=i;break;case"select":e._wrapperState={wasMultiple:!!i.multiple},r=L({},i,{value:void 0}),Ui("invalid",e);break;case"textarea":re(e,i),r=ie(e,i),Ui("invalid",e)}for(s in be(n,r),c=r)if(c.hasOwnProperty(s)){var d=c[s];"style"===s?ge(e,d):"dangerouslySetInnerHTML"===s?null!=(d=d?d.__html:void 0)&&ue(e,d):"children"===s?"string"==typeof d?("textarea"!==n||""!==d)&&he(e,d):"number"==typeof d&&he(e,""+d):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(a.hasOwnProperty(s)?null!=d&&"onScroll"===s&&Ui("scroll",e):null!=d&&y(e,s,d,l))}switch(n){case"input":q(e),X(e,i,!1);break;case"textarea":q(e),se(e);break;case"option":null!=i.value&&e.setAttribute("value",""+W(i.value));break;case"select":e.multiple=!!i.multiple,null!=(s=i.value)?ne(e,!!i.multiple,s,!1):null!=i.defaultValue&&ne(e,!!i.multiple,i.defaultValue,!0);break;default:"function"==typeof r.onClick&&(e.onclick=Xi)}switch(n){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return qa(t),null;case 6:if(e&&null!=t.stateNode)Na(0,t,e.memoizedProps,i);else{if("string"!=typeof i&&null===t.stateNode)throw Error(o(166));if(n=is(ns.current),is(es.current),ho(t)){if(i=t.stateNode,n=t.memoizedProps,i[hr]=t,(s=i.nodeValue!==n)&&null!==(e=no))switch(e.tag){case 3:Zi(i.nodeValue,n,0!=(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Zi(i.nodeValue,n,0!=(1&e.mode))}s&&(t.flags|=4)}else(i=(9===n.nodeType?n:n.ownerDocument).createTextNode(i))[hr]=t,t.stateNode=i}return qa(t),null;case 13:if(_r(ls),i=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(ro&&null!==io&&0!=(1&t.mode)&&0==(128&t.flags))po(),fo(),t.flags|=98560,s=!1;else if(s=ho(t),null!==i&&null!==i.dehydrated){if(null===e){if(!s)throw Error(o(318));if(!(s=null!==(s=t.memoizedState)?s.dehydrated:null))throw Error(o(317));s[hr]=t}else fo(),0==(128&t.flags)&&(t.memoizedState=null),t.flags|=4;qa(t),s=!1}else null!==oo&&(sc(oo),oo=null),s=!0;if(!s)return 65536&t.flags?t:null}return 0!=(128&t.flags)?(t.lanes=n,t):((i=null!==i)!=(null!==e&&null!==e.memoizedState)&&i&&(t.child.flags|=8192,0!=(1&t.mode)&&(null===e||0!=(1&ls.current)?0===Nl&&(Nl=3):mc())),null!==t.updateQueue&&(t.flags|=4),qa(t),null);case 4:return os(),null===e&&zi(t.stateNode.containerInfo),qa(t),null;case 10:return ko(t.type._context),qa(t),null;case 19:if(_r(ls),null===(s=t.memoizedState))return qa(t),null;if(i=0!=(128&t.flags),null===(l=s.rendering))if(i)Ha(s,!1);else{if(0!==Nl||null!==e&&0!=(128&e.flags))for(e=t.child;null!==e;){if(null!==(l=cs(e))){for(t.flags|=128,Ha(s,!1),null!==(i=l.updateQueue)&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;null!==n;)e=i,(s=n).flags&=14680066,null===(l=s.alternate)?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,e=l.dependencies,s.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Tr(ls,1&ls.current|2),t.child}e=e.sibling}null!==s.tail&&Ye()>zl&&(t.flags|=128,i=!0,Ha(s,!1),t.lanes=4194304)}else{if(!i)if(null!==(e=cs(l))){if(t.flags|=128,i=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),Ha(s,!0),null===s.tail&&"hidden"===s.tailMode&&!l.alternate&&!ro)return qa(t),null}else 2*Ye()-s.renderingStartTime>zl&&1073741824!==n&&(t.flags|=128,i=!0,Ha(s,!1),t.lanes=4194304);s.isBackwards?(l.sibling=t.child,t.child=l):(null!==(n=s.last)?n.sibling=l:t.child=l,s.last=l)}return null!==s.tail?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Ye(),t.sibling=null,n=ls.current,Tr(ls,i?1&n|2:1&n),t):(qa(t),null);case 22:case 23:return uc(),i=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==i&&(t.flags|=8192),i&&0!=(1&t.mode)?0!=(1073741824&Ol)&&(qa(t),6&t.subtreeFlags&&(t.flags|=8192)):qa(t),null;case 24:case 25:return null}throw Error(o(156,t.tag))}function Ga(e,t){switch(to(t),t.tag){case 1:return Or(t.type)&&Rr(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return os(),_r(Mr),_r(Ir),us(),0!=(65536&(e=t.flags))&&0==(128&e)?(t.flags=-65537&e|128,t):null;case 5:return as(t),null;case 13:if(_r(ls),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(o(340));fo()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return _r(ls),null;case 4:return os(),null;case 10:return ko(t.type._context),null;case 22:case 23:return uc(),null;default:return null}}Oa=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ra=function(e,t,n,i){var r=e.memoizedProps;if(r!==i){e=t.stateNode,is(es.current);var o,s=null;switch(n){case"input":r=J(e,r),i=J(e,i),s=[];break;case"select":r=L({},r,{value:void 0}),i=L({},i,{value:void 0}),s=[];break;case"textarea":r=ie(e,r),i=ie(e,i),s=[];break;default:"function"!=typeof r.onClick&&"function"==typeof i.onClick&&(e.onclick=Xi)}for(d in be(n,i),n=null,r)if(!i.hasOwnProperty(d)&&r.hasOwnProperty(d)&&null!=r[d])if("style"===d){var l=r[d];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else"dangerouslySetInnerHTML"!==d&&"children"!==d&&"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&"autoFocus"!==d&&(a.hasOwnProperty(d)?s||(s=[]):(s=s||[]).push(d,null));for(d in i){var c=i[d];if(l=null!=r?r[d]:void 0,i.hasOwnProperty(d)&&c!==l&&(null!=c||null!=l))if("style"===d)if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(s||(s=[]),s.push(d,n)),n=c;else"dangerouslySetInnerHTML"===d?(c=c?c.__html:void 0,l=l?l.__html:void 0,null!=c&&l!==c&&(s=s||[]).push(d,c)):"children"===d?"string"!=typeof c&&"number"!=typeof c||(s=s||[]).push(d,""+c):"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&(a.hasOwnProperty(d)?(null!=c&&"onScroll"===d&&Ui("scroll",e),s||l===c||(s=[])):(s=s||[]).push(d,c))}n&&(s=s||[]).push("style",n);var d=s;(t.updateQueue=d)&&(t.flags|=4)}},Na=function(e,t,n,i){n!==i&&(t.flags|=4)};var Ja=!1,Qa=!1,Ya="function"==typeof WeakSet?WeakSet:Set,Za=null;function Xa(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){Ec(e,t,n)}else n.current=null}function el(e,t,n){try{n()}catch(n){Ec(e,t,n)}}var tl=!1;function nl(e,t,n){var i=t.updateQueue;if(null!==(i=null!==i?i.lastEffect:null)){var r=i=i.next;do{if((r.tag&e)===e){var o=r.destroy;r.destroy=void 0,void 0!==o&&el(t,n,o)}r=r.next}while(r!==i)}}function il(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var i=n.create;n.destroy=i()}n=n.next}while(n!==t)}}function rl(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function ol(e){var t=e.alternate;null!==t&&(e.alternate=null,ol(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&null!==(t=e.stateNode)&&(delete t[hr],delete t[pr],delete t[mr],delete t[gr],delete t[vr]),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function sl(e){return 5===e.tag||3===e.tag||4===e.tag}function al(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||sl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function ll(e,t,n){var i=e.tag;if(5===i||6===i)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Xi));else if(4!==i&&null!==(e=e.child))for(ll(e,t,n),e=e.sibling;null!==e;)ll(e,t,n),e=e.sibling}function cl(e,t,n){var i=e.tag;if(5===i||6===i)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==i&&null!==(e=e.child))for(cl(e,t,n),e=e.sibling;null!==e;)cl(e,t,n),e=e.sibling}var dl=null,ul=!1;function hl(e,t,n){for(n=n.child;null!==n;)pl(e,t,n),n=n.sibling}function pl(e,t,n){if(ot&&"function"==typeof ot.onCommitFiberUnmount)try{ot.onCommitFiberUnmount(rt,n)}catch(e){}switch(n.tag){case 5:Qa||Xa(n,t);case 6:var i=dl,r=ul;dl=null,hl(e,t,n),ul=r,null!==(dl=i)&&(ul?(e=dl,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):dl.removeChild(n.stateNode));break;case 18:null!==dl&&(ul?(e=dl,n=n.stateNode,8===e.nodeType?lr(e.parentNode,n):1===e.nodeType&&lr(e,n),zt(e)):lr(dl,n.stateNode));break;case 4:i=dl,r=ul,dl=n.stateNode.containerInfo,ul=!0,hl(e,t,n),dl=i,ul=r;break;case 0:case 11:case 14:case 15:if(!Qa&&null!==(i=n.updateQueue)&&null!==(i=i.lastEffect)){r=i=i.next;do{var o=r,s=o.destroy;o=o.tag,void 0!==s&&(0!=(2&o)||0!=(4&o))&&el(n,t,s),r=r.next}while(r!==i)}hl(e,t,n);break;case 1:if(!Qa&&(Xa(n,t),"function"==typeof(i=n.stateNode).componentWillUnmount))try{i.props=n.memoizedProps,i.state=n.memoizedState,i.componentWillUnmount()}catch(e){Ec(n,t,e)}hl(e,t,n);break;case 21:hl(e,t,n);break;case 22:1&n.mode?(Qa=(i=Qa)||null!==n.memoizedState,hl(e,t,n),Qa=i):hl(e,t,n);break;default:hl(e,t,n)}}function fl(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Ya),t.forEach((function(t){var i=Ic.bind(null,e,t);n.has(t)||(n.add(t),t.then(i,i))}))}}function ml(e,t){var n=t.deletions;if(null!==n)for(var i=0;i<n.length;i++){var r=n[i];try{var s=e,a=t,l=a;e:for(;null!==l;){switch(l.tag){case 5:dl=l.stateNode,ul=!1;break e;case 3:case 4:dl=l.stateNode.containerInfo,ul=!0;break e}l=l.return}if(null===dl)throw Error(o(160));pl(s,a,r),dl=null,ul=!1;var c=r.alternate;null!==c&&(c.return=null),r.return=null}catch(e){Ec(r,t,e)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)gl(t,e),t=t.sibling}function gl(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ml(t,e),vl(e),4&i){try{nl(3,e,e.return),il(3,e)}catch(t){Ec(e,e.return,t)}try{nl(5,e,e.return)}catch(t){Ec(e,e.return,t)}}break;case 1:ml(t,e),vl(e),512&i&&null!==n&&Xa(n,n.return);break;case 5:if(ml(t,e),vl(e),512&i&&null!==n&&Xa(n,n.return),32&e.flags){var r=e.stateNode;try{he(r,"")}catch(t){Ec(e,e.return,t)}}if(4&i&&null!=(r=e.stateNode)){var s=e.memoizedProps,a=null!==n?n.memoizedProps:s,l=e.type,c=e.updateQueue;if(e.updateQueue=null,null!==c)try{"input"===l&&"radio"===s.type&&null!=s.name&&Y(r,s),ye(l,a);var d=ye(l,s);for(a=0;a<c.length;a+=2){var u=c[a],h=c[a+1];"style"===u?ge(r,h):"dangerouslySetInnerHTML"===u?ue(r,h):"children"===u?he(r,h):y(r,u,h,d)}switch(l){case"input":Z(r,s);break;case"textarea":oe(r,s);break;case"select":var p=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var f=s.value;null!=f?ne(r,!!s.multiple,f,!1):p!==!!s.multiple&&(null!=s.defaultValue?ne(r,!!s.multiple,s.defaultValue,!0):ne(r,!!s.multiple,s.multiple?[]:"",!1))}r[pr]=s}catch(t){Ec(e,e.return,t)}}break;case 6:if(ml(t,e),vl(e),4&i){if(null===e.stateNode)throw Error(o(162));r=e.stateNode,s=e.memoizedProps;try{r.nodeValue=s}catch(t){Ec(e,e.return,t)}}break;case 3:if(ml(t,e),vl(e),4&i&&null!==n&&n.memoizedState.isDehydrated)try{zt(t.containerInfo)}catch(t){Ec(e,e.return,t)}break;case 4:default:ml(t,e),vl(e);break;case 13:ml(t,e),vl(e),8192&(r=e.child).flags&&(s=null!==r.memoizedState,r.stateNode.isHidden=s,!s||null!==r.alternate&&null!==r.alternate.memoizedState||(jl=Ye())),4&i&&fl(e);break;case 22:if(u=null!==n&&null!==n.memoizedState,1&e.mode?(Qa=(d=Qa)||u,ml(t,e),Qa=d):ml(t,e),vl(e),8192&i){if(d=null!==e.memoizedState,(e.stateNode.isHidden=d)&&!u&&0!=(1&e.mode))for(Za=e,u=e.child;null!==u;){for(h=Za=u;null!==Za;){switch(f=(p=Za).child,p.tag){case 0:case 11:case 14:case 15:nl(4,p,p.return);break;case 1:Xa(p,p.return);var m=p.stateNode;if("function"==typeof m.componentWillUnmount){i=p,n=p.return;try{t=i,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(e){Ec(i,n,e)}}break;case 5:Xa(p,p.return);break;case 22:if(null!==p.memoizedState){wl(h);continue}}null!==f?(f.return=p,Za=f):wl(h)}u=u.sibling}e:for(u=null,h=e;;){if(5===h.tag){if(null===u){u=h;try{r=h.stateNode,d?"function"==typeof(s=r.style).setProperty?s.setProperty("display","none","important"):s.display="none":(l=h.stateNode,a=null!=(c=h.memoizedProps.style)&&c.hasOwnProperty("display")?c.display:null,l.style.display=me("display",a))}catch(t){Ec(e,e.return,t)}}}else if(6===h.tag){if(null===u)try{h.stateNode.nodeValue=d?"":h.memoizedProps}catch(t){Ec(e,e.return,t)}}else if((22!==h.tag&&23!==h.tag||null===h.memoizedState||h===e)&&null!==h.child){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;null===h.sibling;){if(null===h.return||h.return===e)break e;u===h&&(u=null),h=h.return}u===h&&(u=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:ml(t,e),vl(e),4&i&&fl(e);case 21:}}function vl(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(sl(n)){var i=n;break e}n=n.return}throw Error(o(160))}switch(i.tag){case 5:var r=i.stateNode;32&i.flags&&(he(r,""),i.flags&=-33),cl(e,al(e),r);break;case 3:case 4:var s=i.stateNode.containerInfo;ll(e,al(e),s);break;default:throw Error(o(161))}}catch(t){Ec(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function bl(e,t,n){Za=e,yl(e,t,n)}function yl(e,t,n){for(var i=0!=(1&e.mode);null!==Za;){var r=Za,o=r.child;if(22===r.tag&&i){var s=null!==r.memoizedState||Ja;if(!s){var a=r.alternate,l=null!==a&&null!==a.memoizedState||Qa;a=Ja;var c=Qa;if(Ja=s,(Qa=l)&&!c)for(Za=r;null!==Za;)l=(s=Za).child,22===s.tag&&null!==s.memoizedState?Cl(r):null!==l?(l.return=s,Za=l):Cl(r);for(;null!==o;)Za=o,yl(o,t,n),o=o.sibling;Za=r,Ja=a,Qa=c}Sl(e)}else 0!=(8772&r.subtreeFlags)&&null!==o?(o.return=r,Za=o):Sl(e)}}function Sl(e){for(;null!==Za;){var t=Za;if(0!=(8772&t.flags)){var n=t.alternate;try{if(0!=(8772&t.flags))switch(t.tag){case 0:case 11:case 15:Qa||il(5,t);break;case 1:var i=t.stateNode;if(4&t.flags&&!Qa)if(null===n)i.componentDidMount();else{var r=t.elementType===t.type?n.memoizedProps:vo(t.type,n.memoizedProps);i.componentDidUpdate(r,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;null!==s&&Uo(t,s,i);break;case 3:var a=t.updateQueue;if(null!==a){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Uo(t,a,n)}break;case 5:var l=t.stateNode;if(null===n&&4&t.flags){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var d=t.alternate;if(null!==d){var u=d.memoizedState;if(null!==u){var h=u.dehydrated;null!==h&&zt(h)}}}break;default:throw Error(o(163))}Qa||512&t.flags&&rl(t)}catch(e){Ec(t,t.return,e)}}if(t===e){Za=null;break}if(null!==(n=t.sibling)){n.return=t.return,Za=n;break}Za=t.return}}function wl(e){for(;null!==Za;){var t=Za;if(t===e){Za=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Za=n;break}Za=t.return}}function Cl(e){for(;null!==Za;){var t=Za;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{il(4,t)}catch(e){Ec(t,n,e)}break;case 1:var i=t.stateNode;if("function"==typeof i.componentDidMount){var r=t.return;try{i.componentDidMount()}catch(e){Ec(t,r,e)}}var o=t.return;try{rl(t)}catch(e){Ec(t,o,e)}break;case 5:var s=t.return;try{rl(t)}catch(e){Ec(t,s,e)}}}catch(e){Ec(t,t.return,e)}if(t===e){Za=null;break}var a=t.sibling;if(null!==a){a.return=t.return,Za=a;break}Za=t.return}}var kl,El=Math.ceil,_l=S.ReactCurrentDispatcher,Tl=S.ReactCurrentOwner,xl=S.ReactCurrentBatchConfig,Il=0,Ml=null,Al=null,Pl=0,Ol=0,Rl=Er(0),Nl=0,Dl=null,Fl=0,Ll=0,Bl=0,Ul=null,Vl=null,jl=0,zl=1/0,$l=null,Wl=!1,Hl=null,ql=null,Kl=!1,Gl=null,Jl=0,Ql=0,Yl=null,Zl=-1,Xl=0;function ec(){return 0!=(6&Il)?Ye():-1!==Zl?Zl:Zl=Ye()}function tc(e){return 0==(1&e.mode)?1:0!=(2&Il)&&0!==Pl?Pl&-Pl:null!==go.transition?(0===Xl&&(Xl=mt()),Xl):0!==(e=yt)?e:e=void 0===(e=window.event)?16:Qt(e.type)}function nc(e,t,n,i){if(50<Ql)throw Ql=0,Yl=null,Error(o(185));vt(e,n,i),0!=(2&Il)&&e===Ml||(e===Ml&&(0==(2&Il)&&(Ll|=n),4===Nl&&ac(e,Pl)),ic(e,i),1===n&&0===Il&&0==(1&t.mode)&&(zl=Ye()+500,Ur&&zr()))}function ic(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,r=e.expirationTimes,o=e.pendingLanes;0<o;){var s=31-st(o),a=1<<s,l=r[s];-1===l?0!=(a&n)&&0==(a&i)||(r[s]=pt(a,t)):l<=t&&(e.expiredLanes|=a),o&=~a}}(e,t);var i=ht(e,e===Ml?Pl:0);if(0===i)null!==n&&Ge(n),e.callbackNode=null,e.callbackPriority=0;else if(t=i&-i,e.callbackPriority!==t){if(null!=n&&Ge(n),1===t)0===e.tag?function(e){Ur=!0,jr(e)}(lc.bind(null,e)):jr(lc.bind(null,e)),sr((function(){0==(6&Il)&&zr()})),n=null;else{switch(St(i)){case 1:n=Xe;break;case 4:n=et;break;case 16:default:n=tt;break;case 536870912:n=it}n=Mc(n,rc.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function rc(e,t){if(Zl=-1,Xl=0,0!=(6&Il))throw Error(o(327));var n=e.callbackNode;if(Cc()&&e.callbackNode!==n)return null;var i=ht(e,e===Ml?Pl:0);if(0===i)return null;if(0!=(30&i)||0!=(i&e.expiredLanes)||t)t=gc(e,i);else{t=i;var r=Il;Il|=2;var s=fc();for(Ml===e&&Pl===t||($l=null,zl=Ye()+500,hc(e,t));;)try{bc();break}catch(t){pc(e,t)}Co(),_l.current=s,Il=r,null!==Al?t=0:(Ml=null,Pl=0,t=Nl)}if(0!==t){if(2===t&&0!==(r=ft(e))&&(i=r,t=oc(e,r)),1===t)throw n=Dl,hc(e,0),ac(e,i),ic(e,Ye()),n;if(6===t)ac(e,i);else{if(r=e.current.alternate,0==(30&i)&&!function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var i=0;i<n.length;i++){var r=n[i],o=r.getSnapshot;r=r.value;try{if(!ai(o(),r))return!1}catch(e){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(r)&&(2===(t=gc(e,i))&&0!==(s=ft(e))&&(i=s,t=oc(e,s)),1===t))throw n=Dl,hc(e,0),ac(e,i),ic(e,Ye()),n;switch(e.finishedWork=r,e.finishedLanes=i,t){case 0:case 1:throw Error(o(345));case 2:case 5:wc(e,Vl,$l);break;case 3:if(ac(e,i),(130023424&i)===i&&10<(t=jl+500-Ye())){if(0!==ht(e,0))break;if(((r=e.suspendedLanes)&i)!==i){ec(),e.pingedLanes|=e.suspendedLanes&r;break}e.timeoutHandle=ir(wc.bind(null,e,Vl,$l),t);break}wc(e,Vl,$l);break;case 4:if(ac(e,i),(4194240&i)===i)break;for(t=e.eventTimes,r=-1;0<i;){var a=31-st(i);s=1<<a,(a=t[a])>r&&(r=a),i&=~s}if(i=r,10<(i=(120>(i=Ye()-i)?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*El(i/1960))-i)){e.timeoutHandle=ir(wc.bind(null,e,Vl,$l),i);break}wc(e,Vl,$l);break;default:throw Error(o(329))}}}return ic(e,Ye()),e.callbackNode===n?rc.bind(null,e):null}function oc(e,t){var n=Ul;return e.current.memoizedState.isDehydrated&&(hc(e,t).flags|=256),2!==(e=gc(e,t))&&(t=Vl,Vl=n,null!==t&&sc(t)),e}function sc(e){null===Vl?Vl=e:Vl.push.apply(Vl,e)}function ac(e,t){for(t&=~Bl,t&=~Ll,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-st(t),i=1<<n;e[n]=-1,t&=~i}}function lc(e){if(0!=(6&Il))throw Error(o(327));Cc();var t=ht(e,0);if(0==(1&t))return ic(e,Ye()),null;var n=gc(e,t);if(0!==e.tag&&2===n){var i=ft(e);0!==i&&(t=i,n=oc(e,i))}if(1===n)throw n=Dl,hc(e,0),ac(e,t),ic(e,Ye()),n;if(6===n)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,wc(e,Vl,$l),ic(e,Ye()),null}function cc(e,t){var n=Il;Il|=1;try{return e(t)}finally{0===(Il=n)&&(zl=Ye()+500,Ur&&zr())}}function dc(e){null!==Gl&&0===Gl.tag&&0==(6&Il)&&Cc();var t=Il;Il|=1;var n=xl.transition,i=yt;try{if(xl.transition=null,yt=1,e)return e()}finally{yt=i,xl.transition=n,0==(6&(Il=t))&&zr()}}function uc(){Ol=Rl.current,_r(Rl)}function hc(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,rr(n)),null!==Al)for(n=Al.return;null!==n;){var i=n;switch(to(i),i.tag){case 1:null!=(i=i.type.childContextTypes)&&Rr();break;case 3:os(),_r(Mr),_r(Ir),us();break;case 5:as(i);break;case 4:os();break;case 13:case 19:_r(ls);break;case 10:ko(i.type._context);break;case 22:case 23:uc()}n=n.return}if(Ml=e,Al=e=Rc(e.current,null),Pl=Ol=t,Nl=0,Dl=null,Bl=Ll=Fl=0,Vl=Ul=null,null!==xo){for(t=0;t<xo.length;t++)if(null!==(i=(n=xo[t]).interleaved)){n.interleaved=null;var r=i.next,o=n.pending;if(null!==o){var s=o.next;o.next=r,i.next=s}n.pending=i}xo=null}return e}function pc(e,t){for(;;){var n=Al;try{if(Co(),hs.current=sa,bs){for(var i=ms.memoizedState;null!==i;){var r=i.queue;null!==r&&(r.pending=null),i=i.next}bs=!1}if(fs=0,vs=gs=ms=null,ys=!1,Ss=0,Tl.current=null,null===n||null===n.return){Nl=1,Dl=t,Al=null;break}e:{var s=e,a=n.return,l=n,c=t;if(t=Pl,l.flags|=32768,null!==c&&"object"==typeof c&&"function"==typeof c.then){var d=c,u=l,h=u.tag;if(0==(1&u.mode)&&(0===h||11===h||15===h)){var p=u.alternate;p?(u.updateQueue=p.updateQueue,u.memoizedState=p.memoizedState,u.lanes=p.lanes):(u.updateQueue=null,u.memoizedState=null)}var f=va(a);if(null!==f){f.flags&=-257,ba(f,a,l,0,t),1&f.mode&&ga(s,d,t),c=d;var m=(t=f).updateQueue;if(null===m){var g=new Set;g.add(c),t.updateQueue=g}else m.add(c);break e}if(0==(1&t)){ga(s,d,t),mc();break e}c=Error(o(426))}else if(ro&&1&l.mode){var v=va(a);if(null!==v){0==(65536&v.flags)&&(v.flags|=256),ba(v,a,l,0,t),mo(da(c,l));break e}}s=c=da(c,l),4!==Nl&&(Nl=2),null===Ul?Ul=[s]:Ul.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t,Lo(s,fa(0,c,t));break e;case 1:l=c;var b=s.type,y=s.stateNode;if(0==(128&s.flags)&&("function"==typeof b.getDerivedStateFromError||null!==y&&"function"==typeof y.componentDidCatch&&(null===ql||!ql.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t,Lo(s,ma(s,l,t));break e}}s=s.return}while(null!==s)}Sc(n)}catch(e){t=e,Al===n&&null!==n&&(Al=n=n.return);continue}break}}function fc(){var e=_l.current;return _l.current=sa,null===e?sa:e}function mc(){0!==Nl&&3!==Nl&&2!==Nl||(Nl=4),null===Ml||0==(268435455&Fl)&&0==(268435455&Ll)||ac(Ml,Pl)}function gc(e,t){var n=Il;Il|=2;var i=fc();for(Ml===e&&Pl===t||($l=null,hc(e,t));;)try{vc();break}catch(t){pc(e,t)}if(Co(),Il=n,_l.current=i,null!==Al)throw Error(o(261));return Ml=null,Pl=0,Nl}function vc(){for(;null!==Al;)yc(Al)}function bc(){for(;null!==Al&&!Je();)yc(Al)}function yc(e){var t=kl(e.alternate,e,Ol);e.memoizedProps=e.pendingProps,null===t?Sc(e):Al=t,Tl.current=null}function Sc(e){var t=e;do{var n=t.alternate;if(e=t.return,0==(32768&t.flags)){if(null!==(n=Ka(n,t,Ol)))return void(Al=n)}else{if(null!==(n=Ga(n,t)))return n.flags&=32767,void(Al=n);if(null===e)return Nl=6,void(Al=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(Al=t);Al=t=e}while(null!==t);0===Nl&&(Nl=5)}function wc(e,t,n){var i=yt,r=xl.transition;try{xl.transition=null,yt=1,function(e,t,n,i){do{Cc()}while(null!==Gl);if(0!=(6&Il))throw Error(o(327));n=e.finishedWork;var r=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(o(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var i=e.eventTimes;for(e=e.expirationTimes;0<n;){var r=31-st(n),o=1<<r;t[r]=0,i[r]=-1,e[r]=-1,n&=~o}}(e,s),e===Ml&&(Al=Ml=null,Pl=0),0==(2064&n.subtreeFlags)&&0==(2064&n.flags)||Kl||(Kl=!0,Mc(tt,(function(){return Cc(),null}))),s=0!=(15990&n.flags),0!=(15990&n.subtreeFlags)||s){s=xl.transition,xl.transition=null;var a=yt;yt=1;var l=Il;Il|=4,Tl.current=null,function(e,t){if(er=Wt,pi(e=hi())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var i=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(i&&0!==i.rangeCount){n=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{n.nodeType,s.nodeType}catch(e){n=null;break e}var a=0,l=-1,c=-1,d=0,u=0,h=e,p=null;t:for(;;){for(var f;h!==n||0!==r&&3!==h.nodeType||(l=a+r),h!==s||0!==i&&3!==h.nodeType||(c=a+i),3===h.nodeType&&(a+=h.nodeValue.length),null!==(f=h.firstChild);)p=h,h=f;for(;;){if(h===e)break t;if(p===n&&++d===r&&(l=a),p===s&&++u===i&&(c=a),null!==(f=h.nextSibling))break;p=(h=p).parentNode}h=f}n=-1===l||-1===c?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(tr={focusedElem:e,selectionRange:n},Wt=!1,Za=t;null!==Za;)if(e=(t=Za).child,0!=(1028&t.subtreeFlags)&&null!==e)e.return=t,Za=e;else for(;null!==Za;){t=Za;try{var m=t.alternate;if(0!=(1024&t.flags))switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==m){var g=m.memoizedProps,v=m.memoizedState,b=t.stateNode,y=b.getSnapshotBeforeUpdate(t.elementType===t.type?g:vo(t.type,g),v);b.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var S=t.stateNode.containerInfo;1===S.nodeType?S.textContent="":9===S.nodeType&&S.documentElement&&S.removeChild(S.documentElement);break;default:throw Error(o(163))}}catch(e){Ec(t,t.return,e)}if(null!==(e=t.sibling)){e.return=t.return,Za=e;break}Za=t.return}m=tl,tl=!1}(e,n),gl(n,e),fi(tr),Wt=!!er,tr=er=null,e.current=n,bl(n,e,r),Qe(),Il=l,yt=a,xl.transition=s}else e.current=n;if(Kl&&(Kl=!1,Gl=e,Jl=r),0===(s=e.pendingLanes)&&(ql=null),function(e){if(ot&&"function"==typeof ot.onCommitFiberRoot)try{ot.onCommitFiberRoot(rt,e,void 0,128==(128&e.current.flags))}catch(e){}}(n.stateNode),ic(e,Ye()),null!==t)for(i=e.onRecoverableError,n=0;n<t.length;n++)i((r=t[n]).value,{componentStack:r.stack,digest:r.digest});if(Wl)throw Wl=!1,e=Hl,Hl=null,e;0!=(1&Jl)&&0!==e.tag&&Cc(),0!=(1&(s=e.pendingLanes))?e===Yl?Ql++:(Ql=0,Yl=e):Ql=0,zr()}(e,t,n,i)}finally{xl.transition=r,yt=i}return null}function Cc(){if(null!==Gl){var e=St(Jl),t=xl.transition,n=yt;try{if(xl.transition=null,yt=16>e?16:e,null===Gl)var i=!1;else{if(e=Gl,Gl=null,Jl=0,0!=(6&Il))throw Error(o(331));var r=Il;for(Il|=4,Za=e.current;null!==Za;){var s=Za,a=s.child;if(0!=(16&Za.flags)){var l=s.deletions;if(null!==l){for(var c=0;c<l.length;c++){var d=l[c];for(Za=d;null!==Za;){var u=Za;switch(u.tag){case 0:case 11:case 15:nl(8,u,s)}var h=u.child;if(null!==h)h.return=u,Za=h;else for(;null!==Za;){var p=(u=Za).sibling,f=u.return;if(ol(u),u===d){Za=null;break}if(null!==p){p.return=f,Za=p;break}Za=f}}}var m=s.alternate;if(null!==m){var g=m.child;if(null!==g){m.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(null!==g)}}Za=s}}if(0!=(2064&s.subtreeFlags)&&null!==a)a.return=s,Za=a;else e:for(;null!==Za;){if(0!=(2048&(s=Za).flags))switch(s.tag){case 0:case 11:case 15:nl(9,s,s.return)}var b=s.sibling;if(null!==b){b.return=s.return,Za=b;break e}Za=s.return}}var y=e.current;for(Za=y;null!==Za;){var S=(a=Za).child;if(0!=(2064&a.subtreeFlags)&&null!==S)S.return=a,Za=S;else e:for(a=y;null!==Za;){if(0!=(2048&(l=Za).flags))try{switch(l.tag){case 0:case 11:case 15:il(9,l)}}catch(e){Ec(l,l.return,e)}if(l===a){Za=null;break e}var w=l.sibling;if(null!==w){w.return=l.return,Za=w;break e}Za=l.return}}if(Il=r,zr(),ot&&"function"==typeof ot.onPostCommitFiberRoot)try{ot.onPostCommitFiberRoot(rt,e)}catch(e){}i=!0}return i}finally{yt=n,xl.transition=t}}return!1}function kc(e,t,n){e=Do(e,t=fa(0,t=da(n,t),1),1),t=ec(),null!==e&&(vt(e,1,t),ic(e,t))}function Ec(e,t,n){if(3===e.tag)kc(e,e,n);else for(;null!==t;){if(3===t.tag){kc(t,e,n);break}if(1===t.tag){var i=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof i.componentDidCatch&&(null===ql||!ql.has(i))){t=Do(t,e=ma(t,e=da(n,e),1),1),e=ec(),null!==t&&(vt(t,1,e),ic(t,e));break}}t=t.return}}function _c(e,t,n){var i=e.pingCache;null!==i&&i.delete(t),t=ec(),e.pingedLanes|=e.suspendedLanes&n,Ml===e&&(Pl&n)===n&&(4===Nl||3===Nl&&(130023424&Pl)===Pl&&500>Ye()-jl?hc(e,0):Bl|=n),ic(e,t)}function Tc(e,t){0===t&&(0==(1&e.mode)?t=1:(t=dt,0==(130023424&(dt<<=1))&&(dt=4194304)));var n=ec();null!==(e=Ao(e,t))&&(vt(e,t,n),ic(e,n))}function xc(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Tc(e,n)}function Ic(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,r=e.memoizedState;null!==r&&(n=r.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(o(314))}null!==i&&i.delete(t),Tc(e,n)}function Mc(e,t){return Ke(e,t)}function Ac(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pc(e,t,n,i){return new Ac(e,t,n,i)}function Oc(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Rc(e,t){var n=e.alternate;return null===n?((n=Pc(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Nc(e,t,n,i,r,s){var a=2;if(i=e,"function"==typeof e)Oc(e)&&(a=1);else if("string"==typeof e)a=5;else e:switch(e){case k:return Dc(n.children,r,s,t);case E:a=8,r|=8;break;case _:return(e=Pc(12,n,t,2|r)).elementType=_,e.lanes=s,e;case M:return(e=Pc(13,n,t,r)).elementType=M,e.lanes=s,e;case A:return(e=Pc(19,n,t,r)).elementType=A,e.lanes=s,e;case R:return Fc(n,r,s,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case T:a=10;break e;case x:a=9;break e;case I:a=11;break e;case P:a=14;break e;case O:a=16,i=null;break e}throw Error(o(130,null==e?e:typeof e,""))}return(t=Pc(a,n,t,r)).elementType=e,t.type=i,t.lanes=s,t}function Dc(e,t,n,i){return(e=Pc(7,e,i,t)).lanes=n,e}function Fc(e,t,n,i){return(e=Pc(22,e,i,t)).elementType=R,e.lanes=n,e.stateNode={isHidden:!1},e}function Lc(e,t,n){return(e=Pc(6,e,null,t)).lanes=n,e}function Bc(e,t,n){return(t=Pc(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Uc(e,t,n,i,r){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gt(0),this.expirationTimes=gt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gt(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function Vc(e,t,n,i,r,o,s,a,l){return e=new Uc(e,t,n,a,l),1===t?(t=1,!0===o&&(t|=8)):t=0,o=Pc(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:i,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Oo(o),e}function jc(e,t,n){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:C,key:null==i?null:""+i,children:e,containerInfo:t,implementation:n}}function zc(e){if(!e)return xr;e:{if(ze(e=e._reactInternals)!==e||1!==e.tag)throw Error(o(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Or(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(o(171))}if(1===e.tag){var n=e.type;if(Or(n))return Dr(e,n,t)}return t}function $c(e,t,n,i,r,o,s,a,l){return(e=Vc(n,i,!0,e,0,o,0,a,l)).context=zc(null),n=e.current,(o=No(i=ec(),r=tc(n))).callback=null!=t?t:null,Do(n,o,r),e.current.lanes=r,vt(e,r,i),ic(e,i),e}function Wc(e,t,n,i){var r=t.current,o=ec(),s=tc(r);return n=zc(n),null===t.context?t.context=n:t.pendingContext=n,(t=No(o,s)).payload={element:e},null!==(i=void 0===i?null:i)&&(t.callback=i),null!==(e=Do(r,t,s))&&(nc(e,r,s,o),Fo(e,r,s)),s}function Hc(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function qc(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Kc(e,t){qc(e,t),(e=e.alternate)&&qc(e,t)}kl=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||Mr.current)Sa=!0;else{if(0==(e.lanes&n)&&0==(128&t.flags))return Sa=!1,function(e,t,n){switch(t.tag){case 3:Aa(t),fo();break;case 5:ss(t);break;case 1:Or(t.type)&&Fr(t);break;case 4:rs(t,t.stateNode.containerInfo);break;case 10:var i=t.type._context,r=t.memoizedProps.value;Tr(bo,i._currentValue),i._currentValue=r;break;case 13:if(null!==(i=t.memoizedState))return null!==i.dehydrated?(Tr(ls,1&ls.current),t.flags|=128,null):0!=(n&t.child.childLanes)?La(e,t,n):(Tr(ls,1&ls.current),null!==(e=Wa(e,t,n))?e.sibling:null);Tr(ls,1&ls.current);break;case 19:if(i=0!=(n&t.childLanes),0!=(128&e.flags)){if(i)return za(e,t,n);t.flags|=128}if(null!==(r=t.memoizedState)&&(r.rendering=null,r.tail=null,r.lastEffect=null),Tr(ls,ls.current),i)break;return null;case 22:case 23:return t.lanes=0,_a(e,t,n)}return Wa(e,t,n)}(e,t,n);Sa=0!=(131072&e.flags)}else Sa=!1,ro&&0!=(1048576&t.flags)&&Xr(t,qr,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;$a(e,t),e=t.pendingProps;var r=Pr(t,Ir.current);_o(t,n),r=Es(null,t,i,e,r,n);var s=_s();return t.flags|=1,"object"==typeof r&&null!==r&&"function"==typeof r.render&&void 0===r.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Or(i)?(s=!0,Fr(t)):s=!1,t.memoizedState=null!==r.state&&void 0!==r.state?r.state:null,Oo(t),r.updater=zo,t.stateNode=r,r._reactInternals=t,qo(t,i,e,n),t=Ma(null,t,i,!0,s,n)):(t.tag=0,ro&&s&&eo(t),wa(null,t,r,n),t=t.child),t;case 16:i=t.elementType;e:{switch($a(e,t),e=t.pendingProps,i=(r=i._init)(i._payload),t.type=i,r=t.tag=function(e){if("function"==typeof e)return Oc(e)?1:0;if(null!=e){if((e=e.$$typeof)===I)return 11;if(e===P)return 14}return 2}(i),e=vo(i,e),r){case 0:t=xa(null,t,i,e,n);break e;case 1:t=Ia(null,t,i,e,n);break e;case 11:t=Ca(null,t,i,e,n);break e;case 14:t=ka(null,t,i,vo(i.type,e),n);break e}throw Error(o(306,i,""))}return t;case 0:return i=t.type,r=t.pendingProps,xa(e,t,i,r=t.elementType===i?r:vo(i,r),n);case 1:return i=t.type,r=t.pendingProps,Ia(e,t,i,r=t.elementType===i?r:vo(i,r),n);case 3:e:{if(Aa(t),null===e)throw Error(o(387));i=t.pendingProps,r=(s=t.memoizedState).element,Ro(e,t),Bo(t,i,null,n);var a=t.memoizedState;if(i=a.element,s.isDehydrated){if(s={element:i,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,256&t.flags){t=Pa(e,t,i,n,r=da(Error(o(423)),t));break e}if(i!==r){t=Pa(e,t,i,n,r=da(Error(o(424)),t));break e}for(io=cr(t.stateNode.containerInfo.firstChild),no=t,ro=!0,oo=null,n=Zo(t,null,i,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(fo(),i===r){t=Wa(e,t,n);break e}wa(e,t,i,n)}t=t.child}return t;case 5:return ss(t),null===e&&co(t),i=t.type,r=t.pendingProps,s=null!==e?e.memoizedProps:null,a=r.children,nr(i,r)?a=null:null!==s&&nr(i,s)&&(t.flags|=32),Ta(e,t),wa(e,t,a,n),t.child;case 6:return null===e&&co(t),null;case 13:return La(e,t,n);case 4:return rs(t,t.stateNode.containerInfo),i=t.pendingProps,null===e?t.child=Yo(t,null,i,n):wa(e,t,i,n),t.child;case 11:return i=t.type,r=t.pendingProps,Ca(e,t,i,r=t.elementType===i?r:vo(i,r),n);case 7:return wa(e,t,t.pendingProps,n),t.child;case 8:case 12:return wa(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(i=t.type._context,r=t.pendingProps,s=t.memoizedProps,a=r.value,Tr(bo,i._currentValue),i._currentValue=a,null!==s)if(ai(s.value,a)){if(s.children===r.children&&!Mr.current){t=Wa(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var l=s.dependencies;if(null!==l){a=s.child;for(var c=l.firstContext;null!==c;){if(c.context===i){if(1===s.tag){(c=No(-1,n&-n)).tag=2;var d=s.updateQueue;if(null!==d){var u=(d=d.shared).pending;null===u?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}s.lanes|=n,null!==(c=s.alternate)&&(c.lanes|=n),Eo(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(10===s.tag)a=s.type===t.type?null:s.child;else if(18===s.tag){if(null===(a=s.return))throw Error(o(341));a.lanes|=n,null!==(l=a.alternate)&&(l.lanes|=n),Eo(a,n,t),a=s.sibling}else a=s.child;if(null!==a)a.return=s;else for(a=s;null!==a;){if(a===t){a=null;break}if(null!==(s=a.sibling)){s.return=a.return,a=s;break}a=a.return}s=a}wa(e,t,r.children,n),t=t.child}return t;case 9:return r=t.type,i=t.pendingProps.children,_o(t,n),i=i(r=To(r)),t.flags|=1,wa(e,t,i,n),t.child;case 14:return r=vo(i=t.type,t.pendingProps),ka(e,t,i,r=vo(i.type,r),n);case 15:return Ea(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,r=t.pendingProps,r=t.elementType===i?r:vo(i,r),$a(e,t),t.tag=1,Or(i)?(e=!0,Fr(t)):e=!1,_o(t,n),Wo(t,i,r),qo(t,i,r,n),Ma(null,t,i,!0,e,n);case 19:return za(e,t,n);case 22:return _a(e,t,n)}throw Error(o(156,t.tag))};var Gc="function"==typeof reportError?reportError:function(e){console.error(e)};function Jc(e){this._internalRoot=e}function Qc(e){this._internalRoot=e}function Yc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Zc(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Xc(){}function ed(e,t,n,i,r){var o=n._reactRootContainer;if(o){var s=o;if("function"==typeof r){var a=r;r=function(){var e=Hc(s);a.call(e)}}Wc(t,s,e,r)}else s=function(e,t,n,i,r){if(r){if("function"==typeof i){var o=i;i=function(){var e=Hc(s);o.call(e)}}var s=$c(t,i,e,0,null,!1,0,"",Xc);return e._reactRootContainer=s,e[fr]=s.current,zi(8===e.nodeType?e.parentNode:e),dc(),s}for(;r=e.lastChild;)e.removeChild(r);if("function"==typeof i){var a=i;i=function(){var e=Hc(l);a.call(e)}}var l=Vc(e,0,!1,null,0,!1,0,"",Xc);return e._reactRootContainer=l,e[fr]=l.current,zi(8===e.nodeType?e.parentNode:e),dc((function(){Wc(t,l,n,i)})),l}(n,t,e,r,i);return Hc(s)}Qc.prototype.render=Jc.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(o(409));Wc(e,t,null,null)},Qc.prototype.unmount=Jc.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;dc((function(){Wc(null,e,null,null)})),t[fr]=null}},Qc.prototype.unstable_scheduleHydration=function(e){if(e){var t=Et();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Rt.length&&0!==t&&t<Rt[n].priority;n++);Rt.splice(n,0,e),0===n&&Lt(e)}},wt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ut(t.pendingLanes);0!==n&&(bt(t,1|n),ic(t,Ye()),0==(6&Il)&&(zl=Ye()+500,zr()))}break;case 13:dc((function(){var t=Ao(e,1);if(null!==t){var n=ec();nc(t,e,1,n)}})),Kc(e,1)}},Ct=function(e){if(13===e.tag){var t=Ao(e,134217728);null!==t&&nc(t,e,134217728,ec()),Kc(e,134217728)}},kt=function(e){if(13===e.tag){var t=tc(e),n=Ao(e,t);null!==n&&nc(n,e,t,ec()),Kc(e,t)}},Et=function(){return yt},_t=function(e,t){var n=yt;try{return yt=e,t()}finally{yt=n}},Ce=function(e,t,n){switch(t){case"input":if(Z(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var r=wr(i);if(!r)throw Error(o(90));K(i),Z(i,r)}}}break;case"textarea":oe(e,n);break;case"select":null!=(t=n.value)&&ne(e,!!n.multiple,t,!1)}},Ie=cc,Me=dc;var td={usingClientEntryPoint:!1,Events:[yr,Sr,wr,Te,xe,cc]},nd={findFiberByHostInstance:br,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},id={bundleType:nd.bundleType,version:nd.version,rendererPackageName:nd.rendererPackageName,rendererConfig:nd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:S.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=He(e))?null:e.stateNode},findFiberByHostInstance:nd.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var rd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rd.isDisabled&&rd.supportsFiber)try{rt=rd.inject(id),ot=rd}catch(de){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=td,t.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Yc(t))throw Error(o(200));return jc(e,t,null,n)},t.createRoot=function(e,t){if(!Yc(e))throw Error(o(299));var n=!1,i="",r=Gc;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(i=t.identifierPrefix),void 0!==t.onRecoverableError&&(r=t.onRecoverableError)),t=Vc(e,1,!1,null,0,n,0,i,r),e[fr]=t.current,zi(8===e.nodeType?e.parentNode:e),new Jc(t)},t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(o(188));throw e=Object.keys(e).join(","),Error(o(268,e))}return null===(e=He(t))?null:e.stateNode},t.flushSync=function(e){return dc(e)},t.hydrate=function(e,t,n){if(!Zc(t))throw Error(o(200));return ed(null,e,t,!0,n)},t.hydrateRoot=function(e,t,n){if(!Yc(e))throw Error(o(405));var i=null!=n&&n.hydratedSources||null,r=!1,s="",a=Gc;if(null!=n&&(!0===n.unstable_strictMode&&(r=!0),void 0!==n.identifierPrefix&&(s=n.identifierPrefix),void 0!==n.onRecoverableError&&(a=n.onRecoverableError)),t=$c(t,null,e,1,null!=n?n:null,r,0,s,a),e[fr]=t.current,zi(e),i)for(e=0;e<i.length;e++)r=(r=(n=i[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,r]:t.mutableSourceEagerHydrationData.push(n,r);return new Qc(t)},t.render=function(e,t,n){if(!Zc(t))throw Error(o(200));return ed(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!Zc(e))throw Error(o(40));return!!e._reactRootContainer&&(dc((function(){ed(null,null,e,!1,(function(){e._reactRootContainer=null,e[fr]=null}))})),!0)},t.unstable_batchedUpdates=cc,t.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!Zc(n))throw Error(o(200));if(null==e||void 0===e._reactInternals)throw Error(o(38));return ed(e,t,n,!1,i)},t.version="18.2.0-next-9e3b772b8-20220608"},745:(e,t,n)=>{"use strict";var i=n(935);t.s=i.createRoot,i.hydrateRoot},935:(e,t,n)=>{"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(448)},408:(e,t)=>{"use strict";var n=Symbol.for("react.element"),i=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator,f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,g={};function v(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||f}function b(){}function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||f}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=v.prototype;var S=y.prototype=new b;S.constructor=y,m(S,v.prototype),S.isPureReactComponent=!0;var w=Array.isArray,C=Object.prototype.hasOwnProperty,k={current:null},E={key:!0,ref:!0,__self:!0,__source:!0};function _(e,t,i){var r,o={},s=null,a=null;if(null!=t)for(r in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(s=""+t.key),t)C.call(t,r)&&!E.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(1===l)o.children=i;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];o.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps)void 0===o[r]&&(o[r]=l[r]);return{$$typeof:n,type:e,key:s,ref:a,props:o,_owner:k.current}}function T(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var x=/\/+/g;function I(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function M(e,t,r,o,s){var a=typeof e;"undefined"!==a&&"boolean"!==a||(e=null);var l=!1;if(null===e)l=!0;else switch(a){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case n:case i:l=!0}}if(l)return s=s(l=e),e=""===o?"."+I(l,0):o,w(s)?(r="",null!=e&&(r=e.replace(x,"$&/")+"/"),M(s,t,r,"",(function(e){return e}))):null!=s&&(T(s)&&(s=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(s,r+(!s.key||l&&l.key===s.key?"":(""+s.key).replace(x,"$&/")+"/")+e)),t.push(s)),1;if(l=0,o=""===o?".":o+":",w(e))for(var c=0;c<e.length;c++){var d=o+I(a=e[c],c);l+=M(a,t,r,d,s)}else if(d=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof d)for(e=d.call(e),c=0;!(a=e.next()).done;)l+=M(a=a.value,t,r,d=o+I(a,c++),s);else if("object"===a)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return l}function A(e,t,n){if(null==e)return e;var i=[],r=0;return M(e,i,"","",(function(e){return t.call(n,e,r++)})),i}function P(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var O={current:null},R={transition:null},N={ReactCurrentDispatcher:O,ReactCurrentBatchConfig:R,ReactCurrentOwner:k};t.Children={map:A,forEach:function(e,t,n){A(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return A(e,(function(){t++})),t},toArray:function(e){return A(e,(function(e){return e}))||[]},only:function(e){if(!T(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=v,t.Fragment=r,t.Profiler=s,t.PureComponent=y,t.StrictMode=o,t.Suspense=d,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=N,t.cloneElement=function(e,t,i){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=m({},e.props),o=e.key,s=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(s=t.ref,a=k.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)C.call(t,c)&&!E.hasOwnProperty(c)&&(r[c]=void 0===t[c]&&void 0!==l?l[c]:t[c])}var c=arguments.length-2;if(1===c)r.children=i;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:n,type:e.type,key:o,ref:s,props:r,_owner:a}},t.createContext=function(e){return(e={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:a,_context:e},e.Consumer=e},t.createElement=_,t.createFactory=function(e){var t=_.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:c,render:e}},t.isValidElement=T,t.lazy=function(e){return{$$typeof:h,_payload:{_status:-1,_result:e},_init:P}},t.memo=function(e,t){return{$$typeof:u,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=R.transition;R.transition={};try{e()}finally{R.transition=t}},t.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},t.useCallback=function(e,t){return O.current.useCallback(e,t)},t.useContext=function(e){return O.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return O.current.useDeferredValue(e)},t.useEffect=function(e,t){return O.current.useEffect(e,t)},t.useId=function(){return O.current.useId()},t.useImperativeHandle=function(e,t,n){return O.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return O.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return O.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return O.current.useMemo(e,t)},t.useReducer=function(e,t,n){return O.current.useReducer(e,t,n)},t.useRef=function(e){return O.current.useRef(e)},t.useState=function(e){return O.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return O.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return O.current.useTransition()},t.version="18.2.0"},294:(e,t,n)=>{"use strict";e.exports=n(408)},53:(e,t)=>{"use strict";function n(e,t){var n=e.length;e.push(t);e:for(;0<n;){var i=n-1>>>1,r=e[i];if(!(0<o(r,t)))break e;e[i]=t,e[n]=r,n=i}}function i(e){return 0===e.length?null:e[0]}function r(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var i=0,r=e.length,s=r>>>1;i<s;){var a=2*(i+1)-1,l=e[a],c=a+1,d=e[c];if(0>o(l,n))c<r&&0>o(d,l)?(e[i]=d,e[c]=n,i=c):(e[i]=l,e[a]=n,i=a);else{if(!(c<r&&0>o(d,n)))break e;e[i]=d,e[c]=n,i=c}}}return t}function o(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var c=[],d=[],u=1,h=null,p=3,f=!1,m=!1,g=!1,v="function"==typeof setTimeout?setTimeout:null,b="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function S(e){for(var t=i(d);null!==t;){if(null===t.callback)r(d);else{if(!(t.startTime<=e))break;r(d),t.sortIndex=t.expirationTime,n(c,t)}t=i(d)}}function w(e){if(g=!1,S(e),!m)if(null!==i(c))m=!0,R(C);else{var t=i(d);null!==t&&N(w,t.startTime-e)}}function C(e,n){m=!1,g&&(g=!1,b(T),T=-1),f=!0;var o=p;try{for(S(n),h=i(c);null!==h&&(!(h.expirationTime>n)||e&&!M());){var s=h.callback;if("function"==typeof s){h.callback=null,p=h.priorityLevel;var a=s(h.expirationTime<=n);n=t.unstable_now(),"function"==typeof a?h.callback=a:h===i(c)&&r(c),S(n)}else r(c);h=i(c)}if(null!==h)var l=!0;else{var u=i(d);null!==u&&N(w,u.startTime-n),l=!1}return l}finally{h=null,p=o,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var k,E=!1,_=null,T=-1,x=5,I=-1;function M(){return!(t.unstable_now()-I<x)}function A(){if(null!==_){var e=t.unstable_now();I=e;var n=!0;try{n=_(!0,e)}finally{n?k():(E=!1,_=null)}}else E=!1}if("function"==typeof y)k=function(){y(A)};else if("undefined"!=typeof MessageChannel){var P=new MessageChannel,O=P.port2;P.port1.onmessage=A,k=function(){O.postMessage(null)}}else k=function(){v(A,0)};function R(e){_=e,E||(E=!0,k())}function N(e,n){T=v((function(){e(t.unstable_now())}),n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){m||f||(m=!0,R(C))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):x=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return i(c)},t.unstable_next=function(e){switch(p){case 1:case 2:case 3:var t=3;break;default:t=p}var n=p;p=t;try{return e()}finally{p=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=p;p=e;try{return t()}finally{p=n}},t.unstable_scheduleCallback=function(e,r,o){var s=t.unstable_now();switch(o="object"==typeof o&&null!==o&&"number"==typeof(o=o.delay)&&0<o?s+o:s,e){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return e={id:u++,callback:r,priorityLevel:e,startTime:o,expirationTime:a=o+a,sortIndex:-1},o>s?(e.sortIndex=o,n(d,e),null===i(c)&&e===i(d)&&(g?(b(T),T=-1):g=!0,N(w,o-s))):(e.sortIndex=a,n(c,e),m||f||(m=!0,R(C))),e},t.unstable_shouldYield=M,t.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}},840:(e,t,n)=>{"use strict";e.exports=n(53)},379:e=>{"use strict";var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var o={},s=[],a=0;a<e.length;a++){var l=e[a],c=i.base?l[0]+i.base:l[0],d=o[c]||0,u="".concat(c," ").concat(d);o[c]=d+1;var h=n(u),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==h)t[h].references++,t[h].updater(p);else{var f=r(p,i);i.byIndex=a,t.splice(a,0,{identifier:u,updater:f,references:1})}s.push(u)}return s}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var o=i(e=e||[],r=r||{});return function(e){e=e||[];for(var s=0;s<o.length;s++){var a=n(o[s]);t[a].references--}for(var l=i(e,r),c=0;c<o.length;c++){var d=n(o[c]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}o=l}}},569:e=>{"use strict";var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},565:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},795:e=>{"use strict";e.exports=function(e){var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},61:(e,t,n)=>{var i=n(698).default;function r(){"use strict";e.exports=r=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,o=n.hasOwnProperty,s=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",d=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function h(e,t,n,i){var r=t&&t.prototype instanceof m?t:m,o=Object.create(r.prototype),a=new I(i||[]);return s(o,"_invoke",{value:E(e,n,a)}),o}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var f={};function m(){}function g(){}function v(){}var b={};u(b,l,(function(){return this}));var y=Object.getPrototypeOf,S=y&&y(y(M([])));S&&S!==n&&o.call(S,l)&&(b=S);var w=v.prototype=m.prototype=Object.create(b);function C(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(r,s,a,l){var c=p(e[r],e,s);if("throw"!==c.type){var d=c.arg,u=d.value;return u&&"object"==i(u)&&o.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(u).then((function(e){d.value=e,a(d)}),(function(e){return n("throw",e,a,l)}))}l(c.arg)}var r;s(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,r){n(e,i,t,r)}))}return r=r?r.then(o,o):o()}})}function E(e,t,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return{value:void 0,done:!0}}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=_(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=p(e,t,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function _(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var r=p(i,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,f;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function M(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return g.prototype=v,s(w,"constructor",{value:v,configurable:!0}),s(v,"constructor",{value:g,configurable:!0}),g.displayName=u(v,d,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,d,"GeneratorFunction")),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},C(k.prototype),u(k.prototype,c,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,r,o){void 0===o&&(o=Promise);var s=new k(h(e,n,i,r),o);return t.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},C(w),u(w,d,"Generator"),u(w,l,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=M,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return s.type="throw",s.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],s=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var a=o.call(r,"catchLoc"),l=o.call(r,"finallyLoc");if(a&&l){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&o.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var s=r?r.completion:{};return s.type=e,s.arg=t,r?(this.method="next",this.next=r.finallyLoc,f):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),x(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;x(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:M(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},698:e=>{function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},687:(e,t,n)=>{var i=n(61)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={id:e,exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.nc=void 0;var __webpack_exports__={};(()=>{"use strict";function e(e,t,n,i,r,o,s){try{var a=e[o](s),l=a.value}catch(e){return void n(e)}a.done?t(l):Promise.resolve(l).then(i,r)}function t(t){return function(){var n=this,i=arguments;return new Promise((function(r,o){var s=t.apply(n,i);function a(t){e(s,r,o,a,l,"next",t)}function l(t){e(s,r,o,a,l,"throw",t)}a(void 0)}))}}var n=__webpack_require__(687),i=__webpack_require__.n(n),r=__webpack_require__(294),o=__webpack_require__(745),s=__webpack_require__(379),a=__webpack_require__.n(s),l=__webpack_require__(795),c=__webpack_require__.n(l),d=__webpack_require__(569),u=__webpack_require__.n(d),h=__webpack_require__(565),p=__webpack_require__.n(h),f=__webpack_require__(216),m=__webpack_require__.n(f),g=__webpack_require__(589),v=__webpack_require__.n(g),b=__webpack_require__(90),y={};function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function w(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,s,a=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(a.push(i.value),a.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw r}}return a}}(e,t)||w(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}y.styleTagTransform=v(),y.setAttributes=p(),y.insert=u().bind(null,"head"),y.domAPI=c(),y.insertStyleElement=m(),a()(b.Z,y),b.Z&&b.Z.locals&&b.Z.locals;var k="audio-result",E="audio-test-original",_="audio-test-converted",T="audio-test-converted-echoback";function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function I(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==x(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==x(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===x(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var M=__webpack_require__(504);function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var O=function(){var e=t(i().mark((function e(){var t,n,r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.mediaDevices.getUserMedia({video:!1,audio:!0});case 3:e.sent.getTracks().forEach((function(e){e.stop()})),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.warn("Enumerate device error::",e.t0);case 10:return e.next=12,navigator.mediaDevices.enumerateDevices();case 12:return t=e.sent,(n=t.filter((function(e){return"audioinput"==e.kind}))).push({deviceId:"none",groupId:"none",kind:"audioinput",label:"none",toJSON:function(){}}),n.push({deviceId:"file",groupId:"file",kind:"audioinput",label:"file",toJSON:function(){}}),r=t.filter((function(e){return"audiooutput"==e.kind})),e.abrupt("return",[n,r]);case 18:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function D(e){return function(e){if(Array.isArray(e))return S(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||w(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var F=document.getElementById("app"),L=function(){var e,n,o,s,a,l,c,d,u,h,p,f,m,g,v=(a=C((0,r.useState)(null),2),l=a[0],c=a[1],d=(0,M.useClient)({audioContext:l,audioOutputElementId:k}),e={clientState:d},n=(0,r.useMemo)((function(){var n,o,s,a=function(){var n=t(i().mark((function t(){var n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,M.fileSelector)("");case 2:if(0!=(n=t.sent).name.endsWith(".pth")){t.next=6;break}return alert("モデルファイルの拡張子はpthである必要があります。"),t.abrupt("return");case 6:e.clientState.serverSetting.setFileUploadSetting(P(P({},e.clientState.serverSetting.fileUploadSetting),{},{pyTorchModel:n}));case 7:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}(),l=function(){var n=t(i().mark((function t(){var n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,M.fileSelector)("");case 2:if(0!=(n=t.sent).name.endsWith(".json")){t.next=6;break}return alert("モデルファイルの拡張子はjsonである必要があります。"),t.abrupt("return");case 6:e.clientState.serverSetting.setFileUploadSetting(P(P({},e.clientState.serverSetting.fileUploadSetting),{},{configFile:n}));case 7:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}(),c=function(){var n=t(i().mark((function t(){var n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,M.fileSelector)("");case 2:if(0!=(n=t.sent).name.endsWith(".onnx")){t.next=6;break}return alert("モデルファイルの拡張子はonnxである必要があります。"),t.abrupt("return");case 6:e.clientState.serverSetting.setFileUploadSetting(P(P({},e.clientState.serverSetting.fileUploadSetting),{},{onnxModel:n}));case 7:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}(),d=function(){var n=t(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.clientState.serverSetting.loadModel();case 1:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}(),u=e.clientState.serverSetting.isUploading?"body-button-disabled":"body-button",h=e.clientState.serverSetting.isUploading?function(){}:d,p=e.clientState.serverSetting.isUploading?"wait...":"upload";return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row split-3-3-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Model Uploader"),r.createElement("div",{className:"body-item-text"},r.createElement("div",null)),r.createElement("div",{className:"body-item-text"},r.createElement("div",null))),r.createElement("div",{className:"body-row split-3-3-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-2"},"Config(.json)"),r.createElement("div",{className:"body-item-text"},r.createElement("div",null,null===(n=e.clientState.serverSetting.fileUploadSetting.configFile)||void 0===n?void 0:n.name)),r.createElement("div",{className:"body-button-container"},r.createElement("div",{className:"body-button",onClick:l},"select"),r.createElement("div",{className:"body-button left-margin-1",onClick:function(){e.clientState.serverSetting.setFileUploadSetting(P(P({},e.clientState.serverSetting.fileUploadSetting),{},{configFile:null}))}},"clear"))),r.createElement("div",{className:"body-row split-3-3-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-2"},"PyTorch(.pth)"),r.createElement("div",{className:"body-item-text"},r.createElement("div",null,null===(o=e.clientState.serverSetting.fileUploadSetting.pyTorchModel)||void 0===o?void 0:o.name)),r.createElement("div",{className:"body-button-container"},r.createElement("div",{className:"body-button",onClick:a},"select"),r.createElement("div",{className:"body-button left-margin-1",onClick:function(){e.clientState.serverSetting.setFileUploadSetting(P(P({},e.clientState.serverSetting.fileUploadSetting),{},{pyTorchModel:null}))}},"clear"))),r.createElement("div",{className:"body-row split-3-3-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-2"},"Onnx(.onnx)"),r.createElement("div",{className:"body-item-text"},r.createElement("div",null,null===(s=e.clientState.serverSetting.fileUploadSetting.onnxModel)||void 0===s?void 0:s.name)),r.createElement("div",{className:"body-button-container"},r.createElement("div",{className:"body-button",onClick:c},"select"),r.createElement("div",{className:"body-button left-margin-1",onClick:function(){e.clientState.serverSetting.setFileUploadSetting(P(P({},e.clientState.serverSetting.fileUploadSetting),{},{onnxModel:null}))}},"clear"))),r.createElement("div",{className:"body-row split-3-3-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-2"}),r.createElement("div",{className:"body-item-text"},e.clientState.serverSetting.isUploading?"uploading.... ".concat(e.clientState.serverSetting.uploadProgress,"%"):""),r.createElement("div",{className:"body-button-container"},r.createElement("div",{className:u,onClick:h},p))))}),[e.clientState.serverSetting.fileUploadSetting,e.clientState.serverSetting.loadModel,e.clientState.serverSetting.isUploading,e.clientState.serverSetting.uploadProgress]),o=(0,r.useMemo)((function(){var n=function(){var n=t(i().mark((function t(n){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.clientState.serverSetting.setFramework(n);case 1:case"end":return t.stop()}}),t)})));return function(e){return n.apply(this,arguments)}}();return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Framework"),r.createElement("div",{className:"body-select-container"},r.createElement("select",{className:"body-select",value:e.clientState.serverSetting.setting.framework,onChange:function(e){n(e.target.value)}},Object.values(M.Framework).map((function(e){return r.createElement("option",{key:e,value:e},e)})))))}),[e.clientState.serverSetting.setting.framework,e.clientState.serverSetting.setFramework]),s=(0,r.useMemo)((function(){if("ONNX"==e.clientState.serverSetting.setting.framework){var n=function(){var n=t(i().mark((function t(n){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.clientState.serverSetting.setOnnxExecutionProvider(n);case 1:case"end":return t.stop()}}),t)})));return function(e){return n.apply(this,arguments)}}();return r.createElement("div",{className:"body-row split-3-7 left-padding-1"},r.createElement("div",{className:"body-item-title left-padding-2"},"OnnxExecutionProvider"),r.createElement("div",{className:"body-select-container"},r.createElement("select",{className:"body-select",value:e.clientState.serverSetting.setting.onnxExecutionProvider,onChange:function(e){n(e.target.value)}},Object.values(M.OnnxExecutionProvider).map((function(e){return r.createElement("option",{key:e,value:e},e)})))))}}),[e.clientState.serverSetting.setting.framework,e.clientState.serverSetting.setting.onnxExecutionProvider,e.clientState.serverSetting.setOnnxExecutionProvider]),u={serverSetting:(0,r.useMemo)((function(){return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row split-3-7 left-padding-1"},r.createElement("div",{className:"body-sub-section-title"},"Server Setting"),r.createElement("div",{className:"body-select-container"})),n,o,s)}),[n,o,s])},h=function(e,n){var o=C((0,r.useState)([]),2),s=o[0],a=o[1],l=C((0,r.useState)([]),2),c=l[0],d=l[1],u=C((0,r.useState)("none"),2),h=u[0],p=u[1],f=C((0,r.useState)("none"),2),m=f[0],g=f[1],v=C((0,r.useState)(),2),b=v[0],y=v[1];(0,r.useEffect)((function(){var e=function(){var e=t(i().mark((function e(){var t;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O();case 2:t=e.sent,a(t[0]),d(t[1]);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();e()}),[]);var S=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"AudioInput"),r.createElement("div",{className:"body-select-container"},r.createElement("select",{className:"body-select",value:h,onChange:function(e){p(e.target.value)}},s.map((function(e){return r.createElement("option",{key:e.deviceId,value:e.deviceId},e.label)})))))}),[s,h]);(0,r.useEffect)((function(){if(e)if("none"==h){var t=(0,M.createDummyMediaStream)(e);n.clientState.clientSetting.setAudioInput(t)}else"file"==h||n.clientState.clientSetting.setAudioInput(h)}),[e,h,n.clientState.clientSetting.setAudioInput]);var w=(0,r.useMemo)((function(){if("file"!=h)return r.createElement(r.Fragment,null);var o=function(){var r=t(i().mark((function t(){var r,o,s,a,l,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,M.fileSelectorAsDataURL)("");case 2:return r=t.sent,(o=document.getElementById(_)).src=r,t.next=7,o.play();case 7:s=e.createMediaElementSource(o),a=e.createMediaStreamDestination(),s.connect(a),n.clientState.clientSetting.setAudioInput(a.stream),(l=document.getElementById(T)).srcObject=a.stream,l.play(),y(!1),(c=document.getElementById(E)).src=r,c.pause();case 18:case"end":return t.stop()}}),t)})));return function(){return r.apply(this,arguments)}}();return r.createElement("div",{className:"body-row split-3-3-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title"}),r.createElement("div",{className:"body-item-text"},r.createElement("div",{style:{display:"none"}},"org:",r.createElement("audio",{id:E,controls:!0})),r.createElement("div",null,r.createElement("audio",{id:_,controls:!0}),r.createElement("audio",{id:T,controls:!0,hidden:!0}))),r.createElement("div",{className:"body-button-container"},r.createElement("div",{className:"body-button",onClick:o},"load"),r.createElement("input",{type:"checkbox",checked:b,onChange:function(e){y(e.target.checked)}})," echoback"))}),[h,n.clientState.clientSetting.setAudioInput,b]),x=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"AudioOutput"),r.createElement("div",{className:"body-select-container"},r.createElement("select",{className:"body-select",value:m,onChange:function(e){g(e.target.value)}},c.map((function(e){return r.createElement("option",{key:e.deviceId,value:e.deviceId},e.label)}))),r.createElement("audio",{hidden:!0,id:k})))}),[c,m]);return(0,r.useEffect)((function(){"none"!=m&&[k,E,T].forEach((function(e){var t=document.getElementById(e);t&&t.setSinkId(m)}))}),[m]),(0,r.useEffect)((function(){[T].forEach((function(e){var t=document.getElementById(e);t&&(t.volume=b?1:0)}))}),[b]),{deviceSetting:(0,r.useMemo)((function(){return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row split-3-7 left-padding-1"},r.createElement("div",{className:"body-sub-section-title"},"Device Setting"),r.createElement("div",{className:"body-select-container"})),S,w,x)}),[S,w,x])}}(l,{clientState:d}),p=function(e){var n=C((0,r.useState)(0),2),o=n[0],s=n[1],a=C((0,r.useState)(""),2),l=a[0],c=a[1],d=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Source Speaker Id"),r.createElement("div",{className:"body-select-container"},r.createElement("select",{className:"body-select",value:e.clientState.serverSetting.setting.srcId,onChange:function(t){e.clientState.serverSetting.setSrcId(Number(t.target.value))}},e.clientState.clientSetting.setting.speakers.map((function(e){return r.createElement("option",{key:e.id,value:e.id},e.name,"(",e.id,")")})))))}),[e.clientState.clientSetting.setting.speakers,e.clientState.serverSetting.setting.srcId,e.clientState.serverSetting.setSrcId]),u=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Destination Speaker Id"),r.createElement("div",{className:"body-select-container"},r.createElement("select",{className:"body-select",value:e.clientState.serverSetting.setting.dstId,onChange:function(t){e.clientState.serverSetting.setDstId(Number(t.target.value))}},e.clientState.clientSetting.setting.speakers.map((function(e){return r.createElement("option",{key:e.id,value:e.id},e.name,"(",e.id,")")})))))}),[e.clientState.clientSetting.setting.speakers,e.clientState.serverSetting.setting.dstId,e.clientState.serverSetting.setDstId]),h=(0,r.useMemo)((function(){var n=function(){var n=t(i().mark((function t(){var n,r,s,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=o,r=l,(s=e.clientState.clientSetting.setting.speakers.find((function(e){return e.id==n})))?0==r.length?(a=e.clientState.clientSetting.setting.speakers.filter((function(e){return e.id!=n})),e.clientState.clientSetting.setSpeakers(a)):(s.name=r,e.clientState.clientSetting.setSpeakers(D(e.clientState.clientSetting.setting.speakers))):0==r.length||(e.clientState.clientSetting.setting.speakers.push({id:n,name:r}),e.clientState.clientSetting.setSpeakers(D(e.clientState.clientSetting.setting.speakers)));case 4:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}();return r.createElement("div",{className:"body-row split-3-1-2-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Edit Speaker Mapping"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"number",min:1,max:256,step:1,value:o,onChange:function(t){var n,i=Number(t.target.value);s(i),c((null===(n=e.clientState.clientSetting.setting.speakers.find((function(e){return e.id==i})))||void 0===n?void 0:n.name)||"")}})),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"text",value:l,onChange:function(e){c(e.target.value)}})),r.createElement("div",{className:"body-button-container"},r.createElement("div",{className:"body-button",onClick:n},"set")))}),[e.clientState.clientSetting.setting.speakers,o,l]);return{speakerSetting:(0,r.useMemo)((function(){return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row split-3-7 left-padding-1"},r.createElement("div",{className:"body-sub-section-title"},"Speaker Setting"),r.createElement("div",{className:"body-select-container"})),d,u,h)}),[d,u,h])}}({clientState:d}),f=function(e){var t=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Input Chunk Num(128sample/chunk)"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"number",min:1,max:256,step:1,value:e.clientState.clientSetting.setting.inputChunkNum,onChange:function(t){e.clientState.clientSetting.setInputChunkNum(Number(t.target.value))}})))}),[e.clientState.clientSetting.setting.inputChunkNum,e.clientState.clientSetting.setInputChunkNum]),n=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"GPU"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"number",min:-2,max:5,step:1,value:e.clientState.serverSetting.setting.gpu,onChange:function(t){e.clientState.serverSetting.setGpu(Number(t.target.value))}})))}),[e.clientState.serverSetting.setting.gpu,e.clientState.serverSetting.setGpu]);return{convertSetting:(0,r.useMemo)((function(){return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row split-3-7 left-padding-1"},r.createElement("div",{className:"body-sub-section-title"},"Converter Setting"),r.createElement("div",{className:"body-select-container"})),t,n)}),[t,n])}}({clientState:d}),m=function(e){var n=C((0,r.useState)(!1),2),o=n[0],s=n[1],a=(0,r.useMemo)((function(){var n=function(){var n=t(i().mark((function t(){var n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=document.getElementById("mmvc-server-url"),e.clientState.clientSetting.setServerUrl(n.value);case 2:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}();return r.createElement("div",{className:"body-row split-3-3-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"MMVC Server"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"text",defaultValue:e.clientState.clientSetting.setting.mmvcServerUrl,id:"mmvc-server-url",className:"body-item-input"})),r.createElement("div",{className:"body-button-container"},r.createElement("div",{className:"body-button",onClick:n},"set")))}),[e.clientState.clientSetting.setting.mmvcServerUrl,e.clientState.clientSetting.setServerUrl]),l=(0,r.useMemo)((function(){var n=function(){var n=t(i().mark((function t(n){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.clientState.clientSetting.setProtocol(n);case 1:case"end":return t.stop()}}),t)})));return function(e){return n.apply(this,arguments)}}();return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Protocol"),r.createElement("div",{className:"body-select-container"},r.createElement("select",{className:"body-select",value:e.clientState.clientSetting.setting.protocol,onChange:function(e){n(e.target.value)}},Object.values(M.Protocol).map((function(e){return r.createElement("option",{key:e,value:e},e)})))))}),[e.clientState.clientSetting.setting.protocol,e.clientState.clientSetting.setProtocol]),c=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Sample Rate"),r.createElement("div",{className:"body-select-container"},r.createElement("select",{className:"body-select",value:e.clientState.clientSetting.setting.sampleRate,onChange:function(t){e.clientState.clientSetting.setSampleRate(Number(t.target.value))}},Object.values(M.SampleRate).map((function(e){return r.createElement("option",{key:e,value:e},e)})))))}),[e.clientState.clientSetting.setting.sampleRate,e.clientState.clientSetting.setSampleRate]),d=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Buffer Size"),r.createElement("div",{className:"body-select-container"},r.createElement("select",{className:"body-select",value:e.clientState.clientSetting.setting.bufferSize,onChange:function(t){e.clientState.clientSetting.setBufferSize(Number(t.target.value))}},Object.values(M.BufferSize).map((function(e){return r.createElement("option",{key:e,value:e},e)})))))}),[e.clientState.clientSetting.setting.bufferSize,e.clientState.clientSetting.setBufferSize]),u=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Convert Chunk Num(128sample/chunk)"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"number",min:1,max:256,step:1,value:e.clientState.serverSetting.setting.convertChunkNum,onChange:function(t){e.clientState.serverSetting.setConvertChunkNum(Number(t.target.value))}})))}),[e.clientState.serverSetting.setting.convertChunkNum,e.clientState.serverSetting.setConvertChunkNum]),h=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Min Convert Size(byte)"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"number",min:0,max:8196,step:8196,value:e.clientState.serverSetting.setting.minConvertSize,onChange:function(t){e.clientState.serverSetting.setMinConvertSize(Number(t.target.value))}})))}),[e.clientState.serverSetting.setting.minConvertSize,e.clientState.serverSetting.setMinConvertSize]),p=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Cross Fade Overlap Rate"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"number",min:.1,max:1,step:.1,value:e.clientState.serverSetting.setting.crossFadeOverlapRate,onChange:function(t){e.clientState.serverSetting.setCrossFadeOverlapRate(Number(t.target.value))}})))}),[e.clientState.serverSetting.setting.crossFadeOverlapRate,e.clientState.serverSetting.setCrossFadeOverlapRate]),f=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Cross Fade Offset Rate"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"number",min:0,max:1,step:.1,value:e.clientState.serverSetting.setting.crossFadeOffsetRate,onChange:function(t){e.clientState.serverSetting.setCrossFadeOffsetRate(Number(t.target.value))}})))}),[e.clientState.serverSetting.setting.crossFadeOffsetRate,e.clientState.serverSetting.setCrossFadeOffsetRate]),m=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Cross Fade End Rate"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"number",min:0,max:1,step:.1,value:e.clientState.serverSetting.setting.crossFadeEndRate,onChange:function(t){e.clientState.serverSetting.setCrossFadeEndRate(Number(t.target.value))}})))}),[e.clientState.serverSetting.setting.crossFadeEndRate,e.clientState.serverSetting.setCrossFadeEndRate]),g=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-3-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1 "},"VF Disabled"),r.createElement("div",null,r.createElement("input",{type:"checkbox",checked:e.clientState.clientSetting.setting.forceVfDisable,onChange:function(t){e.clientState.clientSetting.setVfForceDisabled(t.target.checked)}})),r.createElement("div",{className:"body-button-container"}))}),[e.clientState.clientSetting.setting.forceVfDisable,e.clientState.clientSetting.setVfForceDisabled]),v=(0,r.useMemo)((function(){return r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1 "},"Voice Change Mode"),r.createElement("div",{className:"body-select-container"},r.createElement("select",{className:"body-select",value:e.clientState.clientSetting.setting.voiceChangerMode,onChange:function(t){e.clientState.clientSetting.setVoiceChangerMode(t.target.value)}},Object.values(M.VoiceChangerMode).map((function(e){return r.createElement("option",{key:e,value:e},e)})))))}),[e.clientState.clientSetting.setting.voiceChangerMode,e.clientState.clientSetting.setVoiceChangerMode]),b=(0,r.useMemo)((function(){return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Trancate Num"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"number",min:50,max:300,step:1,value:e.clientState.workletSetting.setting.numTrancateTreshold,onChange:function(t){e.clientState.workletSetting.setSetting(N(N({},e.clientState.workletSetting.setting),{},{numTrancateTreshold:Number(t.target.value)}))}}))),r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Trancate Vol"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"number",min:1e-4,max:9e-4,step:1e-4,value:e.clientState.workletSetting.setting.volTrancateThreshold,onChange:function(t){e.clientState.workletSetting.setSetting(N(N({},e.clientState.workletSetting.setting),{},{volTrancateThreshold:Number(t.target.value)}))}}))),r.createElement("div",{className:"body-row split-3-7 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Trancate Vol Length"),r.createElement("div",{className:"body-input-container"},r.createElement("input",{type:"number",min:16,max:128,step:1,value:e.clientState.workletSetting.setting.volTrancateLength,onChange:function(t){e.clientState.workletSetting.setSetting(N(N({},e.clientState.workletSetting.setting),{},{volTrancateLength:Number(t.target.value)}))}}))))}),[e.clientState.workletSetting.setting,e.clientState.workletSetting.setSetting]),y=(0,r.useMemo)((function(){return o?r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row divider"}),a,l,r.createElement("div",{className:"body-row divider"}),c,d,r.createElement("div",{className:"body-row divider"}),u,h,p,f,m,r.createElement("div",{className:"body-row divider"}),g,v,r.createElement("div",{className:"body-row divider"}),b,r.createElement("div",{className:"body-row divider"})):r.createElement(r.Fragment,null)}),[o,a,l,c,d,u,h,p,f,m,g,v,b]);return{advancedSetting:(0,r.useMemo)((function(){return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row split-3-7 left-padding-1"},r.createElement("div",{className:"body-sub-section-title"},"Advanced Setting"),r.createElement("div",null,r.createElement("input",{type:"checkbox",checked:o,onChange:function(e){s(e.target.checked)}})," show")),y)}),[o,y])}}({clientState:d}),g=function(e){var n=C((0,r.useState)(!1),2),o=n[0],s=n[1],a=(0,r.useMemo)((function(){var n=function(){var n=t(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s(!0),t.next=3,e.clientState.clientSetting.start();case 3:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}(),a=function(){var n=t(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return s(!1),t.next=3,e.clientState.clientSetting.stop();case 3:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}(),l=o?"body-button-active":"body-button-stanby",c=o?"body-button-stanby":"body-button-active";return r.createElement("div",{className:"body-row split-3-3-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Start"),r.createElement("div",{className:"body-button-container"},r.createElement("div",{onClick:n,className:l},"start"),r.createElement("div",{onClick:a,className:c},"stop")),r.createElement("div",{className:"body-input-container"}))}),[o,e.clientState.clientSetting.start,e.clientState.clientSetting.stop]),l=(0,r.useMemo)((function(){return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row split-3-1-1-1-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"monitor:"),r.createElement("div",{className:"body-item-text"},"vol",r.createElement("span",{className:"body-item-text-small"},"(rms)")),r.createElement("div",{className:"body-item-text"},"buf",r.createElement("span",{className:"body-item-text-small"},"(ms)")),r.createElement("div",{className:"body-item-text"},"res",r.createElement("span",{className:"body-item-text-small"},"(ms)")),r.createElement("div",{className:"body-item-text"})),r.createElement("div",{className:"body-row split-3-1-1-1-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"}),r.createElement("div",{className:"body-item-text"},e.clientState.volume.toFixed(4)),r.createElement("div",{className:"body-item-text"},e.clientState.bufferingTime),r.createElement("div",{className:"body-item-text"},e.clientState.responseTime),r.createElement("div",{className:"body-item-text"})))}),[e.clientState.volume,e.clientState.bufferingTime,e.clientState.responseTime]),c=(0,r.useMemo)((function(){var n,o,s,a=function(){var n=t(i().mark((function t(){var n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.clientState.getInfo();case 2:n=t.sent,console.log("info",n);case 4:case"end":return t.stop()}}),t)})));return function(){return n.apply(this,arguments)}}();return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row split-3-3-4 left-padding-1 guided"},r.createElement("div",{className:"body-item-title left-padding-1"},"Model Info:"),r.createElement("div",{className:"body-item-text"},r.createElement("span",{className:"body-item-text-item"},(null===(n=e.clientState.serverSetting.serverInfo)||void 0===n?void 0:n.configFile)||""),r.createElement("span",{className:"body-item-text-item"},(null===(o=e.clientState.serverSetting.serverInfo)||void 0===o?void 0:o.pyTorchModelFile)||""),r.createElement("span",{className:"body-item-text-item"},(null===(s=e.clientState.serverSetting.serverInfo)||void 0===s?void 0:s.onnxModelFile)||"")),r.createElement("div",{className:"body-button-container"},r.createElement("div",{className:"body-button",onClick:a},"reload"))))}),[e.clientState.getInfo,e.clientState.serverSetting.serverInfo]);return{serverControl:(0,r.useMemo)((function(){return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row split-3-7 left-padding-1"},r.createElement("div",{className:"body-sub-section-title"},"Server Control"),r.createElement("div",{className:"body-select-container"})),a,l,c)}),[a,l,c])}}({clientState:d}),(0,r.useEffect)((function(){var e=function e(){var t=new AudioContext;c(t),document.removeEventListener("touchstart",e),document.removeEventListener("mousedown",e)};document.addEventListener("touchstart",e),document.addEventListener("mousedown",e)}),[]),{voiceChangerSetting:(0,r.useMemo)((function(){return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row left-padding-1"},r.createElement("div",{className:"body-section-title"},"Virtual Microphone")),g.serverControl,u.serverSetting,h.deviceSetting,p.speakerSetting,f.convertSetting,m.advancedSetting)}),[g.serverControl,u.serverSetting,h.deviceSetting,p.speakerSetting,f.convertSetting,m.advancedSetting])}).voiceChangerSetting,b=function(){var e=t(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,chrome.storage.local.clear();case 2:return e.next=4,chrome.storage.sync.clear();case 4:location.reload();case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=(0,r.useMemo)((function(){return r.createElement(r.Fragment,null,r.createElement("div",{className:"body-row split-3-3-4 left-padding-1"},r.createElement("div",{className:"body-button-container"},r.createElement("div",{className:"body-button",onClick:b},"clear setting")),r.createElement("div",{className:"body-item-text"}),r.createElement("div",{className:"body-item-text"})))}),[]);return r.createElement("div",{className:"body"},r.createElement("div",{className:"body-row split-6-4"},r.createElement("div",{className:"body-top-title"},"Voice Changer Setting"),r.createElement("div",{className:"body-top-title-belongings"},r.createElement("div",{className:"belonging-item"},r.createElement("a",{className:"link",href:"https://github.com/w-okada/voice-changer",target:"_blank",rel:"noopener noreferrer"},r.createElement("img",{src:"./assets/icons/github.svg"}),r.createElement("span",null,"github"))),r.createElement("div",{className:"belonging-item"},r.createElement("a",{className:"link",href:"https://zenn.dev/wok/articles/s01_vc001_top",target:"_blank",rel:"noopener noreferrer"},r.createElement("img",{src:"./assets/icons/help-circle.svg"}),r.createElement("span",null,"manual"))))),y,v,r.createElement("div",null,r.createElement("audio",{id:"audio-output"})))};(0,o.s)(F).render(r.createElement(L,null))})()})();