From 3b46081df4cde53b928239f5083e8fd3313bbf8f Mon Sep 17 00:00:00 2001 From: wataru Date: Sun, 11 Dec 2022 05:05:15 +0900 Subject: [PATCH] update --- demo/MMVCServerSIO.py | 4 ++-- demo/mods/Trainer_Training.py | 25 +++++++++++++++++-------- docker/Dockerfile | 2 +- frontend/dist/index.js | 2 +- start2.sh | 2 +- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/demo/MMVCServerSIO.py b/demo/MMVCServerSIO.py index a3db4aad..cfce3456 100755 --- a/demo/MMVCServerSIO.py +++ b/demo/MMVCServerSIO.py @@ -383,9 +383,9 @@ if __name__ == thisFilename or args.colab == True: return mod_post_pre_training(batch) @app_fastapi.post("/post_start_training") - async def post_start_training(): + async def post_start_training(enable_finetuning: bool = Form(...),GModel: str = Form(...),DModel: str = Form(...)): print("POST START TRAINING..") - return mod_post_start_training() + return mod_post_start_training(enable_finetuning, GModel, DModel) @app_fastapi.post("/post_stop_training") async def post_stop_training(): diff --git a/demo/mods/Trainer_Training.py b/demo/mods/Trainer_Training.py index 1c2d9a91..11d579b8 100755 --- a/demo/mods/Trainer_Training.py +++ b/demo/mods/Trainer_Training.py @@ -3,17 +3,20 @@ from trainer_mods.files import get_file_list from fastapi.responses import JSONResponse from fastapi.encoders import jsonable_encoder -LOG_DIR = "MMVC_Trainer/info" +LOG_DIR = "logs" train_proc = None SUCCESS = 0 ERROR = -1 ### Submodule for Pre train -def sync_exec(cmd:str, log_path:str): +def sync_exec(cmd:str, log_path:str, cwd=None): shortCmdStr = cmd[:20] try: with open(log_path, 'w') as log_file: - proc = subprocess.run(cmd, shell=True, text=True, stdout=log_file, stderr=log_file, cwd="MMVC_Trainer") + if cwd == None: + proc = subprocess.run(cmd, shell=True, text=True, stdout=log_file, stderr=log_file) + else: + proc = subprocess.run(cmd, shell=True, text=True, stdout=log_file, stderr=log_file, cwd=cwd) print(f"{shortCmdStr} returncode:{proc.returncode}") if proc.returncode != 0: print(f"{shortCmdStr} exception:") @@ -39,7 +42,7 @@ def sync_exec_with_stdout(cmd:str, log_path:str): def create_dataset(): cmd = "python3 create_dataset_jtalk.py -f train_config -s 24000 -m dataset/multi_speaker_correspondence.txt" log_file = os.path.join(LOG_DIR, "log_create_dataset_jtalk.txt") - res = sync_exec(cmd, log_file) + res = sync_exec(cmd, log_file, "MMVC_Trainer") return res def set_batch_size(batch:int): @@ -55,7 +58,7 @@ def set_dummy_device_count(): return res ### Submodule for Train -def exec_training(): +def exec_training(enable_finetuning:bool, GModel:str, DModel:str): global train_proc log_file = os.path.join(LOG_DIR, "training.txt") @@ -71,7 +74,12 @@ def exec_training(): try: with open(log_file, 'w') as log_file: - cmd = 'python3 train_ms.py -c configs/train_config.json -m ./' + if enable_finetuning == True: + GModelPath = os.path.join("logs", GModel) # 実行時にcwdを指定しているのでフォルダはlogsでよい。 + DModelPath = os.path.join("logs", DModel) + cmd = f'python3 train_ms.py -c configs/train_config.json -m ./ -fg {GModelPath} -fd {DModelPath}' + else: + cmd = 'python3 train_ms.py -c configs/train_config.json -m ./' print("exec:",cmd) train_proc = subprocess.Popen("exec "+cmd, shell=True, text=True, stdout=log_file, stderr=log_file, cwd="MMVC_Trainer") print("Training stated") @@ -115,8 +123,9 @@ def mod_post_pre_training(batch:int): return {"result":"success", "detail": f"Preprocess succeeded. {res[1]}"} -def mod_post_start_training(): - res = exec_training() +def mod_post_start_training(enable_finetuning:str, GModel:str, DModel:str): + print("START_TRAINING:::::::", enable_finetuning, GModel, DModel) + res = exec_training(enable_finetuning, GModel, DModel) if res[0] == ERROR: return {"result":"failed", "detail": f"Start training failed. {res[1]}"} diff --git a/docker/Dockerfile b/docker/Dockerfile index add7b9d3..bc0dbd3a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM dannadori/voice-changer-internal:20221209_141145 as front +FROM dannadori/voice-changer-internal:20221211_045539 as front FROM debian:bullseye-slim as base ARG DEBIAN_FRONTEND=noninteractive diff --git a/frontend/dist/index.js b/frontend/dist/index.js index 1e9c42e7..ab845c6d 100755 --- a/frontend/dist/index.js +++ b/frontend/dist/index.js @@ -1,2 +1,2 @@ /*! For license information please see index.js.LICENSE.txt */ -(()=>{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),s=n(1938),a=n(21),o=n(87),c=n(6495),l=function(){function e(e){(0,a.supportsWebCrypto)((0,c.locateWindow)())?this.hash=new r.Sha256(e):(0,o.isMsWindow)((0,c.locateWindow)())?this.hash=new i.Sha256(e):this.hash=new s.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=l},3479:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sha256=void 0;var i=n(8036),r=n(7333),s=n(470),a=n(6495),o=function(){function e(e){e?(this.operation=function(e){return new Promise((function(t,n){var i=(0,a.locateWindow)().msCrypto.subtle.importKey("raw",c(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,a.locateWindow)().msCrypto.subtle.sign(r.SHA_256_HMAC_ALGO,e)})),this.operation.catch((function(){}))):this.operation=Promise.resolve((0,a.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(c(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 c(e){return"string"==typeof e?(0,s.fromUtf8)(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.Sha256=o},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),s=n(6495),a=function(){function e(e){this.toHash=new Uint8Array(0),void 0!==e&&(this.key=new Promise((function(t,n){(0,s.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,s.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,s.locateWindow)().crypto.subtle.digest(r.SHA_256_HASH,e.toHash)})).then((function(e){return Promise.resolve(new Uint8Array(e))}))},e}();t.Sha256=a},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>>24&255,s[4*r+1]=this.state[r]>>>16&255,s[4*r+2]=this.state[r]>>>8&255,s[4*r+3]=this.state[r]>>>0&255;return s},e.prototype.hashBuffer=function(){for(var e=this.buffer,t=this.state,n=t[0],r=t[1],s=t[2],a=t[3],o=t[4],c=t[5],l=t[6],u=t[7],d=0;d>>17|h<<15)^(h>>>19|h<<13)^h>>>10,p=((h=this.temp[d-15])>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[d]=(f+this.temp[d-7]|0)+(p+this.temp[d-16]|0)}var m=(((o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7))+(o&c^~o&l)|0)+(u+(i.KEY[d]+this.temp[d]|0)|0)|0,g=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&r^n&s^r&s)|0;u=l,l=c,c=o,o=a+m|0,a=s,s=r,r=n,n=m+g|0}t[0]+=n,t[1]+=r,t[2]+=s,t[3]+=a,t[4]+=o,t[5]+=c,t[6]+=l,t[7]+=u},e}();t.RawSha256=r},6532:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_HASHABLE_LENGTH=t.INIT=t.KEY=t.DIGEST_LENGTH=t.BLOCK_SIZE=void 0,t.BLOCK_SIZE=64,t.DIGEST_LENGTH=32,t.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),t.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],t.MAX_HASHABLE_LENGTH=Math.pow(2,53)-1},1938:(e,t,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),s=n(914),a=n(7658),o=function(){function e(e){if(this.hash=new s.RawSha256,e){this.outer=new s.RawSha256;var t=function(e){var t=(0,a.convertToBuffer)(e);if(t.byteLength>r.BLOCK_SIZE){var n=new s.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{"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 s(e){return"object"==typeof e&&"object"==typeof e.crypto&&"function"==typeof e.crypto.getRandomValues}function a(e){return e&&r.every((function(t){return"function"==typeof e[t]}))}t.supportsWebCrypto=function(e){return!(!s(e)||"object"!=typeof e.crypto.subtle)&&a(e.crypto.subtle)},t.supportsSecureRandom=s,t.supportsSubtleCrypto=a,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(!a(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),s=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?s(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 s=n(2174);Object.defineProperty(t,"numToUint8",{enumerable:!0,get:function(){return s.numToUint8}});var a=n(1558);Object.defineProperty(t,"uint32ArrayFrom",{enumerable:!0,get:function(){return a.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{"use strict";n.r(t),n.d(t,{AllowNotifications:()=>pn,AppInstanceUserMembershipSummaryFilterSensitiveLog:()=>Nn,AssociateChannelFlowCommand:()=>Ws,AssociateChannelFlowRequestFilterSensitiveLog:()=>Dn,BadRequestException:()=>Ln,BatchChannelMembershipsFilterSensitiveLog:()=>Fn,BatchCreateChannelMembershipCommand:()=>Gs,BatchCreateChannelMembershipErrorFilterSensitiveLog:()=>Un,BatchCreateChannelMembershipRequestFilterSensitiveLog:()=>Bn,BatchCreateChannelMembershipResponseFilterSensitiveLog:()=>Wn,ChannelAssociatedWithFlowSummaryFilterSensitiveLog:()=>qn,ChannelBanFilterSensitiveLog:()=>$n,ChannelBanSummaryFilterSensitiveLog:()=>Xn,ChannelFilterSensitiveLog:()=>jn,ChannelFlowCallbackCommand:()=>js,ChannelFlowCallbackRequestFilterSensitiveLog:()=>ni,ChannelFlowCallbackResponseFilterSensitiveLog:()=>ii,ChannelFlowFilterSensitiveLog:()=>Zn,ChannelFlowSummaryFilterSensitiveLog:()=>ri,ChannelMembershipFilterSensitiveLog:()=>si,ChannelMembershipForAppInstanceUserSummaryFilterSensitiveLog:()=>oi,ChannelMembershipPreferencesFilterSensitiveLog:()=>li,ChannelMembershipSummaryFilterSensitiveLog:()=>ui,ChannelMembershipType:()=>mn,ChannelMessageCallbackFilterSensitiveLog:()=>ti,ChannelMessageFilterSensitiveLog:()=>hi,ChannelMessagePersistenceType:()=>Mn,ChannelMessageStatus:()=>Sn,ChannelMessageStatusStructureFilterSensitiveLog:()=>di,ChannelMessageSummaryFilterSensitiveLog:()=>fi,ChannelMessageType:()=>_n,ChannelMode:()=>vn,ChannelModeratedByAppInstanceUserSummaryFilterSensitiveLog:()=>pi,ChannelModeratorFilterSensitiveLog:()=>mi,ChannelModeratorSummaryFilterSensitiveLog:()=>gi,ChannelPrivacy:()=>yn,ChannelSummaryFilterSensitiveLog:()=>ai,ChimeSDKMessaging:()=>Va,ChimeSDKMessagingClient:()=>hn,ChimeSDKMessagingServiceException:()=>fn,ConflictException:()=>An,CreateChannelBanCommand:()=>qs,CreateChannelBanRequestFilterSensitiveLog:()=>xi,CreateChannelBanResponseFilterSensitiveLog:()=>wi,CreateChannelCommand:()=>$s,CreateChannelFlowCommand:()=>Xs,CreateChannelFlowRequestFilterSensitiveLog:()=>Mi,CreateChannelFlowResponseFilterSensitiveLog:()=>Si,CreateChannelMembershipCommand:()=>Ks,CreateChannelMembershipRequestFilterSensitiveLog:()=>_i,CreateChannelMembershipResponseFilterSensitiveLog:()=>Ci,CreateChannelModeratorCommand:()=>Ys,CreateChannelModeratorRequestFilterSensitiveLog:()=>Ei,CreateChannelModeratorResponseFilterSensitiveLog:()=>Ti,CreateChannelRequestFilterSensitiveLog:()=>yi,CreateChannelResponseFilterSensitiveLog:()=>bi,DeleteChannelBanCommand:()=>Js,DeleteChannelBanRequestFilterSensitiveLog:()=>Ai,DeleteChannelCommand:()=>Zs,DeleteChannelFlowCommand:()=>Qs,DeleteChannelFlowRequestFilterSensitiveLog:()=>zi,DeleteChannelMembershipCommand:()=>ea,DeleteChannelMembershipRequestFilterSensitiveLog:()=>Ri,DeleteChannelMessageCommand:()=>ta,DeleteChannelMessageRequestFilterSensitiveLog:()=>Pi,DeleteChannelModeratorCommand:()=>na,DeleteChannelModeratorRequestFilterSensitiveLog:()=>Hi,DeleteChannelRequestFilterSensitiveLog:()=>Li,DescribeChannelBanCommand:()=>ia,DescribeChannelBanRequestFilterSensitiveLog:()=>Vi,DescribeChannelBanResponseFilterSensitiveLog:()=>Ni,DescribeChannelCommand:()=>ra,DescribeChannelFlowCommand:()=>sa,DescribeChannelFlowRequestFilterSensitiveLog:()=>Di,DescribeChannelFlowResponseFilterSensitiveLog:()=>Oi,DescribeChannelMembershipCommand:()=>aa,DescribeChannelMembershipForAppInstanceUserCommand:()=>oa,DescribeChannelMembershipForAppInstanceUserRequestFilterSensitiveLog:()=>Ui,DescribeChannelMembershipForAppInstanceUserResponseFilterSensitiveLog:()=>Wi,DescribeChannelMembershipRequestFilterSensitiveLog:()=>Fi,DescribeChannelMembershipResponseFilterSensitiveLog:()=>Bi,DescribeChannelModeratedByAppInstanceUserCommand:()=>ca,DescribeChannelModeratedByAppInstanceUserRequestFilterSensitiveLog:()=>Gi,DescribeChannelModeratedByAppInstanceUserResponseFilterSensitiveLog:()=>ji,DescribeChannelModeratorCommand:()=>la,DescribeChannelModeratorRequestFilterSensitiveLog:()=>qi,DescribeChannelModeratorResponseFilterSensitiveLog:()=>$i,DescribeChannelRequestFilterSensitiveLog:()=>ki,DescribeChannelResponseFilterSensitiveLog:()=>Ii,DisassociateChannelFlowCommand:()=>ua,DisassociateChannelFlowRequestFilterSensitiveLog:()=>Xi,ElasticChannelConfigurationFilterSensitiveLog:()=>Gn,ErrorCode:()=>gn,FallbackAction:()=>xn,ForbiddenException:()=>zn,GetChannelMembershipPreferencesCommand:()=>da,GetChannelMembershipPreferencesRequestFilterSensitiveLog:()=>Ki,GetChannelMembershipPreferencesResponseFilterSensitiveLog:()=>Yi,GetChannelMessageCommand:()=>ha,GetChannelMessageRequestFilterSensitiveLog:()=>Ji,GetChannelMessageResponseFilterSensitiveLog:()=>Zi,GetChannelMessageStatusCommand:()=>fa,GetChannelMessageStatusRequestFilterSensitiveLog:()=>Qi,GetChannelMessageStatusResponseFilterSensitiveLog:()=>er,GetMessagingSessionEndpointCommand:()=>pa,GetMessagingSessionEndpointRequestFilterSensitiveLog:()=>tr,GetMessagingSessionEndpointResponseFilterSensitiveLog:()=>ir,IdentityFilterSensitiveLog:()=>On,InvocationType:()=>bn,LambdaConfigurationFilterSensitiveLog:()=>Kn,ListChannelBansCommand:()=>ma,ListChannelBansRequestFilterSensitiveLog:()=>rr,ListChannelBansResponseFilterSensitiveLog:()=>sr,ListChannelFlowsCommand:()=>ga,ListChannelFlowsRequestFilterSensitiveLog:()=>ar,ListChannelFlowsResponseFilterSensitiveLog:()=>or,ListChannelMembershipsCommand:()=>va,ListChannelMembershipsForAppInstanceUserCommand:()=>ya,ListChannelMembershipsForAppInstanceUserRequestFilterSensitiveLog:()=>ur,ListChannelMembershipsForAppInstanceUserResponseFilterSensitiveLog:()=>dr,ListChannelMembershipsRequestFilterSensitiveLog:()=>cr,ListChannelMembershipsResponseFilterSensitiveLog:()=>lr,ListChannelMessagesCommand:()=>ba,ListChannelMessagesRequestFilterSensitiveLog:()=>hr,ListChannelMessagesResponseFilterSensitiveLog:()=>fr,ListChannelModeratorsCommand:()=>xa,ListChannelModeratorsRequestFilterSensitiveLog:()=>pr,ListChannelModeratorsResponseFilterSensitiveLog:()=>mr,ListChannelsAssociatedWithChannelFlowCommand:()=>wa,ListChannelsAssociatedWithChannelFlowRequestFilterSensitiveLog:()=>yr,ListChannelsAssociatedWithChannelFlowResponseFilterSensitiveLog:()=>br,ListChannelsCommand:()=>Ma,ListChannelsModeratedByAppInstanceUserCommand:()=>Sa,ListChannelsModeratedByAppInstanceUserRequestFilterSensitiveLog:()=>xr,ListChannelsModeratedByAppInstanceUserResponseFilterSensitiveLog:()=>wr,ListChannelsRequestFilterSensitiveLog:()=>gr,ListChannelsResponseFilterSensitiveLog:()=>vr,ListSubChannelsCommand:()=>_a,ListSubChannelsRequestFilterSensitiveLog:()=>Mr,ListSubChannelsResponseFilterSensitiveLog:()=>_r,ListTagsForResourceCommand:()=>Ca,ListTagsForResourceRequestFilterSensitiveLog:()=>Cr,ListTagsForResourceResponseFilterSensitiveLog:()=>Er,MessageAttributeValueFilterSensitiveLog:()=>Qn,MessagingSessionEndpointFilterSensitiveLog:()=>nr,NotFoundException:()=>Rn,ProcessorConfigurationFilterSensitiveLog:()=>Yn,ProcessorFilterSensitiveLog:()=>Jn,PushNotificationConfigurationFilterSensitiveLog:()=>ei,PushNotificationPreferencesFilterSensitiveLog:()=>ci,PushNotificationType:()=>wn,PutChannelMembershipPreferencesCommand:()=>Ea,PutChannelMembershipPreferencesRequestFilterSensitiveLog:()=>Tr,PutChannelMembershipPreferencesResponseFilterSensitiveLog:()=>Lr,RedactChannelMessageCommand:()=>Ta,RedactChannelMessageRequestFilterSensitiveLog:()=>Ar,RedactChannelMessageResponseFilterSensitiveLog:()=>zr,ResourceLimitExceededException:()=>Vn,SearchChannelsCommand:()=>La,SearchChannelsRequestFilterSensitiveLog:()=>Pr,SearchChannelsResponseFilterSensitiveLog:()=>Hr,SearchFieldFilterSensitiveLog:()=>Rr,SearchFieldKey:()=>En,SearchFieldOperator:()=>Tn,SendChannelMessageCommand:()=>Aa,SendChannelMessageRequestFilterSensitiveLog:()=>kr,SendChannelMessageResponseFilterSensitiveLog:()=>Ir,ServiceFailureException:()=>Pn,ServiceUnavailableException:()=>Hn,SortOrder:()=>Cn,SubChannelSummaryFilterSensitiveLog:()=>Sr,TagFilterSensitiveLog:()=>vi,TagResourceCommand:()=>za,TagResourceRequestFilterSensitiveLog:()=>Vr,ThrottledClientException:()=>kn,UnauthorizedClientException:()=>In,UntagResourceCommand:()=>Ra,UntagResourceRequestFilterSensitiveLog:()=>Nr,UpdateChannelCommand:()=>Pa,UpdateChannelFlowCommand:()=>Ha,UpdateChannelFlowRequestFilterSensitiveLog:()=>Fr,UpdateChannelFlowResponseFilterSensitiveLog:()=>Br,UpdateChannelMessageCommand:()=>ka,UpdateChannelMessageRequestFilterSensitiveLog:()=>Ur,UpdateChannelMessageResponseFilterSensitiveLog:()=>Wr,UpdateChannelReadMarkerCommand:()=>Ia,UpdateChannelReadMarkerRequestFilterSensitiveLog:()=>Gr,UpdateChannelReadMarkerResponseFilterSensitiveLog:()=>jr,UpdateChannelRequestFilterSensitiveLog:()=>Dr,UpdateChannelResponseFilterSensitiveLog:()=>Or,paginateListChannelBans:()=>Oa,paginateListChannelFlows:()=>Ua,paginateListChannelMemberships:()=>Xa,paginateListChannelMembershipsForAppInstanceUser:()=>ja,paginateListChannelMessages:()=>Ja,paginateListChannelModerators:()=>eo,paginateListChannels:()=>lo,paginateListChannelsAssociatedWithChannelFlow:()=>io,paginateListChannelsModeratedByAppInstanceUser:()=>ao,paginateListSubChannels:()=>fo,paginateSearchChannels:()=>go});var i={};n.r(i),n.d(i,{isVirtualHostableS3Bucket:()=>Vt,parseArn:()=>Nt,partition:()=>Lt});var r,s={};n.r(s),n.d(s,{aws:()=>i,booleanEquals:()=>Dt,getAttr:()=>Ot,isSet:()=>Ft,isValidHostLabel:()=>It,not:()=>Bt,parseURL:()=>Gt,stringEquals:()=>jt,substring:()=>qt,uriEncode:()=>$t}),function(e){e.ENV="env",e.CONFIG="shared config entry"}(r||(r={}));const a=e=>"string"==typeof e&&(e.startsWith("fips-")||e.endsWith("-fips")),o=e=>a(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e;class c{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 c({...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 l="content-length",u={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},d={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},h={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function f(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),d),i.add(((e,t)=>(n,i)=>async r=>{const s=i.endpointV2?.url&&e.urlParser?async()=>e.urlParser(i.endpointV2.url):e.endpoint;if(!s)throw new Error("No valid endpoint provider available.");const a=await t(r.input,{...e,endpoint:s});return n({...r,request:a})})(e,t),h)}}}const p=/^[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},y=async(e,t,n)=>{const i={},r=t?.getEndpointParameterInstructions?.()||{};for(const[t,s]of Object.entries(r))switch(s.type){case"staticContextParams":i[t]=s.value;break;case"contextParams":i[t]=e[s.name];break;case"clientContextParams":case"builtInParams":i[t]=await v(s.name,t,n)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}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,s,a]=e.split(":"),o="arn"===t&&e.split(":").length>=6,c=5===[t,n,i,s,a].filter(Boolean).length;if(o&&!c)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return!!("arn"===t&&n&&i&&s&&a)})(t)){if(!0===e.ForcePathStyle)throw new Error("Path-style addressing cannot be used with ARN buckets")}else n=t,(!p.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},b={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:h.name},x=(e,t)=>({applyToStack:n=>{n.addRelativeTo((({config:e,instructions:t})=>(n,i)=>async r=>{const s=await(async(e,t,n,i)=>{const r=await y(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=s,i.authSchemes=s.properties?.authSchemes;const a=i.authSchemes?.[0];return a&&(i.signing_region=a.signingRegion,i.signing_service=a.signingName),n({...r})})({config:e,instructions:t}),b)}}),w=e=>{if("function"==typeof e)return e;const t=Promise.resolve(e);return()=>t},M=e=>{if("string"==typeof e)return M(new URL(e));const{hostname:t,pathname:n,port:i,protocol:r,search:s}=e;let a;return s&&(a=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}(s)),{hostname:t,port:i?parseInt(i):void 0,protocol:r,path:n,query:a}},S={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},_={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0};var C=n(4155);const E={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"};var T;!function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"}(T||(T={}));const L=T.STANDARD,A=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch"],z=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],R=["AbortError","TimeoutError","RequestTimeout","RequestTimeoutException"],P=[500,502,503,504],H=["ECONNRESET","EPIPE","ETIMEDOUT"],k=e=>429===e.$metadata?.httpStatusCode||z.includes(e.name)||1==e.$retryable?.throttling;class I{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(),k(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 V{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 N,D=new Uint8Array(16);function O(){if(!N&&!(N="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 N(D)}const F=/^(?:[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,B=function(e){return"string"==typeof e&&F.test(e)};for(var U=[],W=0;W<256;++W)U.push((W+256).toString(16).substr(1));const G=function(e,t,n){var i=(e=e||{}).random||(e.rng||O)();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=(U[e[t+0]]+U[e[t+1]]+U[e[t+2]]+U[e[t+3]]+"-"+U[e[t+4]]+U[e[t+5]]+"-"+U[e[t+6]]+U[e[t+7]]+"-"+U[e[t+8]]+U[e[t+9]]+"-"+U[e[t+10]]+U[e[t+11]]+U[e[t+12]]+U[e[t+13]]+U[e[t+14]]+U[e[t+15]]).toLowerCase();if(!B(n))throw TypeError("Stringified UUID is invalid");return n}(i)},j=(e,t)=>Math.floor(Math.min(2e4,Math.random()*2**t*e)),q=e=>!!e&&((e=>void 0!==e.$retryable)(e)||(e=>A.includes(e.name))(e)||k(e)||(e=>R.includes(e.name)||H.includes(e?.code||"")||P.includes(e.$metadata?.httpStatusCode||0))(e));class ${constructor(e,t){this.maxAttemptsProvider=e,this.mode=T.STANDARD,this.retryDecider=t?.retryDecider??q,this.delayDecider=t?.delayDecider??j,this.retryQuota=t?.retryQuota??((e,t)=>{let n=500;const i=e=>"TimeoutError"===e.name?10:5,r=e=>i(e)<=n;return Object.freeze({hasRetryTokens:r,retrieveRetryTokens:e=>{if(!r(e))throw new Error("No retry token available");const t=i(e);return n-=t,t},releaseRetryTokens:e=>{n+=e??1,n=Math.min(n,500)}})})()}shouldRetry(e,t,n){return tsetTimeout(e,a)));continue}throw t.$metadata||(t.$metadata={}),t.$metadata.attempts=r,t.$metadata.totalRetryDelay=s,t}}}const X=e=>{if(!V.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).getTime()-Date.now():1e3*i},K=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):"string"==typeof e?new Error(e):new Error(`AWS SDK error wrapper for ${e}`);class Y extends ${constructor(e,t){const{rateLimiter:n,...i}=t??{};super(e,i),this.rateLimiter=n??new I,this.mode=T.ADAPTIVE}async retry(e,t){return super.retry(e,t,{beforeRequest:async()=>this.rateLimiter.getSendToken(),afterRequest:e=>{this.rateLimiter.updateClientSendingRate(e)}})}}const J={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0};class Z extends Error{constructor(e,t=!0){super(e),this.tryNextLink=t,this.name="ProviderError",Object.setPrototypeOf(this,Z.prototype)}static from(e,t=!0){return Object.assign(new this(e.message,t),e)}}const Q=(e,t,n)=>{let i,r,s,a=!1;const o=async()=>{r||(r=e());try{i=await r,s=!0,a=!1}finally{r=void 0}return i};return void 0===t?async e=>(s&&!e?.forceRefresh||(i=await o()),i):async e=>(s&&!e?.forceRefresh||(i=await o()),a?i:n&&!n(i)?(a=!0,i):t(i)?(await o(),i):i)};var ee=n(3538);const te="X-Amz-Security-Token",ne="authorization",ie="X-Amz-Date".toLowerCase(),re=[ne,ie,"date"],se="X-Amz-Signature".toLowerCase(),ae="x-amz-content-sha256",oe=te.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},le=/^proxy-/,ue=/^sec-/,de="AWS4-HMAC-SHA256-PAYLOAD",he={},fe=[],pe=(e,t,n)=>`${e}/${t}/${n}/aws4_request`,me=(e,t,n)=>{const i=new e(t);return i.update(n),i.digest()},ge=({headers:e},t,n)=>{const i={};for(const r of Object.keys(e).sort()){if(null==e[r])continue;const s=r.toLowerCase();(s in ce||t?.has(s)||le.test(s)||ue.test(s))&&(!n||n&&!n.has(s))||(i[s]=e[r].trim().replace(/\s+/g," "))}return i},ve=e=>encodeURIComponent(e).replace(/[!'()*]/g,ye),ye=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`,be=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,ee.toHex)(await e.digest())}var i;return"UNSIGNED-PAYLOAD"},xe=({headers:e,query:t,...n})=>({...n,headers:{...e},query:t?we(t):void 0}),we=e=>Object.keys(e).reduce(((t,n)=>{const i=e[n];return{...t,[n]:Array.isArray(i)?[...i]:i}}),{}),Me=e=>{e="function"==typeof e.clone?e.clone():xe(e);for(const t of Object.keys(e.headers))re.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e};class Se{constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:r,uriEscapePath:s=!0}){this.service=i,this.sha256=r,this.uriEscapePath=s,this.applyChecksum="boolean"!=typeof e||e,this.regionProvider=w(n),this.credentialProvider=w(t)}async presign(e,t={}){const{signingDate:n=new Date,expiresIn:i=3600,unsignableHeaders:r,unhoistableHeaders:s,signableHeaders:a,signingRegion:o,signingService:c}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);const u=o??await this.regionProvider(),{longDate:d,shortDate:h}=_e(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 f=pe(h,u,c??this.service),p=((e,t={})=>{const{headers:n,query:i={}}="function"==typeof e.clone?e.clone():xe(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}})(Me(e),{unhoistableHeaders:s});l.sessionToken&&(p.query[te]=l.sessionToken),p.query["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",p.query["X-Amz-Credential"]=`${l.accessKeyId}/${f}`,p.query["X-Amz-Date"]=d,p.query["X-Amz-Expires"]=i.toString(10);const m=ge(p,r,a);return p.query["X-Amz-SignedHeaders"]=Ce(m),p.query["X-Amz-Signature"]=await this.getSignature(d,f,this.getSigningKey(l,u,h,c),this.createCanonicalRequest(p,m,await be(e,this.sha256))),p}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:s}){const a=r??await this.regionProvider(),{shortDate:o,longDate:c}=_e(n),l=pe(o,a,s??this.service),u=await be({headers:{},body:t},this.sha256),d=new this.sha256;d.update(e);const h=(0,ee.toHex)(await d.digest()),f=[de,c,l,i,h,u].join("\n");return this.signString(f,{signingDate:n,signingRegion:a,signingService:s})}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:i}={}){const r=await this.credentialProvider();this.validateResolvedCredentials(r);const s=n??await this.regionProvider(),{shortDate:a}=_e(t),o=new this.sha256(await this.getSigningKey(r,s,a,i));return o.update(e),(0,ee.toHex)(await o.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:i,signingRegion:r,signingService:s}={}){const a=await this.credentialProvider();this.validateResolvedCredentials(a);const o=r??await this.regionProvider(),c=Me(e),{longDate:l,shortDate:u}=_e(t),d=pe(u,o,s??this.service);c.headers[ie]=l,a.sessionToken&&(c.headers[oe]=a.sessionToken);const h=await be(c,this.sha256);!((e,t)=>{e=e.toLowerCase();for(const n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1})(ae,c.headers)&&this.applyChecksum&&(c.headers[ae]=h);const f=ge(c,i,n),p=await this.getSignature(l,d,this.getSigningKey(a,o,u,s),this.createCanonicalRequest(c,f,h));return c.headers[ne]=`AWS4-HMAC-SHA256 Credential=${a.accessKeyId}/${d}, SignedHeaders=${Ce(f)}, Signature=${p}`,c}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]=`${ve(i)}=${ve(r)}`:Array.isArray(r)&&(n[i]=r.slice(0).sort().reduce(((e,t)=>e.concat([`${ve(i)}=${ve(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`AWS4-HMAC-SHA256\n${e}\n${t}\n${(0,ee.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),s=new this.sha256(await n);return s.update(r),(0,ee.toHex)(await s.digest())}getSigningKey(e,t,n,i){return(async(e,t,n,i,r)=>{const s=await me(e,t.secretAccessKey,t.accessKeyId),a=`${n}:${i}:${r}:${(0,ee.toHex)(s)}:${t.sessionToken}`;if(a in he)return he[a];for(fe.push(a);fe.length>50;)delete he[fe.shift()];let o=`AWS4${t.secretAccessKey}`;for(const t of[n,i,r,"aws4_request"])o=await me(e,o,t);return he[a]=o})(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 _e=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)}},Ce=e=>Object.keys(e).sort().join(";"),Ee=e=>new Date(Date.now()+e),Te=(e,t)=>{const n=Date.parse(e);return((e,t)=>Math.abs(Ee(t).getTime()-e)>=3e5)(n,t)?n-Date.now():t},Le=e=>V.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,Ae={name:"awsAuthMiddleware",tags:["SIGNATURE","AWSAUTH"],relation:"after",toMiddleware:"retryMiddleware",override:!0},ze="user-agent",Re="x-amz-user-agent",Pe=/[^\!\#\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,He=([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(Pe,"_"))).join("/")},ke={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0};class Ie{trace(){}debug(){}info(){}warn(){}error(){}}const Ve=()=>{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},s=(n=!1)=>{const i=[],s=[],a={};var o;return e.forEach((e=>{const t={...e,before:[],after:[]};t.name&&(a[t.name]=t),i.push(t)})),t.forEach((e=>{const t={...e,before:[],after:[]};t.name&&(a[t.name]=t),s.push(t)})),s.forEach((e=>{if(e.toMiddleware){const t=a[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)}})),(o=i,o.sort(((e,t)=>Ne[t.step]-Ne[e.step]||De[t.priority||"normal"]-De[e.priority||"normal"]))).map(r).reduce(((e,t)=>(e.push(...t),e)),[])},a={add:(t,i={})=>{const{name:r,override:s}=i,a={step:"initialize",priority:"normal",middleware:t,...i};if(r){if(n.has(r)){if(!s)throw new Error(`Duplicate middleware name '${r}'`);const t=e.findIndex((e=>e.name===r)),n=e[t];if(n.step!==a.step||n.priority!==a.priority)throw new Error(`"${r}" middleware with ${n.priority} priority in ${n.step} step cannot be overridden by same-name middleware with ${a.priority} priority in ${a.step} step.`);e.splice(t,1)}n.add(r)}e.push(a)},addRelativeTo:(e,i)=>{const{name:r,override:s}=i,a={middleware:e,...i};if(r){if(n.has(r)){if(!s)throw new Error(`Duplicate middleware name '${r}'`);const e=t.findIndex((e=>e.name===r)),n=t[e];if(n.toMiddleware!==a.toMiddleware||n.relation!==a.relation)throw new Error(`"${r}" middleware ${n.relation} "${n.toMiddleware}" middleware cannot be overridden by same-name middleware ${a.relation} "${a.toMiddleware}" middleware.`);t.splice(e,1)}n.add(r)}t.push(a)},clone:()=>i(Ve()),use:e=>{e.applyToStack(a)},remove:i=>"string"==typeof i?(i=>{let r=!1;const s=e=>!e.name||e.name!==i||(r=!0,n.delete(i),!1);return e=e.filter(s),t=t.filter(s),r})(i):(i=>{let r=!1;const s=e=>e.middleware!==i||(r=!0,e.name&&n.delete(e.name),!1);return e=e.filter(s),t=t.filter(s),r})(i),removeByTag:i=>{let r=!1;const s=e=>{const{tags:t,name:s}=e;return!t||!t.includes(i)||(s&&n.delete(s),r=!0,!1)};return e=e.filter(s),t=t.filter(s),r},concat:e=>{const t=i(Ve());return t.use(e),t},applyToStack:i,identify:()=>s(!0).map((e=>e.name+": "+(e.tags||[]).join(","))),resolve:(e,t)=>{for(const n of s().map((e=>e.middleware)).reverse())e=n(e,t);return e}};return a},Ne={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},De={high:3,normal:2,low:1};class Oe{constructor(e){this.middlewareStack=Ve(),this.config=e}send(e,t,n){const i="function"!=typeof t?t:void 0,r="function"==typeof t?t:n,s=e.resolveMiddleware(this.middlewareStack,this.config,i);if(!r)return s(e).then((e=>e.output));s(e).then((e=>r(null,e.output)),(e=>r(e))).catch((()=>{}))}destroy(){this.config.requestHandler.destroy&&this.config.requestHandler.destroy()}}class Fe{constructor(){this.middlewareStack=Ve()}}const Be="***SensitiveInformation***",Ue=e=>{if(null!=e){if("number"==typeof e){if(0!==e&&1!==e||et.warn(Qe(`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||et.warn(Qe(`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}`)}},We=e=>{if(null!=e){if("string"==typeof e){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&et.warn(Qe(`Expected number but observed string: ${e}`)),t}if("number"==typeof e)return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},Ge=(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}`)}}),je=e=>qe(e,32),qe=(e,t)=>{const n=Ge(e);if(void 0!==n&&$e(n,t)!==n)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return n},$e=(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]}},Xe=(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},Ke=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}`)},Ye=e=>{if(null!=e){if("string"==typeof e)return e;if(["boolean","number","bigint"].includes(typeof e))return et.warn(Qe(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)}},Je=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,Ze=e=>{const t=e.match(Je);if(null===t||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},Qe=e=>String(new TypeError(e).stack||e).split("\n").slice(0,5).filter((e=>!e.includes("stackTraceWarning"))).join("\n"),et={warn:console.warn},tt=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=>We("string"==typeof e?Ze(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 nt extends Error{constructor(e){super(e.message),Object.setPrototypeOf(this,nt.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}const it=(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},rt=({output:e,parsedBody:t,exceptionCtor:n,errorCode:i})=>{const r=st(e),s=r.httpStatusCode?r.httpStatusCode+"":void 0,a=new n({name:t.code||t.Code||i||s||"UnknownError",$fault:"client",$metadata:r});throw it(a,t)},st=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),at=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{}}},ot=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 ct(e,t,n){let i,r,s;if(void 0===t&&void 0===n)i={},s=e;else{if(i=e,"function"==typeof t)return r=t,s=n,lt(i,r,s);s=t}for(const e of Object.keys(s)){if(!Array.isArray(s[e])){i[e]=s[e];continue}let[t,n]=s[e];if("function"==typeof n){let r;const s=void 0===t&&null!=(r=n()),a="function"==typeof t&&!!t(void 0)||"function"!=typeof t&&!!t;s?i[e]=r:a&&(i[e]=n())}else{const r=void 0===t&&null!=n,s="function"==typeof t&&!!t(n)||"function"!=typeof t&&!!t;(r||s)&&(i[e]=n)}}return i}ot.prototype=Object.create(String.prototype,{constructor:{value:ot,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(ot,String);const lt=(e,t,n)=>ct(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 ut(e){return encodeURIComponent(e).replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}const dt=(e,t,n,i,r,s)=>{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,s?t.split("/").map((e=>ut(e))).join("/"):ut(t))}return e};var ht=n(7643);function ft(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 pt{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=ve(n),Array.isArray(i))for(let e=0,r=i.length;e{const t=e.headers,n={};for(const e of t.entries())n[e[0]]=e[1];return void 0!==e.body?{response:new V({headers:n,statusCode:e.status,body:e.body})}:e.blob().then((t=>({response:new V({headers:n,statusCode:e.status,body:t})})))})),ft(n)];return t&&l.push(new Promise(((e,n)=>{t.onabort=()=>{const e=new Error("Request aborted");e.name="AbortError",n(e)}}))),Promise.race(l)}}const mt={},gt=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);mt[n]=e,gt[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;mt[n]=i,gt[i]=n}for(let e=0;e<10;e++){mt[e.toString(10)]=e+52;const t=e.toString(10),n=e+52;mt[t]=n,gt[n]=t}mt["+"]=62,gt[62]="+",mt["/"]=63,gt[63]="/";const vt=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>=6;const s=t/4*3;n>>=r%8;const a=Math.floor(r/8);for(let e=0;e>t)}}return new Uint8Array(n)};function yt(e){let t="";for(let n=0;n>n]}t+="==".slice(0,4-s)}return t}const bt=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(","),s=r>-1?r+1:e.length;t(e.substring(s))},i.onabort=()=>n(new Error("Read aborted")),i.onerror=()=>n(i.error),i.readAsDataURL(e)}))}(e),n=vt(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),xt=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 wt=n(1206),Mt=n.n(wt);const St=({serviceId:e,clientVersion:t})=>async()=>{const n="undefined"!=typeof window&&window?.navigator?.userAgent?Mt().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 _t=n(470);const Ct=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-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:Et}=Ct,Tt=Et.find((e=>"aws"===e.id)),Lt=e=>{for(const t of Et){const{regions:n,outputs:i}=t;for(const[t,r]of Object.entries(n))if(t===e)return{...i,...r}}for(const t of Et){const{regionRegex:n,outputs:i}=t;if(new RegExp(n).test(e))return{...i}}if(!Tt)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...Tt.outputs}},At="endpoints";function zt(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${zt(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(zt).join(", ")})`:JSON.stringify(e,null,2)}class Rt extends Error{constructor(e){super(e),this.name="EndpointError"}}const Pt=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}$"),Ht=e=>Pt.test(e)||e.startsWith("[")&&e.endsWith("]"),kt=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),It=(e,t=!1)=>{if(!t)return kt.test(e);const n=e.split(".");for(const e of n)if(!It(e))return!1;return!0},Vt=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!Vt(t))return!1;return!0}return!(!It(e)||e.length<3||e.length>63||e!==e.toLowerCase()||Ht(e))},Nt=e=>{const t=e.split(":");if(t.length<6)return null;const[n,i,r,s,a,...o]=t;return"arn"!==n||""===i||""===r||""===o[0]?null:{partition:i,service:r,region:s,accountId:a,resourceId:o[0].includes("/")?o[0].split("/"):o}},Dt=(e,t)=>e===t,Ot=(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),Ft=e=>null!=e,Bt=e=>!e;var Ut;!function(e){e.HTTP="http",e.HTTPS="https"}(Ut||(Ut={}));const Wt={[Ut.HTTP]:80,[Ut.HTTPS]:443},Gt=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:s={}}=e,a=new URL(`${i}//${t}${n?`:${n}`:""}${r}`);return a.search=Object.entries(s).map((([e,t])=>`${e}=${t}`)).join("&"),a}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:s,protocol:a,search:o}=t;if(o)return null;const c=a.slice(0,-1);if(!Object.values(Ut).includes(c))return null;const l=Ht(r);return{scheme:c,authority:`${i}${n.includes(`${i}:${Wt[c]}`)||"string"==typeof e&&e.includes(`${i}:${Wt[c]}`)?`:${Wt[c]}`:""}`,path:s,normalizedPath:s.endsWith("/")?s:`${s}/`,isIp:l}},jt=(e,t)=>e===t,qt=(e,t,n,i)=>t>=n||e.lengthencodeURIComponent(e).replace(/[!*'()]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),Xt=(e,t)=>{const n=[],i={...t.endpointParams,...t.referenceRecord};let r=0;for(;r{if("string"==typeof e)return Xt(e,n);if(e.fn)return Yt(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.`)},Yt=({fn:e,argv:t},n)=>{const i=t.map((e=>["boolean","number"].includes(typeof e)?e:Kt(e,"arg",n)));return e.split(".").reduce(((e,t)=>e[t]),s)(...i)},Jt=({assign:e,...t},n)=>{if(e&&e in n.referenceRecord)throw new Rt(`'${e}' is already defined in Reference Record.`);const i=Yt(t,n);return n.logger?.debug?.(At,`evaluateCondition: ${zt(t)} = ${zt(i)}`),{result:""===i||!!i,...null!=e&&{toAssign:{name:e,value:i}}}},Zt=(e=[],t)=>{const n={};for(const i of e){const{result:e,toAssign:r}=Jt(i,{...t,referenceRecord:{...t.referenceRecord,...n}});if(!e)return{result:e};r&&(n[r.name]=r.value,t.logger?.debug?.(At,`assign: ${r.name} := ${zt(r.value)}`))}return{result:!0,referenceRecord:n}},Qt=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>({...e,[n]:i.map((e=>{const i=Kt(e,"Header value entry",t);if("string"!=typeof i)throw new Rt(`Header '${n}' value '${i}' is not a string`);return i}))})),{}),en=(e,t)=>{if(Array.isArray(e))return e.map((e=>en(e,t)));switch(typeof e){case"string":return Xt(e,t);case"object":if(null===e)throw new Rt(`Unexpected endpoint property: ${e}`);return tn(e,t);case"boolean":return e;default:throw new Rt("Unexpected endpoint property type: "+typeof e)}},tn=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>({...e,[n]:en(i,t)})),{}),nn=(e,t)=>{const n=Kt(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)},rn=(e,t)=>{const{conditions:n,endpoint:i}=e,{result:r,referenceRecord:s}=Zt(n,t);if(!r)return;const a={...t,referenceRecord:{...t.referenceRecord,...s}},{url:o,properties:c,headers:l}=i;return t.logger?.debug?.(At,`Resolving endpoint from template: ${zt(i)}`),{...null!=l&&{headers:Qt(l,a)},...null!=c&&{properties:tn(c,a)},url:nn(o,a)}},sn=(e,t)=>{const{conditions:n,error:i}=e,{result:r,referenceRecord:s}=Zt(n,t);if(r)throw new Rt(Kt(i,"Error",{...t,referenceRecord:{...t.referenceRecord,...s}}))},an=(e,t)=>{const{conditions:n,rules:i}=e,{result:r,referenceRecord:s}=Zt(n,t);if(r)return on(i,{...t,referenceRecord:{...t.referenceRecord,...s}})},on=(e,t)=>{for(const n of e)if("endpoint"===n.type){const e=rn(n,t);if(e)return e}else if("error"===n.type)sn(n,t);else{if("tree"!==n.type)throw new Rt(`Unknown endpoint rule: ${n}`);{const e=an(n,t);if(e)return e}}throw new Rt("Rules evaluation failed")},cn={version:"1.0",parameters:{Region:{builtIn:"AWS::Region",required:!0,documentation:"The AWS region used to dispatch the request.",type:"String"},UseDualStack:{builtIn:"AWS::UseDualStack",required:!0,default:!1,documentation:"When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.",type:"Boolean"},UseFIPS:{builtIn:"AWS::UseFIPS",required:!0,default:!1,documentation:"When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.",type:"Boolean"},Endpoint:{builtIn:"SDK::Endpoint",required:!1,documentation:"Override the endpoint used to send this request",type:"String"}},rules:[{conditions:[{fn:"aws.partition",argv:[{ref:"Region"}],assign:"PartitionResult"}],type:"tree",rules:[{conditions:[{fn:"isSet",argv:[{ref:"Endpoint"}]},{fn:"parseURL",argv:[{ref:"Endpoint"}],assign:"url"}],type:"tree",rules:[{conditions:[{fn:"booleanEquals",argv:[{ref:"UseFIPS"},!0]}],error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:"error"},{conditions:[],type:"tree",rules:[{conditions:[{fn:"booleanEquals",argv:[{ref:"UseDualStack"},!0]}],error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:"error"},{conditions:[],endpoint:{url:{ref:"Endpoint"},properties:{},headers:{}},type:"endpoint"}]}]},{conditions:[{fn:"booleanEquals",argv:[{ref:"UseFIPS"},!0]},{fn:"booleanEquals",argv:[{ref:"UseDualStack"},!0]}],type:"tree",rules:[{conditions:[{fn:"booleanEquals",argv:[!0,{fn:"getAttr",argv:[{ref:"PartitionResult"},"supportsFIPS"]}]},{fn:"booleanEquals",argv:[!0,{fn:"getAttr",argv:[{ref:"PartitionResult"},"supportsDualStack"]}]}],type:"tree",rules:[{conditions:[],endpoint:{url:"https://messaging-chime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:{},headers:{}},type:"endpoint"}]},{conditions:[],error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:"error"}]},{conditions:[{fn:"booleanEquals",argv:[{ref:"UseFIPS"},!0]}],type:"tree",rules:[{conditions:[{fn:"booleanEquals",argv:[!0,{fn:"getAttr",argv:[{ref:"PartitionResult"},"supportsFIPS"]}]}],type:"tree",rules:[{conditions:[],type:"tree",rules:[{conditions:[],endpoint:{url:"https://messaging-chime-fips.{Region}.{PartitionResult#dnsSuffix}",properties:{},headers:{}},type:"endpoint"}]}]},{conditions:[],error:"FIPS is enabled but this partition does not support FIPS",type:"error"}]},{conditions:[{fn:"booleanEquals",argv:[{ref:"UseDualStack"},!0]}],type:"tree",rules:[{conditions:[{fn:"booleanEquals",argv:[!0,{fn:"getAttr",argv:[{ref:"PartitionResult"},"supportsDualStack"]}]}],type:"tree",rules:[{conditions:[],endpoint:{url:"https://messaging-chime.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:{},headers:{}},type:"endpoint"}]},{conditions:[],error:"DualStack is enabled but this partition does not support DualStack",type:"error"}]},{conditions:[],endpoint:{url:"https://messaging-chime.{Region}.{PartitionResult#dnsSuffix}",properties:{},headers:{}},type:"endpoint"}]}]},ln=(e,t={})=>((e,t)=>{const{endpointParams:n,logger:i}=t,{parameters:r,rules:s}=e;t.logger?.debug?.(At,`Initial EndpointParams: ${zt(n)}`);const a=Object.entries(r).filter((([,e])=>null!=e.default)).map((([e,t])=>[e,t.default]));if(a.length>0)for(const[e,t]of a)n[e]=n[e]??t;const o=Object.entries(r).filter((([,e])=>e.required)).map((([e])=>e));for(const e of o)if(null==n[e])throw new Rt(`Missing required parameter: '${e}'`);const c=on(s,{endpointParams:n,logger:i,referenceRecord:{}});if(t.endpointParams?.Endpoint)try{const e=new URL(t.endpointParams.Endpoint),{protocol:n,port:i}=e;c.url.protocol=n,c.url.port=i}catch(e){}return t.logger?.debug?.(At,`Resolved endpoint: ${zt(c)}`),c})(cn,{endpointParams:e,logger:t.logger}),un=["in-region","cross-region","mobile","standard","legacy"],dn=e=>{const t=(({defaultsMode:e}={})=>Q((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?Mt().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 ${un.join(", ")}, got ${t}`)}})))(e),n=()=>t().then(at),i=(e=>({apiVersion:"2021-05-15",base64Decoder:e?.base64Decoder??vt,base64Encoder:e?.base64Encoder??yt,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??ln,logger:e?.logger??new Ie,serviceId:e?.serviceId??"Chime SDK Messaging",urlParser:e?.urlParser??M}))(e);return{...i,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??xt,credentialDefaultProvider:e?.credentialDefaultProvider??(e=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??St({serviceId:i.serviceId,clientVersion:"3.212.0"}),maxAttempts:e?.maxAttempts??3,region:e?.region??("Region is missing",()=>Promise.reject("Region is missing")),requestHandler:e?.requestHandler??new pt(n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||L),sha256:e?.sha256??ht.Sha256,streamCollector:e?.streamCollector??bt,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(!1)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(!1)),utf8Decoder:e?.utf8Decoder??_t.fromUtf8,utf8Encoder:e?.utf8Encoder??_t.toUtf8}};class hn extends Oe{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 o(t);const e=await t();return o(e)},useFipsEndpoint:async()=>{const e="string"==typeof t?t:await t();return!!a(e)||("boolean"==typeof n?Promise.resolve(n):n())}}})((t=dn(e),{...t,useDualstackEndpoint:t.useDualstackEndpoint??!1,useFipsEndpoint:t.useFipsEndpoint??!1,defaultSigningName:"chime"})),i=(e=>{const t=w(e.maxAttempts??3);return{...e,maxAttempts:t,retryStrategy:async()=>e.retryStrategy?e.retryStrategy:await w(e.retryMode)()===T.ADAPTIVE?new Y(t):new $(t)}})((e=>{const t=e.tls??!0,{endpoint:n}=e,i=null!=n?async()=>(e=>"object"==typeof e?"url"in e?M(e.url):e:M(e))(await w(n)()):void 0,r=!!n;return{...e,endpoint:i,tls:t,isCustomEndpoint:r,useDualstackEndpoint:w(e.useDualstackEndpoint??!1),useFipsEndpoint:w(e.useFipsEndpoint??!1)}})(n)),r=(e=>{const t=e.credentials?"function"==typeof(s=e.credentials)?Q(s,(e=>void 0!==e.expiration&&e.expiration.getTime()-Date.now()<3e5),(e=>void 0!==e.expiration)):w(s):e.credentialDefaultProvider(e),{signingEscapePath:n=!0,systemClockOffset:i=e.systemClockOffset||0,sha256:r}=e;var s;let a;return a=e.signer?w(e.signer):e.regionInfoProvider?()=>w(e.region)().then((async t=>[await e.regionInfoProvider(t,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},t])).then((([i,s])=>{const{signingRegion:a,signingService:o}=i;e.signingRegion=e.signingRegion||a||s,e.signingName=e.signingName||o||e.serviceId;const c={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:r,uriEscapePath:n};return new(e.signerConstructor||Se)(c)})):async i=>{const s=(i=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await w(e.region)(),properties:{}},i)).signingRegion,a=i.signingName;e.signingRegion=e.signingRegion||s,e.signingName=e.signingName||a||e.serviceId;const o={...e,credentials:t,region:e.signingRegion,service:e.signingName,sha256:r,uriEscapePath:n};return new(e.signerConstructor||Se)(o)},{...e,systemClockOffset:i,signingEscapePath:n,credentials:t,signer:a}})(i),s=(d=r,{...d,customUserAgent:"string"==typeof d.customUserAgent?[[d.customUserAgent]]:d.customUserAgent});var d,h;super(s),this.config=s,this.middlewareStack.use((e=>({applyToStack:t=>{t.add((e=>(t,n)=>async i=>{const r=await e.retryStrategy();return r?.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",r.mode]]),r.retry(t,i)})(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(c.isInstance(i)){const{body:e,headers:t}=i;if(e&&-1===Object.keys(t).map((e=>e.toLowerCase())).indexOf(l))try{const t=n(e);i.headers={...i.headers,[l]:String(t)}}catch(e){}}return e({...t,request:i})}),u)}}))(this.config)),this.middlewareStack.use((e=>({applyToStack:t=>{t.add((e=>t=>async n=>{if(!c.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),S)}}))(this.config)),this.middlewareStack.use((this.config,{applyToStack:e=>{e.add(((e,t)=>async n=>{const{clientName:i,commandName:r,inputFilterSensitiveLog:s,logger:a,outputFilterSensitiveLog:o}=t,c=await e(n);if(!a)return c;if("function"==typeof a.info){const{$metadata:e,...t}=c.output;a.info({clientName:i,commandName:r,input:s(n.input),output:o(t),metadata:e})}return c}),_)}})),this.middlewareStack.use((e=>({applyToStack:t=>{t.add((e=>t=>async n=>{const{request:i}=n;if(!c.isInstance(i)||"node"!==e.runtime||i.headers.hasOwnProperty("X-Amzn-Trace-Id"))return t(n);const r=C.env.AWS_LAMBDA_FUNCTION_NAME,s=C.env._X_AMZN_TRACE_ID,a=e=>"string"==typeof e&&e.length>0;return a(r)&&a(s)&&(i.headers["X-Amzn-Trace-Id"]=s),t({...n,request:i})})(e),E)}}))(this.config)),this.middlewareStack.use((e=>({applyToStack:t=>{t.addRelativeTo((e=>(t,n)=>async function(i){if(!c.isInstance(i.request))return t(i);const r=n.endpointV2?.properties?.authSchemes?.[0],s="sigv4a"===r?.name?r?.signingRegionSet?.join(","):void 0,a=await e.signer(r),o=await t({...i,request:await a.sign(i.request,{signingDate:Ee(e.systemClockOffset),signingRegion:s||n.signing_region,signingService:n.signing_service})}).catch((t=>{const n=t.ServerTime??Le(t.$response);throw n&&(e.systemClockOffset=Te(n,e.systemClockOffset)),t})),l=Le(o.response);return l&&(e.systemClockOffset=Te(l,e.systemClockOffset)),o})(e),Ae)}}))(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(!c.isInstance(r))return e(i);const{headers:s}=r,a=n?.userAgent?.map(He)||[],o=(await t.defaultUserAgentProvider()).map(He),l=t?.customUserAgent?.map(He)||[],u=[...o,...a,...l].join(" "),d=[...o.filter((e=>e.startsWith("aws-sdk-"))),...l].join(" ");return"browser"!==t.runtime?(d&&(s[Re]=s[Re]?`${s[ze]} ${d}`:d),s[ze]=u):s[Re]=u,e({...i,request:r})}),ke)}}))}destroy(){super.destroy()}}class fn extends nt{constructor(e){super(e),Object.setPrototypeOf(this,fn.prototype)}}var pn,mn,gn,vn,yn,bn,xn,wn,Mn,Sn,_n,Cn,En,Tn;!function(e){e.ALL="ALL",e.FILTERED="FILTERED",e.NONE="NONE"}(pn||(pn={})),function(e){e.DEFAULT="DEFAULT",e.HIDDEN="HIDDEN"}(mn||(mn={})),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"}(gn||(gn={}));class Ln extends fn{constructor(e){super({name:"BadRequestException",$fault:"client",...e}),this.name="BadRequestException",this.$fault="client",Object.setPrototypeOf(this,Ln.prototype),this.Code=e.Code,this.Message=e.Message}}class An extends fn{constructor(e){super({name:"ConflictException",$fault:"client",...e}),this.name="ConflictException",this.$fault="client",Object.setPrototypeOf(this,An.prototype),this.Code=e.Code,this.Message=e.Message}}class zn extends fn{constructor(e){super({name:"ForbiddenException",$fault:"client",...e}),this.name="ForbiddenException",this.$fault="client",Object.setPrototypeOf(this,zn.prototype),this.Code=e.Code,this.Message=e.Message}}class Rn extends fn{constructor(e){super({name:"NotFoundException",$fault:"client",...e}),this.name="NotFoundException",this.$fault="client",Object.setPrototypeOf(this,Rn.prototype),this.Code=e.Code,this.Message=e.Message}}class Pn extends fn{constructor(e){super({name:"ServiceFailureException",$fault:"server",...e}),this.name="ServiceFailureException",this.$fault="server",Object.setPrototypeOf(this,Pn.prototype),this.Code=e.Code,this.Message=e.Message}}class Hn extends fn{constructor(e){super({name:"ServiceUnavailableException",$fault:"server",...e}),this.name="ServiceUnavailableException",this.$fault="server",Object.setPrototypeOf(this,Hn.prototype),this.Code=e.Code,this.Message=e.Message}}class kn extends fn{constructor(e){super({name:"ThrottledClientException",$fault:"client",...e}),this.name="ThrottledClientException",this.$fault="client",Object.setPrototypeOf(this,kn.prototype),this.Code=e.Code,this.Message=e.Message}}class In extends fn{constructor(e){super({name:"UnauthorizedClientException",$fault:"client",...e}),this.name="UnauthorizedClientException",this.$fault="client",Object.setPrototypeOf(this,In.prototype),this.Code=e.Code,this.Message=e.Message}}class Vn extends fn{constructor(e){super({name:"ResourceLimitExceededException",$fault:"client",...e}),this.name="ResourceLimitExceededException",this.$fault="client",Object.setPrototypeOf(this,Vn.prototype),this.Code=e.Code,this.Message=e.Message}}!function(e){e.RESTRICTED="RESTRICTED",e.UNRESTRICTED="UNRESTRICTED"}(vn||(vn={})),function(e){e.PRIVATE="PRIVATE",e.PUBLIC="PUBLIC"}(yn||(yn={})),function(e){e.ASYNC="ASYNC"}(bn||(bn={})),function(e){e.ABORT="ABORT",e.CONTINUE="CONTINUE"}(xn||(xn={})),function(e){e.DEFAULT="DEFAULT",e.VOIP="VOIP"}(wn||(wn={})),function(e){e.NON_PERSISTENT="NON_PERSISTENT",e.PERSISTENT="PERSISTENT"}(Mn||(Mn={})),function(e){e.DENIED="DENIED",e.FAILED="FAILED",e.PENDING="PENDING",e.SENT="SENT"}(Sn||(Sn={})),function(e){e.CONTROL="CONTROL",e.STANDARD="STANDARD"}(_n||(_n={})),function(e){e.ASCENDING="ASCENDING",e.DESCENDING="DESCENDING"}(Cn||(Cn={})),function(e){e.MEMBERS="MEMBERS"}(En||(En={})),function(e){e.EQUALS="EQUALS",e.INCLUDES="INCLUDES"}(Tn||(Tn={}));const Nn=e=>({...e}),Dn=e=>({...e}),On=e=>({...e,...e.Name&&{Name:Be}}),Fn=e=>({...e,...e.InvitedBy&&{InvitedBy:On(e.InvitedBy)},...e.Members&&{Members:e.Members.map((e=>On(e)))}}),Bn=e=>({...e}),Un=e=>({...e}),Wn=e=>({...e,...e.BatchChannelMemberships&&{BatchChannelMemberships:Fn(e.BatchChannelMemberships)}}),Gn=e=>({...e}),jn=e=>({...e,...e.Name&&{Name:Be},...e.Metadata&&{Metadata:Be},...e.CreatedBy&&{CreatedBy:On(e.CreatedBy)}}),qn=e=>({...e,...e.Name&&{Name:Be},...e.Metadata&&{Metadata:Be}}),$n=e=>({...e,...e.Member&&{Member:On(e.Member)},...e.CreatedBy&&{CreatedBy:On(e.CreatedBy)}}),Xn=e=>({...e,...e.Member&&{Member:On(e.Member)}}),Kn=e=>({...e}),Yn=e=>({...e}),Jn=e=>({...e,...e.Name&&{Name:Be}}),Zn=e=>({...e,...e.Processors&&{Processors:e.Processors.map((e=>Jn(e)))},...e.Name&&{Name:Be}}),Qn=e=>({...e,...e.StringValues&&{StringValues:Be}}),ei=e=>({...e,...e.Title&&{Title:Be},...e.Body&&{Body:Be}}),ti=e=>({...e,...e.Content&&{Content:Be},...e.Metadata&&{Metadata:Be},...e.PushNotification&&{PushNotification:ei(e.PushNotification)},...e.MessageAttributes&&{MessageAttributes:Object.entries(e.MessageAttributes).reduce(((e,[t,n])=>(e[t]=Qn(n),e)),{})}}),ni=e=>({...e,...e.ChannelMessage&&{ChannelMessage:ti(e.ChannelMessage)}}),ii=e=>({...e}),ri=e=>({...e,...e.Name&&{Name:Be},...e.Processors&&{Processors:e.Processors.map((e=>Jn(e)))}}),si=e=>({...e,...e.InvitedBy&&{InvitedBy:On(e.InvitedBy)},...e.Member&&{Member:On(e.Member)}}),ai=e=>({...e,...e.Name&&{Name:Be},...e.Metadata&&{Metadata:Be}}),oi=e=>({...e,...e.ChannelSummary&&{ChannelSummary:ai(e.ChannelSummary)}}),ci=e=>({...e,...e.FilterRule&&{FilterRule:Be}}),li=e=>({...e,...e.PushNotifications&&{PushNotifications:ci(e.PushNotifications)}}),ui=e=>({...e,...e.Member&&{Member:On(e.Member)}}),di=e=>({...e}),hi=e=>({...e,...e.Content&&{Content:Be},...e.Metadata&&{Metadata:Be},...e.Sender&&{Sender:On(e.Sender)},...e.MessageAttributes&&{MessageAttributes:Object.entries(e.MessageAttributes).reduce(((e,[t,n])=>(e[t]=Qn(n),e)),{})}}),fi=e=>({...e,...e.Content&&{Content:Be},...e.Metadata&&{Metadata:Be},...e.Sender&&{Sender:On(e.Sender)},...e.MessageAttributes&&{MessageAttributes:Object.entries(e.MessageAttributes).reduce(((e,[t,n])=>(e[t]=Qn(n),e)),{})}}),pi=e=>({...e,...e.ChannelSummary&&{ChannelSummary:ai(e.ChannelSummary)}}),mi=e=>({...e,...e.Moderator&&{Moderator:On(e.Moderator)},...e.CreatedBy&&{CreatedBy:On(e.CreatedBy)}}),gi=e=>({...e,...e.Moderator&&{Moderator:On(e.Moderator)}}),vi=e=>({...e,...e.Key&&{Key:Be},...e.Value&&{Value:Be}}),yi=e=>({...e,...e.Name&&{Name:Be},...e.Metadata&&{Metadata:Be},...e.ClientRequestToken&&{ClientRequestToken:Be},...e.Tags&&{Tags:e.Tags.map((e=>vi(e)))},...e.ChannelId&&{ChannelId:Be}}),bi=e=>({...e}),xi=e=>({...e}),wi=e=>({...e,...e.Member&&{Member:On(e.Member)}}),Mi=e=>({...e,...e.Processors&&{Processors:e.Processors.map((e=>Jn(e)))},...e.Name&&{Name:Be},...e.Tags&&{Tags:e.Tags.map((e=>vi(e)))},...e.ClientRequestToken&&{ClientRequestToken:Be}}),Si=e=>({...e}),_i=e=>({...e}),Ci=e=>({...e,...e.Member&&{Member:On(e.Member)}}),Ei=e=>({...e}),Ti=e=>({...e,...e.ChannelModerator&&{ChannelModerator:On(e.ChannelModerator)}}),Li=e=>({...e}),Ai=e=>({...e}),zi=e=>({...e}),Ri=e=>({...e}),Pi=e=>({...e}),Hi=e=>({...e}),ki=e=>({...e}),Ii=e=>({...e,...e.Channel&&{Channel:jn(e.Channel)}}),Vi=e=>({...e}),Ni=e=>({...e,...e.ChannelBan&&{ChannelBan:$n(e.ChannelBan)}}),Di=e=>({...e}),Oi=e=>({...e,...e.ChannelFlow&&{ChannelFlow:Zn(e.ChannelFlow)}}),Fi=e=>({...e}),Bi=e=>({...e,...e.ChannelMembership&&{ChannelMembership:si(e.ChannelMembership)}}),Ui=e=>({...e}),Wi=e=>({...e,...e.ChannelMembership&&{ChannelMembership:oi(e.ChannelMembership)}}),Gi=e=>({...e}),ji=e=>({...e,...e.Channel&&{Channel:pi(e.Channel)}}),qi=e=>({...e}),$i=e=>({...e,...e.ChannelModerator&&{ChannelModerator:mi(e.ChannelModerator)}}),Xi=e=>({...e}),Ki=e=>({...e}),Yi=e=>({...e,...e.Member&&{Member:On(e.Member)},...e.Preferences&&{Preferences:li(e.Preferences)}}),Ji=e=>({...e}),Zi=e=>({...e,...e.ChannelMessage&&{ChannelMessage:hi(e.ChannelMessage)}}),Qi=e=>({...e}),er=e=>({...e}),tr=e=>({...e}),nr=e=>({...e}),ir=e=>({...e}),rr=e=>({...e,...e.NextToken&&{NextToken:Be}}),sr=e=>({...e,...e.NextToken&&{NextToken:Be},...e.ChannelBans&&{ChannelBans:e.ChannelBans.map((e=>Xn(e)))}}),ar=e=>({...e,...e.NextToken&&{NextToken:Be}}),or=e=>({...e,...e.ChannelFlows&&{ChannelFlows:e.ChannelFlows.map((e=>ri(e)))},...e.NextToken&&{NextToken:Be}}),cr=e=>({...e,...e.NextToken&&{NextToken:Be}}),lr=e=>({...e,...e.ChannelMemberships&&{ChannelMemberships:e.ChannelMemberships.map((e=>ui(e)))},...e.NextToken&&{NextToken:Be}}),ur=e=>({...e,...e.NextToken&&{NextToken:Be}}),dr=e=>({...e,...e.ChannelMemberships&&{ChannelMemberships:e.ChannelMemberships.map((e=>oi(e)))},...e.NextToken&&{NextToken:Be}}),hr=e=>({...e,...e.NextToken&&{NextToken:Be}}),fr=e=>({...e,...e.NextToken&&{NextToken:Be},...e.ChannelMessages&&{ChannelMessages:e.ChannelMessages.map((e=>fi(e)))}}),pr=e=>({...e,...e.NextToken&&{NextToken:Be}}),mr=e=>({...e,...e.NextToken&&{NextToken:Be},...e.ChannelModerators&&{ChannelModerators:e.ChannelModerators.map((e=>gi(e)))}}),gr=e=>({...e,...e.NextToken&&{NextToken:Be}}),vr=e=>({...e,...e.Channels&&{Channels:e.Channels.map((e=>ai(e)))},...e.NextToken&&{NextToken:Be}}),yr=e=>({...e,...e.NextToken&&{NextToken:Be}}),br=e=>({...e,...e.Channels&&{Channels:e.Channels.map((e=>qn(e)))},...e.NextToken&&{NextToken:Be}}),xr=e=>({...e,...e.NextToken&&{NextToken:Be}}),wr=e=>({...e,...e.Channels&&{Channels:e.Channels.map((e=>pi(e)))},...e.NextToken&&{NextToken:Be}}),Mr=e=>({...e,...e.NextToken&&{NextToken:Be}}),Sr=e=>({...e}),_r=e=>({...e,...e.NextToken&&{NextToken:Be}}),Cr=e=>({...e}),Er=e=>({...e,...e.Tags&&{Tags:e.Tags.map((e=>vi(e)))}}),Tr=e=>({...e,...e.Preferences&&{Preferences:li(e.Preferences)}}),Lr=e=>({...e,...e.Member&&{Member:On(e.Member)},...e.Preferences&&{Preferences:li(e.Preferences)}}),Ar=e=>({...e}),zr=e=>({...e}),Rr=e=>({...e}),Pr=e=>({...e,...e.NextToken&&{NextToken:Be}}),Hr=e=>({...e,...e.Channels&&{Channels:e.Channels.map((e=>ai(e)))},...e.NextToken&&{NextToken:Be}}),kr=e=>({...e,...e.Content&&{Content:Be},...e.Metadata&&{Metadata:Be},...e.ClientRequestToken&&{ClientRequestToken:Be},...e.PushNotification&&{PushNotification:ei(e.PushNotification)},...e.MessageAttributes&&{MessageAttributes:Object.entries(e.MessageAttributes).reduce(((e,[t,n])=>(e[t]=Qn(n),e)),{})}}),Ir=e=>({...e}),Vr=e=>({...e,...e.Tags&&{Tags:e.Tags.map((e=>vi(e)))}}),Nr=e=>({...e,...e.TagKeys&&{TagKeys:Be}}),Dr=e=>({...e,...e.Name&&{Name:Be},...e.Metadata&&{Metadata:Be}}),Or=e=>({...e}),Fr=e=>({...e,...e.Processors&&{Processors:e.Processors.map((e=>Jn(e)))},...e.Name&&{Name:Be}}),Br=e=>({...e}),Ur=e=>({...e,...e.Content&&{Content:Be},...e.Metadata&&{Metadata:Be}}),Wr=e=>({...e}),Gr=e=>({...e}),jr=e=>({...e}),qr=ct,$r=async(e,t)=>{const n=qr({}),i=e.body;null!=i.Code&&(n.Code=Ye(i.Code)),null!=i.Message&&(n.Message=Ye(i.Message));const r=new Ln({$metadata:Ns(e),...n});return it(r,e.body)},Xr=async(e,t)=>{const n=qr({}),i=e.body;null!=i.Code&&(n.Code=Ye(i.Code)),null!=i.Message&&(n.Message=Ye(i.Message));const r=new An({$metadata:Ns(e),...n});return it(r,e.body)},Kr=async(e,t)=>{const n=qr({}),i=e.body;null!=i.Code&&(n.Code=Ye(i.Code)),null!=i.Message&&(n.Message=Ye(i.Message));const r=new zn({$metadata:Ns(e),...n});return it(r,e.body)},Yr=async(e,t)=>{const n=qr({}),i=e.body;null!=i.Code&&(n.Code=Ye(i.Code)),null!=i.Message&&(n.Message=Ye(i.Message));const r=new Rn({$metadata:Ns(e),...n});return it(r,e.body)},Jr=async(e,t)=>{const n=qr({}),i=e.body;null!=i.Code&&(n.Code=Ye(i.Code)),null!=i.Message&&(n.Message=Ye(i.Message));const r=new Vn({$metadata:Ns(e),...n});return it(r,e.body)},Zr=async(e,t)=>{const n=qr({}),i=e.body;null!=i.Code&&(n.Code=Ye(i.Code)),null!=i.Message&&(n.Message=Ye(i.Message));const r=new Pn({$metadata:Ns(e),...n});return it(r,e.body)},Qr=async(e,t)=>{const n=qr({}),i=e.body;null!=i.Code&&(n.Code=Ye(i.Code)),null!=i.Message&&(n.Message=Ye(i.Message));const r=new Hn({$metadata:Ns(e),...n});return it(r,e.body)},es=async(e,t)=>{const n=qr({}),i=e.body;null!=i.Code&&(n.Code=Ye(i.Code)),null!=i.Message&&(n.Message=Ye(i.Message));const r=new kn({$metadata:Ns(e),...n});return it(r,e.body)},ts=async(e,t)=>{const n=qr({}),i=e.body;null!=i.Code&&(n.Code=Ye(i.Code)),null!=i.Message&&(n.Message=Ye(i.Message));const r=new In({$metadata:Ns(e),...n});return it(r,e.body)},ns=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),is=(e,t)=>({...null!=e.PushNotifications&&{PushNotifications:ms(e.PushNotifications,t)}}),rs=(e,t)=>({...null!=e.Content&&{Content:e.Content},...null!=e.MessageAttributes&&{MessageAttributes:ls(e.MessageAttributes,t)},...null!=e.MessageId&&{MessageId:e.MessageId},...null!=e.Metadata&&{Metadata:e.Metadata},...null!=e.PushNotification&&{PushNotification:ps(e.PushNotification,t)},...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId}}),ss=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),as=(e,t)=>({...null!=e.MaximumSubChannels&&{MaximumSubChannels:e.MaximumSubChannels},...null!=e.MinimumMembershipPercentage&&{MinimumMembershipPercentage:e.MinimumMembershipPercentage},...null!=e.TargetMembershipsPerSubChannel&&{TargetMembershipsPerSubChannel:e.TargetMembershipsPerSubChannel}}),os=(e,t)=>({...null!=e.InvocationType&&{InvocationType:e.InvocationType},...null!=e.ResourceArn&&{ResourceArn:e.ResourceArn}}),cs=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),ls=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>(null===i||(e[n]=ds(i,t)),e)),{}),us=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),ds=(e,t)=>({...null!=e.StringValues&&{StringValues:us(e.StringValues)}}),hs=(e,t)=>({...null!=e.Lambda&&{Lambda:os(e.Lambda)}}),fs=(e,t)=>e.filter((e=>null!=e)).map((e=>((e,t)=>({...null!=e.Configuration&&{Configuration:hs(e.Configuration)},...null!=e.ExecutionOrder&&{ExecutionOrder:e.ExecutionOrder},...null!=e.FallbackAction&&{FallbackAction:e.FallbackAction},...null!=e.Name&&{Name:e.Name}}))(e))),ps=(e,t)=>({...null!=e.Body&&{Body:e.Body},...null!=e.Title&&{Title:e.Title},...null!=e.Type&&{Type:e.Type}}),ms=(e,t)=>({...null!=e.AllowNotifications&&{AllowNotifications:e.AllowNotifications},...null!=e.FilterRule&&{FilterRule:e.FilterRule}}),gs=(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:vs(e.Values,t)}}))(e,t))),vs=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),ys=(e,t)=>e.filter((e=>null!=e)).map((e=>e)),bs=(e,t)=>e.filter((e=>null!=e)).map((e=>((e,t)=>({...null!=e.Key&&{Key:e.Key},...null!=e.Value&&{Value:e.Value}}))(e))),xs=(e,t)=>({ReadMarkerTimestamp:null!=e.ReadMarkerTimestamp?Xe(tt(We(e.ReadMarkerTimestamp))):void 0,SubChannelId:Ye(e.SubChannelId),Type:Ye(e.Type)}),ws=(e,t)=>({AppInstanceUserMembershipSummary:null!=e.AppInstanceUserMembershipSummary?xs(e.AppInstanceUserMembershipSummary):void 0,ChannelSummary:null!=e.ChannelSummary?Cs(e.ChannelSummary,t):void 0}),Ms=(e,t)=>({PushNotifications:null!=e.PushNotifications?Vs(e.PushNotifications,t):void 0}),Ss=(e,t)=>({Detail:Ye(e.Detail),Value:Ye(e.Value)}),_s=(e,t)=>({ChannelSummary:null!=e.ChannelSummary?Cs(e.ChannelSummary,t):void 0}),Cs=(e,t)=>({ChannelArn:Ye(e.ChannelArn),LastMessageTimestamp:null!=e.LastMessageTimestamp?Xe(tt(We(e.LastMessageTimestamp))):void 0,Metadata:Ye(e.Metadata),Mode:Ye(e.Mode),Name:Ye(e.Name),Privacy:Ye(e.Privacy)}),Es=(e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:Cs(e,t))),Ts=(e,t)=>({MaximumSubChannels:je(e.MaximumSubChannels),MinimumMembershipPercentage:je(e.MinimumMembershipPercentage),TargetMembershipsPerSubChannel:je(e.TargetMembershipsPerSubChannel)}),Ls=(e,t)=>({Arn:Ye(e.Arn),Name:Ye(e.Name)}),As=(e,t)=>({InvocationType:Ye(e.InvocationType),ResourceArn:Ye(e.ResourceArn)}),zs=(e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:Ls(e,t))),Rs=(e,t)=>Object.entries(e).reduce(((e,[n,i])=>(null===i||(e[n]=Hs(i,t)),e)),{}),Ps=(e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:Ye(e))),Hs=(e,t)=>({StringValues:null!=e.StringValues?Ps(e.StringValues):void 0}),ks=(e,t)=>({Lambda:null!=e.Lambda?As(e.Lambda):void 0}),Is=(e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({Configuration:null!=e.Configuration?ks(e.Configuration):void 0,ExecutionOrder:je(e.ExecutionOrder),FallbackAction:Ye(e.FallbackAction),Name:Ye(e.Name)}))(e))),Vs=(e,t)=>({AllowNotifications:Ye(e.AllowNotifications),FilterRule:Ye(e.FilterRule)}),Ns=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"]}),Ds=(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),Fs=(e,t)=>((e,t)=>Ds(e,t).then((e=>t.utf8Encoder(e))))(e,t).then((e=>e.length?JSON.parse(e):{})),Bs=async(e,t)=>{const n=await Fs(e,t);return n.message=n.message??n.Message,n},Us=(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,"x-amzn-errortype",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 Ws extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Ws.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"AssociateChannelFlowCommand",inputFilterSensitiveLog:Dn,outputFilterSensitiveLog:e=>e},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let o,l=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/channel-flow`;return l=dt(l,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=JSON.stringify({...null!=e.ChannelFlowArn&&{ChannelFlowArn:e.ChannelFlowArn}}),new c({protocol:i,hostname:n,port:r,method:"PUT",headers:a,path:l,body:o})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await Yr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)});return await Ds(e.body,t),n})(e,t)}}class Gs extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Gs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"BatchCreateChannelMembershipCommand",inputFilterSensitiveLog:Bn,outputFilterSensitiveLog:Wn},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/memberships`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const l=qr({operation:[,"batch-create"]});let u;return u=JSON.stringify({...null!=e.MemberArns&&{MemberArns:cs(e.MemberArns)},...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId},...null!=e.Type&&{Type:e.Type}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:a,path:o,query:l,body:u})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await Yr(n,t);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await Jr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.BatchChannelMemberships&&(n.BatchChannelMemberships=((e,t)=>({ChannelArn:Ye(e.ChannelArn),InvitedBy:null!=e.InvitedBy?Ls(e.InvitedBy,t):void 0,Members:null!=e.Members?zs(e.Members,t):void 0,SubChannelId:Ye(e.SubChannelId),Type:Ye(e.Type)}))(i.BatchChannelMemberships,t)),null!=i.Errors&&(n.Errors=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({ErrorCode:Ye(e.ErrorCode),ErrorMessage:Ye(e.ErrorMessage),MemberArn:Ye(e.MemberArn)}))(e))))(i.Errors)),n})(e,t)}}class js extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,js.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ChannelFlowCallbackCommand",inputFilterSensitiveLog:ni,outputFilterSensitiveLog:ii},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint();let a=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}`;a=dt(a,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const o=qr({operation:[,"channel-flow-callback"]});let l;return l=JSON.stringify({CallbackId:e.CallbackId??G(),...null!=e.ChannelMessage&&{ChannelMessage:rs(e.ChannelMessage,t)},...null!=e.DeleteResource&&{DeleteResource:e.DeleteResource}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:{"content-type":"application/json"},path:a,query:o,body:l})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.CallbackId&&(n.CallbackId=Ye(i.CallbackId)),null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),n})(e,t)}}class qs extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,qs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"CreateChannelBanCommand",inputFilterSensitiveLog:xi,outputFilterSensitiveLog:wi},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let o,l=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/bans`;return l=dt(l,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=JSON.stringify({...null!=e.MemberArn&&{MemberArn:e.MemberArn}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:a,path:l,body:o})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await Jr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.Member&&(n.Member=Ls(i.Member,t)),n})(e,t)}}class $s extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,$s.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"CreateChannelCommand",inputFilterSensitiveLog:yi,outputFilterSensitiveLog:bi},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer}),o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels`;let l;return l=JSON.stringify({...null!=e.AppInstanceArn&&{AppInstanceArn:e.AppInstanceArn},...null!=e.ChannelId&&{ChannelId:e.ChannelId},ClientRequestToken:e.ClientRequestToken??G(),...null!=e.ElasticChannelConfiguration&&{ElasticChannelConfiguration:as(e.ElasticChannelConfiguration)},...null!=e.MemberArns&&{MemberArns:ns(e.MemberArns)},...null!=e.Metadata&&{Metadata:e.Metadata},...null!=e.Mode&&{Mode:e.Mode},...null!=e.ModeratorArns&&{ModeratorArns:ss(e.ModeratorArns)},...null!=e.Name&&{Name:e.Name},...null!=e.Privacy&&{Privacy:e.Privacy},...null!=e.Tags&&{Tags:bs(e.Tags)}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:a,path:o,body:l})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await Jr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),n})(e,t)}}class Xs extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Xs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"CreateChannelFlowCommand",inputFilterSensitiveLog:Mi,outputFilterSensitiveLog:Si},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channel-flows`;let o;return o=JSON.stringify({...null!=e.AppInstanceArn&&{AppInstanceArn:e.AppInstanceArn},...null!=e.ClientRequestToken&&{ClientRequestToken:e.ClientRequestToken},...null!=e.Name&&{Name:e.Name},...null!=e.Processors&&{Processors:fs(e.Processors)},...null!=e.Tags&&{Tags:bs(e.Tags)}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:{"content-type":"application/json"},path:a,body:o})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await Jr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelFlowArn&&(n.ChannelFlowArn=Ye(i.ChannelFlowArn)),n})(e,t)}}class Ks extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Ks.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"CreateChannelMembershipCommand",inputFilterSensitiveLog:_i,outputFilterSensitiveLog:Ci},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let o,l=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/memberships`;return l=dt(l,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=JSON.stringify({...null!=e.MemberArn&&{MemberArn:e.MemberArn},...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId},...null!=e.Type&&{Type:e.Type}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:a,path:l,body:o})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await Yr(n,t);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await Jr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.Member&&(n.Member=Ls(i.Member,t)),null!=i.SubChannelId&&(n.SubChannelId=Ye(i.SubChannelId)),n})(e,t)}}class Ys extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Ys.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"CreateChannelModeratorCommand",inputFilterSensitiveLog:Ei,outputFilterSensitiveLog:Ti},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let o,l=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/moderators`;return l=dt(l,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=JSON.stringify({...null!=e.ChannelModeratorArn&&{ChannelModeratorArn:e.ChannelModeratorArn}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:a,path:l,body:o})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await Jr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.ChannelModerator&&(n.ChannelModerator=Ls(i.ChannelModerator,t)),n})(e,t)}}class Js extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Js.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelBanCommand",inputFilterSensitiveLog:Ai,outputFilterSensitiveLog:e=>e},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/bans/{MemberArn}`;return o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1),new c({protocol:i,hostname:n,port:r,method:"DELETE",headers:a,path:o,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)});return await Ds(e.body,t),n})(e,t)}}class Zs extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Zs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelCommand",inputFilterSensitiveLog:Li,outputFilterSensitiveLog:e=>e},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const l=qr({"sub-channel-id":[,e.SubChannelId]});return new c({protocol:i,hostname:n,port:r,method:"DELETE",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)});return await Ds(e.body,t),n})(e,t)}}class Qs extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Qs.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelFlowCommand",inputFilterSensitiveLog:zi,outputFilterSensitiveLog:e=>e},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint();let a=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channel-flows/{ChannelFlowArn}`;return a=dt(a,e,"ChannelFlowArn",(()=>e.ChannelFlowArn),"{ChannelFlowArn}",!1),new c({protocol:i,hostname:n,port:r,method:"DELETE",headers:{},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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)});return await Ds(e.body,t),n})(e,t)}}class ea extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ea.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelMembershipCommand",inputFilterSensitiveLog:Ri,outputFilterSensitiveLog:e=>e},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/memberships/{MemberArn}`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1);const l=qr({"sub-channel-id":[,e.SubChannelId]});return new c({protocol:i,hostname:n,port:r,method:"DELETE",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)});return await Ds(e.body,t),n})(e,t)}}class ta extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ta.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelMessageCommand",inputFilterSensitiveLog:Pi,outputFilterSensitiveLog:e=>e},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/messages/{MessageId}`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"MessageId",(()=>e.MessageId),"{MessageId}",!1);const l=qr({"sub-channel-id":[,e.SubChannelId]});return new c({protocol:i,hostname:n,port:r,method:"DELETE",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)});return await Ds(e.body,t),n})(e,t)}}class na extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,na.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DeleteChannelModeratorCommand",inputFilterSensitiveLog:Hi,outputFilterSensitiveLog:e=>e},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/moderators/{ChannelModeratorArn}`;return o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"ChannelModeratorArn",(()=>e.ChannelModeratorArn),"{ChannelModeratorArn}",!1),new c({protocol:i,hostname:n,port:r,method:"DELETE",headers:a,path:o,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)});return await Ds(e.body,t),n})(e,t)}}class ia extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ia.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelBanCommand",inputFilterSensitiveLog:Vi,outputFilterSensitiveLog:Ni},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/bans/{MemberArn}`;return o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1),new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await Yr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelBan&&(n.ChannelBan=((e,t)=>({ChannelArn:Ye(e.ChannelArn),CreatedBy:null!=e.CreatedBy?Ls(e.CreatedBy,t):void 0,CreatedTimestamp:null!=e.CreatedTimestamp?Xe(tt(We(e.CreatedTimestamp))):void 0,Member:null!=e.Member?Ls(e.Member,t):void 0}))(i.ChannelBan,t)),n})(e,t)}}class ra extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ra.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelCommand",inputFilterSensitiveLog:ki,outputFilterSensitiveLog:Ii},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}`;return o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.Channel&&(n.Channel=((e,t)=>({ChannelArn:Ye(e.ChannelArn),ChannelFlowArn:Ye(e.ChannelFlowArn),CreatedBy:null!=e.CreatedBy?Ls(e.CreatedBy,t):void 0,CreatedTimestamp:null!=e.CreatedTimestamp?Xe(tt(We(e.CreatedTimestamp))):void 0,ElasticChannelConfiguration:null!=e.ElasticChannelConfiguration?Ts(e.ElasticChannelConfiguration,t):void 0,LastMessageTimestamp:null!=e.LastMessageTimestamp?Xe(tt(We(e.LastMessageTimestamp))):void 0,LastUpdatedTimestamp:null!=e.LastUpdatedTimestamp?Xe(tt(We(e.LastUpdatedTimestamp))):void 0,Metadata:Ye(e.Metadata),Mode:Ye(e.Mode),Name:Ye(e.Name),Privacy:Ye(e.Privacy)}))(i.Channel,t)),n})(e,t)}}class sa extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,sa.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelFlowCommand",inputFilterSensitiveLog:Di,outputFilterSensitiveLog:Oi},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint();let a=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channel-flows/{ChannelFlowArn}`;return a=dt(a,e,"ChannelFlowArn",(()=>e.ChannelFlowArn),"{ChannelFlowArn}",!1),new c({protocol:i,hostname:n,port:r,method:"GET",headers:{},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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelFlow&&(n.ChannelFlow=((e,t)=>({ChannelFlowArn:Ye(e.ChannelFlowArn),CreatedTimestamp:null!=e.CreatedTimestamp?Xe(tt(We(e.CreatedTimestamp))):void 0,LastUpdatedTimestamp:null!=e.LastUpdatedTimestamp?Xe(tt(We(e.LastUpdatedTimestamp))):void 0,Name:Ye(e.Name),Processors:null!=e.Processors?Is(e.Processors,t):void 0}))(i.ChannelFlow,t)),n})(e,t)}}class aa extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,aa.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelMembershipCommand",inputFilterSensitiveLog:Fi,outputFilterSensitiveLog:Bi},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/memberships/{MemberArn}`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1);const l=qr({"sub-channel-id":[,e.SubChannelId]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await Yr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelMembership&&(n.ChannelMembership=((e,t)=>({ChannelArn:Ye(e.ChannelArn),CreatedTimestamp:null!=e.CreatedTimestamp?Xe(tt(We(e.CreatedTimestamp))):void 0,InvitedBy:null!=e.InvitedBy?Ls(e.InvitedBy,t):void 0,LastUpdatedTimestamp:null!=e.LastUpdatedTimestamp?Xe(tt(We(e.LastUpdatedTimestamp))):void 0,Member:null!=e.Member?Ls(e.Member,t):void 0,SubChannelId:Ye(e.SubChannelId),Type:Ye(e.Type)}))(i.ChannelMembership,t)),n})(e,t)}}class oa extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,oa.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelMembershipForAppInstanceUserCommand",inputFilterSensitiveLog:Ui,outputFilterSensitiveLog:Wi},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const l=qr({scope:[,"app-instance-user-membership"],"app-instance-user-arn":[,e.AppInstanceUserArn]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelMembership&&(n.ChannelMembership=ws(i.ChannelMembership,t)),n})(e,t)}}class ca extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ca.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelModeratedByAppInstanceUserCommand",inputFilterSensitiveLog:Gi,outputFilterSensitiveLog:ji},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const l=qr({scope:[,"app-instance-user-moderated-channel"],"app-instance-user-arn":[,e.AppInstanceUserArn]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.Channel&&(n.Channel=_s(i.Channel,t)),n})(e,t)}}class la extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,la.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DescribeChannelModeratorCommand",inputFilterSensitiveLog:qi,outputFilterSensitiveLog:$i},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/moderators/{ChannelModeratorArn}`;return o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"ChannelModeratorArn",(()=>e.ChannelModeratorArn),"{ChannelModeratorArn}",!1),new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await Yr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelModerator&&(n.ChannelModerator=((e,t)=>({ChannelArn:Ye(e.ChannelArn),CreatedBy:null!=e.CreatedBy?Ls(e.CreatedBy,t):void 0,CreatedTimestamp:null!=e.CreatedTimestamp?Xe(tt(We(e.CreatedTimestamp))):void 0,Moderator:null!=e.Moderator?Ls(e.Moderator,t):void 0}))(i.ChannelModerator,t)),n})(e,t)}}class ua extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ua.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"DisassociateChannelFlowCommand",inputFilterSensitiveLog:Xi,outputFilterSensitiveLog:e=>e},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/channel-flow/{ChannelFlowArn}`;return o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"ChannelFlowArn",(()=>e.ChannelFlowArn),"{ChannelFlowArn}",!1),new c({protocol:i,hostname:n,port:r,method:"DELETE",headers:a,path:o,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await Yr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)});return await Ds(e.body,t),n})(e,t)}}class da extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,da.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"GetChannelMembershipPreferencesCommand",inputFilterSensitiveLog:Ki,outputFilterSensitiveLog:Yi},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/memberships/{MemberArn}/preferences`;return o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1),new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.Member&&(n.Member=Ls(i.Member,t)),null!=i.Preferences&&(n.Preferences=Ms(i.Preferences,t)),n})(e,t)}}class ha extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ha.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"GetChannelMessageCommand",inputFilterSensitiveLog:Ji,outputFilterSensitiveLog:Zi},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/messages/{MessageId}`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"MessageId",(()=>e.MessageId),"{MessageId}",!1);const l=qr({"sub-channel-id":[,e.SubChannelId]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"NotFoundException":case"com.amazonaws.chimesdkmessaging#NotFoundException":throw await Yr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelMessage&&(n.ChannelMessage=((e,t)=>({ChannelArn:Ye(e.ChannelArn),Content:Ye(e.Content),CreatedTimestamp:null!=e.CreatedTimestamp?Xe(tt(We(e.CreatedTimestamp))):void 0,LastEditedTimestamp:null!=e.LastEditedTimestamp?Xe(tt(We(e.LastEditedTimestamp))):void 0,LastUpdatedTimestamp:null!=e.LastUpdatedTimestamp?Xe(tt(We(e.LastUpdatedTimestamp))):void 0,MessageAttributes:null!=e.MessageAttributes?Rs(e.MessageAttributes,t):void 0,MessageId:Ye(e.MessageId),Metadata:Ye(e.Metadata),Persistence:Ye(e.Persistence),Redacted:Ue(e.Redacted),Sender:null!=e.Sender?Ls(e.Sender,t):void 0,Status:null!=e.Status?Ss(e.Status,t):void 0,SubChannelId:Ye(e.SubChannelId),Type:Ye(e.Type)}))(i.ChannelMessage,t)),n})(e,t)}}class fa extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,fa.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"GetChannelMessageStatusCommand",inputFilterSensitiveLog:Qi,outputFilterSensitiveLog:er},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/messages/{MessageId}`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"MessageId",(()=>e.MessageId),"{MessageId}",!1);const l=qr({scope:[,"message-status"],"sub-channel-id":[,e.SubChannelId]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.Status&&(n.Status=Ss(i.Status,t)),n})(e,t)}}class pa extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,pa.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"GetMessagingSessionEndpointCommand",inputFilterSensitiveLog:tr,outputFilterSensitiveLog:ir},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=`${s?.endsWith("/")?s.slice(0,-1):s||""}/endpoints/messaging-session`;let o;return o="",new c({protocol:i,hostname:n,port:r,method:"GET",headers:{"content-type":"application/json"},path:a,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.Endpoint&&(n.Endpoint=((e,t)=>({Url:Ye(e.Url)}))(i.Endpoint)),n})(e,t)}}class ma extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ma.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelBansCommand",inputFilterSensitiveLog:rr,outputFilterSensitiveLog:sr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/bans`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const l=qr({"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.ChannelBans&&(n.ChannelBans=((e,t)=>{const n=(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({Member:null!=e.Member?Ls(e.Member,t):void 0}))(e,t)));return n})(i.ChannelBans,t)),null!=i.NextToken&&(n.NextToken=Ye(i.NextToken)),n})(e,t)}}class ga extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ga.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelFlowsCommand",inputFilterSensitiveLog:ar,outputFilterSensitiveLog:or},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channel-flows`,o=qr({"app-instance-arn":[,e.AppInstanceArn],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:{},path:a,query:o,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelFlows&&(n.ChannelFlows=((e,t)=>{const n=(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({ChannelFlowArn:Ye(e.ChannelFlowArn),Name:Ye(e.Name),Processors:null!=e.Processors?Is(e.Processors,t):void 0}))(e,t)));return n})(i.ChannelFlows,t)),null!=i.NextToken&&(n.NextToken=Ye(i.NextToken)),n})(e,t)}}class va extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,va.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelMembershipsCommand",inputFilterSensitiveLog:cr,outputFilterSensitiveLog:lr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/memberships`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const l=qr({type:[,e.Type],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken],"sub-channel-id":[,e.SubChannelId]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.ChannelMemberships&&(n.ChannelMemberships=((e,t)=>{const n=(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({Member:null!=e.Member?Ls(e.Member,t):void 0}))(e,t)));return n})(i.ChannelMemberships,t)),null!=i.NextToken&&(n.NextToken=Ye(i.NextToken)),n})(e,t)}}class ya extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ya.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelMembershipsForAppInstanceUserCommand",inputFilterSensitiveLog:ur,outputFilterSensitiveLog:dr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer}),o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels`,l=qr({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 c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelMemberships&&(n.ChannelMemberships=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:ws(e,t))))(i.ChannelMemberships,t)),null!=i.NextToken&&(n.NextToken=Ye(i.NextToken)),n})(e,t)}}class ba extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ba.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelMessagesCommand",inputFilterSensitiveLog:hr,outputFilterSensitiveLog:fr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/messages`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const l=qr({"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 c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.ChannelMessages&&(n.ChannelMessages=((e,t)=>{const n=(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({Content:Ye(e.Content),CreatedTimestamp:null!=e.CreatedTimestamp?Xe(tt(We(e.CreatedTimestamp))):void 0,LastEditedTimestamp:null!=e.LastEditedTimestamp?Xe(tt(We(e.LastEditedTimestamp))):void 0,LastUpdatedTimestamp:null!=e.LastUpdatedTimestamp?Xe(tt(We(e.LastUpdatedTimestamp))):void 0,MessageAttributes:null!=e.MessageAttributes?Rs(e.MessageAttributes,t):void 0,MessageId:Ye(e.MessageId),Metadata:Ye(e.Metadata),Redacted:Ue(e.Redacted),Sender:null!=e.Sender?Ls(e.Sender,t):void 0,Status:null!=e.Status?Ss(e.Status,t):void 0,Type:Ye(e.Type)}))(e,t)));return n})(i.ChannelMessages,t)),null!=i.NextToken&&(n.NextToken=Ye(i.NextToken)),null!=i.SubChannelId&&(n.SubChannelId=Ye(i.SubChannelId)),n})(e,t)}}class xa extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,xa.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelModeratorsCommand",inputFilterSensitiveLog:pr,outputFilterSensitiveLog:mr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/moderators`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const l=qr({"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.ChannelModerators&&(n.ChannelModerators=((e,t)=>{const n=(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({Moderator:null!=e.Moderator?Ls(e.Moderator,t):void 0}))(e,t)));return n})(i.ChannelModerators,t)),null!=i.NextToken&&(n.NextToken=Ye(i.NextToken)),n})(e,t)}}class wa extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,wa.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelsAssociatedWithChannelFlowCommand",inputFilterSensitiveLog:yr,outputFilterSensitiveLog:br},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels`,o=qr({scope:[,"channel-flow-associations"],"channel-flow-arn":[,e.ChannelFlowArn],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:{},path:a,query:o,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(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:Ye(e.ChannelArn),Metadata:Ye(e.Metadata),Mode:Ye(e.Mode),Name:Ye(e.Name),Privacy:Ye(e.Privacy)}))(e))))(i.Channels)),null!=i.NextToken&&(n.NextToken=Ye(i.NextToken)),n})(e,t)}}class Ma extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Ma.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelsCommand",inputFilterSensitiveLog:gr,outputFilterSensitiveLog:vr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer}),o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels`,l=qr({"app-instance-arn":[,e.AppInstanceArn],privacy:[,e.Privacy],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.Channels&&(n.Channels=Es(i.Channels,t)),null!=i.NextToken&&(n.NextToken=Ye(i.NextToken)),n})(e,t)}}class Sa extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Sa.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListChannelsModeratedByAppInstanceUserCommand",inputFilterSensitiveLog:xr,outputFilterSensitiveLog:wr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer}),o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels`,l=qr({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 c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.Channels&&(n.Channels=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:_s(e,t))))(i.Channels,t)),null!=i.NextToken&&(n.NextToken=Ye(i.NextToken)),n})(e,t)}}class _a extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,_a.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListSubChannelsCommand",inputFilterSensitiveLog:Mr,outputFilterSensitiveLog:_r},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/subchannels`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1);const l=qr({"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:a,path:o,query:l,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.NextToken&&(n.NextToken=Ye(i.NextToken)),null!=i.SubChannels&&(n.SubChannels=((e,t)=>(e||[]).filter((e=>null!=e)).map((e=>null===e?null:((e,t)=>({MembershipCount:je(e.MembershipCount),SubChannelId:Ye(e.SubChannelId)}))(e))))(i.SubChannels)),n})(e,t)}}class Ca extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Ca.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"ListTagsForResourceCommand",inputFilterSensitiveLog:Cr,outputFilterSensitiveLog:Er},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=`${s?.endsWith("/")?s.slice(0,-1):s||""}/tags`,o=qr({arn:[,e.ResourceARN]});return new c({protocol:i,hostname:n,port:r,method:"GET",headers:{},path:a,query:o,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(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:Ye(e.Key),Value:Ye(e.Value)}))(e))))(i.Tags)),n})(e,t)}}class Ea extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Ea.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"PutChannelMembershipPreferencesCommand",inputFilterSensitiveLog:Tr,outputFilterSensitiveLog:Lr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let o,l=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/memberships/{MemberArn}/preferences`;return l=dt(l,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),l=dt(l,e,"MemberArn",(()=>e.MemberArn),"{MemberArn}",!1),o=JSON.stringify({...null!=e.Preferences&&{Preferences:is(e.Preferences,t)}}),new c({protocol:i,hostname:n,port:r,method:"PUT",headers:a,path:l,body:o})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.Member&&(n.Member=Ls(i.Member,t)),null!=i.Preferences&&(n.Preferences=Ms(i.Preferences,t)),n})(e,t)}}class Ta extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Ta.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"RedactChannelMessageCommand",inputFilterSensitiveLog:Ar,outputFilterSensitiveLog:zr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/messages/{MessageId}`;o=dt(o,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=dt(o,e,"MessageId",(()=>e.MessageId),"{MessageId}",!1);const l=qr({operation:[,"redact"]});let u;return u=JSON.stringify({...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:a,path:o,query:l,body:u})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.MessageId&&(n.MessageId=Ye(i.MessageId)),null!=i.SubChannelId&&(n.SubChannelId=Ye(i.SubChannelId)),n})(e,t)}}class La extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,La.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"SearchChannelsCommand",inputFilterSensitiveLog:Pr,outputFilterSensitiveLog:Hr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer}),o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels`,l=qr({operation:[,"search"],"max-results":[()=>void 0!==e.MaxResults,()=>e.MaxResults.toString()],"next-token":[,e.NextToken]});let u;return u=JSON.stringify({...null!=e.Fields&&{Fields:gs(e.Fields,t)}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:a,path:o,query:l,body:u})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.Channels&&(n.Channels=Es(i.Channels,t)),null!=i.NextToken&&(n.NextToken=Ye(i.NextToken)),n})(e,t)}}class Aa extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Aa.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"SendChannelMessageCommand",inputFilterSensitiveLog:kr,outputFilterSensitiveLog:Ir},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let o,l=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/messages`;return l=dt(l,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=JSON.stringify({ClientRequestToken:e.ClientRequestToken??G(),...null!=e.Content&&{Content:e.Content},...null!=e.MessageAttributes&&{MessageAttributes:ls(e.MessageAttributes,t)},...null!=e.Metadata&&{Metadata:e.Metadata},...null!=e.Persistence&&{Persistence:e.Persistence},...null!=e.PushNotification&&{PushNotification:ps(e.PushNotification,t)},...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId},...null!=e.Type&&{Type:e.Type}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:a,path:l,body:o})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.MessageId&&(n.MessageId=Ye(i.MessageId)),null!=i.Status&&(n.Status=Ss(i.Status,t)),null!=i.SubChannelId&&(n.SubChannelId=Ye(i.SubChannelId)),n})(e,t)}}class za extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,za.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"TagResourceCommand",inputFilterSensitiveLog:Vr,outputFilterSensitiveLog:e=>e},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=`${s?.endsWith("/")?s.slice(0,-1):s||""}/tags`,o=qr({operation:[,"tag-resource"]});let l;return l=JSON.stringify({...null!=e.ResourceARN&&{ResourceARN:e.ResourceARN},...null!=e.Tags&&{Tags:bs(e.Tags)}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:{"content-type":"application/json"},path:a,query:o,body:l})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ResourceLimitExceededException":case"com.amazonaws.chimesdkmessaging#ResourceLimitExceededException":throw await Jr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)});return await Ds(e.body,t),n})(e,t)}}class Ra extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Ra.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"UntagResourceCommand",inputFilterSensitiveLog:Nr,outputFilterSensitiveLog:e=>e},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=`${s?.endsWith("/")?s.slice(0,-1):s||""}/tags`,o=qr({operation:[,"untag-resource"]});let l;return l=JSON.stringify({...null!=e.ResourceARN&&{ResourceARN:e.ResourceARN},...null!=e.TagKeys&&{TagKeys:ys(e.TagKeys)}}),new c({protocol:i,hostname:n,port:r,method:"POST",headers:{"content-type":"application/json"},path:a,query:o,body:l})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)});return await Ds(e.body,t),n})(e,t)}}class Pa extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Pa.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"UpdateChannelCommand",inputFilterSensitiveLog:Dr,outputFilterSensitiveLog:Or},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let o,l=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}`;return l=dt(l,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=JSON.stringify({...null!=e.Metadata&&{Metadata:e.Metadata},...null!=e.Mode&&{Mode:e.Mode},...null!=e.Name&&{Name:e.Name}}),new c({protocol:i,hostname:n,port:r,method:"PUT",headers:a,path:l,body:o})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),n})(e,t)}}class Ha extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Ha.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"UpdateChannelFlowCommand",inputFilterSensitiveLog:Fr,outputFilterSensitiveLog:Br},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint();let a,o=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channel-flows/{ChannelFlowArn}`;return o=dt(o,e,"ChannelFlowArn",(()=>e.ChannelFlowArn),"{ChannelFlowArn}",!1),a=JSON.stringify({...null!=e.Name&&{Name:e.Name},...null!=e.Processors&&{Processors:fs(e.Processors)}}),new c({protocol:i,hostname:n,port:r,method:"PUT",headers:{"content-type":"application/json"},path:o,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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelFlowArn&&(n.ChannelFlowArn=Ye(i.ChannelFlowArn)),n})(e,t)}}class ka extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,ka.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"UpdateChannelMessageCommand",inputFilterSensitiveLog:Ur,outputFilterSensitiveLog:Wr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let o,l=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/messages/{MessageId}`;return l=dt(l,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),l=dt(l,e,"MessageId",(()=>e.MessageId),"{MessageId}",!1),o=JSON.stringify({...null!=e.Content&&{Content:e.Content},...null!=e.Metadata&&{Metadata:e.Metadata},...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId}}),new c({protocol:i,hostname:n,port:r,method:"PUT",headers:a,path:l,body:o})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.MessageId&&(n.MessageId=Ye(i.MessageId)),null!=i.Status&&(n.Status=Ss(i.Status,t)),null!=i.SubChannelId&&(n.SubChannelId=Ye(i.SubChannelId)),n})(e,t)}}class Ia extends Fe{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(f(t,this.serialize,this.deserialize)),this.middlewareStack.use(x(t,Ia.getEndpointParameterInstructions()));const i=e.concat(this.middlewareStack),{logger:r}=t,s={logger:r,clientName:"ChimeSDKMessagingClient",commandName:"UpdateChannelReadMarkerCommand",inputFilterSensitiveLog:Gr,outputFilterSensitiveLog:jr},{requestHandler:a}=t;return i.resolve((e=>a.handle(e.request,n||{})),s)}serialize(e,t){return(async(e,t)=>{const{hostname:n,protocol:i="https",port:r,path:s}=await t.endpoint(),a=qr({},Os,{"content-type":"application/json","x-amz-chime-bearer":e.ChimeBearer});let o,l=`${s?.endsWith("/")?s.slice(0,-1):s||""}/channels/{ChannelArn}/readMarker`;return l=dt(l,e,"ChannelArn",(()=>e.ChannelArn),"{ChannelArn}",!1),o=JSON.stringify({...null!=e.SubChannelId&&{SubChannelId:e.SubChannelId}}),new c({protocol:i,hostname:n,port:r,method:"PUT",headers:a,path:l,body:o})})(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 Bs(e.body,t)},i=Us(e,n.body);switch(i){case"BadRequestException":case"com.amazonaws.chimesdkmessaging#BadRequestException":throw await $r(n,t);case"ConflictException":case"com.amazonaws.chimesdkmessaging#ConflictException":throw await Xr(n,t);case"ForbiddenException":case"com.amazonaws.chimesdkmessaging#ForbiddenException":throw await Kr(n,t);case"ServiceFailureException":case"com.amazonaws.chimesdkmessaging#ServiceFailureException":throw await Zr(n,t);case"ServiceUnavailableException":case"com.amazonaws.chimesdkmessaging#ServiceUnavailableException":throw await Qr(n,t);case"ThrottledClientException":case"com.amazonaws.chimesdkmessaging#ThrottledClientException":throw await es(n,t);case"UnauthorizedClientException":case"com.amazonaws.chimesdkmessaging#UnauthorizedClientException":throw await ts(n,t);default:const r=n.body;rt({output:e,parsedBody:r,exceptionCtor:fn,errorCode:i})}})(e,t);const n=qr({$metadata:Ns(e)}),i=Xe(Ke(await Fs(e.body,t)),"body");return null!=i.ChannelArn&&(n.ChannelArn=Ye(i.ChannelArn)),null!=i.SubChannelId&&(n.SubChannelId=Ye(i.SubChannelId)),n})(e,t)}}class Va extends hn{associateChannelFlow(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)}}batchCreateChannelMembership(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)}}channelFlowCallback(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)}}createChannel(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)}}createChannelBan(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)}}createChannelFlow(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)}}createChannelMembership(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)}}createChannelModerator(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)}}deleteChannel(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)}}deleteChannelBan(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)}}deleteChannelFlow(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)}}deleteChannelMembership(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)}}deleteChannelMessage(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)}}deleteChannelModerator(e,t,n){const i=new na(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 ra(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 ia(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 sa(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 aa(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 oa(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 ca(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 la(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 ua(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 da(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 ha(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 fa(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 pa(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 ma(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 ga(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 va(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 ya(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 ba(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 xa(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 Ma(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 wa(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 Sa(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 _a(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 Ca(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 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)}}redactChannelMessage(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)}}searchChannels(e,t,n){const i=new La(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 Aa(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 za(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 Ra(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 Pa(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 Ha(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 ka(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 Ia(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 Na=async(e,t,...n)=>await e.send(new ma(t),...n),Da=async(e,t,...n)=>await e.listChannelBans(t,...n);async function*Oa(e,t,...n){let i,r=e.startingToken||void 0,s=!0;for(;s;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof Va)i=await Da(e.client,t,...n);else{if(!(e.client instanceof hn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await Na(e.client,t,...n)}yield i;const a=r;r=i.NextToken,s=!(!r||e.stopOnSameToken&&r===a)}}const Fa=async(e,t,...n)=>await e.send(new ga(t),...n),Ba=async(e,t,...n)=>await e.listChannelFlows(t,...n);async function*Ua(e,t,...n){let i,r=e.startingToken||void 0,s=!0;for(;s;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof Va)i=await Ba(e.client,t,...n);else{if(!(e.client instanceof hn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await Fa(e.client,t,...n)}yield i;const a=r;r=i.NextToken,s=!(!r||e.stopOnSameToken&&r===a)}}const Wa=async(e,t,...n)=>await e.send(new ya(t),...n),Ga=async(e,t,...n)=>await e.listChannelMembershipsForAppInstanceUser(t,...n);async function*ja(e,t,...n){let i,r=e.startingToken||void 0,s=!0;for(;s;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof Va)i=await Ga(e.client,t,...n);else{if(!(e.client instanceof hn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await Wa(e.client,t,...n)}yield i;const a=r;r=i.NextToken,s=!(!r||e.stopOnSameToken&&r===a)}}const qa=async(e,t,...n)=>await e.send(new va(t),...n),$a=async(e,t,...n)=>await e.listChannelMemberships(t,...n);async function*Xa(e,t,...n){let i,r=e.startingToken||void 0,s=!0;for(;s;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof Va)i=await $a(e.client,t,...n);else{if(!(e.client instanceof hn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await qa(e.client,t,...n)}yield i;const a=r;r=i.NextToken,s=!(!r||e.stopOnSameToken&&r===a)}}const Ka=async(e,t,...n)=>await e.send(new ba(t),...n),Ya=async(e,t,...n)=>await e.listChannelMessages(t,...n);async function*Ja(e,t,...n){let i,r=e.startingToken||void 0,s=!0;for(;s;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof Va)i=await Ya(e.client,t,...n);else{if(!(e.client instanceof hn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await Ka(e.client,t,...n)}yield i;const a=r;r=i.NextToken,s=!(!r||e.stopOnSameToken&&r===a)}}const Za=async(e,t,...n)=>await e.send(new xa(t),...n),Qa=async(e,t,...n)=>await e.listChannelModerators(t,...n);async function*eo(e,t,...n){let i,r=e.startingToken||void 0,s=!0;for(;s;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof Va)i=await Qa(e.client,t,...n);else{if(!(e.client instanceof hn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await Za(e.client,t,...n)}yield i;const a=r;r=i.NextToken,s=!(!r||e.stopOnSameToken&&r===a)}}const to=async(e,t,...n)=>await e.send(new wa(t),...n),no=async(e,t,...n)=>await e.listChannelsAssociatedWithChannelFlow(t,...n);async function*io(e,t,...n){let i,r=e.startingToken||void 0,s=!0;for(;s;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof Va)i=await no(e.client,t,...n);else{if(!(e.client instanceof hn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await to(e.client,t,...n)}yield i;const a=r;r=i.NextToken,s=!(!r||e.stopOnSameToken&&r===a)}}const ro=async(e,t,...n)=>await e.send(new Sa(t),...n),so=async(e,t,...n)=>await e.listChannelsModeratedByAppInstanceUser(t,...n);async function*ao(e,t,...n){let i,r=e.startingToken||void 0,s=!0;for(;s;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof Va)i=await so(e.client,t,...n);else{if(!(e.client instanceof hn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await ro(e.client,t,...n)}yield i;const a=r;r=i.NextToken,s=!(!r||e.stopOnSameToken&&r===a)}}const oo=async(e,t,...n)=>await e.send(new Ma(t),...n),co=async(e,t,...n)=>await e.listChannels(t,...n);async function*lo(e,t,...n){let i,r=e.startingToken||void 0,s=!0;for(;s;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof Va)i=await co(e.client,t,...n);else{if(!(e.client instanceof hn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await oo(e.client,t,...n)}yield i;const a=r;r=i.NextToken,s=!(!r||e.stopOnSameToken&&r===a)}}const uo=async(e,t,...n)=>await e.send(new _a(t),...n),ho=async(e,t,...n)=>await e.listSubChannels(t,...n);async function*fo(e,t,...n){let i,r=e.startingToken||void 0,s=!0;for(;s;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof Va)i=await ho(e.client,t,...n);else{if(!(e.client instanceof hn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await uo(e.client,t,...n)}yield i;const a=r;r=i.NextToken,s=!(!r||e.stopOnSameToken&&r===a)}}const po=async(e,t,...n)=>await e.send(new La(t),...n),mo=async(e,t,...n)=>await e.searchChannels(t,...n);async function*go(e,t,...n){let i,r=e.startingToken||void 0,s=!0;for(;s;){if(t.NextToken=r,t.MaxResults=e.pageSize,e.client instanceof Va)i=await mo(e.client,t,...n);else{if(!(e.client instanceof hn))throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient");i=await po(e.client,t,...n)}yield i;const a=r;r=i.NextToken,s=!(!r||e.stopOnSameToken&&r===a)}}},3538:(e,t,n)=>{"use strict";n.r(t),n.d(t,{fromHex:()=>s,toHex:()=>a});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 s(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{"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>6|192,63&i|128);else if(n+1>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;ne.toString(16))).join("%");t+=decodeURIComponent(r)}else t+=String.fromCharCode((15&i)<<12|(63&e[++n])<<6|63&e[++n])}return t})(e)},7326:function(e,t,n){var i,r=n(4155);"undefined"!=typeof self&&self,i=()=>(()=>{var e={373:function(e,t,n){var i;"undefined"!=typeof self&&self,i=()=>(()=>{var e={252:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlockingQueue=void 0;var n=function(){function e(){this._resolvers=[],this._promises=[]}return e.prototype._add=function(){var e=this;this._promises.push(new Promise((function(t){e._resolvers.push(t)})))},e.prototype.enqueue=function(e){this._resolvers.length||this._add(),this._resolvers.shift()(e)},e.prototype.dequeue=function(){return this._promises.length||this._add(),this._promises.shift()},e.prototype.isEmpty=function(){return!this._promises.length},e.prototype.isBlocked=function(){return!!this._resolvers.length},Object.defineProperty(e.prototype,"length",{get:function(){return this._promises.length-this._resolvers.length},enumerable:!1,configurable:!0}),e}();t.BlockingQueue=n},289:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBrowserType=t.BrowserTypes=void 0,t.BrowserTypes={MSIE:"MSIE",EDGE:"EDGE",CHROME:"CHROME",SAFARI:"SAFARI",FIREFOX:"FIREFOX",OPERA:"OPERA",OTHER:"OTHER"},t.getBrowserType=function(){var e=window.navigator.userAgent.toLowerCase();return-1!==e.indexOf("msie")||-1!==e.indexOf("trident")?t.BrowserTypes.MSIE:-1!==e.indexOf("edge")?t.BrowserTypes.EDGE:-1!==e.indexOf("chrome")?t.BrowserTypes.CHROME:-1!==e.indexOf("safari")?t.BrowserTypes.SAFARI:-1!==e.indexOf("firefox")?t.BrowserTypes.FIREFOX:-1!==e.indexOf("opera")?t.BrowserTypes.OPERA:t.BrowserTypes.OTHER}},187:function(e,t,n){"use strict";var i=n(764).lW,r=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,i,r,s,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(s){return function(o){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]100)throw new Error("queue is fulled: ".concat(this.sem.length));return[4,this.lock()];case 1:e=s.sent(),r=new Promise((function(e,r){if(!l.worker)throw new Error("worker is not activated.");l.worker.onmessage=function(t){t.data.message===c.WorkerResponse.PREDICTED?e(t.data.prediction):(console.log("Prediction something wrong..",t.data.message),r(t))},i?n instanceof Uint8ClampedArray?l.worker.postMessage({message:c.WorkerCommand.PREDICT,params:t,data:n},[n.buffer]):l.worker.postMessage({message:c.WorkerCommand.PREDICT,params:t,data:n},[n]):l.worker.postMessage({message:c.WorkerCommand.PREDICT,params:t,data:n})})),s.label=2;case 2:return s.trys.push([2,4,5,6]),[4,r];case 3:return a=s.sent(),[3,6];case 4:return o=s.sent(),console.log("worker prediction error. :",o),[3,6];case 5:return this.unlock(e),[7];case 6:return[2,a]}}))}))},this.useWorker=function(e){return!e.processOnLocal&&(!1!==e.useWorkerForSafari||(0,o.getBrowserType)()!==o.BrowserTypes.SAFARI)},this.fetchData=function(t){return r(e,void 0,void 0,(function(){var e;return s(this,(function(n){switch(n.label){case 0:return t.startsWith("data:")?(e=t.split(",")[1],[2,i.from(e,"base64")]):[4,fetch(t,{method:"GET"})];case 1:return[4,n.sent().arrayBuffer()];case 2:return[2,n.sent()]}}))}))},this.sem.enqueue(0)},t.WorkerDispatcher=function(e){var t=this;this.imageProcessor=null,this.config=null,this.callbacks=null,this.setCallback=function(e){t.callbacks=e},this.dispach=function(e){return r(t,void 0,void 0,(function(){var t,n,i,r;return s(this,(function(s){switch(s.label){case 0:return this.callbacks?e.data.message!==c.WorkerCommand.INITIALIZE?[3,2]:(this.config=e.data.config,t=this,[4,this.callbacks.init(this.config)]):(console.warn("[worker] Dispatcher callbacks is not initialized"),[2]);case 1:return t.imageProcessor=s.sent(),this.context.postMessage({message:c.WorkerResponse.INITIALIZED}),console.log("[worker] Initialized"),[3,4];case 2:return e.data.message!==c.WorkerCommand.PREDICT?[3,4]:this.imageProcessor?this.config?(n=e.data.params,i=e.data.data,[4,this.imageProcessor.predict(this.config,n,i)]):(console.warn("[worker] Dispatcher config is not initialized"),[2]):(console.warn("[worker] ImageProcessor is not initialized"),[2]);case 3:r=s.sent(),this.context.postMessage({message:c.WorkerResponse.PREDICTED,prediction:r}),s.label=4;case 4:return[2]}}))}))},this.context=e}},301:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerResponse=t.WorkerCommand=void 0,t.WorkerCommand={INITIALIZE:"initialize",PREDICT:"predict"},t.WorkerResponse={INITIALIZED:"initialized",PREDICTED:"predicted"}},55:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),r(n(187),t),r(n(289),t)},742:(e,t)=>{"use strict";t.byteLength=function(e){var t=c(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,s=c(e),a=s[0],o=s[1],l=new r(function(e,t,n){return 3*(t+n)/4-n}(0,a,o)),u=0,d=o>0?a-4:a;for(n=0;n>16&255,l[u++]=t>>8&255,l[u++]=255&t;return 2===o&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,l[u++]=255&t),1===o&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t),l},t.fromByteArray=function(e){for(var t,i=e.length,r=i%3,s=[],a=16383,o=0,c=i-r;oc?c:o+a));return 1===r?(t=e[i-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=s.length;a0)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 l(e,t,i){for(var r,s,a=[],o=t;o>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},764:(e,t,n)=>{"use strict";const i=n(742),r=n(645),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=c,t.h2=50;const a=2147483647;function o(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|m(e,t);let i=o(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(K(e,Uint8Array)){const t=new Uint8Array(e);return f(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(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return f(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return f(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 c.from(i,t,n);const r=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=o(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||Y(e.length)?o(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 c.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 u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),o(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),n=o(t);for(let i=0;i=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(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 $(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 z(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return L(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(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 y(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),Y(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=c.from(t,i)),c.isBuffer(t))return 0===t.length?-1:b(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):b(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,i,r){let s,a=1,o=e.length,c=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;a=2,o/=2,c/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(r){let i=-1;for(s=n;so&&(n=o-c),s=n;s>=0;s--){let n=!0;for(let i=0;ir&&(i=r):i=r;const s=t.length;let a;for(i>s/2&&(i=s/2),a=0;a>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function C(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function E(e,t,n){n=Math.min(e.length,n);const i=[];let r=t;for(;r239?4:t>223?3:t>191?2:1;if(r+a<=n){let n,i,o,c;switch(a){case 1:t<128&&(s=t);break;case 2:n=e[r+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(s=c));break;case 3:n=e[r+1],i=e[r+2],128==(192&n)&&128==(192&i)&&(c=(15&t)<<12|(63&n)<<6|63&i,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:n=e[r+1],i=e[r+2],o=e[r+3],128==(192&n)&&128==(192&i)&&128==(192&o)&&(c=(15&t)<<18|(63&n)<<12|(63&i)<<6|63&o,c>65535&&c<1114112&&(s=c))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=a}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let n="",i=0;for(;ii.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(i,r)):Uint8Array.prototype.set.call(i,t,r);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,r)}r+=t.length}return i},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(e,t,n,i,r){if(K(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===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 s=(r>>>=0)-(i>>>=0),a=(n>>>=0)-(t>>>=0);const o=Math.min(s,a),l=this.slice(i,r),u=e.slice(t,n);for(let e=0;e>>=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 s=!1;for(;;)switch(i){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":case"latin1":case"binary":return M(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function L(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;ri)&&(n=i);let r="";for(let i=t;in)throw new RangeError("Trying to access beyond buffer length")}function H(e,t,n,i,r,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||te.length)throw new RangeError("Index out of range")}function k(e,t,n,i,r){U(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function I(e,t,n,i,r){U(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n+7]=s,s>>=8,e[n+6]=s,s>>=8,e[n+5]=s,s>>=8,e[n+4]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function V(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(e,t,n,i,s){return t=+t,n>>>=0,s||V(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function D(e,t,n,i,s){return t=+t,n>>>=0,s||V(e,0,n,8),r.write(e,t,n,i,52,8),n+8}c.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>>=0,t>>>=0,n||P(e,t,this.length);let i=this[e],r=1,s=0;for(;++s>>=0,t>>>=0,n||P(e,t,this.length);let i=this[e+--t],r=1;for(;t>0&&(r*=256);)i+=this[e+--t]*r;return i},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Z((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||G(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)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||G(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)<>>=0,t>>>=0,n||P(e,t,this.length);let i=this[e],r=1,s=0;for(;++s=r&&(i-=Math.pow(2,8*t)),i},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let i=t,r=1,s=this[e+--i];for(;i>0&&(r*=256);)s+=this[e+--i]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Z((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||G(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||G(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<>>=0,t||P(e,4,this.length),r.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),r.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),r.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),r.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,i){e=+e,t>>>=0,n>>>=0,i||H(this,e,t,n,Math.pow(2,8*n)-1,0);let r=1,s=0;for(this[t]=255&e;++s>>=0,n>>>=0,i||H(this,e,t,n,Math.pow(2,8*n)-1,0);let r=n-1,s=1;for(this[t+r]=255&e;--r>=0&&(s*=256);)this[t+r]=e/s&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Z((function(e,t=0){return k(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Z((function(e,t=0){return I(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);H(this,e,t,n,i-1,-i)}let r=0,s=1,a=0;for(this[t]=255&e;++r>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);H(this,e,t,n,i-1,-i)}let r=n-1,s=1,a=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===a&&0!==this[t+r+1]&&(a=1),this[t+r]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Z((function(e,t=0){return k(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Z((function(e,t=0){return I(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,i){if(!c.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=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>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(r=t;r=i+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function U(e,t,n,i,r,s){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new O.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||G(t,e.length-(n+1))}(i,r,s)}function W(e,t){if("number"!=typeof e)throw new O.ERR_INVALID_ARG_TYPE(t,"number",e)}function G(e,t,n){if(Math.floor(e)!==e)throw W(e,n),new O.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new O.ERR_BUFFER_OUT_OF_BOUNDS;throw new O.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let i=`The value of "${e}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=B(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=B(r)),r+="n"),i+=` It must be ${t}. Received ${r}`,i}),RangeError);const j=/[^+/0-9A-Za-z-_]/g;function q(e,t){let n;t=t||1/0;const i=e.length;let r=null;const s=[];for(let a=0;a55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.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;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function $(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,n,i){let r;for(r=0;r=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}const J=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?Q:e}function Q(){throw new Error("BigInt not supported")}},645:(e,t)=>{t.read=function(e,t,n,i,r){var s,a,o=8*r-i-1,c=(1<>1,u=-7,d=n?r-1:0,h=n?-1:1,f=e[t+d];for(d+=h,s=f&(1<<-u)-1,f>>=-u,u+=o;u>0;s=256*s+e[t+d],d+=h,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=256*a+e[t+d],d+=h,u-=8);if(0===s)s=1-l;else{if(s===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),s-=l}return(f?-1:1)*a*Math.pow(2,s-i)},t.write=function(e,t,n,i,r,s){var a,o,c,l=8*s-r-1,u=(1<>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=u?(o=0,a=u):a+d>=1?(o=(t*c-1)*Math.pow(2,r),a+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,r),a=0));r>=8;e[n+f]=255&o,f+=p,o/=256,r-=8);for(a=a<0;e[n+f]=255&a,f+=p,a/=256,l-=8);e[n+f-p]|=128*m}},477:e=>{"use strict";e.exports=function(e,t,n,i){var r=self||window;try{try{var s;try{s=new r.Blob([e])}catch(t){(s=new(r.BlobBuilder||r.WebKitBlobBuilder||r.MozBlobBuilder||r.MSBlobBuilder)).append(e),s=s.getBlob()}var a=r.URL||r.webkitURL,o=a.createObjectURL(s),c=new r[t](o,n);return a.revokeObjectURL(o),c}catch(i){return new r[t]("data:application/javascript,".concat(encodeURIComponent(e)),n)}}catch(e){if(!i)throw Error("Inline worker is not supported");return new r[t](i,n)}}},503:(e,t,n)=>{var i,s=n(764).lW,a=(i=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(e){var t,a,o=void 0!==(e=e||{})?e:{},c=Object.assign;o.ready=new Promise((function(e,n){t=e,a=n}));var l,u,d,h,f,p,m=c({},o),g=[],v="./this.program",y=(e,t)=>{throw t},b="object"==typeof window,x="function"==typeof importScripts,w="object"==typeof r&&"object"==typeof r.versions&&"string"==typeof r.versions.node,M="";w?(M=x?n(375).dirname(M)+"/":"//",p=()=>{f||(h=n(384),f=n(375))},l=function(e,t){return p(),e=f.normalize(e),h.readFileSync(e,t?null:"utf8")},d=e=>{var t=l(e,!0);return t.buffer||(t=new Uint8Array(t)),t},u=(e,t,n)=>{p(),e=f.normalize(e),h.readFile(e,(function(e,i){e?n(e):t(i.buffer)}))},r.argv.length>1&&(v=r.argv[1].replace(/\\/g,"/")),g=r.argv.slice(2),r.on("uncaughtException",(function(e){if(!(e instanceof ze))throw e})),r.on("unhandledRejection",(function(e){throw e})),y=(e,t)=>{if(W())throw r.exitCode=e,t;var n;(n=t)instanceof ze||C("exiting due to exception: "+n),r.exit(e)},o.inspect=function(){return"[Emscripten Module object]"}):(b||x)&&(x?M=self.location.href:"undefined"!=typeof document&&document.currentScript&&(M=document.currentScript.src),i&&(M=i),M=0!==M.indexOf("blob:")?M.substr(0,M.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},x&&(d=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),u=(e,t,n)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):n()},i.onerror=n,i.send(null)});var S,_=o.print||console.log.bind(console),C=o.printErr||console.warn.bind(console);c(o,m),m=null,o.arguments&&(g=o.arguments),o.thisProgram&&(v=o.thisProgram),o.quit&&(y=o.quit),o.wasmBinary&&(S=o.wasmBinary);var E,T=o.noExitRuntime||!0;"object"!=typeof WebAssembly&&Q("no native wasm support detected");var L,A,z,R,P=!1,H="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(e,t,n){for(var i=t+n,r=t;e[r]&&!(r>=i);)++r;if(r-t>16&&e.subarray&&H)return H.decode(e.subarray(t,r));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s}function I(e,t){return e?k(z,e,t):""}function V(e,t,n,i){if(!(i>0))return 0;for(var r=n,s=n+i-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(n>=s)break;t[n++]=o}else if(o<=2047){if(n+1>=s)break;t[n++]=192|o>>6,t[n++]=128|63&o}else if(o<=65535){if(n+2>=s)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|63&o}else{if(n+3>=s)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63,t[n++]=128|o>>6&63,t[n++]=128|63&o}}return t[n]=0,n-r}function N(e){for(var t=0,n=0;n=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++n)),i<=127?++t:t+=i<=2047?2:i<=65535?3:4}return t}function D(e){L=e,o.HEAP8=A=new Int8Array(e),o.HEAP16=new Int16Array(e),o.HEAP32=R=new Int32Array(e),o.HEAPU8=z=new Uint8Array(e),o.HEAPU16=new Uint16Array(e),o.HEAPU32=new Uint32Array(e),o.HEAPF32=new Float32Array(e),o.HEAPF64=new Float64Array(e)}o.INITIAL_MEMORY;var O,F=[],B=[],U=[];function W(){return T||!1}var G,j,q,$,X=0,K=null,Y=null;function J(e){X++,o.monitorRunDependencies&&o.monitorRunDependencies(X)}function Z(e){if(X--,o.monitorRunDependencies&&o.monitorRunDependencies(X),0==X&&(null!==K&&(clearInterval(K),K=null),Y)){var t=Y;Y=null,t()}}function Q(e){o.onAbort&&o.onAbort(e),C(e="Aborted("+e+")"),P=!0,e+=". Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(e);throw a(t),t}function ee(e){return e.startsWith("data:application/octet-stream;base64,")}function te(e){return e.startsWith("file://")}function ne(e){try{if(e==G&&S)return new Uint8Array(S);if(d)return d(e);throw"both async and sync fetching of the wasm failed"}catch(e){Q(e)}}function ie(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var n=t.func;"number"==typeof n?void 0===t.arg?ae(n)():ae(n)(t.arg):n(void 0===t.arg?null:t.arg)}else t(o)}}o.preloadedImages={},o.preloadedAudios={},ee(G="tflite-simd.wasm")||(j=G,G=o.locateFile?o.locateFile(j,M):M+j);var re,se=[];function ae(e){var t=se[e];return t||(e>=se.length&&(se.length=e+1),se[e]=t=O.get(e)),t}function oe(e){this.excPtr=e,this.ptr=e-16,this.set_type=function(e){R[this.ptr+4>>2]=e},this.get_type=function(){return R[this.ptr+4>>2]},this.set_destructor=function(e){R[this.ptr+8>>2]=e},this.get_destructor=function(){return R[this.ptr+8>>2]},this.set_refcount=function(e){R[this.ptr>>2]=e},this.set_caught=function(e){e=e?1:0,A[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=A[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,A[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=A[this.ptr+13>>0]},this.init=function(e,t){this.set_type(e),this.set_destructor(t),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=R[this.ptr>>2];R[this.ptr>>2]=e+1},this.release_ref=function(){var e=R[this.ptr>>2];return R[this.ptr>>2]=e-1,1===e}}function ce(e){try{return E.grow(e-L.byteLength+65535>>>16),D(E.buffer),1}catch(e){}}re=w?()=>{var e=r.hrtime();return 1e3*e[0]+e[1]/1e6}:()=>performance.now();var le={};function ue(){if(!ue.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:v||"./this.program"};for(var t in le)void 0===le[t]?delete e[t]:e[t]=le[t];var n=[];for(var t in e)n.push(t+"="+e[t]);ue.strings=n}return ue.strings}var de={splitPath:function(e){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,t){for(var n=0,i=e.length-1;i>=0;i--){var r=e[i];"."===r?e.splice(i,1):".."===r?(e.splice(i,1),n++):n&&(e.splice(i,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},normalize:function(e){var t="/"===e.charAt(0),n="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((function(e){return!!e})),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e},dirname:function(e){var t=de.splitPath(e),n=t[0],i=t[1];return n||i?(i&&(i=i.substr(0,i.length-1)),n+i):"."},basename:function(e){if("/"===e)return"/";var t=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},extname:function(e){return de.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return de.normalize(e.join("/"))},join2:function(e,t){return de.normalize(e+"/"+t)}};function he(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(1);return function(){return crypto.getRandomValues(e),e[0]}}if(w)try{var t=n(782);return function(){return t.randomBytes(1)[0]}}catch(e){}return function(){Q("randomDevice")}}var fe={resolve:function(){for(var e="",t=!1,n=arguments.length-1;n>=-1&&!t;n--){var i=n>=0?arguments[n]:ge.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t="/"===i.charAt(0)}return(t?"/":"")+(e=de.normalizeArray(e.split("/").filter((function(e){return!!e})),!t).join("/"))||"."},relative:function(e,t){function n(e){for(var t=0;t=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=fe.resolve(e).substr(1),t=fe.resolve(t).substr(1);for(var i=n(e.split("/")),r=n(t.split("/")),s=Math.min(i.length,r.length),a=s,o=0;o0?n.slice(0,i).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(t=window.prompt("Input: "))&&(t+="\n"):"function"==typeof readline&&null!==(t=readline())&&(t+="\n");if(!t)return null;e.input=_e(t,!0)}return e.input.shift()},put_char:function(e,t){null===t||10===t?(_(k(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(_(k(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,t){null===t||10===t?(C(k(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(C(k(e.output,0)),e.output=[])}}},me={ops_table:null,mount:function(e){return me.createNode(null,"/",16895,0)},createNode:function(e,t,n,i){if(ge.isBlkdev(n)||ge.isFIFO(n))throw new ge.ErrnoError(63);me.ops_table||(me.ops_table={dir:{node:{getattr:me.node_ops.getattr,setattr:me.node_ops.setattr,lookup:me.node_ops.lookup,mknod:me.node_ops.mknod,rename:me.node_ops.rename,unlink:me.node_ops.unlink,rmdir:me.node_ops.rmdir,readdir:me.node_ops.readdir,symlink:me.node_ops.symlink},stream:{llseek:me.stream_ops.llseek}},file:{node:{getattr:me.node_ops.getattr,setattr:me.node_ops.setattr},stream:{llseek:me.stream_ops.llseek,read:me.stream_ops.read,write:me.stream_ops.write,allocate:me.stream_ops.allocate,mmap:me.stream_ops.mmap,msync:me.stream_ops.msync}},link:{node:{getattr:me.node_ops.getattr,setattr:me.node_ops.setattr,readlink:me.node_ops.readlink},stream:{}},chrdev:{node:{getattr:me.node_ops.getattr,setattr:me.node_ops.setattr},stream:ge.chrdev_stream_ops}});var r=ge.createNode(e,t,n,i);return ge.isDir(r.mode)?(r.node_ops=me.ops_table.dir.node,r.stream_ops=me.ops_table.dir.stream,r.contents={}):ge.isFile(r.mode)?(r.node_ops=me.ops_table.file.node,r.stream_ops=me.ops_table.file.stream,r.usedBytes=0,r.contents=null):ge.isLink(r.mode)?(r.node_ops=me.ops_table.link.node,r.stream_ops=me.ops_table.link.stream):ge.isChrdev(r.mode)&&(r.node_ops=me.ops_table.chrdev.node,r.stream_ops=me.ops_table.chrdev.stream),r.timestamp=Date.now(),e&&(e.contents[t]=r,e.timestamp=r.timestamp),r},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),0!=n&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr:function(e){var t={};return t.dev=ge.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,ge.isDir(e.mode)?t.size=4096:ge.isFile(e.mode)?t.size=e.usedBytes:ge.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&me.resizeFileStorage(e,t.size)},lookup:function(e,t){throw ge.genericErrors[44]},mknod:function(e,t,n,i){return me.createNode(e,t,n,i)},rename:function(e,t,n){if(ge.isDir(e.mode)){var i;try{i=ge.lookupNode(t,n)}catch(e){}if(i)for(var r in i.contents)throw new ge.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=n,t.contents[n]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink:function(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir:function(e,t){var n=ge.lookupNode(e,t);for(var i in n.contents)throw new ge.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir:function(e){var t=[".",".."];for(var n in e.contents)e.contents.hasOwnProperty(n)&&t.push(n);return t},symlink:function(e,t,n){var i=me.createNode(e,t,41471,0);return i.link=n,i},readlink:function(e){if(!ge.isLink(e.mode))throw new ge.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,n,i,r){var s=e.node.contents;if(r>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-r,i);if(a>8&&s.subarray)t.set(s.subarray(r,r+a),n);else for(var o=0;o0||i+n{if(!(e=fe.resolve(ge.cwd(),e)))return{path:"",node:null};var n={follow_mount:!0,recurse_count:0};for(var i in n)void 0===t[i]&&(t[i]=n[i]);if(t.recurse_count>8)throw new ge.ErrnoError(32);for(var r=de.normalizeArray(e.split("/").filter((e=>!!e)),!1),s=ge.root,a="/",o=0;o40)throw new ge.ErrnoError(32)}}return{path:a,node:s}},getPath:e=>{for(var t;;){if(ge.isRoot(e)){var n=e.mount.mountpoint;return t?"/"!==n[n.length-1]?n+"/"+t:n+t:n}t=t?e.name+"/"+t:e.name,e=e.parent}},hashName:(e,t)=>{for(var n=0,i=0;i>>0)%ge.nameTable.length},hashAddNode:e=>{var t=ge.hashName(e.parent.id,e.name);e.name_next=ge.nameTable[t],ge.nameTable[t]=e},hashRemoveNode:e=>{var t=ge.hashName(e.parent.id,e.name);if(ge.nameTable[t]===e)ge.nameTable[t]=e.name_next;else for(var n=ge.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode:(e,t)=>{var n=ge.mayLookup(e);if(n)throw new ge.ErrnoError(n,e);for(var i=ge.hashName(e.id,t),r=ge.nameTable[i];r;r=r.name_next){var s=r.name;if(r.parent.id===e.id&&s===t)return r}return ge.lookup(e,t)},createNode:(e,t,n,i)=>{var r=new ge.FSNode(e,t,n,i);return ge.hashAddNode(r),r},destroyNode:e=>{ge.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:e=>{var t=ge.flagModes[e];if(void 0===t)throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:e=>{var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>ge.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup:e=>ge.nodePermissions(e,"x")||(e.node_ops.lookup?0:2),mayCreate:(e,t)=>{try{return ge.lookupNode(e,t),20}catch(e){}return ge.nodePermissions(e,"wx")},mayDelete:(e,t,n)=>{var i;try{i=ge.lookupNode(e,t)}catch(e){return e.errno}var r=ge.nodePermissions(e,"wx");if(r)return r;if(n){if(!ge.isDir(i.mode))return 54;if(ge.isRoot(i)||ge.getPath(i)===ge.cwd())return 10}else if(ge.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?ge.isLink(e.mode)?32:ge.isDir(e.mode)&&("r"!==ge.flagsToPermissionString(t)||512&t)?31:ge.nodePermissions(e,ge.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd:(e=0,t=ge.MAX_OPEN_FDS)=>{for(var n=e;n<=t;n++)if(!ge.streams[n])return n;throw new ge.ErrnoError(33)},getStream:e=>ge.streams[e],createStream:(e,t,n)=>{ge.FSStream||(ge.FSStream=function(){},ge.FSStream.prototype={object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}});var i=new ge.FSStream;for(var r in e)i[r]=e[r];e=i;var s=ge.nextfd(t,n);return e.fd=s,ge.streams[s]=e,e},closeStream:e=>{ge.streams[e]=null},chrdev_stream_ops:{open:e=>{var t=ge.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new ge.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice:(e,t)=>{ge.devices[e]={stream_ops:t}},getDevice:e=>ge.devices[e],getMounts:e=>{for(var t=[],n=[e];n.length;){var i=n.pop();t.push(i),n.push.apply(n,i.mounts)}return t},syncfs:(e,t)=>{"function"==typeof e&&(t=e,e=!1),ge.syncFSRequests++,ge.syncFSRequests>1&&C("warning: "+ge.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var n=ge.getMounts(ge.root.mount),i=0;function r(e){return ge.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,r(e));++i>=n.length&&r(null)}n.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount:(e,t,n)=>{var i,r="/"===n,s=!n;if(r&&ge.root)throw new ge.ErrnoError(10);if(!r&&!s){var a=ge.lookupPath(n,{follow_mount:!1});if(n=a.path,i=a.node,ge.isMountpoint(i))throw new ge.ErrnoError(10);if(!ge.isDir(i.mode))throw new ge.ErrnoError(54)}var o={type:e,opts:t,mountpoint:n,mounts:[]},c=e.mount(o);return c.mount=o,o.root=c,r?ge.root=c:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),c},unmount:e=>{var t=ge.lookupPath(e,{follow_mount:!1});if(!ge.isMountpoint(t.node))throw new ge.ErrnoError(28);var n=t.node,i=n.mounted,r=ge.getMounts(i);Object.keys(ge.nameTable).forEach((e=>{for(var t=ge.nameTable[e];t;){var n=t.name_next;r.includes(t.mount)&&ge.destroyNode(t),t=n}})),n.mounted=null;var s=n.mount.mounts.indexOf(i);n.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod:(e,t,n)=>{var i=ge.lookupPath(e,{parent:!0}).node,r=de.basename(e);if(!r||"."===r||".."===r)throw new ge.ErrnoError(28);var s=ge.mayCreate(i,r);if(s)throw new ge.ErrnoError(s);if(!i.node_ops.mknod)throw new ge.ErrnoError(63);return i.node_ops.mknod(i,r,t,n)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,ge.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,ge.mknod(e,t,0)),mkdirTree:(e,t)=>{for(var n=e.split("/"),i="",r=0;r(void 0===n&&(n=t,t=438),t|=8192,ge.mknod(e,t,n)),symlink:(e,t)=>{if(!fe.resolve(e))throw new ge.ErrnoError(44);var n=ge.lookupPath(t,{parent:!0}).node;if(!n)throw new ge.ErrnoError(44);var i=de.basename(t),r=ge.mayCreate(n,i);if(r)throw new ge.ErrnoError(r);if(!n.node_ops.symlink)throw new ge.ErrnoError(63);return n.node_ops.symlink(n,i,e)},rename:(e,t)=>{var n,i,r=de.dirname(e),s=de.dirname(t),a=de.basename(e),o=de.basename(t);if(n=ge.lookupPath(e,{parent:!0}).node,i=ge.lookupPath(t,{parent:!0}).node,!n||!i)throw new ge.ErrnoError(44);if(n.mount!==i.mount)throw new ge.ErrnoError(75);var c,l=ge.lookupNode(n,a),u=fe.relative(e,s);if("."!==u.charAt(0))throw new ge.ErrnoError(28);if("."!==(u=fe.relative(t,r)).charAt(0))throw new ge.ErrnoError(55);try{c=ge.lookupNode(i,o)}catch(e){}if(l!==c){var d=ge.isDir(l.mode),h=ge.mayDelete(n,a,d);if(h)throw new ge.ErrnoError(h);if(h=c?ge.mayDelete(i,o,d):ge.mayCreate(i,o))throw new ge.ErrnoError(h);if(!n.node_ops.rename)throw new ge.ErrnoError(63);if(ge.isMountpoint(l)||c&&ge.isMountpoint(c))throw new ge.ErrnoError(10);if(i!==n&&(h=ge.nodePermissions(n,"w")))throw new ge.ErrnoError(h);ge.hashRemoveNode(l);try{n.node_ops.rename(l,i,o)}catch(e){throw e}finally{ge.hashAddNode(l)}}},rmdir:e=>{var t=ge.lookupPath(e,{parent:!0}).node,n=de.basename(e),i=ge.lookupNode(t,n),r=ge.mayDelete(t,n,!0);if(r)throw new ge.ErrnoError(r);if(!t.node_ops.rmdir)throw new ge.ErrnoError(63);if(ge.isMountpoint(i))throw new ge.ErrnoError(10);t.node_ops.rmdir(t,n),ge.destroyNode(i)},readdir:e=>{var t=ge.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new ge.ErrnoError(54);return t.node_ops.readdir(t)},unlink:e=>{var t=ge.lookupPath(e,{parent:!0}).node;if(!t)throw new ge.ErrnoError(44);var n=de.basename(e),i=ge.lookupNode(t,n),r=ge.mayDelete(t,n,!1);if(r)throw new ge.ErrnoError(r);if(!t.node_ops.unlink)throw new ge.ErrnoError(63);if(ge.isMountpoint(i))throw new ge.ErrnoError(10);t.node_ops.unlink(t,n),ge.destroyNode(i)},readlink:e=>{var t=ge.lookupPath(e).node;if(!t)throw new ge.ErrnoError(44);if(!t.node_ops.readlink)throw new ge.ErrnoError(28);return fe.resolve(ge.getPath(t.parent),t.node_ops.readlink(t))},stat:(e,t)=>{var n=ge.lookupPath(e,{follow:!t}).node;if(!n)throw new ge.ErrnoError(44);if(!n.node_ops.getattr)throw new ge.ErrnoError(63);return n.node_ops.getattr(n)},lstat:e=>ge.stat(e,!0),chmod:(e,t,n)=>{var i;if(!(i="string"==typeof e?ge.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new ge.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod:(e,t)=>{ge.chmod(e,t,!0)},fchmod:(e,t)=>{var n=ge.getStream(e);if(!n)throw new ge.ErrnoError(8);ge.chmod(n.node,t)},chown:(e,t,n,i)=>{var r;if(!(r="string"==typeof e?ge.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new ge.ErrnoError(63);r.node_ops.setattr(r,{timestamp:Date.now()})},lchown:(e,t,n)=>{ge.chown(e,t,n,!0)},fchown:(e,t,n)=>{var i=ge.getStream(e);if(!i)throw new ge.ErrnoError(8);ge.chown(i.node,t,n)},truncate:(e,t)=>{if(t<0)throw new ge.ErrnoError(28);var n;if(!(n="string"==typeof e?ge.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new ge.ErrnoError(63);if(ge.isDir(n.mode))throw new ge.ErrnoError(31);if(!ge.isFile(n.mode))throw new ge.ErrnoError(28);var i=ge.nodePermissions(n,"w");if(i)throw new ge.ErrnoError(i);n.node_ops.setattr(n,{size:t,timestamp:Date.now()})},ftruncate:(e,t)=>{var n=ge.getStream(e);if(!n)throw new ge.ErrnoError(8);if(0==(2097155&n.flags))throw new ge.ErrnoError(28);ge.truncate(n.node,t)},utime:(e,t,n)=>{var i=ge.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,n)})},open:(e,t,n,i,r)=>{if(""===e)throw new ge.ErrnoError(44);var s;if(n=void 0===n?438:n,n=64&(t="string"==typeof t?ge.modeStringToFlags(t):t)?4095&n|32768:0,"object"==typeof e)s=e;else{e=de.normalize(e);try{s=ge.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var a=!1;if(64&t)if(s){if(128&t)throw new ge.ErrnoError(20)}else s=ge.mknod(e,n,0),a=!0;if(!s)throw new ge.ErrnoError(44);if(ge.isChrdev(s.mode)&&(t&=-513),65536&t&&!ge.isDir(s.mode))throw new ge.ErrnoError(54);if(!a){var c=ge.mayOpen(s,t);if(c)throw new ge.ErrnoError(c)}512&t&&ge.truncate(s,0),t&=-131713;var l=ge.createStream({node:s,path:ge.getPath(s),flags:t,seekable:!0,position:0,stream_ops:s.stream_ops,ungotten:[],error:!1},i,r);return l.stream_ops.open&&l.stream_ops.open(l),!o.logReadFiles||1&t||(ge.readFiles||(ge.readFiles={}),e in ge.readFiles||(ge.readFiles[e]=1)),l},close:e=>{if(ge.isClosed(e))throw new ge.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{ge.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek:(e,t,n)=>{if(ge.isClosed(e))throw new ge.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new ge.ErrnoError(70);if(0!=n&&1!=n&&2!=n)throw new ge.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read:(e,t,n,i,r)=>{if(i<0||r<0)throw new ge.ErrnoError(28);if(ge.isClosed(e))throw new ge.ErrnoError(8);if(1==(2097155&e.flags))throw new ge.ErrnoError(8);if(ge.isDir(e.node.mode))throw new ge.ErrnoError(31);if(!e.stream_ops.read)throw new ge.ErrnoError(28);var s=void 0!==r;if(s){if(!e.seekable)throw new ge.ErrnoError(70)}else r=e.position;var a=e.stream_ops.read(e,t,n,i,r);return s||(e.position+=a),a},write:(e,t,n,i,r,s)=>{if(i<0||r<0)throw new ge.ErrnoError(28);if(ge.isClosed(e))throw new ge.ErrnoError(8);if(0==(2097155&e.flags))throw new ge.ErrnoError(8);if(ge.isDir(e.node.mode))throw new ge.ErrnoError(31);if(!e.stream_ops.write)throw new ge.ErrnoError(28);e.seekable&&1024&e.flags&&ge.llseek(e,0,2);var a=void 0!==r;if(a){if(!e.seekable)throw new ge.ErrnoError(70)}else r=e.position;var o=e.stream_ops.write(e,t,n,i,r,s);return a||(e.position+=o),o},allocate:(e,t,n)=>{if(ge.isClosed(e))throw new ge.ErrnoError(8);if(t<0||n<=0)throw new ge.ErrnoError(28);if(0==(2097155&e.flags))throw new ge.ErrnoError(8);if(!ge.isFile(e.node.mode)&&!ge.isDir(e.node.mode))throw new ge.ErrnoError(43);if(!e.stream_ops.allocate)throw new ge.ErrnoError(138);e.stream_ops.allocate(e,t,n)},mmap:(e,t,n,i,r,s)=>{if(0!=(2&r)&&0==(2&s)&&2!=(2097155&e.flags))throw new ge.ErrnoError(2);if(1==(2097155&e.flags))throw new ge.ErrnoError(2);if(!e.stream_ops.mmap)throw new ge.ErrnoError(43);return e.stream_ops.mmap(e,t,n,i,r,s)},msync:(e,t,n,i,r)=>e&&e.stream_ops.msync?e.stream_ops.msync(e,t,n,i,r):0,munmap:e=>0,ioctl:(e,t,n)=>{if(!e.stream_ops.ioctl)throw new ge.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile:(e,t={})=>{if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error('Invalid encoding type "'+t.encoding+'"');var n,i=ge.open(e,t.flags),r=ge.stat(e).size,s=new Uint8Array(r);return ge.read(i,s,0,r,0),"utf8"===t.encoding?n=k(s,0):"binary"===t.encoding&&(n=s),ge.close(i),n},writeFile:(e,t,n={})=>{n.flags=n.flags||577;var i=ge.open(e,n.flags,n.mode);if("string"==typeof t){var r=new Uint8Array(N(t)+1),s=V(t,r,0,r.length);ge.write(i,r,0,s,void 0,n.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");ge.write(i,t,0,t.byteLength,void 0,n.canOwn)}ge.close(i)},cwd:()=>ge.currentPath,chdir:e=>{var t=ge.lookupPath(e,{follow:!0});if(null===t.node)throw new ge.ErrnoError(44);if(!ge.isDir(t.node.mode))throw new ge.ErrnoError(54);var n=ge.nodePermissions(t.node,"x");if(n)throw new ge.ErrnoError(n);ge.currentPath=t.path},createDefaultDirectories:()=>{ge.mkdir("/tmp"),ge.mkdir("/home"),ge.mkdir("/home/web_user")},createDefaultDevices:()=>{ge.mkdir("/dev"),ge.registerDevice(ge.makedev(1,3),{read:()=>0,write:(e,t,n,i,r)=>i}),ge.mkdev("/dev/null",ge.makedev(1,3)),pe.register(ge.makedev(5,0),pe.default_tty_ops),pe.register(ge.makedev(6,0),pe.default_tty1_ops),ge.mkdev("/dev/tty",ge.makedev(5,0)),ge.mkdev("/dev/tty1",ge.makedev(6,0));var e=he();ge.createDevice("/dev","random",e),ge.createDevice("/dev","urandom",e),ge.mkdir("/dev/shm"),ge.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{ge.mkdir("/proc");var e=ge.mkdir("/proc/self");ge.mkdir("/proc/self/fd"),ge.mount({mount:()=>{var t=ge.createNode(e,"fd",16895,73);return t.node_ops={lookup:(e,t)=>{var n=+t,i=ge.getStream(n);if(!i)throw new ge.ErrnoError(8);var r={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return r.parent=r,r}},t}},{},"/proc/self/fd")},createStandardStreams:()=>{o.stdin?ge.createDevice("/dev","stdin",o.stdin):ge.symlink("/dev/tty","/dev/stdin"),o.stdout?ge.createDevice("/dev","stdout",null,o.stdout):ge.symlink("/dev/tty","/dev/stdout"),o.stderr?ge.createDevice("/dev","stderr",null,o.stderr):ge.symlink("/dev/tty1","/dev/stderr"),ge.open("/dev/stdin",0),ge.open("/dev/stdout",1),ge.open("/dev/stderr",1)},ensureErrnoError:()=>{ge.ErrnoError||(ge.ErrnoError=function(e,t){this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},ge.ErrnoError.prototype=new Error,ge.ErrnoError.prototype.constructor=ge.ErrnoError,[44].forEach((e=>{ge.genericErrors[e]=new ge.ErrnoError(e),ge.genericErrors[e].stack=""})))},staticInit:()=>{ge.ensureErrnoError(),ge.nameTable=new Array(4096),ge.mount(me,{},"/"),ge.createDefaultDirectories(),ge.createDefaultDevices(),ge.createSpecialDirectories(),ge.filesystems={MEMFS:me}},init:(e,t,n)=>{ge.init.initialized=!0,ge.ensureErrnoError(),o.stdin=e||o.stdin,o.stdout=t||o.stdout,o.stderr=n||o.stderr,ge.createStandardStreams()},quit:()=>{ge.init.initialized=!1;for(var e=0;e{var n=0;return e&&(n|=365),t&&(n|=146),n},findObject:(e,t)=>{var n=ge.analyzePath(e,t);return n.exists?n.object:null},analyzePath:(e,t)=>{try{e=(i=ge.lookupPath(e,{follow:!t})).path}catch(e){}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=ge.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=i.path,n.parentObject=i.node,n.name=de.basename(e),i=ge.lookupPath(e,{follow:!t}),n.exists=!0,n.path=i.path,n.object=i.node,n.name=i.node.name,n.isRoot="/"===i.path}catch(e){n.error=e.errno}return n},createPath:(e,t,n,i)=>{e="string"==typeof e?e:ge.getPath(e);for(var r=t.split("/").reverse();r.length;){var s=r.pop();if(s){var a=de.join2(e,s);try{ge.mkdir(a)}catch(e){}e=a}}return a},createFile:(e,t,n,i,r)=>{var s=de.join2("string"==typeof e?e:ge.getPath(e),t),a=ge.getMode(i,r);return ge.create(s,a)},createDataFile:(e,t,n,i,r,s)=>{var a=t;e&&(e="string"==typeof e?e:ge.getPath(e),a=t?de.join2(e,t):e);var o=ge.getMode(i,r),c=ge.create(a,o);if(n){if("string"==typeof n){for(var l=new Array(n.length),u=0,d=n.length;u{var r=de.join2("string"==typeof e?e:ge.getPath(e),t),s=ge.getMode(!!n,!!i);ge.createDevice.major||(ge.createDevice.major=64);var a=ge.makedev(ge.createDevice.major++,0);return ge.registerDevice(a,{open:e=>{e.seekable=!1},close:e=>{i&&i.buffer&&i.buffer.length&&i(10)},read:(e,t,i,r,s)=>{for(var a=0,o=0;o{for(var a=0;a{if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!l)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=_e(l(e.url),!0),e.usedBytes=e.contents.length}catch(e){throw new ge.ErrnoError(29)}},createLazyFile:(e,t,n,i,r)=>{function s(){this.lengthKnown=!1,this.chunks=[]}if(s.prototype.get=function(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",n,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+n+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),r=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;r||(a=i);var o=this;o.setDataGetter((e=>{var t=e*a,r=(e+1)*a-1;if(r=Math.min(r,i-1),void 0===o.chunks[e]&&(o.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var r=new XMLHttpRequest;if(r.open("GET",n,!1),i!==a&&r.setRequestHeader("Range","bytes="+e+"-"+t),"undefined"!=typeof Uint8Array&&(r.responseType="arraybuffer"),r.overrideMimeType&&r.overrideMimeType("text/plain; charset=x-user-defined"),r.send(null),!(r.status>=200&&r.status<300||304===r.status))throw new Error("Couldn't load "+n+". Status: "+r.status);return void 0!==r.response?new Uint8Array(r.response||[]):_e(r.responseText||"",!0)})(t,r)),void 0===o.chunks[e])throw new Error("doXHR failed!");return o.chunks[e]})),!s&&i||(a=i=1,i=this.getter(0).length,a=i,_("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!x)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new s;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var o={isDevice:!1,contents:a}}else o={isDevice:!1,url:n};var c=ge.createFile(e,t,o,i,r);o.contents?c.contents=o.contents:o.url&&(c.contents=null,c.url=o.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var l={};return Object.keys(c.stream_ops).forEach((e=>{var t=c.stream_ops[e];l[e]=function(){return ge.forceLoadFile(c),t.apply(null,arguments)}})),l.read=(e,t,n,i,r)=>{ge.forceLoadFile(c);var s=e.node.contents;if(r>=s.length)return 0;var a=Math.min(s.length-r,i);if(s.slice)for(var o=0;o{var d=t?fe.resolve(de.join2(e,t)):e;function h(n){function u(n){l&&l(),o||ge.createDataFile(e,t,n,i,r,c),s&&s(),Z()}Browser.handledByPreloadPlugin(n,d,u,(()=>{a&&a(),Z()}))||u(n)}J(),"string"==typeof n?function(e,t,n,i){var r="al "+e;u(e,(function(t){t||Q('Loading data file "'+e+'" failed (no arrayBuffer).'),(e=>{h(e)})(new Uint8Array(t)),r&&Z()}),(function(t){if(!n)throw'Loading data file "'+e+'" failed.';n()})),r&&J()}(n,0,a):h(n)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(e,t,n)=>{t=t||(()=>{}),n=n||(()=>{});var i=ge.indexedDB();try{var r=i.open(ge.DB_NAME(),ge.DB_VERSION)}catch(e){return n(e)}r.onupgradeneeded=()=>{_("creating db"),r.result.createObjectStore(ge.DB_STORE_NAME)},r.onsuccess=()=>{var i=r.result.transaction([ge.DB_STORE_NAME],"readwrite"),s=i.objectStore(ge.DB_STORE_NAME),a=0,o=0,c=e.length;function l(){0==o?t():n()}e.forEach((e=>{var t=s.put(ge.analyzePath(e).object.contents,e);t.onsuccess=()=>{++a+o==c&&l()},t.onerror=()=>{o++,a+o==c&&l()}})),i.onerror=n},r.onerror=n},loadFilesFromDB:(e,t,n)=>{t=t||(()=>{}),n=n||(()=>{});var i=ge.indexedDB();try{var r=i.open(ge.DB_NAME(),ge.DB_VERSION)}catch(e){return n(e)}r.onupgradeneeded=n,r.onsuccess=()=>{var i=r.result;try{var s=i.transaction([ge.DB_STORE_NAME],"readonly")}catch(e){return void n(e)}var a=s.objectStore(ge.DB_STORE_NAME),o=0,c=0,l=e.length;function u(){0==c?t():n()}e.forEach((e=>{var t=a.get(e);t.onsuccess=()=>{ge.analyzePath(e).exists&&ge.unlink(e),ge.createDataFile(de.dirname(e),de.basename(e),t.result,!0,!0,!0),++o+c==l&&u()},t.onerror=()=>{c++,o+c==l&&u()}})),s.onerror=n},r.onerror=n}},ve={mappings:{},DEFAULT_POLLMASK:5,calculateAt:function(e,t,n){if("/"===t[0])return t;var i;if(-100===e)i=ge.cwd();else{var r=ge.getStream(e);if(!r)throw new ge.ErrnoError(8);i=r.path}if(0==t.length){if(!n)throw new ge.ErrnoError(44);return i}return de.join2(i,t)},doStat:function(e,t,n){try{var i=e(t)}catch(e){if(e&&e.node&&de.normalize(t)!==de.normalize(ge.getPath(e.node)))return-54;throw e}return R[n>>2]=i.dev,R[n+4>>2]=0,R[n+8>>2]=i.ino,R[n+12>>2]=i.mode,R[n+16>>2]=i.nlink,R[n+20>>2]=i.uid,R[n+24>>2]=i.gid,R[n+28>>2]=i.rdev,R[n+32>>2]=0,$=[i.size>>>0,(q=i.size,+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],R[n+40>>2]=$[0],R[n+44>>2]=$[1],R[n+48>>2]=4096,R[n+52>>2]=i.blocks,R[n+56>>2]=i.atime.getTime()/1e3|0,R[n+60>>2]=0,R[n+64>>2]=i.mtime.getTime()/1e3|0,R[n+68>>2]=0,R[n+72>>2]=i.ctime.getTime()/1e3|0,R[n+76>>2]=0,$=[i.ino>>>0,(q=i.ino,+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],R[n+80>>2]=$[0],R[n+84>>2]=$[1],0},doMsync:function(e,t,n,i,r){var s=z.slice(e,e+n);ge.msync(t,s,r,n,i)},doMkdir:function(e,t){return"/"===(e=de.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),ge.mkdir(e,t,0),0},doMknod:function(e,t,n){switch(61440&t){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return ge.mknod(e,t,n),0},doReadlink:function(e,t,n){if(n<=0)return-28;var i=ge.readlink(e),r=Math.min(n,N(i)),s=A[t+r];return V(i,z,t,n+1),A[t+r]=s,r},doAccess:function(e,t){if(-8&t)return-28;var n=ge.lookupPath(e,{follow:!0}).node;if(!n)return-44;var i="";return 4&t&&(i+="r"),2&t&&(i+="w"),1&t&&(i+="x"),i&&ge.nodePermissions(n,i)?-2:0},doDup:function(e,t,n){var i=ge.getStream(n);return i&&ge.close(i),ge.open(e,t,0,n,n).fd},doReadv:function(e,t,n,i){for(var r=0,s=0;s>2],o=R[t+(8*s+4)>>2],c=ge.read(e,A,a,o,i);if(c<0)return-1;if(r+=c,c>2],o=R[t+(8*s+4)>>2],c=ge.write(e,A,a,o,i);if(c<0)return-1;r+=c}return r},varargs:void 0,get:function(){return ve.varargs+=4,R[ve.varargs-4>>2]},getStr:function(e){return I(e)},getStreamFromFD:function(e){var t=ge.getStream(e);if(!t)throw new ge.ErrnoError(8);return t},get64:function(e,t){return e}};function ye(e){return e%4==0&&(e%100!=0||e%400==0)}function be(e,t){for(var n=0,i=0;i<=t;n+=e[i++]);return n}var xe=[31,29,31,30,31,30,31,31,30,31,30,31],we=[31,28,31,30,31,30,31,31,30,31,30,31];function Me(e,t){for(var n=new Date(e.getTime());t>0;){var i=ye(n.getFullYear()),r=n.getMonth(),s=(i?xe:we)[r];if(!(t>s-n.getDate()))return n.setDate(n.getDate()+t),n;t-=s-n.getDate()+1,n.setDate(1),r<11?n.setMonth(r+1):(n.setMonth(0),n.setFullYear(n.getFullYear()+1))}return n}var Se=function(e,t,n,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=ge.nextInode++,this.name=t,this.mode=n,this.node_ops={},this.stream_ops={},this.rdev=i};function _e(e,t,n){var i=n>0?n:N(e)+1,r=new Array(i),s=V(e,r,0,r.length);return t&&(r.length=s),r}Object.defineProperties(Se.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(e){e?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(e){e?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return ge.isDir(this.mode)}},isDevice:{get:function(){return ge.isChrdev(this.mode)}}}),ge.FSNode=Se,ge.staticInit();var Ce,Ee={d:function(e){return Te(e+16)+16},c:function(e,t,n){throw new oe(e).init(t,n),e},f:function(e,t){Q("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},i:function(e,t){Q("To use dlopen, you need to use Emscripten's linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},a:function(){Q("")},b:function(e,t){var n;if(0===e)n=Date.now();else{if(1!==e&&4!==e)return R[Le()>>2]=28,-1;n=re()}return R[t>>2]=n/1e3|0,R[t+4>>2]=n%1e3*1e3*1e3|0,0},o:function(){return 2147483648},g:re,h:function(e,t,n){z.copyWithin(e,t,t+n)},n:function(e){var t,n=z.length,i=2147483648;if((e>>>=0)>i)return!1;for(var r=1;r<=4;r*=2){var s=n*(1+.2/r);if(s=Math.min(s,e+100663296),ce(Math.min(i,((t=Math.max(e,s))%65536>0&&(t+=65536-t%65536),t))))return!0}return!1},p:function(e,t){var n=0;return ue().forEach((function(i,r){var s=t+n;R[e+4*r>>2]=s,function(e,t,n){for(var i=0;i>0]=e.charCodeAt(i);A[t>>0]=0}(i,s),n+=i.length+1})),0},q:function(e,t){var n=ue();R[e>>2]=n.length;var i=0;return n.forEach((function(e){i+=e.length+1})),R[t>>2]=i,0},s:function(e){!function(e,t){var n;W(),n=e,W()||(o.onExit&&o.onExit(n),P=!0),y(n,new ze(n))}(e)},j:function(e){try{var t=ve.getStreamFromFD(e);return ge.close(t),0}catch(e){if(void 0===ge||!(e instanceof ge.ErrnoError))throw e;return e.errno}},r:function(e,t,n,i){try{var r=ve.getStreamFromFD(e),s=ve.doReadv(r,t,n);return R[i>>2]=s,0}catch(e){if(void 0===ge||!(e instanceof ge.ErrnoError))throw e;return e.errno}},k:function(e,t,n,i,r){try{var s=ve.getStreamFromFD(e),a=4294967296*n+(t>>>0),o=9007199254740992;return a<=-o||a>=o?-61:(ge.llseek(s,a,i),$=[s.position>>>0,(q=s.position,+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],R[r>>2]=$[0],R[r+4>>2]=$[1],s.getdents&&0===a&&0===i&&(s.getdents=null),0)}catch(e){if(void 0===ge||!(e instanceof ge.ErrnoError))throw e;return e.errno}},e:function(e,t,n,i){try{var r=ve.getStreamFromFD(e),s=ve.doWritev(r,t,n);return R[i>>2]=s,0}catch(e){if(void 0===ge||!(e instanceof ge.ErrnoError))throw e;return e.errno}},l:function e(t,n){e.randomDevice||(e.randomDevice=he());for(var i=0;i>0]=e.randomDevice();return 0},m:function(e,t,n,i){return function(e,t,n,i){var r=R[i+40>>2],s={tm_sec:R[i>>2],tm_min:R[i+4>>2],tm_hour:R[i+8>>2],tm_mday:R[i+12>>2],tm_mon:R[i+16>>2],tm_year:R[i+20>>2],tm_wday:R[i+24>>2],tm_yday:R[i+28>>2],tm_isdst:R[i+32>>2],tm_gmtoff:R[i+36>>2],tm_zone:r?I(r):""},a=I(n),o={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var c in o)a=a.replace(new RegExp(c,"g"),o[c]);var l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],u=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,t,n){for(var i="number"==typeof e?e.toString():e||"";i.length0?1:0}var i;return 0===(i=n(e.getFullYear()-t.getFullYear()))&&0===(i=n(e.getMonth()-t.getMonth()))&&(i=n(e.getDate()-t.getDate())),i}function p(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function m(e){var t=Me(new Date(e.tm_year+1900,0,1),e.tm_yday),n=new Date(t.getFullYear(),0,4),i=new Date(t.getFullYear()+1,0,4),r=p(n),s=p(i);return f(r,t)<=0?f(s,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var g={"%a":function(e){return l[e.tm_wday].substring(0,3)},"%A":function(e){return l[e.tm_wday]},"%b":function(e){return u[e.tm_mon].substring(0,3)},"%B":function(e){return u[e.tm_mon]},"%C":function(e){return h((e.tm_year+1900)/100|0,2)},"%d":function(e){return h(e.tm_mday,2)},"%e":function(e){return d(e.tm_mday,2," ")},"%g":function(e){return m(e).toString().substring(2)},"%G":function(e){return m(e)},"%H":function(e){return h(e.tm_hour,2)},"%I":function(e){var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),h(t,2)},"%j":function(e){return h(e.tm_mday+be(ye(e.tm_year+1900)?xe:we,e.tm_mon-1),3)},"%m":function(e){return h(e.tm_mon+1,2)},"%M":function(e){return h(e.tm_min,2)},"%n":function(){return"\n"},"%p":function(e){return e.tm_hour>=0&&e.tm_hour<12?"AM":"PM"},"%S":function(e){return h(e.tm_sec,2)},"%t":function(){return"\t"},"%u":function(e){return e.tm_wday||7},"%U":function(e){var t=new Date(e.tm_year+1900,0,1),n=0===t.getDay()?t:Me(t,7-t.getDay()),i=new Date(e.tm_year+1900,e.tm_mon,e.tm_mday);if(f(n,i)<0){var r=be(ye(i.getFullYear())?xe:we,i.getMonth()-1)-31,s=31-n.getDate()+r+i.getDate();return h(Math.ceil(s/7),2)}return 0===f(n,t)?"01":"00"},"%V":function(e){var t,n=new Date(e.tm_year+1900,0,4),i=new Date(e.tm_year+1901,0,4),r=p(n),s=p(i),a=Me(new Date(e.tm_year+1900,0,1),e.tm_yday);return f(a,r)<0?"53":f(s,a)<=0?"01":(t=r.getFullYear()=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(n?"+":"-")+String("0000"+t).slice(-4)},"%Z":function(e){return e.tm_zone},"%%":function(){return"%"}};for(var c in g)a.includes(c)&&(a=a.replace(new RegExp(c,"g"),g[c](s)));var v=_e(a,!1);return v.length>t?0:(function(e,t){A.set(e,t)}(v,e),v.length-1)}(e,t,n,i)}},Te=(function(){var e={a:Ee};function t(e,t){var n,i=e.exports;o.asm=i,D((E=o.asm.t).buffer),O=o.asm.H,n=o.asm.u,B.unshift(n),Z()}function n(e){t(e.instance)}function i(t){return function(){if(!S&&(b||x)){if("function"==typeof fetch&&!te(G))return fetch(G,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+G+"'";return e.arrayBuffer()})).catch((function(){return ne(G)}));if(u)return new Promise((function(e,t){u(G,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return ne(G)}))}().then((function(t){return WebAssembly.instantiate(t,e)})).then((function(e){return e})).then(t,(function(e){C("failed to asynchronously prepare wasm: "+e),Q(e)}))}if(J(),o.instantiateWasm)try{return o.instantiateWasm(e,t)}catch(e){return C("Module.instantiateWasm callback failed with error: "+e),!1}(S||"function"!=typeof WebAssembly.instantiateStreaming||ee(G)||te(G)||"function"!=typeof fetch?i(n):fetch(G,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(n,(function(e){return C("wasm streaming compile failed: "+e),C("falling back to ArrayBuffer instantiation"),i(n)}))}))).catch(a)}(),o.___wasm_call_ctors=function(){return(o.___wasm_call_ctors=o.asm.u).apply(null,arguments)},o._initPoseDetectorModelBuffer=function(){return(o._initPoseDetectorModelBuffer=o.asm.v).apply(null,arguments)},o._getPoseDetectorModelBufferAddress=function(){return(o._getPoseDetectorModelBufferAddress=o.asm.w).apply(null,arguments)},o._loadPoseDetectorModel=function(){return(o._loadPoseDetectorModel=o.asm.x).apply(null,arguments)},o._initPoseLandmarkModelBuffer=function(){return(o._initPoseLandmarkModelBuffer=o.asm.y).apply(null,arguments)},o._getPoseLandmarkModelBufferAddress=function(){return(o._getPoseLandmarkModelBufferAddress=o.asm.z).apply(null,arguments)},o._loadPoseLandmarkModel=function(){return(o._loadPoseLandmarkModel=o.asm.A).apply(null,arguments)},o._initPoseInputBuffer=function(){return(o._initPoseInputBuffer=o.asm.B).apply(null,arguments)},o._getPoseInputBufferAddress=function(){return(o._getPoseInputBufferAddress=o.asm.C).apply(null,arguments)},o._getPoseOutputBufferAddress=function(){return(o._getPoseOutputBufferAddress=o.asm.D).apply(null,arguments)},o._getPoseTemporaryBufferAddress=function(){return(o._getPoseTemporaryBufferAddress=o.asm.E).apply(null,arguments)},o._execPose=function(){return(o._execPose=o.asm.F).apply(null,arguments)},o._set_pose_calculate_mode=function(){return(o._set_pose_calculate_mode=o.asm.G).apply(null,arguments)},o._initPalmDetectorModelBuffer=function(){return(o._initPalmDetectorModelBuffer=o.asm.I).apply(null,arguments)},o._getPalmDetectorModelBufferAddress=function(){return(o._getPalmDetectorModelBufferAddress=o.asm.J).apply(null,arguments)},o._loadPalmDetectorModel=function(){return(o._loadPalmDetectorModel=o.asm.K).apply(null,arguments)},o._initHandLandmarkModelBuffer=function(){return(o._initHandLandmarkModelBuffer=o.asm.L).apply(null,arguments)},o._getHandLandmarkModelBufferAddress=function(){return(o._getHandLandmarkModelBufferAddress=o.asm.M).apply(null,arguments)},o._loadHandLandmarkModel=function(){return(o._loadHandLandmarkModel=o.asm.N).apply(null,arguments)},o._initHandInputBuffer=function(){return(o._initHandInputBuffer=o.asm.O).apply(null,arguments)},o._getHandInputBufferAddress=function(){return(o._getHandInputBufferAddress=o.asm.P).apply(null,arguments)},o._getHandOutputBufferAddress=function(){return(o._getHandOutputBufferAddress=o.asm.Q).apply(null,arguments)},o._getHandTemporaryBufferAddress=function(){return(o._getHandTemporaryBufferAddress=o.asm.R).apply(null,arguments)},o._execHand=function(){return(o._execHand=o.asm.S).apply(null,arguments)},o._initFaceDetectorModelBuffer=function(){return(o._initFaceDetectorModelBuffer=o.asm.T).apply(null,arguments)},o._getFaceDetectorModelBufferAddress=function(){return(o._getFaceDetectorModelBufferAddress=o.asm.U).apply(null,arguments)},o._loadFaceDetectorModel=function(){return(o._loadFaceDetectorModel=o.asm.V).apply(null,arguments)},o._initFaceLandmarkModelBuffer=function(){return(o._initFaceLandmarkModelBuffer=o.asm.W).apply(null,arguments)},o._getFaceLandmarkModelBufferAddress=function(){return(o._getFaceLandmarkModelBufferAddress=o.asm.X).apply(null,arguments)},o._loadFaceLandmarkModel=function(){return(o._loadFaceLandmarkModel=o.asm.Y).apply(null,arguments)},o._initFaceInputBuffer=function(){return(o._initFaceInputBuffer=o.asm.Z).apply(null,arguments)},o._getFaceInputBufferAddress=function(){return(o._getFaceInputBufferAddress=o.asm._).apply(null,arguments)},o._getFaceOutputBufferAddress=function(){return(o._getFaceOutputBufferAddress=o.asm.$).apply(null,arguments)},o._getFaceTemporaryBufferAddress=function(){return(o._getFaceTemporaryBufferAddress=o.asm.aa).apply(null,arguments)},o._execFace=function(){return(o._execFace=o.asm.ba).apply(null,arguments)},o._malloc=function(){return(Te=o._malloc=o.asm.ca).apply(null,arguments)}),Le=o.___errno_location=function(){return(Le=o.___errno_location=o.asm.da).apply(null,arguments)},Ae=o._memalign=function(){return(Ae=o._memalign=o.asm.ea).apply(null,arguments)};function ze(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Re(e){function n(){Ce||(Ce=!0,o.calledRun=!0,P||(o.noFSInit||ge.init.initialized||ge.init(),ge.ignorePermissions=!1,pe.init(),ie(B),t(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),function(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)e=o.postRun.shift(),U.unshift(e);var e;ie(U)}()))}e=e||g,X>0||(function(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)e=o.preRun.shift(),F.unshift(e);var e;ie(F)}(),X>0||(o.setStatus?(o.setStatus("Running..."),setTimeout((function(){setTimeout((function(){o.setStatus("")}),1),n()}),1)):n()))}if(Y=function e(){Ce||Re(),Ce||(Y=e)},o.run=Re,o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return Re(),e.ready});e.exports=a},363:e=>{"use strict";e.exports=n(363)},102:e=>{"use strict";e.exports=n(102)},914:e=>{"use strict";e.exports=n(914)},583:e=>{"use strict";e.exports=n(583)},180:e=>{"use strict";e.exports=n(180)},747:e=>{"use strict";e.exports=n(747)},81:e=>{"use strict";e.exports=n(81)},782:()=>{},384:()=>{},375:()=>{}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),s.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{"use strict";i.r(s),i.d(s,{FingerLookupIndices:()=>r,MediapipeMix2WorkerManager:()=>y,NUM_KEYPOINTS:()=>l,OperationType:()=>t,PartsLookupIndices:()=>n,RefinedLeftEyePoints:()=>h,RefinedLeftIrisPoints:()=>p,RefinedLipPoints:()=>d,RefinedPoints:()=>g,RefinedRightEyePoints:()=>f,RefinedRightIrisPoints:()=>m,TRIANGULATION:()=>u});var e=i(55);const t={hand:"hand",face:"face",pose:"pose"},n={leftEye:[0,1,2,3,7],rightEye:[0,4,5,6,8],mouth:[9,10],body:[11,12,24,23,11],leftArm:[11,13,15],leftThum:[15,21],leftIndex:[15,19],leftPinly:[15,17],rightArm:[12,14,16],rightThum:[16,22],rightIndex:[16,20],rightPinly:[16,18],leftLeg:[23,25,27],leftFoot:[27,29,31],rightLeg:[24,26,28],rightFoot:[28,30,32]},r={thumb:[0,1,2,3,4],indexFinger:[0,5,6,7,8],middleFinger:[0,9,10,11,12],ringFinger:[0,13,14,15,16],pinky:[0,17,18,19,20]};var a=i(477),o=i.n(a);function c(){return o()('/*! For license information please see index.worker.js.LICENSE.txt */\n(()=>{var t={252:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BlockingQueue=void 0;var r=function(){function t(){this._resolvers=[],this._promises=[]}return t.prototype._add=function(){var t=this;this._promises.push(new Promise((function(e){t._resolvers.push(e)})))},t.prototype.enqueue=function(t){this._resolvers.length||this._add(),this._resolvers.shift()(t)},t.prototype.dequeue=function(){return this._promises.length||this._add(),this._promises.shift()},t.prototype.isEmpty=function(){return!this._promises.length},t.prototype.isBlocked=function(){return!!this._resolvers.length},Object.defineProperty(t.prototype,"length",{get:function(){return this._promises.length-this._resolvers.length},enumerable:!1,configurable:!0}),t}();e.BlockingQueue=r},289:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBrowserType=e.BrowserTypes=void 0,e.BrowserTypes={MSIE:"MSIE",EDGE:"EDGE",CHROME:"CHROME",SAFARI:"SAFARI",FIREFOX:"FIREFOX",OPERA:"OPERA",OTHER:"OTHER"},e.getBrowserType=function(){var t=window.navigator.userAgent.toLowerCase();return-1!==t.indexOf("msie")||-1!==t.indexOf("trident")?e.BrowserTypes.MSIE:-1!==t.indexOf("edge")?e.BrowserTypes.EDGE:-1!==t.indexOf("chrome")?e.BrowserTypes.CHROME:-1!==t.indexOf("safari")?e.BrowserTypes.SAFARI:-1!==t.indexOf("firefox")?e.BrowserTypes.FIREFOX:-1!==t.indexOf("opera")?e.BrowserTypes.OPERA:e.BrowserTypes.OTHER}},187:function(t,e,r){"use strict";var n=r(764).lW,o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]100)throw new Error("queue is fulled: ".concat(this.sem.length));return[4,this.lock()];case 1:t=i.sent(),o=new Promise((function(t,o){if(!f.worker)throw new Error("worker is not activated.");f.worker.onmessage=function(e){e.data.message===u.WorkerResponse.PREDICTED?t(e.data.prediction):(console.log("Prediction something wrong..",e.data.message),o(e))},n?r instanceof Uint8ClampedArray?f.worker.postMessage({message:u.WorkerCommand.PREDICT,params:e,data:r},[r.buffer]):f.worker.postMessage({message:u.WorkerCommand.PREDICT,params:e,data:r},[r]):f.worker.postMessage({message:u.WorkerCommand.PREDICT,params:e,data:r})})),i.label=2;case 2:return i.trys.push([2,4,5,6]),[4,o];case 3:return s=i.sent(),[3,6];case 4:return a=i.sent(),console.log("worker prediction error. :",a),[3,6];case 5:return this.unlock(t),[7];case 6:return[2,s]}}))}))},this.useWorker=function(t){return!t.processOnLocal&&(!1!==t.useWorkerForSafari||(0,a.getBrowserType)()!==a.BrowserTypes.SAFARI)},this.fetchData=function(e){return o(t,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return e.startsWith("data:")?(t=e.split(",")[1],[2,n.from(t,"base64")]):[4,fetch(e,{method:"GET"})];case 1:return[4,r.sent().arrayBuffer()];case 2:return[2,r.sent()]}}))}))},this.sem.enqueue(0)};e.WorkerDispatcher=function(t){var e=this;this.imageProcessor=null,this.config=null,this.callbacks=null,this.setCallback=function(t){e.callbacks=t},this.dispach=function(t){return o(e,void 0,void 0,(function(){var e,r,n,o;return i(this,(function(i){switch(i.label){case 0:return this.callbacks?t.data.message!==u.WorkerCommand.INITIALIZE?[3,2]:(this.config=t.data.config,e=this,[4,this.callbacks.init(this.config)]):(console.warn("[worker] Dispatcher callbacks is not initialized"),[2]);case 1:return e.imageProcessor=i.sent(),this.context.postMessage({message:u.WorkerResponse.INITIALIZED}),console.log("[worker] Initialized"),[3,4];case 2:return t.data.message!==u.WorkerCommand.PREDICT?[3,4]:this.imageProcessor?this.config?(r=t.data.params,n=t.data.data,[4,this.imageProcessor.predict(this.config,r,n)]):(console.warn("[worker] Dispatcher config is not initialized"),[2]):(console.warn("[worker] ImageProcessor is not initialized"),[2]);case 3:o=i.sent(),this.context.postMessage({message:u.WorkerResponse.PREDICTED,prediction:o}),i.label=4;case 4:return[2]}}))}))},this.context=t}},301:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WorkerResponse=e.WorkerCommand=void 0,e.WorkerCommand={INITIALIZE:"initialize",PREDICT:"predict"},e.WorkerResponse={INITIALIZED:"initialized",PREDICTED:"predicted"}},55:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(187),e),o(r(289),e)},742:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,i=u(t),s=i[0],a=i[1],f=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),l=0,c=a>0?s-4:s;for(r=0;r>16&255,f[l++]=e>>8&255,f[l++]=255&e;return 2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,f[l++]=255&e),1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,f[l++]=e>>8&255,f[l++]=255&e),f},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],s=16383,a=0,u=n-o;au?u:a+s));return 1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=i.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,n){for(var o,i,s=[],a=e;a>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},764:(t,e,r)=>{"use strict";const n=r(742),o=r(645),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.lW=u,e.h2=50;const s=2147483647;function a(t){if(t>s)throw new RangeError(\'The value "\'+t+\'" is invalid for option "size"\');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError(\'The "string" argument must be of type string. Received type number\');return c(t)}return f(t,e,r)}function f(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|m(t,e);let n=a(r);const o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(G(t,Uint8Array)){const e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(G(t,ArrayBuffer)||t&&G(t.buffer,ArrayBuffer))return h(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(G(t,SharedArrayBuffer)||t&&G(t.buffer,SharedArrayBuffer)))return h(t,e,r);if("number"==typeof t)throw new TypeError(\'The "value" argument must not be of type number. Received type number\');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const o=function(t){if(u.isBuffer(t)){const e=0|p(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||V(t.length)?a(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError(\'"size" argument must be of type number\');if(t<0)throw new RangeError(\'The value "\'+t+\'" is invalid for option "size"\')}function c(t){return l(t),a(t<0?0:0|p(t))}function d(t){const e=t.length<0?0:0|p(t.length),r=a(e);for(let n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function m(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||G(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return X(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(t).length;default:if(o)return n?-1:X(t).length;e=(""+e).toLowerCase(),o=!0}}function y(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return P(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function w(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),V(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:E(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):E(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,o){let i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let n=-1;for(i=r;ia&&(r=a-u),i=r;i>=0;i--){let r=!0;for(let n=0;no&&(n=o):n=o;const i=e.length;let s;for(n>i/2&&(n=i/2),s=0;s>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function P(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);const n=[];let o=e;for(;o239?4:e>223?3:e>191?2:1;if(o+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(i=e);break;case 2:r=t[o+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(i=u));break;case 3:r=t[o+1],n=t[o+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:r=t[o+1],n=t[o+2],a=t[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=s}return function(t){const e=t.length;if(e<=F)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,o)):Uint8Array.prototype.set.call(n,e,o);else{if(!u.isBuffer(e))throw new TypeError(\'"list" argument must be an Array of Buffers\');e.copy(n,o)}o+=e.length}return n},u.byteLength=m,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;er&&(t+=" ... "),""},i&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,o){if(G(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const a=Math.min(i,s),f=this.slice(n,o),l=t.slice(e,r);for(let t=0;t>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":case"latin1":case"binary":return b(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const F=4096;function M(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;on)&&(r=n);let o="";for(let n=e;nr)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!u.isBuffer(t))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(e>o||et.length)throw new RangeError("Index out of range")}function H(t,e,r,n,o){j(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function S(t,e,r,n,o){j(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function T(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,n,i){return e=+e,r>>>=0,i||T(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,i){return e=+e,r>>>=0,i||T(t,0,r,8),o.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||R(t,e,this.length);let n=this[t],o=1,i=0;for(;++i>>=0,e>>>=0,r||R(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=J((function(t){W(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(o)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<>>=0,e>>>=0,r||R(t,e,this.length);let n=this[t],o=1,i=0;for(;++i=o&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);let n=e,o=1,i=this[t+--n];for(;n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=J((function(t){W(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<>>=0,e||R(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||O(this,t,e,r,Math.pow(2,8*r)-1,0);let o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n||O(this,t,e,r,Math.pow(2,8*r)-1,0);let o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=J((function(t,e=0){return H(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=J((function(t,e=0){return S(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);O(this,t,e,r,n-1,-n)}let o=0,i=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);O(this,t,e,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=J((function(t,e=0){return H(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=J((function(t,e=0){return S(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function j(t,e,r,n,o,i){if(t>r||t3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new C.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,r){W(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||Y(e,t.length-(r+1))}(n,o,i)}function W(t,e){if("number"!=typeof t)throw new C.ERR_INVALID_ARG_TYPE(e,"number",t)}function Y(t,e,r){if(Math.floor(t)!==t)throw W(t,r),new C.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new C.ERR_BUFFER_OUT_OF_BOUNDS;throw new C.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}N("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),N("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),N("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=z(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=z(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function X(t,e){let r;e=e||1/0;const n=t.length;let o=null;const i=[];for(let s=0;s55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function $(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,r,n){let o;for(o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function G(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function V(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},645:(t,e)=>{e.read=function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,d=r?-1:1,h=t[e+c];for(c+=d,i=h&(1<<-l)-1,h>>=-l,l+=a;l>0;i=256*i+t[e+c],c+=d,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=n;l>0;s=256*s+t[e+c],c+=d,l-=8);if(0===i)i=1-f;else{if(i===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),i-=f}return(h?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,a,u,f=8*i-o-1,l=(1<>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+c>=1?d/u:d*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=l?(a=0,s=l):s+c>=1?(a=(e*u-1)*Math.pow(2,o),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;t[r+h]=255&a,h+=p,a/=256,o-=8);for(s=s<0;t[r+h]=255&s,h+=p,s/=256,f-=8);t[r+h-p]|=128*m}},503:(t,e,r)=>{var n,o=r(764).lW,i=(n=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(t){var e,i,s=void 0!==(t=t||{})?t:{},a=Object.assign;s.ready=new Promise((function(t,r){e=t,i=r}));var u,f,l,c,d,h,p=a({},s),m=[],y="./this.program",g=(t,e)=>{throw e},w="object"==typeof window,E="function"==typeof importScripts,v="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,_="";v?(_=E?r(375).dirname(_)+"/":"//",h=()=>{d||(c=r(384),d=r(375))},u=function(t,e){return h(),t=d.normalize(t),c.readFileSync(t,e?null:"utf8")},l=t=>{var e=u(t,!0);return e.buffer||(e=new Uint8Array(e)),e},f=(t,e,r)=>{h(),t=d.normalize(t),c.readFile(t,(function(t,n){t?r(t):e(n.buffer)}))},process.argv.length>1&&(y=process.argv[1].replace(/\\\\/g,"/")),m=process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof Dt))throw t})),process.on("unhandledRejection",(function(t){throw t})),g=(t,e)=>{if(j())throw process.exitCode=t,e;var r;(r=e)instanceof Dt||k("exiting due to exception: "+r),process.exit(t)},s.inspect=function(){return"[Emscripten Module object]"}):(w||E)&&(E?_=self.location.href:"undefined"!=typeof document&&document.currentScript&&(_=document.currentScript.src),n&&(_=n),_=0!==_.indexOf("blob:")?_.substr(0,_.replace(/[?#].*/,"").lastIndexOf("/")+1):"",u=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},E&&(l=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),f=(t,e,r)=>{var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)});var b,A=s.print||console.log.bind(console),k=s.printErr||console.warn.bind(console);a(s,p),p=null,s.arguments&&(m=s.arguments),s.thisProgram&&(y=s.thisProgram),s.quit&&(g=s.quit),s.wasmBinary&&(b=s.wasmBinary);var P,B=s.noExitRuntime||!0;"object"!=typeof WebAssembly&&J("no native wasm support detected");var F,M,D,I,x=!1,R="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function O(t,e,r){for(var n=e+r,o=e;t[o]&&!(o>=n);)++o;if(o-e>16&&t.subarray&&R)return R.decode(t.subarray(e,o));for(var i="";e>10,56320|1023&f)}}else i+=String.fromCharCode((31&s)<<6|a)}else i+=String.fromCharCode(s)}return i}function H(t,e){return t?O(D,t,e):""}function S(t,e,r,n){if(!(n>0))return 0;for(var o=r,i=r+n-1,s=0;s=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++s)),a<=127){if(r>=i)break;e[r++]=a}else if(a<=2047){if(r+1>=i)break;e[r++]=192|a>>6,e[r++]=128|63&a}else if(a<=65535){if(r+2>=i)break;e[r++]=224|a>>12,e[r++]=128|a>>6&63,e[r++]=128|63&a}else{if(r+3>=i)break;e[r++]=240|a>>18,e[r++]=128|a>>12&63,e[r++]=128|a>>6&63,e[r++]=128|63&a}}return e[r]=0,r-o}function T(t){for(var e=0,r=0;r=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&t.charCodeAt(++r)),n<=127?++e:e+=n<=2047?2:n<=65535?3:4}return e}function L(t){F=t,s.HEAP8=M=new Int8Array(t),s.HEAP16=new Int16Array(t),s.HEAP32=I=new Int32Array(t),s.HEAPU8=D=new Uint8Array(t),s.HEAPU16=new Uint16Array(t),s.HEAPU32=new Uint32Array(t),s.HEAPF32=new Float32Array(t),s.HEAPF64=new Float64Array(t)}s.INITIAL_MEMORY;var U,C=[],N=[],z=[];function j(){return B||!1}var W,Y,K,X,$=0,q=null,G=null;function V(t){$++,s.monitorRunDependencies&&s.monitorRunDependencies($)}function Z(t){if($--,s.monitorRunDependencies&&s.monitorRunDependencies($),0==$&&(null!==q&&(clearInterval(q),q=null),G)){var e=G;G=null,e()}}function J(t){s.onAbort&&s.onAbort(t),k(t="Aborted("+t+")"),x=!0,t+=". Build with -s ASSERTIONS=1 for more info.";var e=new WebAssembly.RuntimeError(t);throw i(e),e}function Q(t){return t.startsWith("data:application/octet-stream;base64,")}function tt(t){return t.startsWith("file://")}function et(t){try{if(t==W&&b)return new Uint8Array(b);if(l)return l(t);throw"both async and sync fetching of the wasm failed"}catch(t){J(t)}}function rt(t){for(;t.length>0;){var e=t.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?it(r)():it(r)(e.arg):r(void 0===e.arg?null:e.arg)}else e(s)}}s.preloadedImages={},s.preloadedAudios={},Q(W="tflite-simd.wasm")||(Y=W,W=s.locateFile?s.locateFile(Y,_):_+Y);var nt,ot=[];function it(t){var e=ot[t];return e||(t>=ot.length&&(ot.length=t+1),ot[t]=e=U.get(t)),e}function st(t){this.excPtr=t,this.ptr=t-16,this.set_type=function(t){I[this.ptr+4>>2]=t},this.get_type=function(){return I[this.ptr+4>>2]},this.set_destructor=function(t){I[this.ptr+8>>2]=t},this.get_destructor=function(){return I[this.ptr+8>>2]},this.set_refcount=function(t){I[this.ptr>>2]=t},this.set_caught=function(t){t=t?1:0,M[this.ptr+12>>0]=t},this.get_caught=function(){return 0!=M[this.ptr+12>>0]},this.set_rethrown=function(t){t=t?1:0,M[this.ptr+13>>0]=t},this.get_rethrown=function(){return 0!=M[this.ptr+13>>0]},this.init=function(t,e){this.set_type(t),this.set_destructor(e),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=I[this.ptr>>2];I[this.ptr>>2]=t+1},this.release_ref=function(){var t=I[this.ptr>>2];return I[this.ptr>>2]=t-1,1===t}}function at(t){try{return P.grow(t-F.byteLength+65535>>>16),L(P.buffer),1}catch(t){}}nt=v?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now();var ut={};function ft(){if(!ft.strings){var t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:y||"./this.program"};for(var e in ut)void 0===ut[e]?delete t[e]:t[e]=ut[e];var r=[];for(var e in t)r.push(e+"="+t[e]);ft.strings=r}return ft.strings}var lt={splitPath:function(t){return/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/.exec(t).slice(1)},normalizeArray:function(t,e){for(var r=0,n=t.length-1;n>=0;n--){var o=t[n];"."===o?t.splice(n,1):".."===o?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t},normalize:function(t){var e="/"===t.charAt(0),r="/"===t.substr(-1);return(t=lt.normalizeArray(t.split("/").filter((function(t){return!!t})),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t},dirname:function(t){var e=lt.splitPath(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},basename:function(t){if("/"===t)return"/";var e=(t=(t=lt.normalize(t)).replace(/\\/$/,"")).lastIndexOf("/");return-1===e?t:t.substr(e+1)},extname:function(t){return lt.splitPath(t)[3]},join:function(){var t=Array.prototype.slice.call(arguments,0);return lt.normalize(t.join("/"))},join2:function(t,e){return lt.normalize(t+"/"+e)}};function ct(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var t=new Uint8Array(1);return function(){return crypto.getRandomValues(t),t[0]}}if(v)try{var e=r(782);return function(){return e.randomBytes(1)[0]}}catch(t){}return function(){J("randomDevice")}}var dt={resolve:function(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:mt.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,e="/"===n.charAt(0)}return(e?"/":"")+(t=lt.normalizeArray(t.split("/").filter((function(t){return!!t})),!e).join("/"))||"."},relative:function(t,e){function r(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=dt.resolve(t).substr(1),e=dt.resolve(e).substr(1);for(var n=r(t.split("/")),o=r(e.split("/")),i=Math.min(n.length,o.length),s=i,a=0;a0?r.slice(0,n).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\\n");if(!e)return null;t.input=At(e,!0)}return t.input.shift()},put_char:function(t,e){null===e||10===e?(A(O(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},flush:function(t){t.output&&t.output.length>0&&(A(O(t.output,0)),t.output=[])}},default_tty1_ops:{put_char:function(t,e){null===e||10===e?(k(O(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},flush:function(t){t.output&&t.output.length>0&&(k(O(t.output,0)),t.output=[])}}};var pt={ops_table:null,mount:function(t){return pt.createNode(null,"/",16895,0)},createNode:function(t,e,r,n){if(mt.isBlkdev(r)||mt.isFIFO(r))throw new mt.ErrnoError(63);pt.ops_table||(pt.ops_table={dir:{node:{getattr:pt.node_ops.getattr,setattr:pt.node_ops.setattr,lookup:pt.node_ops.lookup,mknod:pt.node_ops.mknod,rename:pt.node_ops.rename,unlink:pt.node_ops.unlink,rmdir:pt.node_ops.rmdir,readdir:pt.node_ops.readdir,symlink:pt.node_ops.symlink},stream:{llseek:pt.stream_ops.llseek}},file:{node:{getattr:pt.node_ops.getattr,setattr:pt.node_ops.setattr},stream:{llseek:pt.stream_ops.llseek,read:pt.stream_ops.read,write:pt.stream_ops.write,allocate:pt.stream_ops.allocate,mmap:pt.stream_ops.mmap,msync:pt.stream_ops.msync}},link:{node:{getattr:pt.node_ops.getattr,setattr:pt.node_ops.setattr,readlink:pt.node_ops.readlink},stream:{}},chrdev:{node:{getattr:pt.node_ops.getattr,setattr:pt.node_ops.setattr},stream:mt.chrdev_stream_ops}});var o=mt.createNode(t,e,r,n);return mt.isDir(o.mode)?(o.node_ops=pt.ops_table.dir.node,o.stream_ops=pt.ops_table.dir.stream,o.contents={}):mt.isFile(o.mode)?(o.node_ops=pt.ops_table.file.node,o.stream_ops=pt.ops_table.file.stream,o.usedBytes=0,o.contents=null):mt.isLink(o.mode)?(o.node_ops=pt.ops_table.link.node,o.stream_ops=pt.ops_table.link.stream):mt.isChrdev(o.mode)&&(o.node_ops=pt.ops_table.chrdev.node,o.stream_ops=pt.ops_table.chrdev.stream),o.timestamp=Date.now(),t&&(t.contents[e]=o,t.timestamp=o.timestamp),o},getFileDataAsTypedArray:function(t){return t.contents?t.contents.subarray?t.contents.subarray(0,t.usedBytes):new Uint8Array(t.contents):new Uint8Array(0)},expandFileStorage:function(t,e){var r=t.contents?t.contents.length:0;if(!(r>=e)){e=Math.max(e,r*(r<1048576?2:1.125)>>>0),0!=r&&(e=Math.max(e,256));var n=t.contents;t.contents=new Uint8Array(e),t.usedBytes>0&&t.contents.set(n.subarray(0,t.usedBytes),0)}},resizeFileStorage:function(t,e){if(t.usedBytes!=e)if(0==e)t.contents=null,t.usedBytes=0;else{var r=t.contents;t.contents=new Uint8Array(e),r&&t.contents.set(r.subarray(0,Math.min(e,t.usedBytes))),t.usedBytes=e}},node_ops:{getattr:function(t){var e={};return e.dev=mt.isChrdev(t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,mt.isDir(t.mode)?e.size=4096:mt.isFile(t.mode)?e.size=t.usedBytes:mt.isLink(t.mode)?e.size=t.link.length:e.size=0,e.atime=new Date(t.timestamp),e.mtime=new Date(t.timestamp),e.ctime=new Date(t.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr:function(t,e){void 0!==e.mode&&(t.mode=e.mode),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.size&&pt.resizeFileStorage(t,e.size)},lookup:function(t,e){throw mt.genericErrors[44]},mknod:function(t,e,r,n){return pt.createNode(t,e,r,n)},rename:function(t,e,r){if(mt.isDir(t.mode)){var n;try{n=mt.lookupNode(e,r)}catch(t){}if(n)for(var o in n.contents)throw new mt.ErrnoError(55)}delete t.parent.contents[t.name],t.parent.timestamp=Date.now(),t.name=r,e.contents[r]=t,e.timestamp=t.parent.timestamp,t.parent=e},unlink:function(t,e){delete t.contents[e],t.timestamp=Date.now()},rmdir:function(t,e){var r=mt.lookupNode(t,e);for(var n in r.contents)throw new mt.ErrnoError(55);delete t.contents[e],t.timestamp=Date.now()},readdir:function(t){var e=[".",".."];for(var r in t.contents)t.contents.hasOwnProperty(r)&&e.push(r);return e},symlink:function(t,e,r){var n=pt.createNode(t,e,41471,0);return n.link=r,n},readlink:function(t){if(!mt.isLink(t.mode))throw new mt.ErrnoError(28);return t.link}},stream_ops:{read:function(t,e,r,n,o){var i=t.node.contents;if(o>=t.node.usedBytes)return 0;var s=Math.min(t.node.usedBytes-o,n);if(s>8&&i.subarray)e.set(i.subarray(o,o+s),r);else for(var a=0;a0||n+r{if(!(t=dt.resolve(mt.cwd(),t)))return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};for(var n in r)void 0===e[n]&&(e[n]=r[n]);if(e.recurse_count>8)throw new mt.ErrnoError(32);for(var o=lt.normalizeArray(t.split("/").filter((t=>!!t)),!1),i=mt.root,s="/",a=0;a40)throw new mt.ErrnoError(32)}}return{path:s,node:i}},getPath:t=>{for(var e;;){if(mt.isRoot(t)){var r=t.mount.mountpoint;return e?"/"!==r[r.length-1]?r+"/"+e:r+e:r}e=e?t.name+"/"+e:t.name,t=t.parent}},hashName:(t,e)=>{for(var r=0,n=0;n>>0)%mt.nameTable.length},hashAddNode:t=>{var e=mt.hashName(t.parent.id,t.name);t.name_next=mt.nameTable[e],mt.nameTable[e]=t},hashRemoveNode:t=>{var e=mt.hashName(t.parent.id,t.name);if(mt.nameTable[e]===t)mt.nameTable[e]=t.name_next;else for(var r=mt.nameTable[e];r;){if(r.name_next===t){r.name_next=t.name_next;break}r=r.name_next}},lookupNode:(t,e)=>{var r=mt.mayLookup(t);if(r)throw new mt.ErrnoError(r,t);for(var n=mt.hashName(t.id,e),o=mt.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===t.id&&i===e)return o}return mt.lookup(t,e)},createNode:(t,e,r,n)=>{var o=new mt.FSNode(t,e,r,n);return mt.hashAddNode(o),o},destroyNode:t=>{mt.hashRemoveNode(t)},isRoot:t=>t===t.parent,isMountpoint:t=>!!t.mounted,isFile:t=>32768==(61440&t),isDir:t=>16384==(61440&t),isLink:t=>40960==(61440&t),isChrdev:t=>8192==(61440&t),isBlkdev:t=>24576==(61440&t),isFIFO:t=>4096==(61440&t),isSocket:t=>49152==(49152&t),flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:t=>{var e=mt.flagModes[t];if(void 0===e)throw new Error("Unknown file open mode: "+t);return e},flagsToPermissionString:t=>{var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e},nodePermissions:(t,e)=>mt.ignorePermissions||(!e.includes("r")||292&t.mode)&&(!e.includes("w")||146&t.mode)&&(!e.includes("x")||73&t.mode)?0:2,mayLookup:t=>mt.nodePermissions(t,"x")||(t.node_ops.lookup?0:2),mayCreate:(t,e)=>{try{return mt.lookupNode(t,e),20}catch(t){}return mt.nodePermissions(t,"wx")},mayDelete:(t,e,r)=>{var n;try{n=mt.lookupNode(t,e)}catch(t){return t.errno}var o=mt.nodePermissions(t,"wx");if(o)return o;if(r){if(!mt.isDir(n.mode))return 54;if(mt.isRoot(n)||mt.getPath(n)===mt.cwd())return 10}else if(mt.isDir(n.mode))return 31;return 0},mayOpen:(t,e)=>t?mt.isLink(t.mode)?32:mt.isDir(t.mode)&&("r"!==mt.flagsToPermissionString(e)||512&e)?31:mt.nodePermissions(t,mt.flagsToPermissionString(e)):44,MAX_OPEN_FDS:4096,nextfd:(t=0,e=mt.MAX_OPEN_FDS)=>{for(var r=t;r<=e;r++)if(!mt.streams[r])return r;throw new mt.ErrnoError(33)},getStream:t=>mt.streams[t],createStream:(t,e,r)=>{mt.FSStream||(mt.FSStream=function(){},mt.FSStream.prototype={object:{get:function(){return this.node},set:function(t){this.node=t}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}});var n=new mt.FSStream;for(var o in t)n[o]=t[o];t=n;var i=mt.nextfd(e,r);return t.fd=i,mt.streams[i]=t,t},closeStream:t=>{mt.streams[t]=null},chrdev_stream_ops:{open:t=>{var e=mt.getDevice(t.node.rdev);t.stream_ops=e.stream_ops,t.stream_ops.open&&t.stream_ops.open(t)},llseek:()=>{throw new mt.ErrnoError(70)}},major:t=>t>>8,minor:t=>255&t,makedev:(t,e)=>t<<8|e,registerDevice:(t,e)=>{mt.devices[t]={stream_ops:e}},getDevice:t=>mt.devices[t],getMounts:t=>{for(var e=[],r=[t];r.length;){var n=r.pop();e.push(n),r.push.apply(r,n.mounts)}return e},syncfs:(t,e)=>{"function"==typeof t&&(e=t,t=!1),mt.syncFSRequests++,mt.syncFSRequests>1&&k("warning: "+mt.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=mt.getMounts(mt.root.mount),n=0;function o(t){return mt.syncFSRequests--,e(t)}function i(t){if(t)return i.errored?void 0:(i.errored=!0,o(t));++n>=r.length&&o(null)}r.forEach((e=>{if(!e.type.syncfs)return i(null);e.type.syncfs(e,t,i)}))},mount:(t,e,r)=>{var n,o="/"===r,i=!r;if(o&&mt.root)throw new mt.ErrnoError(10);if(!o&&!i){var s=mt.lookupPath(r,{follow_mount:!1});if(r=s.path,n=s.node,mt.isMountpoint(n))throw new mt.ErrnoError(10);if(!mt.isDir(n.mode))throw new mt.ErrnoError(54)}var a={type:t,opts:e,mountpoint:r,mounts:[]},u=t.mount(a);return u.mount=a,a.root=u,o?mt.root=u:n&&(n.mounted=a,n.mount&&n.mount.mounts.push(a)),u},unmount:t=>{var e=mt.lookupPath(t,{follow_mount:!1});if(!mt.isMountpoint(e.node))throw new mt.ErrnoError(28);var r=e.node,n=r.mounted,o=mt.getMounts(n);Object.keys(mt.nameTable).forEach((t=>{for(var e=mt.nameTable[t];e;){var r=e.name_next;o.includes(e.mount)&&mt.destroyNode(e),e=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(n);r.mount.mounts.splice(i,1)},lookup:(t,e)=>t.node_ops.lookup(t,e),mknod:(t,e,r)=>{var n=mt.lookupPath(t,{parent:!0}).node,o=lt.basename(t);if(!o||"."===o||".."===o)throw new mt.ErrnoError(28);var i=mt.mayCreate(n,o);if(i)throw new mt.ErrnoError(i);if(!n.node_ops.mknod)throw new mt.ErrnoError(63);return n.node_ops.mknod(n,o,e,r)},create:(t,e)=>(e=void 0!==e?e:438,e&=4095,e|=32768,mt.mknod(t,e,0)),mkdir:(t,e)=>(e=void 0!==e?e:511,e&=1023,e|=16384,mt.mknod(t,e,0)),mkdirTree:(t,e)=>{for(var r=t.split("/"),n="",o=0;o(void 0===r&&(r=e,e=438),e|=8192,mt.mknod(t,e,r)),symlink:(t,e)=>{if(!dt.resolve(t))throw new mt.ErrnoError(44);var r=mt.lookupPath(e,{parent:!0}).node;if(!r)throw new mt.ErrnoError(44);var n=lt.basename(e),o=mt.mayCreate(r,n);if(o)throw new mt.ErrnoError(o);if(!r.node_ops.symlink)throw new mt.ErrnoError(63);return r.node_ops.symlink(r,n,t)},rename:(t,e)=>{var r,n,o=lt.dirname(t),i=lt.dirname(e),s=lt.basename(t),a=lt.basename(e);if(r=mt.lookupPath(t,{parent:!0}).node,n=mt.lookupPath(e,{parent:!0}).node,!r||!n)throw new mt.ErrnoError(44);if(r.mount!==n.mount)throw new mt.ErrnoError(75);var u,f=mt.lookupNode(r,s),l=dt.relative(t,i);if("."!==l.charAt(0))throw new mt.ErrnoError(28);if("."!==(l=dt.relative(e,o)).charAt(0))throw new mt.ErrnoError(55);try{u=mt.lookupNode(n,a)}catch(t){}if(f!==u){var c=mt.isDir(f.mode),d=mt.mayDelete(r,s,c);if(d)throw new mt.ErrnoError(d);if(d=u?mt.mayDelete(n,a,c):mt.mayCreate(n,a))throw new mt.ErrnoError(d);if(!r.node_ops.rename)throw new mt.ErrnoError(63);if(mt.isMountpoint(f)||u&&mt.isMountpoint(u))throw new mt.ErrnoError(10);if(n!==r&&(d=mt.nodePermissions(r,"w")))throw new mt.ErrnoError(d);mt.hashRemoveNode(f);try{r.node_ops.rename(f,n,a)}catch(t){throw t}finally{mt.hashAddNode(f)}}},rmdir:t=>{var e=mt.lookupPath(t,{parent:!0}).node,r=lt.basename(t),n=mt.lookupNode(e,r),o=mt.mayDelete(e,r,!0);if(o)throw new mt.ErrnoError(o);if(!e.node_ops.rmdir)throw new mt.ErrnoError(63);if(mt.isMountpoint(n))throw new mt.ErrnoError(10);e.node_ops.rmdir(e,r),mt.destroyNode(n)},readdir:t=>{var e=mt.lookupPath(t,{follow:!0}).node;if(!e.node_ops.readdir)throw new mt.ErrnoError(54);return e.node_ops.readdir(e)},unlink:t=>{var e=mt.lookupPath(t,{parent:!0}).node;if(!e)throw new mt.ErrnoError(44);var r=lt.basename(t),n=mt.lookupNode(e,r),o=mt.mayDelete(e,r,!1);if(o)throw new mt.ErrnoError(o);if(!e.node_ops.unlink)throw new mt.ErrnoError(63);if(mt.isMountpoint(n))throw new mt.ErrnoError(10);e.node_ops.unlink(e,r),mt.destroyNode(n)},readlink:t=>{var e=mt.lookupPath(t).node;if(!e)throw new mt.ErrnoError(44);if(!e.node_ops.readlink)throw new mt.ErrnoError(28);return dt.resolve(mt.getPath(e.parent),e.node_ops.readlink(e))},stat:(t,e)=>{var r=mt.lookupPath(t,{follow:!e}).node;if(!r)throw new mt.ErrnoError(44);if(!r.node_ops.getattr)throw new mt.ErrnoError(63);return r.node_ops.getattr(r)},lstat:t=>mt.stat(t,!0),chmod:(t,e,r)=>{var n;if(!(n="string"==typeof t?mt.lookupPath(t,{follow:!r}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&e|-4096&n.mode,timestamp:Date.now()})},lchmod:(t,e)=>{mt.chmod(t,e,!0)},fchmod:(t,e)=>{var r=mt.getStream(t);if(!r)throw new mt.ErrnoError(8);mt.chmod(r.node,e)},chown:(t,e,r,n)=>{var o;if(!(o="string"==typeof t?mt.lookupPath(t,{follow:!n}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown:(t,e,r)=>{mt.chown(t,e,r,!0)},fchown:(t,e,r)=>{var n=mt.getStream(t);if(!n)throw new mt.ErrnoError(8);mt.chown(n.node,e,r)},truncate:(t,e)=>{if(e<0)throw new mt.ErrnoError(28);var r;if(!(r="string"==typeof t?mt.lookupPath(t,{follow:!0}).node:t).node_ops.setattr)throw new mt.ErrnoError(63);if(mt.isDir(r.mode))throw new mt.ErrnoError(31);if(!mt.isFile(r.mode))throw new mt.ErrnoError(28);var n=mt.nodePermissions(r,"w");if(n)throw new mt.ErrnoError(n);r.node_ops.setattr(r,{size:e,timestamp:Date.now()})},ftruncate:(t,e)=>{var r=mt.getStream(t);if(!r)throw new mt.ErrnoError(8);if(0==(2097155&r.flags))throw new mt.ErrnoError(28);mt.truncate(r.node,e)},utime:(t,e,r)=>{var n=mt.lookupPath(t,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(e,r)})},open:(t,e,r,n,o)=>{if(""===t)throw new mt.ErrnoError(44);var i;if(r=void 0===r?438:r,r=64&(e="string"==typeof e?mt.modeStringToFlags(e):e)?4095&r|32768:0,"object"==typeof t)i=t;else{t=lt.normalize(t);try{i=mt.lookupPath(t,{follow:!(131072&e)}).node}catch(t){}}var a=!1;if(64&e)if(i){if(128&e)throw new mt.ErrnoError(20)}else i=mt.mknod(t,r,0),a=!0;if(!i)throw new mt.ErrnoError(44);if(mt.isChrdev(i.mode)&&(e&=-513),65536&e&&!mt.isDir(i.mode))throw new mt.ErrnoError(54);if(!a){var u=mt.mayOpen(i,e);if(u)throw new mt.ErrnoError(u)}512&e&&mt.truncate(i,0),e&=-131713;var f=mt.createStream({node:i,path:mt.getPath(i),flags:e,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1},n,o);return f.stream_ops.open&&f.stream_ops.open(f),!s.logReadFiles||1&e||(mt.readFiles||(mt.readFiles={}),t in mt.readFiles||(mt.readFiles[t]=1)),f},close:t=>{if(mt.isClosed(t))throw new mt.ErrnoError(8);t.getdents&&(t.getdents=null);try{t.stream_ops.close&&t.stream_ops.close(t)}catch(t){throw t}finally{mt.closeStream(t.fd)}t.fd=null},isClosed:t=>null===t.fd,llseek:(t,e,r)=>{if(mt.isClosed(t))throw new mt.ErrnoError(8);if(!t.seekable||!t.stream_ops.llseek)throw new mt.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new mt.ErrnoError(28);return t.position=t.stream_ops.llseek(t,e,r),t.ungotten=[],t.position},read:(t,e,r,n,o)=>{if(n<0||o<0)throw new mt.ErrnoError(28);if(mt.isClosed(t))throw new mt.ErrnoError(8);if(1==(2097155&t.flags))throw new mt.ErrnoError(8);if(mt.isDir(t.node.mode))throw new mt.ErrnoError(31);if(!t.stream_ops.read)throw new mt.ErrnoError(28);var i=void 0!==o;if(i){if(!t.seekable)throw new mt.ErrnoError(70)}else o=t.position;var s=t.stream_ops.read(t,e,r,n,o);return i||(t.position+=s),s},write:(t,e,r,n,o,i)=>{if(n<0||o<0)throw new mt.ErrnoError(28);if(mt.isClosed(t))throw new mt.ErrnoError(8);if(0==(2097155&t.flags))throw new mt.ErrnoError(8);if(mt.isDir(t.node.mode))throw new mt.ErrnoError(31);if(!t.stream_ops.write)throw new mt.ErrnoError(28);t.seekable&&1024&t.flags&&mt.llseek(t,0,2);var s=void 0!==o;if(s){if(!t.seekable)throw new mt.ErrnoError(70)}else o=t.position;var a=t.stream_ops.write(t,e,r,n,o,i);return s||(t.position+=a),a},allocate:(t,e,r)=>{if(mt.isClosed(t))throw new mt.ErrnoError(8);if(e<0||r<=0)throw new mt.ErrnoError(28);if(0==(2097155&t.flags))throw new mt.ErrnoError(8);if(!mt.isFile(t.node.mode)&&!mt.isDir(t.node.mode))throw new mt.ErrnoError(43);if(!t.stream_ops.allocate)throw new mt.ErrnoError(138);t.stream_ops.allocate(t,e,r)},mmap:(t,e,r,n,o,i)=>{if(0!=(2&o)&&0==(2&i)&&2!=(2097155&t.flags))throw new mt.ErrnoError(2);if(1==(2097155&t.flags))throw new mt.ErrnoError(2);if(!t.stream_ops.mmap)throw new mt.ErrnoError(43);return t.stream_ops.mmap(t,e,r,n,o,i)},msync:(t,e,r,n,o)=>t&&t.stream_ops.msync?t.stream_ops.msync(t,e,r,n,o):0,munmap:t=>0,ioctl:(t,e,r)=>{if(!t.stream_ops.ioctl)throw new mt.ErrnoError(59);return t.stream_ops.ioctl(t,e,r)},readFile:(t,e={})=>{if(e.flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding)throw new Error(\'Invalid encoding type "\'+e.encoding+\'"\');var r,n=mt.open(t,e.flags),o=mt.stat(t).size,i=new Uint8Array(o);return mt.read(n,i,0,o,0),"utf8"===e.encoding?r=O(i,0):"binary"===e.encoding&&(r=i),mt.close(n),r},writeFile:(t,e,r={})=>{r.flags=r.flags||577;var n=mt.open(t,r.flags,r.mode);if("string"==typeof e){var o=new Uint8Array(T(e)+1),i=S(e,o,0,o.length);mt.write(n,o,0,i,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(e))throw new Error("Unsupported data type");mt.write(n,e,0,e.byteLength,void 0,r.canOwn)}mt.close(n)},cwd:()=>mt.currentPath,chdir:t=>{var e=mt.lookupPath(t,{follow:!0});if(null===e.node)throw new mt.ErrnoError(44);if(!mt.isDir(e.node.mode))throw new mt.ErrnoError(54);var r=mt.nodePermissions(e.node,"x");if(r)throw new mt.ErrnoError(r);mt.currentPath=e.path},createDefaultDirectories:()=>{mt.mkdir("/tmp"),mt.mkdir("/home"),mt.mkdir("/home/web_user")},createDefaultDevices:()=>{mt.mkdir("/dev"),mt.registerDevice(mt.makedev(1,3),{read:()=>0,write:(t,e,r,n,o)=>n}),mt.mkdev("/dev/null",mt.makedev(1,3)),ht.register(mt.makedev(5,0),ht.default_tty_ops),ht.register(mt.makedev(6,0),ht.default_tty1_ops),mt.mkdev("/dev/tty",mt.makedev(5,0)),mt.mkdev("/dev/tty1",mt.makedev(6,0));var t=ct();mt.createDevice("/dev","random",t),mt.createDevice("/dev","urandom",t),mt.mkdir("/dev/shm"),mt.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{mt.mkdir("/proc");var t=mt.mkdir("/proc/self");mt.mkdir("/proc/self/fd"),mt.mount({mount:()=>{var e=mt.createNode(t,"fd",16895,73);return e.node_ops={lookup:(t,e)=>{var r=+e,n=mt.getStream(r);if(!n)throw new mt.ErrnoError(8);var o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},e}},{},"/proc/self/fd")},createStandardStreams:()=>{s.stdin?mt.createDevice("/dev","stdin",s.stdin):mt.symlink("/dev/tty","/dev/stdin"),s.stdout?mt.createDevice("/dev","stdout",null,s.stdout):mt.symlink("/dev/tty","/dev/stdout"),s.stderr?mt.createDevice("/dev","stderr",null,s.stderr):mt.symlink("/dev/tty1","/dev/stderr"),mt.open("/dev/stdin",0),mt.open("/dev/stdout",1),mt.open("/dev/stderr",1)},ensureErrnoError:()=>{mt.ErrnoError||(mt.ErrnoError=function(t,e){this.node=e,this.setErrno=function(t){this.errno=t},this.setErrno(t),this.message="FS error"},mt.ErrnoError.prototype=new Error,mt.ErrnoError.prototype.constructor=mt.ErrnoError,[44].forEach((t=>{mt.genericErrors[t]=new mt.ErrnoError(t),mt.genericErrors[t].stack=""})))},staticInit:()=>{mt.ensureErrnoError(),mt.nameTable=new Array(4096),mt.mount(pt,{},"/"),mt.createDefaultDirectories(),mt.createDefaultDevices(),mt.createSpecialDirectories(),mt.filesystems={MEMFS:pt}},init:(t,e,r)=>{mt.init.initialized=!0,mt.ensureErrnoError(),s.stdin=t||s.stdin,s.stdout=e||s.stdout,s.stderr=r||s.stderr,mt.createStandardStreams()},quit:()=>{mt.init.initialized=!1;for(var t=0;t{var r=0;return t&&(r|=365),e&&(r|=146),r},findObject:(t,e)=>{var r=mt.analyzePath(t,e);return r.exists?r.object:null},analyzePath:(t,e)=>{try{t=(n=mt.lookupPath(t,{follow:!e})).path}catch(t){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=mt.lookupPath(t,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=lt.basename(t),n=mt.lookupPath(t,{follow:!e}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(t){r.error=t.errno}return r},createPath:(t,e,r,n)=>{t="string"==typeof t?t:mt.getPath(t);for(var o=e.split("/").reverse();o.length;){var i=o.pop();if(i){var s=lt.join2(t,i);try{mt.mkdir(s)}catch(t){}t=s}}return s},createFile:(t,e,r,n,o)=>{var i=lt.join2("string"==typeof t?t:mt.getPath(t),e),s=mt.getMode(n,o);return mt.create(i,s)},createDataFile:(t,e,r,n,o,i)=>{var s=e;t&&(t="string"==typeof t?t:mt.getPath(t),s=e?lt.join2(t,e):t);var a=mt.getMode(n,o),u=mt.create(s,a);if(r){if("string"==typeof r){for(var f=new Array(r.length),l=0,c=r.length;l{var o=lt.join2("string"==typeof t?t:mt.getPath(t),e),i=mt.getMode(!!r,!!n);mt.createDevice.major||(mt.createDevice.major=64);var s=mt.makedev(mt.createDevice.major++,0);return mt.registerDevice(s,{open:t=>{t.seekable=!1},close:t=>{n&&n.buffer&&n.buffer.length&&n(10)},read:(t,e,n,o,i)=>{for(var s=0,a=0;a{for(var s=0;s{if(t.isDevice||t.isFolder||t.link||t.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!u)throw new Error("Cannot load without read() or XMLHttpRequest.");try{t.contents=At(u(t.url),!0),t.usedBytes=t.contents.length}catch(t){throw new mt.ErrnoError(29)}},createLazyFile:(t,e,r,n,o)=>{function i(){this.lengthKnown=!1,this.chunks=[]}if(i.prototype.get=function(t){if(!(t>this.length-1||t<0)){var e=t%this.chunkSize,r=t/this.chunkSize|0;return this.getter(r)[e]}},i.prototype.setDataGetter=function(t){this.getter=t},i.prototype.cacheLength=function(){var t=new XMLHttpRequest;if(t.open("HEAD",r,!1),t.send(null),!(t.status>=200&&t.status<300||304===t.status))throw new Error("Couldn\'t load "+r+". Status: "+t.status);var e,n=Number(t.getResponseHeader("Content-length")),o=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e,i=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e,s=1048576;o||(s=n);var a=this;a.setDataGetter((t=>{var e=t*s,o=(t+1)*s-1;if(o=Math.min(o,n-1),void 0===a.chunks[t]&&(a.chunks[t]=((t,e)=>{if(t>e)throw new Error("invalid range ("+t+", "+e+") or no bytes requested!");if(e>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",r,!1),n!==s&&o.setRequestHeader("Range","bytes="+t+"-"+e),"undefined"!=typeof Uint8Array&&(o.responseType="arraybuffer"),o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn\'t load "+r+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):At(o.responseText||"",!0)})(e,o)),void 0===a.chunks[t])throw new Error("doXHR failed!");return a.chunks[t]})),!i&&n||(s=n=1,n=this.getter(0).length,s=n,A("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=s,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!E)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new i;Object.defineProperties(s,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var a={isDevice:!1,contents:s}}else a={isDevice:!1,url:r};var u=mt.createFile(t,e,a,n,o);a.contents?u.contents=a.contents:a.url&&(u.contents=null,u.url=a.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var f={};return Object.keys(u.stream_ops).forEach((t=>{var e=u.stream_ops[t];f[t]=function(){return mt.forceLoadFile(u),e.apply(null,arguments)}})),f.read=(t,e,r,n,o)=>{mt.forceLoadFile(u);var i=t.node.contents;if(o>=i.length)return 0;var s=Math.min(i.length-o,n);if(i.slice)for(var a=0;a{var c=e?dt.resolve(lt.join2(t,e)):t;function d(r){function f(r){l&&l(),a||mt.createDataFile(t,e,r,n,o,u),i&&i(),Z()}Browser.handledByPreloadPlugin(r,c,f,(()=>{s&&s(),Z()}))||f(r)}V(),"string"==typeof r?function(t,e,r,n){var o=n?"":"al "+t;f(t,(function(r){r||J(\'Loading data file "\'+t+\'" failed (no arrayBuffer).\'),e(new Uint8Array(r)),o&&Z()}),(function(e){if(!r)throw\'Loading data file "\'+t+\'" failed.\';r()})),o&&V()}(r,(t=>d(t)),s):d(r)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(t,e,r)=>{e=e||(()=>{}),r=r||(()=>{});var n=mt.indexedDB();try{var o=n.open(mt.DB_NAME(),mt.DB_VERSION)}catch(t){return r(t)}o.onupgradeneeded=()=>{A("creating db"),o.result.createObjectStore(mt.DB_STORE_NAME)},o.onsuccess=()=>{var n=o.result.transaction([mt.DB_STORE_NAME],"readwrite"),i=n.objectStore(mt.DB_STORE_NAME),s=0,a=0,u=t.length;function f(){0==a?e():r()}t.forEach((t=>{var e=i.put(mt.analyzePath(t).object.contents,t);e.onsuccess=()=>{++s+a==u&&f()},e.onerror=()=>{a++,s+a==u&&f()}})),n.onerror=r},o.onerror=r},loadFilesFromDB:(t,e,r)=>{e=e||(()=>{}),r=r||(()=>{});var n=mt.indexedDB();try{var o=n.open(mt.DB_NAME(),mt.DB_VERSION)}catch(t){return r(t)}o.onupgradeneeded=r,o.onsuccess=()=>{var n=o.result;try{var i=n.transaction([mt.DB_STORE_NAME],"readonly")}catch(t){return void r(t)}var s=i.objectStore(mt.DB_STORE_NAME),a=0,u=0,f=t.length;function l(){0==u?e():r()}t.forEach((t=>{var e=s.get(t);e.onsuccess=()=>{mt.analyzePath(t).exists&&mt.unlink(t),mt.createDataFile(lt.dirname(t),lt.basename(t),e.result,!0,!0,!0),++a+u==f&&l()},e.onerror=()=>{u++,a+u==f&&l()}})),i.onerror=r},o.onerror=r}},yt={mappings:{},DEFAULT_POLLMASK:5,calculateAt:function(t,e,r){if("/"===e[0])return e;var n;if(-100===t)n=mt.cwd();else{var o=mt.getStream(t);if(!o)throw new mt.ErrnoError(8);n=o.path}if(0==e.length){if(!r)throw new mt.ErrnoError(44);return n}return lt.join2(n,e)},doStat:function(t,e,r){try{var n=t(e)}catch(t){if(t&&t.node&<.normalize(e)!==lt.normalize(mt.getPath(t.node)))return-54;throw t}return I[r>>2]=n.dev,I[r+4>>2]=0,I[r+8>>2]=n.ino,I[r+12>>2]=n.mode,I[r+16>>2]=n.nlink,I[r+20>>2]=n.uid,I[r+24>>2]=n.gid,I[r+28>>2]=n.rdev,I[r+32>>2]=0,X=[n.size>>>0,(K=n.size,+Math.abs(K)>=1?K>0?(0|Math.min(+Math.floor(K/4294967296),4294967295))>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)],I[r+40>>2]=X[0],I[r+44>>2]=X[1],I[r+48>>2]=4096,I[r+52>>2]=n.blocks,I[r+56>>2]=n.atime.getTime()/1e3|0,I[r+60>>2]=0,I[r+64>>2]=n.mtime.getTime()/1e3|0,I[r+68>>2]=0,I[r+72>>2]=n.ctime.getTime()/1e3|0,I[r+76>>2]=0,X=[n.ino>>>0,(K=n.ino,+Math.abs(K)>=1?K>0?(0|Math.min(+Math.floor(K/4294967296),4294967295))>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)],I[r+80>>2]=X[0],I[r+84>>2]=X[1],0},doMsync:function(t,e,r,n,o){var i=D.slice(t,t+r);mt.msync(e,i,o,r,n)},doMkdir:function(t,e){return"/"===(t=lt.normalize(t))[t.length-1]&&(t=t.substr(0,t.length-1)),mt.mkdir(t,e,0),0},doMknod:function(t,e,r){switch(61440&e){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return mt.mknod(t,e,r),0},doReadlink:function(t,e,r){if(r<=0)return-28;var n=mt.readlink(t),o=Math.min(r,T(n)),i=M[e+o];return S(n,D,e,r+1),M[e+o]=i,o},doAccess:function(t,e){if(-8&e)return-28;var r=mt.lookupPath(t,{follow:!0}).node;if(!r)return-44;var n="";return 4&e&&(n+="r"),2&e&&(n+="w"),1&e&&(n+="x"),n&&mt.nodePermissions(r,n)?-2:0},doDup:function(t,e,r){var n=mt.getStream(r);return n&&mt.close(n),mt.open(t,e,0,r,r).fd},doReadv:function(t,e,r,n){for(var o=0,i=0;i>2],a=I[e+(8*i+4)>>2],u=mt.read(t,M,s,a,n);if(u<0)return-1;if(o+=u,u>2],a=I[e+(8*i+4)>>2],u=mt.write(t,M,s,a,n);if(u<0)return-1;o+=u}return o},varargs:void 0,get:function(){return yt.varargs+=4,I[yt.varargs-4>>2]},getStr:function(t){return H(t)},getStreamFromFD:function(t){var e=mt.getStream(t);if(!e)throw new mt.ErrnoError(8);return e},get64:function(t,e){return t}};function gt(t){return t%4==0&&(t%100!=0||t%400==0)}function wt(t,e){for(var r=0,n=0;n<=e;r+=t[n++]);return r}var Et=[31,29,31,30,31,30,31,31,30,31,30,31],vt=[31,28,31,30,31,30,31,31,30,31,30,31];function _t(t,e){for(var r=new Date(t.getTime());e>0;){var n=gt(r.getFullYear()),o=r.getMonth(),i=(n?Et:vt)[o];if(!(e>i-r.getDate()))return r.setDate(r.getDate()+e),r;e-=i-r.getDate()+1,r.setDate(1),o<11?r.setMonth(o+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r}var bt=function(t,e,r,n){t||(t=this),this.parent=t,this.mount=t.mount,this.mounted=null,this.id=mt.nextInode++,this.name=e,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n};function At(t,e,r){var n=r>0?r:T(t)+1,o=new Array(n),i=S(t,o,0,o.length);return e&&(o.length=i),o}Object.defineProperties(bt.prototype,{read:{get:function(){return 365==(365&this.mode)},set:function(t){t?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146==(146&this.mode)},set:function(t){t?this.mode|=146:this.mode&=-147}},isFolder:{get:function(){return mt.isDir(this.mode)}},isDevice:{get:function(){return mt.isChrdev(this.mode)}}}),mt.FSNode=bt,mt.staticInit();var kt,Pt={d:function(t){return Bt(t+16)+16},c:function(t,e,r){throw new st(t).init(e,r),t},f:function(t,e){J("To use dlopen, you need to use Emscripten\'s linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},i:function(t,e){J("To use dlopen, you need to use Emscripten\'s linking support, see https://github.com/emscripten-core/emscripten/wiki/Linking")},a:function(){J("")},b:function(t,e){var r;if(0===t)r=Date.now();else{if(1!==t&&4!==t)return 28,I[Ft()>>2]=28,-1;r=nt()}return I[e>>2]=r/1e3|0,I[e+4>>2]=r%1e3*1e3*1e3|0,0},o:function(){return 2147483648},g:nt,h:function(t,e,r){D.copyWithin(t,e,e+r)},n:function(t){var e,r=D.length,n=2147483648;if((t>>>=0)>n)return!1;for(var o=1;o<=4;o*=2){var i=r*(1+.2/o);if(i=Math.min(i,t+100663296),at(Math.min(n,((e=Math.max(t,i))%65536>0&&(e+=65536-e%65536),e))))return!0}return!1},p:function(t,e){var r=0;return ft().forEach((function(n,o){var i=e+r;I[t+4*o>>2]=i,function(t,e,r){for(var n=0;n>0]=t.charCodeAt(n);M[e>>0]=0}(n,i),r+=n.length+1})),0},q:function(t,e){var r=ft();I[t>>2]=r.length;var n=0;return r.forEach((function(t){n+=t.length+1})),I[e>>2]=n,0},s:function(t){!function(t,e){var r;j(),r=t,j()||(s.onExit&&s.onExit(r),x=!0),g(r,new Dt(r))}(t)},j:function(t){try{var e=yt.getStreamFromFD(t);return mt.close(e),0}catch(t){if(void 0===mt||!(t instanceof mt.ErrnoError))throw t;return t.errno}},r:function(t,e,r,n){try{var o=yt.getStreamFromFD(t),i=yt.doReadv(o,e,r);return I[n>>2]=i,0}catch(t){if(void 0===mt||!(t instanceof mt.ErrnoError))throw t;return t.errno}},k:function(t,e,r,n,o){try{var i=yt.getStreamFromFD(t),s=4294967296*r+(e>>>0),a=9007199254740992;return s<=-a||s>=a?-61:(mt.llseek(i,s,n),X=[i.position>>>0,(K=i.position,+Math.abs(K)>=1?K>0?(0|Math.min(+Math.floor(K/4294967296),4294967295))>>>0:~~+Math.ceil((K-+(~~K>>>0))/4294967296)>>>0:0)],I[o>>2]=X[0],I[o+4>>2]=X[1],i.getdents&&0===s&&0===n&&(i.getdents=null),0)}catch(t){if(void 0===mt||!(t instanceof mt.ErrnoError))throw t;return t.errno}},e:function(t,e,r,n){try{var o=yt.getStreamFromFD(t),i=yt.doWritev(o,e,r);return I[n>>2]=i,0}catch(t){if(void 0===mt||!(t instanceof mt.ErrnoError))throw t;return t.errno}},l:function t(e,r){t.randomDevice||(t.randomDevice=ct());for(var n=0;n>0]=t.randomDevice();return 0},m:function(t,e,r,n){return function(t,e,r,n){var o=I[n+40>>2],i={tm_sec:I[n>>2],tm_min:I[n+4>>2],tm_hour:I[n+8>>2],tm_mday:I[n+12>>2],tm_mon:I[n+16>>2],tm_year:I[n+20>>2],tm_wday:I[n+24>>2],tm_yday:I[n+28>>2],tm_isdst:I[n+32>>2],tm_gmtoff:I[n+36>>2],tm_zone:o?H(o):""},s=H(r),a={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in a)s=s.replace(new RegExp(u,"g"),a[u]);var f=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"];function c(t,e,r){for(var n="number"==typeof t?t.toString():t||"";n.length0?1:0}var n;return 0===(n=r(t.getFullYear()-e.getFullYear()))&&0===(n=r(t.getMonth()-e.getMonth()))&&(n=r(t.getDate()-e.getDate())),n}function p(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function m(t){var e=_t(new Date(t.tm_year+1900,0,1),t.tm_yday),r=new Date(e.getFullYear(),0,4),n=new Date(e.getFullYear()+1,0,4),o=p(r),i=p(n);return h(o,e)<=0?h(i,e)<=0?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var y={"%a":function(t){return f[t.tm_wday].substring(0,3)},"%A":function(t){return f[t.tm_wday]},"%b":function(t){return l[t.tm_mon].substring(0,3)},"%B":function(t){return l[t.tm_mon]},"%C":function(t){return d((t.tm_year+1900)/100|0,2)},"%d":function(t){return d(t.tm_mday,2)},"%e":function(t){return c(t.tm_mday,2," ")},"%g":function(t){return m(t).toString().substring(2)},"%G":function(t){return m(t)},"%H":function(t){return d(t.tm_hour,2)},"%I":function(t){var e=t.tm_hour;return 0==e?e=12:e>12&&(e-=12),d(e,2)},"%j":function(t){return d(t.tm_mday+wt(gt(t.tm_year+1900)?Et:vt,t.tm_mon-1),3)},"%m":function(t){return d(t.tm_mon+1,2)},"%M":function(t){return d(t.tm_min,2)},"%n":function(){return"\\n"},"%p":function(t){return t.tm_hour>=0&&t.tm_hour<12?"AM":"PM"},"%S":function(t){return d(t.tm_sec,2)},"%t":function(){return"\\t"},"%u":function(t){return t.tm_wday||7},"%U":function(t){var e=new Date(t.tm_year+1900,0,1),r=0===e.getDay()?e:_t(e,7-e.getDay()),n=new Date(t.tm_year+1900,t.tm_mon,t.tm_mday);if(h(r,n)<0){var o=wt(gt(n.getFullYear())?Et:vt,n.getMonth()-1)-31,i=31-r.getDate()+o+n.getDate();return d(Math.ceil(i/7),2)}return 0===h(r,e)?"01":"00"},"%V":function(t){var e,r=new Date(t.tm_year+1900,0,4),n=new Date(t.tm_year+1901,0,4),o=p(r),i=p(n),s=_t(new Date(t.tm_year+1900,0,1),t.tm_yday);return h(s,o)<0?"53":h(i,s)<=0?"01":(e=o.getFullYear()=0;return e=(e=Math.abs(e)/60)/60*100+e%60,(r?"+":"-")+String("0000"+e).slice(-4)},"%Z":function(t){return t.tm_zone},"%%":function(){return"%"}};for(var u in y)s.includes(u)&&(s=s.replace(new RegExp(u,"g"),y[u](i)));var g=At(s,!1);return g.length>e?0:(function(t,e){M.set(t,e)}(g,t),g.length-1)}(t,e,r,n)}},Bt=(function(){var t={a:Pt};function e(t,e){var r,n=t.exports;s.asm=n,L((P=s.asm.t).buffer),U=s.asm.H,r=s.asm.u,N.unshift(r),Z()}function r(t){e(t.instance)}function n(e){return function(){if(!b&&(w||E)){if("function"==typeof fetch&&!tt(W))return fetch(W,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at \'"+W+"\'";return t.arrayBuffer()})).catch((function(){return et(W)}));if(f)return new Promise((function(t,e){f(W,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return et(W)}))}().then((function(e){return WebAssembly.instantiate(e,t)})).then((function(t){return t})).then(e,(function(t){k("failed to asynchronously prepare wasm: "+t),J(t)}))}if(V(),s.instantiateWasm)try{return s.instantiateWasm(t,e)}catch(t){return k("Module.instantiateWasm callback failed with error: "+t),!1}(b||"function"!=typeof WebAssembly.instantiateStreaming||Q(W)||tt(W)||"function"!=typeof fetch?n(r):fetch(W,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,t).then(r,(function(t){return k("wasm streaming compile failed: "+t),k("falling back to ArrayBuffer instantiation"),n(r)}))}))).catch(i)}(),s.___wasm_call_ctors=function(){return(s.___wasm_call_ctors=s.asm.u).apply(null,arguments)},s._initPoseDetectorModelBuffer=function(){return(s._initPoseDetectorModelBuffer=s.asm.v).apply(null,arguments)},s._getPoseDetectorModelBufferAddress=function(){return(s._getPoseDetectorModelBufferAddress=s.asm.w).apply(null,arguments)},s._loadPoseDetectorModel=function(){return(s._loadPoseDetectorModel=s.asm.x).apply(null,arguments)},s._initPoseLandmarkModelBuffer=function(){return(s._initPoseLandmarkModelBuffer=s.asm.y).apply(null,arguments)},s._getPoseLandmarkModelBufferAddress=function(){return(s._getPoseLandmarkModelBufferAddress=s.asm.z).apply(null,arguments)},s._loadPoseLandmarkModel=function(){return(s._loadPoseLandmarkModel=s.asm.A).apply(null,arguments)},s._initPoseInputBuffer=function(){return(s._initPoseInputBuffer=s.asm.B).apply(null,arguments)},s._getPoseInputBufferAddress=function(){return(s._getPoseInputBufferAddress=s.asm.C).apply(null,arguments)},s._getPoseOutputBufferAddress=function(){return(s._getPoseOutputBufferAddress=s.asm.D).apply(null,arguments)},s._getPoseTemporaryBufferAddress=function(){return(s._getPoseTemporaryBufferAddress=s.asm.E).apply(null,arguments)},s._execPose=function(){return(s._execPose=s.asm.F).apply(null,arguments)},s._set_pose_calculate_mode=function(){return(s._set_pose_calculate_mode=s.asm.G).apply(null,arguments)},s._initPalmDetectorModelBuffer=function(){return(s._initPalmDetectorModelBuffer=s.asm.I).apply(null,arguments)},s._getPalmDetectorModelBufferAddress=function(){return(s._getPalmDetectorModelBufferAddress=s.asm.J).apply(null,arguments)},s._loadPalmDetectorModel=function(){return(s._loadPalmDetectorModel=s.asm.K).apply(null,arguments)},s._initHandLandmarkModelBuffer=function(){return(s._initHandLandmarkModelBuffer=s.asm.L).apply(null,arguments)},s._getHandLandmarkModelBufferAddress=function(){return(s._getHandLandmarkModelBufferAddress=s.asm.M).apply(null,arguments)},s._loadHandLandmarkModel=function(){return(s._loadHandLandmarkModel=s.asm.N).apply(null,arguments)},s._initHandInputBuffer=function(){return(s._initHandInputBuffer=s.asm.O).apply(null,arguments)},s._getHandInputBufferAddress=function(){return(s._getHandInputBufferAddress=s.asm.P).apply(null,arguments)},s._getHandOutputBufferAddress=function(){return(s._getHandOutputBufferAddress=s.asm.Q).apply(null,arguments)},s._getHandTemporaryBufferAddress=function(){return(s._getHandTemporaryBufferAddress=s.asm.R).apply(null,arguments)},s._execHand=function(){return(s._execHand=s.asm.S).apply(null,arguments)},s._initFaceDetectorModelBuffer=function(){return(s._initFaceDetectorModelBuffer=s.asm.T).apply(null,arguments)},s._getFaceDetectorModelBufferAddress=function(){return(s._getFaceDetectorModelBufferAddress=s.asm.U).apply(null,arguments)},s._loadFaceDetectorModel=function(){return(s._loadFaceDetectorModel=s.asm.V).apply(null,arguments)},s._initFaceLandmarkModelBuffer=function(){return(s._initFaceLandmarkModelBuffer=s.asm.W).apply(null,arguments)},s._getFaceLandmarkModelBufferAddress=function(){return(s._getFaceLandmarkModelBufferAddress=s.asm.X).apply(null,arguments)},s._loadFaceLandmarkModel=function(){return(s._loadFaceLandmarkModel=s.asm.Y).apply(null,arguments)},s._initFaceInputBuffer=function(){return(s._initFaceInputBuffer=s.asm.Z).apply(null,arguments)},s._getFaceInputBufferAddress=function(){return(s._getFaceInputBufferAddress=s.asm._).apply(null,arguments)},s._getFaceOutputBufferAddress=function(){return(s._getFaceOutputBufferAddress=s.asm.$).apply(null,arguments)},s._getFaceTemporaryBufferAddress=function(){return(s._getFaceTemporaryBufferAddress=s.asm.aa).apply(null,arguments)},s._execFace=function(){return(s._execFace=s.asm.ba).apply(null,arguments)},s._malloc=function(){return(Bt=s._malloc=s.asm.ca).apply(null,arguments)}),Ft=s.___errno_location=function(){return(Ft=s.___errno_location=s.asm.da).apply(null,arguments)},Mt=s._memalign=function(){return(Mt=s._memalign=s.asm.ea).apply(null,arguments)};function Dt(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function It(t){function r(){kt||(kt=!0,s.calledRun=!0,x||(s.noFSInit||mt.init.initialized||mt.init(),mt.ignorePermissions=!1,ht.init(),rt(N),e(s),s.onRuntimeInitialized&&s.onRuntimeInitialized(),function(){if(s.postRun)for("function"==typeof s.postRun&&(s.postRun=[s.postRun]);s.postRun.length;)t=s.postRun.shift(),z.unshift(t);var t;rt(z)}()))}t=t||m,$>0||(function(){if(s.preRun)for("function"==typeof s.preRun&&(s.preRun=[s.preRun]);s.preRun.length;)t=s.preRun.shift(),C.unshift(t);var t;rt(C)}(),$>0||(s.setStatus?(s.setStatus("Running..."),setTimeout((function(){setTimeout((function(){s.setStatus("")}),1),r()}),1)):r()))}if(G=function t(){kt||It(),kt||(G=t)},s.run=It,s.preInit)for("function"==typeof s.preInit&&(s.preInit=[s.preInit]);s.preInit.length>0;)s.preInit.pop()();return It(),t.ready});t.exports=i},782:()=>{},384:()=>{},375:()=>{}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}(()=>{"use strict";var t=r(55);const e={lips:[61,146,91,181,84,17,314,405,321,375,291,185,40,39,37,0,267,269,270,409,78,95,88,178,87,14,317,402,318,324,308,191,80,81,82,13,312,311,310,415,76,77,90,180,85,16,315,404,320,307,306,184,74,73,72,11,302,303,304,408,62,96,89,179,86,15,316,403,319,325,292,183,42,41,38,12,268,271,272,407],leftEye:[33,7,163,144,145,153,154,155,133,246,161,160,159,158,157,173,130,25,110,24,23,22,26,112,243,247,30,29,27,28,56,190,226,31,228,229,230,231,232,233,244,113,225,224,223,222,221,189,35,124,46,53,52,65,143,111,117,118,119,120,121,128,245,156,70,63,105,66,107,55,193],rightEye:[263,249,390,373,374,380,381,382,362,466,388,387,386,385,384,398,359,255,339,254,253,252,256,341,463,467,260,259,257,258,286,414,446,261,448,449,450,451,452,453,464,342,445,444,443,442,441,413,265,353,276,283,282,295,372,340,346,347,348,349,350,357,465,383,300,293,334,296,336,285,417],leftIris:[468,469,470,471,472],rightIris:[473,474,475,476,477]};class n extends t.ImageProcessor{constructor(){super(...arguments),this.tflite=null,this.tfliteHandInputAddress=0,this.tfliteHandOutputAddress=0,this.tfliteFaceInputAddress=0,this.tfliteFaceOutputAddress=0,this.tflitePoseInputAddress=0,this.tflitePoseOutputAddress=0,this.init=async e=>{if(e.browserType!==t.BrowserTypes.SAFARI){const t=r(503);this.tflite=await t({wasmBinary:e.wasmBin})}else console.error("This module use wasm-simd. Safari is not supported.");const n=e.palmDetectorModelTFLites[e.handModelKey];this.tflite._initPalmDetectorModelBuffer(n.byteLength);const o=this.tflite._getPalmDetectorModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(n),o),this.tflite._loadPalmDetectorModel(n.byteLength);const i=e.handLandmarkModelTFLites[e.handModelKey];this.tflite._initHandLandmarkModelBuffer(i.byteLength);const s=this.tflite._getHandLandmarkModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(i),s),this.tflite._loadHandLandmarkModel(i.byteLength),this.tflite._initHandInputBuffer(e.maxProcessWidth,e.maxProcessHeight,4),this.tfliteHandInputAddress=this.tflite._getHandInputBufferAddress(),this.tfliteHandOutputAddress=this.tflite._getHandOutputBufferAddress(),console.log("Hand model is loaded successfully.",e);const a=e.faceDetectorModelTFLites[e.faceModelKey];this.tflite._initFaceDetectorModelBuffer(a.byteLength);const u=this.tflite._getFaceDetectorModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(a),u),this.tflite._loadFaceDetectorModel(a.byteLength);const f=e.faceLandmarkModelTFLites[e.faceModelKey];this.tflite._initFaceLandmarkModelBuffer(f.byteLength);const l=this.tflite._getFaceLandmarkModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(f),l),this.tflite._loadFaceLandmarkModel(f.byteLength),this.tflite._initFaceInputBuffer(e.maxProcessWidth,e.maxProcessHeight,4),this.tfliteFaceInputAddress=this.tflite._getFaceInputBufferAddress(),this.tfliteFaceOutputAddress=this.tflite._getFaceOutputBufferAddress(),console.log("Face model is loaded successfully.",e);const c=e.poseDetectorModelTFLites[e.poseModelKey];this.tflite._initPoseDetectorModelBuffer(c.byteLength);const d=this.tflite._getPoseDetectorModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(c),d),this.tflite._loadPoseDetectorModel(c.byteLength);const h=e.poseLandmarkModelTFLites[e.poseModelKey];this.tflite._initPoseLandmarkModelBuffer(h.byteLength);const p=this.tflite._getPoseLandmarkModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(h),p),this.tflite._loadPoseLandmarkModel(h.byteLength),this.tflite._initPoseInputBuffer(e.maxProcessWidth,e.maxProcessHeight,4),this.tflitePoseInputAddress=this.tflite._getPoseInputBufferAddress(),this.tflitePoseOutputAddress=this.tflite._getPoseOutputBufferAddress(),console.log("Pose model is loaded successfully.",e)},this.predict=async(t,e,r)=>"hand"===e.operationType?this.predictHand(t,e,r):"face"===e.operationType?this.predictFace(t,e,r):"pose"===e.operationType?this.predictPose(t,e,r):null,this.predictHand=async(t,e,r)=>{const n=new ImageData(r,e.handProcessWidth,e.handProcessHeight);this.tflite.HEAPU8.set(n.data,this.tfliteHandInputAddress),this.tflite._execHand(e.handProcessWidth,e.handProcessHeight,e.handMaxHands,e.handAffineResizedFactor);const o=this.tflite.HEAPF32[this.tfliteHandOutputAddress/4],i=[];for(let t=0;t({keypoints:[...t.landmarkKeypoints],handedness:t.handedness<.5?"Left":"Right",score:t.score})))},this.predictFace=async(t,r,n)=>{const o=new ImageData(n,r.faceProcessWidth,r.faceProcessHeight);this.tflite.HEAPU8.set(o.data,this.tfliteFaceInputAddress),this.tflite._execFace(r.faceProcessWidth,r.faceProcessHeight,r.faceMaxFaces);const i=this.tflite.HEAPF32[this.tfliteFaceOutputAddress/4],s=[];for(let t=0;t.5&&r.landmarkScore>.5&&s.push(r)}return s.map((t=>{const r={keypoints:[...t.landmarkKeypoints],box:{xMin:t.face.minX,yMin:t.face.minY,xMax:t.face.maxX,yMax:t.face.maxY,width:t.face.maxX-t.face.minX,height:t.face.maxY-t.face.maxY}};return e.lips.forEach(((e,n)=>{r.keypoints[e].x=t.landmarkLipsKeypoints[n].x,r.keypoints[e].y=t.landmarkLipsKeypoints[n].y})),e.leftEye.forEach(((e,n)=>{r.keypoints[e].x=t.landmarkLeftEyeKeypoints[n].x,r.keypoints[e].y=t.landmarkLeftEyeKeypoints[n].y})),e.rightEye.forEach(((e,n)=>{r.keypoints[e].x=t.landmarkRightEyeKeypoints[n].x,r.keypoints[e].y=t.landmarkRightEyeKeypoints[n].y})),e.leftIris.forEach(((e,n)=>{r.keypoints[e]=t.landmarkLeftIrisKeypoints[n]})),e.rightIris.forEach(((e,n)=>{r.keypoints[e]=t.landmarkRightIrisKeypoints[n]})),r}))},this.predictPose=async(t,e,r)=>{const n=new ImageData(r,e.poseProcessWidth,e.poseProcessHeight);this.tflite.HEAPU8.set(n.data,this.tflitePoseInputAddress),this.tflite._set_pose_calculate_mode(e.poseCalculateMode),this.tflite._execPose(e.poseProcessWidth,e.poseProcessHeight,e.poseMaxPoses,e.poseAffineResizedFactor,e.poseCropExt);const o=this.tflite.HEAPF32[this.tflitePoseOutputAddress/4],i=[];for(let t=0;t.1&&r.landmarkScore>0&&i.push(r)}return i.map((t=>({keypoints:[...t.landmarkKeypoints],keypoints3D:[...t.landmarkKeypoints3D],box:{xMin:t.pose.minX,yMin:t.pose.minY,xMax:t.pose.maxX,yMax:t.pose.maxY,width:t.pose.maxX-t.pose.minX,height:t.pose.maxY-t.pose.maxY}})))}}}const o=self,i=new t.WorkerDispatcher(o),s={init:async t=>{const e=new n;return await e.init(t),e}};i.setCallback(s),onmessage=i.dispach})()})();',"Worker",void 0,void 0)}const l=468,u=[127,34,139,11,0,37,232,231,120,72,37,39,128,121,47,232,121,128,104,69,67,175,171,148,157,154,155,118,50,101,73,39,40,9,151,108,48,115,131,194,204,211,74,40,185,80,42,183,40,92,186,230,229,118,202,212,214,83,18,17,76,61,146,160,29,30,56,157,173,106,204,194,135,214,192,203,165,98,21,71,68,51,45,4,144,24,23,77,146,91,205,50,187,201,200,18,91,106,182,90,91,181,85,84,17,206,203,36,148,171,140,92,40,39,193,189,244,159,158,28,247,246,161,236,3,196,54,68,104,193,168,8,117,228,31,189,193,55,98,97,99,126,47,100,166,79,218,155,154,26,209,49,131,135,136,150,47,126,217,223,52,53,45,51,134,211,170,140,67,69,108,43,106,91,230,119,120,226,130,247,63,53,52,238,20,242,46,70,156,78,62,96,46,53,63,143,34,227,173,155,133,123,117,111,44,125,19,236,134,51,216,206,205,154,153,22,39,37,167,200,201,208,36,142,100,57,212,202,20,60,99,28,158,157,35,226,113,160,159,27,204,202,210,113,225,46,43,202,204,62,76,77,137,123,116,41,38,72,203,129,142,64,98,240,49,102,64,41,73,74,212,216,207,42,74,184,169,170,211,170,149,176,105,66,69,122,6,168,123,147,187,96,77,90,65,55,107,89,90,180,101,100,120,63,105,104,93,137,227,15,86,85,129,102,49,14,87,86,55,8,9,100,47,121,145,23,22,88,89,179,6,122,196,88,95,96,138,172,136,215,58,172,115,48,219,42,80,81,195,3,51,43,146,61,171,175,199,81,82,38,53,46,225,144,163,110,246,33,7,52,65,66,229,228,117,34,127,234,107,108,69,109,108,151,48,64,235,62,78,191,129,209,126,111,35,143,163,161,246,117,123,50,222,65,52,19,125,141,221,55,65,3,195,197,25,7,33,220,237,44,70,71,139,122,193,245,247,130,33,71,21,162,153,158,159,170,169,150,188,174,196,216,186,92,144,160,161,2,97,167,141,125,241,164,167,37,72,38,12,145,159,160,38,82,13,63,68,71,226,35,111,158,153,154,101,50,205,206,92,165,209,198,217,165,167,97,220,115,218,133,112,243,239,238,241,214,135,169,190,173,133,171,208,32,125,44,237,86,87,178,85,86,179,84,85,180,83,84,181,201,83,182,137,93,132,76,62,183,61,76,184,57,61,185,212,57,186,214,207,187,34,143,156,79,239,237,123,137,177,44,1,4,201,194,32,64,102,129,213,215,138,59,166,219,242,99,97,2,94,141,75,59,235,24,110,228,25,130,226,23,24,229,22,23,230,26,22,231,112,26,232,189,190,243,221,56,190,28,56,221,27,28,222,29,27,223,30,29,224,247,30,225,238,79,20,166,59,75,60,75,240,147,177,215,20,79,166,187,147,213,112,233,244,233,128,245,128,114,188,114,217,174,131,115,220,217,198,236,198,131,134,177,132,58,143,35,124,110,163,7,228,110,25,356,389,368,11,302,267,452,350,349,302,303,269,357,343,277,452,453,357,333,332,297,175,152,377,384,398,382,347,348,330,303,304,270,9,336,337,278,279,360,418,262,431,304,408,409,310,415,407,270,409,410,450,348,347,422,430,434,313,314,17,306,307,375,387,388,260,286,414,398,335,406,418,364,367,416,423,358,327,251,284,298,281,5,4,373,374,253,307,320,321,425,427,411,421,313,18,321,405,406,320,404,405,315,16,17,426,425,266,377,400,369,322,391,269,417,465,464,386,257,258,466,260,388,456,399,419,284,332,333,417,285,8,346,340,261,413,441,285,327,460,328,355,371,329,392,439,438,382,341,256,429,420,360,364,394,379,277,343,437,443,444,283,275,440,363,431,262,369,297,338,337,273,375,321,450,451,349,446,342,467,293,334,282,458,461,462,276,353,383,308,324,325,276,300,293,372,345,447,382,398,362,352,345,340,274,1,19,456,248,281,436,427,425,381,256,252,269,391,393,200,199,428,266,330,329,287,273,422,250,462,328,258,286,384,265,353,342,387,259,257,424,431,430,342,353,276,273,335,424,292,325,307,366,447,345,271,303,302,423,266,371,294,455,460,279,278,294,271,272,304,432,434,427,272,407,408,394,430,431,395,369,400,334,333,299,351,417,168,352,280,411,325,319,320,295,296,336,319,403,404,330,348,349,293,298,333,323,454,447,15,16,315,358,429,279,14,15,316,285,336,9,329,349,350,374,380,252,318,402,403,6,197,419,318,319,325,367,364,365,435,367,397,344,438,439,272,271,311,195,5,281,273,287,291,396,428,199,311,271,268,283,444,445,373,254,339,263,466,249,282,334,296,449,347,346,264,447,454,336,296,299,338,10,151,278,439,455,292,407,415,358,371,355,340,345,372,390,249,466,346,347,280,442,443,282,19,94,370,441,442,295,248,419,197,263,255,359,440,275,274,300,383,368,351,412,465,263,467,466,301,368,389,380,374,386,395,378,379,412,351,419,436,426,322,373,390,388,2,164,393,370,462,461,164,0,267,302,11,12,374,373,387,268,12,13,293,300,301,446,261,340,385,384,381,330,266,425,426,423,391,429,355,437,391,327,326,440,457,438,341,382,362,459,457,461,434,430,394,414,463,362,396,369,262,354,461,457,316,403,402,315,404,403,314,405,404,313,406,405,421,418,406,366,401,361,306,408,407,291,409,408,287,410,409,432,436,410,434,416,411,264,368,383,309,438,457,352,376,401,274,275,4,421,428,262,294,327,358,433,416,367,289,455,439,462,370,326,2,326,370,305,460,455,254,449,448,255,261,446,253,450,449,252,451,450,256,452,451,341,453,452,413,464,463,441,413,414,258,442,441,257,443,442,259,444,443,260,445,444,467,342,445,459,458,250,289,392,290,290,328,460,376,433,435,250,290,392,411,416,433,341,463,464,453,464,465,357,465,412,343,412,399,360,363,440,437,399,456,420,456,363,401,435,288,372,383,353,339,255,249,448,261,255,133,243,190,133,155,112,33,246,247,33,130,25,398,384,286,362,398,414,362,463,341,263,359,467,263,249,255,466,467,260,75,60,166,238,239,79,162,127,139,72,11,37,121,232,120,73,72,39,114,128,47,233,232,128,103,104,67,152,175,148,173,157,155,119,118,101,74,73,40,107,9,108,49,48,131,32,194,211,184,74,185,191,80,183,185,40,186,119,230,118,210,202,214,84,83,17,77,76,146,161,160,30,190,56,173,182,106,194,138,135,192,129,203,98,54,21,68,5,51,4,145,144,23,90,77,91,207,205,187,83,201,18,181,91,182,180,90,181,16,85,17,205,206,36,176,148,140,165,92,39,245,193,244,27,159,28,30,247,161,174,236,196,103,54,104,55,193,8,111,117,31,221,189,55,240,98,99,142,126,100,219,166,218,112,155,26,198,209,131,169,135,150,114,47,217,224,223,53,220,45,134,32,211,140,109,67,108,146,43,91,231,230,120,113,226,247,105,63,52,241,238,242,124,46,156,95,78,96,70,46,63,116,143,227,116,123,111,1,44,19,3,236,51,207,216,205,26,154,22,165,39,167,199,200,208,101,36,100,43,57,202,242,20,99,56,28,157,124,35,113,29,160,27,211,204,210,124,113,46,106,43,204,96,62,77,227,137,116,73,41,72,36,203,142,235,64,240,48,49,64,42,41,74,214,212,207,183,42,184,210,169,211,140,170,176,104,105,69,193,122,168,50,123,187,89,96,90,66,65,107,179,89,180,119,101,120,68,63,104,234,93,227,16,15,85,209,129,49,15,14,86,107,55,9,120,100,121,153,145,22,178,88,179,197,6,196,89,88,96,135,138,136,138,215,172,218,115,219,41,42,81,5,195,51,57,43,61,208,171,199,41,81,38,224,53,225,24,144,110,105,52,66,118,229,117,227,34,234,66,107,69,10,109,151,219,48,235,183,62,191,142,129,126,116,111,143,7,163,246,118,117,50,223,222,52,94,19,141,222,221,65,196,3,197,45,220,44,156,70,139,188,122,245,139,71,162,145,153,159,149,170,150,122,188,196,206,216,92,163,144,161,164,2,167,242,141,241,0,164,37,11,72,12,144,145,160,12,38,13,70,63,71,31,226,111,157,158,154,36,101,205,203,206,165,126,209,217,98,165,97,237,220,218,237,239,241,210,214,169,140,171,32,241,125,237,179,86,178,180,85,179,181,84,180,182,83,181,194,201,182,177,137,132,184,76,183,185,61,184,186,57,185,216,212,186,192,214,187,139,34,156,218,79,237,147,123,177,45,44,4,208,201,32,98,64,129,192,213,138,235,59,219,141,242,97,97,2,141,240,75,235,229,24,228,31,25,226,230,23,229,231,22,230,232,26,231,233,112,232,244,189,243,189,221,190,222,28,221,223,27,222,224,29,223,225,30,224,113,247,225,99,60,240,213,147,215,60,20,166,192,187,213,243,112,244,244,233,245,245,128,188,188,114,174,134,131,220,174,217,236,236,198,134,215,177,58,156,143,124,25,110,7,31,228,25,264,356,368,0,11,267,451,452,349,267,302,269,350,357,277,350,452,357,299,333,297,396,175,377,381,384,382,280,347,330,269,303,270,151,9,337,344,278,360,424,418,431,270,304,409,272,310,407,322,270,410,449,450,347,432,422,434,18,313,17,291,306,375,259,387,260,424,335,418,434,364,416,391,423,327,301,251,298,275,281,4,254,373,253,375,307,321,280,425,411,200,421,18,335,321,406,321,320,405,314,315,17,423,426,266,396,377,369,270,322,269,413,417,464,385,386,258,248,456,419,298,284,333,168,417,8,448,346,261,417,413,285,326,327,328,277,355,329,309,392,438,381,382,256,279,429,360,365,364,379,355,277,437,282,443,283,281,275,363,395,431,369,299,297,337,335,273,321,348,450,349,359,446,467,283,293,282,250,458,462,300,276,383,292,308,325,283,276,293,264,372,447,346,352,340,354,274,19,363,456,281,426,436,425,380,381,252,267,269,393,421,200,428,371,266,329,432,287,422,290,250,328,385,258,384,446,265,342,386,387,257,422,424,430,445,342,276,422,273,424,306,292,307,352,366,345,268,271,302,358,423,371,327,294,460,331,279,294,303,271,304,436,432,427,304,272,408,395,394,431,378,395,400,296,334,299,6,351,168,376,352,411,307,325,320,285,295,336,320,319,404,329,330,349,334,293,333,366,323,447,316,15,315,331,358,279,317,14,316,8,285,9,277,329,350,253,374,252,319,318,403,351,6,419,324,318,325,397,367,365,288,435,397,278,344,439,310,272,311,248,195,281,375,273,291,175,396,199,312,311,268,276,283,445,390,373,339,295,282,296,448,449,346,356,264,454,337,336,299,337,338,151,294,278,455,308,292,415,429,358,355,265,340,372,388,390,466,352,346,280,295,442,282,354,19,370,285,441,295,195,248,197,457,440,274,301,300,368,417,351,465,251,301,389,385,380,386,394,395,379,399,412,419,410,436,322,387,373,388,326,2,393,354,370,461,393,164,267,268,302,12,386,374,387,312,268,13,298,293,301,265,446,340,380,385,381,280,330,425,322,426,391,420,429,437,393,391,326,344,440,438,458,459,461,364,434,394,428,396,262,274,354,457,317,316,402,316,315,403,315,314,404,314,313,405,313,421,406,323,366,361,292,306,407,306,291,408,291,287,409,287,432,410,427,434,411,372,264,383,459,309,457,366,352,401,1,274,4,418,421,262,331,294,358,435,433,367,392,289,439,328,462,326,94,2,370,289,305,455,339,254,448,359,255,446,254,253,449,253,252,450,252,256,451,256,341,452,414,413,463,286,441,414,286,258,441,258,257,442,257,259,443,259,260,444,260,467,445,309,459,250,305,289,290,305,290,460,401,376,435,309,250,392,376,411,433,453,341,464,357,453,465,343,357,412,437,343,399,344,360,440,420,437,456,360,420,363,361,401,288,265,372,353,390,339,249,339,448,255],d=[61,146,91,181,84,17,314,405,321,375,291,185,40,39,37,0,267,269,270,409,78,95,88,178,87,14,317,402,318,324,308,191,80,81,82,13,312,311,310,415,76,77,90,180,85,16,315,404,320,307,306,184,74,73,72,11,302,303,304,408,62,96,89,179,86,15,316,403,319,325,292,183,42,41,38,12,268,271,272,407],h=[33,7,163,144,145,153,154,155,133,246,161,160,159,158,157,173,130,25,110,24,23,22,26,112,243,247,30,29,27,28,56,190,226,31,228,229,230,231,232,233,244,113,225,224,223,222,221,189,35,124,46,53,52,65,143,111,117,118,119,120,121,128,245,156,70,63,105,66,107,55,193],f=[263,249,390,373,374,380,381,382,362,466,388,387,386,385,384,398,359,255,339,254,253,252,256,341,463,467,260,259,257,258,286,414,446,261,448,449,450,451,452,453,464,342,445,444,443,442,441,413,265,353,276,283,282,295,372,340,346,347,348,349,350,357,465,383,300,293,334,296,336,285,417],p=[468,469,470,471,472],m=[473,474,475,476,477],g={lips:d,leftEye:h,rightEye:f,leftIris:p,rightIris:m};class v extends e.ImageProcessor{constructor(){super(...arguments),this.tflite=null,this.tfliteHandInputAddress=0,this.tfliteHandOutputAddress=0,this.tfliteFaceInputAddress=0,this.tfliteFaceOutputAddress=0,this.tflitePoseInputAddress=0,this.tflitePoseOutputAddress=0,this.init=async t=>{if(t.browserType!==e.BrowserTypes.SAFARI){const e=i(503);this.tflite=await e({wasmBinary:t.wasmBin})}else console.error("This module use wasm-simd. Safari is not supported.");const n=t.palmDetectorModelTFLites[t.handModelKey];this.tflite._initPalmDetectorModelBuffer(n.byteLength);const r=this.tflite._getPalmDetectorModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(n),r),this.tflite._loadPalmDetectorModel(n.byteLength);const s=t.handLandmarkModelTFLites[t.handModelKey];this.tflite._initHandLandmarkModelBuffer(s.byteLength);const a=this.tflite._getHandLandmarkModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(s),a),this.tflite._loadHandLandmarkModel(s.byteLength),this.tflite._initHandInputBuffer(t.maxProcessWidth,t.maxProcessHeight,4),this.tfliteHandInputAddress=this.tflite._getHandInputBufferAddress(),this.tfliteHandOutputAddress=this.tflite._getHandOutputBufferAddress(),console.log("Hand model is loaded successfully.",t);const o=t.faceDetectorModelTFLites[t.faceModelKey];this.tflite._initFaceDetectorModelBuffer(o.byteLength);const c=this.tflite._getFaceDetectorModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(o),c),this.tflite._loadFaceDetectorModel(o.byteLength);const l=t.faceLandmarkModelTFLites[t.faceModelKey];this.tflite._initFaceLandmarkModelBuffer(l.byteLength);const u=this.tflite._getFaceLandmarkModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(l),u),this.tflite._loadFaceLandmarkModel(l.byteLength),this.tflite._initFaceInputBuffer(t.maxProcessWidth,t.maxProcessHeight,4),this.tfliteFaceInputAddress=this.tflite._getFaceInputBufferAddress(),this.tfliteFaceOutputAddress=this.tflite._getFaceOutputBufferAddress(),console.log("Face model is loaded successfully.",t);const d=t.poseDetectorModelTFLites[t.poseModelKey];this.tflite._initPoseDetectorModelBuffer(d.byteLength);const h=this.tflite._getPoseDetectorModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(d),h),this.tflite._loadPoseDetectorModel(d.byteLength);const f=t.poseLandmarkModelTFLites[t.poseModelKey];this.tflite._initPoseLandmarkModelBuffer(f.byteLength);const p=this.tflite._getPoseLandmarkModelBufferAddress();this.tflite.HEAPU8.set(new Uint8Array(f),p),this.tflite._loadPoseLandmarkModel(f.byteLength),this.tflite._initPoseInputBuffer(t.maxProcessWidth,t.maxProcessHeight,4),this.tflitePoseInputAddress=this.tflite._getPoseInputBufferAddress(),this.tflitePoseOutputAddress=this.tflite._getPoseOutputBufferAddress(),console.log("Pose model is loaded successfully.",t)},this.predict=async(e,n,i)=>n.operationType===t.hand?this.predictHand(e,n,i):n.operationType===t.face?this.predictFace(e,n,i):n.operationType===t.pose?this.predictPose(e,n,i):null,this.predictHand=async(e,t,n)=>{const i=new ImageData(n,t.handProcessWidth,t.handProcessHeight);this.tflite.HEAPU8.set(i.data,this.tfliteHandInputAddress),this.tflite._execHand(t.handProcessWidth,t.handProcessHeight,t.handMaxHands,t.handAffineResizedFactor);const r=this.tflite.HEAPF32[this.tfliteHandOutputAddress/4],s=[];for(let e=0;e({keypoints:[...e.landmarkKeypoints],handedness:e.handedness<.5?"Left":"Right",score:e.score})))},this.predictFace=async(e,t,n)=>{const i=new ImageData(n,t.faceProcessWidth,t.faceProcessHeight);this.tflite.HEAPU8.set(i.data,this.tfliteFaceInputAddress),this.tflite._execFace(t.faceProcessWidth,t.faceProcessHeight,t.faceMaxFaces);const r=this.tflite.HEAPF32[this.tfliteFaceOutputAddress/4],s=[];for(let e=0;e.5&&n.landmarkScore>.5&&s.push(n)}return s.map((e=>{const t={keypoints:[...e.landmarkKeypoints],box:{xMin:e.face.minX,yMin:e.face.minY,xMax:e.face.maxX,yMax:e.face.maxY,width:e.face.maxX-e.face.minX,height:e.face.maxY-e.face.maxY}};return g.lips.forEach(((n,i)=>{t.keypoints[n].x=e.landmarkLipsKeypoints[i].x,t.keypoints[n].y=e.landmarkLipsKeypoints[i].y})),g.leftEye.forEach(((n,i)=>{t.keypoints[n].x=e.landmarkLeftEyeKeypoints[i].x,t.keypoints[n].y=e.landmarkLeftEyeKeypoints[i].y})),g.rightEye.forEach(((n,i)=>{t.keypoints[n].x=e.landmarkRightEyeKeypoints[i].x,t.keypoints[n].y=e.landmarkRightEyeKeypoints[i].y})),g.leftIris.forEach(((n,i)=>{t.keypoints[n]=e.landmarkLeftIrisKeypoints[i]})),g.rightIris.forEach(((n,i)=>{t.keypoints[n]=e.landmarkRightIrisKeypoints[i]})),t}))},this.predictPose=async(e,t,n)=>{const i=new ImageData(n,t.poseProcessWidth,t.poseProcessHeight);this.tflite.HEAPU8.set(i.data,this.tflitePoseInputAddress),this.tflite._set_pose_calculate_mode(t.poseCalculateMode),this.tflite._execPose(t.poseProcessWidth,t.poseProcessHeight,t.poseMaxPoses,t.poseAffineResizedFactor,t.poseCropExt);const r=this.tflite.HEAPF32[this.tflitePoseOutputAddress/4],s=[];for(let e=0;e.1&&n.landmarkScore>0&&s.push(n)}return s.map((e=>({keypoints:[...e.landmarkKeypoints],keypoints3D:[...e.landmarkKeypoints3D],box:{xMin:e.pose.minX,yMin:e.pose.minY,xMax:e.pose.maxX,yMax:e.pose.maxY,width:e.pose.maxX-e.pose.minX,height:e.pose.maxY-e.pose.maxY}})))}}}class y extends e.WorkerManagerBase{constructor(){super(...arguments),this.imageProcessor=new v,this.config=null,this.generateDefaultConfig=async t=>{const n=t?.wasmUrl||i(81),r=this.fetchData(n),s=t?.palmDetectorModelTFLiteUrl||i(102),a=this.fetchData(s),o=t?.handLandmarkLiteTFLiteUrl||i(583),c=this.fetchData(o),l=t?.faceDetectorModelTFLiteUrl||i(363),u=this.fetchData(l),d=t?.faceLandmarkModelTFLiteUrl||i(180),h=this.fetchData(d),f=t?.poseDetectorModelTFLiteUrl||i(914),p=this.fetchData(f),m=t?.poseLandmarkModelTFLiteUrl||i(747),g=this.fetchData(m),[v,y,b,x,w,M,S]=await Promise.all([r,a,c,u,h,p,g]);return{browserType:(0,e.getBrowserType)(),processOnLocal:!0,pageUrl:window.location.href,wasmBin:v,palmDetectorModelTFLites:{lite:y},handLandmarkModelTFLites:{lite:b},handModelKey:"lite",faceDetectorModelTFLites:{lite:x},faceLandmarkModelTFLites:{lite:w},faceModelKey:"lite",poseDetectorModelTFLites:{lite:M},poseLandmarkModelTFLites:{lite:S},poseModelKey:"lite",maxProcessWidth:1024,maxProcessHeight:1024}},this.generateDefaultMediapipeMixParams=()=>({operationType:t.face,handProcessWidth:512,handProcessHeight:512,handMaxHands:2,handAffineResizedFactor:2,faceProcessWidth:512,faceProcessHeight:512,faceMaxFaces:1,faceMovingAverageWindow:5,poseProcessWidth:512,poseProcessHeight:512,poseMaxPoses:1,poseMovingAverageWindow:5,poseAffineResizedFactor:2,poseCropExt:1.3,poseCalculateMode:0}),this.init=async e=>{this.config=e||await this.generateDefaultConfig(),await this.initCommon({useWorkerForSafari:!0,processOnLocal:this.config.processOnLocal,workerJs:()=>new c},this.config),console.log("[manager] tflite worker initilizied.")},this.predict=async(e,n)=>{if(!this.config)return console.warn("config is not initialized."),null;const i={...e},r=((n,i)=>e.operationType===t.hand?this.generateTargetCanvas(i,n.handProcessWidth,n.handProcessHeight):e.operationType===t.face?this.generateTargetCanvas(i,n.faceProcessWidth,n.faceProcessHeight):this.generateTargetCanvas(i,n.poseProcessWidth,n.poseProcessHeight))(i,n);if(!this.worker){const e=r.getContext("2d").getImageData(0,0,r.width,r.height),n=await this.imageProcessor.predict(this.config,i,e.data);return i.operationType===t.hand?this.generateHandPredictionEx(this.config,i,n):i.operationType===t.face?this.generateFacePredictionEx(this.config,i,n):this.generatePosePredictionEx(this.config,i,n)}const s=r.getContext("2d").getImageData(0,0,r.width,r.height),a=await this.sendToWorker(i,s.data);return i.operationType===t.hand?this.generateHandPredictionEx(this.config,i,a):i.operationType===t.face?this.generateFacePredictionEx(this.config,i,a):this.generatePosePredictionEx(this.config,i,a)},this.generateHandPredictionEx=(e,n,i)=>{const r=i;return{operationType:t.hand,rowPrediction:r}},this.facesMV=[],this.generateFacePredictionEx=(e,n,i)=>{const r=i,s={operationType:t.face,rowPrediction:r};if(n.faceMovingAverageWindow>0){if(r)for(;this.facesMV.length>n.faceMovingAverageWindow;)this.facesMV.shift();r&&r[0]&&r[0].keypoints&&this.facesMV.push(r);const e=this.facesMV.map((e=>e[0].keypoints)).reduce(((e,t)=>{for(let n=0;ne[0].box)).reduce(((e,t)=>e.width?(e.width=e.width+t.width,e.xMax=e.xMax+t.xMax,e.xMin=e.xMin+t.xMin,e.height=e.height+t.height,e.yMax=e.yMax+t.yMax,e.yMin=e.yMin+t.yMin,e):{width:t.width,xMax:t.xMax,xMin:t.xMin,height:t.height,yMax:t.yMax,yMin:t.yMin}),{});console.log(),t.width/=this.facesMV.length,t.xMax/=this.facesMV.length,t.xMin/=this.facesMV.length,t.height/=this.facesMV.length,t.yMax/=this.facesMV.length,t.yMin/=this.facesMV.length,s.singlePersonBoxMovingAverage=t}return s},this.posesMV=[],this.generatePosePredictionEx=(e,n,i)=>{const r=i,s={operationType:t.pose,rowPrediction:r};if(n.poseMovingAverageWindow>0){if(r)for(;this.posesMV.length>n.poseMovingAverageWindow;)this.posesMV.shift();r&&r[0]&&r[0].keypoints&&this.posesMV.push(r);const e=this.posesMV.map((e=>e[0].keypoints)).reduce(((e,t)=>{for(let n=0;ne[0].keypoints3D)).reduce(((e,t)=>{for(let n=0;ne[0].box)).reduce(((e,t)=>e.width?(e.width=e.width+t.width,e.xMax=e.xMax+t.xMax,e.xMin=e.xMin+t.xMin,e.height=e.height+t.height,e.yMax=e.yMax+t.yMax,e.yMin=e.yMin+t.yMin,e):{width:t.width,xMax:t.xMax,xMin:t.xMin,height:t.height,yMax:t.yMax,yMin:t.yMin}),{});console.log(),i.width/=this.posesMV.length,i.xMax/=this.posesMV.length,i.xMin/=this.posesMV.length,i.height/=this.posesMV.length,i.yMax/=this.posesMV.length,i.yMin/=this.posesMV.length,s.singlePersonBoxMovingAverage=i}return s},this.fitCroppedArea=(e,t,n,i,r,s,a,o,c,l,u)=>{if(!e.singlePersonBoxMovingAverage)return{xmin:0,ymin:0,width:0,height:0};const d=t/i,h=n/r,f=e.singlePersonBoxMovingAverage.xMin*d,p=e.singlePersonBoxMovingAverage.xMax*d,m=e.singlePersonBoxMovingAverage.yMin*h,g=e.singlePersonBoxMovingAverage.yMax*h,v=(p+f)/2,y=(g+m)/2,b=p-v,x=g-y;let w=v-b*(1+l);w=w<0?0:w;let M=v+b*(1+u);M=M>t?t:M;let S=y-x*(1+o);S=S<0?0:S;let _=y+x*(1+c);_=_>n?n:_;const C=M-w,E=_-S,T=(M+w)/2,L=(_+S)/2,A=a/s;let z,R,P,H;return C*A>E?(z=C,R=C*A):(z=E/A,R=E),P=T-z/2<0?0:T+z/2>t?t-z:T-z/2,H=L-R/2<0?0:L+R/2>n?n-R:L-R/2,{xmin:P,ymin:H,width:z,height:R}}}}})(),s})(),e.exports=i()},698:(e,t,n)=>{"use strict";n.r(t),n.d(t,{MToonMaterial:()=>Tl,MToonMaterialCullMode:()=>wl,MToonMaterialDebugMode:()=>Ml,MToonMaterialOutlineColorMode:()=>Sl,MToonMaterialOutlineWidthMode:()=>_l,MToonMaterialRenderMode:()=>Cl,VRM:()=>Xl,VRMBlendShapeGroup:()=>Nc,VRMBlendShapeImporter:()=>qc,VRMBlendShapeProxy:()=>jc,VRMCurveMapper:()=>sl,VRMDebug:()=>du,VRMFirstPerson:()=>Jc,VRMFirstPersonImporter:()=>Zc,VRMHumanBone:()=>Qc,VRMHumanoid:()=>il,VRMHumanoidImporter:()=>rl,VRMImporter:()=>$l,VRMLookAtApplyer:()=>al,VRMLookAtBlendShapeApplyer:()=>ol,VRMLookAtBoneApplyer:()=>ml,VRMLookAtHead:()=>fl,VRMLookAtImporter:()=>vl,VRMMaterialImporter:()=>Al,VRMMetaImporter:()=>zl,VRMRendererFirstPersonFlags:()=>Yc,VRMSchema:()=>Dc,VRMSpringBone:()=>Ul,VRMSpringBoneDebug:()=>ou,VRMSpringBoneImporter:()=>ql,VRMSpringBoneImporterDebug:()=>cu,VRMSpringBoneManager:()=>Wl,VRMUnlitMaterial:()=>Ll,VRMUnlitMaterialRenderType:()=>El,VRMUtils:()=>eu,VRM_GIZMO_RENDER_ORDER:()=>uu});const i="137",r=100,s=301,a=302,o=306,c=1e3,l=1001,u=1002,d=1003,h=1006,f=1008,p=1009,m=1012,g=1014,v=1015,y=1016,b=1020,x=1023,w=1026,M=1027,S=33776,_=33777,C=33778,E=33779,T=2300,L=2301,A=2302,z=2400,R=2401,P=2402,H=3e3,k=3001,I=7680,V=35044,N=35048,D="300 es",O=1035;class F{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t>8&255]+B[e>>16&255]+B[e>>24&255]+"-"+B[255&t]+B[t>>8&255]+"-"+B[t>>16&15|64]+B[t>>24&255]+"-"+B[63&n|128]+B[n>>8&255]+"-"+B[n>>16&255]+B[n>>24&255]+B[255&i]+B[i>>8&255]+B[i>>16&255]+B[i>>24&255]).toUpperCase()}function j(e,t,n){return Math.max(t,Math.min(n,e))}function q(e,t,n){return(1-n)*e+n*t}function $(e){return 0==(e&e-1)&&0!==e}function X(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}class K{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}K.prototype.isVector2=!0;class Y{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,a,o,c){const l=this.elements;return l[0]=e,l[1]=i,l[2]=a,l[3]=t,l[4]=r,l[5]=o,l[6]=n,l[7]=s,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],a=n[3],o=n[6],c=n[1],l=n[4],u=n[7],d=n[2],h=n[5],f=n[8],p=i[0],m=i[3],g=i[6],v=i[1],y=i[4],b=i[7],x=i[2],w=i[5],M=i[8];return r[0]=s*p+a*v+o*x,r[3]=s*m+a*y+o*w,r[6]=s*g+a*b+o*M,r[1]=c*p+l*v+u*x,r[4]=c*m+l*y+u*w,r[7]=c*g+l*b+u*M,r[2]=d*p+h*v+f*x,r[5]=d*m+h*y+f*w,r[8]=d*g+h*b+f*M,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],c=e[7],l=e[8];return t*s*l-t*a*c-n*r*l+n*a*o+i*r*c-i*s*o}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],c=e[7],l=e[8],u=l*s-a*c,d=a*o-l*r,h=c*r-s*o,f=t*u+n*d+i*h;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);const p=1/f;return e[0]=u*p,e[1]=(i*c-l*n)*p,e[2]=(a*n-i*s)*p,e[3]=d*p,e[4]=(l*t-i*o)*p,e[5]=(i*r-a*t)*p,e[6]=h*p,e[7]=(n*o-c*t)*p,e[8]=(s*t-n*r)*p,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,a){const o=Math.cos(r),c=Math.sin(r);return this.set(n*o,n*c,-n*(o*s+c*a)+s+e,-i*c,i*o,-i*(-c*s+o*a)+a+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],s=i[3],a=i[6],o=i[1],c=i[4],l=i[7];return i[0]=t*r+n*o,i[3]=t*s+n*c,i[6]=t*a+n*l,i[1]=-n*r+t*o,i[4]=-n*s+t*c,i[7]=-n*a+t*l,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}function J(e){for(let t=e.length-1;t>=0;--t)if(e[t]>65535)return!0;return!1}function Z(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}Y.prototype.isMatrix3=!0,Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;const Q={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ee={h:0,s:0,l:0},te={h:0,s:0,l:0};function ne(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function ie(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function re(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class se{constructor(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=function(e,t){return(e%1+1)%1}(e),t=j(t,0,1),n=j(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=ne(r,i,e+1/3),this.g=ne(r,i,e),this.b=ne(r,i,e-1/3)}return this}setStyle(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,t(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,t(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const n=parseFloat(e[1])/360,i=parseInt(e[2],10)/100,r=parseInt(e[3],10)/100;return t(e[4]),this.setHSL(n,i,r)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=n[1],t=e.length;if(3===t)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,this;if(6===t)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=Q[e.toLowerCase()];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ie(e.r),this.g=ie(e.g),this.b=ie(e.b),this}copyLinearToSRGB(e){return this.r=re(e.r),this.g=re(e.g),this.b=re(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){const t=this.r,n=this.g,i=this.b,r=Math.max(t,n,i),s=Math.min(t,n,i);let a,o;const c=(s+r)/2;if(s===r)a=0,o=0;else{const e=r-s;switch(o=c<=.5?e/(r+s):e/(2-r-s),r){case t:a=(n-i)/e+(n2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=Z("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e1)switch(this.wrapS){case c:e.x=e.x-Math.floor(e.x);break;case l:e.x=e.x<0?0:1;break;case u:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case c:e.y=e.y-Math.floor(e.y);break;case l:e.y=e.y<0?0:1;break;case u:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&this.version++}}function ue(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?oe.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}le.DEFAULT_IMAGE=void 0,le.DEFAULT_MAPPING=300,le.prototype.isTexture=!0;class de{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const s=.01,a=.1,o=e.elements,c=o[0],l=o[4],u=o[8],d=o[1],h=o[5],f=o[9],p=o[2],m=o[6],g=o[10];if(Math.abs(l-d)o&&e>v?ev?o=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,t*n);e=Math.sin(e*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*e+d*r,c=c*e+h*r,l=l*e+f*r,u=u*e+p*r,e===1-a){const e=1/Math.sqrt(o*o+c*c+l*l+u*u);o*=e,c*=e,l*=e,u*=e}}e[t]=o,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,s){const a=n[i],o=n[i+1],c=n[i+2],l=n[i+3],u=r[s],d=r[s+1],h=r[s+2],f=r[s+3];return e[t]=a*f+l*u+o*h-c*d,e[t+1]=o*f+l*d+c*u-a*h,e[t+2]=c*f+l*h+a*d-o*u,e[t+3]=l*f-a*u-o*d-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,r=e._z,s=e._order,a=Math.cos,o=Math.sin,c=a(n/2),l=a(i/2),u=a(r/2),d=o(n/2),h=o(i/2),f=o(r/2);switch(s){case"XYZ":this._x=d*l*u+c*h*f,this._y=c*h*u-d*l*f,this._z=c*l*f+d*h*u,this._w=c*l*u-d*h*f;break;case"YXZ":this._x=d*l*u+c*h*f,this._y=c*h*u-d*l*f,this._z=c*l*f-d*h*u,this._w=c*l*u+d*h*f;break;case"ZXY":this._x=d*l*u-c*h*f,this._y=c*h*u+d*l*f,this._z=c*l*f+d*h*u,this._w=c*l*u-d*h*f;break;case"ZYX":this._x=d*l*u-c*h*f,this._y=c*h*u+d*l*f,this._z=c*l*f-d*h*u,this._w=c*l*u+d*h*f;break;case"YZX":this._x=d*l*u+c*h*f,this._y=c*h*u+d*l*f,this._z=c*l*f-d*h*u,this._w=c*l*u-d*h*f;break;case"XZY":this._x=d*l*u-c*h*f,this._y=c*h*u-d*l*f,this._z=c*l*f+d*h*u,this._w=c*l*u+d*h*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],a=t[5],o=t[9],c=t[2],l=t[6],u=t[10],d=n+a+u;if(d>0){const e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-o)*e,this._y=(r-c)*e,this._z=(s-i)*e}else if(n>a&&n>u){const e=2*Math.sqrt(1+n-a-u);this._w=(l-o)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+c)/e}else if(a>u){const e=2*Math.sqrt(1+a-n-u);this._w=(r-c)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(o+l)/e}else{const e=2*Math.sqrt(1+u-n-a);this._w=(s-i)/e,this._x=(r+c)/e,this._y=(o+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(j(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,s=e._w,a=t._x,o=t._y,c=t._z,l=t._w;return this._x=n*l+s*a+i*c-r*o,this._y=i*l+s*o+r*a-n*c,this._z=r*l+s*c+n*o-i*a,this._w=s*l-n*a-i*o-r*c,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(o),l=Math.atan2(c,a),u=Math.sin((1-t)*l)/c,d=Math.sin(t*l)/c;return this._w=s*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}pe.prototype.isQuaternion=!0;class me{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(ve.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ve.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,s=e.y,a=e.z,o=e.w,c=o*t+s*i-a*n,l=o*n+a*t-r*i,u=o*i+r*n-s*t,d=-r*t-s*n-a*i;return this.x=c*o+d*-r+l*-a-u*-s,this.y=l*o+d*-s+u*-r-c*-a,this.z=u*o+d*-a+c*-s-l*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,s=t.x,a=t.y,o=t.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ge.copy(this).projectOnVector(e),this.sub(ge)}reflect(e){return this.sub(ge.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(j(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}me.prototype.isVector3=!0;const ge=new me,ve=new pe;class ye{constructor(e=new me(1/0,1/0,1/0),t=new me(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,c=e.length;or&&(r=c),l>s&&(s=l),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,s,a),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,c=e.count;or&&(r=c),l>s&&(s=l),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,s,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,xe),xe.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Le),Ae.subVectors(this.max,Le),Me.subVectors(e.a,Le),Se.subVectors(e.b,Le),_e.subVectors(e.c,Le),Ce.subVectors(Se,Me),Ee.subVectors(_e,Se),Te.subVectors(Me,_e);let t=[0,-Ce.z,Ce.y,0,-Ee.z,Ee.y,0,-Te.z,Te.y,Ce.z,0,-Ce.x,Ee.z,0,-Ee.x,Te.z,0,-Te.x,-Ce.y,Ce.x,0,-Ee.y,Ee.x,0,-Te.y,Te.x,0];return!!Pe(t,Me,Se,_e,Ae)&&(t=[1,0,0,0,1,0,0,0,1],!!Pe(t,Me,Se,_e,Ae)&&(ze.crossVectors(Ce,Ee),t=[ze.x,ze.y,ze.z],Pe(t,Me,Se,_e,Ae)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return xe.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(xe).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(be[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),be[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),be[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),be[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),be[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),be[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),be[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),be[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(be)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}ye.prototype.isBox3=!0;const be=[new me,new me,new me,new me,new me,new me,new me,new me],xe=new me,we=new ye,Me=new me,Se=new me,_e=new me,Ce=new me,Ee=new me,Te=new me,Le=new me,Ae=new me,ze=new me,Re=new me;function Pe(e,t,n,i,r){for(let s=0,a=e.length-3;s<=a;s+=3){Re.fromArray(e,s);const a=r.x*Math.abs(Re.x)+r.y*Math.abs(Re.y)+r.z*Math.abs(Re.z),o=t.dot(Re),c=n.dot(Re),l=i.dot(Re);if(Math.max(-Math.max(o,c,l),Math.min(o,c,l))>a)return!1}return!0}const He=new ye,ke=new me,Ie=new me,Ve=new me;class Ne{constructor(e=new me,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):He.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Ve.subVectors(e,this.center);const t=Ve.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(Ve.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return!0===this.center.equals(e.center)?Ie.set(0,0,1).multiplyScalar(e.radius):Ie.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(ke.copy(e.center).add(Ie)),this.expandByPoint(ke.copy(e.center).sub(Ie)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const De=new me,Oe=new me,Fe=new me,Be=new me,Ue=new me,We=new me,Ge=new me;class je{constructor(e=new me,t=new me(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,De)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=De.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(De.copy(this.direction).multiplyScalar(t).add(this.origin),De.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Oe.copy(e).add(t).multiplyScalar(.5),Fe.copy(t).sub(e).normalize(),Be.copy(this.origin).sub(Oe);const r=.5*e.distanceTo(t),s=-this.direction.dot(Fe),a=Be.dot(this.direction),o=-Be.dot(Fe),c=Be.lengthSq(),l=Math.abs(1-s*s);let u,d,h,f;if(l>0)if(u=s*o-a,d=s*a-o,f=r*l,u>=0)if(d>=-f)if(d<=f){const e=1/l;u*=e,d*=e,h=u*(u+s*d+2*a)+d*(s*u+d+2*o)+c}else d=r,u=Math.max(0,-(s*d+a)),h=-u*u+d*(d+2*o)+c;else d=-r,u=Math.max(0,-(s*d+a)),h=-u*u+d*(d+2*o)+c;else d<=-f?(u=Math.max(0,-(-s*r+a)),d=u>0?-r:Math.min(Math.max(-r,-o),r),h=-u*u+d*(d+2*o)+c):d<=f?(u=0,d=Math.min(Math.max(-r,-o),r),h=d*(d+2*o)+c):(u=Math.max(0,-(s*r+a)),d=u>0?r:Math.min(Math.max(-r,-o),r),h=-u*u+d*(d+2*o)+c);else d=s>0?-r:r,u=Math.max(0,-(s*d+a)),h=-u*u+d*(d+2*o)+c;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(Fe).multiplyScalar(d).add(Oe),h}intersectSphere(e,t){De.subVectors(e.center,this.origin);const n=De.dot(this.direction),i=De.dot(De)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return a<0&&o<0?null:a<0?this.at(o,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,a,o;const c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),l>=0?(r=(e.min.y-d.y)*l,s=(e.max.y-d.y)*l):(r=(e.max.y-d.y)*l,s=(e.min.y-d.y)*l),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s=0?(a=(e.min.z-d.z)*u,o=(e.max.z-d.z)*u):(a=(e.max.z-d.z)*u,o=(e.min.z-d.z)*u),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,De)}intersectTriangle(e,t,n,i,r){Ue.subVectors(t,e),We.subVectors(n,e),Ge.crossVectors(Ue,We);let s,a=this.direction.dot(Ge);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}Be.subVectors(this.origin,e);const o=s*this.direction.dot(We.crossVectors(Be,We));if(o<0)return null;const c=s*this.direction.dot(Ue.cross(Be));if(c<0)return null;if(o+c>a)return null;const l=-s*Be.dot(Ge);return l<0?null:this.at(l/a,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class qe{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,a,o,c,l,u,d,h,f,p,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=h,g[7]=f,g[11]=p,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new qe).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/$e.setFromMatrixColumn(e,0).length(),r=1/$e.setFromMatrixColumn(e,1).length(),s=1/$e.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,r=e.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){const e=s*l,n=s*u,i=a*l,r=a*u;t[0]=o*l,t[4]=-o*u,t[8]=c,t[1]=n+i*c,t[5]=e-r*c,t[9]=-a*o,t[2]=r-e*c,t[6]=i+n*c,t[10]=s*o}else if("YXZ"===e.order){const e=o*l,n=o*u,i=c*l,r=c*u;t[0]=e+r*a,t[4]=i*a-n,t[8]=s*c,t[1]=s*u,t[5]=s*l,t[9]=-a,t[2]=n*a-i,t[6]=r+e*a,t[10]=s*o}else if("ZXY"===e.order){const e=o*l,n=o*u,i=c*l,r=c*u;t[0]=e-r*a,t[4]=-s*u,t[8]=i+n*a,t[1]=n+i*a,t[5]=s*l,t[9]=r-e*a,t[2]=-s*c,t[6]=a,t[10]=s*o}else if("ZYX"===e.order){const e=s*l,n=s*u,i=a*l,r=a*u;t[0]=o*l,t[4]=i*c-n,t[8]=e*c+r,t[1]=o*u,t[5]=r*c+e,t[9]=n*c-i,t[2]=-c,t[6]=a*o,t[10]=s*o}else if("YZX"===e.order){const e=s*o,n=s*c,i=a*o,r=a*c;t[0]=o*l,t[4]=r-e*u,t[8]=i*u+n,t[1]=u,t[5]=s*l,t[9]=-a*l,t[2]=-c*l,t[6]=n*u+i,t[10]=e-r*u}else if("XZY"===e.order){const e=s*o,n=s*c,i=a*o,r=a*c;t[0]=o*l,t[4]=-u,t[8]=c*l,t[1]=e*u+r,t[5]=s*l,t[9]=n*u-i,t[2]=i*u-n,t[6]=a*l,t[10]=r*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Ke,e,Ye)}lookAt(e,t,n){const i=this.elements;return Qe.subVectors(e,t),0===Qe.lengthSq()&&(Qe.z=1),Qe.normalize(),Je.crossVectors(n,Qe),0===Je.lengthSq()&&(1===Math.abs(n.z)?Qe.x+=1e-4:Qe.z+=1e-4,Qe.normalize(),Je.crossVectors(n,Qe)),Je.normalize(),Ze.crossVectors(Qe,Je),i[0]=Je.x,i[4]=Ze.x,i[8]=Qe.x,i[1]=Je.y,i[5]=Ze.y,i[9]=Qe.y,i[2]=Je.z,i[6]=Ze.z,i[10]=Qe.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],a=n[4],o=n[8],c=n[12],l=n[1],u=n[5],d=n[9],h=n[13],f=n[2],p=n[6],m=n[10],g=n[14],v=n[3],y=n[7],b=n[11],x=n[15],w=i[0],M=i[4],S=i[8],_=i[12],C=i[1],E=i[5],T=i[9],L=i[13],A=i[2],z=i[6],R=i[10],P=i[14],H=i[3],k=i[7],I=i[11],V=i[15];return r[0]=s*w+a*C+o*A+c*H,r[4]=s*M+a*E+o*z+c*k,r[8]=s*S+a*T+o*R+c*I,r[12]=s*_+a*L+o*P+c*V,r[1]=l*w+u*C+d*A+h*H,r[5]=l*M+u*E+d*z+h*k,r[9]=l*S+u*T+d*R+h*I,r[13]=l*_+u*L+d*P+h*V,r[2]=f*w+p*C+m*A+g*H,r[6]=f*M+p*E+m*z+g*k,r[10]=f*S+p*T+m*R+g*I,r[14]=f*_+p*L+m*P+g*V,r[3]=v*w+y*C+b*A+x*H,r[7]=v*M+y*E+b*z+x*k,r[11]=v*S+y*T+b*R+x*I,r[15]=v*_+y*L+b*P+x*V,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],a=e[5],o=e[9],c=e[13],l=e[2],u=e[6],d=e[10],h=e[14];return e[3]*(+r*o*u-i*c*u-r*a*d+n*c*d+i*a*h-n*o*h)+e[7]*(+t*o*h-t*c*d+r*s*d-i*s*h+i*c*l-r*o*l)+e[11]*(+t*c*u-t*a*h-r*s*u+n*s*h+r*a*l-n*c*l)+e[15]*(-i*a*l-t*o*u+t*a*d+i*s*u-n*s*d+n*o*l)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],c=e[7],l=e[8],u=e[9],d=e[10],h=e[11],f=e[12],p=e[13],m=e[14],g=e[15],v=u*m*c-p*d*c+p*o*h-a*m*h-u*o*g+a*d*g,y=f*d*c-l*m*c-f*o*h+s*m*h+l*o*g-s*d*g,b=l*p*c-f*u*c+f*a*h-s*p*h-l*a*g+s*u*g,x=f*u*o-l*p*o-f*a*d+s*p*d+l*a*m-s*u*m,w=t*v+n*y+i*b+r*x;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/w;return e[0]=v*M,e[1]=(p*d*r-u*m*r-p*i*h+n*m*h+u*i*g-n*d*g)*M,e[2]=(a*m*r-p*o*r+p*i*c-n*m*c-a*i*g+n*o*g)*M,e[3]=(u*o*r-a*d*r-u*i*c+n*d*c+a*i*h-n*o*h)*M,e[4]=y*M,e[5]=(l*m*r-f*d*r+f*i*h-t*m*h-l*i*g+t*d*g)*M,e[6]=(f*o*r-s*m*r-f*i*c+t*m*c+s*i*g-t*o*g)*M,e[7]=(s*d*r-l*o*r+l*i*c-t*d*c-s*i*h+t*o*h)*M,e[8]=b*M,e[9]=(f*u*r-l*p*r-f*n*h+t*p*h+l*n*g-t*u*g)*M,e[10]=(s*p*r-f*a*r+f*n*c-t*p*c-s*n*g+t*a*g)*M,e[11]=(l*a*r-s*u*r-l*n*c+t*u*c+s*n*h-t*a*h)*M,e[12]=x*M,e[13]=(l*p*i-f*u*i+f*n*d-t*p*d-l*n*m+t*u*m)*M,e[14]=(f*a*i-s*p*i-f*n*o+t*p*o+s*n*m-t*a*m)*M,e[15]=(s*u*i-l*a*i+l*n*o-t*u*o-s*n*d+t*a*d)*M,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,s=e.x,a=e.y,o=e.z,c=r*s,l=r*a;return this.set(c*s+n,c*a-i*o,c*o+i*a,0,c*a+i*o,l*a+n,l*o-i*s,0,c*o-i*a,l*o+i*s,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,s=t._y,a=t._z,o=t._w,c=r+r,l=s+s,u=a+a,d=r*c,h=r*l,f=r*u,p=s*l,m=s*u,g=a*u,v=o*c,y=o*l,b=o*u,x=n.x,w=n.y,M=n.z;return i[0]=(1-(p+g))*x,i[1]=(h+b)*x,i[2]=(f-y)*x,i[3]=0,i[4]=(h-b)*w,i[5]=(1-(d+g))*w,i[6]=(m+v)*w,i[7]=0,i[8]=(f+y)*M,i[9]=(m-v)*M,i[10]=(1-(d+p))*M,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=$e.set(i[0],i[1],i[2]).length();const s=$e.set(i[4],i[5],i[6]).length(),a=$e.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Xe.copy(this);const o=1/r,c=1/s,l=1/a;return Xe.elements[0]*=o,Xe.elements[1]*=o,Xe.elements[2]*=o,Xe.elements[4]*=c,Xe.elements[5]*=c,Xe.elements[6]*=c,Xe.elements[8]*=l,Xe.elements[9]*=l,Xe.elements[10]*=l,t.setFromRotationMatrix(Xe),n.x=r,n.y=s,n.z=a,this}makePerspective(e,t,n,i,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,o=2*r/(t-e),c=2*r/(n-i),l=(t+e)/(t-e),u=(n+i)/(n-i),d=-(s+r)/(s-r),h=-2*s*r/(s-r);return a[0]=o,a[4]=0,a[8]=l,a[12]=0,a[1]=0,a[5]=c,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=h,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,r,s){const a=this.elements,o=1/(t-e),c=1/(n-i),l=1/(s-r),u=(t+e)*o,d=(n+i)*c,h=(s+r)*l;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*l,a[14]=-h,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}qe.prototype.isMatrix4=!0;const $e=new me,Xe=new qe,Ke=new me(0,0,0),Ye=new me(1,1,1),Je=new me,Ze=new me,Qe=new me,et=new qe,tt=new pe;class nt{constructor(e=0,t=0,n=0,i=nt.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],s=i[4],a=i[8],o=i[1],c=i[5],l=i[9],u=i[2],d=i[6],h=i[10];switch(t){case"XYZ":this._y=Math.asin(j(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,h),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-j(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(o,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(j(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-j(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,h),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(j(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-j(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return et.makeRotationFromQuaternion(e),this.setFromRotationMatrix(et,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return tt.setFromEuler(this),this.setFromQuaternion(tt,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new me(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}nt.prototype.isEuler=!0,nt.DefaultOrder="XYZ",nt.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class it{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l)}return n.object=i,n;function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){yt.subVectors(i,t),bt.subVectors(n,t),xt.subVectors(e,t);const s=yt.dot(yt),a=yt.dot(bt),o=yt.dot(xt),c=bt.dot(bt),l=bt.dot(xt),u=s*c-a*a;if(0===u)return r.set(-2,-1,-1);const d=1/u,h=(c*o-a*l)*d,f=(s*l-a*o)*d;return r.set(1-h-f,f,h)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,wt),wt.x>=0&&wt.y>=0&&wt.x+wt.y<=1}static getUV(e,t,n,i,r,s,a,o){return this.getBarycoord(e,t,n,i,wt),o.set(0,0),o.addScaledVector(r,wt.x),o.addScaledVector(s,wt.y),o.addScaledVector(a,wt.z),o}static isFrontFacing(e,t,n,i){return yt.subVectors(n,t),bt.subVectors(e,t),yt.cross(bt).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return yt.subVectors(this.c,this.b),bt.subVectors(this.a,this.b),.5*yt.cross(bt).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Lt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Lt.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return Lt.getUV(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Lt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Lt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let s,a;Mt.subVectors(i,n),St.subVectors(r,n),Ct.subVectors(e,n);const o=Mt.dot(Ct),c=St.dot(Ct);if(o<=0&&c<=0)return t.copy(n);Et.subVectors(e,i);const l=Mt.dot(Et),u=St.dot(Et);if(l>=0&&u<=l)return t.copy(i);const d=o*u-l*c;if(d<=0&&o>=0&&l<=0)return s=o/(o-l),t.copy(n).addScaledVector(Mt,s);Tt.subVectors(e,r);const h=Mt.dot(Tt),f=St.dot(Tt);if(f>=0&&h<=f)return t.copy(r);const p=h*c-o*f;if(p<=0&&c>=0&&f<=0)return a=c/(c-f),t.copy(n).addScaledVector(St,a);const m=l*f-h*u;if(m<=0&&u-l>=0&&h-f>=0)return _t.subVectors(r,i),a=(u-l)/(u-l+(h-f)),t.copy(i).addScaledVector(_t,a);const g=1/(m+p+d);return s=p*g,a=d*g,t.copy(n).addScaledVector(Mt,s).addScaledVector(St,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let At=0;class zt extends F{constructor(){super(),Object.defineProperty(this,"id",{value:At++}),this.uuid=G(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=r,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=I,this.stencilZFail=I,this.stencilZPass=I,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}zt.prototype.isMaterial=!0;class Rt extends zt{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new se(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}Rt.prototype.isMeshBasicMaterial=!0;const Pt=new me,Ht=new K;class kt{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=V,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],s=[];for(let t=0,i=n.length;t0&&(i[t]=s,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),Xt.copy(n.boundingSphere),Xt.applyMatrix4(r),!1===e.ray.intersectsSphere(Xt))return;if(qt.copy(r).invert(),$t.copy(e.ray).applyMatrix4(qt),null!==n.boundingBox&&!1===$t.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,a=n.attributes.position,o=n.morphAttributes.position,c=n.morphTargetsRelative,l=n.attributes.uv,u=n.attributes.uv2,d=n.groups,h=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,f=d.length;nn.far?null:{distance:l,point:ln.clone(),object:e}}(e,t,n,i,Kt,Yt,Jt,cn);if(f){o&&(sn.fromBufferAttribute(o,l),an.fromBufferAttribute(o,u),on.fromBufferAttribute(o,d),f.uv=Lt.getUV(cn,Kt,Yt,Jt,sn,an,on,new K)),c&&(sn.fromBufferAttribute(c,l),an.fromBufferAttribute(c,u),on.fromBufferAttribute(c,d),f.uv2=Lt.getUV(cn,Kt,Yt,Jt,sn,an,on,new K));const e={a:l,b:u,c:d,normal:new me,materialIndex:0};Lt.getNormal(Kt,Yt,Jt,e.normal),f.face=e}return f}un.prototype.isMesh=!0;class hn extends jt{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],c=[],l=[],u=[];let d=0,h=0;function f(e,t,n,i,r,s,f,p,m,g,v){const y=s/m,b=f/g,x=s/2,w=f/2,M=p/2,S=m+1,_=g+1;let C=0,E=0;const T=new me;for(let s=0;s<_;s++){const a=s*b-w;for(let o=0;o0?1:-1,l.push(T.x,T.y,T.z),u.push(o/m),u.push(1-s/g),C+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}gn.prototype.isShaderMaterial=!0;class vn extends vt{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new qe,this.projectionMatrix=new qe,this.projectionMatrixInverse=new qe}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}vn.prototype.isCamera=!0;class yn extends vn{constructor(e=50,t=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*W*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*U*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*W*Math.atan(Math.tan(.5*U*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,s){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*U*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/a,i*=s.width/e,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}yn.prototype.isPerspectiveCamera=!0;const bn=90;class xn extends vt{constructor(e,t,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new yn(bn,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new me(1,0,0)),this.add(i);const r=new yn(bn,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new me(-1,0,0)),this.add(r);const s=new yn(bn,1,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new me(0,1,0)),this.add(s);const a=new yn(bn,1,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new me(0,-1,0)),this.add(a);const o=new yn(bn,1,e,t);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new me(0,0,1)),this.add(o);const c=new yn(bn,1,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new me(0,0,-1)),this.add(c)}update(e,t){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,a,o,c]=this.children,l=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,s),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,o),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.xr.enabled=l,n.texture.needsPMREMUpdate=!0}}class wn extends le{constructor(e,t,n,i,r,a,o,c,l,u){super(e=void 0!==e?e:[],t=void 0!==t?t:s,n,i,r,a,o,c,l,u),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}wn.prototype.isCubeTexture=!0;class Mn extends he{constructor(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),super(e,e,t),t=t||{},this.texture=new wn(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:h}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=x,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n=new hn(5,5,5),i=new gn({name:"CubemapFromEquirect",uniforms:fn({tEquirect:{value:null}}),vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",side:1,blending:0});i.uniforms.tEquirect.value=t;const r=new un(n,i),s=t.minFilter;return t.minFilter===f&&(t.minFilter=h),new xn(1,10,this).update(e,r),t.minFilter=s,r.geometry.dispose(),r.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}Mn.prototype.isWebGLCubeRenderTarget=!0;const Sn=new me,_n=new me,Cn=new Y;class En{constructor(e=new me(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Sn.subVectors(n,t).cross(_n.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(Sn),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(n).multiplyScalar(r).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Cn.getNormalMatrix(e),i=this.coplanarPoint(Sn).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}En.prototype.isPlane=!0;const Tn=new Ne,Ln=new me;class An{constructor(e=new En,t=new En,n=new En,i=new En,r=new En,s=new En){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],r=n[1],s=n[2],a=n[3],o=n[4],c=n[5],l=n[6],u=n[7],d=n[8],h=n[9],f=n[10],p=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(a-i,u-o,p-d,y-m).normalize(),t[1].setComponents(a+i,u+o,p+d,y+m).normalize(),t[2].setComponents(a+r,u+c,p+h,y+g).normalize(),t[3].setComponents(a-r,u-c,p-h,y-g).normalize(),t[4].setComponents(a-s,u-l,p-f,y-v).normalize(),t[5].setComponents(a+s,u+l,p+f,y+v).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Tn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Tn)}intersectsSprite(e){return Tn.center.set(0,0,0),Tn.radius=.7071067811865476,Tn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Tn)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,Ln.y=i.normal.y>0?e.max.y:e.min.y,Ln.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ln)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function zn(){let e=null,t=!1,n=null,i=null;function r(t,s){n(t,s),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Rn(e,t){const n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){const e=i.get(t);return void((!e||e.version 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\treturn texture2D( envMap, uv ).rgb;\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec;\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\t#else\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\t\t\t#endif\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\t\t\tfloat texelIndex = float( vertexIndex * stride + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV ).xyz;\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},kn={common:{diffuse:{value:new se(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Y},uv2Transform:{value:new Y},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new K(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new se(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new se(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Y}},sprite:{diffuse:{value:new se(16777215)},opacity:{value:1},center:{value:new K(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Y}}},In={basic:{uniforms:pn([kn.common,kn.specularmap,kn.envmap,kn.aomap,kn.lightmap,kn.fog]),vertexShader:Hn.meshbasic_vert,fragmentShader:Hn.meshbasic_frag},lambert:{uniforms:pn([kn.common,kn.specularmap,kn.envmap,kn.aomap,kn.lightmap,kn.emissivemap,kn.fog,kn.lights,{emissive:{value:new se(0)}}]),vertexShader:Hn.meshlambert_vert,fragmentShader:Hn.meshlambert_frag},phong:{uniforms:pn([kn.common,kn.specularmap,kn.envmap,kn.aomap,kn.lightmap,kn.emissivemap,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.fog,kn.lights,{emissive:{value:new se(0)},specular:{value:new se(1118481)},shininess:{value:30}}]),vertexShader:Hn.meshphong_vert,fragmentShader:Hn.meshphong_frag},standard:{uniforms:pn([kn.common,kn.envmap,kn.aomap,kn.lightmap,kn.emissivemap,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.roughnessmap,kn.metalnessmap,kn.fog,kn.lights,{emissive:{value:new se(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Hn.meshphysical_vert,fragmentShader:Hn.meshphysical_frag},toon:{uniforms:pn([kn.common,kn.aomap,kn.lightmap,kn.emissivemap,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.gradientmap,kn.fog,kn.lights,{emissive:{value:new se(0)}}]),vertexShader:Hn.meshtoon_vert,fragmentShader:Hn.meshtoon_frag},matcap:{uniforms:pn([kn.common,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.fog,{matcap:{value:null}}]),vertexShader:Hn.meshmatcap_vert,fragmentShader:Hn.meshmatcap_frag},points:{uniforms:pn([kn.points,kn.fog]),vertexShader:Hn.points_vert,fragmentShader:Hn.points_frag},dashed:{uniforms:pn([kn.common,kn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Hn.linedashed_vert,fragmentShader:Hn.linedashed_frag},depth:{uniforms:pn([kn.common,kn.displacementmap]),vertexShader:Hn.depth_vert,fragmentShader:Hn.depth_frag},normal:{uniforms:pn([kn.common,kn.bumpmap,kn.normalmap,kn.displacementmap,{opacity:{value:1}}]),vertexShader:Hn.meshnormal_vert,fragmentShader:Hn.meshnormal_frag},sprite:{uniforms:pn([kn.sprite,kn.fog]),vertexShader:Hn.sprite_vert,fragmentShader:Hn.sprite_frag},background:{uniforms:{uvTransform:{value:new Y},t2D:{value:null}},vertexShader:Hn.background_vert,fragmentShader:Hn.background_frag},cube:{uniforms:pn([kn.envmap,{opacity:{value:1}}]),vertexShader:Hn.cube_vert,fragmentShader:Hn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Hn.equirect_vert,fragmentShader:Hn.equirect_frag},distanceRGBA:{uniforms:pn([kn.common,kn.displacementmap,{referencePosition:{value:new me},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Hn.distanceRGBA_vert,fragmentShader:Hn.distanceRGBA_frag},shadow:{uniforms:pn([kn.lights,kn.fog,{color:{value:new se(0)},opacity:{value:1}}]),vertexShader:Hn.shadow_vert,fragmentShader:Hn.shadow_frag}};function Vn(e,t,n,i,r,s){const a=new se(0);let c,l,u=!0===r?0:1,d=null,h=0,f=null;function p(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,s)}return{getClearColor:function(){return a},setClearColor:function(e,t=1){a.set(e),u=t,p(a,u)},getClearAlpha:function(){return u},setClearAlpha:function(e){u=e,p(a,u)},render:function(n,r){let s=!1,m=!0===r.isScene?r.background:null;m&&m.isTexture&&(m=t.get(m));const g=e.xr,v=g.getSession&&g.getSession();v&&"additive"===v.environmentBlendMode&&(m=null),null===m?p(a,u):m&&m.isColor&&(p(m,1),s=!0),(e.autoClear||s)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.mapping===o)?(void 0===l&&(l=new un(new hn(1,1,1),new gn({name:"BackgroundCubeMaterial",uniforms:fn(In.cube.uniforms),vertexShader:In.cube.vertexShader,fragmentShader:In.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=m,l.material.uniforms.flipEnvMap.value=m.isCubeTexture&&!1===m.isRenderTargetTexture?-1:1,d===m&&h===m.version&&f===e.toneMapping||(l.material.needsUpdate=!0,d=m,h=m.version,f=e.toneMapping),n.unshift(l,l.geometry,l.material,0,0,null)):m&&m.isTexture&&(void 0===c&&(c=new un(new Pn(2,2),new gn({name:"BackgroundMaterial",uniforms:fn(In.background.uniforms),vertexShader:In.background.vertexShader,fragmentShader:In.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),c.material.uniforms.uvTransform.value.copy(m.matrix),d===m&&h===m.version&&f===e.toneMapping||(c.material.needsUpdate=!0,d=m,h=m.version,f=e.toneMapping),n.unshift(c,c.geometry,c.material,0,0,null))}}}function Nn(e,t,n,i){const r=e.getParameter(34921),s=i.isWebGL2?null:t.get("OES_vertex_array_object"),a=i.isWebGL2||null!==s,o={},c=h(null);let l=c;function u(t){return i.isWebGL2?e.bindVertexArray(t):s.bindVertexArrayOES(t)}function d(t){return i.isWebGL2?e.deleteVertexArray(t):s.deleteVertexArrayOES(t)}function h(e){const t=[],n=[],i=[];for(let e=0;e=0){let s=c[t];if(void 0===s&&("instanceMatrix"===t&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===t&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const t=s.normalized,a=s.itemSize,c=n.get(s);if(void 0===c)continue;const l=c.buffer,u=c.type,d=c.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,c=n.stride,h=s.offset;if(n&&n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let a=void 0!==n.precision?n.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const c=s||t.has("WEBGL_draw_buffers"),l=!0===n.logarithmicDepthBuffer,u=e.getParameter(34930),d=e.getParameter(35660),h=e.getParameter(3379),f=e.getParameter(34076),p=e.getParameter(34921),m=e.getParameter(36347),g=e.getParameter(36348),v=e.getParameter(36349),y=d>0,b=s||t.has("OES_texture_float");return{isWebGL2:s,drawBuffers:c,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:d,maxTextureSize:h,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:y&&b,maxSamples:s?e.getParameter(36183):0}}function Fn(e){const t=this;let n=null,i=0,r=!1,s=!1;const a=new En,o=new Y,c={value:null,needsUpdate:!1};function l(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function u(e,n,i,r){const s=null!==e?e.length:0;let l=null;if(0!==s){if(l=c.value,!0!==r||null===l){const t=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===l||l.length0){const a=new Mn(s.height/2);return a.fromEquirectangularTexture(e,r),t.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}In.physical={uniforms:pn([In.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new K(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new se(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new K},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new se(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new se(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Hn.meshphysical_vert,fragmentShader:Hn.meshphysical_frag};class Un extends vn{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,a=i+t,o=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,a-=t*this.view.offsetY,o=a-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}Un.prototype.isOrthographicCamera=!0;class Wn extends gn{constructor(e){super(e),this.type="RawShaderMaterial"}}Wn.prototype.isRawShaderMaterial=!0;const Gn=Math.pow(2,8),jn=[.125,.215,.35,.446,.526,.582],qn=5+jn.length,$n=new Un,{_lodPlanes:Xn,_sizeLods:Kn,_sigmas:Yn}=function(){const e=[],t=[],n=[];let i=8;for(let r=0;r4?a=jn[r-8+4-1]:0===r&&(a=0),n.push(a);const o=1/(s-1),c=-o/2,l=1+o/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],d=6,h=6,f=3,p=2,m=1,g=new Float32Array(f*h*d),v=new Float32Array(p*h*d),y=new Float32Array(m*h*d);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];g.set(i,f*h*e),v.set(u,p*h*e);const r=[e,e,e,e,e,e];y.set(r,m*h*e)}const b=new jt;b.setAttribute("position",new kt(g,f)),b.setAttribute("uv",new kt(v,p)),b.setAttribute("faceIndex",new kt(y,m)),e.push(b),i>4&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}(),Jn=new se;let Zn=null;const Qn=(1+Math.sqrt(5))/2,ei=1/Qn,ti=[new me(1,1,1),new me(-1,1,1),new me(1,1,-1),new me(-1,1,-1),new me(0,Qn,ei),new me(0,Qn,-ei),new me(ei,0,Qn),new me(-ei,0,Qn),new me(Qn,ei,0),new me(-Qn,ei,0)];class ni{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=function(e){const t=new Float32Array(20),n=new me(0,1,0);return new Wn({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Zn=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=ai(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=si(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let e=0;e2?Gn:0,Gn,Gn),o.setRenderTarget(i),h&&o.render(d,r),o.render(e,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=l,o.autoClear=c,e.background=f}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===s||e.mapping===a;i?(null===this._cubemapShader&&(this._cubemapShader=ai()),this._cubemapShader.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectShader&&(this._equirectShader=si());const r=i?this._cubemapShader:this._equirectShader,o=new un(Xn[0],r),c=r.uniforms;c.envMap.value=e,i||c.texelSize.value.set(1/e.image.width,1/e.image.height),ri(t,0,0,3*Gn,2*Gn),n.setRenderTarget(t),n.render(o,$n)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;t20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to 20`);const m=[];let g=0;for(let e=0;e<20;++e){const t=e/f,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:e4?i-8+4:0),3*v,2*v),o.setRenderTarget(t),o.render(l,$n)}}function ii(e){const t=new he(3*Gn,3*Gn,e);return t.texture.mapping=o,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function ri(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function si(){const e=new K(1,1);return new Wn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:e}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = texture2D ( envMap, uv ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function ai(){return new Wn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function oi(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const o=r.mapping,c=303===o||304===o,l=o===s||o===a;if(c||l){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=t.get(r);return null===n&&(n=new ni(e)),i=c?n.fromEquirectangular(r,i):n.fromCubemap(r,i),t.set(r,i),i.texture}if(t.has(r))return t.get(r).texture;{const s=r.image;if(c&&s&&s.height>0||l&&s&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(s)){null===n&&(n=new ni(e));const s=c?n.fromEquirectangular(r):n.fromCubemap(r);return t.set(r,s),r.addEventListener("dispose",i),s.texture}return null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function ci(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){const t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function li(e,t,n,i){const r={},s=new WeakMap;function a(e){const o=e.target;null!==o.index&&t.remove(o.index);for(const e in o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",a),delete r[o.id];const c=s.get(o);c&&(t.remove(c),s.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){const n=[],i=e.index,r=e.attributes.position;let a=0;if(null!==i){const e=i.array;a=i.version;for(let t=0,i=e.length;tt.maxTextureSize&&(_=Math.ceil(S/t.maxTextureSize),S=t.maxTextureSize);const C=new Float32Array(S*_*4*f),E=new hi(C,S,_,f);E.format=x,E.type=v,E.needsUpdate=!0;const T=4*M;for(let A=0;A0)return e;const r=t*n;let s=Si[r];if(void 0===s&&(s=new Float32Array(r),Si[r]=s),0!==t){i.toArray(s,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(s,r)}return s}function Ai(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n/gm;function Pr(e){return e.replace(Rr,Hr)}function Hr(e,t){const n=Hn[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Pr(n)}const kr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ir=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Vr(e){return e.replace(Ir,Dr).replace(kr,Nr)}function Nr(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Dr(0,t,n,i)}function Dr(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(y+="\n"),b=[m,g].filter(Lr).join("\n"),b.length>0&&(b+="\n")):(y=[Or(n),"#define SHADER_NAME "+n.shaderName,g,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Lr).join("\n"),b=[m,Or(n),"#define SHADER_NAME "+n.shaderName,g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+f:"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Hn.tonemapping_pars_fragment:"",0!==n.toneMapping?Tr("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.transparent?"":"#define OPAQUE",Hn.encodings_pars_fragment,Er("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Lr).join("\n")),l=Pr(l),l=Ar(l,n),l=zr(l,n),u=Pr(u),u=Ar(u,n),u=zr(u,n),l=Vr(l),u=Vr(u),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(x="#version 300 es\n",y=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,b=["#define varying in",n.glslVersion===D?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===D?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+b);const w=x+b+u,M=Sr(r,35633,x+y+l),S=Sr(r,35632,w);if(r.attachShader(v,M),r.attachShader(v,S),void 0!==n.index0AttributeName?r.bindAttribLocation(v,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v),e.debug.checkShaderErrors){const e=r.getProgramInfoLog(v).trim(),t=r.getShaderInfoLog(M).trim(),n=r.getShaderInfoLog(S).trim();let i=!0,s=!0;if(!1===r.getProgramParameter(v,35714)){i=!1;const t=Cr(r,M,"vertex"),n=Cr(r,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,35715)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+n)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==t&&""!==n||(s=!1);s&&(this.diagnostics={runnable:i,programLog:e,vertexShader:{log:t,prefix:y},fragmentShader:{log:n,prefix:b}})}let _,C;return r.deleteShader(M),r.deleteShader(S),this.getUniforms=function(){return void 0===_&&(_=new Mr(r,v)),_},this.getAttributes=function(){return void 0===C&&(C=function(e,t){const n={},i=e.getProgramParameter(t,35721);for(let r=0;r0,R=s.clearcoat>0;return{isWebGL2:d,shaderID:S,shaderName:s.type,vertexShader:C,fragmentShader:E,defines:s.defines,customVertexShaderID:T,customFragmentShaderID:L,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:g,instancing:!0===b.isInstancedMesh,instancingColor:!0===b.isInstancedMesh&&null!==b.instanceColor,supportsVertexTextures:m,outputEncoding:null===A?e.outputEncoding:!0===A.isXRRenderTarget?A.texture.encoding:H,map:!!s.map,matcap:!!s.matcap,envMap:!!M,envMapMode:M&&M.mapping,envMapCubeUV:!!M&&(M.mapping===o||307===M.mapping),lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:1===s.normalMapType,tangentSpaceNormalMap:0===s.normalMapType,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&s.map.encoding===k,clearcoat:R,clearcoatMap:R&&!!s.clearcoatMap,clearcoatRoughnessMap:R&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:R&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,transparent:s.transparent,alphaMap:!!s.alphaMap,alphaTest:z,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!b.geometry&&!!b.geometry.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!b.geometry&&!!b.geometry.attributes.color&&4===b.geometry.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!x,useFog:s.fog,fogExp2:x&&x.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===b.isSkinnedMesh&&_>0,maxBones:_,useVertexTexture:f,morphTargets:!!b.geometry&&!!b.geometry.morphAttributes.position,morphNormals:!!b.geometry&&!!b.geometry.morphAttributes.normal,morphTargetsCount:b.geometry&&b.geometry.morphAttributes.position?b.geometry.morphAttributes.position.length:0,numDirLights:c.directional.length,numPointLights:c.point.length,numSpotLights:c.spot.length,numRectAreaLights:c.rectArea.length,numHemiLights:c.hemi.length,numDirLightShadows:c.directionalShadowMap.length,numPointLightShadows:c.pointShadowMap.length,numSpotLightShadows:c.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:s.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,depthPacking:void 0!==s.depthPacking&&s.depthPacking,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:d||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.maxBones),e.push(t.morphTargetsCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection)}(n,t),function(e,t){c.disableAll(),t.isWebGL2&&c.enable(0),t.supportsVertexTextures&&c.enable(1),t.instancing&&c.enable(2),t.instancingColor&&c.enable(3),t.map&&c.enable(4),t.matcap&&c.enable(5),t.envMap&&c.enable(6),t.envMapCubeUV&&c.enable(7),t.lightMap&&c.enable(8),t.aoMap&&c.enable(9),t.emissiveMap&&c.enable(10),t.bumpMap&&c.enable(11),t.normalMap&&c.enable(12),t.objectSpaceNormalMap&&c.enable(13),t.tangentSpaceNormalMap&&c.enable(14),t.clearcoat&&c.enable(15),t.clearcoatMap&&c.enable(16),t.clearcoatRoughnessMap&&c.enable(17),t.clearcoatNormalMap&&c.enable(18),t.displacementMap&&c.enable(19),t.specularMap&&c.enable(20),t.roughnessMap&&c.enable(21),t.metalnessMap&&c.enable(22),t.gradientMap&&c.enable(23),t.alphaMap&&c.enable(24),t.alphaTest&&c.enable(25),t.vertexColors&&c.enable(26),t.vertexAlphas&&c.enable(27),t.vertexUvs&&c.enable(28),t.vertexTangents&&c.enable(29),t.uvsVertexOnly&&c.enable(30),t.fog&&c.enable(31),e.push(c.mask),c.disableAll(),t.useFog&&c.enable(0),t.flatShading&&c.enable(1),t.logarithmicDepthBuffer&&c.enable(2),t.skinning&&c.enable(3),t.useVertexTexture&&c.enable(4),t.morphTargets&&c.enable(5),t.morphNormals&&c.enable(6),t.premultipliedAlpha&&c.enable(7),t.shadowMapEnabled&&c.enable(8),t.physicallyCorrectLights&&c.enable(9),t.doubleSided&&c.enable(10),t.flipSided&&c.enable(11),t.depthPacking&&c.enable(12),t.dithering&&c.enable(13),t.specularIntensityMap&&c.enable(14),t.specularColorMap&&c.enable(15),t.transmission&&c.enable(16),t.transmissionMap&&c.enable(17),t.thicknessMap&&c.enable(18),t.sheen&&c.enable(19),t.sheenColorMap&&c.enable(20),t.sheenRoughnessMap&&c.enable(21),t.decodeVideoTexture&&c.enable(22),t.transparent&&c.enable(23),e.push(c.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=v[e.type];let n;if(t){const e=In[t];n=mn.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=u.length;e0?i.push(u):!0===a.transparent?r.push(u):n.push(u)},unshift:function(e,t,a,o,c,l){const u=s(e,t,a,o,c,l);a.transmission>0?i.unshift(u):!0===a.transparent?r.unshift(u):n.unshift(u)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||qr),i.length>1&&i.sort(t||$r),r.length>1&&r.sort(t||$r)}}}function Kr(){let e=new WeakMap;return{get:function(t,n){let i;return!1===e.has(t)?(i=new Xr,e.set(t,[i])):n>=e.get(t).length?(i=new Xr,e.get(t).push(i)):i=e.get(t)[n],i},dispose:function(){e=new WeakMap}}}function Yr(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new me,color:new se};break;case"SpotLight":n={position:new me,direction:new me,color:new se,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new me,color:new se,distance:0,decay:0};break;case"HemisphereLight":n={direction:new me,skyColor:new se,groundColor:new se};break;case"RectAreaLight":n={color:new se,position:new me,halfWidth:new me,halfHeight:new me}}return e[t.id]=n,n}}}let Jr=0;function Zr(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Qr(e,t){const n=new Yr,i=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new K,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let e=0;e<9;e++)r.probe.push(new me);const s=new me,a=new qe,o=new qe;return{setup:function(s,a){let o=0,c=0,l=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let u=0,d=0,h=0,f=0,p=0,m=0,g=0,v=0;s.sort(Zr);const y=!0!==a?Math.PI:1;for(let e=0,t=s.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=kn.LTC_FLOAT_1,r.rectAreaLTC2=kn.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=kn.LTC_HALF_1,r.rectAreaLTC2=kn.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=c,r.ambient[2]=l;const b=r.hash;b.directionalLength===u&&b.pointLength===d&&b.spotLength===h&&b.rectAreaLength===f&&b.hemiLength===p&&b.numDirectionalShadows===m&&b.numPointShadows===g&&b.numSpotShadows===v||(r.directional.length=u,r.spot.length=h,r.rectArea.length=f,r.point.length=d,r.hemi.length=p,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=v,b.directionalLength=u,b.pointLength=d,b.spotLength=h,b.rectAreaLength=f,b.hemiLength=p,b.numDirectionalShadows=m,b.numPointShadows=g,b.numSpotShadows=v,r.version=Jr++)},setupView:function(e,t){let n=0,i=0,c=0,l=0,u=0;const d=t.matrixWorldInverse;for(let t=0,h=e.length;t=n.get(i).length?(s=new es(e,t),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class ns extends zt{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}ns.prototype.isMeshDepthMaterial=!0;class is extends zt{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new me,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function rs(e,t,n){let i=new An;const r=new K,s=new K,a=new de,o=new ns({depthPacking:3201}),c=new is,l={},u=n.maxTextureSize,f={0:1,1:0,2:2},p=new gn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new K},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const g=new jt;g.setAttribute("position",new kt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new un(g,p),y=this;function b(n,i){const r=t.update(v);p.defines.VSM_SAMPLES!==n.blurSamples&&(p.defines.VSM_SAMPLES=n.blurSamples,m.defines.VSM_SAMPLES=n.blurSamples,p.needsUpdate=!0,m.needsUpdate=!0),p.uniforms.shadow_pass.value=n.map.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,p,v,null),m.uniforms.shadow_pass.value=n.mapPass.texture,m.uniforms.resolution.value=n.mapSize,m.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,m,v,null)}function w(t,n,i,r,s,a,u){let d=null;const h=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(d=void 0!==h?h:!0===r.isPointLight?c:o,e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0){const e=d.uuid,t=i.uuid;let n=l[e];void 0===n&&(n={},l[e]=n);let r=n[t];void 0===r&&(r=d.clone(),n[t]=r),d=r}return d.visible=i.visible,d.wireframe=i.wireframe,d.side=3===u?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:f[i.side],d.alphaMap=i.alphaMap,d.alphaTest=i.alphaTest,d.clipShadows=i.clipShadows,d.clippingPlanes=i.clippingPlanes,d.clipIntersection=i.clipIntersection,d.displacementMap=i.displacementMap,d.displacementScale=i.displacementScale,d.displacementBias=i.displacementBias,d.wireframeLinewidth=i.wireframeLinewidth,d.linewidth=i.linewidth,!0===r.isPointLight&&!0===d.isMeshDistanceMaterial&&(d.referencePosition.setFromMatrixPosition(r.matrixWorld),d.nearDistance=s,d.farDistance=a),d}function M(n,r,s,a,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=t.update(n),r=n.material;if(Array.isArray(r)){const t=i.groups;for(let c=0,l=t.length;cu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/m.x),r.x=s.x*m.x,f.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/m.y),r.y=s.y*m.y,f.mapSize.y=s.y)),null===f.map&&!f.isPointLightShadow&&3===this.type){const e={minFilter:h,magFilter:h,format:x};f.map=new he(r.x,r.y,e),f.map.texture.name=l.name+".shadowMap",f.mapPass=new he(r.x,r.y,e),f.camera.updateProjectionMatrix()}if(null===f.map){const e={minFilter:d,magFilter:d,format:x};f.map=new he(r.x,r.y,e),f.map.texture.name=l.name+".shadowMap",f.camera.updateProjectionMatrix()}e.setRenderTarget(f.map),e.clear();const g=f.getViewportCount();for(let e=0;e=1):-1!==z.indexOf("OpenGL ES")&&(A=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),L=A>=2);let R=null,P={};const H=e.getParameter(3088),k=e.getParameter(2978),I=(new de).fromArray(H),V=(new de).fromArray(k);function N(t,n,i){const r=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(let t=0;ti||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const i=t?X:Math.floor,s=i(r*e.width),a=i(r*e.height);void 0===A&&(A=R(s,a));const o=n?R(s,a):A;return o.width=s,o.height=a,o.getContext("2d").drawImage(e,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+a+")."),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function I(e){return $(e.width)&&$(e.height)}function V(e,t){return e.generateMipmaps&&t&&e.minFilter!==d&&e.minFilter!==h}function N(t){e.generateMipmap(t)}function D(n,i,r,s,a=!1){if(!1===o)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let c=i;return 6403===i&&(5126===r&&(c=33326),5131===r&&(c=33325),5121===r&&(c=33321)),33319===i&&(5126===r&&(c=33328),5131===r&&(c=33327),5121===r&&(c=33323)),6408===i&&(5126===r&&(c=34836),5131===r&&(c=34842),5121===r&&(c=s===k&&!1===a?35907:32856),32819===r&&(c=32854),32820===r&&(c=32855)),33325!==c&&33326!==c&&33327!==c&&33328!==c&&34842!==c&&34836!==c||t.get("EXT_color_buffer_float"),c}function F(e,t,n){return!0===V(e,n)||e.isFramebufferTexture&&e.minFilter!==d&&e.minFilter!==h?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function B(e){return e===d||1004===e||1005===e?9728:9729}function U(t){const n=t.target;n.removeEventListener("dispose",U),function(t){const n=i.get(t);void 0!==n.__webglInit&&(e.deleteTexture(n.__webglTexture),i.remove(t))}(n),n.isVideoTexture&&L.delete(n),a.memory.textures--}function W(t){const n=t.target;n.removeEventListener("dispose",W),function(t){const n=t.texture,r=i.get(t),s=i.get(n);if(t){if(void 0!==s.__webglTexture&&(e.deleteTexture(s.__webglTexture),a.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(r.__webglFramebuffer[t]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[t]);else e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&e.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(let t=0,r=n.length;t0&&r.__version!==e.version){const n=e.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void ee(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function q(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?function(t,i,r){if(6!==i.image.length)return;Q(t,i),n.activeTexture(33984+r),n.bindTexture(34067,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const a=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),c=i.image[0]&&i.image[0].isDataTexture,l=[];for(let e=0;e<6;e++)l[e]=a||c?c?i.image[e].image:i.image[e]:P(i.image[e],!1,!0,_),l[e]=se(i,l[e]);const u=l[0],d=I(u)||o,h=s.convert(i.format,i.encoding),f=s.convert(i.type),p=D(i.internalFormat,h,f,i.encoding),m=o&&!0!==i.isVideoTexture,g=void 0===t.__version;let v,y=F(i,u,d);if(J(34067,i,d),a){m&&g&&n.texStorage2D(34067,y,p,u.width,u.height);for(let e=0;e<6;e++){v=l[e].mipmaps;for(let t=0;t0&&y++,n.texStorage2D(34067,y,p,l[0].width,l[0].height));for(let e=0;e<6;e++)if(c){m?n.texSubImage2D(34069+e,0,0,0,l[e].width,l[e].height,h,f,l[e].data):n.texImage2D(34069+e,0,p,l[e].width,l[e].height,0,h,f,l[e].data);for(let t=0;t1||i.get(s).__currentAnisotropy)&&(e.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function Q(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",U),t.__webglTexture=e.createTexture(),a.memory.textures++)}function ee(t,i,r){let a=3553;i.isDataTexture2DArray&&(a=35866),i.isDataTexture3D&&(a=32879),Q(t,i),n.activeTexture(33984+r),n.bindTexture(a,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);const c=function(e){return!o&&(e.wrapS!==l||e.wrapT!==l||e.minFilter!==d&&e.minFilter!==h)}(i)&&!1===I(i.image);let u=P(i.image,c,!1,C);u=se(i,u);const f=I(u)||o,p=s.convert(i.format,i.encoding);let y,S=s.convert(i.type),_=D(i.internalFormat,p,S,i.encoding,i.isVideoTexture);J(a,i,f);const E=i.mipmaps,T=o&&!0!==i.isVideoTexture,L=void 0===t.__version,A=F(i,u,f);if(i.isDepthTexture)_=6402,o?_=i.type===v?36012:i.type===g?33190:i.type===b?35056:33189:i.type===v&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===w&&6402===_&&i.type!==m&&i.type!==g&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=m,S=s.convert(i.type)),i.format===M&&6402===_&&(_=34041,i.type!==b&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=b,S=s.convert(i.type))),T&&L?n.texStorage2D(3553,1,_,u.width,u.height):n.texImage2D(3553,0,_,u.width,u.height,0,p,S,null);else if(i.isDataTexture)if(E.length>0&&f){T&&L&&n.texStorage2D(3553,A,_,E[0].width,E[0].height);for(let e=0,t=E.length;e0&&f){T&&L&&n.texStorage2D(3553,A,_,E[0].width,E[0].height);for(let e=0,t=E.length;e=S&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+S),G+=1,e},this.resetTextureUnits=function(){G=0},this.setTexture2D=j,this.setTexture2DArray=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?ee(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){const r=i.get(e);e.version>0&&r.__version!==e.version?ee(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=q,this.rebindTextures=function(e,t,n){const r=i.get(e);void 0!==t&&te(r.__webglFramebuffer,e,e.texture,36064,3553),void 0!==n&&ie(e)},this.setupRenderTarget=function(t){const c=t.texture,l=i.get(t),u=i.get(c);t.addEventListener("dispose",W),!0!==t.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=e.createTexture()),u.__version=c.version,a.memory.textures++);const d=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultipleRenderTargets,f=c.isDataTexture3D||c.isDataTexture2DArray,p=I(t)||o;if(d){l.__webglFramebuffer=[];for(let t=0;t<6;t++)l.__webglFramebuffer[t]=e.createFramebuffer()}else if(l.__webglFramebuffer=e.createFramebuffer(),h)if(r.drawBuffers){const n=t.texture;for(let t=0,r=n.length;to+l?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&a<=o-l&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==c&&(c.visible=null!==s),this}}class hs extends le{constructor(e,t,n,i,r,s,a,o,c,l){if((l=void 0!==l?l:w)!==w&&l!==M)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===w&&(n=m),void 0===n&&l===M&&(n=b),super(null,i,r,s,a,o,l,n,c),this.image={width:e,height:t},this.magFilter=void 0!==a?a:d,this.minFilter=void 0!==o?o:d,this.flipY=!1,this.generateMipmaps=!1}}hs.prototype.isDepthTexture=!0;class fs extends F{constructor(e,t){super();const n=this;let i=null,r=1,s=null,a="local-floor";const o=e.extensions.has("WEBGL_multisampled_render_to_texture");let c=null,l=null,u=null,d=null,h=!1,f=null;const g=t.getContextAttributes();let v=null,y=null;const S=[],_=new Map,C=new yn;C.layers.enable(1),C.viewport=new de;const E=new yn;E.layers.enable(2),E.viewport=new de;const T=[C,E],L=new cs;L.layers.enable(1),L.layers.enable(2);let A=null,z=null;function R(e){const t=_.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function P(){_.forEach((function(e,t){e.disconnect(t)})),_.clear(),A=null,z=null,e.setRenderTarget(v),d=null,u=null,l=null,i=null,y=null,O.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function H(e){const t=i.inputSources;for(let e=0;e0&&(t.alphaTest.value=n.alphaTest);const i=e.get(n).envMap;let r,s;i&&(t.envMap.value=i,t.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,t.reflectivity.value=n.reflectivity,t.ior.value=n.ior,t.refractionRatio.value=n.refractionRatio),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap?r=n.clearcoatRoughnessMap:n.specularIntensityMap?r=n.specularIntensityMap:n.specularColorMap?r=n.specularColorMap:n.transmissionMap?r=n.transmissionMap:n.thicknessMap?r=n.thicknessMap:n.sheenColorMap?r=n.sheenColorMap:n.sheenRoughnessMap&&(r=n.sheenRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix)),n.aoMap?s=n.aoMap:n.lightMap&&(s=n.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),t.uv2Transform.value.copy(s.matrix))}function n(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap),n.bumpMap&&(t.bumpMap.value=n.bumpMap,t.bumpScale.value=n.bumpScale,1===n.side&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,t.normalScale.value.copy(n.normalScale),1===n.side&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias),e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,r,s,a){i.isMeshBasicMaterial?t(e,i):i.isMeshLambertMaterial?(t(e,i),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,i)):i.isMeshToonMaterial?(t(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshPhongMaterial?(t(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshStandardMaterial?(t(e,i),i.isMeshPhysicalMaterial?function(e,t,i){n(e,t),e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap)),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate())),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,i,a):n(e,i)):i.isMeshMatcapMaterial?(t(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDepthMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDistanceMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?(t(e,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){let r;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?r=t.map:t.alphaMap&&(r=t.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,r,s):i.isSpriteMaterial?function(e,t){let n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function ms(e={}){const t=void 0!==e.canvas?e.canvas:function(){const e=Z("canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,s=void 0===e.stencil||e.stencil,a=void 0!==e.antialias&&e.antialias,o=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,u=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let m=null,g=null;const b=[],w=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=H,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const M=this;let S=!1,_=0,C=0,E=null,T=-1,L=null;const A=new de,z=new de;let R=null,P=t.width,k=t.height,I=1,V=null,N=null;const D=new de(0,0,P,k),O=new de(0,0,P,k);let F=!1;const B=new An;let U=!1,W=!1,G=null;const j=new qe,q=new me,$={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function X(){return null===E?I:1}let K,Y,J,Q,ee,te,ne,ie,re,se,ae,oe,ce,le,ue,pe,ge,ve,ye,be,xe,we,Me,Se=n;function _e(e,n){for(let i=0;i0&&function(e,t,n){if(null===G){const e=!0===a&&!0===Y.isWebGL2;G=new(e?fe:he)(1024,1024,{generateMipmaps:!0,type:null!==we.convert(y)?y:p,minFilter:f,magFilter:d,wrapS:l,wrapT:l,useRenderToTexture:K.has("WEBGL_multisampled_render_to_texture")})}const i=M.getRenderTarget();M.setRenderTarget(G),M.clear();const r=M.toneMapping;M.toneMapping=0,Ve(e,t,n),M.toneMapping=r,te.updateMultisampleRenderTarget(G),te.updateRenderTargetMipmap(G),M.setRenderTarget(i)}(r,t,n),i&&J.viewport(A.copy(i)),r.length>0&&Ve(r,t,n),s.length>0&&Ve(s,t,n),o.length>0&&Ve(o,t,n)}function Ve(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r0?w[w.length-1]:null,b.pop(),m=b.length>0?b[b.length-1]:null},this.getActiveCubeFace=function(){return _},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return E},this.setRenderTargetTextures=function(e,t,n){ee.get(e.texture).__webglTexture=t,ee.get(e.depthTexture).__webglTexture=n;const i=ee.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||e.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),e.useRenderToTexture=!1,e.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(e,t){const n=ee.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){E=e,_=t,C=n;let i=!0;if(e){const t=ee.get(e);void 0!==t.__useDefaultFramebuffer?(J.bindFramebuffer(36160,null),i=!1):void 0===t.__webglFramebuffer?te.setupRenderTarget(e):t.__hasExternalTextures&&te.rebindTextures(e,ee.get(e.texture).__webglTexture,ee.get(e.depthTexture).__webglTexture)}let r=null,s=!1,a=!1;if(e){const n=e.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(a=!0);const i=ee.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=i[t],s=!0):r=e.useRenderbuffer?ee.get(e).__webglMultisampledFramebuffer:i,A.copy(e.viewport),z.copy(e.scissor),R=e.scissorTest}else A.copy(D).multiplyScalar(I).floor(),z.copy(O).multiplyScalar(I).floor(),R=F;if(J.bindFramebuffer(36160,r)&&Y.drawBuffers&&i&&J.drawBuffers(e,r),J.viewport(A),J.scissor(z),J.setScissorTest(R),s){const i=ee.get(e.texture);Se.framebufferTexture2D(36160,36064,34069+t,i.__webglTexture,n)}else if(a){const i=ee.get(e.texture),r=t||0;Se.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}T=-1},this.readRenderTargetPixels=function(e,t,n,i,r,s,a){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ee.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){J.bindFramebuffer(36160,o);try{const a=e.texture,o=a.format,c=a.type;if(o!==x&&we.convert(o)!==Se.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const l=c===y&&(K.has("EXT_color_buffer_half_float")||Y.isWebGL2&&K.has("EXT_color_buffer_float"));if(!(c===p||we.convert(c)===Se.getParameter(35738)||c===v&&(Y.isWebGL2||K.has("OES_texture_float")||K.has("WEBGL_color_buffer_float"))||l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===Se.checkFramebufferStatus(36160)?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&Se.readPixels(t,n,i,r,we.convert(o),we.convert(c),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const e=null!==E?ee.get(E).__webglFramebuffer:null;J.bindFramebuffer(36160,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){if(!0!==t.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i);te.setTexture2D(t,0),Se.copyTexSubImage2D(3553,n,0,0,e.x,e.y,r,s),J.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){const r=t.image.width,s=t.image.height,a=we.convert(n.format),o=we.convert(n.type);te.setTexture2D(n,0),Se.pixelStorei(37440,n.flipY),Se.pixelStorei(37441,n.premultiplyAlpha),Se.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?Se.texSubImage2D(3553,i,e.x,e.y,r,s,a,o,t.image.data):t.isCompressedTexture?Se.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,a,t.mipmaps[0].data):Se.texSubImage2D(3553,i,e.x,e.y,a,o,t.image),0===i&&n.generateMipmaps&&Se.generateMipmap(3553),J.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,r=0){if(M.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=e.max.x-e.min.x+1,a=e.max.y-e.min.y+1,o=e.max.z-e.min.z+1,c=we.convert(i.format),l=we.convert(i.type);let u;if(i.isDataTexture3D)te.setTexture3D(i,0),u=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");te.setTexture2DArray(i,0),u=35866}Se.pixelStorei(37440,i.flipY),Se.pixelStorei(37441,i.premultiplyAlpha),Se.pixelStorei(3317,i.unpackAlignment);const d=Se.getParameter(3314),h=Se.getParameter(32878),f=Se.getParameter(3316),p=Se.getParameter(3315),m=Se.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;Se.pixelStorei(3314,g.width),Se.pixelStorei(32878,g.height),Se.pixelStorei(3316,e.min.x),Se.pixelStorei(3315,e.min.y),Se.pixelStorei(32877,e.min.z),n.isDataTexture||n.isDataTexture3D?Se.texSubImage3D(u,r,t.x,t.y,t.z,s,a,o,c,l,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Se.compressedTexSubImage3D(u,r,t.x,t.y,t.z,s,a,o,c,g.data)):Se.texSubImage3D(u,r,t.x,t.y,t.z,s,a,o,c,l,g),Se.pixelStorei(3314,d),Se.pixelStorei(32878,h),Se.pixelStorei(3316,f),Se.pixelStorei(3315,p),Se.pixelStorei(32877,m),0===r&&i.generateMipmaps&&Se.generateMipmap(u),J.unbindTexture()},this.initTexture=function(e){te.setTexture2D(e,0),J.unbindTexture()},this.resetState=function(){_=0,C=0,E=null,J.reset(),Me.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}ms.prototype.isWebGLRenderer=!0,class extends ms{}.prototype.isWebGL1Renderer=!0;class gs{constructor(e,t=25e-5){this.name="",this.color=new se(e),this.density=t}clone(){return new gs(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}gs.prototype.isFogExp2=!0;class vs{constructor(e,t=1,n=1e3){this.name="",this.color=new se(e),this.near=t,this.far=n}clone(){return new vs(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}vs.prototype.isFog=!0;class ys extends vt{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}ys.prototype.isScene=!0;class bs{constructor(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=V,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=G()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;ie.far||t.push({distance:o,point:_s.clone(),uv:Lt.getUV(_s,zs,Rs,Ps,Hs,ks,Is,new K),face:null,object:this})}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}).prototype.isSprite=!0;const Ns=new me,Ds=new de,Os=new de,Fs=new me,Bs=new qe;class Us extends un{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new qe,this.bindMatrixInverse=new qe}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new de,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;no)continue;d.applyMatrix4(this.matrixWorld);const h=e.ray.origin.distanceTo(d);he.far||t.push({distance:h,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}else for(let n=Math.max(0,s.start),i=Math.min(r.count,s.start+s.count)-1;no)continue;d.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(d);ie.far||t.push({distance:i,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}sa.prototype.isLine=!0;const aa=new me,oa=new me;class ca extends sa{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;er.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,object:a})}}(class extends vt{constructor(e=new jt,t=new la){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),ha.copy(n.boundingSphere),ha.applyMatrix4(i),ha.radius+=r,!1===e.ray.intersectsSphere(ha))return;ua.copy(i).invert(),da.copy(e.ray).applyMatrix4(ua);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){const r=n.index,a=n.attributes.position;if(null!==r)for(let n=Math.max(0,s.start),c=Math.min(r.count,s.start+s.count);n0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}).prototype.isPoints=!0,class extends le{constructor(e,t,n,i,r,s,a,o,c){super(e,t,n,i,r,s,a,o,c),this.minFilter=void 0!==s?s:h,this.magFilter=void 0!==r?r:h,this.generateMipmaps=!1;const l=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){l.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;0=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}.prototype.isVideoTexture=!0,class extends le{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=d,this.minFilter=d,this.generateMipmaps=!1,this.needsUpdate=!0}}.prototype.isFramebufferTexture=!0,class extends le{constructor(e,t,n,i,r,s,a,o,c,l,u,d){super(null,s,a,o,c,l,i,r,u,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}.prototype.isCompressedTexture=!0,class extends le{constructor(e,t,n,i,r,s,a,o,c){super(e,t,n,i,r,s,a,o,c),this.needsUpdate=!0}}.prototype.isCanvasTexture=!0;class ma extends jt{constructor(e=1,t=1,n=1,i=8,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};const c=this;i=Math.floor(i),r=Math.floor(r);const l=[],u=[],d=[],h=[];let f=0;const p=[],m=n/2;let g=0;function v(n){const r=f,s=new K,p=new me;let v=0;const y=!0===n?e:t,b=!0===n?1:-1;for(let e=1;e<=i;e++)u.push(0,m*b,0),d.push(0,b,0),h.push(.5,.5),f++;const x=f;for(let e=0;e<=i;e++){const t=e/i*o+a,n=Math.cos(t),r=Math.sin(t);p.x=y*r,p.y=m*b,p.z=y*n,u.push(p.x,p.y,p.z),d.push(0,b,0),s.x=.5*n+.5,s.y=.5*r*b+.5,h.push(s.x,s.y),f++}for(let e=0;e0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute("position",new Nt(u,3)),this.setAttribute("normal",new Nt(d,3)),this.setAttribute("uv",new Nt(h,2))}static fromJSON(e){return new ma(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}new me,new me,new me,new Lt;class ga{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let s;s=t||e*n[r-1];let a,o=0,c=r-1;for(;o<=c;)if(i=Math.floor(o+(c-o)/2),a=n[i]-s,a<0)o=i+1;else{if(!(a>0)){c=i;break}c=i-1}if(i=c,n[i]===s)return i/(r-1);const l=n[i];return(i+(s-l)/(n[i+1]-l))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=t||(s.isVector2?new K:new me);return o.copy(a).sub(s).normalize(),o}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new me,i=[],r=[],s=[],a=new me,o=new qe;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new me)}r[0]=new me,s[0]=new me;let c=Number.MAX_VALUE;const l=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),a.crossVectors(i[t-1],i[t]),a.length()>Number.EPSILON){a.normalize();const e=Math.acos(j(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(a,e))}s[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(j(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],t*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class va extends ga{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(e,t){const n=t||new K,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(c)/r)+1)*r:0===l&&c===r-1&&(c=r-2,l=1),this.closed||c>0?a=i[(c-1)%r]:(xa.subVectors(i[0],i[1]).add(i[0]),a=xa);const u=i[c%r],d=i[(c+1)%r];if(this.closed||c+2i.length-2?i.length-1:s+1],u=i[s>i.length-3?i.length-1:s+2];return n.set(Ca(a,o.x,c.x,l.x,u.x),Ca(a,o.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const e=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-e/a;return s.getPointAt(o,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);const l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Na extends Va{constructor(e){super(e),this.uuid=G(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n0)for(s=t;s=t;s-=i)a=so(s,e[s],e[s+1],a);return a&&Qa(a,a.next)&&(ao(a),a=a.next),a}function Oa(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!Qa(i,i.next)&&0!==Za(i.prev,i,i.next))i=i.next;else{if(ao(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function Fa(e,t,n,i,r,s,a){if(!e)return;!a&&s&&function(e,t,n,i){let r=e;do{null===r.z&&(r.z=Xa(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,s,a,o,c,l=1;do{for(n=e,e=null,s=null,a=0;n;){for(a++,i=n,o=0,t=0;t0||c>0&&i;)0!==o&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,c--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,l*=2}while(a>1)}(r)}(e,i,r,s);let o,c,l=e;for(;e.prev!==e.next;)if(o=e.prev,c=e.next,s?Ua(e,i,r,s):Ba(e))t.push(o.i/n),t.push(e.i/n),t.push(c.i/n),ao(e),e=c.next,l=c.next;else if((e=c)===l){a?1===a?Fa(e=Wa(Oa(e),t,n),t,n,i,r,s,2):2===a&&Ga(e,t,n,i,r,s):Fa(Oa(e),t,n,i,r,s,1);break}}function Ba(e){const t=e.prev,n=e,i=e.next;if(Za(t,n,i)>=0)return!1;let r=e.next.next;for(;r!==e.prev;){if(Ya(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&Za(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Ua(e,t,n,i){const r=e.prev,s=e,a=e.next;if(Za(r,s,a)>=0)return!1;const o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,u=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,d=Xa(o,c,t,n,i),h=Xa(l,u,t,n,i);let f=e.prevZ,p=e.nextZ;for(;f&&f.z>=d&&p&&p.z<=h;){if(f!==e.prev&&f!==e.next&&Ya(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&Za(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,p!==e.prev&&p!==e.next&&Ya(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&Za(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;f&&f.z>=d;){if(f!==e.prev&&f!==e.next&&Ya(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&Za(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;p&&p.z<=h;){if(p!==e.prev&&p!==e.next&&Ya(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&Za(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Wa(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!Qa(r,s)&&eo(r,i,i.next,s)&&io(r,s)&&io(s,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(s.i/n),ao(i),ao(i.next),i=e=s),i=i.next}while(i!==e);return Oa(i)}function Ga(e,t,n,i,r,s){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&Ja(a,e)){let o=ro(a,e);return a=Oa(a,a.next),o=Oa(o,o.next),Fa(a,t,n,i,r,s),void Fa(o,t,n,i,r,s)}e=e.next}a=a.next}while(a!==e)}function ja(e,t){return e.x-t.x}function qa(e,t){if(t=function(e,t){let n=t;const i=e.x,r=e.y;let s,a=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const e=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>a){if(a=e,e===i){if(r===n.y)return n;if(r===n.next.y)return n.next}s=n.x=n.x&&n.x>=c&&i!==n.x&&Ya(rs.x||n.x===s.x&&$a(s,n)))&&(s=n,d=u)),n=n.next}while(n!==o);return s}(e,t),t){const n=ro(t,e);Oa(t,t.next),Oa(n,n.next)}}function $a(e,t){return Za(e.prev,e,t.prev)<0&&Za(t.next,e,e.next)<0}function Xa(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Ka(e){let t=e,n=e;do{(t.x=0&&(e-a)*(i-o)-(n-a)*(t-o)>=0&&(n-a)*(s-o)-(r-a)*(i-o)>=0}function Ja(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&eo(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(io(e,t)&&io(t,e)&&function(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(Za(e.prev,e,t.prev)||Za(e,t.prev,t))||Qa(e,t)&&Za(e.prev,e,e.next)>0&&Za(t.prev,t,t.next)>0)}function Za(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Qa(e,t){return e.x===t.x&&e.y===t.y}function eo(e,t,n,i){const r=no(Za(e,t,n)),s=no(Za(e,t,i)),a=no(Za(n,i,e)),o=no(Za(n,i,t));return r!==s&&a!==o||!(0!==r||!to(e,n,t))||!(0!==s||!to(e,i,t))||!(0!==a||!to(n,e,i))||!(0!==o||!to(n,t,i))}function to(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function no(e){return e>0?1:e<0?-1:0}function io(e,t){return Za(e.prev,e,e.next)<0?Za(e,t,e.next)>=0&&Za(e,e.prev,t)>=0:Za(e,t,e.prev)<0||Za(e,e.next,t)<0}function ro(e,t){const n=new oo(e.i,e.x,e.y),i=new oo(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function so(e,t,n,i){const r=new oo(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function ao(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function oo(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class co{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r80*n){o=l=e[0],c=u=e[1];for(let t=n;tl&&(l=d),h>u&&(u=h);f=Math.max(l-o,u-c),f=0!==f?1/f:0}return Fa(s,a,n,o,c,f),a}(n,i);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function uo(e,t){for(let n=0;nNumber.EPSILON){const d=Math.sqrt(u),h=Math.sqrt(c*c+l*l),f=t.x-o/d,p=t.y+a/d,m=((n.x-l/h-f)*l-(n.y+c/h-p)*c)/(a*l-o*c);i=f+a*m-e.x,r=p+o*m-e.y;const g=i*i+r*r;if(g<=2)return new K(i,r);s=Math.sqrt(g/2)}else{let e=!1;a>Number.EPSILON?c>Number.EPSILON&&(e=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(l)&&(e=!0),e?(i=-o,r=a,s=Math.sqrt(u)):(i=a,r=o,s=Math.sqrt(u/2))}return new K(i/s,r/s)}const R=[];for(let e=0,t=E.length,n=t-1,i=e+1;e=0;e--){const t=e/f,n=u*Math.cos(t*Math.PI/2),i=d*Math.sin(t*Math.PI/2)+h;for(let e=0,t=E.length;e=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=o+2*f;e0)&&h.push(t,r,c),(e!==n-1||o0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}.prototype.isMeshPhysicalMaterial=!0,class extends zt{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new se(16777215),this.specular=new se(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new se(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}.prototype.isMeshPhongMaterial=!0,class extends zt{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new se(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new se(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}.prototype.isMeshToonMaterial=!0,class extends zt{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}.prototype.isMeshNormalMaterial=!0,class extends zt{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new se(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new se(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}.prototype.isMeshLambertMaterial=!0,class extends zt{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new se(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new K(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this}}.prototype.isMeshMatcapMaterial=!0,class extends Qs{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}.prototype.isLineDashedMaterial=!0;const vo={arraySlice:function(e,t,n){return vo.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*t;for(let n=0;n!==t;++n)r[a++]=e[i+n]}return r},flattenJSON:function(e,t,n,i){let r=1,s=e[0];for(;void 0!==s&&void 0===s[i];)s=e[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(t.push(s.time),n.push.apply(n,a)),s=e[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(t.push(s.time),a.toArray(n,n.length)),s=e[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(t.push(s.time),n.push(a)),s=e[r++]}while(void 0!==s)},subclip:function(e,t,n,i,r=30){const s=e.clone();s.name=t;const a=[];for(let e=0;e=i)){c.push(t.times[e]);for(let n=0;ns.tracks[e].times[0]&&(o=s.tracks[e].times[0]);for(let e=0;e=i.times[d]){const e=d*c+o,t=e+c-o;h=vo.arraySlice(i.values,e,t)}else{const e=i.createInterpolant(),t=o,n=c-o;e.evaluate(s),h=vo.arraySlice(e.resultBuffer,t,n)}"quaternion"===r&&(new pe).fromArray(h).normalize().conjugate().toArray(h);const f=a.times.length;for(let e=0;e=r)break e;{const a=t[1];e=r)break t}s=n,n=0}}for(;n>>1;et;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const e=this.getValueSize();this.times=vo.arraySlice(n,r,s),this.values=vo.arraySlice(this.values,r*e,s*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,s),e=!1;break}s=i}if(void 0!==i&&vo.isTypedArray(i))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=vo.arraySlice(this.times),t=vo.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===A,r=e.length-1;let s=1;for(let a=1;a0){e[s]=e[r];for(let e=r*n,i=s*n,a=0;a!==n;++a)t[i+a]=t[e+a];++s}return s!==e.length?(this.times=vo.arraySlice(e,0,s),this.values=vo.arraySlice(t,0,s*n)):(this.times=e,this.values=t),this}clone(){const e=vo.arraySlice(this.times,0),t=vo.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}Mo.prototype.TimeBufferType=Float32Array,Mo.prototype.ValueBufferType=Float32Array,Mo.prototype.DefaultInterpolation=L;class So extends Mo{}So.prototype.ValueTypeName="bool",So.prototype.ValueBufferType=Array,So.prototype.DefaultInterpolation=T,So.prototype.InterpolantFactoryMethodLinear=void 0,So.prototype.InterpolantFactoryMethodSmooth=void 0;class _o extends Mo{}_o.prototype.ValueTypeName="color";class Co extends Mo{}Co.prototype.ValueTypeName="number";class Eo extends yo{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-t)/(i-t);let c=e*a;for(let e=c+a;c!==e;c+=4)pe.slerpFlat(r,0,s,c-a,s,c,o);return r}}class To extends Mo{InterpolantFactoryMethodLinear(e){return new Eo(this.times,this.values,this.getValueSize(),e)}}To.prototype.ValueTypeName="quaternion",To.prototype.DefaultInterpolation=L,To.prototype.InterpolantFactoryMethodSmooth=void 0;class Lo extends Mo{}Lo.prototype.ValueTypeName="string",Lo.prototype.ValueBufferType=Array,Lo.prototype.DefaultInterpolation=T,Lo.prototype.InterpolantFactoryMethodLinear=void 0,Lo.prototype.InterpolantFactoryMethodSmooth=void 0;class Ao extends Mo{}Ao.prototype.ValueTypeName="vector";class zo{constructor(e,t=-1,n,i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=G(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(Ro(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(Mo.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let e=0;e1){const e=s[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const s=[];for(const e in i)s.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const s=[],a=[];vo.flattenJSON(n,s,a,i),0!==s.length&&r.push(new e(t,s,a))}},i=[],r=e.name||"default",s=e.fps||30,a=e.blendMode;let o=e.length||-1;const c=e.hierarchy||[];for(let e=0;e{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==Io[e])return void Io[e].push({onLoad:t,onProgress:n,onError:i});Io[e]=[],Io[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body.getReader)return t;const n=Io[e],i=t.body.getReader(),r=t.headers.get("Content-Length"),s=r?parseInt(r):0,a=0!==s;let o=0;const c=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let e=0,t=n.length;e{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,a)));case"json":return e.json();default:if(void 0===a)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(a),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{Po.add(e,t);const n=Io[e];delete Io[e];for(let e=0,i=n.length;e{const n=Io[e];if(void 0===n)throw this.manager.itemError(e),t;delete Io[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class No extends ko{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=Po.get(e);if(void 0!==s)return r.manager.itemStart(e),setTimeout((function(){t&&t(s),r.manager.itemEnd(e)}),0),s;const a=Z("img");function o(){l(),Po.add(e,this),t&&t(this),r.manager.itemEnd(e)}function c(t){l(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function l(){a.removeEventListener("load",o,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",c,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class Do extends ko{constructor(e){super(e)}load(e,t,n,i){const r=new wn,s=new No(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let a=0;function o(n){s.load(e[n],(function(e){r.images[n]=e,a++,6===a&&(r.needsUpdate=!0,t&&t(r))}),void 0,i)}for(let t=0;t0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n,r=i;e!==r;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){pe.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;pe.multiplyQuaternionsFlat(e,s,e,t,e,n),pe.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=t+a;e[r]=e[r]*s+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]+e[n+s]*i}}}const nc=new RegExp("[\\[\\]\\.:\\/]","g"),ic="[^\\[\\]\\.:\\/]",rc="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",sc=/((?:WC+[\/:])*)/.source.replace("WC",ic),ac=/(WCOD+)?/.source.replace("WCOD",rc),oc=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ic),cc=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ic),lc=new RegExp("^"+sc+ac+oc+cc+"$"),uc=["material","materials","bones"];class dc{constructor(e,t,n){this.path=t,this.parsedPath=n||dc.parseTrackName(t),this.node=dc.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new dc.Composite(e,t,n):new dc(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(nc,"")}static parseTrackName(e){const t=lc.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==uc.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i0){const e=this._interpolants,t=this._propertyBindings;if(2501===this.blendMode)for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(a);else for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,a)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=2202===n;if(0===e)return-1===r?i:s&&1==(1&r)?t-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===a){const t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&1==(1&r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=R,i.endingEnd=R):(i.endingStart=e?this.zeroSlopeAtStart?R:z:P,i.endingEnd=t?this.zeroSlopeAtEnd?R:z:P)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=t,a[1]=r+e,o[1]=n,this}}(class extends F{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,a=e._interpolants,o=n.uuid,c=this._bindingsByRootAndName;let l=c[o];void 0===l&&(l={},c[o]=l);for(let e=0;e!==r;++e){const r=i[e],c=r.name;let u=l[c];if(void 0!==u)++u.referenceCount,s[e]=u;else{if(u=s[e],void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,c));continue}const i=t&&t._propertyBindings[e].binding.parsedPath;u=new tc(dc.create(n,c,i),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,o,c),s[e]=u}a[e].resultBuffer=u.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let a=0;a!==n;++a)t[a]._update(i,e,r,s);const a=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)a[e].apply(s);return this}setTime(e){this.time=0;for(let e=0;ethis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return pc.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}mc.prototype.isBox2=!0;const gc=new me,vc=new qe,yc=new qe;class bc extends ca{constructor(e){const t=xc(e),n=new jt,i=[],r=[],s=new se(0,0,1),a=new se(0,1,0);for(let e=0;e.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Sc.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Sc,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}const Tc=new Float32Array(1);function Lc(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))}function Ac(e){Object.keys(e).forEach((t=>{const n=e[t];(null==n?void 0:n.isTexture)&&n.dispose()})),e.dispose()}function zc(e){const t=e.geometry;t&&t.dispose();const n=e.material;n&&(Array.isArray(n)?n.forEach((e=>Ac(e))):n&&Ac(n))}var Rc,Pc;new Int32Array(Tc.buffer),ga.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(ga.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Va.prototype.fromPoints=function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)},class extends ca{constructor(e=10,t=10,n=4473924,i=8947848){n=new se(n),i=new se(i);const r=t/2,s=e/t,a=e/2,o=[],c=[];for(let e=0,l=0,u=-a;e<=t;e++,u+=s){o.push(-a,0,u,a,0,u),o.push(u,0,-a,u,0,a);const t=e===r?n:i;t.toArray(c,l),l+=3,t.toArray(c,l),l+=3,t.toArray(c,l),l+=3,t.toArray(c,l),l+=3}const l=new jt;l.setAttribute("position",new Nt(o,3)),l.setAttribute("color",new Nt(c,3)),super(l,new Qs({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},bc.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},ko.prototype.extractUrlBase=function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),class{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e{t.meshes.forEach((n=>{n.morphTargetInfluences&&(n.morphTargetInfluences[t.morphTargetIndex]+=e*t.weight)}))})),this._materialValues.forEach((t=>{if(void 0!==t.material[t.propertyName]){if(t.type===Rc.NUMBER){const n=t.deltaValue;t.material[t.propertyName]+=n*e}else if(t.type===Rc.VECTOR2){const n=t.deltaValue;t.material[t.propertyName].add(Hc.copy(n).multiplyScalar(e))}else if(t.type===Rc.VECTOR3){const n=t.deltaValue;t.material[t.propertyName].add(kc.copy(n).multiplyScalar(e))}else if(t.type===Rc.VECTOR4){const n=t.deltaValue;t.material[t.propertyName].add(Ic.copy(n).multiplyScalar(e))}else if(t.type===Rc.COLOR){const n=t.deltaValue;t.material[t.propertyName].add(Vc.copy(n).multiplyScalar(e))}"boolean"==typeof t.material.shouldApplyUniforms&&(t.material.shouldApplyUniforms=!0)}}))}clearAppliedWeight(){this._binds.forEach((e=>{e.meshes.forEach((t=>{t.morphTargetInfluences&&(t.morphTargetInfluences[e.morphTargetIndex]=0)}))})),this._materialValues.forEach((e=>{if(void 0!==e.material[e.propertyName]){if(e.type===Rc.NUMBER){const t=e.defaultValue;e.material[e.propertyName]=t}else if(e.type===Rc.VECTOR2){const t=e.defaultValue;e.material[e.propertyName].copy(t)}else if(e.type===Rc.VECTOR3){const t=e.defaultValue;e.material[e.propertyName].copy(t)}else if(e.type===Rc.VECTOR4){const t=e.defaultValue;e.material[e.propertyName].copy(t)}else if(e.type===Rc.COLOR){const t=e.defaultValue;e.material[e.propertyName].copy(t)}"boolean"==typeof e.material.shouldApplyUniforms&&(e.material.shouldApplyUniforms=!0)}}))}}var Dc;function Oc(e,t,n){const i=e.parser.json.nodes[t].mesh;if(null==i)return null;const r=e.parser.json.meshes[i].primitives.length,s=[];return n.traverse((e=>{s.length{const r=Oc(e,i,t);null!=r&&n.set(i,r)})),n}))}function Bc(e){return"_"!==e[0]?(console.warn(`renameMaterialProperty: Given property name "${e}" might be invalid`),e):(e=e.substring(1),/[A-Z]/.test(e[0])?e[0].toLowerCase()+e.substring(1):(console.warn(`renameMaterialProperty: Given property name "${e}" might be invalid`),e))}!function(e){var t,n,i,r,s,a;(t=e.BlendShapePresetName||(e.BlendShapePresetName={})).A="a",t.Angry="angry",t.Blink="blink",t.BlinkL="blink_l",t.BlinkR="blink_r",t.E="e",t.Fun="fun",t.I="i",t.Joy="joy",t.Lookdown="lookdown",t.Lookleft="lookleft",t.Lookright="lookright",t.Lookup="lookup",t.Neutral="neutral",t.O="o",t.Sorrow="sorrow",t.U="u",t.Unknown="unknown",(n=e.FirstPersonLookAtTypeName||(e.FirstPersonLookAtTypeName={})).BlendShape="BlendShape",n.Bone="Bone",(i=e.HumanoidBoneName||(e.HumanoidBoneName={})).Chest="chest",i.Head="head",i.Hips="hips",i.Jaw="jaw",i.LeftEye="leftEye",i.LeftFoot="leftFoot",i.LeftHand="leftHand",i.LeftIndexDistal="leftIndexDistal",i.LeftIndexIntermediate="leftIndexIntermediate",i.LeftIndexProximal="leftIndexProximal",i.LeftLittleDistal="leftLittleDistal",i.LeftLittleIntermediate="leftLittleIntermediate",i.LeftLittleProximal="leftLittleProximal",i.LeftLowerArm="leftLowerArm",i.LeftLowerLeg="leftLowerLeg",i.LeftMiddleDistal="leftMiddleDistal",i.LeftMiddleIntermediate="leftMiddleIntermediate",i.LeftMiddleProximal="leftMiddleProximal",i.LeftRingDistal="leftRingDistal",i.LeftRingIntermediate="leftRingIntermediate",i.LeftRingProximal="leftRingProximal",i.LeftShoulder="leftShoulder",i.LeftThumbDistal="leftThumbDistal",i.LeftThumbIntermediate="leftThumbIntermediate",i.LeftThumbProximal="leftThumbProximal",i.LeftToes="leftToes",i.LeftUpperArm="leftUpperArm",i.LeftUpperLeg="leftUpperLeg",i.Neck="neck",i.RightEye="rightEye",i.RightFoot="rightFoot",i.RightHand="rightHand",i.RightIndexDistal="rightIndexDistal",i.RightIndexIntermediate="rightIndexIntermediate",i.RightIndexProximal="rightIndexProximal",i.RightLittleDistal="rightLittleDistal",i.RightLittleIntermediate="rightLittleIntermediate",i.RightLittleProximal="rightLittleProximal",i.RightLowerArm="rightLowerArm",i.RightLowerLeg="rightLowerLeg",i.RightMiddleDistal="rightMiddleDistal",i.RightMiddleIntermediate="rightMiddleIntermediate",i.RightMiddleProximal="rightMiddleProximal",i.RightRingDistal="rightRingDistal",i.RightRingIntermediate="rightRingIntermediate",i.RightRingProximal="rightRingProximal",i.RightShoulder="rightShoulder",i.RightThumbDistal="rightThumbDistal",i.RightThumbIntermediate="rightThumbIntermediate",i.RightThumbProximal="rightThumbProximal",i.RightToes="rightToes",i.RightUpperArm="rightUpperArm",i.RightUpperLeg="rightUpperLeg",i.Spine="spine",i.UpperChest="upperChest",(r=e.MetaAllowedUserName||(e.MetaAllowedUserName={})).Everyone="Everyone",r.ExplicitlyLicensedPerson="ExplicitlyLicensedPerson",r.OnlyAuthor="OnlyAuthor",(s=e.MetaUssageName||(e.MetaUssageName={})).Allow="Allow",s.Disallow="Disallow",(a=e.MetaLicenseName||(e.MetaLicenseName={})).Cc0="CC0",a.CcBy="CC_BY",a.CcByNc="CC_BY_NC",a.CcByNcNd="CC_BY_NC_ND",a.CcByNcSa="CC_BY_NC_SA",a.CcByNd="CC_BY_ND",a.CcBySa="CC_BY_SA",a.Other="Other",a.RedistributionProhibited="Redistribution_Prohibited"}(Dc||(Dc={}));const Uc=new me,Wc=new me;function Gc(e,t){return e.matrixWorld.decompose(Uc,t,Wc),t}new pe;class jc{constructor(){this._blendShapeGroups={},this._blendShapePresetMap={},this._unknownGroupNames=[]}get expressions(){return Object.keys(this._blendShapeGroups)}get blendShapePresetMap(){return this._blendShapePresetMap}get unknownGroupNames(){return this._unknownGroupNames}getBlendShapeGroup(e){const t=this._blendShapePresetMap[e],n=t?this._blendShapeGroups[t]:this._blendShapeGroups[e];if(n)return n;console.warn(`no blend shape found by ${e}`)}registerBlendShapeGroup(e,t,n){this._blendShapeGroups[e]=n,t?this._blendShapePresetMap[t]=e:this._unknownGroupNames.push(e)}getValue(e){var t;const n=this.getBlendShapeGroup(e);return null!==(t=null==n?void 0:n.weight)&&void 0!==t?t:null}setValue(e,t){const n=this.getBlendShapeGroup(e);var i;n&&(n.weight=(i=t,Math.max(Math.min(i,1),0)))}getBlendShapeTrackName(e){const t=this.getBlendShapeGroup(e);return t?`${t.name}.weight`:null}update(){Object.keys(this._blendShapeGroups).forEach((e=>{this._blendShapeGroups[e].clearAppliedWeight()})),Object.keys(this._blendShapeGroups).forEach((e=>{this._blendShapeGroups[e].applyWeight()}))}}class qc{import(e){var t;return Lc(this,void 0,void 0,(function*(){const n=null===(t=e.parser.json.extensions)||void 0===t?void 0:t.VRM;if(!n)return null;const i=n.blendShapeMaster;if(!i)return null;const r=new jc,s=i.blendShapeGroups;if(!s)return r;const a={};return yield Promise.all(s.map((t=>Lc(this,void 0,void 0,(function*(){const n=t.name;if(void 0===n)return void console.warn("VRMBlendShapeImporter: One of blendShapeGroups has no name");let i;t.presetName&&t.presetName!==Dc.BlendShapePresetName.Unknown&&!a[t.presetName]&&(i=t.presetName,a[t.presetName]=n);const s=new Nc(n);e.scene.add(s),s.isBinary=t.isBinary||!1,t.binds&&t.binds.forEach((n=>Lc(this,void 0,void 0,(function*(){if(void 0===n.mesh||void 0===n.index)return;const i=[];e.parser.json.nodes.forEach(((e,t)=>{e.mesh===n.mesh&&i.push(t)}));const r=n.index;yield Promise.all(i.map((i=>Lc(this,void 0,void 0,(function*(){var a;const o=yield function(e,t){return Lc(this,void 0,void 0,(function*(){const n=yield e.parser.getDependency("node",t);return Oc(e,t,n)}))}(e,i);o.every((e=>Array.isArray(e.morphTargetInfluences)&&r{if(void 0===t.materialName||void 0===t.propertyName||void 0===t.targetValue)return;const n=[];e.scene.traverse((e=>{if(e.material){const i=e.material;Array.isArray(i)?n.push(...i.filter((e=>e.name===t.materialName&&-1===n.indexOf(e)))):i.name===t.materialName&&-1===n.indexOf(i)&&n.push(i)}})),n.forEach((e=>{s.addMaterialValue({material:e,propertyName:Bc(t.propertyName),targetValue:t.targetValue})}))})),r.registerBlendShapeGroup(n,i,s)}))))),r}))}}const $c=Object.freeze(new me(0,0,-1)),Xc=new pe;var Kc;!function(e){e[e.Auto=0]="Auto",e[e.Both=1]="Both",e[e.ThirdPersonOnly=2]="ThirdPersonOnly",e[e.FirstPersonOnly=3]="FirstPersonOnly"}(Kc||(Kc={}));class Yc{constructor(e,t){this.firstPersonFlag=Yc._parseFirstPersonFlag(e),this.primitives=t}static _parseFirstPersonFlag(e){switch(e){case"Both":return Kc.Both;case"ThirdPersonOnly":return Kc.ThirdPersonOnly;case"FirstPersonOnly":return Kc.FirstPersonOnly;default:return Kc.Auto}}}class Jc{constructor(e,t,n){this._meshAnnotations=[],this._firstPersonOnlyLayer=Jc._DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Jc._DEFAULT_THIRDPERSON_ONLY_LAYER,this._initialized=!1,this._firstPersonBone=e,this._firstPersonBoneOffset=t,this._meshAnnotations=n}get firstPersonBone(){return this._firstPersonBone}get meshAnnotations(){return this._meshAnnotations}getFirstPersonWorldDirection(e){return e.copy($c).applyQuaternion(Gc(this._firstPersonBone,Xc))}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}getFirstPersonBoneOffset(e){return e.copy(this._firstPersonBoneOffset)}getFirstPersonWorldPosition(e){const t=this._firstPersonBoneOffset,n=new de(t.x,t.y,t.z,1);return n.applyMatrix4(this._firstPersonBone.matrixWorld),e.set(n.x,n.y,n.z)}setup({firstPersonOnlyLayer:e=Jc._DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=Jc._DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initialized||(this._initialized=!0,this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=t,this._meshAnnotations.forEach((e=>{e.firstPersonFlag===Kc.FirstPersonOnly?e.primitives.forEach((e=>{e.layers.set(this._firstPersonOnlyLayer)})):e.firstPersonFlag===Kc.ThirdPersonOnly?e.primitives.forEach((e=>{e.layers.set(this._thirdPersonOnlyLayer)})):e.firstPersonFlag===Kc.Auto&&this._createHeadlessModel(e.primitives)})))}_excludeTriangles(e,t,n,i){let r=0;if(null!=t&&t.length>0)for(let s=0;s0&&i.includes(u[0]))continue;if(l[1]>0&&i.includes(u[1]))continue;if(l[2]>0&&i.includes(u[2]))continue;if(l[3]>0&&i.includes(u[3]))continue;const d=t[o],h=n[o];if(d[0]>0&&i.includes(h[0]))continue;if(d[1]>0&&i.includes(h[1]))continue;if(d[2]>0&&i.includes(h[2]))continue;if(d[3]>0&&i.includes(h[3]))continue;const f=t[c],p=n[c];f[0]>0&&i.includes(p[0])||f[1]>0&&i.includes(p[1])||f[2]>0&&i.includes(p[2])||f[3]>0&&i.includes(p[3])||(e[r++]=a,e[r++]=o,e[r++]=c)}return r}_createErasedMesh(e,t){const n=new Us(e.geometry.clone(),e.material);n.name=`${e.name}(erase)`,n.frustumCulled=e.frustumCulled,n.layers.set(this._firstPersonOnlyLayer);const i=n.geometry,r=i.getAttribute("skinIndex").array,s=[];for(let e=0;e{this._isEraseTarget(e)&&n.push(t)})),!n.length)return t.layers.enable(this._thirdPersonOnlyLayer),void t.layers.enable(this._firstPersonOnlyLayer);t.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(t,n);e.add(i)}_createHeadlessModel(e){e.forEach((e=>{if("SkinnedMesh"===e.type){const t=e;this._createHeadlessModelForSkinnedMesh(t.parent,t)}else this._isEraseTarget(e)&&e.layers.set(this._thirdPersonOnlyLayer)}))}_isEraseTarget(e){return e===this._firstPersonBone||!!e.parent&&this._isEraseTarget(e.parent)}}Jc._DEFAULT_FIRSTPERSON_ONLY_LAYER=9,Jc._DEFAULT_THIRDPERSON_ONLY_LAYER=10;class Zc{import(e,t){var n;return Lc(this,void 0,void 0,(function*(){const i=null===(n=e.parser.json.extensions)||void 0===n?void 0:n.VRM;if(!i)return null;const r=i.firstPerson;if(!r)return null;const s=r.firstPersonBone;let a;if(a=void 0===s||-1===s?t.getBoneNode(Dc.HumanoidBoneName.Head):yield e.parser.getDependency("node",s),!a)return console.warn("VRMFirstPersonImporter: Could not find firstPersonBone of the VRM"),null;const o=r.firstPersonBoneOffset?new me(r.firstPersonBoneOffset.x,r.firstPersonBoneOffset.y,-r.firstPersonBoneOffset.z):new me(0,.06,0),c=[],l=yield Fc(e);return Array.from(l.entries()).forEach((([t,n])=>{const i=e.parser.json.nodes[t],s=r.meshAnnotations?r.meshAnnotations.find((e=>e.mesh===i.mesh)):void 0;c.push(new Yc(null==s?void 0:s.firstPersonFlag,n))})),new Jc(a,o,c)}))}}class Qc{constructor(e,t){this.node=e,this.humanLimit=t}}function el(e){return e.invert?e.invert():e.inverse(),e}const tl=new me,nl=new pe;class il{constructor(e,t){this.restPose={},this.humanBones=this._createHumanBones(e),this.humanDescription=t,this.restPose=this.getPose()}getPose(){const e={};return Object.keys(this.humanBones).forEach((t=>{const n=this.getBoneNode(t);if(!n)return;if(e[t])return;tl.set(0,0,0),nl.identity();const i=this.restPose[t];(null==i?void 0:i.position)&&tl.fromArray(i.position).negate(),(null==i?void 0:i.rotation)&&el(nl.fromArray(i.rotation)),tl.add(n.position),nl.premultiply(n.quaternion),e[t]={position:tl.toArray(),rotation:nl.toArray()}}),{}),e}setPose(e){Object.keys(e).forEach((t=>{const n=e[t],i=this.getBoneNode(t);if(!i)return;const r=this.restPose[t];r&&(n.position&&(i.position.fromArray(n.position),r.position&&i.position.add(tl.fromArray(r.position))),n.rotation&&(i.quaternion.fromArray(n.rotation),r.rotation&&i.quaternion.multiply(nl.fromArray(r.rotation))))}))}resetPose(){Object.entries(this.restPose).forEach((([e,t])=>{const n=this.getBoneNode(e);n&&((null==t?void 0:t.position)&&n.position.fromArray(t.position),(null==t?void 0:t.rotation)&&n.quaternion.fromArray(t.rotation))}))}getBone(e){var t;return null!==(t=this.humanBones[e][0])&&void 0!==t?t:void 0}getBones(e){var t;return null!==(t=this.humanBones[e])&&void 0!==t?t:[]}getBoneNode(e){var t,n;return null!==(n=null===(t=this.humanBones[e][0])||void 0===t?void 0:t.node)&&void 0!==n?n:null}getBoneNodes(e){var t,n;return null!==(n=null===(t=this.humanBones[e])||void 0===t?void 0:t.map((e=>e.node)))&&void 0!==n?n:[]}_createHumanBones(e){const t=Object.values(Dc.HumanoidBoneName).reduce(((e,t)=>(e[t]=[],e)),{});return e.forEach((e=>{t[e.name].push(e.bone)})),t}}class rl{import(e){var t;return Lc(this,void 0,void 0,(function*(){const n=null===(t=e.parser.json.extensions)||void 0===t?void 0:t.VRM;if(!n)return null;const i=n.humanoid;if(!i)return null;const r=[];i.humanBones&&(yield Promise.all(i.humanBones.map((t=>Lc(this,void 0,void 0,(function*(){if(!t.bone||null==t.node)return;const n=yield e.parser.getDependency("node",t.node);r.push({name:t.bone,bone:new Qc(n,{axisLength:t.axisLength,center:t.center&&new me(t.center.x,t.center.y,t.center.z),max:t.max&&new me(t.max.x,t.max.y,t.max.z),min:t.min&&new me(t.min.x,t.min.y,t.min.z),useDefaultValues:t.useDefaultValues})})}))))));const s={armStretch:i.armStretch,legStretch:i.legStretch,upperArmTwist:i.upperArmTwist,lowerArmTwist:i.lowerArmTwist,upperLegTwist:i.upperLegTwist,lowerLegTwist:i.lowerLegTwist,feetSpacing:i.feetSpacing,hasTranslationDoF:i.hasTranslationDoF};return new il(r,s)}))}}class sl{constructor(e,t,n){this.curve=[0,0,0,1,1,1,1,0],this.curveXRangeDegree=90,this.curveYRangeDegree=10,void 0!==e&&(this.curveXRangeDegree=e),void 0!==t&&(this.curveYRangeDegree=t),void 0!==n&&(this.curve=n)}map(e){const t=Math.min(Math.max(e,0),this.curveXRangeDegree)/this.curveXRangeDegree;return this.curveYRangeDegree*((e,t)=>{if(e.length<8)throw new Error("evaluateCurve: Invalid curve detected! (Array length must be 8 at least)");if(e.length%4!=0)throw new Error("evaluateCurve: Invalid curve detected! (Array length must be multiples of 4");let n;for(n=0;;n++){if(e.length<=4*n)return e[4*n-3];if(t<=e[4*n])break}const i=n-1;if(i<0)return e[4*i+5];const r=e[4*i],s=(t-r)/(e[4*n]-r);return((e,t,n,i,r)=>{const s=r*r*r,a=r*r;return e+(t-e)*(-2*s+3*a)+n*(s-2*a+r)+i*(s-a)})(e[4*i+1],e[4*n+1],e[4*i+3],e[4*n+2],s)})(this.curve,t)}}class al{}class ol extends al{constructor(e,t,n,i){super(),this.type=Dc.FirstPersonLookAtTypeName.BlendShape,this._curveHorizontal=t,this._curveVerticalDown=n,this._curveVerticalUp=i,this._blendShapeProxy=e}name(){return Dc.FirstPersonLookAtTypeName.BlendShape}lookAt(e){const t=e.x,n=e.y;t<0?(this._blendShapeProxy.setValue(Dc.BlendShapePresetName.Lookup,0),this._blendShapeProxy.setValue(Dc.BlendShapePresetName.Lookdown,this._curveVerticalDown.map(-t))):(this._blendShapeProxy.setValue(Dc.BlendShapePresetName.Lookdown,0),this._blendShapeProxy.setValue(Dc.BlendShapePresetName.Lookup,this._curveVerticalUp.map(t))),n<0?(this._blendShapeProxy.setValue(Dc.BlendShapePresetName.Lookleft,0),this._blendShapeProxy.setValue(Dc.BlendShapePresetName.Lookright,this._curveHorizontal.map(-n))):(this._blendShapeProxy.setValue(Dc.BlendShapePresetName.Lookright,0),this._blendShapeProxy.setValue(Dc.BlendShapePresetName.Lookleft,this._curveHorizontal.map(n)))}}const cl=Object.freeze(new me(0,0,-1)),ll=new me,ul=new me,dl=new me,hl=new pe;class fl{constructor(e,t){this.autoUpdate=!0,this._euler=new nt(0,0,0,fl.EULER_ORDER),this.firstPerson=e,this.applyer=t}getLookAtWorldDirection(e){const t=Gc(this.firstPerson.firstPersonBone,hl);return e.copy(cl).applyEuler(this._euler).applyQuaternion(t)}lookAt(e){this._calcEuler(this._euler,e),this.applyer&&this.applyer.lookAt(this._euler)}update(e){this.target&&this.autoUpdate&&(this.lookAt(this.target.getWorldPosition(ll)),this.applyer&&this.applyer.lookAt(this._euler))}_calcEuler(e,t){const n=this.firstPerson.getFirstPersonWorldPosition(ul),i=dl.copy(t).sub(n).normalize();return i.applyQuaternion(el(Gc(this.firstPerson.firstPersonBone,hl))),e.x=Math.atan2(i.y,Math.sqrt(i.x*i.x+i.z*i.z)),e.y=Math.atan2(-i.x,-i.z),e}}fl.EULER_ORDER="YXZ";const pl=new nt(0,0,0,fl.EULER_ORDER);class ml extends al{constructor(e,t,n,i,r){super(),this.type=Dc.FirstPersonLookAtTypeName.Bone,this._curveHorizontalInner=t,this._curveHorizontalOuter=n,this._curveVerticalDown=i,this._curveVerticalUp=r,this._leftEye=e.getBoneNode(Dc.HumanoidBoneName.LeftEye),this._rightEye=e.getBoneNode(Dc.HumanoidBoneName.RightEye)}lookAt(e){const t=e.x,n=e.y;this._leftEye&&(pl.x=t<0?-this._curveVerticalDown.map(-t):this._curveVerticalUp.map(t),pl.y=n<0?-this._curveHorizontalInner.map(-n):this._curveHorizontalOuter.map(n),this._leftEye.quaternion.setFromEuler(pl)),this._rightEye&&(pl.x=t<0?-this._curveVerticalDown.map(-t):this._curveVerticalUp.map(t),pl.y=n<0?-this._curveHorizontalOuter.map(-n):this._curveHorizontalInner.map(n),this._rightEye.quaternion.setFromEuler(pl))}}const gl=Math.PI/180;class vl{import(e,t,n,i){var r;const s=null===(r=e.parser.json.extensions)||void 0===r?void 0:r.VRM;if(!s)return null;const a=s.firstPerson;if(!a)return null;const o=this._importApplyer(a,n,i);return new fl(t,o||void 0)}_importApplyer(e,t,n){const i=e.lookAtHorizontalInner,r=e.lookAtHorizontalOuter,s=e.lookAtVerticalDown,a=e.lookAtVerticalUp;switch(e.lookAtTypeName){case Dc.FirstPersonLookAtTypeName.Bone:return void 0===i||void 0===r||void 0===s||void 0===a?null:new ml(n,this._importCurveMapperBone(i),this._importCurveMapperBone(r),this._importCurveMapperBone(s),this._importCurveMapperBone(a));case Dc.FirstPersonLookAtTypeName.BlendShape:return void 0===r||void 0===s||void 0===a?null:new ol(t,this._importCurveMapperBlendShape(r),this._importCurveMapperBlendShape(s),this._importCurveMapperBlendShape(a));default:return null}}_importCurveMapperBone(e){return new sl("number"==typeof e.xRange?gl*e.xRange:void 0,"number"==typeof e.yRange?gl*e.yRange:void 0,e.curve)}_importCurveMapperBlendShape(e){return new sl("number"==typeof e.xRange?gl*e.xRange:void 0,e.yRange,e.curve)}}var yl='// #define PHONG\n\n#ifdef BLENDMODE_CUTOUT\n uniform float cutoff;\n#endif\n\nuniform vec3 color;\nuniform float colorAlpha;\nuniform vec3 shadeColor;\n#ifdef USE_SHADETEXTURE\n uniform sampler2D shadeTexture;\n#endif\n\nuniform float receiveShadowRate;\n#ifdef USE_RECEIVESHADOWTEXTURE\n uniform sampler2D receiveShadowTexture;\n#endif\n\nuniform float shadingGradeRate;\n#ifdef USE_SHADINGGRADETEXTURE\n uniform sampler2D shadingGradeTexture;\n#endif\n\nuniform float shadeShift;\nuniform float shadeToony;\nuniform float lightColorAttenuation;\nuniform float indirectLightIntensity;\n\n#ifdef USE_RIMTEXTURE\n uniform sampler2D rimTexture;\n#endif\nuniform vec3 rimColor;\nuniform float rimLightingMix;\nuniform float rimFresnelPower;\nuniform float rimLift;\n\n#ifdef USE_SPHEREADD\n uniform sampler2D sphereAdd;\n#endif\n\nuniform vec3 emissionColor;\n\nuniform vec3 outlineColor;\nuniform float outlineLightingMix;\n\n#ifdef USE_UVANIMMASKTEXTURE\n uniform sampler2D uvAnimMaskTexture;\n#endif\n\nuniform float uvAnimOffsetX;\nuniform float uvAnimOffsetY;\nuniform float uvAnimTheta;\n\n#include \n#include \n#include \n#include \n\n// #include \n#if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )\n varying vec2 vUv;\n#endif\n\n#include \n#include \n// #include \n#include \n// #include \n#include \n// #include \n// #include \n// #include \n#include \n\n// #include \nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\n\n#include \n\n// #include \nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n\nstruct MToonMaterial {\n vec3 diffuseColor;\n vec3 shadeColor;\n float shadingGrade;\n float receiveShadow;\n};\n\n#define Material_LightProbeLOD( material ) (0)\n\n#include \n// #include \n\n// #include \n#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n\n#endif\n\n#ifdef OBJECTSPACE_NORMALMAP\n\n uniform mat3 normalMatrix;\n\n#endif\n\n#if ! defined ( USE_TANGENT ) && defined ( TANGENTSPACE_NORMALMAP )\n\n // Per-Pixel Tangent Space Normal Mapping\n // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n // three-vrm specific change: it requires `uv` as an input in order to support uv scrolls\n\n // Temporary compat against shader change @ Three.js r126\n // See: #21205, #21307, #21299\n #if THREE_VRM_THREE_REVISION >= 126\n\n vec3 perturbNormal2Arb( vec2 uv, vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\n vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n\n vec3 N = normalize( surf_norm );\n\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n\n // three-vrm specific change: Workaround for the issue that happens when delta of uv = 0.0\n // TODO: Is this still required? Or shall I make a PR about it?\n if ( length( T ) == 0.0 || length( B ) == 0.0 ) {\n return surf_norm;\n }\n\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\n return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\n }\n\n #else\n\n vec3 perturbNormal2Arb( vec2 uv, vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\n // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\n vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n\n float scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude\n\n vec3 S = ( q0 * st1.t - q1 * st0.t ) * scale;\n vec3 T = ( - q0 * st1.s + q1 * st0.s ) * scale;\n\n // three-vrm specific change: Workaround for the issue that happens when delta of uv = 0.0\n // TODO: Is this still required? Or shall I make a PR about it?\n\n if ( length( S ) == 0.0 || length( T ) == 0.0 ) {\n return surf_norm;\n }\n\n S = normalize( S );\n T = normalize( T );\n vec3 N = normalize( surf_norm );\n\n #ifdef DOUBLE_SIDED\n\n // Workaround for Adreno GPUs gl_FrontFacing bug. See #15850 and #10331\n\n bool frontFacing = dot( cross( S, T ), N ) > 0.0;\n\n mapN.xy *= ( float( frontFacing ) * 2.0 - 1.0 );\n\n #else\n\n mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n #endif\n\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n\n }\n\n #endif\n\n#endif\n\n// #include \n#include \n#include \n\n// == lighting stuff ===========================================================\nfloat getLightIntensity(\n const in IncidentLight directLight,\n const in GeometricContext geometry,\n const in float shadow,\n const in float shadingGrade\n) {\n float lightIntensity = dot( geometry.normal, directLight.direction );\n lightIntensity = 0.5 + 0.5 * lightIntensity;\n lightIntensity = lightIntensity * shadow;\n lightIntensity = lightIntensity * shadingGrade;\n lightIntensity = lightIntensity * 2.0 - 1.0;\n return shadeToony == 1.0\n ? step( shadeShift, lightIntensity )\n : smoothstep( shadeShift, shadeShift + ( 1.0 - shadeToony ), lightIntensity );\n}\n\nvec3 getLighting( const in vec3 lightColor ) {\n vec3 lighting = lightColor;\n lighting = mix(\n lighting,\n vec3( max( 0.001, max( lighting.x, max( lighting.y, lighting.z ) ) ) ),\n lightColorAttenuation\n );\n\n #if THREE_VRM_THREE_REVISION < 132\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lighting *= PI;\n #endif\n #endif\n\n return lighting;\n}\n\nvec3 getDiffuse(\n const in MToonMaterial material,\n const in float lightIntensity,\n const in vec3 lighting\n) {\n #ifdef DEBUG_LITSHADERATE\n return vec3( BRDF_Lambert( lightIntensity * lighting ) );\n #endif\n\n return lighting * BRDF_Lambert( mix( material.shadeColor, material.diffuseColor, lightIntensity ) );\n}\n\n// == post correction ==========================================================\nvoid postCorrection() {\n #include \n #include \n #include \n #include \n #include \n}\n\n// == main procedure ===========================================================\nvoid main() {\n #include \n\n vec2 uv = vec2(0.5, 0.5);\n\n #if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )\n uv = vUv;\n\n float uvAnimMask = 1.0;\n #ifdef USE_UVANIMMASKTEXTURE\n uvAnimMask = texture2D( uvAnimMaskTexture, uv ).x;\n #endif\n\n uv = uv + vec2( uvAnimOffsetX, uvAnimOffsetY ) * uvAnimMask;\n float uvRotCos = cos( uvAnimTheta * uvAnimMask );\n float uvRotSin = sin( uvAnimTheta * uvAnimMask );\n uv = mat2( uvRotCos, uvRotSin, -uvRotSin, uvRotCos ) * ( uv - 0.5 ) + 0.5;\n #endif\n\n #ifdef DEBUG_UV\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) )\n gl_FragColor = vec4( uv, 0.0, 1.0 );\n #endif\n return;\n #endif\n\n vec4 diffuseColor = vec4( color, colorAlpha );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissionColor;\n\n #include \n\n // #include \n #ifdef USE_MAP\n #if THREE_VRM_THREE_REVISION >= 137\n vec4 sampledDiffuseColor = texture2D( map, uv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n #endif\n diffuseColor *= sampledDiffuseColor;\n #else\n // COMPAT: pre-r137\n diffuseColor *= mapTexelToLinear( texture2D( map, uv ) );\n #endif\n #endif\n\n #include \n // #include \n\n // -- MToon: alpha -----------------------------------------------------------\n // #include \n #ifdef BLENDMODE_CUTOUT\n if ( diffuseColor.a <= cutoff ) { discard; }\n diffuseColor.a = 1.0;\n #endif\n\n #ifdef BLENDMODE_OPAQUE\n diffuseColor.a = 1.0;\n #endif\n\n #if defined( OUTLINE ) && defined( OUTLINE_COLOR_FIXED ) // omitting DebugMode\n gl_FragColor = vec4( outlineColor, diffuseColor.a );\n postCorrection();\n return;\n #endif\n\n // #include \n #include \n\n #ifdef OUTLINE\n normal *= -1.0;\n #endif\n\n // #include \n\n #ifdef OBJECTSPACE_NORMALMAP\n\n normal = texture2D( normalMap, uv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n #ifdef FLIP_SIDED\n\n normal = - normal;\n\n #endif\n\n #ifdef DOUBLE_SIDED\n\n // Temporary compat against shader change @ Three.js r126\n // See: #21205, #21307, #21299\n #if THREE_VRM_THREE_REVISION >= 126\n\n normal = normal * faceDirection;\n\n #else\n\n normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n #endif\n\n #endif\n\n normal = normalize( normalMatrix * normal );\n\n #elif defined( TANGENTSPACE_NORMALMAP )\n\n vec3 mapN = texture2D( normalMap, uv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n\n #ifdef USE_TANGENT\n\n normal = normalize( vTBN * mapN );\n\n #else\n\n // Temporary compat against shader change @ Three.js r126\n // See: #21205, #21307, #21299\n #if THREE_VRM_THREE_REVISION >= 126\n\n normal = perturbNormal2Arb( uv, -vViewPosition, normal, mapN, faceDirection );\n\n #else\n\n normal = perturbNormal2Arb( uv, -vViewPosition, normal, mapN );\n\n #endif\n\n #endif\n\n #endif\n\n // #include \n #ifdef USE_EMISSIVEMAP\n #if THREE_VRM_THREE_REVISION >= 137\n totalEmissiveRadiance *= texture2D( emissiveMap, uv ).rgb;\n #else\n // COMPAT: pre-r137\n totalEmissiveRadiance *= emissiveMapTexelToLinear( texture2D( emissiveMap, uv ) ).rgb;\n #endif\n #endif\n\n #ifdef DEBUG_NORMAL\n gl_FragColor = vec4( 0.5 + 0.5 * normal, 1.0 );\n return;\n #endif\n\n // -- MToon: lighting --------------------------------------------------------\n // accumulation\n // #include \n MToonMaterial material;\n\n material.diffuseColor = diffuseColor.rgb;\n\n material.shadeColor = shadeColor;\n #ifdef USE_SHADETEXTURE\n #if THREE_VRM_THREE_REVISION >= 137\n material.shadeColor *= texture2D( shadeTexture, uv ).rgb;\n #else\n // COMPAT: pre-r137\n material.shadeColor *= shadeTextureTexelToLinear( texture2D( shadeTexture, uv ) ).rgb;\n #endif\n #endif\n\n material.shadingGrade = 1.0;\n #ifdef USE_SHADINGGRADETEXTURE\n material.shadingGrade = 1.0 - shadingGradeRate * ( 1.0 - texture2D( shadingGradeTexture, uv ).r );\n #endif\n\n material.receiveShadow = receiveShadowRate;\n #ifdef USE_RECEIVESHADOWTEXTURE\n material.receiveShadow *= texture2D( receiveShadowTexture, uv ).a;\n #endif\n\n // #include \n GeometricContext geometry;\n\n geometry.position = - vViewPosition;\n geometry.normal = normal;\n geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n IncidentLight directLight;\n vec3 lightingSum = vec3( 0.0 );\n\n // since these variables will be used in unrolled loop, we have to define in prior\n float atten, shadow, lightIntensity;\n vec3 lighting;\n\n #if ( NUM_POINT_LIGHTS > 0 )\n PointLight pointLight;\n\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n\n #if THREE_VRM_THREE_REVISION >= 132\n getPointLightInfo( pointLight, geometry, directLight );\n #else\n getPointDirectLightIrradiance( pointLight, geometry, directLight );\n #endif\n\n atten = 1.0;\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n atten = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n\n shadow = 1.0 - material.receiveShadow * ( 1.0 - ( 0.5 + 0.5 * atten ) );\n lightIntensity = getLightIntensity( directLight, geometry, shadow, material.shadingGrade );\n lighting = getLighting( directLight.color );\n reflectedLight.directDiffuse += getDiffuse( material, lightIntensity, lighting );\n lightingSum += lighting;\n }\n #pragma unroll_loop_end\n #endif\n\n #if ( NUM_SPOT_LIGHTS > 0 )\n SpotLight spotLight;\n\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n\n #if THREE_VRM_THREE_REVISION >= 132\n getSpotLightInfo( spotLight, geometry, directLight );\n #else\n getSpotDirectLightIrradiance( spotLight, geometry, directLight );\n #endif\n\n atten = 1.0;\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n atten = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n #endif\n\n shadow = 1.0 - material.receiveShadow * ( 1.0 - ( 0.5 + 0.5 * atten ) );\n lightIntensity = getLightIntensity( directLight, geometry, shadow, material.shadingGrade );\n lighting = getLighting( directLight.color );\n reflectedLight.directDiffuse += getDiffuse( material, lightIntensity, lighting );\n lightingSum += lighting;\n }\n #pragma unroll_loop_end\n #endif\n\n #if ( NUM_DIR_LIGHTS > 0 )\n DirectionalLight directionalLight;\n\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n\n #if THREE_VRM_THREE_REVISION >= 132\n getDirectionalLightInfo( directionalLight, geometry, directLight );\n #else\n getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n #endif\n\n atten = 1.0;\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n atten = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n\n shadow = 1.0 - material.receiveShadow * ( 1.0 - ( 0.5 + 0.5 * atten ) );\n lightIntensity = getLightIntensity( directLight, geometry, shadow, material.shadingGrade );\n lighting = getLighting( directLight.color );\n reflectedLight.directDiffuse += getDiffuse( material, lightIntensity, lighting );\n lightingSum += lighting;\n }\n #pragma unroll_loop_end\n #endif\n\n // #if defined( RE_IndirectDiffuse )\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if THREE_VRM_THREE_REVISION >= 133\n irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n #else\n irradiance += getLightProbeIrradiance( lightProbe, geometry );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n #if THREE_VRM_THREE_REVISION >= 133\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n #else\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n #endif\n }\n #pragma unroll_loop_end\n #endif\n // #endif\n\n // #include \n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vUv2 );\n #if THREE_VRM_THREE_REVISION >= 137\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n #else\n // COMPAT: pre-r137\n vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n #endif\n #ifndef PHYSICALLY_CORRECT_LIGHTS\n lightMapIrradiance *= PI;\n #endif\n irradiance += lightMapIrradiance;\n #endif\n\n // #include \n // RE_IndirectDiffuse here\n reflectedLight.indirectDiffuse += indirectLightIntensity * irradiance * BRDF_Lambert( material.diffuseColor );\n\n // modulation\n #include \n\n vec3 col = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\n // The "comment out if you want to PBR absolutely" line\n #ifndef DEBUG_LITSHADERATE\n col = min(col, material.diffuseColor);\n #endif\n\n #if defined( OUTLINE ) && defined( OUTLINE_COLOR_MIXED )\n gl_FragColor = vec4(\n outlineColor.rgb * mix( vec3( 1.0 ), col, outlineLightingMix ),\n diffuseColor.a\n );\n postCorrection();\n return;\n #endif\n\n #ifdef DEBUG_LITSHADERATE\n gl_FragColor = vec4( col, diffuseColor.a );\n postCorrection();\n return;\n #endif\n\n // -- MToon: parametric rim lighting -----------------------------------------\n vec3 viewDir = normalize( vViewPosition );\n vec3 rimMix = mix( vec3( 1.0 ), lightingSum + indirectLightIntensity * irradiance, rimLightingMix );\n vec3 rim = rimColor * pow( saturate( 1.0 - dot( viewDir, normal ) + rimLift ), rimFresnelPower );\n #ifdef USE_RIMTEXTURE\n #if THREE_VRM_THREE_REVISION >= 137\n rim *= texture2D( rimTexture, uv ).rgb;\n #else\n // COMPAT: pre-r137\n rim *= rimTextureTexelToLinear( texture2D( rimTexture, uv ) ).rgb;\n #endif\n #endif\n col += rim;\n\n // -- MToon: additive matcap -------------------------------------------------\n #ifdef USE_SPHEREADD\n {\n vec3 x = normalize( vec3( viewDir.z, 0.0, -viewDir.x ) );\n vec3 y = cross( viewDir, x ); // guaranteed to be normalized\n vec2 sphereUv = 0.5 + 0.5 * vec2( dot( x, normal ), -dot( y, normal ) );\n #if THREE_VRM_THREE_REVISION >= 137\n vec3 matcap = texture2D( sphereAdd, sphereUv ).xyz;\n #else\n // COMPAT: pre-r137\n vec3 matcap = sphereAddTexelToLinear( texture2D( sphereAdd, sphereUv ) ).xyz;\n #endif\n col += matcap;\n }\n #endif\n\n // -- MToon: Emission --------------------------------------------------------\n col += totalEmissiveRadiance;\n\n // #include \n\n // -- Almost done! -----------------------------------------------------------\n gl_FragColor = vec4( col, diffuseColor.a );\n postCorrection();\n}';const bl=(e,t)=>{const n=(e=>{if(parseInt(i,10)>=136)switch(e){case H:return["Linear","( value )"];case k:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}else switch(e){case H:return["Linear","( value )"];case k:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+e)}})(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"},xl=2*Math.PI;var wl,Ml,Sl,_l,Cl,El;!function(e){e[e.Off=0]="Off",e[e.Front=1]="Front",e[e.Back=2]="Back"}(wl||(wl={})),function(e){e[e.None=0]="None",e[e.Normal=1]="Normal",e[e.LitShadeRate=2]="LitShadeRate",e[e.UV=3]="UV"}(Ml||(Ml={})),function(e){e[e.FixedColor=0]="FixedColor",e[e.MixedLighting=1]="MixedLighting"}(Sl||(Sl={})),function(e){e[e.None=0]="None",e[e.WorldCoordinates=1]="WorldCoordinates",e[e.ScreenCoordinates=2]="ScreenCoordinates"}(_l||(_l={})),function(e){e[e.Opaque=0]="Opaque",e[e.Cutout=1]="Cutout",e[e.Transparent=2]="Transparent",e[e.TransparentWithZWrite=3]="TransparentWithZWrite"}(Cl||(Cl={}));class Tl extends gn{constructor(e={}){super(),this.isMToonMaterial=!0,this.cutoff=.5,this.color=new de(1,1,1,1),this.shadeColor=new de(.97,.81,.86,1),this.map=null,this.mainTex_ST=new de(0,0,1,1),this.shadeTexture=null,this.normalMap=null,this.normalMapType=0,this.normalScale=new K(1,1),this.receiveShadowRate=1,this.receiveShadowTexture=null,this.shadingGradeRate=1,this.shadingGradeTexture=null,this.shadeShift=0,this.shadeToony=.9,this.lightColorAttenuation=0,this.indirectLightIntensity=.1,this.rimTexture=null,this.rimColor=new de(0,0,0,1),this.rimLightingMix=0,this.rimFresnelPower=1,this.rimLift=0,this.sphereAdd=null,this.emissionColor=new de(0,0,0,1),this.emissiveMap=null,this.outlineWidthTexture=null,this.outlineWidth=.5,this.outlineScaledMaxDistance=1,this.outlineColor=new de(0,0,0,1),this.outlineLightingMix=1,this.uvAnimMaskTexture=null,this.uvAnimScrollX=0,this.uvAnimScrollY=0,this.uvAnimRotation=0,this.shouldApplyUniforms=!0,this._debugMode=Ml.None,this._blendMode=Cl.Opaque,this._outlineWidthMode=_l.None,this._outlineColorMode=Sl.FixedColor,this._cullMode=wl.Back,this._outlineCullMode=wl.Front,this._isOutline=!1,this._uvAnimOffsetX=0,this._uvAnimOffsetY=0,this._uvAnimPhase=0,this.encoding=e.encoding||H,this.encoding!==H&&this.encoding!==k&&console.warn("The specified color encoding does not work properly with MToonMaterial. You might want to use THREE.sRGBEncoding instead."),["mToonVersion","shadeTexture_ST","bumpMap_ST","receiveShadowTexture_ST","shadingGradeTexture_ST","rimTexture_ST","sphereAdd_ST","emissionMap_ST","outlineWidthTexture_ST","uvAnimMaskTexture_ST","srcBlend","dstBlend"].forEach((t=>{void 0!==e[t]&&delete e[t]})),e.fog=!0,e.lights=!0,e.clipping=!0,parseInt(i,10)<129&&(e.skinning=e.skinning||!1),parseInt(i,10)<131&&(e.morphTargets=e.morphTargets||!1,e.morphNormals=e.morphNormals||!1),e.uniforms=mn.merge([kn.common,kn.normalmap,kn.emissivemap,kn.fog,kn.lights,{cutoff:{value:.5},color:{value:new se(1,1,1)},colorAlpha:{value:1},shadeColor:{value:new se(.97,.81,.86)},mainTex_ST:{value:new de(0,0,1,1)},shadeTexture:{value:null},receiveShadowRate:{value:1},receiveShadowTexture:{value:null},shadingGradeRate:{value:1},shadingGradeTexture:{value:null},shadeShift:{value:0},shadeToony:{value:.9},lightColorAttenuation:{value:0},indirectLightIntensity:{value:.1},rimTexture:{value:null},rimColor:{value:new se(0,0,0)},rimLightingMix:{value:0},rimFresnelPower:{value:1},rimLift:{value:0},sphereAdd:{value:null},emissionColor:{value:new se(0,0,0)},outlineWidthTexture:{value:null},outlineWidth:{value:.5},outlineScaledMaxDistance:{value:1},outlineColor:{value:new se(0,0,0)},outlineLightingMix:{value:1},uvAnimMaskTexture:{value:null},uvAnimOffsetX:{value:0},uvAnimOffsetY:{value:0},uvAnimTheta:{value:0}}]),this.setValues(e),this._updateShaderCode(),this._applyUniforms()}get mainTex(){return this.map}set mainTex(e){this.map=e}get bumpMap(){return this.normalMap}set bumpMap(e){this.normalMap=e}get bumpScale(){return this.normalScale.x}set bumpScale(e){this.normalScale.set(e,e)}get emissionMap(){return this.emissiveMap}set emissionMap(e){this.emissiveMap=e}get blendMode(){return this._blendMode}set blendMode(e){this._blendMode=e,this.depthWrite=this._blendMode!==Cl.Transparent,this.transparent=this._blendMode===Cl.Transparent||this._blendMode===Cl.TransparentWithZWrite,this._updateShaderCode()}get debugMode(){return this._debugMode}set debugMode(e){this._debugMode=e,this._updateShaderCode()}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(e){this._outlineWidthMode=e,this._updateShaderCode()}get outlineColorMode(){return this._outlineColorMode}set outlineColorMode(e){this._outlineColorMode=e,this._updateShaderCode()}get cullMode(){return this._cullMode}set cullMode(e){this._cullMode=e,this._updateCullFace()}get outlineCullMode(){return this._outlineCullMode}set outlineCullMode(e){this._outlineCullMode=e,this._updateCullFace()}get zWrite(){return this.depthWrite?1:0}set zWrite(e){this.depthWrite=.5<=e}get isOutline(){return this._isOutline}set isOutline(e){this._isOutline=e,this._updateShaderCode(),this._updateCullFace()}updateVRMMaterials(e){this._uvAnimOffsetX=this._uvAnimOffsetX+e*this.uvAnimScrollX,this._uvAnimOffsetY=this._uvAnimOffsetY-e*this.uvAnimScrollY,this._uvAnimPhase=this._uvAnimPhase+e*this.uvAnimRotation,this._applyUniforms()}copy(e){return super.copy(e),this.cutoff=e.cutoff,this.color.copy(e.color),this.shadeColor.copy(e.shadeColor),this.map=e.map,this.mainTex_ST.copy(e.mainTex_ST),this.shadeTexture=e.shadeTexture,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(this.normalScale),this.receiveShadowRate=e.receiveShadowRate,this.receiveShadowTexture=e.receiveShadowTexture,this.shadingGradeRate=e.shadingGradeRate,this.shadingGradeTexture=e.shadingGradeTexture,this.shadeShift=e.shadeShift,this.shadeToony=e.shadeToony,this.lightColorAttenuation=e.lightColorAttenuation,this.indirectLightIntensity=e.indirectLightIntensity,this.rimTexture=e.rimTexture,this.rimColor.copy(e.rimColor),this.rimLightingMix=e.rimLightingMix,this.rimFresnelPower=e.rimFresnelPower,this.rimLift=e.rimLift,this.sphereAdd=e.sphereAdd,this.emissionColor.copy(e.emissionColor),this.emissiveMap=e.emissiveMap,this.outlineWidthTexture=e.outlineWidthTexture,this.outlineWidth=e.outlineWidth,this.outlineScaledMaxDistance=e.outlineScaledMaxDistance,this.outlineColor.copy(e.outlineColor),this.outlineLightingMix=e.outlineLightingMix,this.uvAnimMaskTexture=e.uvAnimMaskTexture,this.uvAnimScrollX=e.uvAnimScrollX,this.uvAnimScrollY=e.uvAnimScrollY,this.uvAnimRotation=e.uvAnimRotation,this.debugMode=e.debugMode,this.blendMode=e.blendMode,this.outlineWidthMode=e.outlineWidthMode,this.outlineColorMode=e.outlineColorMode,this.cullMode=e.cullMode,this.outlineCullMode=e.outlineCullMode,this.isOutline=e.isOutline,this}_applyUniforms(){this.uniforms.uvAnimOffsetX.value=this._uvAnimOffsetX,this.uniforms.uvAnimOffsetY.value=this._uvAnimOffsetY,this.uniforms.uvAnimTheta.value=xl*this._uvAnimPhase,this.shouldApplyUniforms&&(this.shouldApplyUniforms=!1,this.uniforms.cutoff.value=this.cutoff,this.uniforms.color.value.setRGB(this.color.x,this.color.y,this.color.z),this.uniforms.colorAlpha.value=this.color.w,this.uniforms.shadeColor.value.setRGB(this.shadeColor.x,this.shadeColor.y,this.shadeColor.z),this.uniforms.map.value=this.map,this.uniforms.mainTex_ST.value.copy(this.mainTex_ST),this.uniforms.shadeTexture.value=this.shadeTexture,this.uniforms.normalMap.value=this.normalMap,this.uniforms.normalScale.value.copy(this.normalScale),this.uniforms.receiveShadowRate.value=this.receiveShadowRate,this.uniforms.receiveShadowTexture.value=this.receiveShadowTexture,this.uniforms.shadingGradeRate.value=this.shadingGradeRate,this.uniforms.shadingGradeTexture.value=this.shadingGradeTexture,this.uniforms.shadeShift.value=this.shadeShift,this.uniforms.shadeToony.value=this.shadeToony,this.uniforms.lightColorAttenuation.value=this.lightColorAttenuation,this.uniforms.indirectLightIntensity.value=this.indirectLightIntensity,this.uniforms.rimTexture.value=this.rimTexture,this.uniforms.rimColor.value.setRGB(this.rimColor.x,this.rimColor.y,this.rimColor.z),this.uniforms.rimLightingMix.value=this.rimLightingMix,this.uniforms.rimFresnelPower.value=this.rimFresnelPower,this.uniforms.rimLift.value=this.rimLift,this.uniforms.sphereAdd.value=this.sphereAdd,this.uniforms.emissionColor.value.setRGB(this.emissionColor.x,this.emissionColor.y,this.emissionColor.z),this.uniforms.emissiveMap.value=this.emissiveMap,this.uniforms.outlineWidthTexture.value=this.outlineWidthTexture,this.uniforms.outlineWidth.value=this.outlineWidth,this.uniforms.outlineScaledMaxDistance.value=this.outlineScaledMaxDistance,this.uniforms.outlineColor.value.setRGB(this.outlineColor.x,this.outlineColor.y,this.outlineColor.z),this.uniforms.outlineLightingMix.value=this.outlineLightingMix,this.uniforms.uvAnimMaskTexture.value=this.uvAnimMaskTexture,this.encoding===k&&(this.uniforms.color.value.convertSRGBToLinear(),this.uniforms.shadeColor.value.convertSRGBToLinear(),this.uniforms.rimColor.value.convertSRGBToLinear(),this.uniforms.emissionColor.value.convertSRGBToLinear(),this.uniforms.outlineColor.value.convertSRGBToLinear()),this._updateCullFace())}_updateShaderCode(){const e=null!==this.outlineWidthTexture,t=null!==this.map||null!==this.shadeTexture||null!==this.receiveShadowTexture||null!==this.shadingGradeTexture||null!==this.rimTexture||null!==this.uvAnimMaskTexture;if(this.defines={THREE_VRM_THREE_REVISION:parseInt(i,10),OUTLINE:this._isOutline,BLENDMODE_OPAQUE:this._blendMode===Cl.Opaque,BLENDMODE_CUTOUT:this._blendMode===Cl.Cutout,BLENDMODE_TRANSPARENT:this._blendMode===Cl.Transparent||this._blendMode===Cl.TransparentWithZWrite,MTOON_USE_UV:e||t,MTOON_UVS_VERTEX_ONLY:e&&!t,USE_SHADETEXTURE:null!==this.shadeTexture,USE_RECEIVESHADOWTEXTURE:null!==this.receiveShadowTexture,USE_SHADINGGRADETEXTURE:null!==this.shadingGradeTexture,USE_RIMTEXTURE:null!==this.rimTexture,USE_SPHEREADD:null!==this.sphereAdd,USE_OUTLINEWIDTHTEXTURE:null!==this.outlineWidthTexture,USE_UVANIMMASKTEXTURE:null!==this.uvAnimMaskTexture,DEBUG_NORMAL:this._debugMode===Ml.Normal,DEBUG_LITSHADERATE:this._debugMode===Ml.LitShadeRate,DEBUG_UV:this._debugMode===Ml.UV,OUTLINE_WIDTH_WORLD:this._outlineWidthMode===_l.WorldCoordinates,OUTLINE_WIDTH_SCREEN:this._outlineWidthMode===_l.ScreenCoordinates,OUTLINE_COLOR_FIXED:this._outlineColorMode===Sl.FixedColor,OUTLINE_COLOR_MIXED:this._outlineColorMode===Sl.MixedLighting},this.vertexShader="// #define PHONG\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n\n#include \n\n// #include \n#ifdef MTOON_USE_UV\n #ifdef MTOON_UVS_VERTEX_ONLY\n vec2 vUv;\n #else\n varying vec2 vUv;\n #endif\n\n uniform vec4 mainTex_ST;\n#endif\n\n#include \n// #include \n// #include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef USE_OUTLINEWIDTHTEXTURE\n uniform sampler2D outlineWidthTexture;\n#endif\n\nuniform float outlineWidth;\nuniform float outlineScaledMaxDistance;\n\nvoid main() {\n\n // #include \n #ifdef MTOON_USE_UV\n vUv = uv;\n vUv.y = 1.0 - vUv.y; // uv.y is opposite from UniVRM's\n vUv = mainTex_ST.st + mainTex_ST.pq * vUv;\n vUv.y = 1.0 - vUv.y; // reverting the previous flip\n #endif\n\n #include \n #include \n\n #include \n #include \n #include \n #include \n\n // we need this to compute the outline properly\n objectNormal = normalize( objectNormal );\n\n #include \n\n #ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #endif\n\n #include \n\n #include \n #include \n // #include \n #include \n #include \n #include \n\n vViewPosition = - mvPosition.xyz;\n\n float outlineTex = 1.0;\n\n #ifdef OUTLINE\n #ifdef USE_OUTLINEWIDTHTEXTURE\n outlineTex = texture2D( outlineWidthTexture, vUv ).r;\n #endif\n\n #ifdef OUTLINE_WIDTH_WORLD\n float worldNormalLength = length( transformedNormal );\n vec3 outlineOffset = 0.01 * outlineWidth * outlineTex * worldNormalLength * objectNormal;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( outlineOffset + transformed, 1.0 );\n #endif\n\n #ifdef OUTLINE_WIDTH_SCREEN\n vec3 clipNormal = ( projectionMatrix * modelViewMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n vec2 projectedNormal = normalize( clipNormal.xy );\n projectedNormal *= min( gl_Position.w, outlineScaledMaxDistance );\n projectedNormal.x *= projectionMatrix[ 0 ].x / projectionMatrix[ 1 ].y;\n gl_Position.xy += 0.01 * outlineWidth * outlineTex * projectedNormal.xy;\n #endif\n\n gl_Position.z += 1E-6 * gl_Position.w; // anti-artifact magic\n #endif\n\n #include \n // #include \n #include \n #include \n\n}",this.fragmentShader=yl,parseInt(i,10)<137){const e=(null!==this.shadeTexture?bl("shadeTextureTexelToLinear",this.shadeTexture.encoding)+"\n":"")+(null!==this.sphereAdd?bl("sphereAddTexelToLinear",this.sphereAdd.encoding)+"\n":"")+(null!==this.rimTexture?bl("rimTextureTexelToLinear",this.rimTexture.encoding)+"\n":"");this.fragmentShader=e+yl}this.needsUpdate=!0}_updateCullFace(){this.isOutline?this.outlineCullMode===wl.Off?this.side=2:this.outlineCullMode===wl.Front?this.side=1:this.outlineCullMode===wl.Back&&(this.side=0):this.cullMode===wl.Off?this.side=2:this.cullMode===wl.Front?this.side=1:this.cullMode===wl.Back&&(this.side=0)}}!function(e){e[e.Opaque=0]="Opaque",e[e.Cutout=1]="Cutout",e[e.Transparent=2]="Transparent",e[e.TransparentWithZWrite=3]="TransparentWithZWrite"}(El||(El={}));class Ll extends gn{constructor(e){super(),this.isVRMUnlitMaterial=!0,this.cutoff=.5,this.map=null,this.mainTex_ST=new de(0,0,1,1),this._renderType=El.Opaque,this.shouldApplyUniforms=!0,void 0===e&&(e={}),e.fog=!0,e.clipping=!0,parseInt(i,10)<129&&(e.skinning=e.skinning||!1),parseInt(i,10)<131&&(e.morphTargets=e.morphTargets||!1,e.morphNormals=e.morphNormals||!1),e.uniforms=mn.merge([kn.common,kn.fog,{cutoff:{value:.5},mainTex_ST:{value:new de(0,0,1,1)}}]),this.setValues(e),this._updateShaderCode(),this._applyUniforms()}get mainTex(){return this.map}set mainTex(e){this.map=e}get renderType(){return this._renderType}set renderType(e){this._renderType=e,this.depthWrite=this._renderType!==El.Transparent,this.transparent=this._renderType===El.Transparent||this._renderType===El.TransparentWithZWrite,this._updateShaderCode()}updateVRMMaterials(e){this._applyUniforms()}copy(e){return super.copy(e),this.cutoff=e.cutoff,this.map=e.map,this.mainTex_ST.copy(e.mainTex_ST),this.renderType=e.renderType,this}_applyUniforms(){this.shouldApplyUniforms&&(this.shouldApplyUniforms=!1,this.uniforms.cutoff.value=this.cutoff,this.uniforms.map.value=this.map,this.uniforms.mainTex_ST.value.copy(this.mainTex_ST))}_updateShaderCode(){this.defines={RENDERTYPE_OPAQUE:this._renderType===El.Opaque,RENDERTYPE_CUTOUT:this._renderType===El.Cutout,RENDERTYPE_TRANSPARENT:this._renderType===El.Transparent||this._renderType===El.TransparentWithZWrite},this.vertexShader="#include \n\n// #include \n#ifdef USE_MAP\n varying vec2 vUv;\n uniform vec4 mainTex_ST;\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n // #include \n #ifdef USE_MAP\n vUv = vec2( mainTex_ST.p * uv.x + mainTex_ST.s, mainTex_ST.q * uv.y + mainTex_ST.t );\n #endif\n\n #include \n #include \n #include \n\n #ifdef USE_ENVMAP\n\n #include \n #include \n #include \n #include \n\n #endif\n\n #include \n #include \n #include \n #include \n #include \n\n #include \n #include \n #include \n #include \n\n}",this.fragmentShader="#ifdef RENDERTYPE_CUTOUT\n uniform float cutoff;\n#endif\n\n#include \n#include \n#include \n#include \n#include \n// #include \n// #include \n// #include \n// #include \n#include \n// #include \n#include \n#include \n\n// == main procedure ===========================================================\nvoid main() {\n #include \n\n vec4 diffuseColor = vec4( 1.0 );\n\n #include \n\n #include \n #include \n // #include \n\n // MToon: alpha\n // #include \n #ifdef RENDERTYPE_CUTOUT\n if ( diffuseColor.a <= cutoff ) { discard; }\n diffuseColor.a = 1.0;\n #endif\n\n #ifdef RENDERTYPE_OPAQUE\n diffuseColor.a = 1.0;\n #endif\n\n // #include \n\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n // accumulation (baked indirect lighting only)\n #ifdef USE_LIGHTMAP\n reflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n\n // modulation\n // #include \n\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n // #include \n\n gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n #include \n #include \n #include \n #include \n}",this.needsUpdate=!0}}class Al{constructor(e={}){this._encoding=e.encoding||H,this._encoding!==H&&this._encoding!==k&&console.warn("The specified color encoding might not work properly with VRMMaterialImporter. You might want to use THREE.sRGBEncoding instead."),this._requestEnvMap=e.requestEnvMap}convertGLTFMaterials(e){var t;return Lc(this,void 0,void 0,(function*(){const n=null===(t=e.parser.json.extensions)||void 0===t?void 0:t.VRM;if(!n)return null;const i=n.materialProperties;if(!i)return null;const r=yield Fc(e),s={},a=[];return yield Promise.all(Array.from(r.entries()).map((([t,n])=>Lc(this,void 0,void 0,(function*(){const r=e.parser.json.nodes[t],o=e.parser.json.meshes[r.mesh];yield Promise.all(n.map(((t,n)=>Lc(this,void 0,void 0,(function*(){const r=o.primitives[n];if(!r)return;const c=t.geometry,l=c.index?c.index.count:c.attributes.position.count/3;Array.isArray(t.material)||(t.material=[t.material],c.addGroup(0,l,0));const u=r.material;let d,h=i[u];h||(console.warn(`VRMMaterialImporter: There are no material definition for material #${u} on VRM extension.`),h={shader:"VRM_USE_GLTFSHADER"}),s[u]?d=s[u]:(d=yield this.createVRMMaterials(t.material[0],h,e),s[u]=d,a.push(d.surface),d.outline&&a.push(d.outline)),t.material[0]=d.surface,this._requestEnvMap&&d.surface.isMeshStandardMaterial&&this._requestEnvMap().then((e=>{d.surface.envMap=e,d.surface.needsUpdate=!0})),t.renderOrder=h.renderQueue||2e3,d.outline&&(t.material[1]=d.outline,c.addGroup(0,l,1))})))))}))))),a}))}createVRMMaterials(e,t,n){return Lc(this,void 0,void 0,(function*(){let i,r;if("VRM/MToon"===t.shader){const s=yield this._extractMaterialProperties(e,t,n);["srcBlend","dstBlend","isFirstSetup"].forEach((e=>{void 0!==s[e]&&delete s[e]})),["mainTex","shadeTexture","emissionMap","sphereAdd","rimTexture"].forEach((e=>{void 0!==s[e]&&(s[e].encoding=this._encoding)})),s.encoding=this._encoding,i=new Tl(s),s.outlineWidthMode!==_l.None&&(s.isOutline=!0,r=new Tl(s))}else if("VRM/UnlitTexture"===t.shader){const r=yield this._extractMaterialProperties(e,t,n);r.renderType=El.Opaque,i=new Ll(r)}else if("VRM/UnlitCutout"===t.shader){const r=yield this._extractMaterialProperties(e,t,n);r.renderType=El.Cutout,i=new Ll(r)}else if("VRM/UnlitTransparent"===t.shader){const r=yield this._extractMaterialProperties(e,t,n);r.renderType=El.Transparent,i=new Ll(r)}else if("VRM/UnlitTransparentZWrite"===t.shader){const r=yield this._extractMaterialProperties(e,t,n);r.renderType=El.TransparentWithZWrite,i=new Ll(r)}else"VRM_USE_GLTFSHADER"!==t.shader&&console.warn(`Unknown shader detected: "${t.shader}"`),i=this._convertGLTFMaterial(e.clone());return i.name=e.name,i.userData=JSON.parse(JSON.stringify(e.userData)),i.userData.vrmMaterialProperties=t,r&&(r.name=e.name+" (Outline)",r.userData=JSON.parse(JSON.stringify(e.userData)),r.userData.vrmMaterialProperties=t),{surface:i,outline:r}}))}_renameMaterialProperty(e){return"_"!==e[0]?(console.warn(`VRMMaterials: Given property name "${e}" might be invalid`),e):(e=e.substring(1),/[A-Z]/.test(e[0])?e[0].toLowerCase()+e.substring(1):(console.warn(`VRMMaterials: Given property name "${e}" might be invalid`),e))}_convertGLTFMaterial(e){if(e.isMeshStandardMaterial){const t=e;t.map&&(t.map.encoding=this._encoding),t.emissiveMap&&(t.emissiveMap.encoding=this._encoding),this._encoding===H&&(t.color.convertLinearToSRGB(),t.emissive.convertLinearToSRGB())}if(e.isMeshBasicMaterial){const t=e;t.map&&(t.map.encoding=this._encoding),this._encoding===H&&t.color.convertLinearToSRGB()}return e}_extractMaterialProperties(e,t,n){const r=[],s={};if(t.textureProperties)for(const e of Object.keys(t.textureProperties)){const i=this._renameMaterialProperty(e),a=t.textureProperties[e];r.push(n.parser.getDependency("texture",a).then((e=>{s[i]=e})))}if(t.floatProperties)for(const e of Object.keys(t.floatProperties)){const n=this._renameMaterialProperty(e);s[n]=t.floatProperties[e]}if(t.vectorProperties)for(const e of Object.keys(t.vectorProperties)){let n=this._renameMaterialProperty(e);["_MainTex","_ShadeTexture","_BumpMap","_ReceiveShadowTexture","_ShadingGradeTexture","_RimTexture","_SphereAdd","_EmissionMap","_OutlineWidthTexture","_UvAnimMaskTexture"].some((t=>e===t))&&(n+="_ST"),s[n]=new de(...t.vectorProperties[e])}return parseInt(i,10)<129&&(s.skinning=e.skinning||!1),parseInt(i,10)<131&&(s.morphTargets=e.morphTargets||!1,s.morphNormals=e.morphNormals||!1),Promise.all(r).then((()=>s))}}class zl{constructor(e){var t;this.ignoreTexture=null!==(t=null==e?void 0:e.ignoreTexture)&&void 0!==t&&t}import(e){var t;return Lc(this,void 0,void 0,(function*(){const n=null===(t=e.parser.json.extensions)||void 0===t?void 0:t.VRM;if(!n)return null;const i=n.meta;if(!i)return null;let r;return this.ignoreTexture||null==i.texture||-1===i.texture||(r=yield e.parser.getDependency("texture",i.texture)),{allowedUserName:i.allowedUserName,author:i.author,commercialUssageName:i.commercialUssageName,contactInformation:i.contactInformation,licenseName:i.licenseName,otherLicenseUrl:i.otherLicenseUrl,otherPermissionUrl:i.otherPermissionUrl,reference:i.reference,sexualUssageName:i.sexualUssageName,texture:null!=r?r:void 0,title:i.title,version:i.version,violentUssageName:i.violentUssageName}}))}}const Rl=new qe;function Pl(e){return e.invert?e.invert():e.getInverse(Rl.copy(e)),e}class Hl{constructor(e){this._inverseCache=new qe,this._shouldUpdateInverse=!0,this.matrix=e;const t={set:(e,t,n)=>(this._shouldUpdateInverse=!0,e[t]=n,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,t)}get inverse(){return this._shouldUpdateInverse&&(Pl(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const kl=Object.freeze(new qe),Il=Object.freeze(new pe),Vl=new me,Nl=new me,Dl=new me,Ol=new pe,Fl=new qe,Bl=new qe;class Ul{constructor(e,t={}){var n,i,r,s,a,o;if(this._currentTail=new me,this._prevTail=new me,this._nextTail=new me,this._boneAxis=new me,this._centerSpacePosition=new me,this._center=null,this._parentWorldRotation=new pe,this._initialLocalMatrix=new qe,this._initialLocalRotation=new pe,this._initialLocalChildPosition=new me,this.bone=e,this.bone.matrixAutoUpdate=!1,this.radius=null!==(n=t.radius)&&void 0!==n?n:.02,this.stiffnessForce=null!==(i=t.stiffnessForce)&&void 0!==i?i:1,this.gravityDir=t.gravityDir?(new me).copy(t.gravityDir):(new me).set(0,-1,0),this.gravityPower=null!==(r=t.gravityPower)&&void 0!==r?r:0,this.dragForce=null!==(s=t.dragForce)&&void 0!==s?s:.4,this.colliders=null!==(a=t.colliders)&&void 0!==a?a:[],this._centerSpacePosition.setFromMatrixPosition(this.bone.matrixWorld),this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),0===this.bone.children.length)this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);else{const e=this.bone.children[0];this._initialLocalChildPosition.copy(e.position)}this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)),this._prevTail.copy(this._currentTail),this._nextTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize(),this._centerSpaceBoneLength=Vl.copy(this._initialLocalChildPosition).applyMatrix4(this.bone.matrixWorld).sub(this._centerSpacePosition).length(),this.center=null!==(o=t.center)&&void 0!==o?o:null}get center(){return this._center}set center(e){var t;this._getMatrixCenterToWorld(Fl),this._currentTail.applyMatrix4(Fl),this._prevTail.applyMatrix4(Fl),this._nextTail.applyMatrix4(Fl),(null===(t=this._center)||void 0===t?void 0:t.userData.inverseCacheProxy)&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=e,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new Hl(this._center.matrixWorld))),this._getMatrixWorldToCenter(Fl),this._currentTail.applyMatrix4(Fl),this._prevTail.applyMatrix4(Fl),this._nextTail.applyMatrix4(Fl),Fl.multiply(this.bone.matrixWorld),this._centerSpacePosition.setFromMatrixPosition(Fl),this._centerSpaceBoneLength=Vl.copy(this._initialLocalChildPosition).applyMatrix4(Fl).sub(this._centerSpacePosition).length()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix),this._centerSpacePosition.setFromMatrixPosition(this.bone.matrixWorld),this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)),this._prevTail.copy(this._currentTail),this._nextTail.copy(this._currentTail)}update(e){if(e<=0)return;this.bone.parent?Gc(this.bone.parent,this._parentWorldRotation):this._parentWorldRotation.copy(Il),this._getMatrixWorldToCenter(Fl),Fl.multiply(this.bone.matrixWorld),this._centerSpacePosition.setFromMatrixPosition(Fl),this._getMatrixWorldToCenter(Bl),Bl.multiply(this._getParentMatrixWorld());const t=this.stiffnessForce*e,n=Nl.copy(this.gravityDir).multiplyScalar(this.gravityPower*e);this._nextTail.copy(this._currentTail).add(Vl.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.dragForce)).add(Vl.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(Bl).sub(this._centerSpacePosition).normalize().multiplyScalar(t)).add(n),this._nextTail.sub(this._centerSpacePosition).normalize().multiplyScalar(this._centerSpaceBoneLength).add(this._centerSpacePosition),this._collision(this._nextTail),this._prevTail.copy(this._currentTail),this._currentTail.copy(this._nextTail);const i=Pl(Fl.copy(Bl.multiply(this._initialLocalMatrix))),r=Ol.setFromUnitVectors(this._boneAxis,Vl.copy(this._nextTail).applyMatrix4(i).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(r),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix)}_collision(e){this.colliders.forEach((t=>{this._getMatrixWorldToCenter(Fl),Fl.multiply(t.matrixWorld);const n=Vl.setFromMatrixPosition(Fl),i=t.geometry.boundingSphere.radius,r=this.radius+i;if(e.distanceToSquared(n)<=r*r){const t=Nl.subVectors(e,n).normalize(),i=Dl.addVectors(n,t.multiplyScalar(r));e.copy(i.sub(this._centerSpacePosition).normalize().multiplyScalar(this._centerSpaceBoneLength).add(this._centerSpacePosition))}}))}_getMatrixCenterToWorld(e){return this._center?e.copy(this._center.matrixWorld):e.identity(),e}_getMatrixWorldToCenter(e){return this._center?e.copy(this._center.userData.inverseCacheProxy.inverse):e.identity(),e}_getParentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:kl}}class Wl{constructor(e,t){this.colliderGroups=[],this.springBoneGroupList=[],this.colliderGroups=e,this.springBoneGroupList=t}setCenter(e){this.springBoneGroupList.forEach((t=>{t.forEach((t=>{t.center=e}))}))}lateUpdate(e){const t=new Set;this.springBoneGroupList.forEach((n=>{n.forEach((n=>{this._updateWorldMatrix(t,n.bone),n.update(e)}))}))}reset(){const e=new Set;this.springBoneGroupList.forEach((t=>{t.forEach((t=>{this._updateWorldMatrix(e,t.bone),t.reset()}))}))}_updateWorldMatrix(e,t){e.has(t)||(t.parent&&this._updateWorldMatrix(e,t.parent),t.updateWorldMatrix(!1,!1),e.add(t))}}const Gl=new me,jl=new Rt({visible:!1});class ql{import(e){var t;return Lc(this,void 0,void 0,(function*(){const n=null===(t=e.parser.json.extensions)||void 0===t?void 0:t.VRM;if(!n)return null;const i=n.secondaryAnimation;if(!i)return null;const r=yield this._importColliderMeshGroups(e,i),s=yield this._importSpringBoneGroupList(e,i,r);return new Wl(r,s)}))}_createSpringBone(e,t={}){return new Ul(e,t)}_importSpringBoneGroupList(e,t,n){return Lc(this,void 0,void 0,(function*(){const i=t.boneGroups||[],r=[];return yield Promise.all(i.map((t=>Lc(this,void 0,void 0,(function*(){if(void 0===t.stiffiness||void 0===t.gravityDir||void 0===t.gravityDir.x||void 0===t.gravityDir.y||void 0===t.gravityDir.z||void 0===t.gravityPower||void 0===t.dragForce||void 0===t.hitRadius||void 0===t.colliderGroups||void 0===t.bones||void 0===t.center)return;const i=t.stiffiness,s=new me(t.gravityDir.x,t.gravityDir.y,-t.gravityDir.z),a=t.gravityPower,o=t.dragForce,c=t.hitRadius,l=[];t.colliderGroups.forEach((e=>{l.push(...n[e].colliders)}));const u=[];yield Promise.all(t.bones.map((n=>Lc(this,void 0,void 0,(function*(){const r=yield e.parser.getDependency("node",n),d=-1!==t.center?yield e.parser.getDependency("node",t.center):null;r&&r.traverse((e=>{const t=this._createSpringBone(e,{radius:c,stiffnessForce:i,gravityDir:s,gravityPower:a,dragForce:o,colliders:l,center:d});u.push(t)}))}))))),r.push(u)}))))),r}))}_importColliderMeshGroups(e,t){return Lc(this,void 0,void 0,(function*(){const n=t.colliderGroups;if(void 0===n)return[];const i=[];return n.forEach((t=>Lc(this,void 0,void 0,(function*(){if(void 0===t.node||void 0===t.colliders)return;const n=yield e.parser.getDependency("node",t.node),r=[];t.colliders.forEach((e=>{if(void 0===e.offset||void 0===e.offset.x||void 0===e.offset.y||void 0===e.offset.z||void 0===e.radius)return;const t=Gl.set(e.offset.x,e.offset.y,-e.offset.z),i=this._createColliderMesh(e.radius,t);n.add(i),r.push(i)}));const s={node:t.node,colliders:r};i.push(s)})))),i}))}_createColliderMesh(e,t){const n=new un(new mo(e,8,4),jl);return n.position.copy(t),n.name="vrmColliderSphere",n.geometry.computeBoundingSphere(),n}}class $l{constructor(e={}){this._metaImporter=e.metaImporter||new zl,this._blendShapeImporter=e.blendShapeImporter||new qc,this._lookAtImporter=e.lookAtImporter||new vl,this._humanoidImporter=e.humanoidImporter||new rl,this._firstPersonImporter=e.firstPersonImporter||new Zc,this._materialImporter=e.materialImporter||new Al,this._springBoneImporter=e.springBoneImporter||new ql}import(e){return Lc(this,void 0,void 0,(function*(){if(void 0===e.parser.json.extensions||void 0===e.parser.json.extensions.VRM)throw new Error("Could not find VRM extension on the GLTF");const t=e.scene;t.updateMatrixWorld(!1),t.traverse((e=>{e.isMesh&&(e.frustumCulled=!1)}));const n=(yield this._metaImporter.import(e))||void 0,i=(yield this._materialImporter.convertGLTFMaterials(e))||void 0,r=(yield this._humanoidImporter.import(e))||void 0,s=r&&(yield this._firstPersonImporter.import(e,r))||void 0,a=(yield this._blendShapeImporter.import(e))||void 0,o=s&&a&&r&&(yield this._lookAtImporter.import(e,s,a,r))||void 0,c=(yield this._springBoneImporter.import(e))||void 0;return new Xl({scene:e.scene,meta:n,materials:i,humanoid:r,firstPerson:s,blendShapeProxy:a,lookAt:o,springBoneManager:c})}))}}class Xl{constructor(e){this.scene=e.scene,this.humanoid=e.humanoid,this.blendShapeProxy=e.blendShapeProxy,this.firstPerson=e.firstPerson,this.lookAt=e.lookAt,this.materials=e.materials,this.springBoneManager=e.springBoneManager,this.meta=e.meta}static from(e,t={}){return Lc(this,void 0,void 0,(function*(){const n=new $l(t);return yield n.import(e)}))}update(e){this.lookAt&&this.lookAt.update(e),this.blendShapeProxy&&this.blendShapeProxy.update(),this.springBoneManager&&this.springBoneManager.lateUpdate(e),this.materials&&this.materials.forEach((t=>{t.updateVRMMaterials&&t.updateVRMMaterials(e)}))}dispose(){var e,t;const n=this.scene;n&&n.traverse(zc),null===(t=null===(e=this.meta)||void 0===e?void 0:e.texture)||void 0===t||t.dispose()}}const Kl=new K,Yl=new Un(-1,1,-1,1,-1,1),Jl=new Rt({color:16777215,side:2}),Zl=new un(new Pn(2,2),Jl),Ql=new ys;Ql.add(Zl);class eu{constructor(){}}eu.extractThumbnailBlob=function(e,t,n=512){var i;const r=null===(i=t.meta)||void 0===i?void 0:i.texture;if(!r)throw new Error("extractThumbnailBlob: This VRM does not have a thumbnail");const s=e.getContext().canvas;e.getSize(Kl);const a=Kl.x,o=Kl.y;return e.setSize(n,n,!1),Jl.map=r,e.render(Ql,Yl),Jl.map=null,s instanceof OffscreenCanvas?s.convertToBlob().finally((()=>{e.setSize(a,o,!1)})):new Promise(((t,n)=>{s.toBlob((i=>{e.setSize(a,o,!1),null==i?n("extractThumbnailBlob: Failed to create a blob"):t(i)}))}))},eu.removeUnnecessaryJoints=function(e){const t=new Map;e.traverse((e=>{if("SkinnedMesh"!==e.type)return;const n=e,i=n.geometry.getAttribute("skinIndex");let r=t.get(i);if(!r){const e=[],s=[],a={},o=i.array;for(let t=0;t{var n,i,r,s;if(!e.isMesh)return;const a=e,o=a.geometry,c=o.index;if(null==c)return;const l=t.get(o);if(null!=l)return void(a.geometry=l);const u=new jt;u.name=o.name,u.morphTargetsRelative=o.morphTargetsRelative,o.groups.forEach((e=>{u.addGroup(e.start,e.count,e.materialIndex)})),u.boundingBox=null!==(i=null===(n=o.boundingBox)||void 0===n?void 0:n.clone())&&void 0!==i?i:null,u.boundingSphere=null!==(s=null===(r=o.boundingSphere)||void 0===r?void 0:r.clone())&&void 0!==s?s:null,u.setDrawRange(o.drawRange.start,o.drawRange.count),u.userData=o.userData,t.set(o,u);const d=[],h=[];{const e=c.array,t=new e.constructor(e.length);let n=0;for(let i=0;i{const t=o.attributes[e];if(t.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const n=t.array,{itemSize:i,normalized:r}=t,s=new n.constructor(h.length*i);h.forEach(((e,t)=>{for(let r=0;r{u.morphAttributes[e]=[];const t=o.morphAttributes[e];for(let n=0;n{for(let n=0;n0===e)),u.morphAttributes[e][n]=new kt(o,s,a)}})),f&&(u.morphAttributes={}),a.geometry=u})),Array.from(t.keys()).forEach((e=>{e.dispose()}))};const tu=new me;class nu extends fl{setupHelper(e,t){t.disableFaceDirectionHelper||(this._faceDirectionHelper=new Ec(new me(0,0,-1),new me(0,0,0),.5,16711935),e.add(this._faceDirectionHelper))}update(e){super.update(e),this._faceDirectionHelper&&(this.firstPerson.getFirstPersonWorldPosition(this._faceDirectionHelper.position),this._faceDirectionHelper.setDirection(this.getLookAtWorldDirection(tu)))}}class iu extends vl{import(e,t,n,i){var r;const s=null===(r=e.parser.json.extensions)||void 0===r?void 0:r.VRM;if(!s)return null;const a=s.firstPerson;if(!a)return null;const o=this._importApplyer(a,n,i);return new nu(t,o||void 0)}}const ru=new Rt({color:16711935,wireframe:!0,transparent:!0,depthTest:!1});class su extends Wl{setupHelper(e,t){t.disableSpringBoneHelper||(this.springBoneGroupList.forEach((t=>{t.forEach((t=>{if(t.getGizmo){const n=t.getGizmo();e.add(n)}}))})),this.colliderGroups.forEach((e=>{e.colliders.forEach((e=>{e.material=ru,e.renderOrder=uu}))})))}}const au=new me;class ou extends Ul{constructor(e,t){super(e,t)}getGizmo(){if(this._gizmo)return this._gizmo;const e=au.copy(this._nextTail).sub(this._centerSpacePosition),t=e.length();return this._gizmo=new Ec(e.normalize(),this._centerSpacePosition,t,16776960,this.radius,this.radius),this._gizmo.line.renderOrder=uu,this._gizmo.cone.renderOrder=uu,this._gizmo.line.material.depthTest=!1,this._gizmo.line.material.transparent=!0,this._gizmo.cone.material.depthTest=!1,this._gizmo.cone.material.transparent=!0,this._gizmo}update(e){super.update(e),this._updateGizmo()}_updateGizmo(){if(!this._gizmo)return;const e=au.copy(this._currentTail).sub(this._centerSpacePosition),t=e.length();this._gizmo.setDirection(e.normalize()),this._gizmo.setLength(t,this.radius,this.radius),this._gizmo.position.copy(this._centerSpacePosition)}}class cu extends ql{import(e){var t;return Lc(this,void 0,void 0,(function*(){const n=null===(t=e.parser.json.extensions)||void 0===t?void 0:t.VRM;if(!n)return null;const i=n.secondaryAnimation;if(!i)return null;const r=yield this._importColliderMeshGroups(e,i),s=yield this._importSpringBoneGroupList(e,i,r);return new su(r,s)}))}_createSpringBone(e,t){return new ou(e,t)}}class lu extends $l{constructor(e={}){e.lookAtImporter=e.lookAtImporter||new iu,e.springBoneImporter=e.springBoneImporter||new cu,super(e)}import(e,t={}){return Lc(this,void 0,void 0,(function*(){if(void 0===e.parser.json.extensions||void 0===e.parser.json.extensions.VRM)throw new Error("Could not find VRM extension on the GLTF");const n=e.scene;n.updateMatrixWorld(!1),n.traverse((e=>{e.isMesh&&(e.frustumCulled=!1)}));const i=(yield this._metaImporter.import(e))||void 0,r=(yield this._materialImporter.convertGLTFMaterials(e))||void 0,s=(yield this._humanoidImporter.import(e))||void 0,a=s&&(yield this._firstPersonImporter.import(e,s))||void 0,o=(yield this._blendShapeImporter.import(e))||void 0,c=a&&o&&s&&(yield this._lookAtImporter.import(e,a,o,s))||void 0;c.setupHelper&&c.setupHelper(n,t);const l=(yield this._springBoneImporter.import(e))||void 0;return l.setupHelper&&l.setupHelper(n,t),new du({scene:e.scene,meta:i,materials:r,humanoid:s,firstPerson:a,blendShapeProxy:o,lookAt:c,springBoneManager:l},t)}))}}const uu=1e4;class du extends Xl{static from(e,t={},n={}){return Lc(this,void 0,void 0,(function*(){const i=new lu(t);return yield i.import(e,n)}))}constructor(e,t={}){super(e),t.disableBoxHelper||this.scene.add(new Mc(this.scene)),t.disableSkeletonHelper||this.scene.add(new bc(this.scene))}update(e){super.update(e)}}},696:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.MediapipeAvator=void 0;var a=n(698),o=n(314),c=s(n(232)),l=function(){function e(e,t,n){void 0===n&&(n={x:0,y:0,z:0});var i=this;this.enableFace=!0,this.enableUpperBody=!0,this.enableLegs=!0,this.enableHands=!0,this.oldLookTarget=new c.Euler,this.LEFT_LOWER_ARM_TARGET_COLOR="rgba(255, 0, 0, 0.5)",this.LEFT_UPPER_ARM_TARGET_COLOR="rgba(0, 255, 0, 0.5)",this.RIGHT_LOWER_ARM_TARGET_COLOR="rgba(255, 0, 255, 0.5)",this.RIGHT_UPPER_ARM_TARGET_COLOR="rgba(0, 255, 255, 0.5)",this.INVISIBLE="rgba(0, 0, 0, 0)",this.leftLowerArmTarget=new c.Mesh(new c.SphereGeometry(.05),new c.MeshBasicMaterial({color:this.LEFT_LOWER_ARM_TARGET_COLOR})),this.leftUpperArmTarget=new c.Mesh(new c.SphereGeometry(.05),new c.MeshBasicMaterial({color:this.LEFT_UPPER_ARM_TARGET_COLOR})),this.rightLowerArmTarget=new c.Mesh(new c.SphereGeometry(.05),new c.MeshBasicMaterial({color:this.RIGHT_LOWER_ARM_TARGET_COLOR})),this.rightUpperArmTarget=new c.Mesh(new c.SphereGeometry(.05),new c.MeshBasicMaterial({color:this.RIGHT_UPPER_ARM_TARGET_COLOR})),this.initialize=function(e,t,n){void 0===n&&(n={x:0,y:0,z:0}),i.avatar=e,i.scene=t,i.offset=n,t.add(i.leftLowerArmTarget),t.add(i.leftUpperArmTarget),t.add(i.rightLowerArmTarget),t.add(i.rightUpperArmTarget)},this._isTargetVisible=!0,this.useSlerp=!1,this.rigRotation=function(e,t,n,r){void 0===t&&(t={x:0,y:0,z:0}),void 0===n&&(n=1),void 0===r&&(r=.3);var s=i.avatar.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName[e]);if(s){var o=new c.Euler(t.x*n,t.y*n,t.z*n),l=(new c.Quaternion).setFromEuler(o);s.quaternion.slerp(l,r)}},this.rigPosition=function(e,t,n,r){void 0===t&&(t={x:0,y:0,z:0}),void 0===n&&(n=1),void 0===r&&(r=.3);var s=i.avatar.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName[e]);if(s){var o=new c.Vector3(t.x*n,t.y*n,t.z*n);s.position.lerp(o,r)}},this.rigFace=function(e){var t=JSON.parse(JSON.stringify(e));i.rigRotation("Neck",t.head,.7);var n=i.avatar.blendShapeProxy,r=a.VRMSchema.BlendShapePresetName;t.eye.l=o.Vector.lerp(o.Utils.clamp(1-t.eye.l,0,1),n.getValue(r.Blink),.5),t.eye.r=o.Vector.lerp(o.Utils.clamp(1-t.eye.r,0,1),n.getValue(r.Blink),.5),t.eye=o.Face.stabilizeBlink(t.eye,t.head.y),n.setValue(r.Blink,t.eye.l),n.setValue(r.I,o.Vector.lerp(t.mouth.shape.I,n.getValue(r.I),.5)),n.setValue(r.A,o.Vector.lerp(t.mouth.shape.A,n.getValue(r.A),.5)),n.setValue(r.E,o.Vector.lerp(t.mouth.shape.E,n.getValue(r.E),.5)),n.setValue(r.O,o.Vector.lerp(t.mouth.shape.O,n.getValue(r.O),.5)),n.setValue(r.U,o.Vector.lerp(t.mouth.shape.U,n.getValue(r.U),.5));var s=new c.Euler(o.Vector.lerp(i.oldLookTarget.x,t.pupil.y,.4),o.Vector.lerp(i.oldLookTarget.y,t.pupil.x,.4),0,"XYZ");i.oldLookTarget.copy(s),i.avatar.lookAt.applyer.lookAt(s),i.avatar.blendShapeProxy.update()},this.rigUpperBody=function(e){i.rigRotation("Hips",e.Hips.rotation,.7),i.rigPosition("Hips",{x:e.Hips.position.x,y:e.Hips.position.y+1,z:-e.Hips.position.z},1,.07),i.rigRotation("Chest",e.Spine,.25,.3),i.rigRotation("Spine",e.Spine,.45,.3),i.rigRotation("RightUpperArm",e.RightUpperArm,1,.3),i.rigRotation("RightLowerArm",e.RightLowerArm,1,.3),i.rigRotation("LeftUpperArm",e.LeftUpperArm,1,.3),i.rigRotation("LeftLowerArm",e.LeftLowerArm,1,.3)},this.rigLegs=function(e){i.rigRotation("LeftUpperLeg",e.LeftUpperLeg,1,.3),i.rigRotation("LeftLowerLeg",e.LeftLowerLeg,1,.3),i.rigRotation("RightUpperLeg",e.RightUpperLeg,1,.3),i.rigRotation("RightLowerLeg",e.RightLowerLeg,1,.3)},this.rigLeftHand=function(e,t){i.rigRotation("LeftHand",{z:t.LeftHand.z,y:e.LeftWrist.y,x:e.LeftWrist.x}),i.rigRotation("LeftRingProximal",e.LeftRingProximal),i.rigRotation("LeftRingIntermediate",e.LeftRingIntermediate),i.rigRotation("LeftRingDistal",e.LeftRingDistal),i.rigRotation("LeftIndexProximal",e.LeftIndexProximal),i.rigRotation("LeftIndexIntermediate",e.LeftIndexIntermediate),i.rigRotation("LeftIndexDistal",e.LeftIndexDistal),i.rigRotation("LeftMiddleProximal",e.LeftMiddleProximal),i.rigRotation("LeftMiddleIntermediate",e.LeftMiddleIntermediate),i.rigRotation("LeftMiddleDistal",e.LeftMiddleDistal),i.rigRotation("LeftThumbProximal",e.LeftThumbProximal),i.rigRotation("LeftThumbIntermediate",e.LeftThumbIntermediate),i.rigRotation("LeftThumbDistal",e.LeftThumbDistal),i.rigRotation("LeftLittleProximal",e.LeftLittleProximal),i.rigRotation("LeftLittleIntermediate",e.LeftLittleIntermediate),i.rigRotation("LeftLittleDistal",e.LeftLittleDistal)},this.rigRightHand=function(e,t){i.rigRotation("RightHand",{z:t.RightHand.z,y:e.RightWrist.y,x:e.RightWrist.x}),i.rigRotation("RightRingProximal",e.RightRingProximal),i.rigRotation("RightRingIntermediate",e.RightRingIntermediate),i.rigRotation("RightRingDistal",e.RightRingDistal),i.rigRotation("RightIndexProximal",e.RightIndexProximal),i.rigRotation("RightIndexIntermediate",e.RightIndexIntermediate),i.rigRotation("RightIndexDistal",e.RightIndexDistal),i.rigRotation("RightMiddleProximal",e.RightMiddleProximal),i.rigRotation("RightMiddleIntermediate",e.RightMiddleIntermediate),i.rigRotation("RightMiddleDistal",e.RightMiddleDistal),i.rigRotation("RightThumbProximal",e.RightThumbProximal),i.rigRotation("RightThumbIntermediate",e.RightThumbIntermediate),i.rigRotation("RightThumbDistal",e.RightThumbDistal),i.rigRotation("RightLittleProximal",e.RightLittleProximal),i.rigRotation("RightLittleIntermediate",e.RightLittleIntermediate),i.rigRotation("RightLittleDistal",e.RightLittleDistal)},this.updatePose=function(e,t,n,r){i.enableFace&&e&&i.rigFace(e),i.enableUpperBody&&t&&i.rigUpperBody(t),i.enableLegs&&t&&i.rigLegs(t),i.enableHands&&t&&(n&&i.rigLeftHand(n,t),r&&i.rigRightHand(r,t))},this.rigUpperShaft=function(e){i.rigRotation("Hips",e.Hips.rotation,.7),i.rigPosition("Hips",{x:e.Hips.position.x,y:e.Hips.position.y+1,z:-e.Hips.position.z},1,.07),i.rigRotation("Chest",e.Spine,.25,.3),i.rigRotation("Spine",e.Spine,.45,.3)},this.getArmPointTFList=function(e,t,n,i){var r=e.singlePersonKeypoints3DMovingAverage;return[t,n,i].map((function(e){return new c.Vector4(r[e].x,r[e].y,r[e].z,r[e].score)}))},this.getTargetVectorFromShoulderTF=function(e,t){var n=t.clone().sub(e);return new c.Vector3(n.x,-1*n.y,1*n.z)},this.getTargetPosition=function(e,t,n){var i;if(!(i="Left"==t?e.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName.LeftShoulder):e.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName.RightShoulder)))return null;var r=new c.Vector3;i.getWorldPosition(r);var s=i.worldToLocal(r.clone()).clone().add(n);return i.localToWorld(s.clone())},this.getTargetPosition2=function(e,t,n){var i=e.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName.LeftShoulder),r=e.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName.RightShoulder);if(!i||!r)return null;var s=new c.Vector3;i.getWorldPosition(s);var o=new c.Vector3;r.getWorldPosition(o);var l=s.add(o).divideScalar(2),u=i.worldToLocal(l.clone()).clone().add(n);return i.localToWorld(u.clone())},this.moveArm=function(e,t,n,i){var r=new c.Vector3(n.x,n.y,n.z),s=new c.Vector3,a=new c.Quaternion,o=new c.Vector3;e.matrixWorld.decompose(s,a,o),a.invert();var l=new c.Vector3,u=new c.Vector3;t.getWorldPosition(l),u.subVectors(l,s),u.applyQuaternion(a),u.normalize();var d=new c.Vector3;d.subVectors(r,s),d.applyQuaternion(a),d.normalize();var h=d.dot(u);if(h>1?h=1:h<-1&&(h=-1),!((h=Math.acos(h))<1e-5)){var f=new c.Vector3;f.crossVectors(u,d),f.normalize();var p=new c.Quaternion;p.setFromAxisAngle(f,h);var m=e.clone();return m.quaternion.multiply(p),i?e.quaternion.slerp(p,.3):e.quaternion.multiply(p),m}},this.updatePoseWithRawInternal2=function(e){var t=i.getArmPointTFList(e,12,14,16),n=i.getArmPointTFList(e,11,13,15),r=t[0].add(n[0]).divideScalar(2),s=i.getTargetVectorFromShoulderTF(r,t[1]),o=i.getTargetVectorFromShoulderTF(r,t[2]),c=i.getTargetVectorFromShoulderTF(r,n[1]),l=i.getTargetVectorFromShoulderTF(r,n[2]),u=i.avatar.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName.LeftUpperArm),d=i.avatar.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName.LeftLowerArm),h=i.avatar.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName.LeftHand),f=i.getTargetPosition2(i.avatar,"Left",s);f&&(i.moveArm(u,d,f,i.useSlerp),i.leftUpperArmTarget.position.set(f.x,f.y,f.z));var p=i.getTargetPosition2(i.avatar,"Left",o);p&&(i.moveArm(d,h,p,i.useSlerp),i.leftLowerArmTarget.position.set(p.x,p.y,p.z));var m=i.avatar.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName.RightUpperArm),g=i.avatar.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName.RightLowerArm),v=i.avatar.humanoid.getBoneNode(a.VRMSchema.HumanoidBoneName.RightHand);(f=i.getTargetPosition(i.avatar,"Right",c))&&(i.moveArm(m,g,f,i.useSlerp),i.rightUpperArmTarget.position.set(f.x,f.y,f.z)),(p=i.getTargetPosition(i.avatar,"Right",l))&&(i.moveArm(g,v,p,i.useSlerp),i.rightLowerArmTarget.position.set(p.x,p.y,p.z))},this.updatePoseWithRaw=function(e,t,n,r,s){i.enableFace&&e&&i.rigFace(e),i.enableUpperBody&&t&&i.rigUpperShaft(t),s&&s.singlePersonKeypoints3DMovingAverage&&i.updatePoseWithRawInternal2(s),i.enableHands&&t&&(n&&i.rigLeftHand(n,t),r&&i.rigRightHand(r,t))},e&&(this.avatar=e),t&&(this.scene=t,t.add(this.leftLowerArmTarget),t.add(this.leftUpperArmTarget),t.add(this.rightLowerArmTarget),t.add(this.rightUpperArmTarget)),this.offset=n}return e.prototype.setOffset=function(e){this.offset=e},Object.defineProperty(e.prototype,"isTargetVisible",{get:function(){return this._isTargetVisible},set:function(e){e?(this.scene.add(this.leftUpperArmTarget),this.scene.add(this.leftLowerArmTarget),this.scene.add(this.rightUpperArmTarget),this.scene.add(this.rightLowerArmTarget)):(this.scene.remove(this.leftUpperArmTarget),this.scene.remove(this.leftLowerArmTarget),this.scene.remove(this.rightUpperArmTarget),this.scene.remove(this.rightLowerArmTarget)),this._isTargetVisible=e},enumerable:!1,configurable:!0}),e}();t.MediapipeAvator=l},375:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},a=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,i,r,s,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(s){return function(o){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]0?[4,Promise.race(e)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:return n=i.sent(),console.log("catch error:::",n),[3,5];case 5:return[2,{hands:this.latestHands,faces:this.latestFaces,poses:this.latestPoses,leftHandRig:this.latestLeftHandRig,rightHandRig:this.latestRightHandRig,faceRig:this.latestFaceRig,poseRig:this.latestPoseRig}]}}))}))},this.count=0,this.predictFaces=function(t){return a(e,void 0,void 0,(function(){var e,n,i;return o(this,(function(r){switch(r.label){case 0:if(!this.faceDetector)return this.faceProcessing=!1,[2,"predictFaces"];r.label=1;case 1:return r.trys.push([1,3,,4]),e=this,[4,this.faceDetector.predict(this.faceParams,t)];case 2:return e.latestFaces=r.sent(),[3,4];case 3:return n=r.sent(),console.log("predictFaces:",n),[3,4];case 4:return this.latestFaces&&this.latestFaces.rowPrediction&&this.latestFaces.rowPrediction.length>0&&this.latestFaces.rowPrediction[0].keypoints&&(i=c.Face.solve(this.latestFaces.singlePersonKeypointsMovingAverage,{runtime:"mediapipe",imageSize:{height:t.height,width:t.width},smoothBlink:!0}),this.latestFaceRig=JSON.parse(JSON.stringify(i))),this.faceProcessing=!1,[2,"predictFaces"]}}))}))},this.predictHands=function(t){return a(e,void 0,void 0,(function(){var e,n,i,r,s;return o(this,(function(a){switch(a.label){case 0:if(!this.handDetector)return this.handProcessing=!1,[2,"predictHands"];a.label=1;case 1:return a.trys.push([1,3,,4]),e=this,[4,this.handDetector.predict(this.handParams,t)];case 2:return e.latestHands=a.sent(),[3,4];case 3:return n=a.sent(),console.log("predictHands:",n),[3,4];case 4:if(this.latestHands&&this.latestHands.rowPrediction&&this.latestHands.rowPrediction.length>0)for(i=0;i0&&(this.latestPoses.singlePersonKeypointsMovingAverage.forEach((function(e){e.x*=t.width,e.y*=t.height,e.z*=t.width})),this.latestPoses.singlePersonKeypoints3DMovingAverage.forEach((function(e){e.x/=2,e.y/=2})),i=c.Pose.solve(this.latestPoses.singlePersonKeypoints3DMovingAverage,this.latestPoses.singlePersonKeypointsMovingAverage,{runtime:"tfjs",imageSize:{height:t.height,width:t.width},smoothLandmarks:!0}),this.latestPoseRig=JSON.parse(JSON.stringify(i))),this.poseProcessing=!1,[2,"predictPoses"]}}))}))}}},950:function(e,t,n){"use strict";var i,r,s,a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.calcBrow=t.getBrowRaise=t.calcPupils=t.calcEyes=t.stabilizeBlink=t.pupilPos=t.eyeLidRatio=t.getEyeOpen=void 0;var o=a(n(360)),c=n(652),l=n(147),u={eye:(i={},i[l.LEFT]=[130,133,160,159,158,144,145,153],i[l.RIGHT]=[263,362,387,386,385,373,374,380],i),brow:(r={},r[l.LEFT]=[35,244,63,105,66,229,230,231],r[l.RIGHT]=[265,464,293,334,296,449,450,451],r),pupil:(s={},s[l.LEFT]=[468,469,470,471,472],s[l.RIGHT]=[473,474,475,476,477],s)};t.getEyeOpen=function(e,n,i){void 0===n&&(n=l.LEFT);var r=void 0===i?{}:i,s=r.high,a=void 0===s?.85:s,o=r.low,d=void 0===o?.55:o,h=u.eye[n],f=(0,t.eyeLidRatio)(e[h[0]],e[h[1]],e[h[2]],e[h[3]],e[h[4]],e[h[5]],e[h[6]],e[h[7]]),p=(0,c.clamp)(f/.285,0,2);return{norm:(0,c.remap)(p,d,a),raw:p}},t.eyeLidRatio=function(e,t,n,i,r,s,a,c){e=new o.default(e),t=new o.default(t),n=new o.default(n),i=new o.default(i),r=new o.default(r),s=new o.default(s),a=new o.default(a),c=new o.default(c);var l=e.distance(t,2);return(n.distance(s,2)+i.distance(a,2)+r.distance(c,2))/3/l},t.pupilPos=function(e,t){void 0===t&&(t=l.LEFT);var n=new o.default(e[u.eye[t][0]]),i=new o.default(e[u.eye[t][1]]),r=n.distance(i,2),s=n.lerp(i,.5),a=new o.default(e[u.pupil[t][0]]),c=(s.x-a.x)/(r/2),d=(s.y-.075*r-a.y)/(r/4);return{x:c*=4,y:d*=4}},t.stabilizeBlink=function(e,t,n){var i=void 0===n?{}:n,r=i.enableWink,s=void 0===r||r,a=i.maxRot,l=void 0===a?.5:a;e.r=(0,c.clamp)(e.r,0,1),e.l=(0,c.clamp)(e.l,0,1);var u=Math.abs(e.l-e.r),d=s?.8:1.2,h=e.l<.3&&e.r<.3,f=e.l>.6&&e.r>.6;return t>l?{l:e.r,r:e.r}:t<-l?{l:e.l,r:e.l}:{l:u>=d&&!h&&!f?e.l:e.r>e.l?o.default.lerp(e.r,e.l,.95):o.default.lerp(e.r,e.l,.05),r:u>=d&&!h&&!f?e.r:e.r>e.l?o.default.lerp(e.r,e.l,.95):o.default.lerp(e.r,e.l,.05)}},t.calcEyes=function(e,n){var i=void 0===n?{}:n,r=i.high,s=void 0===r?.85:r,a=i.low,o=void 0===a?.55:a;if(478!==e.length)return{l:1,r:1};var c=(0,t.getEyeOpen)(e,l.LEFT,{high:s,low:o}),u=(0,t.getEyeOpen)(e,l.RIGHT,{high:s,low:o});return{l:c.norm||0,r:u.norm||0}},t.calcPupils=function(e){if(478!==e.length)return{x:0,y:0};var n=(0,t.pupilPos)(e,l.LEFT),i=(0,t.pupilPos)(e,l.RIGHT);return{x:.5*(n.x+i.x)||0,y:.5*(n.y+i.y)||0}},t.getBrowRaise=function(e,n){void 0===n&&(n=l.LEFT);var i=u.brow[n],r=.07,s=(0,t.eyeLidRatio)(e[i[0]],e[i[1]],e[i[2]],e[i[3]],e[i[4]],e[i[5]],e[i[6]],e[i[7]])/1.15-1;return((0,c.clamp)(s,r,.125)-r)/(.125-r)},t.calcBrow=function(e){return 478!==e.length?0:((0,t.getBrowRaise)(e,l.LEFT)+(0,t.getBrowRaise)(e,l.RIGHT))/2||0}},519:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.calcHead=t.createEulerPlane=void 0;var r=i(n(360)),s=n(147);t.createEulerPlane=function(e){var t=new r.default(e[21]),n=new r.default(e[251]),i=new r.default(e[397]),s=new r.default(e[172]);return{vector:[t,n,i.lerp(s,.5)],points:[t,n,i,s]}},t.calcHead=function(e){var n=(0,t.createEulerPlane)(e).vector,i=r.default.rollPitchYaw(n[0],n[1],n[2]),a=n[0].lerp(n[1],.5),o=n[0].distance(n[1]),c=a.distance(n[2]);return i.x*=-1,i.z*=-1,{y:i.y*s.PI,x:i.x*s.PI,z:i.z*s.PI,width:o,height:c,position:a.lerp(n[2],.5),normalized:{y:i.y,x:i.x,z:i.z},degrees:{y:180*i.y,x:180*i.x,z:180*i.z}}}},935:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.calcMouth=void 0;var r=i(n(360)),s=n(652);t.calcMouth=function(e){var t=new r.default(e[133]),n=new r.default(e[362]),i=new r.default(e[130]),a=new r.default(e[263]),o=t.distance(n),c=i.distance(a),l=new r.default(e[13]),u=new r.default(e[14]),d=new r.default(e[61]),h=new r.default(e[291]),f=l.distance(u),p=f/o,m=d.distance(h)/c;p=(0,s.remap)(p,.15,.7);var g=m=2*((m=(0,s.remap)(m,.45,.9))-.3),v=(0,s.remap)(f/o,.17,.5),y=(0,s.clamp)(2*(0,s.remap)(g,0,1)*(0,s.remap)(v,.2,.7),0,1),b=.4*v+v*(1-y)*.6,x=v*(0,s.remap)(1-y,0,.3)*.1;return{x:m||0,y:p||0,shape:{A:b||0,E:(0,s.remap)(x,.2,1)*(1-y)*.3||0,I:y||0,O:(1-y)*(0,s.remap)(v,.3,1)*.4||0,U:x||0}}}},417:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FaceSolver=void 0;var i=n(519),r=n(950),s=n(935),a=function(){function e(){}return e.solve=function(e,t){var n=void 0===t?{}:t,a=n.runtime,o=void 0===a?"tfjs":a,c=n.video,l=void 0===c?null:c,u=n.imageSize,d=void 0===u?null:u,h=n.smoothBlink,f=void 0!==h&&h,p=n.blinkSettings,m=void 0===p?[]:p;if(e){if(l){var g="string"==typeof l?document.querySelector(l):l;d={width:g.videoWidth,height:g.videoHeight}}if("mediapipe"===o&&d)for(var v=0,y=e;v0?m:"tfjs"===o?[.55,.85]:[.35,.5];var M=(0,r.calcEyes)(e,{high:m[1],low:m[0]});f&&(M=(0,r.stabilizeBlink)(M,x.y));var S=(0,r.calcPupils)(e);return{head:x,eye:M,brow:(0,r.calcBrow)(e),pupil:S,mouth:w}}console.error("Need Face Landmarks")},e.stabilizeBlink=r.stabilizeBlink,e}();t.FaceSolver=a},702:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HandSolver=void 0;var r=i(n(360)),s=n(652),a=n(147),o=n(147),c=function(){function e(){}return e.solve=function(e,t){if(void 0===t&&(t=a.RIGHT),e){var n=[new r.default(e[0]),new r.default(e[t===a.RIGHT?17:5]),new r.default(e[t===a.RIGHT?5:17])],i=r.default.rollPitchYaw(n[0],n[1],n[2]);i.y=i.z,i.y-=(a.LEFT,.4);var s={};return s[t+"Wrist"]={x:i.x,y:i.y,z:i.z},s[t+"RingProximal"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[0],e[13],e[14])},s[t+"RingIntermediate"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[13],e[14],e[15])},s[t+"RingDistal"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[14],e[15],e[16])},s[t+"IndexProximal"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[0],e[5],e[6])},s[t+"IndexIntermediate"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[5],e[6],e[7])},s[t+"IndexDistal"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[6],e[7],e[8])},s[t+"MiddleProximal"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[0],e[9],e[10])},s[t+"MiddleIntermediate"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[9],e[10],e[11])},s[t+"MiddleDistal"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[10],e[11],e[12])},s[t+"ThumbProximal"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[0],e[1],e[2])},s[t+"ThumbIntermediate"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[1],e[2],e[3])},s[t+"ThumbDistal"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[2],e[3],e[4])},s[t+"LittleProximal"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[0],e[17],e[18])},s[t+"LittleIntermediate"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[17],e[18],e[19])},s[t+"LittleDistal"]={x:0,y:0,z:r.default.angleBetween3DCoords(e[18],e[19],e[20])},l(s,t)}console.error("Need Hand Landmarks")},e}();t.HandSolver=c;var l=function(e,t){void 0===t&&(t=a.RIGHT);var n=t===a.RIGHT?1:-1,i=["Proximal","Intermediate","Distal"];return e[t+"Wrist"].x=(0,s.clamp)(2*e[t+"Wrist"].x*n,-.3,.3),e[t+"Wrist"].y=(0,s.clamp)(2.3*e[t+"Wrist"].y,t===a.RIGHT?-1.2:-.6,t===a.RIGHT?.6:1.6),e[t+"Wrist"].z=-2.3*e[t+"Wrist"].z*n,["Ring","Index","Little","Thumb","Middle"].forEach((function(r){i.forEach((function(i){var c=e[t+r+i];if("Thumb"===r){var l={x:"Proximal"===i?2.2:0,y:"Proximal"===i?2.2:"Intermediate"===i?.7:1,z:.5},u={x:"Proximal"===i?1.2:-.2,y:"Proximal"===i?1.1*n:.1*n,z:.2*n},d={x:0,y:0,z:0};"Proximal"===i?(d.z=(0,s.clamp)(u.z+c.z*-o.PI*l.z*n,t===a.RIGHT?-.6:-.3,t===a.RIGHT?.3:.6),d.x=(0,s.clamp)(u.x+c.z*-o.PI*l.x,-.6,.3),d.y=(0,s.clamp)(u.y+c.z*-o.PI*l.y*n,t===a.RIGHT?-1:-.3,t===a.RIGHT?.3:1)):(d.z=(0,s.clamp)(u.z+c.z*-o.PI*l.z*n,-2,2),d.x=(0,s.clamp)(u.x+c.z*-o.PI*l.x,-2,2),d.y=(0,s.clamp)(u.y+c.z*-o.PI*l.y*n,-2,2)),c.x=d.x,c.y=d.y,c.z=d.z}else c.z=(0,s.clamp)(c.z*-o.PI*n,t===a.RIGHT?-o.PI:0,t===a.RIGHT?0:o.PI)}))})),e}},95:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rigArm=t.calcArms=void 0;var r=i(n(360)),s=n(652),a=n(147),o=n(147);t.calcArms=function(e){var n={r:r.default.findRotation(e[11],e[13]),l:r.default.findRotation(e[12],e[14])};n.r.y=r.default.angleBetween3DCoords(e[12],e[11],e[13]),n.l.y=r.default.angleBetween3DCoords(e[11],e[12],e[14]);var i={r:r.default.findRotation(e[13],e[15]),l:r.default.findRotation(e[14],e[16])};i.r.y=r.default.angleBetween3DCoords(e[11],e[13],e[15]),i.l.y=r.default.angleBetween3DCoords(e[12],e[14],e[16]),i.r.z=(0,s.clamp)(i.r.z,-2.14,0),i.l.z=(0,s.clamp)(i.l.z,-2.14,0);var o={r:r.default.findRotation(r.default.fromArray(e[15]),r.default.lerp(r.default.fromArray(e[17]),r.default.fromArray(e[19]),.5)),l:r.default.findRotation(r.default.fromArray(e[16]),r.default.lerp(r.default.fromArray(e[18]),r.default.fromArray(e[20]),.5))},c=(0,t.rigArm)(n.r,i.r,o.r,a.RIGHT),l=(0,t.rigArm)(n.l,i.l,o.l,a.LEFT);return{UpperArm:{r:c.UpperArm,l:l.UpperArm},LowerArm:{r:c.LowerArm,l:l.LowerArm},Hand:{r:c.Hand,l:l.Hand},Unscaled:{UpperArm:n,LowerArm:i,Hand:o}}},t.rigArm=function(e,t,n,i){void 0===i&&(i=a.RIGHT);var r=i===a.RIGHT?1:-1;return e.z*=-2.3*r,e.y*=o.PI*r,e.y-=Math.max(t.x),e.y-=-r*Math.max(t.z,0),e.x-=.3*r,t.z*=-2.14*r,t.y*=2.14*r,t.x*=2.14*r,e.x=(0,s.clamp)(e.x,-.5,o.PI),t.x=(0,s.clamp)(t.x,-.3,.3),n.y=(0,s.clamp)(2*n.z,-.6,.6),n.z=-2.3*n.z*r,{UpperArm:e,LowerArm:t,Hand:n}}},699:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rigHips=t.calcHips=void 0;var r=i(n(360)),s=n(652),a=n(147);t.calcHips=function(e,n){var i=r.default.fromArray(n[23]),a=r.default.fromArray(n[24]),o=r.default.fromArray(n[11]),c=r.default.fromArray(n[12]),l=i.lerp(a,1),u=o.lerp(c,1),d=l.distance(u),h={position:{x:(0,s.clamp)(l.x-.4,-1,1),y:0,z:(0,s.clamp)(d-1,-2,0)}};h.worldPosition={x:h.position.x,y:0,z:h.position.z*Math.pow(-2*h.position.z,2)},h.worldPosition.x*=h.worldPosition.z,h.rotation=r.default.rollPitchYaw(e[23],e[24]),h.rotation.y>.5&&(h.rotation.y-=2),h.rotation.y+=.5,h.rotation.z>0&&(h.rotation.z=1-h.rotation.z),h.rotation.z<0&&(h.rotation.z=-1-h.rotation.z);var f=(0,s.remap)(Math.abs(h.rotation.y),.2,.4);h.rotation.z*=1-f,h.rotation.x=0;var p=r.default.rollPitchYaw(e[11],e[12]);p.y>.5&&(p.y-=2),p.y+=.5,p.z>0&&(p.z=1-p.z),p.z<0&&(p.z=-1-p.z);var m=(0,s.remap)(Math.abs(p.y),.2,.4);return p.z*=1-m,p.x=0,(0,t.rigHips)(h,p)},t.rigHips=function(e,t){return e.rotation&&(e.rotation.x*=Math.PI,e.rotation.y*=Math.PI,e.rotation.z*=Math.PI),t.x*=a.PI,t.y*=a.PI,t.z*=a.PI,{Hips:e,Spine:t}}},581:function(e,t,n){"use strict";var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rigLeg=t.calcLegs=t.offsets=void 0;var r=i(n(360)),s=i(n(945)),a=n(652),o=n(147),c=n(147);t.offsets={upperLeg:{z:.1}},t.calcLegs=function(e){var n=r.default.getSphericalCoords(e[23],e[25],{x:"y",y:"z",z:"x"}),i=r.default.getSphericalCoords(e[24],e[26],{x:"y",y:"z",z:"x"}),s=r.default.getRelativeSphericalCoords(e[23],e[25],e[27],{x:"y",y:"z",z:"x"}),a=r.default.getRelativeSphericalCoords(e[24],e[26],e[28],{x:"y",y:"z",z:"x"}),c=r.default.findRotation(e[23],e[24]),l={r:new r.default({x:n.theta,y:s.phi,z:n.phi-c.z}),l:new r.default({x:i.theta,y:a.phi,z:i.phi-c.z})},u={r:new r.default({x:-Math.abs(s.theta),y:0,z:0}),l:new r.default({x:-Math.abs(a.theta),y:0,z:0})},d=(0,t.rigLeg)(l.r,u.r,o.RIGHT),h=(0,t.rigLeg)(l.l,u.l,o.LEFT);return{UpperLeg:{r:d.UpperLeg,l:h.UpperLeg},LowerLeg:{r:d.LowerLeg,l:h.LowerLeg},Unscaled:{UpperLeg:l,LowerLeg:u}}},t.rigLeg=function(e,n,i){void 0===i&&(i=o.RIGHT);var r=i===o.RIGHT?1:-1;return{UpperLeg:new s.default({x:(0,a.clamp)(e.x,0,.5)*c.PI,y:(0,a.clamp)(e.y,-.25,.25)*c.PI,z:(0,a.clamp)(e.z,-.5,.5)*c.PI+r*t.offsets.upperLeg.z,rotationOrder:"XYZ"}),LowerLeg:new s.default({x:n.x*c.PI,y:n.y*c.PI,z:n.z*c.PI})}}},201:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PoseSolver=void 0;var i=n(652),r=n(95),s=n(699),a=n(581),o=function(){function e(){}return e.solve=function(e,t,n){var o,c,l,u,d=void 0===n?{}:n,h=d.runtime,f=void 0===h?"mediapipe":h,p=d.video,m=void 0===p?null:p,g=d.imageSize,v=void 0===g?null:g,y=d.enableLegs,b=void 0===y||y;if(e||t){if(m){var x="string"==typeof m?document.querySelector(m):m;v={width:x.videoWidth,height:x.videoHeight}}if("tfjs"===f&&v){for(var w=0,M=e;w1||(null!==(o=e[15].visibility)&&void 0!==o?o:0)<.7,z=e[16].y>1||(null!==(c=e[16].visibility)&&void 0!==c?c:0)<.7,R=e[23].y>.1||(null!==(l=e[23].visibility)&&void 0!==l?l:0)<.8||T.Hips.position.z>-.4,P=e[24].y>.1||(null!==(u=e[24].visibility)&&void 0!==u?u:0)<.8||T.Hips.position.z>-.4;return E.UpperArm.l=E.UpperArm.l.multiply(z?0:1),E.UpperArm.l.z=z?i.RestingDefault.Pose.LeftUpperArm.z:E.UpperArm.l.z,E.UpperArm.r=E.UpperArm.r.multiply(A?0:1),E.UpperArm.r.z=A?i.RestingDefault.Pose.RightUpperArm.z:E.UpperArm.r.z,E.LowerArm.l=E.LowerArm.l.multiply(z?0:1),E.LowerArm.r=E.LowerArm.r.multiply(A?0:1),E.Hand.l=E.Hand.l.multiply(z?0:1),E.Hand.r=E.Hand.r.multiply(A?0:1),L&&(L.UpperLeg.l=L.UpperLeg.l.multiply(P?0:1),L.UpperLeg.r=L.UpperLeg.r.multiply(R?0:1),L.LowerLeg.l=L.LowerLeg.l.multiply(P?0:1),L.LowerLeg.r=L.LowerLeg.r.multiply(R?0:1)),{RightUpperArm:E.UpperArm.r,RightLowerArm:E.LowerArm.r,LeftUpperArm:E.UpperArm.l,LeftLowerArm:E.LowerArm.l,RightHand:E.Hand.r,LeftHand:E.Hand.l,RightUpperLeg:L?L.UpperLeg.r:i.RestingDefault.Pose.RightUpperLeg,RightLowerLeg:L?L.LowerLeg.r:i.RestingDefault.Pose.RightLowerLeg,LeftUpperLeg:L?L.UpperLeg.l:i.RestingDefault.Pose.LeftUpperLeg,LeftLowerLeg:L?L.LowerLeg.l:i.RestingDefault.Pose.LeftLowerLeg,Hips:T.Hips,Spine:T.Spine}}console.error("Need both World Pose and Pose Landmarks")},e.calcArms=r.calcArms,e.calcHips=s.calcHips,e.calcLegs=a.calcLegs,e}();t.PoseSolver=o},431:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},147:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TWO_PI=t.PI=t.LEFT=t.RIGHT=void 0,t.RIGHT="Right",t.LEFT="Left",t.PI=Math.PI,t.TWO_PI=2*Math.PI},314:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t},a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Utils=t.Vector=t.Face=t.Hand=t.Pose=void 0;var c=n(201);Object.defineProperty(t,"Pose",{enumerable:!0,get:function(){return c.PoseSolver}});var l=n(702);Object.defineProperty(t,"Hand",{enumerable:!0,get:function(){return l.HandSolver}});var u=n(417);Object.defineProperty(t,"Face",{enumerable:!0,get:function(){return u.FaceSolver}});var d=n(360);Object.defineProperty(t,"Vector",{enumerable:!0,get:function(){return o(d).default}}),t.Utils=s(n(652)),a(n(431),t)},945:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t,n,i){var r,s,a,o;if(e&&"object"==typeof e)return this.x=null!==(r=e.x)&&void 0!==r?r:0,this.y=null!==(s=e.y)&&void 0!==s?s:0,this.z=null!==(a=e.z)&&void 0!==a?a:0,void(this.rotationOrder=null!==(o=e.rotationOrder)&&void 0!==o?o:"XYZ");this.x=null!=e?e:0,this.y=null!=t?t:0,this.z=null!=n?n:0,this.rotationOrder=null!=i?i:"XYZ"}return e.prototype.multiply=function(t){return new e(this.x*t,this.y*t,this.z*t,this.rotationOrder)},e}();t.default=n},652:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RestingDefault=t.remap=t.clamp=void 0,t.clamp=function(e,t,n){return Math.max(Math.min(e,n),t)},t.remap=function(e,n,i){return((0,t.clamp)(e,n,i)-n)/(i-n)},t.RestingDefault={Face:{eye:{l:1,r:1},mouth:{x:0,y:0,shape:{A:0,E:0,I:0,O:0,U:0}},head:{x:0,y:0,z:0,width:.3,height:.6,position:{x:.5,y:.5,z:0}},brow:0,pupil:{x:0,y:0}},Pose:{RightUpperArm:{x:0,y:0,z:-1.25},LeftUpperArm:{x:0,y:0,z:1.25},RightLowerArm:{x:0,y:0,z:0},LeftLowerArm:{x:0,y:0,z:0},LeftUpperLeg:{x:0,y:0,z:0},RightUpperLeg:{x:0,y:0,z:0},RightLowerLeg:{x:0,y:0,z:0},LeftLowerLeg:{x:0,y:0,z:0},LeftHand:{x:0,y:0,z:0},RightHand:{x:0,y:0,z:0},Spine:{x:0,y:0,z:0},Hips:{position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0}}},RightHand:{RightWrist:{x:-.13,y:-.07,z:-1.04},RightRingProximal:{x:0,y:0,z:-.13},RightRingIntermediate:{x:0,y:0,z:-.4},RightRingDistal:{x:0,y:0,z:-.04},RightIndexProximal:{x:0,y:0,z:-.24},RightIndexIntermediate:{x:0,y:0,z:-.25},RightIndexDistal:{x:0,y:0,z:-.06},RightMiddleProximal:{x:0,y:0,z:-.09},RightMiddleIntermediate:{x:0,y:0,z:-.44},RightMiddleDistal:{x:0,y:0,z:-.06},RightThumbProximal:{x:-.23,y:-.33,z:-.12},RightThumbIntermediate:{x:-.2,y:-.199,z:-.0139},RightThumbDistal:{x:-.2,y:.002,z:.15},RightLittleProximal:{x:0,y:0,z:-.09},RightLittleIntermediate:{x:0,y:0,z:-.225},RightLittleDistal:{x:0,y:0,z:-.1}},LeftHand:{LeftWrist:{x:-.13,y:-.07,z:-1.04},LeftRingProximal:{x:0,y:0,z:.13},LeftRingIntermediate:{x:0,y:0,z:.4},LeftRingDistal:{x:0,y:0,z:.049},LeftIndexProximal:{x:0,y:0,z:.24},LeftIndexIntermediate:{x:0,y:0,z:.25},LeftIndexDistal:{x:0,y:0,z:.06},LeftMiddleProximal:{x:0,y:0,z:.09},LeftMiddleIntermediate:{x:0,y:0,z:.44},LeftMiddleDistal:{x:0,y:0,z:.066},LeftThumbProximal:{x:-.23,y:.33,z:.12},LeftThumbIntermediate:{x:-.2,y:.25,z:.05},LeftThumbDistal:{x:-.2,y:.17,z:-.06},LeftLittleProximal:{x:0,y:0,z:.17},LeftLittleIntermediate:{x:0,y:0,z:.4},LeftLittleDistal:{x:0,y:0,z:.1}}}},360:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(147),r=function(){function e(e,t,n){var i,r,s,a,o,c;return Array.isArray(e)?(this.x=null!==(i=e[0])&&void 0!==i?i:0,this.y=null!==(r=e[1])&&void 0!==r?r:0,void(this.z=null!==(s=e[2])&&void 0!==s?s:0)):e&&"object"==typeof e?(this.x=null!==(a=e.x)&&void 0!==a?a:0,this.y=null!==(o=e.y)&&void 0!==o?o:0,void(this.z=null!==(c=e.z)&&void 0!==c?c:0)):(this.x=null!=e?e:0,this.y=null!=t?t:0,void(this.z=null!=n?n:0))}return e.prototype.negative=function(){return new e(-this.x,-this.y,-this.z)},e.prototype.add=function(t){return t instanceof e?new e(this.x+t.x,this.y+t.y,this.z+t.z):new e(this.x+t,this.y+t,this.z+t)},e.prototype.subtract=function(t){return t instanceof e?new e(this.x-t.x,this.y-t.y,this.z-t.z):new e(this.x-t,this.y-t,this.z-t)},e.prototype.multiply=function(t){return t instanceof e?new e(this.x*t.x,this.y*t.y,this.z*t.z):new e(this.x*t,this.y*t,this.z*t)},e.prototype.divide=function(t){return t instanceof e?new e(this.x/t.x,this.y/t.y,this.z/t.z):new e(this.x/t,this.y/t,this.z/t)},e.prototype.equals=function(e){return this.x==e.x&&this.y==e.y&&this.z==e.z},e.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},e.prototype.cross=function(t){return new e(this.y*t.z-this.z*t.y,this.z*t.x-this.x*t.z,this.x*t.y-this.y*t.x)},e.prototype.length=function(){return Math.sqrt(this.dot(this))},e.prototype.distance=function(e,t){return void 0===t&&(t=3),2===t?Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2)):Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2)+Math.pow(this.z-e.z,2))},e.prototype.lerp=function(e,t){return e.subtract(this).multiply(t).add(this)},e.prototype.unit=function(){return this.divide(this.length())},e.prototype.min=function(){return Math.min(Math.min(this.x,this.y),this.z)},e.prototype.max=function(){return Math.max(Math.max(this.x,this.y),this.z)},e.prototype.toSphericalCoords=function(e){return void 0===e&&(e={x:"x",y:"y",z:"z"}),{theta:Math.atan2(this[e.y],this[e.x]),phi:Math.acos(this[e.z]/this.length())}},e.prototype.angleTo=function(e){return Math.acos(this.dot(e)/(this.length()*e.length()))},e.prototype.toArray=function(e){return[this.x,this.y,this.z].slice(0,e||3)},e.prototype.clone=function(){return new e(this.x,this.y,this.z)},e.prototype.init=function(e,t,n){return this.x=e,this.y=t,this.z=n,this},e.negative=function(t,n){return void 0===n&&(n=new e),n.x=-t.x,n.y=-t.y,n.z=-t.z,n},e.add=function(t,n,i){return void 0===i&&(i=new e),n instanceof e?(i.x=t.x+n.x,i.y=t.y+n.y,i.z=t.z+n.z):(i.x=t.x+n,i.y=t.y+n,i.z=t.z+n),i},e.subtract=function(t,n,i){return void 0===i&&(i=new e),n instanceof e?(i.x=t.x-n.x,i.y=t.y-n.y,i.z=t.z-n.z):(i.x=t.x-n,i.y=t.y-n,i.z=t.z-n),i},e.multiply=function(t,n,i){return void 0===i&&(i=new e),n instanceof e?(i.x=t.x*n.x,i.y=t.y*n.y,i.z=t.z*n.z):(i.x=t.x*n,i.y=t.y*n,i.z=t.z*n),i},e.divide=function(t,n,i){return void 0===i&&(i=new e),n instanceof e?(i.x=t.x/n.x,i.y=t.y/n.y,i.z=t.z/n.z):(i.x=t.x/n,i.y=t.y/n,i.z=t.z/n),i},e.cross=function(t,n,i){return void 0===i&&(i=new e),i.x=t.y*n.z-t.z*n.y,i.y=t.z*n.x-t.x*n.z,i.z=t.x*n.y-t.y*n.x,i},e.unit=function(e,t){var n=e.length();return t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t},e.fromAngles=function(t,n){return new e(Math.cos(t)*Math.cos(n),Math.sin(n),Math.sin(t)*Math.cos(n))},e.randomDirection=function(){return e.fromAngles(Math.random()*i.TWO_PI,Math.asin(2*Math.random()-1))},e.min=function(t,n){return new e(Math.min(t.x,n.x),Math.min(t.y,n.y),Math.min(t.z,n.z))},e.max=function(t,n){return new e(Math.max(t.x,n.x),Math.max(t.y,n.y),Math.max(t.z,n.z))},e.lerp=function(t,n,i){return n instanceof e?n.subtract(t).multiply(i).add(t):(n-t)*i+t},e.fromArray=function(t){return Array.isArray(t)?new e(t[0],t[1],t[2]):new e(t.x,t.y,t.z)},e.angleBetween=function(e,t){return e.angleTo(t)},e.distance=function(e,t,n){return 2===n?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)+Math.pow(e.z-t.z,2))},e.toDegrees=function(e){return e*(180/i.PI)},e.normalizeAngle=function(e){var t=e%i.TWO_PI;return(t=t>i.PI?t-i.TWO_PI:t<-i.PI?i.TWO_PI+t:t)/i.PI},e.normalizeRadians=function(e){return e>=i.PI/2&&(e-=i.TWO_PI),e<=-i.PI/2&&(e+=i.TWO_PI,e=i.PI-e),e/i.PI},e.find2DAngle=function(e,t,n,i){var r=i-t,s=n-e;return Math.atan2(r,s)},e.findRotation=function(t,n,i){return void 0===i&&(i=!0),i?new e(e.normalizeRadians(e.find2DAngle(t.z,t.x,n.z,n.x)),e.normalizeRadians(e.find2DAngle(t.z,t.y,n.z,n.y)),e.normalizeRadians(e.find2DAngle(t.x,t.y,n.x,n.y))):new e(e.find2DAngle(t.z,t.x,n.z,n.x),e.find2DAngle(t.z,t.y,n.z,n.y),e.find2DAngle(t.x,t.y,n.x,n.y))},e.rollPitchYaw=function(t,n,i){if(!i)return new e(e.normalizeAngle(e.find2DAngle(t.z,t.y,n.z,n.y)),e.normalizeAngle(e.find2DAngle(t.z,t.x,n.z,n.x)),e.normalizeAngle(e.find2DAngle(t.x,t.y,n.x,n.y)));var r=n.subtract(t),s=i.subtract(t),a=r.cross(s).unit(),o=r.unit(),c=a.cross(o),l=Math.asin(a.x)||0,u=Math.atan2(-a.y,a.z)||0,d=Math.atan2(-c.x,o.x)||0;return new e(e.normalizeAngle(u),e.normalizeAngle(l),e.normalizeAngle(d))},e.angleBetween3DCoords=function(t,n,i){t instanceof e||(t=new e(t),n=new e(n),i=new e(i));var r=t.subtract(n),s=i.subtract(n),a=r.unit(),o=s.unit(),c=a.dot(o),l=Math.acos(c);return e.normalizeRadians(l)},e.getRelativeSphericalCoords=function(t,n,i,r){t instanceof e||(t=new e(t),n=new e(n),i=new e(i));var s=n.subtract(t),a=i.subtract(n),o=s.unit(),c=a.unit(),l=o.toSphericalCoords(r),u=l.theta,d=l.phi,h=c.toSphericalCoords(r),f=u-h.theta,p=d-h.phi;return{theta:e.normalizeAngle(f),phi:e.normalizeAngle(p)}},e.getSphericalCoords=function(t,n,r){void 0===r&&(r={x:"x",y:"y",z:"z"}),t instanceof e||(t=new e(t),n=new e(n));var s=n.subtract(t).unit().toSphericalCoords(r),a=s.theta,o=s.phi;return{theta:e.normalizeAngle(-a),phi:e.normalizeAngle(i.PI/2-o)}},e}();t.default=r},363:e=>{"use strict";e.exports=n(8992)},102:e=>{"use strict";e.exports=n(4470)},914:e=>{"use strict";e.exports=n(9537)},583:e=>{"use strict";e.exports=n(7979)},180:e=>{"use strict";e.exports=n(5173)},747:e=>{"use strict";e.exports=n(7644)},81:e=>{"use strict";e.exports=n(4570)},232:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n="137",i=100,r=300,s=301,a=302,o=303,c=304,l=306,u=307,d=1e3,h=1001,f=1002,p=1003,m=1004,g=1005,v=1006,y=1007,b=1008,x=1009,w=1012,M=1014,S=1015,_=1016,C=1020,E=1023,T=1026,L=1027,A=33776,z=33777,R=33778,P=33779,H=35840,k=35841,I=35842,V=35843,N=37492,D=37496,O=37808,F=37809,B=37810,U=37811,W=37812,G=37813,j=37814,q=37815,$=37816,X=37817,K=37818,Y=37819,J=37820,Z=37821,Q=36492,ee=2300,te=2301,ne=2302,ie=2400,re=2401,se=2402,ae=2501,oe=3e3,ce=3001,le=7680,ue=35044,de=35048,he="300 es",fe=1035;class pe{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;const n=this._listeners[e];if(void 0!==n){const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;const t=this._listeners[e.type];if(void 0!==t){e.target=this;const n=t.slice(0);for(let t=0,i=n.length;t>8&255]+me[e>>16&255]+me[e>>24&255]+"-"+me[255&t]+me[t>>8&255]+"-"+me[t>>16&15|64]+me[t>>24&255]+"-"+me[63&n|128]+me[n>>8&255]+"-"+me[n>>16&255]+me[n>>24&255]+me[255&i]+me[i>>8&255]+me[i>>16&255]+me[i>>24&255]).toUpperCase()}function xe(e,t,n){return Math.max(t,Math.min(n,e))}function we(e,t){return(e%t+t)%t}function Me(e,t,n){return(1-n)*e+n*t}function Se(e){return 0==(e&e-1)&&0!==e}function _e(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Ce(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var Ee=Object.freeze({__proto__:null,DEG2RAD:ve,RAD2DEG:ye,generateUUID:be,clamp:xe,euclideanModulo:we,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:Me,damp:function(e,t,n,i){return Me(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(we(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){return void 0!==e&&(ge=e%2147483647),ge=16807*ge%2147483647,(ge-1)/2147483646},degToRad:function(e){return e*ve},radToDeg:function(e){return e*ye},isPowerOfTwo:Se,ceilPowerOfTwo:_e,floorPowerOfTwo:Ce,setQuaternionFromProperEuler:function(e,t,n,i,r){const s=Math.cos,a=Math.sin,o=s(n/2),c=a(n/2),l=s((t+i)/2),u=a((t+i)/2),d=s((t-i)/2),h=a((t-i)/2),f=s((i-t)/2),p=a((i-t)/2);switch(r){case"XYX":e.set(o*u,c*d,c*h,o*l);break;case"YZY":e.set(c*h,o*u,c*d,o*l);break;case"ZXZ":e.set(c*d,c*h,o*u,o*l);break;case"XZX":e.set(o*u,c*p,c*f,o*l);break;case"YXY":e.set(c*f,o*u,c*p,o*l);break;case"ZYZ":e.set(c*p,c*f,o*u,o*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}});class Te{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Te.prototype.isVector2=!0;class Le{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,a,o,c){const l=this.elements;return l[0]=e,l[1]=i,l[2]=a,l[3]=t,l[4]=r,l[5]=o,l[6]=n,l[7]=s,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],a=n[3],o=n[6],c=n[1],l=n[4],u=n[7],d=n[2],h=n[5],f=n[8],p=i[0],m=i[3],g=i[6],v=i[1],y=i[4],b=i[7],x=i[2],w=i[5],M=i[8];return r[0]=s*p+a*v+o*x,r[3]=s*m+a*y+o*w,r[6]=s*g+a*b+o*M,r[1]=c*p+l*v+u*x,r[4]=c*m+l*y+u*w,r[7]=c*g+l*b+u*M,r[2]=d*p+h*v+f*x,r[5]=d*m+h*y+f*w,r[8]=d*g+h*b+f*M,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],c=e[7],l=e[8];return t*s*l-t*a*c-n*r*l+n*a*o+i*r*c-i*s*o}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],c=e[7],l=e[8],u=l*s-a*c,d=a*o-l*r,h=c*r-s*o,f=t*u+n*d+i*h;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);const p=1/f;return e[0]=u*p,e[1]=(i*c-l*n)*p,e[2]=(a*n-i*s)*p,e[3]=d*p,e[4]=(l*t-i*o)*p,e[5]=(i*r-a*t)*p,e[6]=h*p,e[7]=(n*o-c*t)*p,e[8]=(s*t-n*r)*p,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,a){const o=Math.cos(r),c=Math.sin(r);return this.set(n*o,n*c,-n*(o*s+c*a)+s+e,-i*c,i*o,-i*(-c*s+o*a)+a+t,0,0,1),this}scale(e,t){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this}rotate(e){const t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],s=i[3],a=i[6],o=i[1],c=i[4],l=i[7];return i[0]=t*r+n*o,i[3]=t*s+n*c,i[6]=t*a+n*l,i[1]=-n*r+t*o,i[4]=-n*s+t*c,i[7]=-n*a+t*l,this}translate(e,t){const n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}function Ae(e){for(let t=e.length-1;t>=0;--t)if(e[t]>65535)return!0;return!1}Le.prototype.isMatrix3=!0;const ze={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Re(e,t){return new ze[e](t)}function Pe(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}const He={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ke={h:0,s:0,l:0},Ie={h:0,s:0,l:0};function Ve(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Ne(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function De(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class Oe{constructor(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){if(e=we(e,1),t=xe(t,0,1),n=xe(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Ve(r,i,e+1/3),this.g=Ve(r,i,e),this.b=Ve(r,i,e-1/3)}return this}setStyle(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let e;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,t(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,t(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const n=parseFloat(e[1])/360,i=parseInt(e[2],10)/100,r=parseInt(e[3],10)/100;return t(e[4]),this.setHSL(n,i,r)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const e=n[1],t=e.length;if(3===t)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,this;if(6===t)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=He[e.toLowerCase()];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ne(e.r),this.g=Ne(e.g),this.b=Ne(e.b),this}copyLinearToSRGB(e){return this.r=De(e.r),this.g=De(e.g),this.b=De(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){const t=this.r,n=this.g,i=this.b,r=Math.max(t,n,i),s=Math.min(t,n,i);let a,o;const c=(s+r)/2;if(s===r)a=0,o=0;else{const e=r-s;switch(o=c<=.5?e/(r+s):e/(2-r-s),r){case t:a=(n-i)/e+(n2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=Pe("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e1)switch(this.wrapS){case d:e.x=e.x-Math.floor(e.x);break;case h:e.x=e.x<0?0:1;break;case f:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case d:e.y=e.y-Math.floor(e.y);break;case h:e.y=e.y<0?0:1;break;case f:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&this.version++}}function Ge(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?Be.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}We.DEFAULT_IMAGE=void 0,We.DEFAULT_MAPPING=r,We.prototype.isTexture=!0;class je{constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*t+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*t+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*t+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const s=.01,a=.1,o=e.elements,c=o[0],l=o[4],u=o[8],d=o[1],h=o[5],f=o[9],p=o[2],m=o[6],g=o[10];if(Math.abs(l-d)o&&e>v?ev?o=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,t*n);e=Math.sin(e*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*e+d*r,c=c*e+h*r,l=l*e+f*r,u=u*e+p*r,e===1-a){const e=1/Math.sqrt(o*o+c*c+l*l+u*u);o*=e,c*=e,l*=e,u*=e}}e[t]=o,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,r,s){const a=n[i],o=n[i+1],c=n[i+2],l=n[i+3],u=r[s],d=r[s+1],h=r[s+2],f=r[s+3];return e[t]=a*f+l*u+o*h-c*d,e[t+1]=o*f+l*d+c*u-a*h,e[t+2]=c*f+l*h+a*d-o*u,e[t+3]=l*f-a*u-o*d-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=e._x,i=e._y,r=e._z,s=e._order,a=Math.cos,o=Math.sin,c=a(n/2),l=a(i/2),u=a(r/2),d=o(n/2),h=o(i/2),f=o(r/2);switch(s){case"XYZ":this._x=d*l*u+c*h*f,this._y=c*h*u-d*l*f,this._z=c*l*f+d*h*u,this._w=c*l*u-d*h*f;break;case"YXZ":this._x=d*l*u+c*h*f,this._y=c*h*u-d*l*f,this._z=c*l*f-d*h*u,this._w=c*l*u+d*h*f;break;case"ZXY":this._x=d*l*u-c*h*f,this._y=c*h*u+d*l*f,this._z=c*l*f+d*h*u,this._w=c*l*u-d*h*f;break;case"ZYX":this._x=d*l*u-c*h*f,this._y=c*h*u+d*l*f,this._z=c*l*f-d*h*u,this._w=c*l*u+d*h*f;break;case"YZX":this._x=d*l*u+c*h*f,this._y=c*h*u+d*l*f,this._z=c*l*f-d*h*u,this._w=c*l*u-d*h*f;break;case"XZY":this._x=d*l*u-c*h*f,this._y=c*h*u-d*l*f,this._z=c*l*f+d*h*u,this._w=c*l*u+d*h*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],a=t[5],o=t[9],c=t[2],l=t[6],u=t[10],d=n+a+u;if(d>0){const e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-o)*e,this._y=(r-c)*e,this._z=(s-i)*e}else if(n>a&&n>u){const e=2*Math.sqrt(1+n-a-u);this._w=(l-o)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+c)/e}else if(a>u){const e=2*Math.sqrt(1+a-n-u);this._w=(r-c)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(o+l)/e}else{const e=2*Math.sqrt(1+u-n-a);this._w=(s-i)/e,this._x=(r+c)/e,this._y=(o+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(xe(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,s=e._w,a=t._x,o=t._y,c=t._z,l=t._w;return this._x=n*l+s*a+i*c-r*o,this._y=i*l+s*o+r*a-n*c,this._z=r*l+s*c+n*o-i*a,this._w=s*l-n*a-i*o-r*c,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*e._w+n*e._x+i*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(o),l=Math.atan2(c,a),u=Math.sin((1-t)*l)/c,d=Math.sin(t*l)/c;return this._w=s*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(r),n*Math.cos(r),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Ke.prototype.isQuaternion=!0;class Ye{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Ze.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ze.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,s=e.y,a=e.z,o=e.w,c=o*t+s*i-a*n,l=o*n+a*t-r*i,u=o*i+r*n-s*t,d=-r*t-s*n-a*i;return this.x=c*o+d*-r+l*-a-u*-s,this.y=l*o+d*-s+u*-r-c*-a,this.z=u*o+d*-a+c*-s-l*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,s=t.x,a=t.y,o=t.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Je.copy(this).projectOnVector(e),this.sub(Je)}reflect(e){return this.sub(Je.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(xe(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}Ye.prototype.isVector3=!0;const Je=new Ye,Ze=new Ke;class Qe{constructor(e=new Ye(1/0,1/0,1/0),t=new Ye(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,c=e.length;or&&(r=c),l>s&&(s=l),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,s,a),this}setFromBufferAttribute(e){let t=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,c=e.count;or&&(r=c),l>s&&(s=l),u>a&&(a=u)}return this.min.set(t,n,i),this.max.set(r,s,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,tt),tt.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(lt),ut.subVectors(this.max,lt),it.subVectors(e.a,lt),rt.subVectors(e.b,lt),st.subVectors(e.c,lt),at.subVectors(rt,it),ot.subVectors(st,rt),ct.subVectors(it,st);let t=[0,-at.z,at.y,0,-ot.z,ot.y,0,-ct.z,ct.y,at.z,0,-at.x,ot.z,0,-ot.x,ct.z,0,-ct.x,-at.y,at.x,0,-ot.y,ot.x,0,-ct.y,ct.x,0];return!!ft(t,it,rt,st,ut)&&(t=[1,0,0,0,1,0,0,0,1],!!ft(t,it,rt,st,ut)&&(dt.crossVectors(at,ot),t=[dt.x,dt.y,dt.z],ft(t,it,rt,st,ut)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return tt.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(tt).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(et[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),et[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),et[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),et[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),et[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),et[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),et[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),et[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(et)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Qe.prototype.isBox3=!0;const et=[new Ye,new Ye,new Ye,new Ye,new Ye,new Ye,new Ye,new Ye],tt=new Ye,nt=new Qe,it=new Ye,rt=new Ye,st=new Ye,at=new Ye,ot=new Ye,ct=new Ye,lt=new Ye,ut=new Ye,dt=new Ye,ht=new Ye;function ft(e,t,n,i,r){for(let s=0,a=e.length-3;s<=a;s+=3){ht.fromArray(e,s);const a=r.x*Math.abs(ht.x)+r.y*Math.abs(ht.y)+r.z*Math.abs(ht.z),o=t.dot(ht),c=n.dot(ht),l=i.dot(ht);if(Math.max(-Math.max(o,c,l),Math.min(o,c,l))>a)return!1}return!0}const pt=new Qe,mt=new Ye,gt=new Ye,vt=new Ye;class yt{constructor(e=new Ye,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):pt.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){vt.subVectors(e,this.center);const t=vt.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.add(vt.multiplyScalar(n/e)),this.radius+=n}return this}union(e){return!0===this.center.equals(e.center)?gt.set(0,0,1).multiplyScalar(e.radius):gt.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(mt.copy(e.center).add(gt)),this.expandByPoint(mt.copy(e.center).sub(gt)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const bt=new Ye,xt=new Ye,wt=new Ye,Mt=new Ye,St=new Ye,_t=new Ye,Ct=new Ye;class Et{constructor(e=new Ye,t=new Ye(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,bt)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=bt.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(bt.copy(this.direction).multiplyScalar(t).add(this.origin),bt.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){xt.copy(e).add(t).multiplyScalar(.5),wt.copy(t).sub(e).normalize(),Mt.copy(this.origin).sub(xt);const r=.5*e.distanceTo(t),s=-this.direction.dot(wt),a=Mt.dot(this.direction),o=-Mt.dot(wt),c=Mt.lengthSq(),l=Math.abs(1-s*s);let u,d,h,f;if(l>0)if(u=s*o-a,d=s*a-o,f=r*l,u>=0)if(d>=-f)if(d<=f){const e=1/l;u*=e,d*=e,h=u*(u+s*d+2*a)+d*(s*u+d+2*o)+c}else d=r,u=Math.max(0,-(s*d+a)),h=-u*u+d*(d+2*o)+c;else d=-r,u=Math.max(0,-(s*d+a)),h=-u*u+d*(d+2*o)+c;else d<=-f?(u=Math.max(0,-(-s*r+a)),d=u>0?-r:Math.min(Math.max(-r,-o),r),h=-u*u+d*(d+2*o)+c):d<=f?(u=0,d=Math.min(Math.max(-r,-o),r),h=d*(d+2*o)+c):(u=Math.max(0,-(s*r+a)),d=u>0?r:Math.min(Math.max(-r,-o),r),h=-u*u+d*(d+2*o)+c);else d=s>0?-r:r,u=Math.max(0,-(s*d+a)),h=-u*u+d*(d+2*o)+c;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(wt).multiplyScalar(d).add(xt),h}intersectSphere(e,t){bt.subVectors(e.center,this.origin);const n=bt.dot(this.direction),i=bt.dot(bt)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return a<0&&o<0?null:a<0?this.at(o,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,a,o;const c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),l>=0?(r=(e.min.y-d.y)*l,s=(e.max.y-d.y)*l):(r=(e.max.y-d.y)*l,s=(e.min.y-d.y)*l),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s=0?(a=(e.min.z-d.z)*u,o=(e.max.z-d.z)*u):(a=(e.max.z-d.z)*u,o=(e.min.z-d.z)*u),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,bt)}intersectTriangle(e,t,n,i,r){St.subVectors(t,e),_t.subVectors(n,e),Ct.crossVectors(St,_t);let s,a=this.direction.dot(Ct);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}Mt.subVectors(this.origin,e);const o=s*this.direction.dot(_t.crossVectors(Mt,_t));if(o<0)return null;const c=s*this.direction.dot(St.cross(Mt));if(c<0)return null;if(o+c>a)return null;const l=-s*Mt.dot(Ct);return l<0?null:this.at(l/a,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Tt{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,n,i,r,s,a,o,c,l,u,d,h,f,p,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=h,g[7]=f,g[11]=p,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Tt).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Lt.setFromMatrixColumn(e,0).length(),r=1/Lt.setFromMatrixColumn(e,1).length(),s=1/Lt.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*s,t[9]=n[9]*s,t[10]=n[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,n=e.x,i=e.y,r=e.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),c=Math.sin(i),l=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){const e=s*l,n=s*u,i=a*l,r=a*u;t[0]=o*l,t[4]=-o*u,t[8]=c,t[1]=n+i*c,t[5]=e-r*c,t[9]=-a*o,t[2]=r-e*c,t[6]=i+n*c,t[10]=s*o}else if("YXZ"===e.order){const e=o*l,n=o*u,i=c*l,r=c*u;t[0]=e+r*a,t[4]=i*a-n,t[8]=s*c,t[1]=s*u,t[5]=s*l,t[9]=-a,t[2]=n*a-i,t[6]=r+e*a,t[10]=s*o}else if("ZXY"===e.order){const e=o*l,n=o*u,i=c*l,r=c*u;t[0]=e-r*a,t[4]=-s*u,t[8]=i+n*a,t[1]=n+i*a,t[5]=s*l,t[9]=r-e*a,t[2]=-s*c,t[6]=a,t[10]=s*o}else if("ZYX"===e.order){const e=s*l,n=s*u,i=a*l,r=a*u;t[0]=o*l,t[4]=i*c-n,t[8]=e*c+r,t[1]=o*u,t[5]=r*c+e,t[9]=n*c-i,t[2]=-c,t[6]=a*o,t[10]=s*o}else if("YZX"===e.order){const e=s*o,n=s*c,i=a*o,r=a*c;t[0]=o*l,t[4]=r-e*u,t[8]=i*u+n,t[1]=u,t[5]=s*l,t[9]=-a*l,t[2]=-c*l,t[6]=n*u+i,t[10]=e-r*u}else if("XZY"===e.order){const e=s*o,n=s*c,i=a*o,r=a*c;t[0]=o*l,t[4]=-u,t[8]=c*l,t[1]=e*u+r,t[5]=s*l,t[9]=n*u-i,t[2]=i*u-n,t[6]=a*l,t[10]=r*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(zt,e,Rt)}lookAt(e,t,n){const i=this.elements;return kt.subVectors(e,t),0===kt.lengthSq()&&(kt.z=1),kt.normalize(),Pt.crossVectors(n,kt),0===Pt.lengthSq()&&(1===Math.abs(n.z)?kt.x+=1e-4:kt.z+=1e-4,kt.normalize(),Pt.crossVectors(n,kt)),Pt.normalize(),Ht.crossVectors(kt,Pt),i[0]=Pt.x,i[4]=Ht.x,i[8]=kt.x,i[1]=Pt.y,i[5]=Ht.y,i[9]=kt.y,i[2]=Pt.z,i[6]=Ht.z,i[10]=kt.z,this}multiply(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],a=n[4],o=n[8],c=n[12],l=n[1],u=n[5],d=n[9],h=n[13],f=n[2],p=n[6],m=n[10],g=n[14],v=n[3],y=n[7],b=n[11],x=n[15],w=i[0],M=i[4],S=i[8],_=i[12],C=i[1],E=i[5],T=i[9],L=i[13],A=i[2],z=i[6],R=i[10],P=i[14],H=i[3],k=i[7],I=i[11],V=i[15];return r[0]=s*w+a*C+o*A+c*H,r[4]=s*M+a*E+o*z+c*k,r[8]=s*S+a*T+o*R+c*I,r[12]=s*_+a*L+o*P+c*V,r[1]=l*w+u*C+d*A+h*H,r[5]=l*M+u*E+d*z+h*k,r[9]=l*S+u*T+d*R+h*I,r[13]=l*_+u*L+d*P+h*V,r[2]=f*w+p*C+m*A+g*H,r[6]=f*M+p*E+m*z+g*k,r[10]=f*S+p*T+m*R+g*I,r[14]=f*_+p*L+m*P+g*V,r[3]=v*w+y*C+b*A+x*H,r[7]=v*M+y*E+b*z+x*k,r[11]=v*S+y*T+b*R+x*I,r[15]=v*_+y*L+b*P+x*V,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],a=e[5],o=e[9],c=e[13],l=e[2],u=e[6],d=e[10],h=e[14];return e[3]*(+r*o*u-i*c*u-r*a*d+n*c*d+i*a*h-n*o*h)+e[7]*(+t*o*h-t*c*d+r*s*d-i*s*h+i*c*l-r*o*l)+e[11]*(+t*c*u-t*a*h-r*s*u+n*s*h+r*a*l-n*c*l)+e[15]*(-i*a*l-t*o*u+t*a*d+i*s*u-n*s*d+n*o*l)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],o=e[6],c=e[7],l=e[8],u=e[9],d=e[10],h=e[11],f=e[12],p=e[13],m=e[14],g=e[15],v=u*m*c-p*d*c+p*o*h-a*m*h-u*o*g+a*d*g,y=f*d*c-l*m*c-f*o*h+s*m*h+l*o*g-s*d*g,b=l*p*c-f*u*c+f*a*h-s*p*h-l*a*g+s*u*g,x=f*u*o-l*p*o-f*a*d+s*p*d+l*a*m-s*u*m,w=t*v+n*y+i*b+r*x;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/w;return e[0]=v*M,e[1]=(p*d*r-u*m*r-p*i*h+n*m*h+u*i*g-n*d*g)*M,e[2]=(a*m*r-p*o*r+p*i*c-n*m*c-a*i*g+n*o*g)*M,e[3]=(u*o*r-a*d*r-u*i*c+n*d*c+a*i*h-n*o*h)*M,e[4]=y*M,e[5]=(l*m*r-f*d*r+f*i*h-t*m*h-l*i*g+t*d*g)*M,e[6]=(f*o*r-s*m*r-f*i*c+t*m*c+s*i*g-t*o*g)*M,e[7]=(s*d*r-l*o*r+l*i*c-t*d*c-s*i*h+t*o*h)*M,e[8]=b*M,e[9]=(f*u*r-l*p*r-f*n*h+t*p*h+l*n*g-t*u*g)*M,e[10]=(s*p*r-f*a*r+f*n*c-t*p*c-s*n*g+t*a*g)*M,e[11]=(l*a*r-s*u*r-l*n*c+t*u*c+s*n*h-t*a*h)*M,e[12]=x*M,e[13]=(l*p*i-f*u*i+f*n*d-t*p*d-l*n*m+t*u*m)*M,e[14]=(f*a*i-s*p*i-f*n*o+t*p*o+s*n*m-t*a*m)*M,e[15]=(s*u*i-l*a*i+l*n*o-t*u*o-s*n*d+t*a*d)*M,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,s=e.x,a=e.y,o=e.z,c=r*s,l=r*a;return this.set(c*s+n,c*a-i*o,c*o+i*a,0,c*a+i*o,l*a+n,l*o-i*s,0,c*o-i*a,l*o+i*s,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,s=t._y,a=t._z,o=t._w,c=r+r,l=s+s,u=a+a,d=r*c,h=r*l,f=r*u,p=s*l,m=s*u,g=a*u,v=o*c,y=o*l,b=o*u,x=n.x,w=n.y,M=n.z;return i[0]=(1-(p+g))*x,i[1]=(h+b)*x,i[2]=(f-y)*x,i[3]=0,i[4]=(h-b)*w,i[5]=(1-(d+g))*w,i[6]=(m+v)*w,i[7]=0,i[8]=(f+y)*M,i[9]=(m-v)*M,i[10]=(1-(d+p))*M,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=Lt.set(i[0],i[1],i[2]).length();const s=Lt.set(i[4],i[5],i[6]).length(),a=Lt.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],At.copy(this);const o=1/r,c=1/s,l=1/a;return At.elements[0]*=o,At.elements[1]*=o,At.elements[2]*=o,At.elements[4]*=c,At.elements[5]*=c,At.elements[6]*=c,At.elements[8]*=l,At.elements[9]*=l,At.elements[10]*=l,t.setFromRotationMatrix(At),n.x=r,n.y=s,n.z=a,this}makePerspective(e,t,n,i,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,o=2*r/(t-e),c=2*r/(n-i),l=(t+e)/(t-e),u=(n+i)/(n-i),d=-(s+r)/(s-r),h=-2*s*r/(s-r);return a[0]=o,a[4]=0,a[8]=l,a[12]=0,a[1]=0,a[5]=c,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=h,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,r,s){const a=this.elements,o=1/(t-e),c=1/(n-i),l=1/(s-r),u=(t+e)*o,d=(n+i)*c,h=(s+r)*l;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*l,a[14]=-h,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}Tt.prototype.isMatrix4=!0;const Lt=new Ye,At=new Tt,zt=new Ye(0,0,0),Rt=new Ye(1,1,1),Pt=new Ye,Ht=new Ye,kt=new Ye,It=new Tt,Vt=new Ke;class Nt{constructor(e=0,t=0,n=0,i=Nt.DefaultOrder){this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],s=i[4],a=i[8],o=i[1],c=i[5],l=i[9],u=i[2],d=i[6],h=i[10];switch(t){case"XYZ":this._y=Math.asin(xe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,h),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-xe(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(o,c)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(xe(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-s,c)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-xe(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,h),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,c));break;case"YZX":this._z=Math.asin(xe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-xe(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return It.makeRotationFromQuaternion(e),this.setFromRotationMatrix(It,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Vt.setFromEuler(this),this.setFromQuaternion(Vt,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new Ye(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Nt.prototype.isEuler=!0,Nt.DefaultOrder="XYZ",Nt.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Dt{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l)}return n.object=i,n;function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Qt.subVectors(i,t),en.subVectors(n,t),tn.subVectors(e,t);const s=Qt.dot(Qt),a=Qt.dot(en),o=Qt.dot(tn),c=en.dot(en),l=en.dot(tn),u=s*c-a*a;if(0===u)return r.set(-2,-1,-1);const d=1/u,h=(c*o-a*l)*d,f=(s*l-a*o)*d;return r.set(1-h-f,f,h)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,nn),nn.x>=0&&nn.y>=0&&nn.x+nn.y<=1}static getUV(e,t,n,i,r,s,a,o){return this.getBarycoord(e,t,n,i,nn),o.set(0,0),o.addScaledVector(r,nn.x),o.addScaledVector(s,nn.y),o.addScaledVector(a,nn.z),o}static isFrontFacing(e,t,n,i){return Qt.subVectors(n,t),en.subVectors(e,t),Qt.cross(en).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Qt.subVectors(this.c,this.b),en.subVectors(this.a,this.b),.5*Qt.cross(en).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return un.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return un.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,r){return un.getUV(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return un.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return un.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let s,a;rn.subVectors(i,n),sn.subVectors(r,n),on.subVectors(e,n);const o=rn.dot(on),c=sn.dot(on);if(o<=0&&c<=0)return t.copy(n);cn.subVectors(e,i);const l=rn.dot(cn),u=sn.dot(cn);if(l>=0&&u<=l)return t.copy(i);const d=o*u-l*c;if(d<=0&&o>=0&&l<=0)return s=o/(o-l),t.copy(n).addScaledVector(rn,s);ln.subVectors(e,r);const h=rn.dot(ln),f=sn.dot(ln);if(f>=0&&h<=f)return t.copy(r);const p=h*c-o*f;if(p<=0&&c>=0&&f<=0)return a=c/(c-f),t.copy(n).addScaledVector(sn,a);const m=l*f-h*u;if(m<=0&&u-l>=0&&h-f>=0)return an.subVectors(r,i),a=(u-l)/(u-l+(h-f)),t.copy(i).addScaledVector(an,a);const g=1/(m+p+d);return s=p*g,a=d*g,t.copy(n).addScaledVector(rn,s).addScaledVector(sn,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let dn=0;class hn extends pe{constructor(){super(),Object.defineProperty(this,"id",{value:dn++}),this.uuid=be(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=i,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=le,this.stencilZFail=le,this.stencilZPass=le,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if("shading"===t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}hn.prototype.isMaterial=!0;class fn extends hn{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new Oe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}fn.prototype.isMeshBasicMaterial=!0;const pn=new Ye,mn=new Te;class gn{constructor(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=ue,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const t in n){const i=n[t];e.data.attributes[t]=i.toJSON(e.data)}const i={};let r=!1;for(const t in this.morphAttributes){const n=this.morphAttributes[t],s=[];for(let t=0,i=n.length;t0&&(i[t]=s,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),Nn.copy(n.boundingSphere),Nn.applyMatrix4(r),!1===e.ray.intersectsSphere(Nn))return;if(In.copy(r).invert(),Vn.copy(e.ray).applyMatrix4(In),null!==n.boundingBox&&!1===Vn.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,a=n.attributes.position,o=n.morphAttributes.position,c=n.morphTargetsRelative,l=n.attributes.uv,u=n.attributes.uv2,d=n.groups,h=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,f=d.length;nn.far?null:{distance:l,point:Jn.clone(),object:e}}(e,t,n,i,Dn,On,Fn,Yn);if(f){o&&($n.fromBufferAttribute(o,l),Xn.fromBufferAttribute(o,u),Kn.fromBufferAttribute(o,d),f.uv=un.getUV(Yn,Dn,On,Fn,$n,Xn,Kn,new Te)),c&&($n.fromBufferAttribute(c,l),Xn.fromBufferAttribute(c,u),Kn.fromBufferAttribute(c,d),f.uv2=un.getUV(Yn,Dn,On,Fn,$n,Xn,Kn,new Te));const e={a:l,b:u,c:d,normal:new Ye,materialIndex:0};un.getNormal(Dn,On,Fn,e.normal),f.face=e}return f}Zn.prototype.isMesh=!0;class ei extends kn{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],c=[],l=[],u=[];let d=0,h=0;function f(e,t,n,i,r,s,f,p,m,g,v){const y=s/m,b=f/g,x=s/2,w=f/2,M=p/2,S=m+1,_=g+1;let C=0,E=0;const T=new Ye;for(let s=0;s<_;s++){const a=s*b-w;for(let o=0;o0?1:-1,l.push(T.x,T.y,T.z),u.push(o/m),u.push(1-s/g),C+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}ri.prototype.isShaderMaterial=!0;class si extends Zt{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Tt,this.projectionMatrix=new Tt,this.projectionMatrixInverse=new Tt}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}si.prototype.isCamera=!0;class ai extends si{constructor(e=50,t=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*ye*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*ve*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*ye*Math.atan(Math.tan(.5*ve*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,r,s){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*ve*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/a,i*=s.width/e,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}ai.prototype.isPerspectiveCamera=!0;const oi=90;class ci extends Zt{constructor(e,t,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new ai(oi,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Ye(1,0,0)),this.add(i);const r=new ai(oi,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Ye(-1,0,0)),this.add(r);const s=new ai(oi,1,e,t);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new Ye(0,1,0)),this.add(s);const a=new ai(oi,1,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new Ye(0,-1,0)),this.add(a);const o=new ai(oi,1,e,t);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new Ye(0,0,1)),this.add(o);const c=new ai(oi,1,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new Ye(0,0,-1)),this.add(c)}update(e,t){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,a,o,c]=this.children,l=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,s),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,o),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.xr.enabled=l,n.texture.needsPMREMUpdate=!0}}class li extends We{constructor(e,t,n,i,r,a,o,c,l,u){super(e=void 0!==e?e:[],t=void 0!==t?t:s,n,i,r,a,o,c,l,u),this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}li.prototype.isCubeTexture=!0;class ui extends qe{constructor(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),super(e,e,t),t=t||{},this.texture=new li(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:v}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=E,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n=new ei(5,5,5),i=new ri({name:"CubemapFromEquirect",uniforms:ti({tEquirect:{value:null}}),vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",side:1,blending:0});i.uniforms.tEquirect.value=t;const r=new Zn(n,i),s=t.minFilter;return t.minFilter===b&&(t.minFilter=v),new ci(1,10,this).update(e,r),t.minFilter=s,r.geometry.dispose(),r.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}ui.prototype.isWebGLCubeRenderTarget=!0;const di=new Ye,hi=new Ye,fi=new Le;class pi{constructor(e=new Ye(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=di.subVectors(n,t).cross(hi.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const n=e.delta(di),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(n).multiplyScalar(r).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||fi.getNormalMatrix(e),i=this.coplanarPoint(di).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}pi.prototype.isPlane=!0;const mi=new yt,gi=new Ye;class vi{constructor(e=new pi,t=new pi,n=new pi,i=new pi,r=new pi,s=new pi){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){const t=this.planes,n=e.elements,i=n[0],r=n[1],s=n[2],a=n[3],o=n[4],c=n[5],l=n[6],u=n[7],d=n[8],h=n[9],f=n[10],p=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(a-i,u-o,p-d,y-m).normalize(),t[1].setComponents(a+i,u+o,p+d,y+m).normalize(),t[2].setComponents(a+r,u+c,p+h,y+g).normalize(),t[3].setComponents(a-r,u-c,p-h,y-g).normalize(),t[4].setComponents(a-s,u-l,p-f,y-v).normalize(),t[5].setComponents(a+s,u+l,p+f,y+v).normalize(),this}intersectsObject(e){const t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),mi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(mi)}intersectsSprite(e){return mi.center.set(0,0,0),mi.radius=.7071067811865476,mi.applyMatrix4(e.matrixWorld),this.intersectsSphere(mi)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,gi.y=i.normal.y>0?e.max.y:e.min.y,gi.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(gi)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function yi(){let e=null,t=!1,n=null,i=null;function r(t,s){n(t,s),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function bi(e,t){const n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);const n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){const e=i.get(t);return void((!e||e.version 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\treturn texture2D( envMap, uv ).rgb;\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec;\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\t#else\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\t\t\t#endif\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(\t\t0, 1,\t\t0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\t\t\tfloat texelIndex = float( vertexIndex * stride + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV ).xyz;\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(\t1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,\t1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,\t1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Mi={common:{diffuse:{value:new Oe(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Le},uv2Transform:{value:new Le},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Te(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Oe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Oe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Le}},sprite:{diffuse:{value:new Oe(16777215)},opacity:{value:1},center:{value:new Te(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Le}}},Si={basic:{uniforms:ni([Mi.common,Mi.specularmap,Mi.envmap,Mi.aomap,Mi.lightmap,Mi.fog]),vertexShader:wi.meshbasic_vert,fragmentShader:wi.meshbasic_frag},lambert:{uniforms:ni([Mi.common,Mi.specularmap,Mi.envmap,Mi.aomap,Mi.lightmap,Mi.emissivemap,Mi.fog,Mi.lights,{emissive:{value:new Oe(0)}}]),vertexShader:wi.meshlambert_vert,fragmentShader:wi.meshlambert_frag},phong:{uniforms:ni([Mi.common,Mi.specularmap,Mi.envmap,Mi.aomap,Mi.lightmap,Mi.emissivemap,Mi.bumpmap,Mi.normalmap,Mi.displacementmap,Mi.fog,Mi.lights,{emissive:{value:new Oe(0)},specular:{value:new Oe(1118481)},shininess:{value:30}}]),vertexShader:wi.meshphong_vert,fragmentShader:wi.meshphong_frag},standard:{uniforms:ni([Mi.common,Mi.envmap,Mi.aomap,Mi.lightmap,Mi.emissivemap,Mi.bumpmap,Mi.normalmap,Mi.displacementmap,Mi.roughnessmap,Mi.metalnessmap,Mi.fog,Mi.lights,{emissive:{value:new Oe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:wi.meshphysical_vert,fragmentShader:wi.meshphysical_frag},toon:{uniforms:ni([Mi.common,Mi.aomap,Mi.lightmap,Mi.emissivemap,Mi.bumpmap,Mi.normalmap,Mi.displacementmap,Mi.gradientmap,Mi.fog,Mi.lights,{emissive:{value:new Oe(0)}}]),vertexShader:wi.meshtoon_vert,fragmentShader:wi.meshtoon_frag},matcap:{uniforms:ni([Mi.common,Mi.bumpmap,Mi.normalmap,Mi.displacementmap,Mi.fog,{matcap:{value:null}}]),vertexShader:wi.meshmatcap_vert,fragmentShader:wi.meshmatcap_frag},points:{uniforms:ni([Mi.points,Mi.fog]),vertexShader:wi.points_vert,fragmentShader:wi.points_frag},dashed:{uniforms:ni([Mi.common,Mi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:wi.linedashed_vert,fragmentShader:wi.linedashed_frag},depth:{uniforms:ni([Mi.common,Mi.displacementmap]),vertexShader:wi.depth_vert,fragmentShader:wi.depth_frag},normal:{uniforms:ni([Mi.common,Mi.bumpmap,Mi.normalmap,Mi.displacementmap,{opacity:{value:1}}]),vertexShader:wi.meshnormal_vert,fragmentShader:wi.meshnormal_frag},sprite:{uniforms:ni([Mi.sprite,Mi.fog]),vertexShader:wi.sprite_vert,fragmentShader:wi.sprite_frag},background:{uniforms:{uvTransform:{value:new Le},t2D:{value:null}},vertexShader:wi.background_vert,fragmentShader:wi.background_frag},cube:{uniforms:ni([Mi.envmap,{opacity:{value:1}}]),vertexShader:wi.cube_vert,fragmentShader:wi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:wi.equirect_vert,fragmentShader:wi.equirect_frag},distanceRGBA:{uniforms:ni([Mi.common,Mi.displacementmap,{referencePosition:{value:new Ye},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:wi.distanceRGBA_vert,fragmentShader:wi.distanceRGBA_frag},shadow:{uniforms:ni([Mi.lights,Mi.fog,{color:{value:new Oe(0)},opacity:{value:1}}]),vertexShader:wi.shadow_vert,fragmentShader:wi.shadow_frag}};function _i(e,t,n,i,r,s){const a=new Oe(0);let o,c,u=!0===r?0:1,d=null,h=0,f=null;function p(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,s)}return{getClearColor:function(){return a},setClearColor:function(e,t=1){a.set(e),u=t,p(a,u)},getClearAlpha:function(){return u},setClearAlpha:function(e){u=e,p(a,u)},render:function(n,r){let s=!1,m=!0===r.isScene?r.background:null;m&&m.isTexture&&(m=t.get(m));const g=e.xr,v=g.getSession&&g.getSession();v&&"additive"===v.environmentBlendMode&&(m=null),null===m?p(a,u):m&&m.isColor&&(p(m,1),s=!0),(e.autoClear||s)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.mapping===l)?(void 0===c&&(c=new Zn(new ei(1,1,1),new ri({name:"BackgroundCubeMaterial",uniforms:ti(Si.cube.uniforms),vertexShader:Si.cube.vertexShader,fragmentShader:Si.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=m,c.material.uniforms.flipEnvMap.value=m.isCubeTexture&&!1===m.isRenderTargetTexture?-1:1,d===m&&h===m.version&&f===e.toneMapping||(c.material.needsUpdate=!0,d=m,h=m.version,f=e.toneMapping),n.unshift(c,c.geometry,c.material,0,0,null)):m&&m.isTexture&&(void 0===o&&(o=new Zn(new xi(2,2),new ri({name:"BackgroundMaterial",uniforms:ti(Si.background.uniforms),vertexShader:Si.background.vertexShader,fragmentShader:Si.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(o)),o.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),o.material.uniforms.uvTransform.value.copy(m.matrix),d===m&&h===m.version&&f===e.toneMapping||(o.material.needsUpdate=!0,d=m,h=m.version,f=e.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null))}}}function Ci(e,t,n,i){const r=e.getParameter(e.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:t.get("OES_vertex_array_object"),a=i.isWebGL2||null!==s,o={},c=h(null);let l=c;function u(t){return i.isWebGL2?e.bindVertexArray(t):s.bindVertexArrayOES(t)}function d(t){return i.isWebGL2?e.deleteVertexArray(t):s.deleteVertexArrayOES(t)}function h(e){const t=[],n=[],i=[];for(let e=0;e=0){let s=c[t];if(void 0===s&&("instanceMatrix"===t&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===t&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const t=s.normalized,a=s.itemSize,c=n.get(s);if(void 0===c)continue;const l=c.buffer,u=c.type,d=c.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,c=n.stride,h=s.offset;if(n&&n.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext;let a=void 0!==n.precision?n.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const c=s||t.has("WEBGL_draw_buffers"),l=!0===n.logarithmicDepthBuffer,u=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),f=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),p=e.getParameter(e.MAX_VERTEX_ATTRIBS),m=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),g=e.getParameter(e.MAX_VARYING_VECTORS),v=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=d>0,b=s||t.has("OES_texture_float");return{isWebGL2:s,drawBuffers:c,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:d,maxTextureSize:h,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:y&&b,maxSamples:s?e.getParameter(e.MAX_SAMPLES):0}}function Li(e){const t=this;let n=null,i=0,r=!1,s=!1;const a=new pi,o=new Le,c={value:null,needsUpdate:!1};function l(){c.value!==n&&(c.value=n,c.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function u(e,n,i,r){const s=null!==e?e.length:0;let l=null;if(0!==s){if(l=c.value,!0!==r||null===l){const t=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===l||l.length0){const a=new ui(s.height/2);return a.fromEquirectangularTexture(e,r),t.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}Si.physical={uniforms:ni([Si.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Te(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new Oe(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Te},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Oe(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Oe(1,1,1)},specularColorMap:{value:null}}]),vertexShader:wi.meshphysical_vert,fragmentShader:wi.meshphysical_frag};class zi extends si{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,a=i+t,o=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,a-=t*this.view.offsetY,o=a-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}zi.prototype.isOrthographicCamera=!0;class Ri extends ri{constructor(e){super(e),this.type="RawShaderMaterial"}}Ri.prototype.isRawShaderMaterial=!0;const Pi=Math.pow(2,8),Hi=[.125,.215,.35,.446,.526,.582],ki=5+Hi.length,Ii=new zi,{_lodPlanes:Vi,_sizeLods:Ni,_sigmas:Di}=function(){const e=[],t=[],n=[];let i=8;for(let r=0;r4?a=Hi[r-8+4-1]:0===r&&(a=0),n.push(a);const o=1/(s-1),c=-o/2,l=1+o/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],d=6,h=6,f=3,p=2,m=1,g=new Float32Array(f*h*d),v=new Float32Array(p*h*d),y=new Float32Array(m*h*d);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];g.set(i,f*h*e),v.set(u,p*h*e);const r=[e,e,e,e,e,e];y.set(r,m*h*e)}const b=new kn;b.setAttribute("position",new gn(g,f)),b.setAttribute("uv",new gn(v,p)),b.setAttribute("faceIndex",new gn(y,m)),e.push(b),i>4&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}(),Oi=new Oe;let Fi=null;const Bi=(1+Math.sqrt(5))/2,Ui=1/Bi,Wi=[new Ye(1,1,1),new Ye(-1,1,1),new Ye(1,1,-1),new Ye(-1,1,-1),new Ye(0,Bi,Ui),new Ye(0,Bi,-Ui),new Ye(Ui,0,Bi),new Ye(-Ui,0,Bi),new Ye(Bi,Ui,0),new Ye(-Bi,Ui,0)];class Gi{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=function(e){const t=new Float32Array(20),n=new Ye(0,1,0);return new Ri({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Fi=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Xi(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=$i(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let e=0;e2?Pi:0,Pi,Pi),o.setRenderTarget(i),h&&o.render(d,r),o.render(e,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=l,o.autoClear=c,e.background=f}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===s||e.mapping===a;i?(null===this._cubemapShader&&(this._cubemapShader=Xi()),this._cubemapShader.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectShader&&(this._equirectShader=$i());const r=i?this._cubemapShader:this._equirectShader,o=new Zn(Vi[0],r),c=r.uniforms;c.envMap.value=e,i||c.texelSize.value.set(1/e.image.width,1/e.image.height),qi(t,0,0,3*Pi,2*Pi),n.setRenderTarget(t),n.render(o,Ii)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let t=1;t20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to 20`);const m=[];let g=0;for(let e=0;e<20;++e){const t=e/f,n=Math.exp(-t*t/2);m.push(n),0===e?g+=n:e4?i-8+4:0),3*v,2*v),o.setRenderTarget(t),o.render(l,Ii)}}function ji(e){const t=new qe(3*Pi,3*Pi,e);return t.texture.mapping=l,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function qi(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function $i(){const e=new Te(1,1);return new Ri({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:e}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = texture2D ( envMap, uv ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = texture2D ( envMap, uv ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Xi(){return new Ri({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Ki(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const l=r.mapping,u=l===o||l===c,d=l===s||l===a;if(u||d){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=t.get(r);return null===n&&(n=new Gi(e)),i=u?n.fromEquirectangular(r,i):n.fromCubemap(r,i),t.set(r,i),i.texture}if(t.has(r))return t.get(r).texture;{const s=r.image;if(u&&s&&s.height>0||d&&s&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(s)){null===n&&(n=new Gi(e));const s=u?n.fromEquirectangular(r):n.fromCubemap(r);return t.set(r,s),r.addEventListener("dispose",i),s.texture}return null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Yi(e){const t={};function n(n){if(void 0!==t[n])return t[n];let i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){const t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function Ji(e,t,n,i){const r={},s=new WeakMap;function a(e){const o=e.target;null!==o.index&&t.remove(o.index);for(const e in o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",a),delete r[o.id];const c=s.get(o);c&&(t.remove(c),s.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){const n=[],i=e.index,r=e.attributes.position;let a=0;if(null!==i){const e=i.array;a=i.version;for(let t=0,i=e.length;tt.maxTextureSize&&(M=Math.ceil(w/t.maxTextureSize),w=t.maxTextureSize);const _=new Float32Array(w*M*4*f),C=new er(_,w,M,f);C.format=E,C.type=S,C.needsUpdate=!0;const T=4*x;for(let A=0;A0)return e;const r=t*n;let s=dr[r];if(void 0===s&&(s=new Float32Array(r),dr[r]=s),0!==t){i.toArray(s,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(s,r)}return s}function vr(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n/gm;function xs(e){return e.replace(bs,ws)}function ws(e,t){const n=wi[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return xs(n)}const Ms=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ss=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function _s(e){return e.replace(Ss,Es).replace(Ms,Cs)}function Cs(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Es(0,t,n,i)}function Es(e,t,n,i){let r="";for(let e=parseInt(t);e0&&(b+="\n"),x=[g,v].filter(gs).join("\n"),x.length>0&&(x+="\n")):(b=[Ts(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(gs).join("\n"),x=[g,Ts(n),"#define SHADER_NAME "+n.shaderName,v,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.envMap?"#define "+p:"",n.envMap?"#define "+m:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?wi.tonemapping_pars_fragment:"",0!==n.toneMapping?ms("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.transparent?"":"#define OPAQUE",wi.encodings_pars_fragment,ps("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(gs).join("\n")),c=xs(c),c=vs(c,n),c=ys(c,n),d=xs(d),d=vs(d,n),d=ys(d,n),c=_s(c),d=_s(d),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(w="#version 300 es\n",b=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+b,x=["#define varying in",n.glslVersion===he?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===he?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x);const M=w+b+c,S=w+x+d,_=ds(r,r.VERTEX_SHADER,M),C=ds(r,r.FRAGMENT_SHADER,S);if(r.attachShader(y,_),r.attachShader(y,C),void 0!==n.index0AttributeName?r.bindAttribLocation(y,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y),e.debug.checkShaderErrors){const e=r.getProgramInfoLog(y).trim(),t=r.getShaderInfoLog(_).trim(),n=r.getShaderInfoLog(C).trim();let i=!0,s=!0;if(!1===r.getProgramParameter(y,r.LINK_STATUS)){i=!1;const t=fs(r,_,"vertex"),n=fs(r,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+n)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==t&&""!==n||(s=!1);s&&(this.diagnostics={runnable:i,programLog:e,vertexShader:{log:t,prefix:b},fragmentShader:{log:n,prefix:x}})}let E,T;return r.deleteShader(_),r.deleteShader(C),this.getUniforms=function(){return void 0===E&&(E=new us(r,y)),E},this.getAttributes=function(){return void 0===T&&(T=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r0,P=s.clearcoat>0;return{isWebGL2:h,shaderID:_,shaderName:s.type,vertexShader:E,fragmentShader:T,defines:s.defines,customVertexShaderID:L,customFragmentShaderID:A,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:v,instancing:!0===x.isInstancedMesh,instancingColor:!0===x.isInstancedMesh&&null!==x.instanceColor,supportsVertexTextures:g,outputEncoding:null===z?e.outputEncoding:!0===z.isXRRenderTarget?z.texture.encoding:oe,map:!!s.map,matcap:!!s.matcap,envMap:!!S,envMapMode:S&&S.mapping,envMapCubeUV:!!S&&(S.mapping===l||S.mapping===u),lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:1===s.normalMapType,tangentSpaceNormalMap:0===s.normalMapType,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&s.map.encoding===ce,clearcoat:P,clearcoatMap:P&&!!s.clearcoatMap,clearcoatRoughnessMap:P&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:P&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,transparent:s.transparent,alphaMap:!!s.alphaMap,alphaTest:R,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!x.geometry&&!!x.geometry.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!x.geometry&&!!x.geometry.attributes.color&&4===x.geometry.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!w,useFog:s.fog,fogExp2:w&&w.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:f,skinning:!0===x.isSkinnedMesh&&C>0,maxBones:C,useVertexTexture:p,morphTargets:!!x.geometry&&!!x.geometry.morphAttributes.position,morphNormals:!!x.geometry&&!!x.geometry.morphAttributes.normal,morphTargetsCount:x.geometry&&x.geometry.morphAttributes.position?x.geometry.morphAttributes.position.length:0,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:s.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,depthPacking:void 0!==s.depthPacking&&s.depthPacking,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.maxBones),e.push(t.morphTargetsCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection)}(n,t),function(e,t){o.disableAll(),t.isWebGL2&&o.enable(0),t.supportsVertexTextures&&o.enable(1),t.instancing&&o.enable(2),t.instancingColor&&o.enable(3),t.map&&o.enable(4),t.matcap&&o.enable(5),t.envMap&&o.enable(6),t.envMapCubeUV&&o.enable(7),t.lightMap&&o.enable(8),t.aoMap&&o.enable(9),t.emissiveMap&&o.enable(10),t.bumpMap&&o.enable(11),t.normalMap&&o.enable(12),t.objectSpaceNormalMap&&o.enable(13),t.tangentSpaceNormalMap&&o.enable(14),t.clearcoat&&o.enable(15),t.clearcoatMap&&o.enable(16),t.clearcoatRoughnessMap&&o.enable(17),t.clearcoatNormalMap&&o.enable(18),t.displacementMap&&o.enable(19),t.specularMap&&o.enable(20),t.roughnessMap&&o.enable(21),t.metalnessMap&&o.enable(22),t.gradientMap&&o.enable(23),t.alphaMap&&o.enable(24),t.alphaTest&&o.enable(25),t.vertexColors&&o.enable(26),t.vertexAlphas&&o.enable(27),t.vertexUvs&&o.enable(28),t.vertexTangents&&o.enable(29),t.uvsVertexOnly&&o.enable(30),t.fog&&o.enable(31),e.push(o.mask),o.disableAll(),t.useFog&&o.enable(0),t.flatShading&&o.enable(1),t.logarithmicDepthBuffer&&o.enable(2),t.skinning&&o.enable(3),t.useVertexTexture&&o.enable(4),t.morphTargets&&o.enable(5),t.morphNormals&&o.enable(6),t.premultipliedAlpha&&o.enable(7),t.shadowMapEnabled&&o.enable(8),t.physicallyCorrectLights&&o.enable(9),t.doubleSided&&o.enable(10),t.flipSided&&o.enable(11),t.depthPacking&&o.enable(12),t.dithering&&o.enable(13),t.specularIntensityMap&&o.enable(14),t.specularColorMap&&o.enable(15),t.transmission&&o.enable(16),t.transmissionMap&&o.enable(17),t.thicknessMap&&o.enable(18),t.sheen&&o.enable(19),t.sheenColorMap&&o.enable(20),t.sheenRoughnessMap&&o.enable(21),t.decodeVideoTexture&&o.enable(22),t.transparent&&o.enable(23),e.push(o.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=y[e.type];let n;if(t){const e=Si[t];n=ii.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=d.length;e0?i.push(u):!0===a.transparent?r.push(u):n.push(u)},unshift:function(e,t,a,o,c,l){const u=s(e,t,a,o,c,l);a.transmission>0?i.unshift(u):!0===a.transparent?r.unshift(u):n.unshift(u)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||ks),i.length>1&&i.sort(t||Is),r.length>1&&r.sort(t||Is)}}}function Ns(){let e=new WeakMap;return{get:function(t,n){let i;return!1===e.has(t)?(i=new Vs,e.set(t,[i])):n>=e.get(t).length?(i=new Vs,e.get(t).push(i)):i=e.get(t)[n],i},dispose:function(){e=new WeakMap}}}function Ds(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Ye,color:new Oe};break;case"SpotLight":n={position:new Ye,direction:new Ye,color:new Oe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ye,color:new Oe,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ye,skyColor:new Oe,groundColor:new Oe};break;case"RectAreaLight":n={color:new Oe,position:new Ye,halfWidth:new Ye,halfHeight:new Ye}}return e[t.id]=n,n}}}let Os=0;function Fs(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Bs(e,t){const n=new Ds,i=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Te,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let e=0;e<9;e++)r.probe.push(new Ye);const s=new Ye,a=new Tt,o=new Tt;return{setup:function(s,a){let o=0,c=0,l=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let u=0,d=0,h=0,f=0,p=0,m=0,g=0,v=0;s.sort(Fs);const y=!0!==a?Math.PI:1;for(let e=0,t=s.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=Mi.LTC_FLOAT_1,r.rectAreaLTC2=Mi.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Mi.LTC_HALF_1,r.rectAreaLTC2=Mi.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=c,r.ambient[2]=l;const b=r.hash;b.directionalLength===u&&b.pointLength===d&&b.spotLength===h&&b.rectAreaLength===f&&b.hemiLength===p&&b.numDirectionalShadows===m&&b.numPointShadows===g&&b.numSpotShadows===v||(r.directional.length=u,r.spot.length=h,r.rectArea.length=f,r.point.length=d,r.hemi.length=p,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=v,b.directionalLength=u,b.pointLength=d,b.spotLength=h,b.rectAreaLength=f,b.hemiLength=p,b.numDirectionalShadows=m,b.numPointShadows=g,b.numSpotShadows=v,r.version=Os++)},setupView:function(e,t){let n=0,i=0,c=0,l=0,u=0;const d=t.matrixWorldInverse;for(let t=0,h=e.length;t=n.get(i).length?(s=new Us(e,t),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class Gs extends hn{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}Gs.prototype.isMeshDepthMaterial=!0;class js extends hn{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new Ye,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function qs(e,t,n){let i=new vi;const r=new Te,s=new Te,a=new je,o=new Gs({depthPacking:3201}),c=new js,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},h=new ri({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Te},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const m=new kn;m.setAttribute("position",new gn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new Zn(m,h),y=this;function b(n,i){const r=t.update(g);h.defines.VSM_SAMPLES!==n.blurSamples&&(h.defines.VSM_SAMPLES=n.blurSamples,f.defines.VSM_SAMPLES=n.blurSamples,h.needsUpdate=!0,f.needsUpdate=!0),h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,h,g,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,f,g,null)}function x(t,n,i,r,s,a,u){let h=null;const f=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(h=void 0!==f?f:!0===r.isPointLight?c:o,e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0){const e=h.uuid,t=i.uuid;let n=l[e];void 0===n&&(n={},l[e]=n);let r=n[t];void 0===r&&(r=h.clone(),n[t]=r),h=r}return h.visible=i.visible,h.wireframe=i.wireframe,h.side=3===u?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:d[i.side],h.alphaMap=i.alphaMap,h.alphaTest=i.alphaTest,h.clipShadows=i.clipShadows,h.clippingPlanes=i.clippingPlanes,h.clipIntersection=i.clipIntersection,h.displacementMap=i.displacementMap,h.displacementScale=i.displacementScale,h.displacementBias=i.displacementBias,h.wireframeLinewidth=i.wireframeLinewidth,h.linewidth=i.linewidth,!0===r.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(r.matrixWorld),h.nearDistance=s,h.farDistance=a),h}function w(n,r,s,a,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=t.update(n),r=n.material;if(Array.isArray(r)){const t=i.groups;for(let c=0,l=t.length;cu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/f.x),r.x=s.x*f.x,d.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/f.y),r.y=s.y*f.y,d.mapSize.y=s.y)),null===d.map&&!d.isPointLightShadow&&3===this.type){const e={minFilter:v,magFilter:v,format:E};d.map=new qe(r.x,r.y,e),d.map.texture.name=l.name+".shadowMap",d.mapPass=new qe(r.x,r.y,e),d.camera.updateProjectionMatrix()}if(null===d.map){const e={minFilter:p,magFilter:p,format:E};d.map=new qe(r.x,r.y,e),d.map.texture.name=l.name+".shadowMap",d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();const m=d.getViewportCount();for(let e=0;e=1):-1!==z.indexOf("OpenGL ES")&&(A=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),L=A>=2);let R=null,P={};const H=e.getParameter(e.SCISSOR_BOX),k=e.getParameter(e.VIEWPORT),I=(new je).fromArray(H),V=(new je).fromArray(k);function N(t,n,i){const r=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let t=0;ti||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const i=t?Ce:Math.floor,s=i(r*e.width),a=i(r*e.height);void 0===P&&(P=k(s,a));const o=n?k(s,a):P;return o.width=s,o.height=a,o.getContext("2d").drawImage(e,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+a+")."),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function V(e){return Se(e.width)&&Se(e.height)}function N(e,t){return e.generateMipmaps&&t&&e.minFilter!==p&&e.minFilter!==v}function D(t){e.generateMipmap(t)}function O(n,i,r,s,a=!1){if(!1===o)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let c=i;return i===e.RED&&(r===e.FLOAT&&(c=e.R32F),r===e.HALF_FLOAT&&(c=e.R16F),r===e.UNSIGNED_BYTE&&(c=e.R8)),i===e.RG&&(r===e.FLOAT&&(c=e.RG32F),r===e.HALF_FLOAT&&(c=e.RG16F),r===e.UNSIGNED_BYTE&&(c=e.RG8)),i===e.RGBA&&(r===e.FLOAT&&(c=e.RGBA32F),r===e.HALF_FLOAT&&(c=e.RGBA16F),r===e.UNSIGNED_BYTE&&(c=s===ce&&!1===a?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(c=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(c=e.RGB5_A1)),c!==e.R16F&&c!==e.R32F&&c!==e.RG16F&&c!==e.RG32F&&c!==e.RGBA16F&&c!==e.RGBA32F||t.get("EXT_color_buffer_float"),c}function F(e,t,n){return!0===N(e,n)||e.isFramebufferTexture&&e.minFilter!==p&&e.minFilter!==v?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function B(t){return t===p||t===m||t===g?e.NEAREST:e.LINEAR}function U(t){const n=t.target;n.removeEventListener("dispose",U),function(t){const n=i.get(t);void 0!==n.__webglInit&&(e.deleteTexture(n.__webglTexture),i.remove(t))}(n),n.isVideoTexture&&R.delete(n),a.memory.textures--}function W(t){const n=t.target;n.removeEventListener("dispose",W),function(t){const n=t.texture,r=i.get(t),s=i.get(n);if(t){if(void 0!==s.__webglTexture&&(e.deleteTexture(s.__webglTexture),a.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++)e.deleteFramebuffer(r.__webglFramebuffer[t]),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[t]);else e.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&e.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(let t=0,r=n.length;t0&&s.__version!==t.version){const e=t.image;if(void 0===e)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==e.complete)return void J(s,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_2D,s.__webglTexture)}function q(t,r){const a=i.get(t);t.version>0&&a.__version!==t.version?function(t,i,r){if(6!==i.image.length)return;Y(t,i),n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);const a=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),c=i.image[0]&&i.image[0].isDataTexture,u=[];for(let e=0;e<6;e++)u[e]=a||c?c?i.image[e].image:i.image[e]:I(i.image[e],!1,!0,l),u[e]=ne(i,u[e]);const d=u[0],h=V(d)||o,f=s.convert(i.format,i.encoding),p=s.convert(i.type),m=O(i.internalFormat,f,p,i.encoding),g=o&&!0!==i.isVideoTexture,v=void 0===t.__version;let y,b=F(i,d,h);if(K(e.TEXTURE_CUBE_MAP,i,h),a){g&&v&&n.texStorage2D(e.TEXTURE_CUBE_MAP,b,m,d.width,d.height);for(let t=0;t<6;t++){y=u[t].mipmaps;for(let r=0;r0&&b++,n.texStorage2D(e.TEXTURE_CUBE_MAP,b,m,u[0].width,u[0].height));for(let t=0;t<6;t++)if(c){g?n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,u[t].width,u[t].height,f,p,u[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,m,u[t].width,u[t].height,0,f,p,u[t].data);for(let i=0;i1||i.get(s).__currentAnisotropy)&&(e.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function Y(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",U),t.__webglTexture=e.createTexture(),a.memory.textures++)}function J(t,i,r){let a=e.TEXTURE_2D;i.isDataTexture2DArray&&(a=e.TEXTURE_2D_ARRAY),i.isDataTexture3D&&(a=e.TEXTURE_3D),Y(t,i),n.activeTexture(e.TEXTURE0+r),n.bindTexture(a,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,i.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE);const c=function(e){return!o&&(e.wrapS!==h||e.wrapT!==h||e.minFilter!==p&&e.minFilter!==v)}(i)&&!1===V(i.image);let l=I(i.image,c,!1,u);l=ne(i,l);const d=V(l)||o,f=s.convert(i.format,i.encoding);let m,g=s.convert(i.type),y=O(i.internalFormat,f,g,i.encoding,i.isVideoTexture);K(a,i,d);const b=i.mipmaps,x=o&&!0!==i.isVideoTexture,_=void 0===t.__version,A=F(i,l,d);if(i.isDepthTexture)y=e.DEPTH_COMPONENT,o?y=i.type===S?e.DEPTH_COMPONENT32F:i.type===M?e.DEPTH_COMPONENT24:i.type===C?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT16:i.type===S&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===T&&y===e.DEPTH_COMPONENT&&i.type!==w&&i.type!==M&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=w,g=s.convert(i.type)),i.format===L&&y===e.DEPTH_COMPONENT&&(y=e.DEPTH_STENCIL,i.type!==C&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=C,g=s.convert(i.type))),x&&_?n.texStorage2D(e.TEXTURE_2D,1,y,l.width,l.height):n.texImage2D(e.TEXTURE_2D,0,y,l.width,l.height,0,f,g,null);else if(i.isDataTexture)if(b.length>0&&d){x&&_&&n.texStorage2D(e.TEXTURE_2D,A,y,b[0].width,b[0].height);for(let t=0,i=b.length;t0&&d){x&&_&&n.texStorage2D(e.TEXTURE_2D,A,y,b[0].width,b[0].height);for(let t=0,i=b.length;t=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),G+=1,e},this.resetTextureUnits=function(){G=0},this.setTexture2D=j,this.setTexture2DArray=function(t,r){const s=i.get(t);t.version>0&&s.__version!==t.version?J(s,t,r):(n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_2D_ARRAY,s.__webglTexture))},this.setTexture3D=function(t,r){const s=i.get(t);t.version>0&&s.__version!==t.version?J(s,t,r):(n.activeTexture(e.TEXTURE0+r),n.bindTexture(e.TEXTURE_3D,s.__webglTexture))},this.setTextureCube=q,this.rebindTextures=function(t,n,r){const s=i.get(t);void 0!==n&&Z(s.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),void 0!==r&&ee(t)},this.setupRenderTarget=function(t){const c=t.texture,l=i.get(t),u=i.get(c);t.addEventListener("dispose",W),!0!==t.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=e.createTexture()),u.__version=c.version,a.memory.textures++);const d=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultipleRenderTargets,f=c.isDataTexture3D||c.isDataTexture2DArray,p=V(t)||o;if(d){l.__webglFramebuffer=[];for(let t=0;t<6;t++)l.__webglFramebuffer[t]=e.createFramebuffer()}else if(l.__webglFramebuffer=e.createFramebuffer(),h)if(r.drawBuffers){const n=t.texture;for(let t=0,r=n.length;to+l?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&a<=o-l&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==c&&(c.visible=null!==s),this}}class ea extends We{constructor(e,t,n,i,r,s,a,o,c,l){if((l=void 0!==l?l:T)!==T&&l!==L)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===T&&(n=w),void 0===n&&l===L&&(n=C),super(null,i,r,s,a,o,l,n,c),this.image={width:e,height:t},this.magFilter=void 0!==a?a:p,this.minFilter=void 0!==o?o:p,this.flipY=!1,this.generateMipmaps=!1}}ea.prototype.isDepthTexture=!0;class ta extends pe{constructor(e,t){super();const n=this;let i=null,r=1,s=null,a="local-floor";const o=e.extensions.has("WEBGL_multisampled_render_to_texture");let c=null,l=null,u=null,d=null,h=!1,f=null;const p=t.getContextAttributes();let m=null,g=null;const v=[],y=new Map,b=new ai;b.layers.enable(1),b.viewport=new je;const M=new ai;M.layers.enable(2),M.viewport=new je;const S=[b,M],_=new Ys;_.layers.enable(1),_.layers.enable(2);let A=null,z=null;function R(e){const t=y.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function P(){y.forEach((function(e,t){e.disconnect(t)})),y.clear(),A=null,z=null,e.setRenderTarget(m),d=null,u=null,l=null,i=null,g=null,D.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function H(e){const t=i.inputSources;for(let e=0;e0&&(t.alphaTest.value=n.alphaTest);const i=e.get(n).envMap;let r,s;i&&(t.envMap.value=i,t.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,t.reflectivity.value=n.reflectivity,t.ior.value=n.ior,t.refractionRatio.value=n.refractionRatio),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap?r=n.clearcoatRoughnessMap:n.specularIntensityMap?r=n.specularIntensityMap:n.specularColorMap?r=n.specularColorMap:n.transmissionMap?r=n.transmissionMap:n.thicknessMap?r=n.thicknessMap:n.sheenColorMap?r=n.sheenColorMap:n.sheenRoughnessMap&&(r=n.sheenRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix)),n.aoMap?s=n.aoMap:n.lightMap&&(s=n.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),t.uv2Transform.value.copy(s.matrix))}function n(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap),n.bumpMap&&(t.bumpMap.value=n.bumpMap,t.bumpScale.value=n.bumpScale,1===n.side&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,t.normalScale.value.copy(n.normalScale),1===n.side&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias),e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,r,s,a){i.isMeshBasicMaterial?t(e,i):i.isMeshLambertMaterial?(t(e,i),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,i)):i.isMeshToonMaterial?(t(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshPhongMaterial?(t(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshStandardMaterial?(t(e,i),i.isMeshPhysicalMaterial?function(e,t,i){n(e,t),e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap)),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate())),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,i,a):n(e,i)):i.isMeshMatcapMaterial?(t(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDepthMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDistanceMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?(t(e,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){let r;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?r=t.map:t.alphaMap&&(r=t.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,r,s):i.isSpriteMaterial?function(e,t){let n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest),t.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function ia(e={}){const t=void 0!==e.canvas?e.canvas:function(){const e=Pe("canvas");return e.style.display="block",e}(),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,s=void 0===e.stencil||e.stencil,a=void 0!==e.antialias&&e.antialias,o=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,l=void 0!==e.powerPreference?e.powerPreference:"default",u=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;let d=null,f=null;const m=[],g=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=oe,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const v=this;let y=!1,w=0,M=0,C=null,T=-1,L=null;const A=new je,z=new je;let R=null,P=t.width,H=t.height,k=1,I=null,V=null;const N=new je(0,0,P,H),D=new je(0,0,P,H);let O=!1;const F=new vi;let B=!1,U=!1,W=null;const G=new Tt,j=new Ye,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function $(){return null===C?k:1}let X,K,Y,J,Z,Q,ee,te,ne,ie,re,se,ae,ce,le,ue,de,he,fe,pe,me,ge,ve,ye=n;function be(e,n){for(let i=0;i0&&function(e,t,n){if(null===W){const e=!0===a&&!0===K.isWebGL2;W=new(e?Xe:qe)(1024,1024,{generateMipmaps:!0,type:null!==ge.convert(_)?_:x,minFilter:b,magFilter:p,wrapS:h,wrapT:h,useRenderToTexture:X.has("WEBGL_multisampled_render_to_texture")})}const i=v.getRenderTarget();v.setRenderTarget(W),v.clear();const r=v.toneMapping;v.toneMapping=0,Re(e,t,n),v.toneMapping=r,Q.updateMultisampleRenderTarget(W),Q.updateRenderTargetMipmap(W),v.setRenderTarget(i)}(r,t,n),i&&Y.viewport(A.copy(i)),r.length>0&&Re(r,t,n),s.length>0&&Re(s,t,n),o.length>0&&Re(o,t,n)}function Re(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r0?g[g.length-1]:null,m.pop(),d=m.length>0?m[m.length-1]:null},this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return C},this.setRenderTargetTextures=function(e,t,n){Z.get(e.texture).__webglTexture=t,Z.get(e.depthTexture).__webglTexture=n;const i=Z.get(e);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||e.useRenderToTexture&&(console.warn("render-to-texture extension was disabled because an external texture was provided"),e.useRenderToTexture=!1,e.useRenderbuffer=!0))},this.setRenderTargetFramebuffer=function(e,t){const n=Z.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){C=e,w=t,M=n;let i=!0;if(e){const t=Z.get(e);void 0!==t.__useDefaultFramebuffer?(Y.bindFramebuffer(ye.FRAMEBUFFER,null),i=!1):void 0===t.__webglFramebuffer?Q.setupRenderTarget(e):t.__hasExternalTextures&&Q.rebindTextures(e,Z.get(e.texture).__webglTexture,Z.get(e.depthTexture).__webglTexture)}let r=null,s=!1,a=!1;if(e){const n=e.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(a=!0);const i=Z.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=i[t],s=!0):r=e.useRenderbuffer?Z.get(e).__webglMultisampledFramebuffer:i,A.copy(e.viewport),z.copy(e.scissor),R=e.scissorTest}else A.copy(N).multiplyScalar(k).floor(),z.copy(D).multiplyScalar(k).floor(),R=O;if(Y.bindFramebuffer(ye.FRAMEBUFFER,r)&&K.drawBuffers&&i&&Y.drawBuffers(e,r),Y.viewport(A),Y.scissor(z),Y.setScissorTest(R),s){const i=Z.get(e.texture);ye.framebufferTexture2D(ye.FRAMEBUFFER,ye.COLOR_ATTACHMENT0,ye.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(a){const i=Z.get(e.texture),r=t||0;ye.framebufferTextureLayer(ye.FRAMEBUFFER,ye.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}T=-1},this.readRenderTargetPixels=function(e,t,n,i,r,s,a){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=Z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){Y.bindFramebuffer(ye.FRAMEBUFFER,o);try{const a=e.texture,o=a.format,c=a.type;if(o!==E&&ge.convert(o)!==ye.getParameter(ye.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const l=c===_&&(X.has("EXT_color_buffer_half_float")||K.isWebGL2&&X.has("EXT_color_buffer_float"));if(!(c===x||ge.convert(c)===ye.getParameter(ye.IMPLEMENTATION_COLOR_READ_TYPE)||c===S&&(K.isWebGL2||X.has("OES_texture_float")||X.has("WEBGL_color_buffer_float"))||l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");ye.checkFramebufferStatus(ye.FRAMEBUFFER)===ye.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&ye.readPixels(t,n,i,r,ge.convert(o),ge.convert(c),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const e=null!==C?Z.get(C).__webglFramebuffer:null;Y.bindFramebuffer(ye.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t,n=0){if(!0!==t.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i);Q.setTexture2D(t,0),ye.copyTexSubImage2D(ye.TEXTURE_2D,n,0,0,e.x,e.y,r,s),Y.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i=0){const r=t.image.width,s=t.image.height,a=ge.convert(n.format),o=ge.convert(n.type);Q.setTexture2D(n,0),ye.pixelStorei(ye.UNPACK_FLIP_Y_WEBGL,n.flipY),ye.pixelStorei(ye.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),ye.pixelStorei(ye.UNPACK_ALIGNMENT,n.unpackAlignment),t.isDataTexture?ye.texSubImage2D(ye.TEXTURE_2D,i,e.x,e.y,r,s,a,o,t.image.data):t.isCompressedTexture?ye.compressedTexSubImage2D(ye.TEXTURE_2D,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,a,t.mipmaps[0].data):ye.texSubImage2D(ye.TEXTURE_2D,i,e.x,e.y,a,o,t.image),0===i&&n.generateMipmaps&&ye.generateMipmap(ye.TEXTURE_2D),Y.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,i,r=0){if(v.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=e.max.x-e.min.x+1,a=e.max.y-e.min.y+1,o=e.max.z-e.min.z+1,c=ge.convert(i.format),l=ge.convert(i.type);let u;if(i.isDataTexture3D)Q.setTexture3D(i,0),u=ye.TEXTURE_3D;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Q.setTexture2DArray(i,0),u=ye.TEXTURE_2D_ARRAY}ye.pixelStorei(ye.UNPACK_FLIP_Y_WEBGL,i.flipY),ye.pixelStorei(ye.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),ye.pixelStorei(ye.UNPACK_ALIGNMENT,i.unpackAlignment);const d=ye.getParameter(ye.UNPACK_ROW_LENGTH),h=ye.getParameter(ye.UNPACK_IMAGE_HEIGHT),f=ye.getParameter(ye.UNPACK_SKIP_PIXELS),p=ye.getParameter(ye.UNPACK_SKIP_ROWS),m=ye.getParameter(ye.UNPACK_SKIP_IMAGES),g=n.isCompressedTexture?n.mipmaps[0]:n.image;ye.pixelStorei(ye.UNPACK_ROW_LENGTH,g.width),ye.pixelStorei(ye.UNPACK_IMAGE_HEIGHT,g.height),ye.pixelStorei(ye.UNPACK_SKIP_PIXELS,e.min.x),ye.pixelStorei(ye.UNPACK_SKIP_ROWS,e.min.y),ye.pixelStorei(ye.UNPACK_SKIP_IMAGES,e.min.z),n.isDataTexture||n.isDataTexture3D?ye.texSubImage3D(u,r,t.x,t.y,t.z,s,a,o,c,l,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ye.compressedTexSubImage3D(u,r,t.x,t.y,t.z,s,a,o,c,g.data)):ye.texSubImage3D(u,r,t.x,t.y,t.z,s,a,o,c,l,g),ye.pixelStorei(ye.UNPACK_ROW_LENGTH,d),ye.pixelStorei(ye.UNPACK_IMAGE_HEIGHT,h),ye.pixelStorei(ye.UNPACK_SKIP_PIXELS,f),ye.pixelStorei(ye.UNPACK_SKIP_ROWS,p),ye.pixelStorei(ye.UNPACK_SKIP_IMAGES,m),0===r&&i.generateMipmaps&&ye.generateMipmap(u),Y.unbindTexture()},this.initTexture=function(e){Q.setTexture2D(e,0),Y.unbindTexture()},this.resetState=function(){w=0,M=0,C=null,Y.reset(),ve.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}ia.prototype.isWebGLRenderer=!0;class ra extends ia{}ra.prototype.isWebGL1Renderer=!0;class sa{constructor(e,t=25e-5){this.name="",this.color=new Oe(e),this.density=t}clone(){return new sa(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}sa.prototype.isFogExp2=!0;class aa{constructor(e,t=1,n=1e3){this.name="",this.color=new Oe(e),this.near=t,this.far=n}clone(){return new aa(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}aa.prototype.isFog=!0;class oa extends Zt{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}oa.prototype.isScene=!0;class ca{constructor(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=ue,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=be()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;ie.far||t.push({distance:o,point:fa.clone(),uv:un.getUV(fa,ba,xa,wa,Ma,Sa,_a,new Te),face:null,object:this})}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Ea(e,t,n,i,r,s){ga.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(va.x=s*ga.x-r*ga.y,va.y=r*ga.x+s*ga.y):va.copy(ga),e.copy(t),e.x+=va.x,e.y+=va.y,e.applyMatrix4(ya)}Ca.prototype.isSprite=!0;const Ta=new Ye,La=new Ye;class Aa extends Zt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let e=0,n=t.length;e0){let n,i;for(n=1,i=t.length;n0){Ta.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(Ta);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Ta.setFromMatrixPosition(e.matrixWorld),La.setFromMatrixPosition(this.matrixWorld);const n=Ta.distanceTo(La)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;io)continue;d.applyMatrix4(this.matrixWorld);const h=e.ray.origin.distanceTo(d);he.far||t.push({distance:h,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}else for(let n=Math.max(0,s.start),i=Math.min(r.count,s.start+s.count)-1;no)continue;d.applyMatrix4(this.matrixWorld);const i=e.ray.origin.distanceTo(d);ie.far||t.push({distance:i,point:u.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,n=Object.keys(t);if(n.length>0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Qa.prototype.isLine=!0;const eo=new Ye,to=new Ye;class no extends Qa{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e0){const e=t[n[0]];if(void 0!==e){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,n=e.length;t0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function uo(e,t,n,i,r,s,a){const o=ao.distanceSqToPoint(e);if(or.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,object:a})}}lo.prototype.isPoints=!0;class ho extends We{constructor(e,t,n,i,r,s,a,o,c){super(e,t,n,i,r,s,a,o,c),this.minFilter=void 0!==s?s:v,this.magFilter=void 0!==r?r:v,this.generateMipmaps=!1;const l=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){l.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;0=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}ho.prototype.isVideoTexture=!0;class fo extends We{constructor(e,t,n){super({width:e,height:t}),this.format=n,this.magFilter=p,this.minFilter=p,this.generateMipmaps=!1,this.needsUpdate=!0}}fo.prototype.isFramebufferTexture=!0;class po extends We{constructor(e,t,n,i,r,s,a,o,c,l,u,d){super(null,s,a,o,c,l,i,r,u,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}po.prototype.isCompressedTexture=!0;class mo extends We{constructor(e,t,n,i,r,s,a,o,c){super(e,t,n,i,r,s,a,o,c),this.needsUpdate=!0}}mo.prototype.isCanvasTexture=!0;class go extends kn{constructor(e=1,t=8,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],s=[],a=[],o=[],c=new Ye,l=new Te;s.push(0,0,0),a.push(0,0,1),o.push(.5,.5);for(let r=0,u=3;r<=t;r++,u+=3){const d=n+r/t*i;c.x=e*Math.cos(d),c.y=e*Math.sin(d),s.push(c.x,c.y,c.z),a.push(0,0,1),l.x=(s[u]/e+1)/2,l.y=(s[u+1]/e+1)/2,o.push(l.x,l.y)}for(let e=1;e<=t;e++)r.push(e,e+1,0);this.setIndex(r),this.setAttribute("position",new Cn(s,3)),this.setAttribute("normal",new Cn(a,3)),this.setAttribute("uv",new Cn(o,2))}static fromJSON(e){return new go(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class vo extends kn{constructor(e=1,t=1,n=1,i=8,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};const c=this;i=Math.floor(i),r=Math.floor(r);const l=[],u=[],d=[],h=[];let f=0;const p=[],m=n/2;let g=0;function v(n){const r=f,s=new Te,p=new Ye;let v=0;const y=!0===n?e:t,b=!0===n?1:-1;for(let e=1;e<=i;e++)u.push(0,m*b,0),d.push(0,b,0),h.push(.5,.5),f++;const x=f;for(let e=0;e<=i;e++){const t=e/i*o+a,n=Math.cos(t),r=Math.sin(t);p.x=y*r,p.y=m*b,p.z=y*n,u.push(p.x,p.y,p.z),d.push(0,b,0),s.x=.5*n+.5,s.y=.5*r*b+.5,h.push(s.x,s.y),f++}for(let e=0;e0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute("position",new Cn(u,3)),this.setAttribute("normal",new Cn(d,3)),this.setAttribute("uv",new Cn(h,2))}static fromJSON(e){return new vo(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class yo extends vo{constructor(e=1,t=1,n=8,i=1,r=!1,s=0,a=2*Math.PI){super(0,e,t,n,i,r,s,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(e){return new yo(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class bo extends kn{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],s=[];function a(e,t,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const a=e.clone().lerp(n,i/r),o=t.clone().lerp(n,i/r),c=r-i;for(let e=0;e<=c;e++)s[i][e]=0===e&&i===r?a:a.clone().lerp(o,e/c)}for(let e=0;e.9&&a<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new Cn(r,3)),this.setAttribute("normal",new Cn(r.slice(),3)),this.setAttribute("uv",new Cn(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new bo(e.vertices,e.indices,e.radius,e.details)}}class xo extends bo{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new xo(e.radius,e.detail)}}const wo=new Ye,Mo=new Ye,So=new Ye,_o=new un;class Co extends kn{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,i=Math.pow(10,n),r=Math.cos(ve*t),s=e.getIndex(),a=e.getAttribute("position"),o=s?s.count:a.count,c=[0,0,0],l=["a","b","c"],u=new Array(3),d={},h=[];for(let e=0;e0)){c=i;break}c=i-1}if(i=c,n[i]===s)return i/(r-1);const l=n[i];return(i+(s-l)/(n[i+1]-l))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=t||(s.isVector2?new Te:new Ye);return o.copy(a).sub(s).normalize(),o}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new Ye,i=[],r=[],s=[],a=new Ye,o=new Tt;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new Ye)}r[0]=new Ye,s[0]=new Ye;let c=Number.MAX_VALUE;const l=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),a.crossVectors(i[t-1],i[t]),a.length()>Number.EPSILON){a.normalize();const e=Math.acos(xe(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(a,e))}s[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(xe(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],t*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class To extends Eo{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(e,t){const n=t||new Te,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(c)/r)+1)*r:0===l&&c===r-1&&(c=r-2,l=1),this.closed||c>0?a=i[(c-1)%r]:(zo.subVectors(i[0],i[1]).add(i[0]),a=zo);const u=i[c%r],d=i[(c+1)%r];if(this.closed||c+2i.length-2?i.length-1:s+1],u=i[s>i.length-3?i.length-1:s+2];return n.set(Io(a,o.x,c.x,l.x,u.x),Io(a,o.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const e=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-e/a;return s.getPointAt(o,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);const l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Xo extends $o{constructor(e){super(e),this.uuid=be(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n0)for(s=t;s=t;s-=i)a=gc(s,e[s],e[s+1],a);return a&&uc(a,a.next)&&(vc(a),a=a.next),a}function Yo(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!uc(i,i.next)&&0!==lc(i.prev,i,i.next))i=i.next;else{if(vc(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function Jo(e,t,n,i,r,s,a){if(!e)return;!a&&s&&function(e,t,n,i){let r=e;do{null===r.z&&(r.z=sc(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,s,a,o,c,l=1;do{for(n=e,e=null,s=null,a=0;n;){for(a++,i=n,o=0,t=0;t0||c>0&&i;)0!==o&&(0===c||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,c--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,l*=2}while(a>1)}(r)}(e,i,r,s);let o,c,l=e;for(;e.prev!==e.next;)if(o=e.prev,c=e.next,s?Qo(e,i,r,s):Zo(e))t.push(o.i/n),t.push(e.i/n),t.push(c.i/n),vc(e),e=c.next,l=c.next;else if((e=c)===l){a?1===a?Jo(e=ec(Yo(e),t,n),t,n,i,r,s,2):2===a&&tc(e,t,n,i,r,s):Jo(Yo(e),t,n,i,r,s,1);break}}function Zo(e){const t=e.prev,n=e,i=e.next;if(lc(t,n,i)>=0)return!1;let r=e.next.next;for(;r!==e.prev;){if(oc(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&lc(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Qo(e,t,n,i){const r=e.prev,s=e,a=e.next;if(lc(r,s,a)>=0)return!1;const o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,u=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,d=sc(o,c,t,n,i),h=sc(l,u,t,n,i);let f=e.prevZ,p=e.nextZ;for(;f&&f.z>=d&&p&&p.z<=h;){if(f!==e.prev&&f!==e.next&&oc(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&lc(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,p!==e.prev&&p!==e.next&&oc(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&lc(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;f&&f.z>=d;){if(f!==e.prev&&f!==e.next&&oc(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&lc(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;p&&p.z<=h;){if(p!==e.prev&&p!==e.next&&oc(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&lc(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function ec(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!uc(r,s)&&dc(r,i,i.next,s)&&pc(r,s)&&pc(s,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(s.i/n),vc(i),vc(i.next),i=e=s),i=i.next}while(i!==e);return Yo(i)}function tc(e,t,n,i,r,s){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&cc(a,e)){let o=mc(a,e);return a=Yo(a,a.next),o=Yo(o,o.next),Jo(a,t,n,i,r,s),void Jo(o,t,n,i,r,s)}e=e.next}a=a.next}while(a!==e)}function nc(e,t){return e.x-t.x}function ic(e,t){if(t=function(e,t){let n=t;const i=e.x,r=e.y;let s,a=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const e=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>a){if(a=e,e===i){if(r===n.y)return n;if(r===n.next.y)return n.next}s=n.x=n.x&&n.x>=c&&i!==n.x&&oc(rs.x||n.x===s.x&&rc(s,n)))&&(s=n,d=u)),n=n.next}while(n!==o);return s}(e,t),t){const n=mc(t,e);Yo(t,t.next),Yo(n,n.next)}}function rc(e,t){return lc(e.prev,e,t.prev)<0&&lc(t.next,e,e.next)<0}function sc(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ac(e){let t=e,n=e;do{(t.x=0&&(e-a)*(i-o)-(n-a)*(t-o)>=0&&(n-a)*(s-o)-(r-a)*(i-o)>=0}function cc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&dc(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(pc(e,t)&&pc(t,e)&&function(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,s=(e.y+t.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(lc(e.prev,e,t.prev)||lc(e,t.prev,t))||uc(e,t)&&lc(e.prev,e,e.next)>0&&lc(t.prev,t,t.next)>0)}function lc(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function uc(e,t){return e.x===t.x&&e.y===t.y}function dc(e,t,n,i){const r=fc(lc(e,t,n)),s=fc(lc(e,t,i)),a=fc(lc(n,i,e)),o=fc(lc(n,i,t));return r!==s&&a!==o||!(0!==r||!hc(e,n,t))||!(0!==s||!hc(e,i,t))||!(0!==a||!hc(n,e,i))||!(0!==o||!hc(n,t,i))}function hc(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function fc(e){return e>0?1:e<0?-1:0}function pc(e,t){return lc(e.prev,e,e.next)<0?lc(e,t,e.next)>=0&&lc(e,e.prev,t)>=0:lc(e,t,e.prev)<0||lc(e,e.next,t)<0}function mc(e,t){const n=new yc(e.i,e.x,e.y),i=new yc(t.i,t.x,t.y),r=e.next,s=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function gc(e,t,n,i){const r=new yc(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function vc(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function yc(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class bc{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r80*n){o=l=e[0],c=u=e[1];for(let t=n;tl&&(l=d),h>u&&(u=h);f=Math.max(l-o,u-c),f=0!==f?1/f:0}return Jo(s,a,n,o,c,f),a}(n,i);for(let e=0;e2&&e[t-1].equals(e[0])&&e.pop()}function wc(e,t){for(let n=0;nNumber.EPSILON){const d=Math.sqrt(u),h=Math.sqrt(c*c+l*l),f=t.x-o/d,p=t.y+a/d,m=((n.x-l/h-f)*l-(n.y+c/h-p)*c)/(a*l-o*c);i=f+a*m-e.x,r=p+o*m-e.y;const g=i*i+r*r;if(g<=2)return new Te(i,r);s=Math.sqrt(g/2)}else{let e=!1;a>Number.EPSILON?c>Number.EPSILON&&(e=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(l)&&(e=!0),e?(i=-o,r=a,s=Math.sqrt(u)):(i=a,r=o,s=Math.sqrt(u/2))}return new Te(i/s,r/s)}const R=[];for(let e=0,t=E.length,n=t-1,i=e+1;e=0;e--){const t=e/f,n=u*Math.cos(t*Math.PI/2),i=d*Math.sin(t*Math.PI/2)+h;for(let e=0,t=E.length;e=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=o+2*f;e0)&&h.push(t,r,c),(e!==n-1||o0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}Oc.prototype.isMeshPhysicalMaterial=!0;class Fc extends hn{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new Oe(16777215),this.specular=new Oe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Oe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}Fc.prototype.isMeshPhongMaterial=!0;class Bc extends hn{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Oe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Oe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}Bc.prototype.isMeshToonMaterial=!0;class Uc extends hn{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}Uc.prototype.isMeshNormalMaterial=!0;class Wc extends hn{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new Oe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Oe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}Wc.prototype.isMeshLambertMaterial=!0;class Gc extends hn{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Oe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this}}Gc.prototype.isMeshMatcapMaterial=!0;class jc extends $a{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}jc.prototype.isLineDashedMaterial=!0;var qc=Object.freeze({__proto__:null,ShadowMaterial:Nc,SpriteMaterial:da,RawShaderMaterial:Ri,ShaderMaterial:ri,PointsMaterial:ro,MeshPhysicalMaterial:Oc,MeshStandardMaterial:Dc,MeshPhongMaterial:Fc,MeshToonMaterial:Bc,MeshNormalMaterial:Uc,MeshLambertMaterial:Wc,MeshDepthMaterial:Gs,MeshDistanceMaterial:js,MeshBasicMaterial:fn,MeshMatcapMaterial:Gc,LineDashedMaterial:jc,LineBasicMaterial:$a,Material:hn});const $c={arraySlice:function(e,t,n){return $c.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*t;for(let n=0;n!==t;++n)r[a++]=e[i+n]}return r},flattenJSON:function(e,t,n,i){let r=1,s=e[0];for(;void 0!==s&&void 0===s[i];)s=e[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(t.push(s.time),n.push.apply(n,a)),s=e[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(t.push(s.time),a.toArray(n,n.length)),s=e[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(t.push(s.time),n.push(a)),s=e[r++]}while(void 0!==s)},subclip:function(e,t,n,i,r=30){const s=e.clone();s.name=t;const a=[];for(let e=0;e=i)){c.push(t.times[e]);for(let n=0;ns.tracks[e].times[0]&&(o=s.tracks[e].times[0]);for(let e=0;e=i.times[d]){const e=d*c+o,t=e+c-o;h=$c.arraySlice(i.values,e,t)}else{const e=i.createInterpolant(),t=o,n=c-o;e.evaluate(s),h=$c.arraySlice(e.resultBuffer,t,n)}"quaternion"===r&&(new Ke).fromArray(h).normalize().conjugate().toArray(h);const f=a.times.length;for(let e=0;e=r)break e;{const a=t[1];e=r)break t}s=n,n=0}}for(;n>>1;et;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const e=this.getValueSize();this.times=$c.arraySlice(n,r,s),this.values=$c.arraySlice(this.values,r*e,s*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let s=null;for(let t=0;t!==r;t++){const i=n[t];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,t,i,s),e=!1;break}s=i}if(void 0!==i&&$c.isTypedArray(i))for(let t=0,n=i.length;t!==n;++t){const n=i[t];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,t,n),e=!1;break}}return e}optimize(){const e=$c.arraySlice(this.times),t=$c.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===ne,r=e.length-1;let s=1;for(let a=1;a0){e[s]=e[r];for(let e=r*n,i=s*n,a=0;a!==n;++a)t[i+a]=t[e+a];++s}return s!==e.length?(this.times=$c.arraySlice(e,0,s),this.values=$c.arraySlice(t,0,s*n)):(this.times=e,this.values=t),this}clone(){const e=$c.arraySlice(this.times,0),t=$c.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}Zc.prototype.TimeBufferType=Float32Array,Zc.prototype.ValueBufferType=Float32Array,Zc.prototype.DefaultInterpolation=te;class Qc extends Zc{}Qc.prototype.ValueTypeName="bool",Qc.prototype.ValueBufferType=Array,Qc.prototype.DefaultInterpolation=ee,Qc.prototype.InterpolantFactoryMethodLinear=void 0,Qc.prototype.InterpolantFactoryMethodSmooth=void 0;class el extends Zc{}el.prototype.ValueTypeName="color";class tl extends Zc{}tl.prototype.ValueTypeName="number";class nl extends Xc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-t)/(i-t);let c=e*a;for(let e=c+a;c!==e;c+=4)Ke.slerpFlat(r,0,s,c-a,s,c,o);return r}}class il extends Zc{InterpolantFactoryMethodLinear(e){return new nl(this.times,this.values,this.getValueSize(),e)}}il.prototype.ValueTypeName="quaternion",il.prototype.DefaultInterpolation=te,il.prototype.InterpolantFactoryMethodSmooth=void 0;class rl extends Zc{}rl.prototype.ValueTypeName="string",rl.prototype.ValueBufferType=Array,rl.prototype.DefaultInterpolation=ee,rl.prototype.InterpolantFactoryMethodLinear=void 0,rl.prototype.InterpolantFactoryMethodSmooth=void 0;class sl extends Zc{}sl.prototype.ValueTypeName="vector";class al{constructor(e,t=-1,n,i=2500){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=be(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let e=0,r=n.length;e!==r;++e)t.push(ol(n[e]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,i=n.length;e!==i;++e)t.push(Zc.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let e=0;e1){const e=s[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const s=[];for(const e in i)s.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const s=[],a=[];$c.flattenJSON(n,s,a,i),0!==s.length&&r.push(new e(t,s,a))}},i=[],r=e.name||"default",s=e.fps||30,a=e.blendMode;let o=e.length||-1;const c=e.hierarchy||[];for(let e=0;e{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==hl[e])return void hl[e].push({onLoad:t,onProgress:n,onError:i});hl[e]=[],hl[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body.getReader)return t;const n=hl[e],i=t.body.getReader(),r=t.headers.get("Content-Length"),s=r?parseInt(r):0,a=0!==s;let o=0;const c=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let e=0,t=n.length;e{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,a)));case"json":return e.json();default:if(void 0===a)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(a),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{cl.add(e,t);const n=hl[e];delete hl[e];for(let e=0,i=n.length;e{const n=hl[e];if(void 0===n)throw this.manager.itemError(e),t;delete hl[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class pl extends dl{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=cl.get(e);if(void 0!==s)return r.manager.itemStart(e),setTimeout((function(){t&&t(s),r.manager.itemEnd(e)}),0),s;const a=Pe("img");function o(){l(),cl.add(e,this),t&&t(this),r.manager.itemEnd(e)}function c(t){l(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function l(){a.removeEventListener("load",o,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",c,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class ml extends dl{constructor(e){super(e)}load(e,t,n,i){const r=new li,s=new pl(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let a=0;function o(n){s.load(e[n],(function(e){r.images[n]=e,a++,6===a&&(r.needsUpdate=!0,t&&t(r))}),void 0,i)}for(let t=0;t0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const t in e.uniforms){const r=e.uniforms[t];switch(i.uniforms[t]={},r.type){case"t":i.uniforms[t].value=n(r.value);break;case"c":i.uniforms[t].value=(new Oe).setHex(r.value);break;case"v2":i.uniforms[t].value=(new Te).fromArray(r.value);break;case"v3":i.uniforms[t].value=(new Ye).fromArray(r.value);break;case"v4":i.uniforms[t].value=(new je).fromArray(r.value);break;case"m3":i.uniforms[t].value=(new Le).fromArray(r.value);break;case"m4":i.uniforms[t].value=(new Tt).fromArray(r.value);break;default:i.uniforms[t].value=r.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(const t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=(new Te).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Te).fromArray(e.clearcoatNormalScale)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}}class Dl{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n,r=i;e!==r;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){Ke.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;Ke.multiplyQuaternionsFlat(e,s,e,t,e,n),Ke.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=t+a;e[r]=e[r]*s+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]+e[n+s]*i}}}const hu=new RegExp("[\\[\\]\\.:\\/]","g"),fu="[^\\[\\]\\.:\\/]",pu="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",mu=/((?:WC+[\/:])*)/.source.replace("WC",fu),gu=/(WCOD+)?/.source.replace("WCOD",pu),vu=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",fu),yu=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",fu),bu=new RegExp("^"+mu+gu+vu+yu+"$"),xu=["material","materials","bones"];class wu{constructor(e,t,n){this.path=t,this.parsedPath=n||wu.parseTrackName(t),this.node=wu.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new wu.Composite(e,t,n):new wu(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(hu,"")}static parseTrackName(e){const t=bu.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==xu.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i=r){const s=r++,l=e[s];t[l.uuid]=c,e[c]=l,t[o]=s,e[s]=a;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[s],r=t[c];t[c]=i,t[s]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=e.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,c=t[o];if(void 0!==c)if(delete t[o],c0&&(t[a.uuid]=c),e[c]=a,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[c]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,a=this._parsedPaths,o=this._objects,c=o.length,l=this.nCachedObjects_,u=new Array(c);i=r.length,n[e]=i,s.push(e),a.push(t),r.push(u);for(let n=l,i=o.length;n!==i;++n){const i=o[n];u[n]=new wu(i,e,t)}return u}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length-1,o=s[a];t[e[a]]=n,s[n]=o,s.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}Mu.prototype.isAnimationObjectGroup=!0;class Su{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,s=r.length,a=new Array(s),o={endingStart:ie,endingEnd:ie};for(let e=0;e!==s;++e){const t=r[e].createInterpolant(null);a[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,i=e._clip.duration,r=i/n,s=n/i;e.warp(1,r,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,s=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,c=a.sampleValues;return o[0]=r,o[1]=r+n,c[0]=e/s,c[1]=t/s,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;if(i<0||0===n)return;this._startTime=null,t=n*i}t*=this._updateTimeScale(e);const s=this._updateTime(t),a=this._updateWeight(e);if(a>0){const e=this._interpolants,t=this._propertyBindings;if(this.blendMode===ae)for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(a);else for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,a)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=2202===n;if(0===e)return-1===r?i:s&&1==(1&r)?t-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===a){const t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&1==(1&r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=re,i.endingEnd=re):(i.endingStart=e?this.zeroSlopeAtStart?re:ie:se,i.endingEnd=t?this.zeroSlopeAtEnd?re:ie:se)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=t,a[1]=r+e,o[1]=n,this}}class _u extends pe{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,a=e._interpolants,o=n.uuid,c=this._bindingsByRootAndName;let l=c[o];void 0===l&&(l={},c[o]=l);for(let e=0;e!==r;++e){const r=i[e],c=r.name;let u=l[c];if(void 0!==u)++u.referenceCount,s[e]=u;else{if(u=s[e],void 0!==u){null===u._cacheIndex&&(++u.referenceCount,this._addInactiveBinding(u,o,c));continue}const i=t&&t._propertyBindings[e].binding.parsedPath;u=new du(wu.create(n,c,i),r.ValueTypeName,r.getValueSize()),++u.referenceCount,this._addInactiveBinding(u,o,c),s[e]=u}a[e].resultBuffer=u.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let a=0;a!==n;++a)t[a]._update(i,e,r,s);const a=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)a[e].apply(s);return this}setTime(e){this.time=0;for(let e=0;ethis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return zu.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}Ru.prototype.isBox2=!0;const Pu=new Ye,Hu=new Ye;class ku{constructor(e=new Ye,t=new Ye){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Pu.subVectors(e,this.start),Hu.subVectors(this.end,this.start);const n=Hu.dot(Hu);let i=Hu.dot(Pu)/n;return t&&(i=xe(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Iu=new Ye,Vu=new Ye,Nu=new Tt,Du=new Tt;class Ou extends no{constructor(e){const t=Fu(e),n=new kn,i=[],r=[],s=new Oe(0,0,1),a=new Oe(0,1,0);for(let e=0;e.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Qu.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Qu,t)}}setLength(e,t=.2*e,n=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}},t.Audio=su,t.AudioAnalyser=uu,t.AudioContext=ql,t.AudioListener=class extends Zt{constructor(){super(),this.type="AudioListener",this.context=ql.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Ql}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(tu,nu,iu),ru.set(0,0,-1).applyQuaternion(nu),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(tu.x,e),t.positionY.linearRampToValueAtTime(tu.y,e),t.positionZ.linearRampToValueAtTime(tu.z,e),t.forwardX.linearRampToValueAtTime(ru.x,e),t.forwardY.linearRampToValueAtTime(ru.y,e),t.forwardZ.linearRampToValueAtTime(ru.z,e),t.upX.linearRampToValueAtTime(n.x,e),t.upY.linearRampToValueAtTime(n.y,e),t.upZ.linearRampToValueAtTime(n.z,e)}else t.setPosition(tu.x,tu.y,tu.z),t.setOrientation(ru.x,ru.y,ru.z,n.x,n.y,n.z)}},t.AudioLoader=$l,t.AxesHelper=nd,t.AxisHelper=function(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new nd(e)},t.BackSide=1,t.BasicDepthPacking=3200,t.BasicShadowMap=0,t.BinaryTextureLoader=function(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new gl(e)},t.Bone=Va,t.BooleanKeyframeTrack=Qc,t.BoundingBoxHelper=function(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Zu(e,t)},t.Box2=Ru,t.Box3=Qe,t.Box3Helper=class extends no{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new kn;i.setIndex(new gn(n,1)),i.setAttribute("position",new Cn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new $a({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}},t.BoxBufferGeometry=ei,t.BoxGeometry=ei,t.BoxHelper=Zu,t.BufferAttribute=gn,t.BufferGeometry=kn,t.BufferGeometryLoader=Fl,t.ByteType=1010,t.Cache=cl,t.Camera=si,t.CameraHelper=class extends no{constructor(e){const t=new kn,n=new $a({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={},a=new Oe(16755200),o=new Oe(16711680),c=new Oe(43775),l=new Oe(16777215),u=new Oe(3355443);function d(e,t,n){h(e,n),h(t,n)}function h(e,t){i.push(0,0,0),r.push(t.r,t.g,t.b),void 0===s[e]&&(s[e]=[]),s[e].push(i.length/3-1)}d("n1","n2",a),d("n2","n4",a),d("n4","n3",a),d("n3","n1",a),d("f1","f2",a),d("f2","f4",a),d("f4","f3",a),d("f3","f1",a),d("n1","f1",a),d("n2","f2",a),d("n3","f3",a),d("n4","f4",a),d("p","n1",o),d("p","n2",o),d("p","n3",o),d("p","n4",o),d("u1","u2",c),d("u2","u3",c),d("u3","u1",c),d("c","t",l),d("p","c",u),d("cn1","cn2",u),d("cn3","cn4",u),d("cf1","cf2",u),d("cf3","cf4",u),t.setAttribute("position",new Cn(i,3)),t.setAttribute("color",new Cn(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){const e=this.geometry,t=this.pointMap;Ku.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Yu("c",t,e,Ku,0,0,-1),Yu("t",t,e,Ku,0,0,1),Yu("n1",t,e,Ku,-1,-1,-1),Yu("n2",t,e,Ku,1,-1,-1),Yu("n3",t,e,Ku,-1,1,-1),Yu("n4",t,e,Ku,1,1,-1),Yu("f1",t,e,Ku,-1,-1,1),Yu("f2",t,e,Ku,1,-1,1),Yu("f3",t,e,Ku,-1,1,1),Yu("f4",t,e,Ku,1,1,1),Yu("u1",t,e,Ku,.7,1.1,-1),Yu("u2",t,e,Ku,-.7,1.1,-1),Yu("u3",t,e,Ku,0,2,-1),Yu("cf1",t,e,Ku,-1,0,1),Yu("cf2",t,e,Ku,1,0,1),Yu("cf3",t,e,Ku,0,-1,1),Yu("cf4",t,e,Ku,0,1,1),Yu("cn1",t,e,Ku,-1,0,-1),Yu("cn2",t,e,Ku,1,0,-1),Yu("cn3",t,e,Ku,0,-1,-1),Yu("cn4",t,e,Ku,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},t.CanvasTexture=mo,t.CatmullRomCurve3=ko,t.CineonToneMapping=3,t.CircleBufferGeometry=go,t.CircleGeometry=go,t.ClampToEdgeWrapping=h,t.Clock=Ql,t.Color=Oe,t.ColorKeyframeTrack=el,t.CompressedTexture=po,t.CompressedTextureLoader=class extends dl{constructor(e){super(e)}load(e,t,n,i){const r=this,s=[],a=new po,o=new fl(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials);let c=0;function l(l){o.load(e[l],(function(e){const n=r.parse(e,!0);s[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},c+=1,6===c&&(1===n.mipmapCount&&(a.minFilter=v),a.image=s,a.format=n.format,a.needsUpdate=!0,t&&t(a))}),n,i)}if(Array.isArray(e))for(let t=0,n=e.length;t65504&&(console.warn("THREE.DataUtils.toHalfFloat(): value exceeds 65504."),e=65504),id[0]=e;const t=rd[0];let n=t>>16&32768,i=t>>12&2047;const r=t>>23&255;return r<103?n:r>142?(n|=31744,n|=(255==r?0:1)&&8388607&t,n):r<113?(i|=2048,n|=(i>>114-r)+(i>>113-r&1),n):(n|=r-112<<10|i>>1,n+=1&i,n)}},t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=ul,t.DepthFormat=T,t.DepthStencilFormat=L,t.DepthTexture=ea,t.DirectionalLight=Pl,t.DirectionalLightHelper=class extends Zt{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);let i=new kn;i.setAttribute("position",new Cn([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new $a({fog:!1,toneMapped:!1});this.lightPlane=new Qa(i,r),this.add(this.lightPlane),i=new kn,i.setAttribute("position",new Cn([0,0,0,0,0,1],3)),this.targetLine=new Qa(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){ju.setFromMatrixPosition(this.light.matrixWorld),qu.setFromMatrixPosition(this.light.target.matrixWorld),$u.subVectors(qu,ju),this.lightPlane.lookAt(qu),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(qu),this.targetLine.scale.z=$u.length()}},t.DiscreteInterpolant=Jc,t.DodecahedronBufferGeometry=xo,t.DodecahedronGeometry=xo,t.DoubleSide=2,t.DstAlphaFactor=206,t.DstColorFactor=208,t.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new gn(e,t).setUsage(de)},t.DynamicCopyUsage=35050,t.DynamicDrawUsage=de,t.DynamicReadUsage=35049,t.EdgesGeometry=Co,t.EdgesHelper=function(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new no(new Co(e.geometry),new $a({color:void 0!==t?t:16777215}))},t.EllipseCurve=To,t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=o,t.EquirectangularRefractionMapping=c,t.Euler=Nt,t.EventDispatcher=pe,t.ExtrudeBufferGeometry=Mc,t.ExtrudeGeometry=Mc,t.FaceColors=1,t.FileLoader=fl,t.FlatShading=1,t.Float16BufferAttribute=_n,t.Float32Attribute=function(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Cn(e,t)},t.Float32BufferAttribute=Cn,t.Float64Attribute=function(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new En(e,t)},t.Float64BufferAttribute=En,t.FloatType=S,t.Fog=aa,t.FogExp2=sa,t.Font=function(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")},t.FontLoader=function(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")},t.FramebufferTexture=fo,t.FrontSide=0,t.Frustum=vi,t.GLBufferAttribute=Tu,t.GLSL1="100",t.GLSL3=he,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=Gu,t.Group=Js,t.HalfFloatType=_,t.HemisphereLight=bl,t.HemisphereLightHelper=class extends Zt{constructor(e,t,n){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new Ec(t);i.rotateY(.5*Math.PI),this.material=new fn({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new gn(s,3)),this.add(new Zn(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Uu.copy(this.light.color),Wu.copy(this.light.groundColor);for(let e=0,n=t.count;e0){const n=new ll(t);r=new pl(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t0){i=new pl(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;tNumber.EPSILON){if(c<0&&(n=t[s],o=-o,a=t[r],c=-c),e.ya.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=c*(e.x-n.x)-o*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(a.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=a.x)return!0}}return i}const r=bc.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===t)return n(s);let a,o,c;const l=[];if(1===s.length)return o=s[0],c=new Xo,c.curves=o.curves,l.push(c),l;let u=!r(s[0].getPoints());u=e?!u:u;const d=[],h=[];let f,p,m=[],g=0;h[g]=void 0,m[g]=[];for(let t=0,n=s.length;t1){let e=!1;const t=[];for(let e=0,t=h.length;e0&&(e||(m=d))}for(let e=0,t=h.length;e{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};return(()=>{"use strict";var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.MediapipeAvator=e.MotionDetector=void 0;var t=i(375);Object.defineProperty(e,"MotionDetector",{enumerable:!0,get:function(){return t.MotionDetector}});var n=i(696);Object.defineProperty(e,"MediapipeAvator",{enumerable:!0,get:function(){return n.MediapipeAvator}})})(),s})(),e.exports=i()},4537:e=>{"use strict";e.exports=function(e,t){for(var n=new Array(arguments.length-1),i=0,r=2,s=!0;r{"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),s=0;s<64;)r[i[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;n.encode=function(e,t,n){for(var r,s=null,a=[],o=0,c=0;t>2],r=(3&l)<<4,c=1;break;case 1:a[o++]=i[r|l>>4],r=(15&l)<<2,c=2;break;case 2:a[o++]=i[r|l>>6],a[o++]=i[63&l],c=0}o>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,a)),o=0)}return c&&(a[o++]=i[r],a[o++]=61,1===c&&(a[o++]=61)),s?(o&&s.push(String.fromCharCode.apply(String,a.slice(0,o))),s.join("")):String.fromCharCode.apply(String,a.slice(0,o))};var a="invalid encoding";n.decode=function(e,t,n){for(var i,s=n,o=0,c=0;c1)break;if(void 0===(l=r[l]))throw Error(a);switch(o){case 0:i=l,o=1;break;case 1:t[n++]=i<<2|(48&l)>>4,i=l,o=2;break;case 2:t[n++]=(15&i)<<4|(60&l)>>2,i=l,o=3;break;case 3:t[n++]=(3&i)<<6|l,o=0}}if(1===o)throw Error(a);return n-s},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{"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 s(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 a(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 o(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:s,e.writeFloatBE=i?s:r,e.readFloatLE=i?a:o,e.readFloatBE=i?o:a}():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 s=Math.floor(Math.log(t)/Math.LN2);e((r<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,n,i)}}function a(e,t,n){var i=e(t,n),r=2*(i>>31)+1,s=i>>>23&255,a=8388607&i;return 255===s?a?NaN:r*(1/0):0===s?1401298464324817e-60*r*a:r*Math.pow(2,s-150)*(a+8388608)}e.writeFloatLE=t.bind(null,n),e.writeFloatBE=t.bind(null,i),e.readFloatLE=a.bind(null,r),e.readFloatBE=a.bind(null,s)}(),"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 s(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 a(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 o(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:s,e.writeDoubleBE=i?s:r,e.readDoubleLE=i?a:o,e.readDoubleBE=i?o:a}():function(){function t(e,t,n,i,r,s){var a=i<0?1:0;if(a&&(i=-i),0===i)e(0,r,s+t),e(1/i>0?0:2147483648,r,s+n);else if(isNaN(i))e(0,r,s+t),e(2146959360,r,s+n);else if(i>17976931348623157e292)e(0,r,s+t),e((a<<31|2146435072)>>>0,r,s+n);else{var o;if(i<22250738585072014e-324)e((o=i/5e-324)>>>0,r,s+t),e((a<<31|o/4294967296)>>>0,r,s+n);else{var c=Math.floor(Math.log(i)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(o=i*Math.pow(2,-c))>>>0,r,s+t),e((a<<31|c+1023<<20|1048576*o&1048575)>>>0,r,s+n)}}}function a(e,t,n,i,r){var s=e(i,r+t),a=e(i,r+n),o=2*(a>>31)+1,c=a>>>20&2047,l=4294967296*(1048575&a)+s;return 2047===c?l?NaN:o*(1/0):0===c?5e-324*o*l:o*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,n,0,4),e.writeDoubleBE=t.bind(null,i,4,0),e.readDoubleLE=a.bind(null,r,0,4),e.readDoubleBE=a.bind(null,s,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 s(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,s=null,a=i;return function(n){if(n<1||n>r)return e(n);a+n>i&&(s=e(i),a=0);var o=t.call(s,a,a+=n);return 7&a&&(a=1+(7|a)),o}}},4997:(e,t)=>{"use strict";var n=t;n.length=function(e){for(var t=0,n=0,i=0;i191&&i<224?s[a++]=(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,s[a++]=55296+(i>>10),s[a++]=56320+(1023&i)):s[a++]=(15&i)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),a=0);return r?(a&&r.push(String.fromCharCode.apply(String,s.slice(0,a))),r.join("")):String.fromCharCode.apply(String,s.slice(0,a))},n.write=function(e,t,n){for(var i,r,s=n,a=0;a>6|192,t[n++]=63&i|128):55296==(64512&i)&&56320==(64512&(r=e.charCodeAt(a+1)))?(i=65536+((1023&i)<<10)+(1023&r),++a,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-s}},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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((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;et.activeScore-e.activeScore)).filter((function(e){return e.activeScore>0})).map((function(e){return e.attendeeId}));this.activeSpeakers=s,t(s);const a=s.length>0&&s[0]===this.selfAttendeeId&&e.prioritizeVideoSendBandwidthForActiveSpeaker();this.hasBandwidthPriority!==a&&(this.hasBandwidthPriority=a,this.hasBandwidthPriorityCallback(a))}updateScore(e,t,n,i,r){const s=e.calculateScore(n,i,r);this.speakerScores[n]!==s&&(this.speakerScores[n]=s,this.mostRecentUpdateTimestamp[n]=Date.now(),this.updateActiveSpeakers(e,t,n))}subscribe(e,t,n,i){const s=(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,s)=>{this.mostRecentUpdateTimestamp[n]=Date.now(),null!==r&&(this.speakerMuteState[n]=r),this.updateScore(e,t,n,i,r)}))};this.detectorCallbackToHandler.set(t,s);const a=new r.default(this.updateIntervalMs);if(a.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,a),n&&i){const e=new r.default(i);e.start((()=>{n(this.speakerScores)})),this.detectorCallbackToScoresTimer.set(t,e)}this.realtimeController.realtimeSubscribeToAttendeeIdPresence(s)}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{"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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543),s=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)s.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 s=this.audioElement,a=this.audioStream;if(this.browserBehavior.hasChromiumWebRTC()&&(s.srcObject=null),i)try{yield s.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()&&(s.srcObject=a)}))}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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(8320),s=n(6802),a=n(3765),o=n(543),c=n(6688),l=n(8581),u=n(3789),d=n(5687),h=n(5723),f=n(214),p=n(7500),m=n(983),g=n(7797),v=n(9678),y=n(3860),b=n(9553),x=n(3013),w=n(1208),M=n(9416),S=n(9101),_=n(289),C=n(8597),E=n(8358),T=n(3216),L=n(7408),A=n(5482),z=n(1129),R=n(6240),P=n(1960),H=n(6180),k=n(2748),I=n(1981),V=n(4543),N=n(8556),D=n(9945),O=n(1209),F=n(5547),B=n(120),U=n(9560),W=n(9485),G=n(7079),j=n(4833),q=n(5275),$=n(5924),X=n(250),K=n(6171),Y=n(365),J=n(7377),Z=n(5785),Q=n(9354),ee=n(8660),te=n(1133),ne=n(5185),ie=n(2880),re=n(1508),se=n(1318),ae=n(4242),oe=n(2958),ce=n(4922),le=n(4450),ue=n(4442),de=n(9751),he=n(1876);class fe{constructor(e,t,n,i,r,o){this._audioProfile=new a.default,this.connectionHealthData=new c.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 oe.default(new ce.default,this,this._logger),this._audioMixController=new s.default(this._logger),this._mediaStreamBroker.addMediaStreamBrokerObserver(this._audioMixController),this.meetingSessionContext.logger=this._logger,this._eventController=o}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 o.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===M.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(y.default.Connect,(()=>{this.actionConnect(!1).then(e).catch(t)}))})))}connectWithPromises(e){const t=this.meetingSessionContext;this.monitorTask=new I.default(t,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData);const n=this.monitorTask.once(),i=new O.default(t).once();this.receiveIndexTask=new U.default(t),this.monitorTask.pauseResubscribeCheck(),this.receiveIndexTask.pauseIngestion();const r=new G.default(this.logger,"Signaling",[this.createOrReuseSignalingTask(),new k.default(t),new W.default(t),new P.default(t),new F.default(t),this.receiveIndexTask]).once(),s=new A.default(t).once(r),a=new E.default(t).once(s,i),o=new z.default(t).once(a),c=new j.default(t).once(o),l=new R.default(t).once(c),u=new $.default(t).once(l);return new G.default(this.logger,this.wrapTaskName("AudioVideoStart"),[n,((e,t)=>new X.default(this.logger,t,e))(this.configuration.connectionTimeoutMs,new G.default(this.logger,"Peer",[u,e?new X.default(this.logger,new N.default(this.logger,"FinalizeConnection",[new K.default(t),new q.default(t)]),this.meetingSessionContext.meetingSessionConfiguration.attendeePresenceTimeoutMs):new q.default(t)]))])}connectWithTasks(e){return this.receiveIndexTask=new U.default(this.meetingSessionContext),this.monitorTask=new I.default(this.meetingSessionContext,this.configuration.connectionHealthPolicyConfiguration,this.connectionHealthData),this.receiveIndexTask.pauseIngestion(),this.monitorTask.pauseResubscribeCheck(),new G.default(this.logger,this.wrapTaskName("AudioVideoStart"),[this.monitorTask,new O.default(this.meetingSessionContext),new X.default(this.logger,new G.default(this.logger,"Media",[new G.default(this.logger,"Signaling",[new V.default(this.meetingSessionContext),new k.default(this.meetingSessionContext),new W.default(this.meetingSessionContext),new P.default(this.meetingSessionContext),new F.default(this.meetingSessionContext),this.receiveIndexTask]),new G.default(this.logger,"Peer",[new A.default(this.meetingSessionContext),new E.default(this.meetingSessionContext),new z.default(this.meetingSessionContext),new j.default(this.meetingSessionContext),new R.default(this.meetingSessionContext),new $.default(this.meetingSessionContext),e?new X.default(this.logger,new N.default(this.logger,"FinalizeConnection",[new K.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 o.default).hasChromiumWebRTC();const n=!!this.configuration.urls.audioHostURL;if(n?this.enableSimulcast?(this.logger.info("Using transceiver controller with simulcast support"),new f.default(this.configuration.credentials.attendeeId).hasModality(f.default.MODALITY_CONTENT)?this.meetingSessionContext.transceiverController=new J.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 Y.default(this.logger,this.meetingSessionContext.browserBehavior)):(this.logger.info("Using video only transceiver controller"),this.meetingSessionContext.transceiverController=new Q.default(this.logger,this.meetingSessionContext.browserBehavior)),this.meetingSessionContext.volumeIndicatorAdapter=new de.default(this.logger,this._realtimeController,fe.MIN_VOLUME_DECIBELS,fe.MAX_VOLUME_DECIBELS,this.configuration.credentials.attendeeId),this.meetingSessionContext.videoTileController=this._videoTileController,this.meetingSessionContext.videoDownlinkBandwidthPolicy=this.configuration.videoDownlinkBandwidthPolicy,this.meetingSessionContext.videoUplinkBandwidthPolicy=this.configuration.videoUplinkBandwidthPolicy,this.meetingSessionContext.enableSimulcast=this.enableSimulcast,this.enableSimulcast){let e=this.meetingSessionContext.videoUplinkBandwidthPolicy;e||(e=new le.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 ae.default(this.logger)}else this.meetingSessionContext.enableSimulcast=!1,this.meetingSessionContext.videoStreamIndex=new se.default(this.logger),this.meetingSessionContext.videoUplinkBandwidthPolicy||(this.meetingSessionContext.videoUplinkBandwidthPolicy=new ue.default(this.configuration.credentials.attendeeId,!this.meetingSessionContext.browserBehavior.disableResolutionScaleDown(),this.meetingSessionContext.logger,this.meetingSessionContext.browserBehavior)),this.meetingSessionContext.videoDownlinkBandwidthPolicy||(this.meetingSessionContext.videoDownlinkBandwidthPolicy=new 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 C.default(this,this.logger),this.meetingSessionContext.connectionMonitor=new l.default(this,this._realtimeController,this.connectionHealthData,new p.default(this.meetingSessionContext.signalingClient,fe.PING_PONG_INTERVAL_MS,this.logger),this.meetingSessionContext.statsCollector),this.meetingSessionContext.reconnectController=this._reconnectController,this.meetingSessionContext.videoDeviceInformation={},e||(this.totalRetryCount=0,this._reconnectController.reset(),this.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 s;this.logger.info("Needs to wait for attendee presence? "+r),s=this.usePromises?this.connectWithPromises(r):this.connectWithTasks(r);try{yield s.run(),this.connectionHealthData.setConnectionStartTime(),this._mediaStreamBroker.addMediaStreamBrokerObserver(this),this.sessionStateController.perform(y.default.FinishConnecting,(()=>{this.eventController&&(this.meetingSessionContext.meetingStartDurationMs=Date.now()-this.startAudioVideoTimestamp,this.eventController.publishEvent("meetingStartSucceeded",{maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,poorConnectionCount:this.meetingSessionContext.poorConnectionCount,retryCount:this.totalRetryCount,signalingOpenDurationMs:this.meetingSessionContext.signalingOpenDurationMs,iceGatheringDurationMs:this.meetingSessionContext.iceGatheringDurationMs,meetingStartDurationMs:this.meetingSessionContext.meetingStartDurationMs})),this.meetingSessionContext.startTimeMs=Date.now(),this.actionFinishConnecting()}))}catch(e){this.signalingTask=void 0;const t=new u.default(this.getMeetingStatusCode(e)||d.default.TaskFailed);if(this.logger.info(`Start failed: ${t} due to error ${e}.`),this.sessionStateController.state()===b.default.NotConnected)return void this.logger.info("Start failed and not connected. Not cleaning up.");this.sessionStateController.perform(y.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 X.default(this.logger,new V.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs).once()),this.signalingTask}actionFinishConnecting(){this.signalingTask=void 0,this.meetingSessionContext.videoDuplexMode=_.SdkStreamServiceType.RX,this.meetingSessionContext.enableSimulcast||(this.useUpdateTransceiverControllerForUplink?this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController():this.enforceBandwidthLimitationForSender(this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0])),this.forEachObserver((e=>{ee.Maybe.of(e.audioVideoDidStart).map((t=>t.bind(e)()))})),this._reconnectController.reset(),this.receiveIndexTask.resumeIngestion(),this.monitorTask.resumeResubscribeCheck()}stopReturningPromise(){var e;return this.sessionStateController.state()===b.default.NotConnected?(null===(e=this.meetingSessionContext.signalingClient)||void 0===e||e.closeConnection(),this.meetingSessionContext.signalingClient=null,this.cleanUpMediaStreamsAfterStop(),Promise.resolve()):new Promise(((e,t)=>{this.sessionStateController.perform(y.default.Disconnect,(()=>{this._reconnectController.disableReconnect(),this.logger.info("attendee left meeting, session will not be reconnected"),this.actionDisconnect(new u.default(d.default.Left),!1,null).then(e).catch(t)}))}))}stop(){this.stopReturningPromise()}actionDisconnect(e,t,n){return i(this,void 0,void 0,(function*(){try{yield new G.default(this.logger,this.wrapTaskName("AudioVideoStop"),[new X.default(this.logger,new H.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)]).run()}catch(e){this.logger.info("fail to stop")}try{const e=[new X.default(this.logger,new L.default(this.meetingSessionContext),this.configuration.connectionTimeoutMs)];this.cleanUpMediaStreamsAfterStop(),yield new G.default(this.logger,this.wrapTaskName("AudioVideoClean"),e).run()}catch(e){this.logger.info("fail to clean")}this.sessionStateController.perform(y.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(y.default.Update,(()=>{this.actionUpdateWithRenegotiation(!0)}));return n===x.default.Transitioned||n===x.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 s=[];if(null===n.lastVideosToReceive)i=n.videosToReceive.array();else{const e=n.videoStreamIndex;n.videosToReceive.forEach((t=>{if(n.lastVideosToReceive.contain(t))return;let s=!1;n.lastVideosToReceive.forEach((n=>{s||e.StreamIdsInSameGroup(n,t)&&(r.set(n,t),s=!0)})),s||i.push(t)})),s=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: ${s}`);const a=[];for(const[e,t]of r.entries()){const i=new S.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(a.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!==a.length&&n.signalingClient.remoteVideoUpdate(a,[]),0===i.length&&0===s.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(y.default.Update,(()=>{t()}));return n===x.default.Transitioned||n===x.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 G.default(this.logger,this.wrapTaskName("AudioVideoUpdate"),[new B.default(this.meetingSessionContext),new X.default(this.logger,new G.default(this.logger,"UpdateSession",[new E.default(this.meetingSessionContext),new z.default(this.meetingSessionContext),new j.default(this.meetingSessionContext),new R.default(this.meetingSessionContext),new $.default(this.meetingSessionContext),new q.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),e&&this.sessionStateController.perform(y.default.FinishUpdating,(()=>{this.actionFinishUpdating()}))}catch(e){this.sessionStateController.perform(y.default.FinishUpdating,(()=>{const t=new u.default(this.getMeetingStatusCode(e)||d.default.TaskFailed);t.statusCode()!==d.default.IncompatibleSDP&&this.logger.info("failed to update audio-video session"),this.handleMeetingSessionStatus(t,e)}))}}))}notifyStop(e,t){var 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 u.default(d.default.SignalingInternalServerError))))})),this.eventController){const{signalingOpenDurationMs:i,poorConnectionCount:r,startTimeMs:s,iceGatheringDurationMs:a,attendeePresenceDurationMs:o,meetingStartDurationMs:c}=this.meetingSessionContext,l={maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,meetingDurationMs:null===s?0:Math.round(Date.now()-s),meetingStatus:d.default[e.statusCode()],signalingOpenDurationMs:i,iceGatheringDurationMs:a,attendeePresenceDurationMs:o,poorConnectionCount:r,meetingStartDurationMs:c,retryCount:this.totalRetryCount},u=t&&t.message||(null===(n=e.toString)||void 0===n?void 0:n.call(e))||"";0===l.meetingDurationMs?(l.meetingErrorMessage=u,delete l.meetingDurationMs,delete l.attendeePresenceDurationMs,delete l.meetingStartDurationMs,this.eventController.publishEvent("meetingStartFailed",l)):e.isFailure()||e.isAudioConnectionFailure()?(l.meetingErrorMessage=u,this.eventController.publishEvent("meetingFailed",l)):this.eventController.publishEvent("meetingEnded",l)}}actionFinishUpdating(){if(!this.meetingSessionContext.enableSimulcast)if(this.useUpdateTransceiverControllerForUplink)this.meetingSessionContext.videoUplinkBandwidthPolicy.updateTransceiverController();else{const e=this.meetingSessionContext.videoCaptureAndEncodeParameter.encodeBitrates()[0];this.enforceBandwidthLimitationForSender(e)}this.monitorTask.resumeResubscribeCheck(),this.receiveIndexTask.resumeIngestion(),this.logger.info("updated audio-video session")}reconnect(e,t){const n=this._reconnectController.retryWithBackoff((()=>i(this,void 0,void 0,(function*(){this.sessionStateController.state()===b.default.NotConnected?this.sessionStateController.perform(y.default.Connect,(()=>{this.actionConnect(!0)})):this.sessionStateController.perform(y.default.Reconnect,(()=>{this.actionReconnect(e)})),this.totalRetryCount+=1}))),(()=>{this.logger.info("canceled retry")}));return n||this.sessionStateController.perform(y.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 G.default(this.logger,this.wrapTaskName("AudioVideoReconnect"),[new X.default(this.logger,new G.default(this.logger,"Media",[new T.default(this.meetingSessionContext),new G.default(this.logger,"Signaling",[new V.default(this.meetingSessionContext),new P.default(this.meetingSessionContext),new F.default(this.meetingSessionContext)]),new A.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs),new B.default(this.meetingSessionContext),new X.default(this.logger,new G.default(this.logger,"UpdateSession",[new E.default(this.meetingSessionContext),new z.default(this.meetingSessionContext),new j.default(this.meetingSessionContext),new R.default(this.meetingSessionContext),new $.default(this.meetingSessionContext),new q.default(this.meetingSessionContext)]),this.configuration.connectionTimeoutMs)]).run(),this.sessionStateController.perform(y.default.FinishConnecting,(()=>{if(this.eventController){const{signalingOpenDurationMs:t,poorConnectionCount:n,startTimeMs:i,iceGatheringDurationMs:r,attendeePresenceDurationMs:s,meetingStartDurationMs:a}=this.meetingSessionContext,o={maxVideoTileCount:this.meetingSessionContext.maxVideoTileCount,meetingDurationMs:Math.round(Date.now()-i),meetingStatus:d.default[e.statusCode()],signalingOpenDurationMs:t,iceGatheringDurationMs:r,attendeePresenceDurationMs:s,poorConnectionCount:n,meetingStartDurationMs:a,retryCount:this.totalRetryCount};this.eventController.publishEvent("meetingReconnected",o)}this.actionFinishConnecting()}))}catch(e){this.sessionStateController.perform(y.default.FinishConnecting,(()=>{this.logger.info("failed to reconnect audio-video session");const t=new u.default(this.getMeetingStatusCode(e)||d.default.TaskFailed);this.handleMeetingSessionStatus(t,e)}))}this.connectionHealthData.setConnectionStartTime()}))}wrapTaskName(e){return`${e}/${this.configuration.meetingId}/${this.configuration.credentials.attendeeId}`}cleanUpMediaStreamsAfterStop(){this._mediaStreamBroker.removeMediaStreamBrokerObserver(this),this.meetingSessionContext.activeAudioInput=void 0,this.meetingSessionContext.activeVideoInput=void 0}getMeetingStatusCode(e){const t=/the meeting status code: (\d+)/.exec(e&&e.message);return t&&t.length>1?Number.parseInt(t[1],10):null}enforceBandwidthLimitationForSender(e){return i(this,void 0,void 0,(function*(){yield this.meetingSessionContext.transceiverController.setVideoSendingBitrateKbps(e)}))}handleMeetingSessionStatus(e,t){if(this.logger.info(`handling status: ${d.default[e.statusCode()]}`),e.isTerminal()||this.meetingSessionContext.statsCollector&&this.meetingSessionContext.statsCollector.logMeetingSessionStatus(e),e.statusCode()===d.default.IncompatibleSDP)return this.restartLocalVideo((()=>{this.logger.info("handled incompatible SDP by attempting to restart video")})),!0;if(e.statusCode()===d.default.VideoCallSwitchToViewOnly)return this._videoTileController.removeLocalVideoTile(),this.forEachObserver((e=>{ee.Maybe.of(e.videoSendDidBecomeUnavailable).map((t=>t.bind(e)()))})),!1;if(e.statusCode()===d.default.AudioVideoWasRemovedFromPrimaryMeeting)return this.forEachObserver((t=>{ee.Maybe.of(t.audioVideoWasDemotedFromPrimaryMeeting).map((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 ${d.default[e.statusCode()]}${t?` and error: ${t.message}`:""}`):this.logger.error(`failed with status code ${d.default[e.statusCode()]}${t?` and error: ${t.message}`:""}`),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 u.default(d.default.SignalingRequestFailed);return yield new G.default(this.logger,this.wrapTaskName("PromoteToPrimaryMeeting"),[new X.default(this.logger,new D.default(this.meetingSessionContext,e,(e=>{t=e})),this.configuration.connectionTimeoutMs)]).run(),this.promotedToPrimaryMeeting=t.statusCode()===d.default.OK,t}))}demoteFromPrimaryMeeting(){this.meetingSessionContext.signalingClient.demoteFromPrimaryMeeting(),this.forEachObserver((e=>{ee.Maybe.of(e.audioVideoWasDemotedFromPrimaryMeeting).map((t=>t.bind(e)(new u.default(d.default.OK))))}))}videoInputDidChange(e){return 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=fe,fe.MIN_VOLUME_DECIBELS=-42,fe.MAX_VOLUME_DECIBELS=-14,fe.PING_PONG_INTERVAL_MS=1e4},9836:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8434),r=n(3831),s=n(209),a=n(4015),o=n(589),c=n(8015),l=n(3789),u=n(5687),d=n(6057),h=n(9141),f=n(7631),p=n(9059);class m extends p.default{constructor(e){const t=new o.default;t.meetingId="",t.externalMeetingId="",t.credentials=new c.default,t.credentials.attendeeId="",t.credentials.joinToken="",t.urls=new d.default,t.urls.turnControlURL="",t.urls.audioHostURL="",t.urls.signalingURL="wss://localhost/";const n=new s.default;super(e||t,n,new f.default(new s.default),new a.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 l.default(u.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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((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,s){this.audioVideoController=e,this.videoTileController=t,this.realtimeController=n,this.audioMixController=i,this.deviceController=r,this.contentShareController=s}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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(8074),s=n(9734);class a 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:s,height:a}=r;t&&n?(this.scaledCanvas.getContext("2d").putImageData(t,0,0),this.blurCanvasCtx.putImageData(this.blurredImage,0,0),i.save(),i.clearRect(0,0,s,a),i.drawImage(this.scaledCanvas,0,0,s,a),i.globalCompositeOperation="source-in",i.drawImage(e,0,0,s,a),i.globalCompositeOperation="destination-over",i.drawImage(this.blurCanvas,0,0,s,a),i.restore()):i.clearRect(0,0,s,a)}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=s.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=a},8074:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1851),s=n(9734),a=n(9852);class o extends r.default{constructor(e,t){super("background blur",e,t,new a.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:s}=i;n.save(),n.clearRect(0,0,r,s),n.drawImage(this.scaledCanvas,0,0,r,s),n.globalCompositeOperation="source-in",n.drawImage(e,0,0,r,s),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=s.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=o},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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4243),s=n(8030),a=n(813),o=n(2801),c=n(179),l=n(8074),u=n(9734);class d extends o.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 d;let r;return(yield l.default.isSupported())?(n.info("Using browser-provided background blur"),r=new l.default(e,t)):(n.info("Using built-in background blur"),r=new c.default(e,t)),yield r.loadAssets(),r}))}static resolveOptions(e={}){let t=Object.assign({},e);return t.blurStrength||(t.blurStrength=u.default.MEDIUM),t.logger||(t.logger=new s.default("BackgroundBlurProcessor",a.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),s=Math.round(this.framerate*(t/1e3))-n,a=Math.round(100*i/t);r>=this.filterDurationNotifyMillis&&this.delegate.filterFrameDurationHigh({framesDropped:s,avgFilterDurationMillis:r,framerate:this.framerate,periodMillis:t}),a>=this.filterCPUUtilization&&this.delegate.filterCPUUtilizationHigh({cpuUtilization:a,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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundFilterMonitor=void 0;const r=n(5021),s=n(9807),a=n(3368);class o{constructor(){this.value=void 0,this.resolve=null}whenNext(){return this.promise||(this.promise=new Promise((e=>this.resolve=e))),this.promise}next(e){this.value=e,this.resolve(e),delete this.promise}}class c{constructor(e,t,n,i){this.targetCanvas=document.createElement("canvas"),this.canvasCtx=this.targetCanvas.getContext("2d"),this.canvasVideoFrameBuffer=new s.default(this.targetCanvas),this.mask$=new o,this.sourceWidth=0,this.sourceHeight=0,this.frameNumber=0,this.videoFramesPerFilterUpdate=1,this.initWorkerPromise=c.createWorkerPromise(),this.loadModelPromise=c.createWorkerPromise(),this.modelInitialized=!1,this.destroyed=!1,this.filterType=e,this.validateSpec(t),this.validateOptions(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 a.default(this.delegate,e.reportingPeriodMillis,e.filterCPUUtilization,this.logger),this.cpuMonitor=new l(5e3,{reduceCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.min(this.videoFramesPerFilterUpdate+1,10))},increaseCPUUtilization:()=>{this.updateVideoFramesPerFilterUpdate(Math.max(this.videoFramesPerFilterUpdate-1,1))}}),this.delegate.addObserver(this.cpuMonitor)}stringify(e){return JSON.stringify(e,null,2)}handleInitialize(e){if(this.logger.info(`received initialize message: ${this.stringify(e)}`),!e.payload)return this.logger.error("failed to initialize module"),void this.initWorkerPromise.reject(new Error("failed to initialize the module"));const t=this.spec.model;this.worker.postMessage({msg:"loadModel",payload:{modelUrl:t.path,inputHeight:t.input.height,inputWidth:t.input.width,inputChannels:4,modelRangeMin:t.input.range[0],modelRangeMax:t.input.range[1],blurPixels:0}}),this.initWorkerPromise.resolve({})}handleLoadModel(e){if(this.logger.info(`received load model message: ${this.stringify(e)}`),2!==e.payload)return this.logger.error("failed to load model! status: "+e.payload),void this.loadModelPromise.reject(new Error("failed to load model! status: "+e.payload));this.modelInitialized=!0,this.loadModelPromise.resolve({})}handlePredict(e){this.mask$.next(e.payload.output)}handleWorkerEvent(e){const t=e.data;switch(t.msg){case"initialize":this.handleInitialize(t);break;case"loadModel":this.handleLoadModel(t);break;case"predict":this.handlePredict(t);break;default:this.logger.info(`unexpected event msg: ${this.stringify(t)}`)}}loadAssets(){return 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 s=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:s},[s.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=c;class l{constructor(e,t){this.monitoringPeriodMillis=e,this.observer=t,this.lastCPUChangeTimestamp=0}filterCPUUtilizationHigh(){const e=Date.now();e-this.lastCPUChangeTimestamp>=this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=e,this.observer.reduceCPUUtilization())}frameReceived(){const e=Date.now();e-this.lastCPUChangeTimestamp>=2*this.monitoringPeriodMillis&&(this.lastCPUChangeTimestamp=e,this.observer.increaseCPUUtilization())}}t.BackgroundFilterMonitor=l},4243:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5021),s=n(9424),a=n(22),o=n(543),c=n(4046),l=()=>a.default.builder().withSelfieSegmentationDefaults().build(),u="https://static.sdkassets.chime.aws",d={worker:`${u}/bgblur/workers/worker.js`,wasm:`${u}/bgblur/wasm/_cwt-wasm.wasm`,simd:`${u}/bgblur/wasm/_cwt-wasm-simd.wasm`};t.default=class{static defaultAssetSpec(){const e=c.default.sdkVersionSemVer;return{assetGroup:`sdk-${e.major}.${e.minor}`}}static createUrlWithParams(e,t){const 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=d,model:n=l(),assetGroup:i=this.defaultAssetSpec().assetGroup,revisionID:r=this.defaultAssetSpec().revisionID}=e||{},s={assetGroup:i,revisionID:r,sdk:encodeURIComponent(c.default.sdkVersion),ua:encodeURIComponent(c.default.sdkUserAgentLowResolution)};return t.worker=this.createUrlWithParams(t.worker,s),t.wasm=this.createUrlWithParams(t.wasm,s),t.simd=this.createUrlWithParams(t.simd,s),n.path=this.createUrlWithParams(n.path,s),{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 o.default).supportsBackgroundFilter()?s.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(!s.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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1851),s=n(1447);class a extends r.default{constructor(e,t){super("background replacement",e,t,new s.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 a.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:s}=i;n.save(),n.clearRect(0,0,r,s),n.drawImage(this.scaledCanvas,0,0,r,s),n.globalCompositeOperation="source-in",n.drawImage(e,0,0,r,s),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 a.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=a},9854:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4243),s=n(8030),a=n(813),o=n(2801),c=n(9392);class l extends o.default{loadAssets(){return i(this,void 0,void 0,(function*(){}))}addObserver(){}removeObserver(){}setImageBlob(){return i(this,void 0,void 0,(function*(){}))}}class u 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 u.isSupported(e,t)))return n.warn("Using no-op processor because background replacement is not supported"),new l;n.info("Using background replacement filter");const i=new c.default(e,t);return yield i.loadAssets(),i}))}static resolveOptions(e={}){const t=Object.assign({},e);return t.logger||(t.logger=new s.default("BackgroundReplacementProcessor",a.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 c.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=u},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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3631),s=n(2238);class a{constructor(){this.browser=r.detect(),this.uaParserResult=navigator&&navigator.userAgent?new s.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()>=a.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()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=a,a.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),s=n(9496),a=n(2306);class o{constructor(e,t,n){this.logger=e,this.videoStreamIndex=t,this.selfAttendeeId=n,this.globalMetricReport=new a.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),s=i+r;return s<=0||r<=0?0:100*r/s},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"),s=i.includes("fallback from");return r&&!s?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:s.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamPacketsSent:{source:"packetsSent",media:s.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamPacketLossPercent:{source:"packetsLost",media:s.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamFramesEncodedPerSecond:{source:"framesEncoded",media:s.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamFrameHeight:{source:"frameHeight",media:s.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamFrameWidth:{source:"frameWidth",media:s.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamJitterMs:{source:"jitter",media:s.default.VIDEO,dir:r.default.UPSTREAM},videoUpstreamRoundTripTimeMs:{source:"roundTripTime",media:s.default.VIDEO,dir:r.default.UPSTREAM},videoDownstreamBitrate:{source:"bytesReceived",media:s.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamPacketLossPercent:{source:"packetsLost",media:s.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamPacketsReceived:{source:"packetsReceived",media:s.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamFramesDecodedPerSecond:{source:"framesDecoded",media:s.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamFrameHeight:{source:"frameHeight",media:s.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamFrameWidth:{source:"frameWidth",media:s.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamJitterMs:{source:"jitter",media:s.default.VIDEO,dir:r.default.DOWNSTREAM},videoDownstreamDelayMs:{source:"jitterBufferMs",media:s.default.VIDEO,dir:r.default.DOWNSTREAM}},this.observableMetricSpec={audioPacketsReceived:{source:"packetsReceived",media:s.default.AUDIO,dir:r.default.DOWNSTREAM},audioPacketsReceivedFractionLoss:{source:"packetsLost",media:s.default.AUDIO,dir:r.default.DOWNSTREAM},audioDecoderLoss:{source:"decoderLoss",media:s.default.AUDIO,dir:r.default.DOWNSTREAM},audioPacketsSent:{source:"packetsSent",media:s.default.AUDIO,dir:r.default.UPSTREAM},audioPacketLossPercent:{source:"packetsLost",media:s.default.AUDIO,dir:r.default.UPSTREAM},audioUpstreamRoundTripTimeMs:{source:"roundTripTime",media:s.default.AUDIO,dir:r.default.UPSTREAM},videoUpstreamBitrate:{source:"bytesSent",media:s.default.VIDEO,dir:r.default.UPSTREAM},videoPacketSentPerSecond:{source:"packetsSent",media:s.default.VIDEO,dir:r.default.UPSTREAM},audioSpeakerDelayMs:{source:"jitterBufferMs",media:s.default.AUDIO,dir:r.default.DOWNSTREAM},audioUpstreamJitterMs:{source:"jitter",media:s.default.AUDIO,dir:r.default.UPSTREAM},audioDownstreamJitterMs:{source:"jitter",media:s.default.AUDIO,dir:r.default.DOWNSTREAM},nackCountReceivedPerSecond:{source:"nackCount",media:s.default.VIDEO,dir:r.default.UPSTREAM},availableOutgoingBitrate:{source:"availableOutgoingBitrate"},availableIncomingBitrate:{source:"availableIncomingBitrate"},currentRoundTripTimeMs:{source:"currentRoundTripTime"}}}getMetricMap(e,t){switch(e){case s.default.AUDIO:switch(t){case r.default.UPSTREAM:return this.audioUpstreamMetricMap;case r.default.DOWNSTREAM:return this.audioDownstreamMetricMap}case s.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:s}=i;return r(s||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===s.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 o(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=o},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(){"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.lastWarnTimestampMsthis.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.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,s=i.audioPacketsReceivedFractionLoss,a=i.audioSpeakerDelayMs;"number"!=typeof a||isNaN(a)||this.connectionHealthData.setAudioSpeakerDelayMs(a),"number"==typeof r&&"number"==typeof s&&(t=r,n=s,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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543),s=n(4142);class a{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."),s.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||a.defaultFrameRate}}),e&&{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxFrameRate:t||a.defaultFrameRate}})}}toggleMediaStream(e){let t=!1;if(this.mediaStream)for(let n=0;n{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=>{c.Maybe.of(e.contentShareDidPause).map((t=>t.call(e)))}))}unpauseContentShare(){this.mediaStreamBroker.toggleMediaStream(!0)&&this.forEachContentShareObserver((e=>{c.Maybe.of(e.contentShareDidUnpause).map((t=>t.call(e)))}))}setContentShareVideoCodecPreferences(e){this.contentAudioVideo.setVideoCodecSendPreferences(e)}destroy(){return 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)o.default.nextTick((()=>{this.observerQueue.has(t)&&e(t)}))}audioVideoDidStart(){this.mediaStreamBroker.mediaStream.getVideoTracks().length>0&&this.contentAudioVideo.videoTileController.startLocalVideoTile()}audioVideoDidStop(e){this.mediaStreamBroker.cleanup(),this.contentShareTile&&(this.attendeeAudioVideo.videoTileController.removeVideoTile(this.contentShareTile.id()),this.contentShareTile=null),this.forEachContentShareObserver((e=>{c.Maybe.of(e.contentShareDidStop).map((t=>t.call(e)))}))}setupContentShareEvents(){this.attendeeAudioVideo.realtimeController.realtimeSubscribeToAttendeeIdPresence(((e,t,n,i)=>{const r=new a.default(e).hasModality(a.default.MODALITY_CONTENT),s=new a.default(e).base()===this.attendeeAudioVideo.configuration.credentials.attendeeId;if(!r||!s||!t||this.contentShareTile)return;const o=this.mediaStreamBroker.mediaStream;if(null==o?void 0:o.getVideoTracks().length){this.contentShareTile=this.attendeeAudioVideo.videoTileController.addVideoTile();const e=o.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,o,t,n,null,this.contentAudioVideo.configuration.credentials.externalUserId)}this.forEachContentShareObserver((e=>{c.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,s){this.timestampMs=e,this.topic=t,this.data=n,this.senderAttendeeId=i,this.senderExternalUserId=r,this.throttled=!!s}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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543),s=n(6354),a=n(7797),o=n(1515),c=n(8660),l=n(3327),u=n(1746),d=n(8128),h=n(5348),f=n(1238),p=n(3110),m=n(4842),g=n(6991),v=n(6950),y=n(4500),b=n(7170);class x{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 o.default,this.videoInputTaskQueue=new o.default,this.muted=!1,this.mediaStreamMuteObserver=(e,t)=>{for(const n of this.deviceChangeObservers)a.default.nextTick((()=>{this.deviceChangeObservers.has(n)&&n.audioInputMuteStateChanged&&n.audioInputMuteStateChanged(e,t)}))},this.alreadyHandlingDeviceChange=!1;const{enableWebAudio:c=!1,useMediaConstraintsFallback:l=!0}=t||{};this.useWebAudio=c,this.useMediaConstraintsFallback=l,this.videoInputQualitySettings=new y.default(x.defaultVideoWidth,x.defaultVideoHeight,x.defaultVideoFrameRate);const u=this.browserBehavior.requiresResolutionAlignment(this.videoInputQualitySettings.videoWidth,this.videoInputQualitySettings.videoHeight);this.videoInputQualitySettings.videoWidth=u[0],this.videoInputQualitySettings.videoHeight=u[1],this.logger.info(`DefaultDeviceController video dimension ${this.videoInputQualitySettings.videoWidth} x ${this.videoInputQualitySettings.videoHeight}`);try{this.mediaDeviceWrapper=(new s.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 u.isAudioTransformDevice(e)?(this.logger.info(`Choosing transform input device ${e}`),yield this.chooseAudioTransformInputDevice(e)):(this.logger.info(`Choosing intrinsic audio input device ${e}`),this.removeTransform(),yield this.chooseInputIntrinsicDevice("audio",e)),this.trace("startAudioInputDevice",e,"success"),this.useWebAudio?(this.attachAudioInputStreamToAudioContext(this.activeDevices.audio.stream),this.pushAudioMeetingStateForPermissions(this.getMediaStreamDestinationNode().stream),yield null===(t=this.transform)||void 0===t?void 0:t.device.mute(this.muted),this.getMediaStreamDestinationNode().stream):(this.publishAudioInputDidChangeEvent(this.activeDevices.audio.stream),this.activeDevices.audio.stream)}catch(e){throw e}else this.logger.error("Audio input device cannot be undefined")}))}stopAudioInput(){return 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=x.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 b.isVideoTransformDevice(e)?(this.logger.info(`Choosing video transform device ${e}`),yield this.chooseVideoTransformInputDevice(e),this.publishVideoInputDidChangeEvent(this.chosenVideoTransformDevice.outputMediaStream),this.chosenVideoTransformDevice.outputMediaStream):(this.chosenVideoInputIsTransformDevice()&&(this.chosenVideoTransformDevice.onOutputStreamDisconnect(),this.chosenVideoTransformDevice=null),yield this.chooseInputIntrinsicDevice("video",e),this.trace("startVideoInputDevice",e),this.publishVideoInputDidChangeEvent(this.activeDevices.video.stream),this.activeDevices.video.stream)}catch(e){throw e}else this.logger.error("Invalid video input device")}))}stopVideoInput(){return 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=x.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);l.default.connectVideoStreamToVideoElement(this.chosenVideoTransformDevice?this.chosenVideoTransformDevice.outputMediaStream:this.activeDevices.video.stream,e,!0),this.trace("startVideoPreviewForVideoInput",e.id)}stopVideoPreviewForVideoInput(e){l.default.disconnectVideoStreamFromVideoElement(e,!1),this.trace("stopVideoPreviewForVideoInput",e.id)}setDeviceLabelTrigger(e){if(this.deviceInfoCache)for(const e of this.deviceInfoCache)if(!e.label){this.deviceInfoCache=null;break}this.deviceLabelTrigger=e,this.trace("setDeviceLabelTrigger")}mixIntoAudioInput(e){let t=null;return this.useWebAudio?(t=x.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 y.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 s of t.stream.getTracks())s.stop(),n&&s.removeEventListener("ended",n),i&&s.removeEventListener("mute",i),r&&s.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 x.synthesizeAudioDevice(0)}static synthesizeAudioDevice(e){const t=x.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*x.defaultSampleRate,x.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 a.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"),s=this.listCachedDevicesOfKind("audiooutput");this.forEachObserver((a=>{this.areDeviceListsEqual(e,i)||c.Maybe.of(a.audioInputsChanged).map((e=>e.bind(a)(i))),this.areDeviceListsEqual(t,r)||c.Maybe.of(a.videoInputsChanged).map((e=>e.bind(a)(r))),this.areDeviceListsEqual(n,s)||c.Maybe.of(a.audioOutputsChanged).map((e=>e.bind(a)(s)))})),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=>{c.Maybe.of(e.audioInputStreamEnded).map((n=>n.bind(e)(t)))})):this.forEachObserver((e=>{c.Maybe.of(e.videoInputStreamEnded).map((n=>n.bind(e)(t)))}))}))}forEachObserver(e){for(const t of this.deviceChangeObservers)a.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,s,a;let o;return"audio"===e?(o=null==n?void 0:n.audio.streamId,!!o&&o===(null===(r=null===(i=t.constraints)||void 0===i?void 0:i.audio)||void 0===r?void 0:r.streamId)):(o=null==n?void 0:n.video.streamId,!!o&&o===(null===(a=null===(s=null==t?void 0:t.constraints)||void 0===s?void 0:s.video)||void 0===a?void 0:a.streamId))}hasSameGroupId(e,t,n){if(""===e)return!0;const i=x.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 p.default(e);case"NotFoundError":case"DevicesNotFoundError":throw new f.default(e);case"NotAllowedError":case"PermissionDeniedError":case"SecurityError":throw t&&t{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:x.defaultSampleRate}),this.supportSampleSizeConstraint()&&(r.sampleSize={ideal:x.defaultSampleSize}),this.supportChannelCountConstraint()&&(r.channelCount={ideal:x.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=x.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,s=this.getMediaStreamDestinationNode();this.logger.debug(`Connecting transform node ${r} to destination ${s}.`),null==r||r.connect(s),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=x.getAudioContext().createMediaStreamSource(e);const n=this.getMediaStreamOutputNode();this.audioInputSourceNode.connect(n)}getMediaStreamDestinationNode(){return this.audioInputDestinationNode||(this.audioInputDestinationNode=x.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){x.defaultLatencyHint=e}static getAudioContext(){if(!x.audioContext){const e={};navigator.mediaDevices.getSupportedConstraints().sampleRate&&(e.sampleRate=x.defaultSampleRate),(new r.default).requiresPlaybackLatencyHintForAudioContext()&&(e.latencyHint="playback"),x.defaultLatencyHint&&(e.latencyHint=x.defaultLatencyHint),x.audioContext=new(window.AudioContext||window.webkitAudioContext)(e)}return x.audioContext}static closeAudioContext(){if(x.audioContext)try{x.audioContext.close()}catch(e){}x.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=x,x.permissionDeniedOriginDetectionThresholdMs=500,x.defaultVideoWidth=960,x.defaultVideoHeight=540,x.defaultVideoFrameRate=15,x.defaultSampleRate=48e3,x.defaultSampleSize=16,x.defaultChannelCount=1,x.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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.NoOpDeviceControllerWithEventController=void 0;const r=n(4015);class s 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=s,t.NoOpDeviceControllerWithEventController=class extends s{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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((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({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 e=yield this.send(t);if(this.cancellableEvents.delete(i),e.ok)try{const n=yield e.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - send successful events: ${t} message: ${JSON.stringify(n)}`)}catch(e){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEvents error reading OK response ${e} for events ${t}`)}else this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEvents - Failed to send events ${t} with response status ${e.status}`),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 c=new o.default(a).getParserResult(),{browserMajorVersion:l}=c,u=r(c,["browserMajorVersion"]),d=t.toJSON(),{type:h,v:f}=d,p=r(d,["type","v"]);this.authenticationToken=t.getAuthenticationToken(),this.metadata=Object.assign(Object.assign({},u),p),Object.keys(this.metadata).forEach((e=>this.attributesToFilter.push(e))),this.type=h,this.v=f,this.ingestionURL=n,this.logger=a,this.importantEvents=new Set(s);const{maxBufferCapacityKb:m,totalBufferItems:g,flushSize:v,flushIntervalMs:y,retryCountLimit:b}=e;this.maxBufferCapacityBytes=1024*m,this.totalBufferItems=g,this.maxBufferItemCapacityBytes=Math.round(this.maxBufferCapacityBytes/g),this.flushIntervalMs=y,this.flushSize=v,this.retryCountLimit=b,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 a.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),s=Object.assign({name:t,ts:n},r);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - event after filtering attributes ${JSON.stringify(s)}`);const a=this.getSize(s);if(a>l.MAX_ITEM_SIZE_BYTES_ALLOWED)throw new Error(`Event Reporting - Item to be added has size ${a} bytes. Item cannot exceed max item size allowed of ${l.MAX_ITEM_SIZE_BYTES_ALLOWED} bytes.`);if(this.importantEvents.has(t))return this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - addItem - sending important event ${JSON.stringify(s)}`),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(s),this.ingestionEventSize+=a,this.bufferItemThresholdReached(a)){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===l.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 s=!1,a=null;const o=this.makeRequestBody([r]);try{if(a=yield this.send(o),a.ok){try{const e=yield a.json();this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - send successful event: ${o}, message: ${JSON.stringify(e)}`)}catch(e){this.logger.warn(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Error reading OK response ${e} for event ${o}`)}return}this.logger.error(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - Failed to send an important event ${o} with response status ${a.status}`),s=!0}catch(e){this.logger.warn(`Event Reporting - There may be a failure in sending an important event ${o} to the ingestion endpoint ${e}.`),s=!0;try{if("firefox"===this.metadata.browserName.toLowerCase()){const e=this.makeBeaconRequestBody([r]);this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - beaconing data out ${e}`),s=!navigator.sendBeacon(`${this.ingestionURL}?beacon=1`,e)}}catch(e){this.logger.warn(`Event Reporting - Error sending beacon for an important event ${o}`),s=!0}}s&&(this.logger.debug(`Event Reporting - InMemoryJSONEventBuffer - sendEventImmediately - pushing to failed events ${o}`),this.failedIngestionEvents.push(r))}))}send(e){return i(this,void 0,void 0,(function*(){const t=new s.default(l.RETRY_FIXED_BACKOFF_WAIT_MS,l.RETRY_SHORT_BACKOFF_MS,l.RETRY_LONG_BACKOFF_MS);try{let n=0;for(;n0){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=l,l.SENDING_FAILURE_CODES=new Set([408,429,500,502,503,504]),l.RETRY_FIXED_BACKOFF_WAIT_MS=0,l.RETRY_SHORT_BACKOFF_MS=1e3,l.RETRY_LONG_BACKOFF_MS=15e3,l.MAX_PAYLOAD_ITEMS=2,l.MAX_ITEM_SIZE_BYTES_ALLOWED=3e3},7700:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e=5e3,t=2,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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(2238),s=n(146),a=n(5680),o=n(6366),c=n(9385),l=n(7797),u=n(4046),d=n(731);class h{constructor(e,t,n){var i,s,a,o,c,l,u;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===(a=null===(s=null===(i=this.parserResult)||void 0===i?void 0:i.browser)||void 0===s?void 0:s.version)||void 0===a?void 0:a.split(".")[0])||h.UNAVAILABLE,this.browserName=(null===(o=this.parserResult)||void 0===o?void 0:o.browser.name)||h.UNAVAILABLE,this.browserVersion=(null===(c=this.parserResult)||void 0===c?void 0:c.browser.version)||h.UNAVAILABLE,this.deviceName=[(null===(l=this.parserResult)||void 0===l?void 0:l.device.vendor)||"",(null===(u=this.parserResult)||void 0===u?void 0:u.device.model)||""].join(" ").trim()||h.UNAVAILABLE}addObserver(e){this.observerSet.add(e)}removeObserver(e){this.observerSet.delete(e)}forEachObserver(e){for(const t of this.observerSet)l.default.nextTick((()=>{this.observerSet.has(t)&&e(t)}))}publishEvent(e,t){return 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=d.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:s}}=e,l=new c.default(i,r,s),u=new a.default(l,n);this._eventReporter=new o.default(u,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:u.default.sdkVersion,sdkName:u.default.sdkName,timestampMs:e}}get eventReporter(){return this._eventReporter}destroy(){return i(this,void 0,void 0,(function*(){s.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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(146),s=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:a}=n;this.eventBuffer=new s.default(r,n,i,this.importantEvents,t),this.logger=t,this.eventsToIgnore=a,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 s=n(7797);t.AsyncScheduler=s.default;const a=n(8358);t.AttachMediaInputTask=a.default;const o=n(7602);t.Attendee=o.default;const c=n(9880);t.AudioLogEvent=c.default;const l=n(3765);t.AudioProfile=l.default;const u=n(1876);t.AudioVideoControllerState=u.default;const d=n(9734);t.BackgroundBlurStrength=d.default;const h=n(1260);t.BackgroundBlurVideoFrameProcessor=h.default;const f=n(4243);t.BackgroundFilterVideoFrameProcessor=f.default;const p=n(9854);t.BackgroundReplacementVideoFrameProcessor=p.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 y=n(7237);t.CSPMonitor=y.default;const b=n(9807);t.CanvasVideoFrameBuffer=b.default;const x=n(2084);t.CheckAudioConnectivityFeedback=x.default;const w=n(8892);t.CheckAudioInputFeedback=w.default;const M=n(9333);t.CheckAudioOutputFeedback=M.default;const S=n(1087);t.CheckCameraResolutionFeedback=S.default;const _=n(2606);t.CheckContentShareConnectivityFeedback=_.default;const C=n(7415);t.CheckNetworkTCPConnectivityFeedback=C.default;const E=n(4299);t.CheckNetworkUDPConnectivityFeedback=E.default;const T=n(6818);t.CheckVideoConnectivityFeedback=T.default;const L=n(1737);t.CheckVideoInputFeedback=L.default;const A=n(3216);t.CleanRestartedSessionTask=A.default;const z=n(7408);t.CleanStoppedSessionTask=z.default;const R=n(4571);t.ClientMetricReport=R.default;const P=n(6196);t.ClientMetricReportDirection=P.default;const H=n(9496);t.ClientMetricReportMediaType=H.default;const k=n(2770);t.ClientVideoStreamReceivingReport=k.default;const I=n(6688);t.ConnectionHealthData=I.default;const V=n(3731);t.ConnectionHealthPolicyConfiguration=V.default;const N=n(8030);t.ConsoleLogger=N.default;const D=n(8890);t.ContentShareConstants=D.default;const O=n(8370);t.ContentShareMediaStreamBroker=O.default;const F=n(5482);t.CreatePeerConnectionTask=F.default;const B=n(1129);t.CreateSDPTask=B.default;const U=n(1018);t.DataMessage=U.default;const W=n(8320);t.DefaultActiveSpeakerDetector=W.default;const G=n(2363);t.DefaultActiveSpeakerPolicy=G.default;const j=n(6802);t.DefaultAudioMixController=j.default;const q=n(9059);t.DefaultAudioVideoController=q.default;const $=n(8538);t.DefaultAudioVideoFacade=$.default;const X=n(543);t.DefaultBrowserBehavior=X.default;const K=n(8023);t.DefaultContentShareController=K.default;const Y=n(4142);t.DefaultDeviceController=Y.default;const J=n(8236);t.DefaultDevicePixelRatioMonitor=J.default;const Z=n(3831);t.DefaultEventController=Z.default;const Q=n(6354);t.DefaultMediaDeviceFactory=Q.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 se=n(7500);t.DefaultPingPong=se.default;const ae=n(983);t.DefaultRealtimeController=ae.default;const oe=n(9141);t.DefaultReconnectController=oe.default;const ce=n(9678);t.DefaultSessionStateController=ce.default;const le=n(334);t.DefaultSigV4=le.default;const ue=n(1208);t.DefaultSignalingClient=ue.default;const de=n(4450);t.DefaultSimulcastUplinkPolicy=de.default;const he=n(3879);t.DefaultSimulcastUplinkPolicyForContentShare=he.default;const fe=n(365);t.DefaultTransceiverController=fe.default;const pe=n(5308);t.DefaultTranscriptionController=pe.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 ye=n(1508);t.DefaultVideoStreamIdSet=ye.default;const be=n(1318);t.DefaultVideoStreamIndex=be.default;const xe=n(3327);t.DefaultVideoTile=xe.default;const we=n(2958);t.DefaultVideoTileController=we.default;const Me=n(4922);t.DefaultVideoTileFactory=Me.default;const Se=n(7673);t.DefaultVideoTransformDevice=Se.default;const _e=n(9751);t.DefaultVolumeIndicatorAdapter=_e.default;const Ce=n(7631);t.DefaultWebSocketAdapter=Ce.default;const Ee=n(9190);t.DevicePixelRatioWindowSource=Ee.default;const Te=n(8128);t.DeviceSelection=Te.default;const Le=n(7700);t.EventBufferConfiguration=Le.default;const Ae=n(5680);t.EventIngestionConfiguration=Ae.default;const ze=n(6240);t.FinishGatheringICECandidatesTask=ze.default;const Re=n(8434);t.FullJitterBackoff=Re.default;const Pe=n(5640);t.FullJitterBackoffFactory=Pe.default;const He=n(7300);t.FullJitterLimitedBackoff=He.default;const ke=n(5348);t.GetUserMediaError=ke.default;const Ie=n(2306);t.GlobalMetricReport=Ie.default;const Ve=n(3520);t.InMemoryJSONEventBuffer=Ve.default;const Ne=n(3922);t.IntervalScheduler=Ne.default;const De=n(1960);t.JoinAndReceiveIndexTask=De.default;const Oe=n(6180);t.LeaveAndReceiveLeaveAckTask=Oe.default;const Fe=n(2748);t.ListenForVolumeIndicatorsTask=Fe.default;const Be=n(293);t.Log=Be.default;const Ue=n(813);t.LogLevel=Ue.default;const We=n(4236);t.MediaDeviceProxyHandler=We.default;const Ge=n(9385);t.MeetingEventsClientConfiguration=Ge.default;const je=n(3990);t.MeetingReadinessCheckerConfiguration=je.default;const qe=n(589);t.MeetingSessionConfiguration=qe.default;const $e=n(8015);t.MeetingSessionCredentials=$e.default;const Xe=n(7604);t.MeetingSessionLifecycleEvent=Xe.default;const Ke=n(1296);t.MeetingSessionLifecycleEventCondition=Ke.default;const Ye=n(3789);t.MeetingSessionStatus=Ye.default;const Je=n(5687);t.MeetingSessionStatusCode=Je.default;const Ze=n(7215);t.MeetingSessionTURNCredentials=Ze.default;const Qe=n(6057);t.MeetingSessionURLs=Qe.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 st=n(9938);t.MultiLogger=st.default;const at=n(4442);t.NScaleVideoUplinkBandwidthPolicy=at.default;const ot=n(9836);t.NoOpAudioVideoController=ot.default;const ct=n(209);t.NoOpDebugLogger=ct.default;const lt=n(6154);t.NoOpDeviceController=lt.default;const ut=n(732);t.NoOpEventReporter=ut.default;const dt=n(7434);t.NoOpLogger=dt.default;const ht=n(4015);t.NoOpMediaStreamBroker=ht.default;const ft=n(8831);t.NoOpTask=ft.default;const pt=n(3663);t.NoOpVideoElementFactory=pt.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 yt=n(1238);t.NotFoundError=yt.default;const bt=n(3110);t.NotReadableError=bt.default;const xt=n(1124);t.OnceTask=xt.default;const wt=n(4543);t.OpenSignalingConnectionTask=wt.default;const Mt=n(4842);t.OverconstrainedError=Mt.default;const St=n(5013);t.POSTLogger=St.default;const _t=n(8556);t.ParallelGroupTask=_t.default;const Ct=n(6991);t.PermissionDeniedError=Ct.default;const Et=n(106);t.PrefetchOn=Et.default;const Tt=n(3938);t.PrefetchSortBy=Tt.default;const Lt=n(1515);t.PromiseQueue=Lt.default;const At=n(9945);t.PromoteToPrimaryMeetingTask=At.default;const zt=n(5910);t.RealtimeAttendeePositionInFrame=zt.default;const Rt=n(9825);t.RealtimeState=Rt.default;const Pt=n(9576);t.RealtimeVolumeIndicator=Pt.default;const Ht=n(1209);t.ReceiveAudioInputTask=Ht.default;const kt=n(5547);t.ReceiveTURNCredentialsTask=kt.default;const It=n(120);t.ReceiveVideoInputTask=It.default;const Vt=n(9560);t.ReceiveVideoStreamIndexTask=Vt.default;const Nt=n(9708);t.ReconnectionHealthPolicy=Nt.default;const Dt=n(4191);t.RunnableTask=Dt.default;const Ot=n(326);t.SDP=Ot.default;const Ft=n(4076);t.SDPCandidateType=Ft.default;const Bt=n(1944);t.SDPMediaSection=Bt.default;const Ut=n(9485);t.SendAndReceiveDataMessagesTask=Ut.default;const Wt=n(2977);t.SendingAudioFailureConnectionHealthPolicy=Wt.default;const Gt=n(7079);t.SerialGroupTask=Gt.default;const jt=n(7103);t.ServerSideNetworkAdaption=jt.default;const qt=n(3860);t.SessionStateControllerAction=qt.default;const $t=n(6850);t.SessionStateControllerDeferPriority=$t.default;const Xt=n(9553);t.SessionStateControllerState=Xt.default;const Kt=n(3013);t.SessionStateControllerTransitionResult=Kt.default;const Yt=n(4833);t.SetLocalDescriptionTask=Yt.default;const Jt=n(5275);t.SetRemoteDescriptionTask=Jt.default;const Zt=n(8581);t.SignalingAndMetricsConnectionMonitor=Zt.default;const Qt=n(3920);t.SignalingClientConnectionRequest=Qt.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 sn=n(9101);t.SignalingClientVideoSubscriptionConfiguration=sn.default;const an=n(7377);t.SimulcastContentShareTransceiverController=an.default;const on=n(7606);t.SimulcastLayers=on.default;const cn=n(5785);t.SimulcastTransceiverController=cn.default;const ln=n(4242);t.SimulcastVideoStreamIndex=ln.default;const un=n(7786);t.SingleNodeAudioTransformDevice=un.default;const dn=n(2811);t.StreamMetricReport=dn.default;const hn=n(5924);t.SubscribeAndReceiveSubscribeAckTask=hn.default;const fn=n(2721);t.TargetDisplaySize=fn.default;const pn=n(4456);t.TaskStatus=pn.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 yn=n(2471);t.TranscriptAlternative=yn.default;const bn=n(7210);t.TranscriptEntity=bn.default;const xn=n(1741);t.TranscriptItem=xn.default;const wn=n(6864);t.TranscriptItemType=wn.default;const Mn=n(9063);t.TranscriptLanguageWithScore=Mn.default;const Sn=n(5323);t.TranscriptResult=Sn.default;const _n=n(1288);t.TranscriptionStatus=_n.default;const Cn=n(1326);t.TranscriptionStatusType=Cn.default;const En=n(6950);t.TypeError=En.default;const Tn=n(1922);t.UnusableAudioWarningConnectionHealthPolicy=Tn.default;const Ln=n(4046);t.Versioning=Ln.default;const An=n(2880);t.VideoAdaptiveProbePolicy=An.default;const zn=n(2330);t.VideoCodecCapability=zn.default;const Rn=n(155);t.VideoLogEvent=Rn.default;const Pn=n(9354);t.VideoOnlyTransceiverController=Pn.default;const Hn=n(1754);t.VideoPreference=Hn.default;const kn=n(1819);t.VideoPreferences=kn.default;const In=n(4992);t.VideoPriorityBasedPolicy=In.default;const Vn=n(1034);t.VideoPriorityBasedPolicyConfig=Vn.default;const Nn=n(4500);t.VideoQualitySettings=Nn.default;const Dn=n(60);t.VideoSource=Dn.default;const On=n(6876);t.VideoStreamDescription=On.default;const Fn=n(7804);t.VideoTileState=Fn.default;const Bn=n(2497);t.VoiceFocusDeviceTransformer=Bn.default;const Un=n(8878);t.VoiceFocusTransformDevice=Un.default;const Wn=n(6171);t.WaitForAttendeePresenceTask=Wn.default;const Gn=n(7387);t.WebSocketReadyState=Gn.default;const jn=n(3320);t.ZLIBTextCompressor=jn.default;const qn=n(1819);Object.defineProperty(t,"MutableVideoPreferences",{enumerable:!0,get:function(){return qn.MutableVideoPreferences}});const $n=n(8660);Object.defineProperty(t,"Some",{enumerable:!0,get:function(){return $n.Some}}),Object.defineProperty(t,"None",{enumerable:!0,get:function(){return $n.None}}),Object.defineProperty(t,"Maybe",{enumerable:!0,get:function(){return $n.Maybe}});const Xn=n(1746);Object.defineProperty(t,"isAudioTransformDevice",{enumerable:!0,get:function(){return Xn.isAudioTransformDevice}});const Kn=n(146);Object.defineProperty(t,"isDestroyable",{enumerable:!0,get:function(){return Kn.isDestroyable}});const Yn=n(7170);Object.defineProperty(t,"isVideoTransformDevice",{enumerable:!0,get:function(){return Yn.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{"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 s extends r.default{constructor(){super(i.default.DEBUG)}}t.default=s},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.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){a.default.DEBUGi(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{"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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(7797),s=n(3922);class a{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 s.default(a.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.deviceIdt.deviceId?-1:0))}))}handleDeviceChangeEvent(){for(const e of this.deviceChangeListeners)r.default.nextTick((()=>{if(this.deviceChangeListeners.has(e)){const t=new Event("devicechange");"function"==typeof e?e(t):e.handleEvent(t)}}))}}t.default=a,a.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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(6802),s=n(543),a=n(4142),o=n(6991),c=n(1789),l=n(250),u=n(2084),d=n(8892),h=n(9333),f=n(1087),p=n(2606),m=n(7415),g=n(4299),v=n(6818),y=n(1737),b=n(3990);class x{constructor(e,t,n=new b.default){this.logger=e,this.meetingSession=t,this.configuration=n,this.browserBehavior=new s.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(),d.default.Succeeded}catch(e){return this.logger.error(`MeetingReadinessChecker: Audio input check failed with error ${e}`),e instanceof o.default?d.default.PermissionDenied:d.default.Failed}}))}checkAudioOutput(e,t,n=null){return i(this,void 0,void 0,(function*(){try{const i=e?a.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=a.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 s=this.audioContext.currentTime+.1;this.gainNode.gain.linearRampToValueAtTime(0,s),this.gainNode.gain.linearRampToValueAtTime(i,s+.1),this.oscillatorNode.start();const o=new r.default(this.logger);try{this.browserBehavior.supportsSetSinkId()&&(yield o.bindAudioDevice({deviceId:e}))}catch(e){this.logger.error(`Failed to bind audio device: ${e}`)}try{yield o.bindAudioElement(n||new Audio)}catch(e){this.logger.error(`Failed to bind audio element: ${e}`)}yield o.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(),y.default.Succeeded}catch(e){return this.logger.error(`MeetingReadinessChecker: Video check failed with error ${e}`),e instanceof o.default?y.default.PermissionDenied:y.default.Failed}}))}checkCameraResolution(e,t,n){return i(this,void 0,void 0,(function*(){let i;try{const r=a.default.getIntrinsicDeviceId(e),s={video:this.calculateVideoConstraint(r,t,n)};i=yield navigator.mediaDevices.getUserMedia(s)}catch(e){return this.logger.error(`MeetingReadinessChecker: Camera resolution check with width: ${t} height ${n} failed with error ${e}`),e&&"OverconstrainedError"===e.name?f.default.ResolutionNotSupported:e&&"NotAllowedError"===e.name?f.default.PermissionDenied:f.default.Failed}finally{i&&i.getTracks().forEach((function(e){e.stop()}))}return f.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}},s={audioVideoDidStart:()=>{n=!0}};try{return this.meetingSession.audioVideo.addObserver(s),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?p.default.Succeeded:p.default.TimedOut):p.default.ConnectionFailed}catch(e){return this.logger.error(`MeetingReadinessChecker: Content share check failed with error ${e}`),"NotAllowedError"===e.name?p.default.PermissionDenied:p.default.Failed}finally{this.meetingSession.audioVideo.removeObserver(s),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 o.default?u.default.AudioInputPermissionDenied:u.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?u.default.Succeeded:u.default.AudioNotReceived):(n.realtimeUnsubscribeToAttendeeIdPresence(r),yield this.meetingSession.audioVideo.stopAudioInput(),u.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 o.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 c.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 x.delay(this.waitDurationMs)}}))}}const r=new l.default(this.logger,new n(this.logger,this.configuration.waitDurationMs),this.configuration.timeoutMs);return yield r.run(),t}))}}t.default=x},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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9059),s=n(8538),a=n(8434),o=n(543),c=n(8370),l=n(8023),u=n(7237),d=n(146),h=n(3831),f=n(9141),p=n(7631);t.default=class{constructor(e,t,n,i){this._eventController=i,this._configuration=e,this._logger=t,this.checkBrowserSupportAndFeatureConfiguration(),u.default.addLogger(this._logger),u.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 p.default(this._logger),n,new f.default(this._configuration.reconnectTimeoutMs,new a.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs)),this.eventController),this._deviceController=n;const o=new c.default(this._logger);this.contentShareController=new l.default(o,new r.default(l.default.createContentShareMeetingSessionConfigure(this._configuration),this._logger,new p.default(this._logger),o,new f.default(this._configuration.reconnectTimeoutMs,new a.default(this._configuration.reconnectFixedWaitMs,this._configuration.reconnectShortBackOffMs,this._configuration.reconnectLongBackOffMs))),this.audioVideoController),this.audioVideoFacade=new s.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*(){d.isDestroyable(this.contentShareController)&&(yield this.contentShareController.destroy()),d.isDestroyable(this.audioVideoController)&&(yield this.audioVideoController.destroy()),d.isDestroyable(this.eventController)&&(yield this.eventController.destroy()),u.default.removeLogger(this._logger),this._logger=void 0,this._configuration=void 0,this._deviceController=void 0,this.audioVideoFacade=void 0,this.audioVideoController=void 0,this.contentShareController=void 0,this._eventController=void 0}))}checkBrowserSupportAndFeatureConfiguration(){const e=new o.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),s=n(8015),a=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 a.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 s.default,this.credentials.attendeeId=t.attendeeid,this.credentials.externalUserId=t.externaluserid,this.credentials.joinToken=t.jointoken)}}},8015:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.attendeeId=null,this.externalUserId=null,this.joinToken=null}toJSON(){return{attendeeId:this.attendeeId,joinToken:null===this.joinToken?null:""}}}},7604:(e,t)=>{"use strict";var 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 s{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 s(r.default.SignalingRequestFailed):e.type===i.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE?new s(r.default.AudioVideoWasRemovedFromPrimaryMeeting):new s(r.default.OK)}static fromAudioStatus(e){switch(e){case 200:return new s(r.default.OK);case 301:return new s(r.default.AudioJoinedFromAnotherDevice);case 302:return new s(r.default.AudioDisconnectAudio);case 403:return new s(r.default.AudioAuthenticationRejected);case 409:return new s(r.default.AudioCallAtCapacity);case 410:return new s(r.default.MeetingEnded);case 411:return new s(r.default.AudioAttendeeRemoved);case 500:return new s(r.default.AudioInternalServerError);case 503:return new s(r.default.AudioServiceUnavailable);default:return 2===Math.floor(e/100)?new s(r.default.OK):new s(r.default.AudioDisconnected)}}static fromSignalingStatus(e){switch(e){case 206:return new s(r.default.VideoCallSwitchToViewOnly);case 509:return new s(r.default.VideoCallAtSourceCapacity);case 403:return new s(r.default.AudioAuthenticationRejected);case 409:return new s(r.default.AudioCallAtCapacity);default:switch(Math.floor(e/100)){case 2:return new s(r.default.OK);case 4:return new s(r.default.SignalingBadRequest);case 5:return new s(r.default.SignalingInternalServerError);default:return new s(r.default.SignalingRequestFailed)}}}}t.default=s},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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5388),s=n(8434),a=n(7237),o=n(9358),c=n(9141),l=n(7797),u=n(334),d=n(7631),h=n(7387),f=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 d.default(this.logger)),this.reconnectController||(this.reconnectController=new c.default(e.reconnectTimeoutMs,new s.default(e.reconnectFixedWaitMs,e.reconnectShortBackoffMs,e.reconnectLongBackoffMs))),this.sigV4||(this.sigV4=new u.default(this.configuration.chimeClient)),a.default.addLogger(this.logger),a.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(),a.default.removeLogger(this.logger))}forEachObserver(e){for(const t of this.observerQueue)l.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===f.default.Connect&&t.set("prefetch-on",[f.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 o.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{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),s=n(9416),a=n(289),o=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=>{o.Maybe.of(e.didMissPongs).map((t=>t.bind(e)(this.consecutivePongsUnaccountedFor)))}))),this.consecutivePongsUnaccountedFor+=1,this.pingId=this.pingId+1&4294967295;const e=a.SdkPingPongFrame.create();e.pingId=this.pingId,e.type=a.SdkPingPongType.PING,this.pingTimestampLocalMs=this.signalingClient.pingPong(e),this.logger.debug((()=>`sent ping ${this.pingId}`))}pong(e){const t=a.SdkPingPongFrame.create();t.pingId=e,t.type=a.SdkPingPongType.PONG,this.signalingClient.pingPong(t)}handleSignalingClientEvent(e){switch(e.type){case s.default.WebSocketOpen:this.startPingInterval();break;case s.default.WebSocketFailed:case s.default.WebSocketError:this.logger.warn(`stopped pinging (${s.default[e.type]})`),this.stopPingInterval();break;case s.default.WebSocketClosing:case s.default.WebSocketClosed:this.logger.info(`stopped pinging (${s.default[e.type]})`),this.stopPingInterval();break;case s.default.ReceivedSignalFrame:if(e.message.type!==a.SdkSignalFrame.Type.PING_PONG)break;if(e.message.pingPong.type===a.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),s=this.pingTimestampLocalMs-r;this.logger.info(`local clock skew estimate=${s}ms from ping-pong time=${i}ms`),this.forEachObserver((e=>{o.Maybe.of(e.didReceivePong).map((n=>n.bind(e)(t,s,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),s=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 s of this.state.attendeeIdChangesCallbacks)s(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 s=this.getVolumeIndicatorState(e);let a=!1,o=!1,c=!1;null!==n&&s.muted!==n&&(s.muted=n,o=!0,s.muted&&0!==s.volume&&(s.volume=0,a=!0)),s.muted||null===t||(s.volume!==t&&(s.volume=t,a=!0),null===s.muted&&(s.muted=!1,o=!0)),null!==i&&s.signalStrength!==i&&(s.signalStrength=i,c=!0),this.sendVolumeIndicatorChange(e,a,o,c,r)}catch(e){this.onError(e)}}realtimeSubscribeToLocalSignalStrengthChange(e){try{if(this.state.localSignalStrengthChangeCallbacks.push(e),null===this.state.localAttendeeId)return;this.sendLocalSignalStrengthChange(this.state.localAttendeeId,!0)}catch(e){this.onError(e)}}realtimeUnsubscribeToLocalSignalStrengthChange(e){try{const t=this.state.localSignalStrengthChangeCallbacks.indexOf(e);-1!==t&&this.state.localSignalStrengthChangeCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeSubscribeToSendDataMessage(e){try{this.state.sendDataMessageCallbacks.push(e)}catch(e){this.onError(e)}}realtimeUnsubscribeFromSendDataMessage(e){try{const t=this.state.sendDataMessageCallbacks.indexOf(e);-1!==t&&this.state.sendDataMessageCallbacks.splice(t,1)}catch(e){this.onError(e)}}realtimeSendDataMessage(e,t,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 a=this.getVolumeIndicatorState(e),o=new s.default;if(t&&(o.volume=a.volume),n&&(o.muted=a.muted),i&&(o.signalStrength=a.signalStrength),!this.stateIsEmpty(o))for(const t of this.state.volumeIndicatorCallbacks[e])t(e,o.volume,o.muted,o.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 s.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),s=n(2330);class a{constructor(e){this.sdp=e}clone(){return new a(this.sdp)}static isRTPCandidate(e){const t=/candidate[:](\S+) (\d+)/g.exec(e);return null!==t&&"1"===t[2]}static linesToSDP(e){return new a(e.join(a.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:a.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()+a.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 a.splitLines(e).filter((e=>0===e.indexOf(t)))}lines(){return this.sdp.split(a.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 a.linesToSDP(this.lines().filter((t=>a.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,a.rfc7587LowestBitrate),a.rfc7587HighestBitrate));const t=this.lines(),n=a.findOpusFmtpAttributes(t),i=a.updateOpusFmtpAttributes(t,n,[`maxaveragebitrate=${e}`]);return a.linesToSDP(i)}withStereoAudio(){const e=this.lines(),t=a.findOpusFmtpAttributes(e),n=a.updateOpusFmtpAttributes(e,t,["stereo=1","sprop-stereo=1"]);return a.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,s=null;for(const a of e)if(a.startsWith("m=audio")&&(s=t[r],r++),a.startsWith("m=video")&&(s=null),s&&a.startsWith(s)){const e=a.slice(s.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(s+t.join(";"))}else i.push(a);return i}withUnifiedPlanFormat(){let e=this.sdp;return e.includes("mozilla")?this.clone():(e=e.replace("o=-","o=mozilla-chrome"),new a(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(a.splitLines(this.sdp)):n,r=a.splitSections(this.sdp),s=[];for(let e of r){if(/^m=video/.test(e)&&-1===a.getRtpHeaderExtensionIdInSection(e,t)){const n=a.splitLines(e),r=[];if(-1===i||this.hasRtpHeaderExtensionId(i)){s.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(a.CRLF)+a.CRLF}else if(-1!==n&&/^m=video/.test(e)&&a.getRtpHeaderExtensionIdInSection(e,t)!==n){const i=a.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(a.CRLF)+a.CRLF}s.push(e)}const o=s.join("");return new a(o)}ssrcForVideoSendingSection(){const e=this.sdp,t=a.splitSections(e);if(t.length<2)return"";const n=a.findActiveCameraSection(t);if(-1===n)return"";const i=a.matchPrefix(t[n],"a=ssrc-group:FID ");if(i.length<1)return"";const r=a.extractSSRCsFromFIDGroupLine(i[0]),[s]=r.split(" ").map((e=>parseInt(e,10)));return s.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=a.splitSections(e),n=a.findActiveCameraSection(t);if(-1===n)return new a(this.sdp);const i=t[n],r=a.splitLines(i),s=[],o=new Map;r.forEach((e=>{if(/^a=rtpmap:/.test(e)){const t=/^a=rtpmap:([0-9]+)\s/.exec(e);t&&e.toLowerCase().includes("h264")&&s.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);o.has(n)?o.get(n).push(e):o.set(n,[e])}}}));const c=new Set;for(const e of s){c.add(e);const t=o.get(e);if(t)for(const e of t)c.add(e)}if(s.length>0){const e=r[0].split(" ");r[0]=e.filter((e=>!c.has(parseInt(e)))).join(" ")}const l=r.filter((e=>{if(!e.includes("rtpmap")&&!e.includes("rtcp-fb")&&!e.includes("fmtp"))return!0;for(const t of c)if(e.includes(t.toString()))return!1;return!0}));t[n]=l.join(a.CRLF)+a.CRLF;const u=t.join("");return new a(u)}mediaSections(){const e=a.splitSections(this.sdp);if(e.length<2)return[];const t=[];for(let n=1;n{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 s=!1;if(void 0!==r.codecCapability.sdpFmtpLine){for(const e of i)if(e.startsWith(`a=fmtp:${t[1]} ${r.codecCapability.sdpFmtpLine}`)){s=!0;break}}else s=!0;if(s){n.set(r.codecName,t[1]);break}}}));const r=new Set(n.values()),s=i[0].split(" ").filter((e=>!r.has(e))),o=Array.from(n.values()).sort(((e,i)=>t.findIndex((t=>n.get(t.codecName)===e))-t.findIndex((e=>n.get(e.codecName)===i))));return s.splice(3,0,...o.values()),i[0]=s.join(" "),i.join(a.CRLF)+a.CRLF}highestPriorityVideoSendCodec(){const e=this.sdp,t=a.splitSections(e),n=a.findActiveCameraSection(t);if(-1===n)return;const i=a.splitLines(t[n]),r=i[0].split(" ");if(r.length<4)return;const o=r[3];let c,l,u;for(const e of i){const t=/^a=rtpmap:([0-9]+)\s/.exec(e);if(null===t||t.length<2||t[1]!==o)continue;const n=e.split(" ")[1].split("/");if(!(void 0===n||n.length<2)){c=n[0],l=n[1];for(const e of i)if(e.startsWith(`a=fmtp:${o}`)){const t=e.split(" ");if(void 0===t||t.length<2)return;u=t[1]}break}}return void 0!==c?new s.default(c,{clockRate:parseInt(l),mimeType:`video/${c}`,sdpFmtpLine:u}):void 0}}t.default=a,a.CRLF="\r\n",a.rfc7587LowestBitrate=6e3,a.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 s="";try{s=i.inflateRaw(e,n)}catch(e){this.logger.error(`failed to decompress the string with error: [${e}]`)}return s}}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),s=n(9553),a=n(3013);t.default=class{constructor(e){this.logger=e,this.currentState=s.SessionStateControllerState.NotConnected,this.deferredAction=null,this.deferredWork=null}perform(e,t){const n=this.currentState;if(n===s.SessionStateControllerState.NotConnected&&e===i.SessionStateControllerAction.Connect)this.transition(s.SessionStateControllerState.Connecting,e);else if(n===s.SessionStateControllerState.Connecting&&e===i.SessionStateControllerAction.Fail)this.transition(s.SessionStateControllerState.Disconnecting,e);else if(n===s.SessionStateControllerState.Connecting&&e===i.SessionStateControllerAction.FinishConnecting)this.transition(s.SessionStateControllerState.Connected,e);else if(n===s.SessionStateControllerState.Connected&&e===i.SessionStateControllerAction.Disconnect)this.transition(s.SessionStateControllerState.Disconnecting,e);else if(n===s.SessionStateControllerState.Connected&&e===i.SessionStateControllerAction.Reconnect)this.transition(s.SessionStateControllerState.Connecting,e);else if(n===s.SessionStateControllerState.Connected&&e===i.SessionStateControllerAction.Fail)this.transition(s.SessionStateControllerState.Disconnecting,e);else if(n===s.SessionStateControllerState.Connected&&e===i.SessionStateControllerAction.Update)this.transition(s.SessionStateControllerState.Updating,e);else if(n===s.SessionStateControllerState.Updating&&e===i.SessionStateControllerAction.Fail)this.transition(s.SessionStateControllerState.Disconnecting,e);else if(n===s.SessionStateControllerState.Updating&&e===i.SessionStateControllerAction.FinishUpdating)this.transition(s.SessionStateControllerState.Connected,e);else{if(n!==s.SessionStateControllerState.Disconnecting||e!==i.SessionStateControllerAction.FinishDisconnecting)return this.canDefer(e)?(this.logger.info(`deferring transition from ${s.SessionStateControllerState[this.currentState]} with ${i.SessionStateControllerAction[e]}`),this.deferAction(e,t),a.SessionStateControllerTransitionResult.DeferredTransition):(this.logger.warn(`no transition found from ${s.SessionStateControllerState[this.currentState]} with ${i.SessionStateControllerAction[e]}`),a.SessionStateControllerTransitionResult.NoTransitionAvailable);this.transition(s.SessionStateControllerState.NotConnected,e)}try{t()}catch(t){return this.logger.error(`error during state ${s.SessionStateControllerState[this.currentState]} with action ${i.SessionStateControllerAction[e]}: ${t}`),this.logger.info(`rolling back transition to ${s.SessionStateControllerState[n]}`),this.currentState=n,a.SessionStateControllerTransitionResult.TransitionFailed}return this.performDeferredAction(),a.SessionStateControllerTransitionResult.Transitioned}state(){return this.currentState}transition(e,t){this.logger.info(`transitioning from ${s.SessionStateControllerState[this.currentState]} to ${s.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===s.SessionStateControllerState.Connecting||this.currentState===s.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)!==a.SessionStateControllerTransitionResult.Transitioned&&this.logger.info(`unable to perform deferred action ${i.SessionStateControllerAction[e]} in state ${s.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),s=n(289),a=n(4046),o=n(7387),c=n(7103),l=n(2902),u=n(9416);class d{constructor(e,t){this.webSocket=e,this.logger=t,this.unloadHandler=null,this.closeEventHandler=e=>{this.deactivatePageUnloadHandler(),this.resetConnection(),this.sendEvent(new l.default(this,u.default.WebSocketClosed,null,e.code,e.reason)),this.serviceConnectionRequestQueue()},this.observerQueue=new Set,this.connectionRequestQueue=[],this.resetConnection(),this.logger.debug((()=>"signaling client init")),this.audioSessionId=this.generateNewAudioSessionId()}registerObserver(e){this.logger.debug((()=>"registering signaling client observer")),this.observerQueue.add(e)}removeObserver(e){this.logger.debug((()=>"removing signaling client observer")),this.observerQueue.delete(e)}openConnection(e){this.logger.info("adding connection request to queue: "+e.url()),this.connectionRequestQueue.push(e),this.closeConnection()}pingPong(e){this.logger.debug((()=>"sending ping"));const t=s.SdkSignalFrame.create();return t.type=s.SdkSignalFrame.Type.PING_PONG,t.pingPong=e,this.sendMessage(t),t.timestampMs}join(e){this.logger.info("sending join");const t=s.SdkJoinFrame.create();t.protocolVersion=2,t.flags=s.SdkJoinFlags.HAS_STREAM_UPDATE;const n=new i.default,r={platformName:n.name(),platformVersion:n.version(),clientSource:a.default.sdkName,chimeSdkVersion:a.default.sdkVersion};if(e.applicationMetadata){const{appName:t,appVersion:n}=e.applicationMetadata;r.appName=t,r.appVersion=n}t.clientDetails=s.SdkClientDetails.create(r),t.audioSessionId=this.audioSessionId,t.wantsCompressedSdp=d.CLIENT_SUPPORTS_COMPRESSION,t.serverSideNetworkAdaption=c.convertServerSideNetworkAdaptionEnumToSignaled(e.serverSideNetworkAdaption),e.serverSideNetworkAdaption===c.default.BandwidthProbing&&(t.wantsServerSideNetworkProbingOnReceiveSideEstimator=!0),t.supportedServerSideNetworkAdaptions=e.supportedServerSideNetworkAdaptions.map(c.convertServerSideNetworkAdaptionEnumToSignaled);const o=s.SdkSignalFrame.create();o.type=s.SdkSignalFrame.Type.JOIN,o.join=t,this.sendMessage(o)}subscribe(e){const t=s.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=s.SdkStreamDescriptor.create();n.mediaType=s.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=s.SdkStreamServiceType.RX,e.localVideoEnabled){t.duplex=s.SdkStreamServiceType.DUPLEX;for(let n=0;n0&&(t.videoSubscriptionConfiguration=e.videoSubscriptionConfiguration.map(this.convertVideoSubscriptionConfiguration));const n=s.SdkSignalFrame.create();n.type=s.SdkSignalFrame.Type.SUBSCRIBE,n.sub=t,this.sendMessage(n)}remoteVideoUpdate(e,t){const n=s.SdkRemoteVideoUpdateFrame.create();n.addedOrUpdatedVideoSubscriptions=e.map(this.convertVideoSubscriptionConfiguration),n.removedVideoSubscriptionMids=t;const i=s.SdkSignalFrame.create();i.type=s.SdkSignalFrame.Type.REMOTE_VIDEO_UPDATE,i.remoteVideoUpdate=n,this.sendMessage(i)}convertVideoSubscriptionConfiguration(e){const t=new s.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=s.SdkSignalFrame.create();e.type=s.SdkSignalFrame.Type.LEAVE,e.leave=s.SdkLeaveFrame.create(),this.sendMessage(e),this.logger.debug((()=>"sent leave"))}sendClientMetrics(e){const t=s.SdkSignalFrame.create();t.type=s.SdkSignalFrame.Type.CLIENT_METRIC,t.clientMetric=e,this.sendMessage(t)}sendDataMessage(e){const t=s.SdkSignalFrame.create();t.type=s.SdkSignalFrame.Type.DATA_MESSAGE,t.dataMessage=e,this.sendMessage(t)}closeConnection(){var e,t;if(this.webSocket.readyState()!==o.default.None&&this.webSocket.readyState()!==o.default.Closed){this.isClosing=!0,this.sendEvent(new l.default(this,u.default.WebSocketClosing,null));const n=new r.default(d.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()===o.default.Open&&!this.isClosing&&this.wasOpened}mute(e){const t=s.SdkSignalFrame.create();t.type=s.SdkSignalFrame.Type.AUDIO_CONTROL;const n=s.SdkAudioControlFrame.create();n.muted=e,t.audioControl=n,this.sendMessage(t)}pause(e){const t=s.SdkSignalFrame.create();t.type=s.SdkSignalFrame.Type.PAUSE,t.pause=s.SdkPauseResumeFrame.create(),t.pause.streamIds=e,this.sendMessage(t)}resume(e){const t=s.SdkSignalFrame.create();t.type=s.SdkSignalFrame.Type.RESUME,t.pause=s.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(s.SdkSignalFrame.encode(e).finish());if(this.ready()){if(!this.webSocket.send(t))return void this.sendEvent(new l.default(this,u.default.WebSocketSendMessageFailure,null));this.sendEvent(new l.default(this,u.default.WebSocketSentMessage,null))}else this.sendEvent(new l.default(this,u.default.WebSocketSkippedMessage,null))}receiveMessage(e){let t;try{t=s.SdkSignalFrame.decode(e)}catch(t){return this.logger.info(`failed to decode: ${e}`),void this.sendEvent(new l.default(this,u.default.ProtocolDecodeFailure,null))}this.logger.debug((()=>`received: ${JSON.stringify(t)}`)),this.webSocket.readyState()===o.default.Open?this.sendEvent(new l.default(this,u.default.ReceivedSignalFrame,t)):this.logger.info(`skipping notification of message since WebSocket is not open: ${JSON.stringify(t)}`)}stripFrameTypeRTC(e){const t=e[0];return t!==d.FRAME_TYPE_RTC&&2!==t&&this.logger.warn(`expected FrameTypeRTC for message but got ${t}`),e.slice(1)}prependWithFrameTypeRTC(e){const t=new Uint8Array(e.length+1);return t[0]=d.FRAME_TYPE_RTC,t.set(e,1),t}serviceConnectionRequestQueue(){if(0===this.connectionRequestQueue.length)return void this.logger.info("no connection requests to service");const e=this.connectionRequestQueue.shift();this.logger.info(`opening connection to ${e.url()}`),this.isClosing=!1,this.webSocket.create(e.url(),e.protocols()),this.setUpEventListeners(),this.sendEvent(new l.default(this,u.default.WebSocketConnecting,null))}sendEvent(e){switch(e.type){case u.default.WebSocketMessage:case u.default.ReceivedSignalFrame:case u.default.WebSocketSentMessage:this.logger.debug((()=>`notifying event: ${u.default[e.type]}`));break;case u.default.WebSocketSkippedMessage:this.logger.debug((()=>`notifying event: ${u.default[e.type]}, websocket state=${o.default[this.webSocket.readyState()]}`));break;default:this.logger.info(`notifying event: ${u.default[e.type]}`)}for(const t of this.observerQueue)t.handleSignalingClientEvent(e)}setUpEventListeners(){this.webSocket.addEventListener("open",(()=>{this.activatePageUnloadHandler(),this.wasOpened=!0,this.sendEvent(new l.default(this,u.default.WebSocketOpen,null))})),this.webSocket.addEventListener("message",(e=>{this.sendEvent(new l.default(this,u.default.WebSocketMessage,null)),this.receiveMessage(this.stripFrameTypeRTC(new Uint8Array(e.data)))})),this.webSocket.addEventListener("close",this.closeEventHandler),this.webSocket.addEventListener("error",(()=>{!this.isClosing||this.wasOpened?this.wasOpened?(this.logger.error("received error while connected"),this.sendEvent(new l.default(this,u.default.WebSocketError,null))):(this.logger.error("failed to connect"),this.sendEvent(new l.default(this,u.default.WebSocketFailed,null))):this.logger.info("ignoring error closing signaling while connecting")}))}activatePageUnloadHandler(){this.unloadHandler=()=>{this.leave()};const e=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=s.SdkMeetingSessionCredentials.create();t.attendeeId=e.attendeeId,t.externalUserId=e.externalUserId,t.joinToken=e.joinToken;const n=s.SdkPrimaryMeetingJoinFrame.create();n.credentials=t;const i=s.SdkSignalFrame.create();i.type=s.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN,i.primaryMeetingJoin=n,this.sendMessage(i)}demoteFromPrimaryMeeting(){const e=s.SdkPrimaryMeetingLeaveFrame.create(),t=s.SdkSignalFrame.create();t.type=s.SdkSignalFrame.Type.PRIMARY_MEETING_LEAVE,t.primaryMeetingLeave=e,this.sendMessage(t)}}t.default=d,d.FRAME_TYPE_RTC=5,d.CLOSE_EVENT_TIMEOUT_MS=2e3,d.CLIENT_SUPPORTS_COMPRESSION=!0},7103:(e,t,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,s,a,o,c,l){this.attendeeId=e,this.sdpOffer=t,this.audioHost=n,this.audioMuted=i,this.audioCheckin=r,this.receiveStreamIds=s,this.localVideoEnabled=a,this.videoStreamDescriptions=o,this.connectionTypeHasVideo=c,this.compressedSdpOffer=l,this.videoSubscriptionConfiguration=[]}}},9101:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{}},289:(e,t,n)=>{"use strict";var i,r,s=n(2100),a=s.Reader,o=s.Writer,c=s.util,l=s.roots.default||(s.roots.default={});l.SdkSignalFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>3){case 1:i.timestampMs=e.uint64();break;case 2:i.type=e.int32();break;case 3:i.error=l.SdkErrorFrame.decode(e,e.uint32());break;case 4:i.join=l.SdkJoinFrame.decode(e,e.uint32());break;case 5:i.joinack=l.SdkJoinAckFrame.decode(e,e.uint32());break;case 6:i.sub=l.SdkSubscribeFrame.decode(e,e.uint32());break;case 7:i.suback=l.SdkSubscribeAckFrame.decode(e,e.uint32());break;case 8:i.index=l.SdkIndexFrame.decode(e,e.uint32());break;case 10:i.pause=l.SdkPauseResumeFrame.decode(e,e.uint32());break;case 11:i.leave=l.SdkLeaveFrame.decode(e,e.uint32());break;case 12:i.leaveAck=l.SdkLeaveAckFrame.decode(e,e.uint32());break;case 14:i.bitrates=l.SdkBitrateFrame.decode(e,e.uint32());break;case 17:i.audioControl=l.SdkAudioControlFrame.decode(e,e.uint32());break;case 18:i.audioMetadata=l.SdkAudioMetadataFrame.decode(e,e.uint32());break;case 19:i.audioStreamIdInfo=l.SdkAudioStreamIdInfoFrame.decode(e,e.uint32());break;case 20:i.pingPong=l.SdkPingPongFrame.decode(e,e.uint32());break;case 21:i.audioStatus=l.SdkAudioStatusFrame.decode(e,e.uint32());break;case 22:i.clientMetric=l.SdkClientMetricFrame.decode(e,e.uint32());break;case 23:i.dataMessage=l.SdkDataMessageFrame.decode(e,e.uint32());break;case 25:i.remoteVideoUpdate=l.SdkRemoteVideoUpdateFrame.decode(e,e.uint32());break;case 26:i.primaryMeetingJoin=l.SdkPrimaryMeetingJoinFrame.decode(e,e.uint32());break;case 27:i.primaryMeetingJoinAck=l.SdkPrimaryMeetingJoinAckFrame.decode(e,e.uint32());break;case 28:i.primaryMeetingLeave=l.SdkPrimaryMeetingLeaveFrame.decode(e,e.uint32());break;default:e.skipType(7&r)}}if(!i.hasOwnProperty("timestampMs"))throw c.ProtocolError("missing required 'timestampMs'",{instance:i});if(!i.hasOwnProperty("type"))throw c.ProtocolError("missing required 'type'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(!(c.isInteger(e.timestampMs)||e.timestampMs&&c.isInteger(e.timestampMs.low)&&c.isInteger(e.timestampMs.high)))return"timestampMs: integer|Long expected";switch(e.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 7:case 8:case 9:case 10:case 13:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 24:case 25:case 26:case 27:}var t;return null!=e.error&&e.hasOwnProperty("error")&&(t=l.SdkErrorFrame.verify(e.error))?"error."+t:null!=e.join&&e.hasOwnProperty("join")&&(t=l.SdkJoinFrame.verify(e.join))?"join."+t:null!=e.joinack&&e.hasOwnProperty("joinack")&&(t=l.SdkJoinAckFrame.verify(e.joinack))?"joinack."+t:null!=e.sub&&e.hasOwnProperty("sub")&&(t=l.SdkSubscribeFrame.verify(e.sub))?"sub."+t:null!=e.suback&&e.hasOwnProperty("suback")&&(t=l.SdkSubscribeAckFrame.verify(e.suback))?"suback."+t:null!=e.index&&e.hasOwnProperty("index")&&(t=l.SdkIndexFrame.verify(e.index))?"index."+t:null!=e.pause&&e.hasOwnProperty("pause")&&(t=l.SdkPauseResumeFrame.verify(e.pause))?"pause."+t:null!=e.leave&&e.hasOwnProperty("leave")&&(t=l.SdkLeaveFrame.verify(e.leave))?"leave."+t:null!=e.leaveAck&&e.hasOwnProperty("leaveAck")&&(t=l.SdkLeaveAckFrame.verify(e.leaveAck))?"leaveAck."+t:null!=e.bitrates&&e.hasOwnProperty("bitrates")&&(t=l.SdkBitrateFrame.verify(e.bitrates))?"bitrates."+t:null!=e.audioControl&&e.hasOwnProperty("audioControl")&&(t=l.SdkAudioControlFrame.verify(e.audioControl))?"audioControl."+t:null!=e.audioMetadata&&e.hasOwnProperty("audioMetadata")&&(t=l.SdkAudioMetadataFrame.verify(e.audioMetadata))?"audioMetadata."+t:null!=e.audioStreamIdInfo&&e.hasOwnProperty("audioStreamIdInfo")&&(t=l.SdkAudioStreamIdInfoFrame.verify(e.audioStreamIdInfo))?"audioStreamIdInfo."+t:null!=e.pingPong&&e.hasOwnProperty("pingPong")&&(t=l.SdkPingPongFrame.verify(e.pingPong))?"pingPong."+t:null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&(t=l.SdkAudioStatusFrame.verify(e.audioStatus))?"audioStatus."+t:null!=e.clientMetric&&e.hasOwnProperty("clientMetric")&&(t=l.SdkClientMetricFrame.verify(e.clientMetric))?"clientMetric."+t:null!=e.dataMessage&&e.hasOwnProperty("dataMessage")&&(t=l.SdkDataMessageFrame.verify(e.dataMessage))?"dataMessage."+t:null!=e.remoteVideoUpdate&&e.hasOwnProperty("remoteVideoUpdate")&&(t=l.SdkRemoteVideoUpdateFrame.verify(e.remoteVideoUpdate))?"remoteVideoUpdate."+t:null!=e.primaryMeetingJoin&&e.hasOwnProperty("primaryMeetingJoin")&&(t=l.SdkPrimaryMeetingJoinFrame.verify(e.primaryMeetingJoin))?"primaryMeetingJoin."+t:null!=e.primaryMeetingJoinAck&&e.hasOwnProperty("primaryMeetingJoinAck")&&(t=l.SdkPrimaryMeetingJoinAckFrame.verify(e.primaryMeetingJoinAck))?"primaryMeetingJoinAck."+t:null!=e.primaryMeetingLeave&&e.hasOwnProperty("primaryMeetingLeave")&&(t=l.SdkPrimaryMeetingLeaveFrame.verify(e.primaryMeetingLeave))?"primaryMeetingLeave."+t:null},e.fromObject=function(e){if(e instanceof l.SdkSignalFrame)return e;var t=new l.SdkSignalFrame;switch(null!=e.timestampMs&&(c.Long?(t.timestampMs=c.Long.fromValue(e.timestampMs)).unsigned=!0:"string"==typeof e.timestampMs?t.timestampMs=parseInt(e.timestampMs,10):"number"==typeof e.timestampMs?t.timestampMs=e.timestampMs:"object"==typeof e.timestampMs&&(t.timestampMs=new c.LongBits(e.timestampMs.low>>>0,e.timestampMs.high>>>0).toNumber(!0))),e.type){case"JOIN":case 1:t.type=1;break;case"JOIN_ACK":case 2:t.type=2;break;case"SUBSCRIBE":case 3:t.type=3;break;case"SUBSCRIBE_ACK":case 4:t.type=4;break;case"INDEX":case 5:t.type=5;break;case"PAUSE":case 7:t.type=7;break;case"RESUME":case 8:t.type=8;break;case"LEAVE":case 9:t.type=9;break;case"LEAVE_ACK":case 10:t.type=10;break;case"BITRATES":case 13:t.type=13;break;case"AUDIO_CONTROL":case 16:t.type=16;break;case"AUDIO_METADATA":case 17:t.type=17;break;case"AUDIO_STREAM_ID_INFO":case 18:t.type=18;break;case"PING_PONG":case 19:t.type=19;break;case"AUDIO_STATUS":case 20:t.type=20;break;case"CLIENT_METRIC":case 21:t.type=21;break;case"DATA_MESSAGE":case 22:t.type=22;break;case"REMOTE_VIDEO_UPDATE":case 24:t.type=24;break;case"PRIMARY_MEETING_JOIN":case 25:t.type=25;break;case"PRIMARY_MEETING_JOIN_ACK":case 26:t.type=26;break;case"PRIMARY_MEETING_LEAVE":case 27:t.type=27}if(null!=e.error){if("object"!=typeof e.error)throw TypeError(".SdkSignalFrame.error: object expected");t.error=l.SdkErrorFrame.fromObject(e.error)}if(null!=e.join){if("object"!=typeof e.join)throw TypeError(".SdkSignalFrame.join: object expected");t.join=l.SdkJoinFrame.fromObject(e.join)}if(null!=e.joinack){if("object"!=typeof e.joinack)throw TypeError(".SdkSignalFrame.joinack: object expected");t.joinack=l.SdkJoinAckFrame.fromObject(e.joinack)}if(null!=e.sub){if("object"!=typeof e.sub)throw TypeError(".SdkSignalFrame.sub: object expected");t.sub=l.SdkSubscribeFrame.fromObject(e.sub)}if(null!=e.suback){if("object"!=typeof e.suback)throw TypeError(".SdkSignalFrame.suback: object expected");t.suback=l.SdkSubscribeAckFrame.fromObject(e.suback)}if(null!=e.index){if("object"!=typeof e.index)throw TypeError(".SdkSignalFrame.index: object expected");t.index=l.SdkIndexFrame.fromObject(e.index)}if(null!=e.pause){if("object"!=typeof e.pause)throw TypeError(".SdkSignalFrame.pause: object expected");t.pause=l.SdkPauseResumeFrame.fromObject(e.pause)}if(null!=e.leave){if("object"!=typeof e.leave)throw TypeError(".SdkSignalFrame.leave: object expected");t.leave=l.SdkLeaveFrame.fromObject(e.leave)}if(null!=e.leaveAck){if("object"!=typeof e.leaveAck)throw TypeError(".SdkSignalFrame.leaveAck: object expected");t.leaveAck=l.SdkLeaveAckFrame.fromObject(e.leaveAck)}if(null!=e.bitrates){if("object"!=typeof e.bitrates)throw TypeError(".SdkSignalFrame.bitrates: object expected");t.bitrates=l.SdkBitrateFrame.fromObject(e.bitrates)}if(null!=e.audioControl){if("object"!=typeof e.audioControl)throw TypeError(".SdkSignalFrame.audioControl: object expected");t.audioControl=l.SdkAudioControlFrame.fromObject(e.audioControl)}if(null!=e.audioMetadata){if("object"!=typeof e.audioMetadata)throw TypeError(".SdkSignalFrame.audioMetadata: object expected");t.audioMetadata=l.SdkAudioMetadataFrame.fromObject(e.audioMetadata)}if(null!=e.audioStreamIdInfo){if("object"!=typeof e.audioStreamIdInfo)throw TypeError(".SdkSignalFrame.audioStreamIdInfo: object expected");t.audioStreamIdInfo=l.SdkAudioStreamIdInfoFrame.fromObject(e.audioStreamIdInfo)}if(null!=e.pingPong){if("object"!=typeof e.pingPong)throw TypeError(".SdkSignalFrame.pingPong: object expected");t.pingPong=l.SdkPingPongFrame.fromObject(e.pingPong)}if(null!=e.audioStatus){if("object"!=typeof e.audioStatus)throw TypeError(".SdkSignalFrame.audioStatus: object expected");t.audioStatus=l.SdkAudioStatusFrame.fromObject(e.audioStatus)}if(null!=e.clientMetric){if("object"!=typeof e.clientMetric)throw TypeError(".SdkSignalFrame.clientMetric: object expected");t.clientMetric=l.SdkClientMetricFrame.fromObject(e.clientMetric)}if(null!=e.dataMessage){if("object"!=typeof e.dataMessage)throw TypeError(".SdkSignalFrame.dataMessage: object expected");t.dataMessage=l.SdkDataMessageFrame.fromObject(e.dataMessage)}if(null!=e.remoteVideoUpdate){if("object"!=typeof e.remoteVideoUpdate)throw TypeError(".SdkSignalFrame.remoteVideoUpdate: object expected");t.remoteVideoUpdate=l.SdkRemoteVideoUpdateFrame.fromObject(e.remoteVideoUpdate)}if(null!=e.primaryMeetingJoin){if("object"!=typeof e.primaryMeetingJoin)throw TypeError(".SdkSignalFrame.primaryMeetingJoin: object expected");t.primaryMeetingJoin=l.SdkPrimaryMeetingJoinFrame.fromObject(e.primaryMeetingJoin)}if(null!=e.primaryMeetingJoinAck){if("object"!=typeof e.primaryMeetingJoinAck)throw TypeError(".SdkSignalFrame.primaryMeetingJoinAck: object expected");t.primaryMeetingJoinAck=l.SdkPrimaryMeetingJoinAckFrame.fromObject(e.primaryMeetingJoinAck)}if(null!=e.primaryMeetingLeave){if("object"!=typeof e.primaryMeetingLeave)throw TypeError(".SdkSignalFrame.primaryMeetingLeave: object expected");t.primaryMeetingLeave=l.SdkPrimaryMeetingLeaveFrame.fromObject(e.primaryMeetingLeave)}return t},e.toObject=function(e,t){t||(t={});var n={};if(t.defaults){if(c.Long){var i=new c.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?c.Long.prototype.toString.call(e.timestampMs):t.longs===Number?new c.LongBits(e.timestampMs.low>>>0,e.timestampMs.high>>>0).toNumber(!0):e.timestampMs),null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?l.SdkSignalFrame.Type[e.type]:e.type),null!=e.error&&e.hasOwnProperty("error")&&(n.error=l.SdkErrorFrame.toObject(e.error,t)),null!=e.join&&e.hasOwnProperty("join")&&(n.join=l.SdkJoinFrame.toObject(e.join,t)),null!=e.joinack&&e.hasOwnProperty("joinack")&&(n.joinack=l.SdkJoinAckFrame.toObject(e.joinack,t)),null!=e.sub&&e.hasOwnProperty("sub")&&(n.sub=l.SdkSubscribeFrame.toObject(e.sub,t)),null!=e.suback&&e.hasOwnProperty("suback")&&(n.suback=l.SdkSubscribeAckFrame.toObject(e.suback,t)),null!=e.index&&e.hasOwnProperty("index")&&(n.index=l.SdkIndexFrame.toObject(e.index,t)),null!=e.pause&&e.hasOwnProperty("pause")&&(n.pause=l.SdkPauseResumeFrame.toObject(e.pause,t)),null!=e.leave&&e.hasOwnProperty("leave")&&(n.leave=l.SdkLeaveFrame.toObject(e.leave,t)),null!=e.leaveAck&&e.hasOwnProperty("leaveAck")&&(n.leaveAck=l.SdkLeaveAckFrame.toObject(e.leaveAck,t)),null!=e.bitrates&&e.hasOwnProperty("bitrates")&&(n.bitrates=l.SdkBitrateFrame.toObject(e.bitrates,t)),null!=e.audioControl&&e.hasOwnProperty("audioControl")&&(n.audioControl=l.SdkAudioControlFrame.toObject(e.audioControl,t)),null!=e.audioMetadata&&e.hasOwnProperty("audioMetadata")&&(n.audioMetadata=l.SdkAudioMetadataFrame.toObject(e.audioMetadata,t)),null!=e.audioStreamIdInfo&&e.hasOwnProperty("audioStreamIdInfo")&&(n.audioStreamIdInfo=l.SdkAudioStreamIdInfoFrame.toObject(e.audioStreamIdInfo,t)),null!=e.pingPong&&e.hasOwnProperty("pingPong")&&(n.pingPong=l.SdkPingPongFrame.toObject(e.pingPong,t)),null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&(n.audioStatus=l.SdkAudioStatusFrame.toObject(e.audioStatus,t)),null!=e.clientMetric&&e.hasOwnProperty("clientMetric")&&(n.clientMetric=l.SdkClientMetricFrame.toObject(e.clientMetric,t)),null!=e.dataMessage&&e.hasOwnProperty("dataMessage")&&(n.dataMessage=l.SdkDataMessageFrame.toObject(e.dataMessage,t)),null!=e.remoteVideoUpdate&&e.hasOwnProperty("remoteVideoUpdate")&&(n.remoteVideoUpdate=l.SdkRemoteVideoUpdateFrame.toObject(e.remoteVideoUpdate,t)),null!=e.primaryMeetingJoin&&e.hasOwnProperty("primaryMeetingJoin")&&(n.primaryMeetingJoin=l.SdkPrimaryMeetingJoinFrame.toObject(e.primaryMeetingJoin,t)),null!=e.primaryMeetingJoinAck&&e.hasOwnProperty("primaryMeetingJoinAck")&&(n.primaryMeetingJoinAck=l.SdkPrimaryMeetingJoinAckFrame.toObject(e.primaryMeetingJoinAck,t)),null!=e.primaryMeetingLeave&&e.hasOwnProperty("primaryMeetingLeave")&&(n.primaryMeetingLeave=l.SdkPrimaryMeetingLeaveFrame.toObject(e.primaryMeetingLeave,t)),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.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}(),l.SdkErrorFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.status&&e.hasOwnProperty("status")&&!c.isInteger(e.status)?"status: integer expected":null!=e.description&&e.hasOwnProperty("description")&&!c.isString(e.description)?"description: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkErrorFrame)return e;var t=new l.SdkErrorFrame;return null!=e.status&&(t.status=e.status>>>0),null!=e.description&&(t.description=String(e.description)),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.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),l.SdkClientDetails=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.appName&&e.hasOwnProperty("appName")&&!c.isString(e.appName)?"appName: string expected":null!=e.appVersion&&e.hasOwnProperty("appVersion")&&!c.isString(e.appVersion)?"appVersion: string expected":null!=e.deviceModel&&e.hasOwnProperty("deviceModel")&&!c.isString(e.deviceModel)?"deviceModel: string expected":null!=e.deviceMake&&e.hasOwnProperty("deviceMake")&&!c.isString(e.deviceMake)?"deviceMake: string expected":null!=e.platformName&&e.hasOwnProperty("platformName")&&!c.isString(e.platformName)?"platformName: string expected":null!=e.platformVersion&&e.hasOwnProperty("platformVersion")&&!c.isString(e.platformVersion)?"platformVersion: string expected":null!=e.clientSource&&e.hasOwnProperty("clientSource")&&!c.isString(e.clientSource)?"clientSource: string expected":null!=e.chimeSdkVersion&&e.hasOwnProperty("chimeSdkVersion")&&!c.isString(e.chimeSdkVersion)?"chimeSdkVersion: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkClientDetails)return e;var t=new l.SdkClientDetails;return null!=e.appName&&(t.appName=String(e.appName)),null!=e.appVersion&&(t.appVersion=String(e.appVersion)),null!=e.deviceModel&&(t.deviceModel=String(e.deviceModel)),null!=e.deviceMake&&(t.deviceMake=String(e.deviceMake)),null!=e.platformName&&(t.platformName=String(e.platformName)),null!=e.platformVersion&&(t.platformVersion=String(e.platformVersion)),null!=e.clientSource&&(t.clientSource=String(e.clientSource)),null!=e.chimeSdkVersion&&(t.chimeSdkVersion=String(e.chimeSdkVersion)),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.SdkServerSideNetworkAdaption=function(){var e={},t=Object.create(e);return t[e[1]="DEFAULT"]=1,t[e[2]="NONE"]=2,t[e[3]="BANDWIDTH_PROBING"]=3,t}(),l.SdkJoinFrame=function(){function e(e){if(this.supportedServerSideNetworkAdaptions=[],e)for(var t=Object.keys(e),n=0;n>>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=l.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 s=e.uint32()+e.pos;e.pos>>0),null!=e.maxNumOfVideos&&(t.maxNumOfVideos=e.maxNumOfVideos>>>0),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.clientDetails){if("object"!=typeof e.clientDetails)throw TypeError(".SdkJoinFrame.clientDetails: object expected");t.clientDetails=l.SdkClientDetails.fromObject(e.clientDetails)}switch(null!=e.audioSessionId&&(c.Long?(t.audioSessionId=c.Long.fromValue(e.audioSessionId)).unsigned=!0:"string"==typeof e.audioSessionId?t.audioSessionId=parseInt(e.audioSessionId,10):"number"==typeof e.audioSessionId?t.audioSessionId=e.audioSessionId:"object"==typeof e.audioSessionId&&(t.audioSessionId=new c.LongBits(e.audioSessionId.low>>>0,e.audioSessionId.high>>>0).toNumber(!0))),null!=e.wantsCompressedSdp&&(t.wantsCompressedSdp=Boolean(e.wantsCompressedSdp)),null!=e.wantsServerSideNetworkProbingOnReceiveSideEstimator&&(t.wantsServerSideNetworkProbingOnReceiveSideEstimator=Boolean(e.wantsServerSideNetworkProbingOnReceiveSideEstimator)),e.serverSideNetworkAdaption){case"DEFAULT":case 1:t.serverSideNetworkAdaption=1;break;case"NONE":case 2:t.serverSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:t.serverSideNetworkAdaption=3}if(e.supportedServerSideNetworkAdaptions){if(!Array.isArray(e.supportedServerSideNetworkAdaptions))throw TypeError(".SdkJoinFrame.supportedServerSideNetworkAdaptions: array expected");t.supportedServerSideNetworkAdaptions=[];for(var n=0;n>>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?l.SdkServerSideNetworkAdaption[e.serverSideNetworkAdaption]:e.serverSideNetworkAdaption),e.supportedServerSideNetworkAdaptions&&e.supportedServerSideNetworkAdaptions.length){n.supportedServerSideNetworkAdaptions=[];for(var r=0;r>>3){case 1:i.turnCredentials=l.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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.turnCredentials&&e.hasOwnProperty("turnCredentials")){var t=l.SdkTurnCredentials.verify(e.turnCredentials);if(t)return"turnCredentials."+t}if(null!=e.videoSubscriptionLimit&&e.hasOwnProperty("videoSubscriptionLimit")&&!c.isInteger(e.videoSubscriptionLimit))return"videoSubscriptionLimit: integer expected";if(null!=e.wantsCompressedSdp&&e.hasOwnProperty("wantsCompressedSdp")&&"boolean"!=typeof e.wantsCompressedSdp)return"wantsCompressedSdp: boolean expected";if(null!=e.defaultServerSideNetworkAdaption&&e.hasOwnProperty("defaultServerSideNetworkAdaption"))switch(e.defaultServerSideNetworkAdaption){default:return"defaultServerSideNetworkAdaption: enum value expected";case 1:case 2:case 3:}return null},e.fromObject=function(e){if(e instanceof l.SdkJoinAckFrame)return e;var t=new l.SdkJoinAckFrame;if(null!=e.turnCredentials){if("object"!=typeof e.turnCredentials)throw TypeError(".SdkJoinAckFrame.turnCredentials: object expected");t.turnCredentials=l.SdkTurnCredentials.fromObject(e.turnCredentials)}switch(null!=e.videoSubscriptionLimit&&(t.videoSubscriptionLimit=e.videoSubscriptionLimit>>>0),null!=e.wantsCompressedSdp&&(t.wantsCompressedSdp=Boolean(e.wantsCompressedSdp)),e.defaultServerSideNetworkAdaption){case"DEFAULT":case 1:t.defaultServerSideNetworkAdaption=1;break;case"NONE":case 2:t.defaultServerSideNetworkAdaption=2;break;case"BANDWIDTH_PROBING":case 3:t.defaultServerSideNetworkAdaption=3}return t},e.toObject=function(e,t){t||(t={});var 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=l.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?l.SdkServerSideNetworkAdaption[e.defaultServerSideNetworkAdaption]:e.defaultServerSideNetworkAdaption),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),l.SdkLeaveFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>3){case 1:i.duplex=e.int32();break;case 2:i.sendStreams&&i.sendStreams.length||(i.sendStreams=[]),i.sendStreams.push(l.SdkStreamDescriptor.decode(e,e.uint32()));break;case 3:if(i.receiveStreamIds&&i.receiveStreamIds.length||(i.receiveStreamIds=[]),2==(7&r))for(var s=e.uint32()+e.pos;e.pos>>0}if(null!=e.sdpOffer&&(t.sdpOffer=String(e.sdpOffer)),null!=e.audioHost&&(t.audioHost=String(e.audioHost)),null!=e.audioCheckin&&(t.audioCheckin=Boolean(e.audioCheckin)),null!=e.audioMuted&&(t.audioMuted=Boolean(e.audioMuted)),null!=e.compressedSdpOffer&&("string"==typeof e.compressedSdpOffer?c.base64.decode(e.compressedSdpOffer,t.compressedSdpOffer=c.newBuffer(c.base64.length(e.compressedSdpOffer)),0):e.compressedSdpOffer.length&&(t.compressedSdpOffer=e.compressedSdpOffer)),e.videoSubscriptionConfiguration){if(!Array.isArray(e.videoSubscriptionConfiguration))throw TypeError(".SdkSubscribeFrame.videoSubscriptionConfiguration: array expected");for(t.videoSubscriptionConfiguration=[],n=0;n>>3){case 1:i.duplex=e.int32();break;case 2:i.allocations&&i.allocations.length||(i.allocations=[]),i.allocations.push(l.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(l.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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.duplex&&e.hasOwnProperty("duplex"))switch(e.duplex){default:return"duplex: enum value expected";case 1:case 2:case 3:}if(null!=e.allocations&&e.hasOwnProperty("allocations")){if(!Array.isArray(e.allocations))return"allocations: array expected";for(var t=0;t>>3){case 1:i.atCapacity=e.bool();break;case 2:i.sources&&i.sources.length||(i.sources=[]),i.sources.push(l.SdkStreamDescriptor.decode(e,e.uint32()));break;case 3:if(i.pausedAtSourceIds&&i.pausedAtSourceIds.length||(i.pausedAtSourceIds=[]),2==(7&r))for(var s=e.uint32()+e.pos;e.pos>>0}if(null!=e.numParticipants&&(t.numParticipants=e.numParticipants>>>0),e.supportedReceiveCodecIntersection){if(!Array.isArray(e.supportedReceiveCodecIntersection))throw TypeError(".SdkIndexFrame.supportedReceiveCodecIntersection: array expected");for(t.supportedReceiveCodecIntersection=[],n=0;n>>3){case 1:if(i.streamIds&&i.streamIds.length||(i.streamIds=[]),2==(7&r))for(var s=e.uint32()+e.pos;e.pos>>0}if(e.groupIds){if(!Array.isArray(e.groupIds))throw TypeError(".SdkPauseResumeFrame.groupIds: array expected");for(t.groupIds=[],n=0;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>>3==1?(i.bitrates&&i.bitrates.length||(i.bitrates=[]),i.bitrates.push(l.SdkBitrate.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.bitrates&&e.hasOwnProperty("bitrates")){if(!Array.isArray(e.bitrates))return"bitrates: array expected";for(var t=0;t>>3){case 1: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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.streamId&&e.hasOwnProperty("streamId")&&!c.isInteger(e.streamId))return"streamId: integer expected";if(null!=e.framerate&&e.hasOwnProperty("framerate")&&!c.isInteger(e.framerate))return"framerate: integer expected";if(null!=e.maxBitrateKbps&&e.hasOwnProperty("maxBitrateKbps")&&!c.isInteger(e.maxBitrateKbps))return"maxBitrateKbps: integer expected";if(null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!c.isString(e.trackLabel))return"trackLabel: string expected";if(null!=e.groupId&&e.hasOwnProperty("groupId")&&!c.isInteger(e.groupId))return"groupId: integer expected";if(null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&!c.isInteger(e.avgBitrateBps))return"avgBitrateBps: integer expected";if(null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!c.isString(e.attendeeId))return"attendeeId: string expected";if(null!=e.mediaType&&e.hasOwnProperty("mediaType"))switch(e.mediaType){default:return"mediaType: enum value expected";case 1:case 2:}return null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&!c.isString(e.externalUserId)?"externalUserId: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkStreamDescriptor)return e;var t=new l.SdkStreamDescriptor;switch(null!=e.streamId&&(t.streamId=e.streamId>>>0),null!=e.framerate&&(t.framerate=e.framerate>>>0),null!=e.maxBitrateKbps&&(t.maxBitrateKbps=e.maxBitrateKbps>>>0),null!=e.trackLabel&&(t.trackLabel=String(e.trackLabel)),null!=e.groupId&&(t.groupId=e.groupId>>>0),null!=e.avgBitrateBps&&(t.avgBitrateBps=e.avgBitrateBps>>>0),null!=e.attendeeId&&(t.attendeeId=String(e.attendeeId)),e.mediaType){case"AUDIO":case 1:t.mediaType=1;break;case"VIDEO":case 2:t.mediaType=2}return null!=e.externalUserId&&(t.externalUserId=String(e.externalUserId)),t},e.toObject=function(e,t){t||(t={});var 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?l.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,s.util.toJSONOptions)},e}(),l.SdkStreamAllocation=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!c.isString(e.trackLabel)?"trackLabel: string expected":null!=e.streamId&&e.hasOwnProperty("streamId")&&!c.isInteger(e.streamId)?"streamId: integer expected":null!=e.groupId&&e.hasOwnProperty("groupId")&&!c.isInteger(e.groupId)?"groupId: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkStreamAllocation)return e;var t=new l.SdkStreamAllocation;return null!=e.trackLabel&&(t.trackLabel=String(e.trackLabel)),null!=e.streamId&&(t.streamId=e.streamId>>>0),null!=e.groupId&&(t.groupId=e.groupId>>>0),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.SdkTrackMapping=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.streamId&&e.hasOwnProperty("streamId")&&!c.isInteger(e.streamId)?"streamId: integer expected":null!=e.ssrc&&e.hasOwnProperty("ssrc")&&!c.isInteger(e.ssrc)?"ssrc: integer expected":null!=e.trackLabel&&e.hasOwnProperty("trackLabel")&&!c.isString(e.trackLabel)?"trackLabel: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkTrackMapping)return e;var t=new l.SdkTrackMapping;return null!=e.streamId&&(t.streamId=e.streamId>>>0),null!=e.ssrc&&(t.ssrc=e.ssrc>>>0),null!=e.trackLabel&&(t.trackLabel=String(e.trackLabel)),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.SdkBitrate=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.sourceStreamId&&e.hasOwnProperty("sourceStreamId")&&!c.isInteger(e.sourceStreamId)?"sourceStreamId: integer expected":null!=e.avgBitrateBps&&e.hasOwnProperty("avgBitrateBps")&&!c.isInteger(e.avgBitrateBps)?"avgBitrateBps: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkBitrate)return e;var t=new l.SdkBitrate;return null!=e.sourceStreamId&&(t.sourceStreamId=e.sourceStreamId>>>0),null!=e.avgBitrateBps&&(t.avgBitrateBps=e.avgBitrateBps>>>0),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.SdkAudioControlFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>3==1?i.muted=e.bool():e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.muted&&e.hasOwnProperty("muted")&&"boolean"!=typeof e.muted?"muted: boolean expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioControlFrame)return e;var t=new l.SdkAudioControlFrame;return null!=e.muted&&(t.muted=Boolean(e.muted)),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.SdkAudioMetadataFrame=function(){function e(e){if(this.attendeeStates=[],e)for(var t=Object.keys(e),n=0;n>>3==1?(i.attendeeStates&&i.attendeeStates.length||(i.attendeeStates=[]),i.attendeeStates.push(l.SdkAudioAttendeeState.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attendeeStates&&e.hasOwnProperty("attendeeStates")){if(!Array.isArray(e.attendeeStates))return"attendeeStates: array expected";for(var t=0;t>>3){case 1: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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&!c.isInteger(e.audioStreamId)?"audioStreamId: integer expected":null!=e.volume&&e.hasOwnProperty("volume")&&!c.isInteger(e.volume)?"volume: integer expected":null!=e.muted&&e.hasOwnProperty("muted")&&"boolean"!=typeof e.muted?"muted: boolean expected":null!=e.signalStrength&&e.hasOwnProperty("signalStrength")&&!c.isInteger(e.signalStrength)?"signalStrength: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioAttendeeState)return e;var t=new l.SdkAudioAttendeeState;return null!=e.audioStreamId&&(t.audioStreamId=e.audioStreamId>>>0),null!=e.volume&&(t.volume=e.volume>>>0),null!=e.muted&&(t.muted=Boolean(e.muted)),null!=e.signalStrength&&(t.signalStrength=e.signalStrength>>>0),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.SdkAudioStreamIdInfoFrame=function(){function e(e){if(this.streams=[],e)for(var t=Object.keys(e),n=0;n>>3==1?(i.streams&&i.streams.length||(i.streams=[]),i.streams.push(l.SdkAudioStreamIdInfo.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.streams&&e.hasOwnProperty("streams")){if(!Array.isArray(e.streams))return"streams: array expected";for(var t=0;t>>3){case 1: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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStreamId&&e.hasOwnProperty("audioStreamId")&&!c.isInteger(e.audioStreamId)?"audioStreamId: integer expected":null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!c.isString(e.attendeeId)?"attendeeId: string expected":null!=e.muted&&e.hasOwnProperty("muted")&&"boolean"!=typeof e.muted?"muted: boolean expected":null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&!c.isString(e.externalUserId)?"externalUserId: string expected":null!=e.dropped&&e.hasOwnProperty("dropped")&&"boolean"!=typeof e.dropped?"dropped: boolean expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioStreamIdInfo)return e;var t=new l.SdkAudioStreamIdInfo;return null!=e.audioStreamId&&(t.audioStreamId=e.audioStreamId>>>0),null!=e.attendeeId&&(t.attendeeId=String(e.attendeeId)),null!=e.muted&&(t.muted=Boolean(e.muted)),null!=e.externalUserId&&(t.externalUserId=String(e.externalUserId)),null!=e.dropped&&(t.dropped=Boolean(e.dropped)),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.SdkPingPongType=function(){var e={},t=Object.create(e);return t[e[1]="PING"]=1,t[e[2]="PONG"]=2,t}(),l.SdkPingPongFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>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 c.ProtocolError("missing required 'type'",{instance:i});if(!i.hasOwnProperty("pingId"))throw c.ProtocolError("missing required 'pingId'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";switch(e.type){default:return"type: enum value expected";case 1:case 2:}return c.isInteger(e.pingId)?null:"pingId: integer expected"},e.fromObject=function(e){if(e instanceof l.SdkPingPongFrame)return e;var t=new l.SdkPingPongFrame;switch(e.type){case"PING":case 1:t.type=1;break;case"PONG":case 2:t.type=2}return null!=e.pingId&&(t.pingId=e.pingId>>>0),t},e.toObject=function(e,t){t||(t={});var 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?l.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,s.util.toJSONOptions)},e}(),l.SdkAudioStatusFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>3==1?i.audioStatus=e.uint32():e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.audioStatus&&e.hasOwnProperty("audioStatus")&&!c.isInteger(e.audioStatus)?"audioStatus: integer expected":null},e.fromObject=function(e){if(e instanceof l.SdkAudioStatusFrame)return e;var t=new l.SdkAudioStatusFrame;return null!=e.audioStatus&&(t.audioStatus=e.audioStatus>>>0),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.SdkMetric=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>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 a||(e=new a(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 l.SdkMetric)return e;var t=new l.SdkMetric;switch(e.type){case"VIDEO_ACTUAL_ENCODER_BITRATE":case 1:t.type=1;break;case"VIDEO_AVAILABLE_SEND_BANDWIDTH":case 2:t.type=2;break;case"VIDEO_RETRANSMIT_BITRATE":case 3:t.type=3;break;case"VIDEO_AVAILABLE_RECEIVE_BANDWIDTH":case 4:t.type=4;break;case"VIDEO_TARGET_ENCODER_BITRATE":case 5:t.type=5;break;case"VIDEO_BUCKET_DELAY_MS":case 6:t.type=6;break;case"STUN_RTT_MS":case 7:t.type=7;break;case"SOCKET_DISCARDED_PPS":case 8:t.type=8;break;case"RTC_MIC_JITTER_MS":case 9:t.type=9;break;case"RTC_MIC_PPS":case 10:t.type=10;break;case"RTC_MIC_FRACTION_PACKET_LOST_PERCENT":case 11:t.type=11;break;case"RTC_MIC_BITRATE":case 12:t.type=12;break;case"RTC_MIC_RTT_MS":case 13:t.type=13;break;case"RTC_SPK_PPS":case 14:t.type=14;break;case"RTC_SPK_FRACTION_PACKET_LOST_PERCENT":case 15:t.type=15;break;case"RTC_SPK_JITTER_MS":case 16:t.type=16;break;case"RTC_SPK_FRACTION_DECODER_LOSS_PERCENT":case 17:t.type=17;break;case"RTC_SPK_BITRATE":case 18:t.type=18;break;case"RTC_SPK_CURRENT_DELAY_MS":case 19:t.type=19;break;case"RTC_SPK_JITTER_BUFFER_MS":case 20:t.type=20;break;case"VIDEO_SENT_RTT_MS":case 21:t.type=21;break;case"VIDEO_ENCODE_USAGE_PERCENT":case 22:t.type=22;break;case"VIDEO_NACKS_RECEIVED":case 23:t.type=23;break;case"VIDEO_PLIS_RECEIVED":case 24:t.type=24;break;case"VIDEO_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?l.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,s.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}(),l.SdkStreamMetricFrame=function(){function e(e){if(this.metrics=[],this.dimensions=[],e)for(var t=Object.keys(e),n=0;n>>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(l.SdkMetric.decode(e,e.uint32()));break;case 6:i.dimensions&&i.dimensions.length||(i.dimensions=[]),i.dimensions.push(l.SdkStreamDimension.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.streamId&&e.hasOwnProperty("streamId")&&!c.isInteger(e.streamId))return"streamId: integer expected";if(null!=e.groupId&&e.hasOwnProperty("groupId")&&!c.isInteger(e.groupId))return"groupId: integer expected";if(null!=e.metrics&&e.hasOwnProperty("metrics")){if(!Array.isArray(e.metrics))return"metrics: array expected";for(var t=0;t>>0),null!=e.groupId&&(t.groupId=e.groupId>>>0),e.metrics){if(!Array.isArray(e.metrics))throw TypeError(".SdkStreamMetricFrame.metrics: array expected");t.metrics=[];for(var n=0;n>>3){case 1:i.globalMetrics&&i.globalMetrics.length||(i.globalMetrics=[]),i.globalMetrics.push(l.SdkMetric.decode(e,e.uint32()));break;case 2:i.streamMetricFrames&&i.streamMetricFrames.length||(i.streamMetricFrames=[]),i.streamMetricFrames.push(l.SdkStreamMetricFrame.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.globalMetrics&&e.hasOwnProperty("globalMetrics")){if(!Array.isArray(e.globalMetrics))return"globalMetrics: array expected";for(var t=0;t>>3){case 1:i.type=e.int32();break;case 2:i.value=l.SdkDimensionValue.decode(e,e.uint32());break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(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=l.SdkDimensionValue.verify(e.value);if(t)return"value."+t}return null},e.fromObject=function(e){if(e instanceof l.SdkStreamDimension)return e;var t=new l.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=l.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?l.SdkStreamDimension.Type[e.type]:e.type),null!=e.value&&e.hasOwnProperty("value")&&(n.value=l.SdkDimensionValue.toObject(e.value,t)),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.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}(),l.SdkDimensionValue=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.stringValue&&e.hasOwnProperty("stringValue")&&!c.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")&&!(c.isInteger(e.uintValue)||e.uintValue&&c.isInteger(e.uintValue.low)&&c.isInteger(e.uintValue.high))?"uintValue: integer|Long expected":null},e.fromObject=function(e){if(e instanceof l.SdkDimensionValue)return e;var t=new l.SdkDimensionValue;return null!=e.stringValue&&(t.stringValue=String(e.stringValue)),null!=e.boolValue&&(t.boolValue=Boolean(e.boolValue)),null!=e.uintValue&&(c.Long?(t.uintValue=c.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 c.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,c.Long){var i=new c.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?c.Long.prototype.toString.call(e.uintValue):t.longs===Number?new c.LongBits(e.uintValue.low>>>0,e.uintValue.high>>>0).toNumber(!0):e.uintValue),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),l.SdkDataMessageFrame=function(){function e(e){if(this.messages=[],e)for(var t=Object.keys(e),n=0;n>>3==1?(i.messages&&i.messages.length||(i.messages=[]),i.messages.push(l.SdkDataMessagePayload.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.messages&&e.hasOwnProperty("messages")){if(!Array.isArray(e.messages))return"messages: array expected";for(var t=0;t>>3){case 1: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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.topic&&e.hasOwnProperty("topic")&&!c.isString(e.topic)?"topic: string expected":null!=e.data&&e.hasOwnProperty("data")&&!(e.data&&"number"==typeof e.data.length||c.isString(e.data))?"data: buffer expected":null!=e.lifetimeMs&&e.hasOwnProperty("lifetimeMs")&&!c.isInteger(e.lifetimeMs)?"lifetimeMs: integer expected":null!=e.senderAttendeeId&&e.hasOwnProperty("senderAttendeeId")&&!c.isString(e.senderAttendeeId)?"senderAttendeeId: string expected":null!=e.ingestTimeNs&&e.hasOwnProperty("ingestTimeNs")&&!(c.isInteger(e.ingestTimeNs)||e.ingestTimeNs&&c.isInteger(e.ingestTimeNs.low)&&c.isInteger(e.ingestTimeNs.high))?"ingestTimeNs: integer|Long expected":null!=e.senderExternalUserId&&e.hasOwnProperty("senderExternalUserId")&&!c.isString(e.senderExternalUserId)?"senderExternalUserId: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkDataMessagePayload)return e;var t=new l.SdkDataMessagePayload;return null!=e.topic&&(t.topic=String(e.topic)),null!=e.data&&("string"==typeof e.data?c.base64.decode(e.data,t.data=c.newBuffer(c.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.lifetimeMs&&(t.lifetimeMs=e.lifetimeMs>>>0),null!=e.senderAttendeeId&&(t.senderAttendeeId=String(e.senderAttendeeId)),null!=e.ingestTimeNs&&(c.Long?(t.ingestTimeNs=c.Long.fromValue(e.ingestTimeNs)).unsigned=!1:"string"==typeof e.ingestTimeNs?t.ingestTimeNs=parseInt(e.ingestTimeNs,10):"number"==typeof e.ingestTimeNs?t.ingestTimeNs=e.ingestTimeNs:"object"==typeof e.ingestTimeNs&&(t.ingestTimeNs=new c.LongBits(e.ingestTimeNs.low>>>0,e.ingestTimeNs.high>>>0).toNumber())),null!=e.senderExternalUserId&&(t.senderExternalUserId=String(e.senderExternalUserId)),t},e.toObject=function(e,t){t||(t={});var n={};if(t.defaults){if(n.topic="",t.bytes===String?n.data="":(n.data=[],t.bytes!==Array&&(n.data=c.newBuffer(n.data))),n.lifetimeMs=0,n.senderAttendeeId="",c.Long){var i=new c.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?c.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),null!=e.lifetimeMs&&e.hasOwnProperty("lifetimeMs")&&(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?c.Long.prototype.toString.call(e.ingestTimeNs):t.longs===Number?new c.LongBits(e.ingestTimeNs.low>>>0,e.ingestTimeNs.high>>>0).toNumber():e.ingestTimeNs),null!=e.senderExternalUserId&&e.hasOwnProperty("senderExternalUserId")&&(n.senderExternalUserId=e.senderExternalUserId),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),l.SdkTurnCredentials=function(){function e(e){if(this.uris=[],e)for(var t=Object.keys(e),n=0;n>>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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.username&&e.hasOwnProperty("username")&&!c.isString(e.username))return"username: string expected";if(null!=e.password&&e.hasOwnProperty("password")&&!c.isString(e.password))return"password: string expected";if(null!=e.ttl&&e.hasOwnProperty("ttl")&&!c.isInteger(e.ttl))return"ttl: integer expected";if(null!=e.uris&&e.hasOwnProperty("uris")){if(!Array.isArray(e.uris))return"uris: array expected";for(var t=0;t>>0),e.uris){if(!Array.isArray(e.uris))throw TypeError(".SdkTurnCredentials.uris: array expected");t.uris=[];for(var n=0;n>>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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.content&&e.hasOwnProperty("content")&&!c.isString(e.content))return"content: string expected";if(null!=e.endTime&&e.hasOwnProperty("endTime")&&!(c.isInteger(e.endTime)||e.endTime&&c.isInteger(e.endTime.low)&&c.isInteger(e.endTime.high)))return"endTime: integer|Long expected";if(null!=e.speakerAttendeeId&&e.hasOwnProperty("speakerAttendeeId")&&!c.isString(e.speakerAttendeeId))return"speakerAttendeeId: string expected";if(null!=e.speakerExternalUserId&&e.hasOwnProperty("speakerExternalUserId")&&!c.isString(e.speakerExternalUserId))return"speakerExternalUserId: string expected";if(null!=e.startTime&&e.hasOwnProperty("startTime")&&!(c.isInteger(e.startTime)||e.startTime&&c.isInteger(e.startTime.low)&&c.isInteger(e.startTime.high)))return"startTime: integer|Long expected";if(null!=e.type&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 1:case 2:}return null!=e.vocabularyFilterMatch&&e.hasOwnProperty("vocabularyFilterMatch")&&"boolean"!=typeof e.vocabularyFilterMatch?"vocabularyFilterMatch: boolean expected":null!=e.confidence&&e.hasOwnProperty("confidence")&&"number"!=typeof e.confidence?"confidence: number expected":null!=e.stable&&e.hasOwnProperty("stable")&&"boolean"!=typeof e.stable?"stable: boolean expected":null},e.fromObject=function(e){if(e instanceof l.SdkTranscriptItem)return e;var t=new l.SdkTranscriptItem;switch(null!=e.content&&(t.content=String(e.content)),null!=e.endTime&&(c.Long?(t.endTime=c.Long.fromValue(e.endTime)).unsigned=!1:"string"==typeof e.endTime?t.endTime=parseInt(e.endTime,10):"number"==typeof e.endTime?t.endTime=e.endTime:"object"==typeof e.endTime&&(t.endTime=new c.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber())),null!=e.speakerAttendeeId&&(t.speakerAttendeeId=String(e.speakerAttendeeId)),null!=e.speakerExternalUserId&&(t.speakerExternalUserId=String(e.speakerExternalUserId)),null!=e.startTime&&(c.Long?(t.startTime=c.Long.fromValue(e.startTime)).unsigned=!1:"string"==typeof e.startTime?t.startTime=parseInt(e.startTime,10):"number"==typeof e.startTime?t.startTime=e.startTime:"object"==typeof e.startTime&&(t.startTime=new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber())),e.type){case"PRONUNCIATION":case 1:t.type=1;break;case"PUNCTUATION":case 2:t.type=2}return null!=e.vocabularyFilterMatch&&(t.vocabularyFilterMatch=Boolean(e.vocabularyFilterMatch)),null!=e.confidence&&(t.confidence=Number(e.confidence)),null!=e.stable&&(t.stable=Boolean(e.stable)),t},e.toObject=function(e,t){t||(t={});var n={};if(t.defaults){if(n.content="",c.Long){var i=new c.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="",c.Long?(i=new c.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?c.Long.prototype.toString.call(e.endTime):t.longs===Number?new c.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber():e.endTime),null!=e.speakerAttendeeId&&e.hasOwnProperty("speakerAttendeeId")&&(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?c.Long.prototype.toString.call(e.startTime):t.longs===Number?new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber():e.startTime),null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?l.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,s.util.toJSONOptions)},e.Type=function(){var e={},t=Object.create(e);return t[e[1]="PRONUNCIATION"]=1,t[e[2]="PUNCTUATION"]=2,t}(),e}(),l.SdkTranscriptEntity=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.category&&e.hasOwnProperty("category")&&!c.isString(e.category)?"category: string expected":null!=e.confidence&&e.hasOwnProperty("confidence")&&"number"!=typeof e.confidence?"confidence: number expected":null!=e.content&&e.hasOwnProperty("content")&&!c.isString(e.content)?"content: string expected":null!=e.endTime&&e.hasOwnProperty("endTime")&&!(c.isInteger(e.endTime)||e.endTime&&c.isInteger(e.endTime.low)&&c.isInteger(e.endTime.high))?"endTime: integer|Long expected":null!=e.startTime&&e.hasOwnProperty("startTime")&&!(c.isInteger(e.startTime)||e.startTime&&c.isInteger(e.startTime.low)&&c.isInteger(e.startTime.high))?"startTime: integer|Long expected":null!=e.type&&e.hasOwnProperty("type")&&!c.isString(e.type)?"type: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkTranscriptEntity)return e;var t=new l.SdkTranscriptEntity;return null!=e.category&&(t.category=String(e.category)),null!=e.confidence&&(t.confidence=Number(e.confidence)),null!=e.content&&(t.content=String(e.content)),null!=e.endTime&&(c.Long?(t.endTime=c.Long.fromValue(e.endTime)).unsigned=!1:"string"==typeof e.endTime?t.endTime=parseInt(e.endTime,10):"number"==typeof e.endTime?t.endTime=e.endTime:"object"==typeof e.endTime&&(t.endTime=new c.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber())),null!=e.startTime&&(c.Long?(t.startTime=c.Long.fromValue(e.startTime)).unsigned=!1:"string"==typeof e.startTime?t.startTime=parseInt(e.startTime,10):"number"==typeof e.startTime?t.startTime=e.startTime:"object"==typeof e.startTime&&(t.startTime=new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber())),null!=e.type&&(t.type=String(e.type)),t},e.toObject=function(e,t){t||(t={});var n={};if(t.defaults){if(n.category="",n.confidence=0,n.content="",c.Long){var i=new c.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;c.Long?(i=new c.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?c.Long.prototype.toString.call(e.endTime):t.longs===Number?new c.LongBits(e.endTime.low>>>0,e.endTime.high>>>0).toNumber():e.endTime),null!=e.startTime&&e.hasOwnProperty("startTime")&&("number"==typeof e.startTime?n.startTime=t.longs===String?String(e.startTime):e.startTime:n.startTime=t.longs===String?c.Long.prototype.toString.call(e.startTime):t.longs===Number?new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber():e.startTime),null!=e.type&&e.hasOwnProperty("type")&&(n.type=e.type),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),l.SdkTranscriptAlternative=function(){function e(e){if(this.items=[],this.entities=[],e)for(var t=Object.keys(e),n=0;n>>3){case 1:i.items&&i.items.length||(i.items=[]),i.items.push(l.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(l.SdkTranscriptEntity.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.items&&e.hasOwnProperty("items")){if(!Array.isArray(e.items))return"items: array expected";for(var t=0;t>>3){case 1: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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.languageCode&&e.hasOwnProperty("languageCode")&&!c.isString(e.languageCode)?"languageCode: string expected":null!=e.score&&e.hasOwnProperty("score")&&"number"!=typeof e.score?"score: number expected":null},e.fromObject=function(e){if(e instanceof l.SdkTranscriptLanguageWithScore)return e;var t=new l.SdkTranscriptLanguageWithScore;return null!=e.languageCode&&(t.languageCode=String(e.languageCode)),null!=e.score&&(t.score=Number(e.score)),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.SdkTranscriptResult=function(){function e(e){if(this.alternatives=[],this.languageIdentification=[],e)for(var t=Object.keys(e),n=0;n>>3){case 1:i.alternatives&&i.alternatives.length||(i.alternatives=[]),i.alternatives.push(l.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(l.SdkTranscriptLanguageWithScore.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.alternatives&&e.hasOwnProperty("alternatives")){if(!Array.isArray(e.alternatives))return"alternatives: array expected";for(var t=0;t>>0,e.endTime.high>>>0).toNumber())),null!=e.isPartial&&(t.isPartial=Boolean(e.isPartial)),null!=e.resultId&&(t.resultId=String(e.resultId)),null!=e.startTime&&(c.Long?(t.startTime=c.Long.fromValue(e.startTime)).unsigned=!1:"string"==typeof e.startTime?t.startTime=parseInt(e.startTime,10):"number"==typeof e.startTime?t.startTime=e.startTime:"object"==typeof e.startTime&&(t.startTime=new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber())),null!=e.languageCode&&(t.languageCode=String(e.languageCode)),e.languageIdentification){if(!Array.isArray(e.languageIdentification))throw TypeError(".SdkTranscriptResult.languageIdentification: array expected");for(t.languageIdentification=[],n=0;n>>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?c.Long.prototype.toString.call(e.startTime):t.longs===Number?new c.LongBits(e.startTime.low>>>0,e.startTime.high>>>0).toNumber():e.startTime),null!=e.languageCode&&e.hasOwnProperty("languageCode")&&(n.languageCode=e.languageCode),e.languageIdentification&&e.languageIdentification.length)for(n.languageIdentification=[],r=0;r>>3==1?(i.results&&i.results.length||(i.results=[]),i.results.push(l.SdkTranscriptResult.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.results&&e.hasOwnProperty("results")){if(!Array.isArray(e.results))return"results: array expected";for(var t=0;t>>3){case 1: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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.type&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:}return null!=e.eventTime&&e.hasOwnProperty("eventTime")&&!(c.isInteger(e.eventTime)||e.eventTime&&c.isInteger(e.eventTime.low)&&c.isInteger(e.eventTime.high))?"eventTime: integer|Long expected":null!=e.transcriptionRegion&&e.hasOwnProperty("transcriptionRegion")&&!c.isString(e.transcriptionRegion)?"transcriptionRegion: string expected":null!=e.transcriptionConfiguration&&e.hasOwnProperty("transcriptionConfiguration")&&!c.isString(e.transcriptionConfiguration)?"transcriptionConfiguration: string expected":null!=e.message&&e.hasOwnProperty("message")&&!c.isString(e.message)?"message: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkTranscriptionStatus)return e;var t=new l.SdkTranscriptionStatus;switch(e.type){case"STARTED":case 1:t.type=1;break;case"INTERRUPTED":case 2:t.type=2;break;case"RESUMED":case 3:t.type=3;break;case"STOPPED":case 4:t.type=4;break;case"FAILED":case 5:t.type=5}return null!=e.eventTime&&(c.Long?(t.eventTime=c.Long.fromValue(e.eventTime)).unsigned=!1:"string"==typeof e.eventTime?t.eventTime=parseInt(e.eventTime,10):"number"==typeof e.eventTime?t.eventTime=e.eventTime:"object"==typeof e.eventTime&&(t.eventTime=new c.LongBits(e.eventTime.low>>>0,e.eventTime.high>>>0).toNumber())),null!=e.transcriptionRegion&&(t.transcriptionRegion=String(e.transcriptionRegion)),null!=e.transcriptionConfiguration&&(t.transcriptionConfiguration=String(e.transcriptionConfiguration)),null!=e.message&&(t.message=String(e.message)),t},e.toObject=function(e,t){t||(t={});var n={};if(t.defaults){if(n.type=t.enums===String?"STARTED":1,c.Long){var i=new c.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?l.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?c.Long.prototype.toString.call(e.eventTime):t.longs===Number?new c.LongBits(e.eventTime.low>>>0,e.eventTime.high>>>0).toNumber():e.eventTime),null!=e.transcriptionRegion&&e.hasOwnProperty("transcriptionRegion")&&(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,s.util.toJSONOptions)},e.Type=function(){var e={},t=Object.create(e);return t[e[1]="STARTED"]=1,t[e[2]="INTERRUPTED"]=2,t[e[3]="RESUMED"]=3,t[e[4]="STOPPED"]=4,t[e[5]="FAILED"]=5,t}(),e}(),l.SdkTranscriptEvent=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>3){case 1:i.status=l.SdkTranscriptionStatus.decode(e,e.uint32());break;case 2:i.transcript=l.SdkTranscript.decode(e,e.uint32());break;default:e.skipType(7&r)}}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(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=l.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=l.SdkTranscript.verify(e.transcript))return"transcript."+n}return null},e.fromObject=function(e){if(e instanceof l.SdkTranscriptEvent)return e;var t=new l.SdkTranscriptEvent;if(null!=e.status){if("object"!=typeof e.status)throw TypeError(".SdkTranscriptEvent.status: object expected");t.status=l.SdkTranscriptionStatus.fromObject(e.status)}if(null!=e.transcript){if("object"!=typeof e.transcript)throw TypeError(".SdkTranscriptEvent.transcript: object expected");t.transcript=l.SdkTranscript.fromObject(e.transcript)}return t},e.toObject=function(e,t){t||(t={});var n={};return null!=e.status&&e.hasOwnProperty("status")&&(n.status=l.SdkTranscriptionStatus.toObject(e.status,t),t.oneofs&&(n.Event="status")),null!=e.transcript&&e.hasOwnProperty("transcript")&&(n.transcript=l.SdkTranscript.toObject(e.transcript,t),t.oneofs&&(n.Event="transcript")),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),l.SdkTranscriptFrame=function(){function e(e){if(this.events=[],e)for(var t=Object.keys(e),n=0;n>>3==1?(i.events&&i.events.length||(i.events=[]),i.events.push(l.SdkTranscriptEvent.decode(e,e.uint32()))):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.events&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(var t=0;t>>3){case 1:i.addedOrUpdatedVideoSubscriptions&&i.addedOrUpdatedVideoSubscriptions.length||(i.addedOrUpdatedVideoSubscriptions=[]),i.addedOrUpdatedVideoSubscriptions.push(l.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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.addedOrUpdatedVideoSubscriptions&&e.hasOwnProperty("addedOrUpdatedVideoSubscriptions")){if(!Array.isArray(e.addedOrUpdatedVideoSubscriptions))return"addedOrUpdatedVideoSubscriptions: array expected";for(var t=0;t>>3){case 1: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 c.ProtocolError("missing required 'mid'",{instance:i});return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":c.isString(e.mid)?null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!c.isString(e.attendeeId)?"attendeeId: string expected":null!=e.streamId&&e.hasOwnProperty("streamId")&&!c.isInteger(e.streamId)?"streamId: integer expected":null!=e.priority&&e.hasOwnProperty("priority")&&!c.isInteger(e.priority)?"priority: integer expected":null!=e.targetBitrateKbps&&e.hasOwnProperty("targetBitrateKbps")&&!c.isInteger(e.targetBitrateKbps)?"targetBitrateKbps: integer expected":null!=e.groupId&&e.hasOwnProperty("groupId")&&!c.isInteger(e.groupId)?"groupId: integer expected":null:"mid: string expected"},e.fromObject=function(e){if(e instanceof l.SdkVideoSubscriptionConfiguration)return e;var t=new l.SdkVideoSubscriptionConfiguration;return null!=e.mid&&(t.mid=String(e.mid)),null!=e.attendeeId&&(t.attendeeId=String(e.attendeeId)),null!=e.streamId&&(t.streamId=e.streamId>>>0),null!=e.priority&&(t.priority=e.priority>>>0),null!=e.targetBitrateKbps&&(t.targetBitrateKbps=e.targetBitrateKbps>>>0),null!=e.groupId&&(t.groupId=e.groupId>>>0),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.SdkPrimaryMeetingJoinFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>3==1?i.credentials=l.SdkMeetingSessionCredentials.decode(e,e.uint32()):e.skipType(7&r)}return i},e.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.credentials&&e.hasOwnProperty("credentials")){var t=l.SdkMeetingSessionCredentials.verify(e.credentials);if(t)return"credentials."+t}return null},e.fromObject=function(e){if(e instanceof l.SdkPrimaryMeetingJoinFrame)return e;var t=new l.SdkPrimaryMeetingJoinFrame;if(null!=e.credentials){if("object"!=typeof e.credentials)throw TypeError(".SdkPrimaryMeetingJoinFrame.credentials: object expected");t.credentials=l.SdkMeetingSessionCredentials.fromObject(e.credentials)}return t},e.toObject=function(e,t){t||(t={});var n={};return t.defaults&&(n.credentials=null),null!=e.credentials&&e.hasOwnProperty("credentials")&&(n.credentials=l.SdkMeetingSessionCredentials.toObject(e.credentials,t)),n},e.prototype.toJSON=function(){return this.constructor.toObject(this,s.util.toJSONOptions)},e}(),l.SdkPrimaryMeetingJoinAckFrame=function(){function e(e){if(e)for(var t=Object.keys(e),n=0;n>>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 a||(e=new a(e)),this.decode(e,e.uint32())},e.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.attendeeId&&e.hasOwnProperty("attendeeId")&&!c.isString(e.attendeeId)?"attendeeId: string expected":null!=e.externalUserId&&e.hasOwnProperty("externalUserId")&&!c.isString(e.externalUserId)?"externalUserId: string expected":null!=e.joinToken&&e.hasOwnProperty("joinToken")&&!c.isString(e.joinToken)?"joinToken: string expected":null},e.fromObject=function(e){if(e instanceof l.SdkMeetingSessionCredentials)return e;var t=new l.SdkMeetingSessionCredentials;return null!=e.attendeeId&&(t.attendeeId=String(e.attendeeId)),null!=e.externalUserId&&(t.externalUserId=String(e.externalUserId)),null!=e.joinToken&&(t.joinToken=String(e.joinToken)),t},e.toObject=function(e,t){t||(t={});var 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,s.util.toJSONOptions)},e}(),l.SdkVideoCodecCapability=function(){var e={},t=Object.create(e);return t[e[1]="VP8"]=1,t[e[3]="H264_CONSTRAINED_BASELINE_PROFILE"]=3,t}(),e.exports=l,c.Long=void 0,s.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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1938),s=n(3538),a=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),s=yield this.hmac(n,i),a=yield this.hmac(r,s);return yield this.hmac("aws4_request",a)}))}signURL(e,t,n,r,o,c,l){return i(this,void 0,void 0,(function*(){const i=this.getDateTimeString(),u=this.getDateString(i);let d="";d=this.chimeClient.config.region instanceof Function?yield this.chimeClient.config.region():this.chimeClient.config.region;const h="host:"+r.toLowerCase()+"\n",f=u+"/"+d+"/"+n+"/aws4_request";let p;p=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(p.accessKeyId+"/"+f)]),m.set("X-Amz-Date",[i]),m.set("X-Amz-Expires",["10"]),m.set("X-Amz-SignedHeaders",["host"]),p.sessionToken&&m.set("X-Amz-Security-Token",[encodeURIComponent(p.sessionToken)]),m.set(a.default.X_AMZN_VERSION,[encodeURIComponent(a.default.sdkVersion)]),m.set(a.default.X_AMZN_USER_AGENT,[encodeURIComponent(a.default.sdkUserAgentLowResolution)]),null==l||l.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"+o+"\n"+g+"\n"+h+"\nhost\n"+s.toHex(yield this.hmac(c)),y=s.toHex(yield this.hmac(v)),b="AWS4-HMAC-SHA256\n"+i+"\n"+u+"/"+d+"/"+n+"/aws4_request\n"+y,x=yield this.getSignatureKey(p.secretAccessKey,u,d,n),w=s.toHex(yield this.hmac(b,x));return t+"://"+r+o+"?"+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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4571),s=n(6196),a=n(9496),o=n(2811),c=n(7604),l=n(1296),u=n(3922),d=n(289),h=n(8660),f=n(9880),p=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(f.default[e]);this.logEvent(n,t)}logVideoEvent(e,t){const n="video"+this.toSuffix(p.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(c.default[e])}`,lifecycle_event_code:`${e}`,lifecycle_event_condition:`condition${this.toSuffix(l.default[t])}`,lifecycle_event_condition_code:`${t}`};this.logEvent("meeting_session_lifecycle",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 u.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 o.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=d.SdkStreamDimension.create();r.type=n[i];const s=d.SdkDimensionValue.create();s.stringValue=t.currentStringMetrics[i],r.value=s,e.dimensions.push(r)}}addMetricFrame(e,t,n,i){const r=n.type,s=n.transform,a=n.source,o=t.streamMetricFrames.length,c=t.streamMetricFrames[o-1];if(r){const n=d.SdkMetric.create();n.type=r,n.value=s(a||e,i),i?c.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=d.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=d.SdkClientMetricFrame.create();return e.globalMetrics=[],e.streamMetricFrames=[],this.addGlobalMetricsToProtobuf(e),this.addStreamMetricsToProtobuf(e),e}sendClientMetricProtobuf(e){this.signalingClient.sendClientMetrics(e)}isStreamRawMetricReport(e){return["inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp"].includes(e)}getMediaType(e){return"audio"===e.kind?a.default.AUDIO:a.default.VIDEO}getDirectionType(e){const{type:t}=e;return"inbound-rtp"===t||"remote-outbound-rtp"===t?s.default.DOWNSTREAM:s.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)===s.default.DOWNSTREAM&&this.getMediaType(e)===a.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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(155),s=n(1789);class a extends s.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=a},1789:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1124),s=n(4456);t.default=class{constructor(e){this.logger=e,this.taskName="BaseTask",this.parentTask=null,this.status=s.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 s.default.RUNNING:this.logAndThrow(`${this.name()} is already running`);case s.default.CANCELED:this.logAndThrow(`${this.name()} was canceled before running`);case s.default.FINISHED:this.logAndThrow(`${this.name()} was already finished`)}this.status=s.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!==s.default.CANCELED&&(this.status=s.default.FINISHED)}}))}baseCancel(e){this.status!==s.default.CANCELED&&this.status!==s.default.FINISHED?(this.logger.info(`canceling task ${this.name()}`),this.status=s.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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1789);class s 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=s},7408:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9416),s=n(1789);class a extends s.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=a},5482:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1789);class s 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 s,a;if(this.context.videoTileController.getVideoTileForAttendeeId?(a=this.context.videoTileController.getVideoTileForAttendeeId(r),s=!!(null===(n=null==a?void 0:a.state())||void 0===n?void 0:n.boundVideoStream)):s=this.context.videoTileController.haveVideoTileForAttendeeId(r),s)return void this.context.logger.info(`Not adding remote track. Already have tile for attendeeId: ${r}`);a||(a=this.context.videoTileController.addVideoTile(),this.logger.info(`Created video tile ${a.id()}`));let o,c,l=this.context.videoStreamIndex.streamIdForTrack(i);void 0===l&&(this.logger.warn(`stream not found for tile=${a.id()} track=${i}`),l=null);for(let n=0;n{this.context.logger.info(`received the ${i} event for tile=${a.id()} id=${e.id} streamId=${l}`),"ended"===i&&this.removeRemoteVideoTrack(e,a.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();o=t.width,c=t.height}else{const t=e.getCapabilities();o=t.width,c=t.height}const u=this.context.videoStreamIndex.externalUserIdForTrack(i);a.bindVideoStream(r,!1,t,o,c,l,u),this.logger.info(`video track added, use tile=${a.id()} track=${i} streamId=${l}`);const d="removetrack",h=t,f=()=>this.removeRemoteVideoTrack(e,a.state());this.removeTrackRemovedEventListeners[e.id]=()=>{h.removeEventListener(d,f),delete this.removeTrackRemovedEventListeners[e.id]},h.addEventListener(d,f)}removeRemoteVideoTrack(e,t){if(this.removeTrackRemovedEventListeners.hasOwnProperty(e.id)){this.removeTrackRemovedEventListeners[e.id]();for(const t of this.removeVideoTrackEventListeners[e.id])t();delete this.removeVideoTrackEventListeners[e.id]}this.logger.info(`video track ended, removing tile=${t.tileId} id=${e.id} stream=${t.streamId}`),t.streamId?this.context.videosPaused.remove(t.streamId):this.logger.warn(`no stream found for tile=${t.tileId}`),this.context.videoTileController.removeVideoTile(t.tileId)}}t.default=s,s.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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5687),s=n(326),a=n(1789);class o extends a.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 s.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=o},6240:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5687),s=n(326),a=n(1789);class o extends a.default{constructor(e,t=o.CHROME_VPN_TIMEOUT_MS){super(e.logger),this.context=e,this.chromeVpnTimeoutMs=t,this.taskName="FinishGatheringICECandidatesTask"}removeEventListener(){this.context.peer&&(this.context.peer.removeEventListener("icecandidate",this.context.iceCandidateHandler),this.context.turnCredentials||this.context.peer.removeEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler))}cancel(){let e;this.context.browserBehavior.requiresIceCandidateGatheringTimeoutWorkaround()&&this.chromeVpnTimeoutMsthis.chromeVpnTimeoutMs&&(e=new Error(`canceling ${this.name()} due to the meeting status code: ${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 s.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 s.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&&(s.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 s.default(this.context.peer.localDescription.sdp).hasCandidates()&&0!==this.context.iceCandidates.length?(e(),delete this.cancelPromise):(t(new Error("no ice candidates were gathered")),delete this.cancelPromise))},this.context.peer.addEventListener("icecandidate",this.context.iceCandidateHandler),this.startTimestampMs=Date.now()}))}catch(e){throw e}finally{this.startTimestampMs&&(this.context.iceGatheringDurationMs=Math.round(Date.now()-this.startTimestampMs))}else this.context.logger.info("ice gathering state is complete and candidates are in SDP; bypass gathering")}))}}t.default=o,o.CHROME_VPN_TIMEOUT_MS=5e3},1960:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3789),s=n(5687),a=n(7215),o=n(7103),c=n(9416),l=n(2168),u=n(289),d=n(1789);class h extends d.default{constructor(e){super(e.logger),this.context=e,this.taskName="JoinAndReceiveIndexTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return 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===c.default.WebSocketClosed){let e=`The signaling connection was closed with code ${t.closeCode} and reason: ${t.closeReason}`;n.logger.warn(e);let i=s.default.SignalingBadRequest;return 4410===t.closeCode?(e="The meeting already ended.",n.logger.warn(e),i=s.default.MeetingEnded):t.closeCode>=4500&&t.closeCode<4600&&(i=s.default.SignalingInternalServerError),void n.audioVideoController.handleMeetingSessionStatus(new r.default(i),new Error(e))}if(t.type!==c.default.ReceivedSignalFrame)return;if(t.message.type===u.SdkSignalFrame.Type.JOIN_ACK){const e=t.message.joinack;if(e&&e.videoSubscriptionLimit&&(n.videoSubscriptionLimit=e.videoSubscriptionLimit),n.serverSupportsCompression=null==e?void 0:e.wantsCompressedSdp,void 0!==(null==e?void 0:e.defaultServerSideNetworkAdaption)&&e.defaultServerSideNetworkAdaption!==o.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(o.convertServerSideNetworkAdaptionEnumFromSignaled(t))}return void(e&&e.turnCredentials?(n.turnCredentials=new a.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!==u.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 d=new l.default(this.context.meetingSessionConfiguration.applicationMetadata);void 0!==this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&void 0!==this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions&&(d.serverSideNetworkAdaption=this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption(),d.supportedServerSideNetworkAdaptions=this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions()),this.context.signalingClient.join(d)}));this.context.logger.info(`received first index ${JSON.stringify(e)}`),this.context.indexFrame=e}))}}t.default=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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9416),s=n(289),a=n(1789);class o extends a.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===s.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=o},2748:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9416),s=n(289),a=n(1789);class o extends a.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===s.SdkSignalFrame.Type.AUDIO_STREAM_ID_INFO){const t=e.message.audioStreamIdInfo;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioStreamIdInfo(t)}else if(e.message.type===s.SdkSignalFrame.Type.AUDIO_METADATA){const t=e.message.audioMetadata;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioMetadata(t)}}}t.default=o},1981:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(6196),s=n(9496),a=n(2770),o=n(9708),c=n(2977),l=n(1922),u=n(3789),d=n(5687),h=n(9416),f=n(289),p=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:p.default.RedmicStartLoss:n?p.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 u.default(d.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 o.default(e.logger,Object.assign({},t),this.initialConnectionHealthData.clone()),this.unusableAudioWarningHealthPolicy=new l.default(Object.assign({},t),this.initialConnectionHealthData.clone()),this.sendingAudioFailureHealthPolicy=new c.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 s=this.context.videoDownlinkBandwidthPolicy.wantsResubscribe();if(r=r||s,s){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=${s}; 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 o=new Map,c=new Map;for(const e in n)n[e].mediaType===s.default.VIDEO&&n[e].direction===r.default.DOWNSTREAM&&o.set(n[e].streamId,n[e]);let l=!1;for(const e of this.currentAvailableStreamAvgBitrates.bitrates)if(o.has(e.sourceStreamId)){const t=o.get(e.sourceStreamId),n=this.context.videoStreamIndex.attendeeIdForStreamId(e.sourceStreamId);if(!n)continue;const i=new a.default,r=t.previousMetrics.bytesReceived,s=t.currentMetrics.bytesReceived;if(!r||!s)continue;const u=8*(s-r)/1e3;i.expectedAverageBitrateKbps=e.avgBitrateBps/1e3,i.receivedAverageBitrateKbps=u,i.attendeeId=n,u{this.context.audioVideoController.handleMeetingSessionStatus(new u.default(d.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=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=u.default.fromSignalFrame(e.message);e.message.type!==f.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&t.statusCode()!==d.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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3920),s=n(9416),a=n(1789);class o extends a.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 s.default.WebSocketOpen:this.signalingClient.removeObserver(this),e();break;case s.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=o},8556:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1789);class s 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;n0){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=s},9945:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3204),s=n(9416),a=n(289),o=n(1789);class c extends o.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===s.default.ReceivedSignalFrame&&t.message.type===a.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=c},1209:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1789);class s 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=s},5547:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5687),s=n(7215),a=n(214),o=n(4046),c=n(1789);class l extends c.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveTURNCredentialsTask",this.url=e.meetingSessionConfiguration.urls.turnControlURL,this.meetingId=e.meetingSessionConfiguration.meetingId,this.joinToken=e.meetingSessionConfiguration.credentials.joinToken}cancel(){if(this.cancelPromise){const e=new Error(`canceling ${this.name()}`);this.cancelPromise(e),delete this.cancelPromise}}run(){return 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 a.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(o.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 s.default,this.context.turnCredentials.password=t.password,this.context.turnCredentials.ttl=t.ttl,this.context.turnCredentials.uris=t.uris.map((e=>this.context.meetingSessionConfiguration.urls.urlRewriter(e))).filter((e=>!!e)),this.context.turnCredentials.username=t.username}))}}t.default=l},120:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(214),s=n(289),a=n(1789);class o extends a.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===s.SdkStreamServiceType.RX||this.context.videoDuplexMode===s.SdkStreamServiceType.DUPLEX;if(this.context.videoTileController.hasStartedLocalVideoTile()?this.context.videoDuplexMode=e?s.SdkStreamServiceType.DUPLEX:s.SdkStreamServiceType.TX:this.context.videoDuplexMode=e?s.SdkStreamServiceType.RX:0,this.context.videoCaptureAndEncodeParameter=this.context.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters(),!this.context.videoTileController.hasStartedLocalVideoTile())return this.context.logger.info("has not started local video tile"),void(this.context.activeVideoInput&&(this.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 e=n.getVideoTracks();if(!e||0===e.length)return;const i=this.context.meetingSessionConfiguration.credentials.attendeeId,s=new r.default(i).hasModality(r.default.MODALITY_CONTENT),a=e[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 e[0].applyConstraints(t)}catch(e){this.context.logger.info("simulcast: pass video without more constraint")}}const o=this.context.audioVideoController.configuration.credentials.externalUserId;t.bindVideoStream(i,!0,n,a.width,a.height,null,o);for(let t=0;t{const n=new s.default(e.attendeeId);return!(n.base()===t&&n.hasModality(s.default.MODALITY_CONTENT))}));const{videoStreamIndex:n,videoDownlinkBandwidthPolicy:i,videoUplinkBandwidthPolicy:r}=this.context,a=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 o=n.allVideoSendingSourcesExcludingSelf(t);this.areVideoSourcesEqual(a,o)||this.context.audioVideoController.forEachObserver((e=>{l.Maybe.of(e.remoteVideoSourcesDidChange).map((t=>t.bind(e)(o)))}))}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;ethis.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.context.videoCaptureAndEncodeParameter=t.chooseCaptureAndEncodeParameters(),this.logger.info(`trigger resubscribe for up=${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=>{l.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){for(const n of e.supportedReceiveCodecIntersection)if(i.equals(a.default.fromSignaled(n))){t.push(i);break}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=d},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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1018),s=n(9416),a=n(289),o=n(1789);class c extends o.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=a.SdkDataMessagePayload.create();r.topic=e,r.lifetimeMs=n,r.data=i;const s=a.SdkDataMessageFrame.create();s.messages=[r],this.context.signalingClient.sendDataMessage(s)}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===s.default.ReceivedSignalFrame&&e.message.type===a.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(!c.TOPIC_REGEX.test(e))throw new Error("Invalid topic");if(t.length>c.DATA_SIZE)throw new Error("Data size has to be less than 2048 bytes");if(n&&n<0)throw new Error("The life time of the message has to be non negative")}}t.default=c,c.TOPIC_REGEX=new RegExp(/^[a-zA-Z0-9_-]{1,36}$/),c.DATA_SIZE=2048},7079:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1789),s=n(4456);class a 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()===s.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=a},4833:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543),s=n(326),a=n(1789);class o extends a.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 s.default(t).withVideoLayersAllocationRtpHeaderExtension(this.context.previousSdpOffer).sdp),(new r.default).requiresDisablingH264Encoding()&&(t=new s.default(t).removeH264SupportFromSendSection().sdp),void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(t=new s.default(t).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.audioProfile&&(t=new s.default(t).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(t=new s.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=o},5275:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(326),s=n(1789);class a extends s.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=a},5924:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(3789),s=n(5687),a=n(326),o=n(3320),c=n(7103),l=n(9416),u=n(6729),d=n(9101),h=n(289),f=n(1789);class p extends f.default{constructor(e){super(e.logger),this.context=e,this.taskName="SubscribeAndReceiveSubscribeAckTask",this.taskCanceler=null,this.textCompressor=new o.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 a.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 a.default(r);const s=new u.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()!==c.default.None&&void 0!==this.context.videoDownlinkBandwidthPolicy.getVideoPreferences&&(s.videoSubscriptionConfiguration=this.convertVideoPreferencesToVideoSubscriptionConfiguration(t,this.context.videoDownlinkBandwidthPolicy.getVideoPreferences())),this.context.logger.info(`sending subscribe: ${JSON.stringify(s)}`),this.context.signalingClient.subscribe(s);const o=yield this.receiveSubscribeAck();this.context.logger.info(`got subscribe ack: ${JSON.stringify(o)}`);let l="";o.compressedSdpAnswer&&o.compressedSdpAnswer.length?(l=this.textCompressor.decompress(o.compressedSdpAnswer,this.context.previousSdpAnswerAsString),0===l.length&&(this.context.sdpAnswer="",this.context.previousSdpAnswerAsString="",this.logAndThrow("Error occurred while trying to decompress the SDP answer.")),this.context.logger.info(`Decompressed the SDP message from ${o.compressedSdpAnswer.length} to ${l.length} bytes.`),this.context.sdpAnswer=l):this.context.sdpAnswer=o.sdpAnswer,this.context.previousSdpAnswerAsString=this.context.sdpAnswer,this.context.videoStreamIndex.integrateSubscribeAckFrame(o)}))}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 a.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 d.default,s=i.get(e.attendeeId);void 0!==s?(t.mid=s,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=s.default.TaskFailed;return t.closeCode>=4500&&t.closeCode<4600&&(i=s.default.SignalingInternalServerError),void n.audioVideoController.handleMeetingSessionStatus(new r.default(i),new Error(e))}if(t.type!==l.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=p},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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(4929),s=n(1789);class a extends s.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=a},6171:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5687),s=n(1789);class a extends s.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,s,a,o)=>{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=a},365:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((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 s=t.streamIdForTrack("v_"+r.mid);if("inactive"!==r.direction&&void 0!==s)for(const[a,o]of n.entries())if(t.StreamIdsInSameGroup(s,o)){r.direction="recvonly",this.videoSubscriptions[i]=o,e=!0,this.streamIdToTransceiver.delete(s),this.streamIdToTransceiver.set(o,r),n.splice(a,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[s,a]of n.entries())if(t.StreamIdsInSameGroup(e,a)){r.direction="recvonly",this.videoSubscriptions[i]=a,this.streamIdToTransceiver.delete(e),this.streamIdToTransceiver.set(a,r),n.splice(s,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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(5785);class s extends r.default{constructor(e,t){super(e,t);let n=2;this.videoQualityControlParameterMap=new Map;for(let e=0;e{"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),s=n(1288),a=n(1326),o=n(6864),c={[i.SdkTranscriptionStatus.Type.STARTED]:a.default.STARTED,[i.SdkTranscriptionStatus.Type.INTERRUPTED]:a.default.INTERRUPTED,[i.SdkTranscriptionStatus.Type.RESUMED]:a.default.RESUMED,[i.SdkTranscriptionStatus.Type.STOPPED]:a.default.STOPPED,[i.SdkTranscriptionStatus.Type.FAILED]:a.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=c[e.status.type];if(!t)continue;const i=new s.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=o.default.PRONUNCIATION;break;case i.SdkTranscriptItem.Type.PUNCTUATION:t.type=o.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 s{constructor(e){var t,n,r,a,o,c,l;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])||s.UNAVAILABLE,this.browserName=(null===(a=this.parserResult)||void 0===a?void 0:a.browser.name)||s.UNAVAILABLE,this.browserVersion=(null===(o=this.parserResult)||void 0===o?void 0:o.browser.version)||s.UNAVAILABLE,this.deviceName=[(null===(c=this.parserResult)||void 0===c?void 0:c.device.vendor)||"",(null===(l=this.parserResult)||void 0===l?void 0:l.device.model)||""].join(" ").trim()||s.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)||s.UNAVAILABLE,osVersion:(null===(t=this.parserResult)||void 0===t?void 0:t.os.version)||s.UNAVAILABLE,sdkVersion:r.default.sdkVersion,sdkName:r.default.sdkName}}}t.default=s,s.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],s="object"==typeof r?e(r):r;return n[i.toLowerCase()]=s,n}),{})}},4046:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(543),r=n(2336);class s{static get sdkName(){return"amazon-chime-sdk-js"}static get sdkVersion(){return r.default.semverString}static get sdkVersionSemVer(){var e,t,n,i;const s=r.default.semverString.match(/^(?[0-9]+)\.(?[0-9]+)((?:\.(?[0-9]+))(?:-(?[a-zA-Z]+(\.[0-9])*))?)?/);return{major:null===(e=null==s?void 0:s.groups)||void 0===e?void 0:e.major,minor:null===(t=null==s?void 0:s.groups)||void 0===t?void 0:t.minor,patch:null===(n=null==s?void 0:s.groups)||void 0===n?void 0:n.patch,preRelease:null===(i=null==s?void 0:s.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(s.X_AMZN_VERSION,s.sdkVersion),t.searchParams.append(s.X_AMZN_USER_AGENT,s.sdkUserAgentLowResolution),t.toString()}}t.default=s,s.X_AMZN_VERSION="X-Amzn-Version",s.X_AMZN_USER_AGENT="X-Amzn-User-Agent"},2336:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={hash:"6fc9293",raw:"v3.9.0",semverString:"3.9.0"}},1133:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n{constructor(e,t,n,i,r,s=1){this.cameraWidth=e,this.cameraHeight=t,this.cameraFrameRate=n,this.maxEncodeBitrateKbps=i,this.isSimulcast=r,this.scaleResolutionDownBy=s}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{"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(),s=new Map;for(const e of r)n.contain(e.streamId)&&s.set(e.attendeeId,e.streamId);for(const e of this.videoSources){const n=e.attendee.attendeeId;s.has(n)&&t.add(s.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),s=n(1819),a=n(4992);class o extends a.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=s.VideoPreferences.prepare();let n=!1;const a=e.remoteStreamDescriptions();for(const e of a)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=o},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.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 s(this.builder.build())}}t.MutableVideoPreferences=r;class s{constructor(e){this.items=e}static prepare(){return new r(new i)}static default(){return new s(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=s.prepare();for(const t of this.items)e.add(t.clone());return e.build()}}t.VideoPreferences=s,t.default=s},4992:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(6196),r=n(9496),s=n(8890),a=n(813),o=n(7103),c=n(1508),l=n(2721),u=n(1754),d=n(1819),h=n(1034);class f{constructor(){this.bandwidthEstimateKbps=0,this.usedBandwidthKbps=0,this.packetsLost=0,this.nackCount=0,this.rttMs=0}}class p{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 c.default,this.optimalReceiveStreams=[],this.optimalNonPausedReceiveStreams=[],this.subscribedReceiveSet=new c.default,this.subscribedReceiveStreams=[],this.videoPreferences=void 0,this.defaultVideoPreferences=void 0,this.shouldPauseTiles=!0,this.pausedStreamIds=new c.default,this.pausedBwAttendeeIds=new Set,this.videoPreferencesUpdated=!1,this.logCount=0,this.startupPeriod=!0,this.usingPrevTargetRate=!1,this.rateProbeState="Not Probing",this.firstEstimateTimestamp=0,this.lastUpgradeRateKbps=0,this.timeBeforeAllowSubscribeMs=p.MIN_TIME_BETWEEN_SUBSCRIBE_MS,this.lastProbeTimestamp=Date.now(),this.timeBeforeAllowProbeMs=p.MIN_TIME_BETWEEN_PROBE_MS,this.downlinkStats=new f,this.prevDownlinkStats=new f,this.probeFailed=!1,this.serverSideNetworkAdaption=this.videoPriorityBasedPolicyConfig.serverSideNetworkAdaption}bindToTileController(e){this.tileController=e,this.logger.info("tileController bound")}chooseRemoteVideoSources(e){var t;(null===(t=this.videoPreferences)||void 0===t?void 0:t.equals(e))||(this.videoPreferences=null==e?void 0:e.clone(),this.videoPreferencesUpdated=!0,this.logger.info(`bwe: setVideoPreferences bwe: new preferences: ${JSON.stringify(e)}`))}updateIndex(e){this.videoIndex=e,this.videoPreferences||this.updateDefaultVideoPreferences()}updateDefaultVideoPreferences(){const e=new Set;for(const t of this.videoIndex.remoteStreamDescriptions())e.add(t.attendeeId);const t=d.VideoPreferences.prepare(),n=e.size;let i=l.default.High;n>8?i=l.default.Low:n>4&&(i=l.default.Medium);for(const n of e)t.add(new u.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 f;const t=e.getObservableMetrics();this.downlinkStats.bandwidthEstimateKbps=t.availableIncomingBitrate/1e3;for(const t in e.streamMetricReports){const n=Number.parseInt(t,10),s=e.streamMetricReports[n];s.direction===i.default.DOWNSTREAM&&s.mediaType===r.default.VIDEO&&(s.currentMetrics.hasOwnProperty("nackCount")&&(this.downlinkStats.nackCount+=e.countPerSecond("nackCount",n)),s.currentMetrics.hasOwnProperty("packetsLost")&&(this.downlinkStats.packetsLost+=e.countPerSecond("packetsLost",n)),s.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),c=!this.startupPeriod&&r;if(c&&Date.now()-this.lastSubscribeTimestampe.maxBitrateKbps===t.maxBitrateKbps?e.streamId-t.streamId:e.maxBitrateKbps-t.maxBitrateKbps));for(const e of n)(0===e.avgBitrateKbps||e.avgBitrateKbps>e.maxBitrateKbps)&&(e.attendeeId.endsWith(s.default.Modality)&&e.maxBitrateKbps<100?e.maxBitrateKbps=e.avgBitrateKbps:e.avgBitrateKbps=e.maxBitrateKbps);const l={targetDownlinkBitrate:0,chosenTotalBitrate:0,deltaToNextUpgrade:0};l.targetDownlinkBitrate=this.determineTargetRate();const u=this.subscribedReceiveSet.size(),d=this.downlinkStats.bandwidthEstimateKbps,h=!this.videoPriorityBasedPolicyConfig.allowSubscribe(u,d);if(this.probeFailed&&(this.probeFailed=!1,this.timeBeforeAllowSubscribeMs=p.MIN_TIME_BETWEEN_SUBSCRIBE_MS,c&&h))return;const f=this.priorityPolicy(l,n,t);let m=0;if(this.serverSideNetworkAdaption!==o.default.None&&this.serverSideNetworkAdaption!==o.default.Default||this.startupPeriod||!r?(this.setProbeState("Not Probing"),this.lastUpgradeRateKbps=0):"Probing"===this.rateProbeState?m=this.handleProbe(t,l.targetDownlinkBitrate):0!==l.deltaToNextUpgrade&&(m=this.maybeOverrideOrProbe(t,l,f)),this.prevRemoteInfos=n,this.videoPreferencesUpdated=!1,1===m)return this.logger.info(`bwe: keepSameSubscriptions stats:${JSON.stringify(this.downlinkStats)}`),void(this.prevTargetRateKbps=l.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()<=a.LogLevel.INFO&&(this.logCount%15==0||this.rateProbeState!==i||this.optimalReceiveStreams.length!==t.length||g!==this.pausedBwAttendeeIds.size)&&(this.logger.info(this.policyStateLogStr(n,l.targetDownlinkBitrate)),this.logCount=0),this.logCount++,this.prevTargetRateKbps=l.targetDownlinkBitrate,this.optimalReceiveStreams=t.slice()}calculateOptimalReceiveSet(){const e=new c.default;this.calculateOptimalReceiveStreams();for(const t of this.optimalReceiveStreams)e.add(t.streamId);if(!this.optimalReceiveSet.equal(e)){const t=this.calculateSubscribeRate(this.optimalReceiveStreams);this.logger.info(`bwe: new streamSelection: ${JSON.stringify(e)} subscribedRate:${t}`)}this.optimalReceiveSet=e}determineTargetRate(){let e=0;const t=Date.now();return 0!==this.downlinkStats.bandwidthEstimateKbps?(0===this.firstEstimateTimestamp&&(this.firstEstimateTimestamp=t),this.startupPeriod&&(this.downlinkStats.bandwidthEstimateKbps>p.DEFAULT_BANDWIDTH_KBPS||this.downlinkStats.packetsLost>0||t-this.firstEstimateTimestamp>p.STARTUP_PERIOD_MS&&this.downlinkStats.bandwidthEstimateKbps<=this.prevDownlinkStats.bandwidthEstimateKbps)&&(this.startupPeriod=!1,this.prevTargetRateKbps=this.downlinkStats.bandwidthEstimateKbps),this.startupPeriod?e=p.DEFAULT_BANDWIDTH_KBPS:"Probing"===this.rateProbeState&&this.downlinkStats.usedBandwidthKbps>this.downlinkStats.bandwidthEstimateKbps&&this.downlinkStats.packetsLost"bwe: ValidateRate: Using Previous rate "+this.prevTargetRateKbps)),this.usingPrevTargetRate=!0,e=this.prevTargetRateKbps):this.usingPrevTargetRate=!1,e}setProbeState(e){if(this.rateProbeState===e)return!1;const t=Date.now();switch(e){case"Not Probing":this.probePendingStartTimestamp=0;break;case"Probe Pending":if(!(0===this.lastProbeTimestamp||t-this.lastProbeTimestamp>p.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,p.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;np.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>p.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(p.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=p.MIN_TIME_BETWEEN_PROBE_MS,0):1}maybeOverrideOrProbe(e,t,n){const i=this.chosenStreamsSameAsLast(e);let r=0;const s=t.targetDownlinkBitrate>p.LOW_BITRATE_THRESHOLD_KBPS?p.TARGET_RATE_CHANGE_TRIGGER_PERCENT:2*p.TARGET_RATE_CHANGE_TRIGGER_PERCENT,a=t.targetDownlinkBitrate*s/100;if(this.targetRateBaselineForDeltaCheckKbps=void 0!==this.targetRateBaselineForDeltaCheckKbps?this.targetRateBaselineForDeltaCheckKbps:this.prevTargetRateKbps,!i&&Math.abs(t.targetDownlinkBitrate-this.targetRateBaselineForDeltaCheckKbps)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 c.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),s=(null==n?void 0:n.state().paused)||!1;if(t.some((e=>e.attendeeId===r.attendeeId)))s&&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&&(s||(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(),a=r.highestPriority();let o,c=a;for(;-1!==c;){o=-1;for(const s of r)if(s.priority===c)for(const r of t)r.attendeeId===s.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(s.priority>c){o=s.priority;break}for(const a of r)if(a.priority===c){for(const r of t)if(r.attendeeId===a.attendeeId){const o=n.findIndex((e=>e.groupId===r.groupId&&e.maxBitrateKbpsc)break;if(c===a&&0!==e.deltaToNextUpgrade)break;c=o}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===l.default.High||t===l.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[o.default.None,o.default.BandwidthProbing]}getVideoPreferences(){let e=this.getCurrentVideoPreferences();return e||(e=d.VideoPreferences.prepare().build()),e}}t.default=p,p.DEFAULT_BANDWIDTH_KBPS=2800,p.STARTUP_PERIOD_MS=6e3,p.LARGE_RATE_CHANGE_TRIGGER_PERCENT=20,p.TARGET_RATE_CHANGE_TRIGGER_PERCENT=15,p.LOW_BITRATE_THRESHOLD_KBPS=300,p.MIN_TIME_BETWEEN_PROBE_MS=5e3,p.MIN_TIME_BETWEEN_SUBSCRIBE_MS=2e3,p.MAX_HOLD_BEFORE_PROBE_MS=3e4,p.MAX_ALLOWED_PROBE_TIME_MS=6e4,p.SPURIOUS_PACKET_LOST_THRESHOLD=2,p.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(tn)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,s=this.networkIssueResponseDelayFactor;return 1===e&&(n+=i*s*(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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((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 s=performance.now()-e,a=2e3/this.framerate-s,o=Math.max(0,1e3/this.framerate-s);a<=0&&this.forEachObserver((e=>{e.processingLatencyTooHigh&&e.processingLatencyTooHigh(s)})),this.lastTimeOut=setTimeout(this.process,o)}))}destroy(){if(this.stop(),this.stages)for(const e of this.stages)e.destroy()}get framerate(){return this.fr}set framerate(e){this.fr=e<0?15:e}stop(){if(this.videoInput.removeEventListener("loadedmetadata",this.process),this.videoInput.srcObject=null,this.destroyInputMediaStreamAndBuffers(),this.outputMediaStream)for(const e of this.outputMediaStream.getVideoTracks())e.stop();this.lastTimeOut&&(clearTimeout(this.lastTimeOut),this.lastTimeOut=void 0),this.hasStarted&&(this.hasStarted=!1,this.forEachObserver((e=>{e.processingDidStop&&e.processingDidStop()})))}addObserver(e){this.observers.add(e)}removeObserver(e){this.observers.delete(e)}getInputMediaStream(){return 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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543),s=n(8919);class a{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 s.default(this.logger,this.processors),this.pipe.addObserver(this)}get outputMediaStream(){return this.pipe.outputMediaStream}chooseNewInnerDevice(e){const t=new a(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=a},2801:function(e,t){"use strict";var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((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{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(289),r=n(1508),s=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 s.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 s.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);et.get(e.attendeeId)===e.groupId))),this.streamToAttendeeMap=null,this.streamToExternalUserIdMap=null}subscribeFrameSent(){this.indexForSubscribe=this.currentIndex}integrateSubscribeAckFrame(e){this.currentSubscribeAck=e,this.subscribeTrackToStreamMap=this.buildTrackToStreamMap(this.currentSubscribeAck),this.subscribeSsrcToStreamMap=this.buildSSRCToStreamMap(this.currentSubscribeAck),this.subscribeStreamToAttendeeMap=this.buildStreamToAttendeeMap(this.indexForSubscribe),this.subscribeStreamToExternalUserIdMap=this.buildStreamExternalUserIdMap(this.indexForSubscribe)}integrateBitratesFrame(e){if(this.currentIndex)for(const t of e.bitrates){const e=this.currentIndex.sources.find((e=>e.streamId===t.sourceStreamId));void 0!==e&&(e.avgBitrateBps=t.avgBitrateBps)}}allStreams(){const e=new r.default;if(this.currentIndex)for(const t of this.currentIndex.sources)e.add(t.streamId);return e}allVideoSendingSourcesExcludingSelf(e){const t=[],n=new Set;if(this.currentIndex&&this.currentIndex.sources&&this.currentIndex.sources.length)for(const r of this.currentIndex.sources){const{attendeeId:s,externalUserId:a,mediaType:o}=r;s!==e&&o===i.SdkStreamMediaType.VIDEO&&(n.has(s)||(t.push({attendee:{attendeeId:s,externalUserId:a}}),n.add(s)))}return t}streamSelectionUnderBandwidthConstraint(e,t,n,s){const a=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)||a.add(r.attendeeId));const o=this.buildAttendeeToSortedStreamDescriptorMapExcludingSelf(e),c=new Map;let l=0;o.forEach(((e,t)=>{c.set(t,e[0]),l+=e[0].maxBitrateKbps})),l=this.trySelectHighBitrateForAttendees(o,t,l,s,c),this.trySelectHighBitrateForAttendees(o,a,l,s,c);const u=new r.default;for(const e of c.values())u.add(e.streamId);return u}highestQualityStreamFromEachGroupExcludingSelf(e){const t=new r.default;if(this.currentIndex){const 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);if(void 0===t||!this.subscribeStreamToAttendeeMap)return this.logger.warn(`no attendee found for track ${e}`),"";return this.subscribeStreamToAttendeeMap.get(t)||(this.logger.info(`track ${e} (stream ${t}) does not correspond to a known attendee`),"")}externalUserIdForTrack(e){const t=this.streamIdForTrack(e);if(void 0===t||!this.subscribeStreamToExternalUserIdMap)return this.logger.warn(`no external user id found for track ${e}`),"";return this.subscribeStreamToExternalUserIdMap.get(t)||(this.logger.info(`track ${e} (stream ${t}) does not correspond to a known externalUserId`),"")}attendeeIdForStreamId(e){if(!this.streamToAttendeeMap){if(!this.currentIndex)return"";this.streamToAttendeeMap=this.buildStreamToAttendeeMap(this.currentIndex)}return this.streamToAttendeeMap.get(e)||(this.logger.info(`stream ${e}) does not correspond to a known attendee`),"")}groupIdForStreamId(e){if(this.currentIndex&&this.currentIndex.sources){for(const t of this.currentIndex.sources)if(t.streamId===e)return t.groupId;if(this.indexForSubscribe)for(const t of this.indexForSubscribe.sources)if(t.streamId===e)return t.groupId}}StreamIdsInSameGroup(e,t){return this.groupIdForStreamId(e)===this.groupIdForStreamId(t)}streamIdForTrack(e){if(this.subscribeTrackToStreamMap)return this.subscribeTrackToStreamMap.get(e)}streamIdForSSRC(e){if(this.subscribeSsrcToStreamMap)return this.subscribeSsrcToStreamMap.get(e)}overrideStreamIdMappings(e,t){if(this.subscribeTrackToStreamMap)for(const[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 s of t){if(n>=i)break;if(e.has(s)){const t=e.get(s);for(const e of t.reverse())if(n-r.get(s).maxBitrateKbps+e.maxBitrateKbps{e.sort(((e,t)=>e.maxBitrateKbps>t.maxBitrateKbps?1:e.maxBitrateKbps{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(289),r=n(1318),s=n(6876);class a 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;i0&&(this._localStreamInfos[n].timeEnabled=Date.now()),this._localStreamInfos[n].maxBitrateKbps=r,this._localStreamInfos[n].maxFrameRate=a,this._localStreamInfos[n].disabledByUplinkPolicy=0===r,!0===this._localStreamInfos[n].disabledByUplinkPolicy&&(this._localStreamInfos[n].disabledByWebRTC=!1),n++;else{t=!1;const e=new s.default;e.maxBitrateKbps=r,e.maxFrameRate=a,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)===a.UNSEEN_STREAM_BITRATE?this.streamIdToBitrateKbpsMap.set(e,a.RECENTLY_INACTIVE_STREAM_BITRATE):this.streamIdToBitrateKbpsMap.set(e,a.NOT_SENDING_STREAM_BITRATE));for(let e=0;ea.BitratesMsgFrequencyMs&&(this._localStreamInfos[e].disabledByWebRTC=!0):this._lastBitRateMsgTime-this._localStreamInfos[e].timeEnabled>a.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,a.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{"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),s=n(7804);class a{constructor(e,t,n,i){this.tileController=n,this.devicePixelRatioMonitor=i,this.tileState=new s.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(a.setVideoElementFlag(t,"disablePictureInPicture",n),a.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="",a.setVideoElementFlag(e,"disablePictureInPicture",!1),a.setVideoElementFlag(e,"disableRemotePlayback",!1),e.srcObject=null}}destroy(){this.devicePixelRatioMonitor.removeObserver(this),this.tileState.boundVideoElement&&this.tileState.boundVideoElement.srcObject===this.tileState.boundVideoStream&&a.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,!1),this.tileState=new s.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,s,a,o){let c=!1;this.tileState.boundAttendeeId!==e&&(this.tileState.boundAttendeeId=e,new r.default(e).hasModality(r.default.MODALITY_CONTENT)&&(this.tileState.isContent=!0),c=!0),this.tileState.boundExternalUserId!==o&&(this.tileState.boundExternalUserId=o,c=!0),this.tileState.localTile!==t&&(this.tileState.localTile=t,c=!0),this.tileState.boundVideoStream!==n&&(this.tileState.boundVideoStream=n,c=!0),this.tileState.videoStreamContentWidth!==i&&(this.tileState.videoStreamContentWidth=i,c=!0),this.tileState.videoStreamContentHeight!==s&&(this.tileState.videoStreamContentHeight=s,c=!0),this.tileState.streamId!==a&&(this.tileState.streamId=a,c=!0),c&&this.sendTileStateUpdate()}bindVideoElement(e){let t=!1;this.tileState.boundVideoElement!==e&&(this.tileState.boundVideoElement=e,t=!0),null!==this.tileState.boundVideoElement?(this.tileState.videoElementCSSWidthPixels!==e.clientWidth&&(this.tileState.videoElementCSSWidthPixels=e.clientWidth,t=!0),this.tileState.videoElementCSSHeightPixels!==e.clientHeight&&(this.tileState.videoElementCSSHeightPixels=e.clientHeight,t=!0)):(this.tileState.videoElementCSSWidthPixels=null,this.tileState.videoElementCSSHeightPixels=null),t&&this.sendTileStateUpdate()}pause(){this.tileState.paused||(this.tileState.paused=!0,this.sendTileStateUpdate())}unpause(){this.tileState.paused&&(this.tileState.paused=!1,this.sendTileStateUpdate())}markPoorConnection(){return!this.tileState.poorConnection&&(this.tileState.poorConnection=!0,this.sendTileStateUpdate(),!0)}unmarkPoorConnection(){return!!this.tileState.poorConnection&&(this.tileState.poorConnection=!1,this.sendTileStateUpdate(),!0)}capture(){if(!this.tileState.active)return null;const e=document.createElement("canvas"),t=this.tileState.boundVideoElement;e.width=t.videoWidth||t.width,e.height=t.videoHeight||t.height;const 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?a.connectVideoStreamToVideoElement(this.tileState.boundVideoStream,this.tileState.boundVideoElement,this.tileState.localTile):a.disconnectVideoStreamFromVideoElement(this.tileState.boundVideoElement,this.tileState.paused,this.tileController.keepLastFrameWhenPaused)}static setVideoElementFlag(e,t,n){t in e&&(e[t]=n)}}t.default=a},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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(8236),s=n(9190),a=n(8660),o=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 s.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"),o.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=>{a.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=>{a.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),s=n(8660),a=n(1133),o=n(9394);class c{constructor(e,t){this.selfAttendeeId=e,this.logger=t,this.numSenders=0,this.shouldDisableSimulcast=!1,this.newQualityMap=new Map,this.currentQualityMap=new Map,this.newActiveStreams=1,this.currentActiveStreams=1,this.lastUplinkBandwidthKbps=c.defaultUplinkBandwidthKbps,this.startTimeMs=0,this.lastUpdatedMs=Date.now(),this.videoIndex=null,this.currLocalDescriptions=[],this.nextLocalDescriptions=[],this.observerQueue=new Set,this.optimalParameters=new a.default(0,0,0,0,!0),this.parametersInEffect=new a.default(0,0,0,0,!0),this.lastUplinkBandwidthKbps=c.defaultUplinkBandwidthKbps,this.currentQualityMap=this.fillEncodingParamWithBitrates([300,0,1200]),this.newQualityMap=this.fillEncodingParamWithBitrates([300,0,1200])}updateConnectionMetric({uplinkKbps:e=0}){if(isNaN(e))return;0===this.startTimeMs&&(this.startTimeMs=Date.now()),Date.now()-this.startTimeMs`simulcast: uplink policy update metrics ${this.lastUplinkBandwidthKbps}`));let t=c.holdDownDurationMs;3===this.currentActiveStreams?t=2*c.holdDownDurationMs:(2===this.currentActiveStreams&&e<=c.kMidDisabledRate||1===this.currentActiveStreams&&e<=c.kHiDisabledRate)&&(t=c.holdDownDurationMs/2),Date.now()=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>=c.kHiDisabledRate?(this.newActiveStreams=1,t[0].maxBitrateKbps=300,t[1].maxBitrateKbps=0,t[2].maxBitrateKbps=1200):this.lastUplinkBandwidthKbps>=c.kMidDisabledRate?(this.newActiveStreams=2,t[0].maxBitrateKbps=this.lastUplinkBandwidthKbps>=350?200:150,t[1].maxBitrateKbps=this.numSenders<=6?600:350,t[2].maxBitrateKbps=0):(this.newActiveStreams=3,t[0].maxBitrateKbps=300,t[1].maxBitrateKbps=0,t[2].maxBitrateKbps=0);const e=t.map(((e,t,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,s=this.shouldDisableSimulcast!==r;this.numSenders=t,this.shouldDisableSimulcast=r,this.optimalParameters=new a.default(this.captureWidth(),this.captureHeight(),this.captureFrameRate(),this.maxBandwidthKbps(),!1),this.videoIndex=e,this.newQualityMap=this.calculateEncodingParameters(n||s)}wantsResubscribe(){let e=!this.encodingParametersEqual();this.nextLocalDescriptions=this.videoIndex.localStreamDescriptions();for(let t=0;te.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 s=this.shouldDisableSimulcast?1:4;for(let e=0;e0,scaleResolutionDownBy:Math.max(s,1),maxBitrate:1e3*i[e]}),s/=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=>{s.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=c,c.defaultUplinkBandwidthKbps=1200,c.startupDurationMs=6e3,c.holdDownDurationMs=4e3,c.defaultMaxFrameRate=15,c.kHiDisabledRate=700,c.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,s,a,o,c,l,u,d,h;const f=new Map,p=i.default.NAME_ARR_ASCENDING;return f.set(p[0],{rid:p[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===(a=null===(s=this.encodingParams)||void 0===s?void 0:s.low)||void 0===a?void 0:a.maxFramerate)||5}),f.set(p[1],{rid:p[1],active:!0,scaleResolutionDownBy:(null===(c=null===(o=this.encodingParams)||void 0===o?void 0:o.high)||void 0===c?void 0:c.scaleResolutionDownBy)||1,maxBitrate:1e3*((null===(u=null===(l=this.encodingParams)||void 0===l?void 0:l.high)||void 0===u?void 0:u.maxBitrateKbps)||1200),maxFramerate:null===(h=null===(d=this.encodingParams)||void 0===d?void 0:d.high)||void 0===h?void 0:h.maxFramerate}),this.getQualityMapString(f),f}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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(1133);class s{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(s.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 s=e.numberOfVideoPublishingParticipantsExcludingSelf(this.selfAttendeeId)+(n?1:0);if(this.numberOfPublishedVideoSources!==s){if(this.numberOfPublishedVideoSources=s,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(s.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=s.targetHeightArray[Math.min(this.getNumberOfPublishedVideoSources(),s.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=s,s.encodingMapKey="video",s.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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VoiceFocusDeviceTransformer=void 0;const r=n(6035),s=n(8690),a=n(4046),o=n(3928),c=n(8878),l=n(851);class u{constructor(e,{preload:t=!0,logger:n,fetchBehavior:i=u.defaultFetchBehavior()},r){this.spec=e,this.supported=!0,this.logger=n,this.vfLogger=n?new o.default(n):void 0,this.preload=t,this.fetchBehavior=i,this.spec=u.augmentSpec(this.spec),r&&(this.configuration=Promise.resolve(r))}static isSupported(e,t){var n,i;const a={fetchBehavior:u.defaultFetchBehavior(),logger:(null==t?void 0:t.logger)?new o.default(t.logger):void 0};if(s.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(u.augmentSpec(e),a)}static create(e={},t={},n,r,s){var a,o,c;return i(this,void 0,void 0,(function*(){r&&r.Meeting.Meeting&&(r=r.Meeting);const i="AVAILABLE"===(null===(c=null===(o=null===(a=null==r?void 0:r.Meeting)||void 0===a?void 0:a.MeetingFeatures)||void 0===o?void 0:o.Audio)||void 0===c?void 0:c.EchoReduction),s=n&&!0===n.supported&&"ns_es"===n.model.name&&!i,l="ns_es"===e.name&&!i;if(s||l)throw new Error("Echo Reduction requested but not enabled.");const d=new u(e,t,n);return yield d.init(),d}))}static configure(e={},t={}){return i(this,void 0,void 0,(function*(){return new u(e,t,void 0).configure(!0)}))}getConfiguration(){return this.configuration}isSupported(){return this.supported}createTransformDevice(e,t){return i(this,void 0,void 0,(function*(){if(this.supported)try{const n=!0,[i,r]=yield this.allocateVoiceFocus(n),s=Object.assign(Object.assign({},t),{es:"ns_es"===this.spec.name});return new c.default(e,i,r,s)}catch(e){return}}))}static augmentSpec(e){return e&&(e.assetGroup||e.revisionID)?e:Object.assign(Object.assign({},e),{assetGroup:u.currentSDKAssetGroup()})}configure(e=!1){return 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 l.default;return[yield r.VoiceFocus.init(e,{delegate:n,preload:t,logger:this.vfLogger}),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 a.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|[1-9][0-9]*)/)[0]}static majorMinorVersion(){return a.default.sdkVersion.match(/^[1-9][0-9]*\.(?:0|(?:[1-9][0-9]*))\.(?:0|[1-9][0-9]*)/)[0]}static currentSDKAssetGroup(){const e=this.majorVersion();return e?`sdk-${e}`:"stable-v1"}static defaultFetchBehavior(){const e=u.majorMinorVersion()||"unknown",t=a.default.sdkUserAgentLowResolution;return{escapedQueryString:`sdk=${encodeURIComponent(e)}&ua=${encodeURIComponent(t)}`}}}t.VoiceFocusDeviceTransformer=u,t.default=u},8878:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(543);class s{constructor(e,t,n,i,s=!1,a,o=new r.default,c=new Map,l,u){this.device=e,this.voiceFocus=t,this.delegate=n,this.nodeOptions=i,this.failed=s,this.node=a,this.browserBehavior=o,this.farEndStreamToAudioSourceNode=c,this.mixDestNode=l,this.mixSourceNode=u}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 s(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=s},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,s=n.hasOwnProperty("muted"),a=!!n.dropped;if(i){this.attendeeIdToStreamId[n.attendeeId]&&this.attendeeIdToStreamId[n.attendeeId]n.audioStreamId&&this.streamIdToAttendeeId[t]===i){s=!0;break}}s||this.realtimeController.realtimeSetAttendeeIdPresence(i,!1,r,a,{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],s=this.streamIdToExternalUserId[i];let a=null,o=null;null!==e&&(a=e.hasOwnProperty(r)?e[r]:n.IMPLICIT_VOLUME),null!==t&&(o=t.hasOwnProperty(r)?t[r]:n.IMPLICIT_SIGNAL_STRENGTH),null===a&&null===o||this.realtimeController.realtimeUpdateVolumeIndicator(r,a,null,o,s)}}attendeeIdForStreamId(e){if(0===e)return null;return this.streamIdToAttendeeId[e]||(this.warnedAboutMissingStreamIdMapping[e]||(this.warnedAboutMissingStreamIdMapping[e]=!0,this.logger.warn(`volume indicator stream id ${e} seen before being defined`)),null)}}t.default=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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.decideModel=t.measureAndDecideExecutionApproach=void 0;const r=n(5021),s=n(9424),a={wasm:{noSupport:.07,inline:{c100:1,c50:.36,c20:.16,c10:.07},worker:{c100:.5,c50:.18,c20:.08,c10:.06}},simd:{noSupport:.1,inline:{c100:1,c50:.43,c20:.3,c10:.2},worker:{c100:.5,c50:.21,c20:.15,c10:.1}}};class o{constructor(e,t){this.fetchConfig=e,this.logger=t;const 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 s;s=e=>{const{message:a,key:o}=e.data;a===t&&o===n&&(r.removeEventListener("message",s),i(e.data))},r.addEventListener("message",s),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,s=`bench:${e}`,a={message:"measure",fetchBehavior:this.fetchBehavior,budget:t,path:r,key:s};return this.roundtrip(a,"measurement",s).then((e=>{if(e.measurement)return e.measurement;throw new Error("Failed to measure.")}))}stop(){this.worker.then((e=>{var t;null===(t=this.logger)||void 0===t||t.debug("Stopping estimator worker."),e.terminate()})).catch((e=>{}))}}const c=(e,t,n,r)=>i(void 0,void 0,void 0,(function*(){const i={supportsSIMD:e,supportsSAB:s.supportsSharedArrayBuffer(globalThis,window,n),duration:-1};if(e)return null==n||n.info("Supports SIMD: true (force)"),i;const a=!r,c=r||new o(t,n);try{const t=!s.isOldChrome(window,n)&&(yield c.supportsSIMD());return null==n||n.info(`Supports SIMD: ${t} (force: ${e})`),i.supportsSIMD=t,i}finally{a&&c.stop()}}));t.measureAndDecideExecutionApproach=(e,t,n,r=a)=>i(void 0,void 0,void 0,(function*(){let l=e.executionPreference;const{usagePreference:u,variantPreference:d,namePreference:h,simdPreference:f,estimatorBudget:p,executionQuantaPreference:m}=e;"interactivity"===u&&"inline"!==l&&(null==n||n.debug(`Overriding execution preference ${l} to reflect interactivity preference.`),l="inline");const g="force"===f,v="auto"!==d,y="auto"!==l;let b;try{b=v&&y?yield c(g,t,n):yield((e,t,n,r)=>i(void 0,void 0,void 0,(function*(){const i=new o(t,r);try{const s=yield c(e,t,r,i);if(s.supportsSIMD)try{return s.duration=yield i.measure(!0,n),null==r||r.info("SIMD timing:",s.duration),s}catch(e){null==r||r.warn("Failed SIMD estimation; falling back to non-SIMD."),s.supportsSIMD=!1}return s.duration=yield i.measure(!1,n),null==r||r.info("No-SIMD timing:",s.duration),s}catch(e){throw null==r||r.error("Could not feature check.",e),e}finally{i.stop()}})))(g,t,p,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:o="auto",namePreference:c="default",usagePreference:l,executionQuantaPreference:u=3},d=a,h)=>{const f="force"===r||"disable"!==r&&e,p=-1!==n,m=p?(f?2.5:2.63)/n:0,g=f?d.simd:d.wasm,v=p?((e,t)=>1===e?.6:"quality"===t?.65*e:.5*e)(u,l)*m:0,y=p?.7*m:0,b=c,x=e=>({supported:!1,reason:e});if(p){if(m({supported:!0,useSIMD:f,processor:e,executionApproach:t,variant:n,executionQuanta:"inline"===t?u:void 0,name:b}),M=(e,t,n)=>"auto"!==t?!p||e>n[t]?t:"failed":e>n.c100?"c100":e>n.c50?"c50":e>n.c20?"c20":e>n.c10?"c10":"failed",S=e=>{switch(e||"auto"){case"auto":{let e=S("inline"),t=S("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 s.supportsSharedArrayBuffer(globalThis,window,h)?S("worker-sab"):S("worker-postMessage");case"inline":{const e=M(v,o,g.inline);return"failed"===e?x(`Performance score ${v} not sufficient for inline use with variant preference ${o}.`):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=M(y,o,g.worker);return"failed"===e?x(`Performance score ${y} not sufficient for worker use with variant preference ${o}.`):w("voicefocus-worker-sab-processor","worker-sab",e)}case"worker-postMessage":{const e=M(y,o,g.worker);if("failed"===e)return x(`Performance score ${y} not sufficient for worker use.`);if("ns_es"===b){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 S(i)})(Object.assign(Object.assign({},b),{simdPreference:f,executionPreference:l,variantPreference:d,namePreference:h,usagePreference:u,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 s=r(e,n),a=i(t,n);return fetch(s,a)}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 s={method:"HEAD",mode:"cors",credentials:"omit",redirect:"follow",referrerPolicy:"origin"};t.resolveURL=function(e,t){return n(e,s,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,s)=>{null==s||s.debug(`Loading ${t} worker from ${e}.`);let a=!1;try{a=self.origin===new URL(e).origin}catch(e){null==s||s.error("Could not compare origins.",e)}if(a){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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((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)||(s(e)||0)<95),t.supportsVoiceFocusWorker=(e=globalThis,n,s)=>i(void 0,void 0,void 0,(function*(){if(!t.supportsWorker(e,s))return!1;const i=`${n.paths.workers}worker-v1.js`;try{const e=yield r.loadWorker(i,"VoiceFocusTestWorker",n,s);try{e.terminate()}catch(e){null==s||s.debug("Failed to terminate worker.",e)}return!0}catch(e){return null==s||s.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 s=(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=s(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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getAudioInput=t.createAudioContext=t.VoiceFocus=void 0;const r=n(5995),s=n(623),a=n(5021),o=n(9424),c=n(2633),l=n(1678),u=n(271),d={useVoiceFocusAGC:!1,useBuiltInAGC:!0},h="stable-v1",f="https://static.sdkassets.chime.aws",p={processors:`${f}/processors/`,workers:`${f}/workers/`,wasm:`${f}/wasm/`,models:`${f}/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}),y=Object.assign(Object.assign({},g),{autoGainControl:!1,googAutoGainControl:!1,googAutoGainControl2:!1}),b={"voicefocus-worker-sab-processor":{file:"worklet-worker-sab-processor-v1.js",node:l.default},"voicefocus-worker-postMessage-processor":{file:"worklet-worker-postMessage-processor-v1.js",node:u.default},"voicefocus-inline-processor":{file:"worklet-inline-processor-v1.js",node:c.default}},x=(e,t)=>{if(void 0!==e&&!s.isValidAssetGroup(e))throw new Error(`Invalid asset group ${e}`);if(void 0!==t&&!s.isValidRevisionID(t))throw new Error(`Invalid revision ID ${t}`)},w=(e,t)=>`${t.models}${r.decideModel(e)}.wasm`;class M{constructor(e,t,n,i,r){this.processorURL=t,this.nodeConstructor=n,this.nodeOptions=i,this.executionQuanta=r,this.internal={worker:e,nodeOptions:i}}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(!o.supportsAudioWorklet(globalThis,i))return null==i||i.debug("Browser does not support Audio Worklet."),Promise.resolve(!1);if(!o.supportsWASM(globalThis,i))return null==i||i.debug("Browser does not support WASM."),Promise.resolve(!1);o.supportsWASMStreaming(globalThis,i)||null==i||i.debug("Browser does not support streaming WASM compilation.");const{assetGroup:r=h,revisionID:a,paths:c=p}=e||{};x(r,a);const l=a?{revisionID:a}:{assetGroup:r},u=s.addQueryParams(n,l),d=Object.assign(Object.assign({},u),{paths:c});return o.supportsVoiceFocusWorker(globalThis,d,i)}static mungeExecutionPreference(e,t){const n=void 0===e||"auto"===e;if(o.isSafari(globalThis)){if(n||"inline"===e)return"inline";if(!n)throw new Error(`Unsupported execution preference ${e}`)}if("worker-sab"===e&&!o.supportsSharedArrayBuffer(globalThis,globalThis,t))throw new Error(`Unsupported execution preference ${e}`);return e||"auto"}static configure(e,t){return i(this,void 0,void 0,(function*(){const{fetchBehavior:n,preResolve:i,logger:a}=t||{},{category:o="voicefocus",name:c="default",variant:l="auto",assetGroup:u=h,revisionID:d,simd:f="detect",executionPreference:m="auto",executionQuantaPreference:g,usagePreference:v="interactivity",estimatorBudget:y=100,paths:b=p,thresholds:M}=e||{};if(null==a||a.debug("Configuring Voice Focus with spec",e),void 0!==o&&"voicefocus"!==o)throw new Error(`Unrecognized category ${o}`);if(void 0!==c&&"default"!==c&&"ns_es"!==c)throw new Error(`Unrecognized feature name ${c}`);if(void 0!==l&&!["auto","c100","c50","c20","c10"].includes(l))throw new Error(`Unrecognized feature variant ${l}`);if(void 0!==g&&![1,2,3].includes(g))throw new Error(`Unrecognized execution quanta preference ${g}`);if(x(u,d),void 0!==f&&!["detect","force","disable"].includes(f))throw new Error(`Unrecognized SIMD option ${f}`);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 S={executionPreference:this.mungeExecutionPreference(m,a),usagePreference:v,executionQuantaPreference:g,variantPreference:l,namePreference:c,simdPreference:f,estimatorBudget:y},_=d?{revisionID:d}:{assetGroup:u},C=s.addQueryParams(n,_),E=Object.assign({paths:b},C),T=yield r.measureAndDecideExecutionApproach(S,E,a,M);if(!1===T.supported)return{supported:!1,reason:T.reason};null==a||a.info("Decided execution approach",T);const{useSIMD:L,processor:A,variant:z,executionQuanta:R}=T,P={category:o||"voicefocus",name:c||"default",variant:z,simd:L};if(i){const e=w(P,b);P.url=yield s.resolveURL(e,C)}return{fetchConfig:E,model:P,processor:A,executionQuanta:R,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:s,fetchConfig:c,executionQuanta:l}=e,{simd:u,name:d}=i,{paths:h}=c;if("voicefocus-inline-processor"!==s&&"voicefocus-worker-postMessage-processor"!==s&&"voicefocus-worker-sab-processor"!==s)throw new Error(`Unknown processor ${s}`);const f=i.url||w(i,h);null==r||r.debug(`Using model URL ${f}.`);const p=`${h.wasm}audio_buffer-v1${u?"_simd":""}.wasm`,m=`${h.wasm}resampler-v1${u?"_simd":""}.wasm`,g=`${h.workers}worker-v1.js`,{file:v,node:y}=b[s],x=`${h.processors}${v}`,S=yield a.loadWorker(g,"VoiceFocusWorker",c,r);if(n){null==r||r.debug("Preloading",f);let e=o.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";S.postMessage({message:e,preload:!0,key:"model",fetchBehavior:c,path:f})}const _=new M(S,x,y,{processor:s,worker:S,audioBufferURL:p,resamplerURL:m,fetchBehavior:c,modelURL:f,delegate:t,logger:r,numberOfInputs:"ns_es"===d?2:1},l);return Promise.resolve(_)}))}createNode(e,t){var n;const{voiceFocusSampleRate:i=(16e3===e.sampleRate?16e3:48e3),enabled:r=!0,agc:a=d}=t||{},o=null==t?void 0:t.es,c={voiceFocusSampleRate:i,enabled:r,sendBufferCount:10,prefill:6,agc:a,executionQuanta:this.executionQuanta,supportFarendStream:o},l=s.withQueryString(this.processorURL,null===(n=this.nodeOptions)||void 0===n?void 0:n.fetchBehavior);return e.audioWorklet.addModule(l).then((()=>new this.nodeConstructor(e,Object.assign(Object.assign({},this.nodeOptions),{processorOptions:c}))))}applyToStream(e,t,n){return i(this,void 0,void 0,(function*(){const i=t.createMediaStreamSource(e),r=yield this.applyToSourceNode(i,t,n),s=t.createMediaStreamDestination();return r.connect(s),{node:r,source:i,destination:s,stream:s.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}))}}t.VoiceFocus=M,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:s,spec:a,delegate:o,preload:c=!0,options:l}=t,{logger:u}=n,h=yield M.configure(a,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(s);const f=yield M.init(h,{delegate:o,preload:c,logger:u}),p=(null===(r=t.options)||void 0===r?void 0:r.agc)||d,m=yield window.navigator.mediaDevices.getUserMedia(((e,t)=>{let n;if(n=t.useBuiltInAGC?v:y,!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)})})(s,p));return f.applyToStream(m,e,l).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,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9424),s=n(103);class a extends s.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.cpuWarningCount=0,this.channelCountMode="explicit",this.channelCount=1;const{modelURL:n,worker:i,fetchBehavior:s,logger:a,delegate:o}=t;this.logger=a,this.port.onmessage=this.onProcessorMessage.bind(this),this.delegate=o,a&&a.debug("VoiceFocusInlineNode:",n),this.worker=i,this.worker.onmessage=this.onWorkerMessage.bind(this);const c=r.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:c,key:"model",fetchBehavior:s,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,s=Math.abs(e-i);(!this.cpuWarningLastTriggered||s>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=a},271:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9424),s=n(103);class a extends s.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.channelCountMode="explicit",this.channelCount=1;const{modelURL:n,audioBufferURL:i,worker:s,fetchBehavior:a,delegate:o}=t;this.delegate=o,this.worker=s,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:c,agc:l,supportFarendStream:u}=t.processorOptions;this.worker.postMessage({message:"init",approach:"postMessage",frames:16e3===e.sampleRate?160:480,enabled:c,agc:l,fetchBehavior:a,model:n,supportFarendStream:u});const d=r.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:d,key:"buffer",fetchBehavior:a,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=a},1678:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(9424),s=n(103);class a extends s.VoiceFocusAudioWorkletNode{constructor(e,t){super(e,t.processor,t),this.channelCountMode="explicit",this.channelCount=1;const{modelURL:n,resamplerURL:i,worker:s,fetchBehavior:a,delegate:o}=t;this.delegate=o,this.worker=s,this.worker.onmessage=this.onWorkerMessage.bind(this),this.port.onmessage=this.onProcessorMessage.bind(this);const{enabled:c,supportFarendStream:l}=t.processorOptions;this.worker.postMessage({message:"init",approach:"sab",frames:16e3===e.sampleRate?160:480,enabled:c,model:n,supportFarendStream:l});const u=r.supportsWASMPostMessage(globalThis)?"get-module":"get-module-buffer";this.worker.postMessage({message:u,key:"resampler",fetchBehavior:a,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=a},9742:(e,t)=>{"use strict";t.byteLength=function(e){var t=c(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,s=c(e),a=s[0],o=s[1],l=new r(function(e,t,n){return 3*(t+n)/4-n}(0,a,o)),u=0,d=o>0?a-4:a;for(n=0;n>16&255,l[u++]=t>>8&255,l[u++]=255&t;return 2===o&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,l[u++]=255&t),1===o&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t),l},t.fromByteArray=function(e){for(var t,i=e.length,r=i%3,s=[],a=16383,o=0,c=i-r;oc?c:o+a));return 1===r?(t=e[i-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=s.length;a0)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 l(e,t,i){for(var r,s,a=[],o=t;o>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return a.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),s=e.getVersionPrecision(n),a=Math.max(r,s),o=0,c=e.map([t,n],(function(t){var n=a-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&&(o=a-Math.min(r,s)),a-=1;a>=o;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===o)return 0;a-=1}else if(c[0][a]1?r-1:0),a=1;a0){var a=Object.keys(n),c=o.default.find(a,(function(e){return t.isOS(e)}));if(c){var l=this.satisfies(n[c]);if(void 0!==l)return l}var u=o.default.find(a,(function(e){return t.isPlatform(e)}));if(u){var d=this.satisfies(n[u]);if(void 0!==d)return d}}if(s>0){var h=Object.keys(r),f=o.default.find(h,(function(e){return t.isBrowser(e,!0)}));if(void 0!==f)return this.compareVersion(r[f])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var n=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),r=o.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(o.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=l,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},s=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},n=r.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||r.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},n=r.default.getFirstMatch(s,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(s,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},n=r.default.getFirstMatch(s,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(s,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(s,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(s,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(s,e);return n&&(t.version=n),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},n=r.default.getFirstMatch(s,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(s,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(s,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},n=r.default.getFirstMatch(s,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(s,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(s,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(s,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(s,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(s,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(s,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(s,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(s,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(s,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(s,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(s,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(s,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(s,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},n=r.default.getFirstMatch(s,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},n=r.default.getFirstMatch(s,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=a,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},s=n(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=r.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:s.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:s.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:s.OS_MAP.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:s.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:s.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:s.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:s.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:s.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:s.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=r.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=r.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:s.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:s.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=r.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:s.OS_MAP.PlayStation4,version:t}}}];t.default=a,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},s=n(18),a=[{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:s.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:s.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:s.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:s.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:s.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:s.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:s.PLATFORMS_MAP.tv}}}];t.default=a,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},s=n(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:s.ENGINE_MAP.Blink};var t=r.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:s.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:s.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:s.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:s.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:s.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:s.ENGINE_MAP.WebKit},n=r.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];t.default=a,e.exports=t.default}})},5420:(e,t,n)=>{var i=n(8764).Buffer,r=Object.prototype.toString,s=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 a=e,"ArrayBuffer"===r.call(a).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 s?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 s?i.from(e,t):new i(e,t)}(e,t):s?i.from(e):new i(e);var a}},8764:(e,t,n)=>{"use strict";const i=n(9742),r=n(645),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const a=2147483647;function o(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|m(e,t);let i=o(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(K(e,Uint8Array)){const t=new Uint8Array(e);return f(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(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return f(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return f(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 c.from(i,t,n);const r=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=o(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||Y(e.length)?o(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 c.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 u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),o(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),n=o(t);for(let i=0;i=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(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 $(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 z(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return L(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(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 y(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),Y(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=c.from(t,i)),c.isBuffer(t))return 0===t.length?-1:b(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):b(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,i,r){let s,a=1,o=e.length,c=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;a=2,o/=2,c/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(r){let i=-1;for(s=n;so&&(n=o-c),s=n;s>=0;s--){let n=!0;for(let i=0;ir&&(i=r):i=r;const s=t.length;let a;for(i>s/2&&(i=s/2),a=0;a>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function C(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function E(e,t,n){n=Math.min(e.length,n);const i=[];let r=t;for(;r239?4:t>223?3:t>191?2:1;if(r+a<=n){let n,i,o,c;switch(a){case 1:t<128&&(s=t);break;case 2:n=e[r+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(s=c));break;case 3:n=e[r+1],i=e[r+2],128==(192&n)&&128==(192&i)&&(c=(15&t)<<12|(63&n)<<6|63&i,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:n=e[r+1],i=e[r+2],o=e[r+3],128==(192&n)&&128==(192&i)&&128==(192&o)&&(c=(15&t)<<18|(63&n)<<12|(63&i)<<6|63&o,c>65535&&c<1114112&&(s=c))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=a}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let n="",i=0;for(;ii.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(i,r)):Uint8Array.prototype.set.call(i,t,r);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,r)}r+=t.length}return i},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(e,t,n,i,r){if(K(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===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 s=(r>>>=0)-(i>>>=0),a=(n>>>=0)-(t>>>=0);const o=Math.min(s,a),l=this.slice(i,r),u=e.slice(t,n);for(let e=0;e>>=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 s=!1;for(;;)switch(i){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":case"latin1":case"binary":return M(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function L(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;ri)&&(n=i);let r="";for(let i=t;in)throw new RangeError("Trying to access beyond buffer length")}function H(e,t,n,i,r,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||te.length)throw new RangeError("Index out of range")}function k(e,t,n,i,r){U(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function I(e,t,n,i,r){U(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n+7]=s,s>>=8,e[n+6]=s,s>>=8,e[n+5]=s,s>>=8,e[n+4]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function V(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function N(e,t,n,i,s){return t=+t,n>>>=0,s||V(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function D(e,t,n,i,s){return t=+t,n>>>=0,s||V(e,0,n,8),r.write(e,t,n,i,52,8),n+8}c.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>>=0,t>>>=0,n||P(e,t,this.length);let i=this[e],r=1,s=0;for(;++s>>=0,t>>>=0,n||P(e,t,this.length);let i=this[e+--t],r=1;for(;t>0&&(r*=256);)i+=this[e+--t]*r;return i},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Z((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||G(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)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||G(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)<>>=0,t>>>=0,n||P(e,t,this.length);let i=this[e],r=1,s=0;for(;++s=r&&(i-=Math.pow(2,8*t)),i},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let i=t,r=1,s=this[e+--i];for(;i>0&&(r*=256);)s+=this[e+--i]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Z((function(e){W(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||G(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(i)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||G(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<>>=0,t||P(e,4,this.length),r.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),r.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),r.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),r.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,i){e=+e,t>>>=0,n>>>=0,i||H(this,e,t,n,Math.pow(2,8*n)-1,0);let r=1,s=0;for(this[t]=255&e;++s>>=0,n>>>=0,i||H(this,e,t,n,Math.pow(2,8*n)-1,0);let r=n-1,s=1;for(this[t+r]=255&e;--r>=0&&(s*=256);)this[t+r]=e/s&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Z((function(e,t=0){return k(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Z((function(e,t=0){return I(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);H(this,e,t,n,i-1,-i)}let r=0,s=1,a=0;for(this[t]=255&e;++r>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);H(this,e,t,n,i-1,-i)}let r=n-1,s=1,a=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===a&&0!==this[t+r+1]&&(a=1),this[t+r]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||H(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Z((function(e,t=0){return k(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Z((function(e,t=0){return I(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return N(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return N(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,i){if(!c.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=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>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(r=t;r=i+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function U(e,t,n,i,r,s){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new O.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||G(t,e.length-(n+1))}(i,r,s)}function W(e,t){if("number"!=typeof e)throw new O.ERR_INVALID_ARG_TYPE(t,"number",e)}function G(e,t,n){if(Math.floor(e)!==e)throw W(e,n),new O.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new O.ERR_BUFFER_OUT_OF_BOUNDS;throw new O.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let i=`The value of "${e}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=B(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=B(r)),r+="n"),i+=` It must be ${t}. Received ${r}`,i}),RangeError);const j=/[^+/0-9A-Za-z-_]/g;function q(e,t){let n;t=t||1/0;const i=e.length;let r=null;const s=[];for(let a=0;a55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.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;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function $(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,n,i){let r;for(r=0;r=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}const J=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?Q:e}function Q(){throw new Error("BigInt not supported")}},58:(e,t,n)=>{"use strict";n.d(t,{Z:()=>m});var i=n(8081),r=n.n(i),s=n(3645),a=n.n(s),o=n(8817),c=n(8243),l=n(5301),u=n(8444),d=n(9789),h=n(7051),f=n(3317),p=a()(r());p.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);"]),p.i(o.Z),p.i(c.Z),p.i(l.Z),p.i(u.Z),p.i(d.Z),p.i(h.Z),p.i(f.Z),p.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-animation: ease-in-out;\n\n --header-height: 1.5rem;\n --right-sidebar-width: 320px;\n\n --dialog-border-color: rgba(100, 100, 100, 1);\n --dialog-shadow-color: rgba(0, 0, 0, 0.3);\n --dialog-background-color: rgba(255, 255, 255, 1);\n --dialog-primary-color: rgba(19, 70, 209, 1);\n --dialog-active-color: rgba(40, 70, 209, 1);\n --dialog-input-border-color: rgba(200, 200, 200, 1);\n --dialog-submit-button-color: rgba(180, 190, 230, 1);\n --dialog-cancel-button-color: rgba(235, 80, 80, 1);\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: "Poppins", sans-serif;\n}\nhtml {\n font-size: 16px;\n}\nbody {\n height: 100%;\n width: 100%;\n color: var(--text-color);\n background: linear-gradient(45deg, var(--company-color1) 0, 5%, var(--company-color2) 5% 10%, var(--company-color3) 10% 80%, var(--company-color1) 80% 85%, var(--company-color2) 85% 100%);\n}\n\n.application-container {\n position: relative;\n height: 100vh;\n width: 100%;\n overflow: hidden;\n list-style-type: none;\n}\n',""]);const m=p},8817:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(8081),r=n.n(i),s=n(3645),a=n.n(s)()(r());a.push([e.id,".front-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n margin-top: 30px;\n}\n.front-title {\n font-size: 4rem;\n font-weight: 100;\n}\n.front-description {\n font-size: 0.9rem;\n text-align: center;\n}\n.front-description-img {\n height: 2rem;\n width: 50%;\n height: 50%;\n border: 3px solid;\n}\n.front-description-strong {\n color: #f66;\n font-size: 0.9rem;\n font-weight: 600;\n}\n.front-start-button {\n font-size: 4rem;\n border: 3px solid #333;\n width: 500px;\n padding: 15px;\n cursor: pointer;\n text-align: center;\n margin: 100px 0 0 0 auto;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n.front-start-button-color {\n background: #eef;\n}\n.trainer-front-start-button-color {\n background: #efe;\n}\n.front-note {\n font-size: 1rem;\n}\n.front-attention {\n font-size: 0.8rem;\n color: #f55;\n font-weight: 600;\n}\n.front-disclaimer {\n font-size: 0.8rem;\n}\n",""]);const o=a},8243:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(8081),r=n.n(i),s=n(3645),a=n.n(s)()(r());a.push([e.id,'/* Header */\n.header-container {\n position: fixed;\n top: 0px;\n left: 0px;\n height: var(--header-height);\n width: 100vw;\n}\n/* Body*/\n.body-container {\n position: fixed;\n top: var(--header-height);\n left: 0px;\n height: calc(100vh - var(--header-height));\n background: linear-gradient(45deg, var(--company-color1) 0, 5%, var(--company-color2) 5% 10%, var(--company-color3) 10% 80%, var(--company-color1) 80% 85%, var(--company-color2) 85% 100%);\n}\n.open-right-sidebar-checkbox:checked + .body-container {\n width: calc(100vw - var(--right-sidebar-width));\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n}\n.open-right-sidebar-checkbox + .body-container {\n width: calc(100vw);\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n}\n\n/* RightSidebar*/\n.right-sidebar-container {\n position: fixed;\n top: var(--header-height);\n height: calc(100vh - var(--header-height));\n display: flex;\n flex-direction: column;\n width: var(--right-sidebar-width);\n background: var(--company-color3);\n z-index: 100;\n}\n\n.right-sidebar-container:before {\n content: "";\n position: absolute;\n height: 100vh;\n width: var(--right-sidebar-width);\n background: var(--company-color2-alpha);\n z-index: -1;\n}\n.right-sidebar-container:after {\n content: "";\n position: absolute;\n height: 100vh;\n width: var(--right-sidebar-width);\n background: var(--company-color1-alpha);\n -webkit-clip-path: ellipse(158% 41% at 60% 30%);\n clip-path: ellipse(158% 41% at 60% 30%);\n z-index: -1;\n}\n.open-right-sidebar-checkbox:checked + .right-sidebar-container {\n right: 0;\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n}\n.open-right-sidebar-checkbox + .right-sidebar-container {\n right: calc(-1 * var(--right-sidebar-width));\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n}\n',""]);const o=a},5301:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(8081),r=n.n(i),s=n(3645),a=n.n(s)()(r());a.push([e.id,"/* Header */\n.header {\n height: 100%;\n width: 100vw;\n background: #ffe;\n display: flex;\n justify-content: space-between;\n}\n.header-application-title-container {\n display: flex;\n}\n.header-application-title-container .header-application-title-logo {\n width: var(--header-height);\n height: var(--header-height);\n padding: 2px 2px 2px 2px;\n margin: 0px 2px 0px 5px;\n }\n.header-application-title-container .header-application-title-text {\n font-weight: 600;\n margin: 0px 2px 0px 2px;\n }\n\n.header-button-container {\n display: flex;\n}\n\n.header-button-spacer {\n width: 1rem;\n}\n",""]);const o=a},8444:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(8081),r=n.n(i),s=n(3645),a=n.n(s)()(r());a.push([e.id,".body-content {\n background: var(--company-color1);\n width: 100%;\n height: 100%;\n}\n.body {\n background: var(--company-color1);\n width: 100%;\n height: 100%;\n}\n.body-main-video-for-avatar {\n position: absolute;\n left: -100px;\n width: 1%;\n height: 1%;\n}\n.body-main-canvas-for-avatar {\n position: absolute;\n left: -100px;\n width: 1%;\n height: 1%;\n}\n.body-main-canvas {\n width: 100%;\n height: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n}\n.body-main-script {\n position: absolute;\n width: 80%;\n bottom: 10%;\n left: 10%;\n font-size: 2rem;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n/* For Trainer */\n.body-panels-container {\n padding: 10px;\n background: #afa;\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n}\n.body-panel-partition {\n position: static;\n display: flex;\n flex-direction: column;\n width: 100%;\n flex-grow: 1;\n color: rgba(255, 255, 255, 1);\n background: rgba(0, 0, 0, 0);\n z-index: 10;\n overflow: hidden;\n}\n.body-panel-partition-40 {\n height: 40%;\n}\n.body-panel-partition-30 {\n height: 30%;\n}\n\n.body-panel-partition-20 {\n height: 20%;\n}\n\n.state-control-checkbox:checked + .body-panel-partition {\n max-height: 800px;\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n}\n\n.state-control-checkbox:checked + .body-panel-partition .body-panel-content {\n max-height: 800px;\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n }\n.state-control-checkbox + .body-panel-partition {\n max-height: var(--header-height);\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n}\n.state-control-checkbox + .body-panel-partition .body-panel-content {\n max-height: 0px;\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n }\n.body-panel-header {\n position: static;\n width: 100%;\n height: var(--header-height);\n font-size: 1.1rem;\n background: rgba(10, 10, 10, 0.5);\n display: flex;\n justify-content: space-between;\n}\n.body-panel-header .body-panel-header-title {\n padding-left: 1rem;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n.body-panel-header .body-panel-header-caret {\n align-items: right;\n }\n.body-panel-content {\n padding: 0px 5px 0px 5px;\n position: static;\n width: 100%;\n height: calc(100% - var(--header-height));\n background: rgba(0, 0, 0, 0.3);\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n overflow: hidden;\n}\n\n.body-panel-container {\n display: flex;\n height: 100%;\n width: 100%;\n flex-direction: row;\n}\n\n.body-panel-container .body-panel-col {\n height: 100%;\n border: solid 1px;\n display: flex;\n flex-direction: column;\n }\n\n.body-panel-container .body-panel-col .body-panel-col-header {\n color: #444;\n font-size: 1.2rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: 5px 10px 5px 10px;\n padding: 5px 0px 5px 0px;\n min-height: 2.2rem;\n }\n\n.body-panel-container .body-panel-col .body-panel-col-buttons {\n display: flex;\n flex-direction: row;\n margin: 5px 10px 5px 10px;\n overflow-x: hidden;\n overflow-y: hidden;\n min-height: 1.2rem;\n }\n\n.body-panel-container .body-panel-col .body-panel-col-buttons .button {\n color: #444;\n border: solid 1px #fff;\n margin: 5px 4px 5px 4px;\n padding: 2px 10px 2px 10px;\n border-radius: 4px;\n box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4);\n cursor: pointer;\n background: rgba(200, 100, 200, 0.3);\n min-height: 1.2rem;\n }\n\n.body-panel-container .body-panel-col .body-panel-description {\n color: #000;\n font-weight: 600;\n margin: 5px 10px 5px 10px;\n height: 5rem;\n display: flex;\n flex-direction: column;\n overflow-y: hidden;\n overflow-x: hidden;\n }\n\n.body-panel-container .body-panel-col .body-panel-col-card {\n margin: 10px;\n padding: 5px;\n background: rgba(0, 0, 0, 0.1);\n }\n\n.body-panel-container .body-panel-col .body-panel-col-card .body-panel-col-card-row {\n display: flex;\n flex-direction: row;\n }\n\n.body-panel-container .body-panel-col .body-panel-col-card .body-panel-col-card-row .title {\n font-weight: 600;\n width: 7rem;\n padding-left: 0.5rem;\n padding-right: 1rem;\n }\n\n.body-panel-container .body-panel-col .body-panel-col-card .body-panel-col-card-row .text {\n width: calc(100% - 7rem);\n }\n\n.body-panel-container .body-panel-col .body-panel-col-card .body-panel-col-card-row .audio {\n }\n\n.body-panel-container .body-panel-col .row {\n display: flex;\n flex-direction: row;\n margin: 5px 4px 5px 4px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n min-height: 1.6rem;\n }\n\n.body-panel-container .body-panel-col .row .title {\n font-weight: 600;\n color: #222;\n padding-left: 0.2rem;\n }\n\n.body-panel-container .body-panel-col .row .text {\n padding-left: 1rem;\n }\n\n.body-panel-container .body-panel-col .row .em {\n /* font-weight: 600; */\n color: #333;\n }\n\n.body-panel-container .body-panel-col .row .input {\n padding-left: 1rem;\n }\n\n.body-panel-container .body-panel-col .row .button {\n color: #444;\n border: solid 1px #fff;\n border-radius: 4px;\n cursor: pointer;\n background: rgba(200, 100, 200, 0.3);\n text-align: center;\n margin-left: 4px;\n margin-right: 4px;\n }\n\n.body-panel-container .body-panel-col .row .cmdline {\n background: #000;\n overflow-y: scroll;\n /* overflow-x: hidden; */\n width: 100%;\n min-height: 10rem;\n height: 100%;\n }\n\n.body-panel-container .body-panel-col .row .cmdline .line {\n color: #999;\n -webkit-user-select: text;\n -moz-user-select: text;\n user-select: text;\n overflow-wrap: break-word;\n word-break: break-all;\n white-space: normal;\n }\n\n.body-panel-container .body-panel-col .split-3-7 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n\n.body-panel-container .body-panel-col .split-3-7 > div:nth-child(2) {\n left: 30%;\n width: 70%;\n }\n\n.body-panel-container .body-panel-col .split-2-5-3 > div:nth-child(1) {\n left: 0px;\n width: 20%;\n }\n\n.body-panel-container .body-panel-col .split-2-5-3 > div:nth-child(2) {\n left: 20%;\n width: 50%;\n }\n\n.body-panel-container .body-panel-col .split-2-5-3 > div:nth-child(3) {\n left: 70%;\n width: 30%;\n }\n\n.body-panel-container .body-panel-col .split-3-5-2 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n\n.body-panel-container .body-panel-col .split-3-5-2 > div:nth-child(2) {\n left: 30%;\n width: 50%;\n }\n\n.body-panel-container .body-panel-col .split-3-5-2 > div:nth-child(3) {\n left: 80%;\n width: 20%;\n }\n\n.body-panel-container .body-panel-col .split-4-2-2-2 > div:nth-child(1) {\n left: 0px;\n width: 40%;\n }\n\n.body-panel-container .body-panel-col .split-4-2-2-2 > div:nth-child(2) {\n left: 40%;\n width: 20%;\n }\n\n.body-panel-container .body-panel-col .split-4-2-2-2 > div:nth-child(3) {\n left: 60%;\n width: 20%;\n }\n\n.body-panel-container .body-panel-col .split-4-2-2-2 > div:nth-child(4) {\n left: 80%;\n width: 20%;\n }\n\n.body-panel-container .body-panel-col .split-1-4-1-4 > div:nth-child(1) {\n left: 0px;\n width: 10%;\n }\n\n.body-panel-container .body-panel-col .split-1-4-1-4 > div:nth-child(2) {\n left: 10%;\n width: 40%;\n }\n\n.body-panel-container .body-panel-col .split-1-4-1-4 > div:nth-child(3) {\n left: 50%;\n width: 10%;\n }\n\n.body-panel-container .body-panel-col .split-1-4-1-4 > div:nth-child(4) {\n left: 60%;\n width: 40%;\n }\n\n.body-panel-container .body-panel-col .split-2-3-2-3 > div:nth-child(1) {\n left: 0px;\n width: 20%;\n }\n\n.body-panel-container .body-panel-col .split-2-3-2-3 > div:nth-child(2) {\n left: 20%;\n width: 30%;\n }\n\n.body-panel-container .body-panel-col .split-2-3-2-3 > div:nth-child(3) {\n left: 50%;\n width: 20%;\n }\n\n.body-panel-container .body-panel-col .split-2-3-2-3 > div:nth-child(4) {\n left: 70%;\n width: 30%;\n }\n\n.body-panel-container .body-panel-col .split-2-2-2-2-2 > div:nth-child(1) {\n left: 0px;\n width: 20%;\n }\n\n.body-panel-container .body-panel-col .split-2-2-2-2-2 > div:nth-child(2) {\n left: 20%;\n width: 20%;\n }\n\n.body-panel-container .body-panel-col .split-2-2-2-2-2 > div:nth-child(3) {\n left: 40%;\n width: 20%;\n }\n\n.body-panel-container .body-panel-col .split-2-2-2-2-2 > div:nth-child(4) {\n left: 60%;\n width: 20%;\n }\n\n.body-panel-container .body-panel-col .split-2-2-2-2-2 > div:nth-child(5) {\n left: 80%;\n width: 20%;\n }\n\n.body-panel-container .width-10 {\n width: 10%;\n }\n\n.body-panel-container .width-20 {\n width: 20%;\n }\n\n.body-panel-container .width-30 {\n width: 30%;\n }\n\n.body-panel-container .width-40 {\n width: 40%;\n }\n\n.body-panel-container .width-60 {\n width: 60%;\n }\n\n.body-panel-container .width-80 {\n width: 80%;\n }\n\n.body-panel-container .body-panel-voices-list-container {\n display: flex;\n flex-direction: column;\n width: 20%;\n height: 100%;\n }\n\n.body-panel-container .body-panel-voices-list-container .body-panel-voices-list-container-header {\n }\n\n.body-panel-container .body-panel-voices-list-container .body-panel-voices-list-container-buttons-row {\n }\n\n.body-panel-container .body-panel-voices-list-container .body-panel-voices-list-container-list {\n }\n\n.body-panel-container .body-panel-voice-container {\n width: 60%;\n height: 100%;\n background: #f0f;\n }\n\n.body-panel-training-container {\n display: flex;\n flex-direction: row;\n}\n\n.body-panel-monitor-container {\n display: flex;\n flex-direction: row;\n height: auto;\n}\n/* コンポーネント */\n.body-panel-col-list {\n margin: 5px 10px 5px 10px;\n height: calc(100% - 5rem - 20px - 5rem);\n min-height: 4rem;\n display: flex;\n flex-direction: column;\n overflow-y: scroll;\n overflow-x: hidden;\n background: rgba(200, 100, 200, 0.3);\n}\n.body-panel-col-list::-webkit-scrollbar {\n width: 10px;\n height: 10px;\n }\n.body-panel-col-list::-webkit-scrollbar-track {\n background-color: rgba(0, 0, 0, 0.1);\n border-radius: 10px;\n }\n.body-panel-col-list::-webkit-scrollbar-thumb {\n background: rgba(0, 0, 0, 0.4);\n border-radius: 10px;\n }\n.body-panel-col-list .item {\n background: rgba(0, 0, 0, 0.2);\n display: flex;\n flex-direction: row;\n }\n.body-panel-col-list .item .title {\n margin: 2px;\n padding-left: 3px;\n padding-right: 3px;\n }\n.body-panel-col-list .selected {\n background: rgba(0, 0, 0, 0.7);\n }\n.body-panel-col-list .split-7-3 {\n display: flex;\n flex-direction: row;\n }\n.body-panel-col-list .split-7-3 > div:nth-child(1) {\n left: 0px;\n width: 70%;\n }\n.body-panel-col-list .split-7-3 > div:nth-child(2) {\n left: 70%;\n width: 30%;\n }\n.body-panel-col-list-training-height {\n /* height: calc(100%); */\n}\n",""]);const o=a},9789:(e,t,n)=>{"use strict";n.d(t,{Z:()=>l});var i=n(8081),r=n.n(i),s=n(3645),a=n.n(s),o=n(1774),c=a()(r());c.i(o.Z),c.push([e.id,".right-sidebar {\n}\n/* Partition */\n.sidebar-partition {\n position: static;\n display: flex;\n flex-direction: column;\n width: 100%;\n color: rgba(255, 255, 255, 1);\n background: rgba(0, 0, 0, 0);\n z-index: 10;\n overflow: hidden;\n}\n.state-control-checkbox:checked + .sidebar-partition .sidebar-content {\n max-height: 800px;\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n}\n.state-control-checkbox + .sidebar-partition .sidebar-content {\n max-height: 0px;\n transition: all var(--sidebar-transition-time) var(--sidebar-transition-animation);\n}\n\n/* Header */\n.sidebar-header {\n position: static;\n width: 100%;\n height: var(--header-height);\n font-size: 1.1rem;\n background: rgba(10, 10, 10, 0.5);\n display: flex;\n justify-content: space-between;\n}\n.sidebar-header .sidebar-header-title {\n padding-left: 1rem;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n.sidebar-header .sidebar-header-caret {\n align-items: right;\n }\n/* Content */\n.sidebar-content {\n padding: 0px 5px 0px 5px;\n position: static;\n width: 100%;\n height: auto;\n /* height: calc(100% - var(--header-height)); */\n background: rgba(200, 0, 0, 1);\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n/***** 行分割 *****/\n.sidebar-content-row-1 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n/***** 行分割(x2) *****/\n.sidebar-content-row-3-7 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.sidebar-content-row-3-7 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.sidebar-content-row-3-7 > div:nth-child(2) {\n left: 30%;\n width: 70%;\n }\n\n.sidebar-content-row-5-5 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.sidebar-content-row-5-5 > div:nth-child(1) {\n left: 0px;\n width: 50%;\n }\n\n.sidebar-content-row-5-5 > div:nth-child(2) {\n left: 50%;\n width: 50%;\n }\n\n.sidebar-content-row-7-3 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.sidebar-content-row-7-3 > div:nth-child(1) {\n left: 0px;\n width: 70%;\n }\n\n.sidebar-content-row-7-3 > div:nth-child(2) {\n left: 70%;\n width: 30%;\n }\n/***** 行分割(x3) *****/\n.sidebar-content-row-3-5-2 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.sidebar-content-row-3-5-2 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n.sidebar-content-row-3-5-2 > div:nth-child(2) {\n left: 30%;\n width: 50%;\n }\n.sidebar-content-row-3-5-2 > div:nth-child(3) {\n left: 80%;\n width: 20%;\n }\n.sidebar-content-row-4-3-3 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n.sidebar-content-row-4-3-3 > div:nth-child(1) {\n left: 0px;\n width: 40%;\n }\n.sidebar-content-row-4-3-3 > div:nth-child(2) {\n left: 40%;\n width: 30%;\n }\n.sidebar-content-row-4-3-3 > div:nth-child(3) {\n left: 70%;\n width: 30%;\n }\n\n/***** Divider *****/\n.sidebar-content-row-dividing {\n height: 5px;\n width: 80%;\n background: #ffffff88;\n margin: 10px 0px 10px 0px;\n border-radius: 5px;\n}\n\n/***** Padding *****/\n.pad-left-03 {\n padding-left: 0.3rem;\n}\n.pad-left-1 {\n padding-left: 1rem;\n}\n.pad-left-3 {\n padding-left: 3rem;\n}\n.stick-to-right {\n text-align: right;\n}\n.stick-to-left {\n text-align: left;\n}\n.row-space-holder-2 {\n height: 2rem;\n}\n.no-wrap {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n/**** 行中身 ****/\n/* Label */\n.sidebar-content-row-label {\n width: 100%;\n}\n.sidebar-content-row-label-small {\n font-size: 0.75rem;\n}\n\n/* Button */\n.sidebar-content-row-button,\n.sidebar-content-row-button-activated,\n.sidebar-content-row-button-stanby {\n padding: 0px 5px 0px 5px;\n margin: 0px 5px 0px 5px;\n border-radius: 2px;\n border: 1px solid #446;\n cursor: pointer;\n /* width: 30%; */\n text-align: center;\n font-weight: 100;\n}\n.sidebar-content-row-button-activated {\n /* width: 50%; */\n background: #bbd;\n color: #000;\n}\n.sidebar-content-row-button-activated:hover {\n /* background: #4f5; */\n font-weight: 600;\n}\n.sidebar-content-row-button,\n.sidebar-content-row-button-stanby {\n background: #555;\n}\n.sidebar-content-row-button:hover,\n.sidebar-content-row-button-stanby:hover {\n /* background: #666; */\n font-weight: 400;\n}\n\n/* Select */\n.sidebar-content-row-select {\n}\n.sidebar-content-row-select-option {\n font-size: 1rem;\n}\n.sidebar-content-row-select-select {\n max-width: 90%;\n min-width: 30%;\n font-size: 0.7rem;\n}\n\n/* Device Select */\n.device-selector-option {\n font-size: 1rem;\n}\n.device-selector-select {\n max-width: 90%;\n min-width: 50%;\n font-size: 0.7rem;\n}\n\n/* input */\n.sidebar-content-row-input {\n}\n\n.sidebar-content-row-input-input {\n max-width: 90%;\n min-width: 30%;\n font-size: 0.7rem;\n}\n.sidebar-content-row-input-input-full {\n width: 90%;\n font-size: 0.7rem;\n}\n\n.sidebar-content-row-input-checkbox {\n max-width: 90%;\n min-width: 30%;\n font-size: 0.7rem;\n}\n\n/* Visualizer */\n.output-audio-visializer {\n margin: 5%;\n width: 40%;\n height: 50px;\n}\n.output-audio-visializer-canvas {\n width: 100%;\n height: 100%;\n}\n\n/* Misc */\n.sidebar-content-row-container {\n width: 100%;\n height: 100px;\n}\n.avatar-controller-video {\n width: 100%;\n height: 100%;\n -o-object-fit: contain;\n object-fit: contain;\n transform: scaleX(-1);\n padding: 10px;\n}\n\n.avatar-controller-avatar-area {\n width: 100%;\n height: 100%;\n display: flex;\n padding: 10px;\n}\n.avatar-controller-background-video {\n width: 1px;\n height: 1px;\n position: absolute;\n left: -100px;\n}\n",""]);const l=c},1774:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(8081),r=n.n(i),s=n(3645),a=n.n(s)()(r());a.push([e.id,'.voice-loader-audio-player {\n height: 50px;\n width: 100%;\n margin: 5px 5% 5px 5%;\n background: #444;\n /* box-shadow: 0 0 20px 0 #000a; */\n\n font-family: arial;\n color: white;\n font-size: 0.75em;\n overflow: hidden;\n\n display: grid;\n grid-template-rows: 10px auto;\n}\n.voice-loader-audio-player-timeline {\n background: white;\n width: 100%;\n position: relative;\n cursor: pointer;\n box-shadow: 0 2px 10px 0 #0008;\n}\n.voice-loader-audio-player-progress {\n background: coral;\n width: 0%;\n height: 100%;\n transition: 0.25s;\n}\n.voice-loader-audio-player-controls {\n display: flex;\n justify-content: space-between;\n align-items: stretch;\n padding: 0 20px;\n font-weight: 100;\n}\n.voice-loader-audio-player-controls > * {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n.voice-loader-audio-player-controls .toggle-play.play {\n cursor: pointer;\n position: relative;\n left: 0;\n height: 0;\n width: 0;\n border: 7px solid #0000;\n border-left: 13px solid white;\n }\n.voice-loader-audio-player-controls .toggle-play.play:hover {\n transform: scale(1.1);\n }\n.voice-loader-audio-player-controls .toggle-play.pause {\n height: 15px;\n width: 20px;\n cursor: pointer;\n position: relative;\n }\n.voice-loader-audio-player-controls .toggle-play.pause:before {\n position: absolute;\n top: 0;\n left: 0px;\n background: white;\n content: "";\n height: 15px;\n width: 3px;\n }\n.voice-loader-audio-player-controls .toggle-play.pause:after {\n position: absolute;\n top: 0;\n right: 8px;\n background: white;\n content: "";\n height: 15px;\n width: 3px;\n }\n.voice-loader-audio-player-controls .toggle-play.pause:hover {\n transform: scale(1.1);\n }\n.voice-loader-audio-player-time {\n display: flex;\n widht: 200px;\n}\n.voice-loader-audio-player-time > * {\n padding: 2px;\n }\n\n.voice-loader-audio-player-volume-container {\n cursor: pointer;\n\n position: relative;\n z-index: 2;\n}\n\n.voice-loader-audio-player-volume-container .voice-loader-audio-player-volume-slider {\n position: absolute;\n left: -3px;\n top: 15px;\n z-index: -1;\n width: 0;\n height: 15px;\n background: white;\n box-shadow: 0 0 20px #000a;\n transition: 0.25s;\n }\n\n.voice-loader-audio-player-volume-container .voice-loader-audio-player-volume-slider .voice-loader-audio-player-volume-percentage {\n background: coral;\n height: 100%;\n width: 75%;\n }\n\n.voice-loader-audio-player-volume-container:hover .voice-loader-audio-player-volume-slider {\n left: -123px;\n width: 120px;\n }\n.voice-loader-audio-player-volume-button {\n height: 26px;\n display: flex;\n align-items: center;\n}\n.voice-loader-audio-player-volume-button .volume {\n transform: scale(0.7);\n }\n.voice-loader-audio-player-button {\n cursor: pointer;\n}\n.voice-loader-audio-player-button:hover {\n font-weight: 600;\n }\n',""]);const o=a},7051:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(8081),r=n.n(i),s=n(3645),a=n.n(s)()(r());a.push([e.id,"/* (1) Dialog コンテナと表示・非表示 */\n.dialog-container {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100vw;\n height: 100vh;\n}\n\n.state-control-checkbox:checked ~ .dialog-container {\n background: rgba(200, 200, 200, 0.4);\n animation-name: dialog-show;\n animation-duration: 0.4s;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n animation-direction: normal;\n}\n.state-control-checkbox ~ .dialog-container {\n background: rgba(100, 100, 100, 0.4);\n animation-name: dialog-hide;\n animation-duration: 0.4s;\n animation-iteration-count: 1;\n animation-fill-mode: forwards;\n animation-direction: normal;\n}\n\n@keyframes dialog-hide {\n from {\n opacity: 1;\n z-index: 200;\n }\n 90% {\n opacity: 0;\n z-index: -1;\n }\n to {\n opacity: 0;\n z-index: -1;\n /* display: none; */\n }\n}\n\n@keyframes dialog-show {\n from {\n opacity: 0;\n z-index: -1;\n }\n 10% {\n display: flex;\n z-index: 200;\n }\n to {\n opacity: 1;\n z-index: 200;\n }\n}\n\n/* (2) Dialog の枠 */\n.dialog-frame {\n color: #000;\n width: 40rem;\n border: 2px solid var(--dialog-border-color);\n border-radius: 20px;\n display: flex;\n flex-direction: column;\n align-items: center;\n box-shadow: 5px 5px 5px var(--dialog-shadow-color);\n background: var(--dialog-background-color);\n overflow: hidden;\n}\n\n/* (2) Dialog の中身 */\n/****** (a) title */\n.dialog-title {\n margin-top: 20px;\n background: var(--company-color2);\n color: #fff;\n width: 100%;\n font-size: 1.5rem;\n text-align: center;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n/****** (b) content */\n.dialog-content {\n width: 90%;\n}\n/***** 行分割 *****/\n.dialog-content-row-1 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.dialog-content-row-3-7 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.dialog-content-row-3-7 > div:nth-child(1) {\n left: 0px;\n width: 30%;\n }\n\n.dialog-content-row-3-7 > div:nth-child(2) {\n left: 30%;\n width: 70%;\n }\n\n.dialog-content-row-7-3 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.dialog-content-row-7-3 > div:nth-child(1) {\n left: 0px;\n width: 70%;\n }\n\n.dialog-content-row-7-3 > div:nth-child(2) {\n left: 70%;\n width: 30%;\n }\n\n.dialog-content-row-4-4-2 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.dialog-content-row-4-4-2 > div:nth-child(1) {\n left: 0px;\n width: 40%;\n }\n\n.dialog-content-row-4-4-2 > div:nth-child(2) {\n left: 40%;\n width: 40%;\n }\n\n.dialog-content-row-4-4-2 > div:nth-child(3) {\n left: 80%;\n width: 20%;\n }\n\n.dialog-content-row-2-2-2-2-2 {\n display: flex;\n width: 100%;\n justify-content: center;\n margin: 1px 0px 1px 0px;\n}\n\n.dialog-content-row-2-2-2-2-2 > div:nth-child(1) {\n left: 0px;\n width: 20%;\n }\n\n.dialog-content-row-2-2-2-2-2 > div:nth-child(2) {\n left: 20%;\n width: 20%;\n }\n\n.dialog-content-row-2-2-2-2-2 > div:nth-child(3) {\n left: 40%;\n width: 20%;\n }\n\n.dialog-content-row-2-2-2-2-2 > div:nth-child(4) {\n left: 60%;\n width: 20%;\n }\n\n.dialog-content-row-2-2-2-2-2 > div:nth-child(5) {\n left: 80%;\n width: 20%;\n }\n\n/***** Divider *****/\n.dialog-content-row-dividing {\n height: 2px;\n width: 100%;\n background: #aaaaaa88;\n margin: 10px 0px 10px 0px;\n border-radius: 5px;\n}\n.dialog-content-row-spacer {\n height: 0.5rem;\n}\n\n/* label */\n.dialog-content-row-label {\n width: 100%;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n\n/* input */\n.dialog-content-row-input {\n width: 100%;\n}\n\n.dialog-content-row-input-input {\n max-width: 90%;\n min-width: 30%;\n font-size: 0.7rem;\n}\n\n/* Button */\n.dialog-content-row-button {\n padding: 0px 5px 0px 5px;\n margin: 0px 5px 0px 5px;\n border-radius: 2px;\n border: 1px solid #446;\n cursor: pointer;\n /* width: 30%; */\n text-align: center;\n font-weight: 100;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n",""]);const o=a},3317:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var i=n(8081),r=n.n(i),s=n(3645),a=n.n(s)()(r());a.push([e.id,"/* 前提条件 */\n\n.rotate-button-container {\n height: var(--header-height);\n width: var(--header-height);\n position: relative;\n}\n.rotate-button {\n display: none;\n}\n.rotate-button ~ .rotate-lable {\n padding: 2px;\n position: absolute;\n transition: all 0.3s;\n cursor: pointer;\n height: var(--header-height);\n width: var(--header-height);\n}\n.rotate-button ~ .rotate-lable > * {\n width: 100%;\n height: 100%;\n float: left;\n transition: all 0.3s;\n}\n.rotate-button ~ .rotate-lable > * .spin-on {\n width: 100%;\n height: 100%;\n display: none;\n }\n.rotate-button ~ .rotate-lable > * .spin-off {\n width: 100%;\n height: 100%;\n display: blcok;\n }\n.rotate-button ~ .rotate-lable > .colored {\n color: rgba(200, 200, 200, 0.8);\n background: rgba(0, 0, 0, 1);\n transition: all 0.3s;\n}\n.rotate-button ~ .rotate-lable > .colored .spin-on {\n display: none;\n }\n.rotate-button ~ .rotate-lable > .colored .spin-off {\n display: block;\n }\n.rotate-button:checked ~ .rotate-lable > .colored {\n color: rgba(50, 240, 50, 0.8);\n background: rgba(60, 60, 60, 1);\n transition: all 0.3s;\n}\n.rotate-button:checked ~ .rotate-lable > .colored .spin-on {\n display: block;\n }\n.rotate-button:checked ~ .rotate-lable > .colored .spin-off {\n display: none;\n }\n\n.rotate-button:checked ~ .rotate-lable > .spinner {\n width: 100%;\n height: 100%;\n transform: rotate(-180deg);\n transition: all 0.3s;\n box-sizing: border-box;\n}\n\n.rotate-button:checked ~ .rotate-lable > .spinner .spin-on {\n display: block;\n }\n\n.rotate-button:checked ~ .rotate-lable > .spinner .spin-off {\n display: none;\n }\n",""]);const o=a},3645: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,s){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(i)for(var o=0;o0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=s),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),t.push(u))}},t}},8081:e=>{"use strict";e.exports=function(e){return e[1]}},3631:(e,t,n)=>{"use strict";n.r(t),n.d(t,{BotInfo:()=>c,BrowserInfo:()=>s,NodeInfo:()=>a,ReactNativeInfo:()=>l,SearchBotDeviceInfo:()=>o,browserName:()=>m,detect:()=>f,detectOS:()=>v,getNodeVersion:()=>y,parseUserAgent:()=>g});var i=n(4155),r=function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r{"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 s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}m(e,t,s,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,r)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,n,i){var r,s,a,l;if(o(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),a=s[t]),void 0===a)a=s[t]=n,++e._eventsCount;else if("function"==typeof a?a=s[t]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=c(e))>0&&a.length>r&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=u.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;n0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var c=s[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var l=c.length,u=p(c,l);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){a=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},645:(e,t)=>{t.read=function(e,t,n,i,r){var s,a,o=8*r-i-1,c=(1<>1,u=-7,d=n?r-1:0,h=n?-1:1,f=e[t+d];for(d+=h,s=f&(1<<-u)-1,f>>=-u,u+=o;u>0;s=256*s+e[t+d],d+=h,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=256*a+e[t+d],d+=h,u-=8);if(0===s)s=1-l;else{if(s===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),s-=l}return(f?-1:1)*a*Math.pow(2,s-i)},t.write=function(e,t,n,i,r,s){var a,o,c,l=8*s-r-1,u=(1<>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=u?(o=0,a=u):a+d>=1?(o=(t*c-1)*Math.pow(2,r),a+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,r),a=0));r>=8;e[n+f]=255&o,f+=p,o/=256,r-=8);for(a=a<0;e[n+f]=255&a,f+=p,a/=256,l-=8);e[n+f-p]|=128*m}},9483:(e,t,n)=>{e.exports=function e(t,n,i){function r(a,o){if(!n[a]){if(!t[a]){if(s)return s(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,(function(e){return r(t[a][1][e]||e)}),l,l.exports,e,t,n,i)}return n[a].exports}for(var s=void 0,a=0;a=43)}})).catch((function(){return!1}))}(e).then((function(e){return h=e}))}function b(e){var t=f[e.name],n={};n.promise=new a((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function x(e){var t=f[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var n=f[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function M(e,t){return new a((function(n,i){if(f[e.name]=f[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);b(e),e.db.close()}var s=[e.name];t&&s.push(e.version);var a=r.open.apply(r,s);t&&(a.onupgradeneeded=function(t){var n=a.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(d)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),i(a.error)},a.onsuccess=function(){var t=a.result;t.onversionchange=function(e){e.target.close()},n(t),x(e)}}))}function S(e){return M(e,!1)}function _(e){return M(e,!0)}function C(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),i=e.versione.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),r||n){if(n){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function E(e){return s([v(atob(e.data))],{type:e.type})}function T(e){return e&&e.__local_forage_encoded_blob}function L(e){var t=this,n=t._initReady().then((function(){var e=f[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(n,e,e),n}function A(e,t,n,i){void 0===i&&(i=1);try{var r=e.db.transaction(e.storeName,t);n(null,r)}catch(r){if(i>0&&(!e.db||"InvalidStateError"===r.name||"NotFoundError"===r.name))return a.resolve().then((function(){if(!e.db||"NotFoundError"===r.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),_(e)})).then((function(){return function(e){b(e);for(var t=f[e.name],n=t.forages,i=0;i>4,u[c++]=(15&i)<<4|r>>2,u[c++]=(3&r)<<6|63&s;return l}function K(e){var t,n=new Uint8Array(e),i="";for(t=0;t>2],i+=R[(3&n[t])<<4|n[t+1]>>4],i+=R[(15&n[t+1])<<2|n[t+2]>>6],i+=R[63&n[t+2]];return n.length%3==2?i=i.substring(0,i.length-1)+"=":n.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}var Y={serialize:function(e,t){var n="";if(e&&(n=$.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===$.call(e.buffer))){var i,r=H;e instanceof ArrayBuffer?(i=e,r+=I):(i=e.buffer,"[object Int8Array]"===n?r+=N:"[object Uint8Array]"===n?r+=D:"[object Uint8ClampedArray]"===n?r+=O:"[object Int16Array]"===n?r+=F:"[object Uint16Array]"===n?r+=U:"[object Int32Array]"===n?r+=B:"[object Uint32Array]"===n?r+=W:"[object Float32Array]"===n?r+=G:"[object Float64Array]"===n?r+=j:t(new Error("Failed to get type for BinaryArray"))),t(r+K(i))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n="~~local_forage_type~"+e.type+"~"+K(this.result);t("__lfsc__:blob"+n)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,k)!==H)return JSON.parse(e);var t,n=e.substring(q),i=e.substring(k,q);if(i===V&&P.test(n)){var r=n.match(P);t=r[1],n=n.substring(r[0].length)}var a=X(n);switch(i){case I:return a;case V:return s([a],{type:t});case N:return new Int8Array(a);case D:return new Uint8Array(a);case O:return new Uint8ClampedArray(a);case F:return new Int16Array(a);case U:return new Uint16Array(a);case B:return new Int32Array(a);case W:return new Uint32Array(a);case G:return new Float32Array(a);case j:return new Float64Array(a);default:throw new Error("Unkown type: "+i)}},stringToBuffer:X,bufferToString:K};function J(e,t,n,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,i)}function Z(e,t,n,i,r,s){e.executeSql(n,i,r,(function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,o){o.rows.length?s(e,a):J(e,t,(function(){e.executeSql(n,i,r,s)}),s)}),s):s(e,a)}),s)}function Q(e,t,n,i){var r=this;e=l(e);var s=new a((function(s,a){r.ready().then((function(){void 0===t&&(t=null);var o=t,c=r._dbInfo;c.serializer.serialize(t,(function(t,l){l?a(l):c.db.transaction((function(n){Z(n,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){s(o)}),(function(e,t){a(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void s(Q.apply(r,[e,o,n,i-1]));a(t)}}))}))})).catch(a)}));return o(s,n),s}function ee(e){return new a((function(t,n){e.transaction((function(i){i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,i){for(var r=[],s=0;s0}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=ne(e,this._defaultConfig),ie()?(this._dbInfo=t,t.serializer=Y,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,i=n.ready().then((function(){for(var t=n._dbInfo,i=t.keyPrefix,r=i.length,s=localStorage.length,a=1,o=0;o=0;n--){var i=localStorage.key(n);0===i.indexOf(e)&&localStorage.removeItem(i)}}));return o(n,e),n},length:function(e){var t=this.keys().then((function(e){return e.length}));return o(t,e),t},key:function(e,t){var n=this,i=n.ready().then((function(){var t,i=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(i.keyPrefix.length)),t}));return o(i,t),i},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,i=[],r=0;r=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):a.reject("Invalid arguments"),o(i,t),i}},se=function(e,t){for(var n=e.length,i=0;i{"use strict";const{Deflate:i,deflate:r,deflateRaw:s,gzip:a}=n(4555),{Inflate:o,inflate:c,inflateRaw:l,ungzip:u}=n(8843),d=n(1619);e.exports.Deflate=i,e.exports.deflate=r,e.exports.deflateRaw=s,e.exports.gzip=a,e.exports.Inflate=o,e.exports.inflate=c,e.exports.inflateRaw=l,e.exports.ungzip=u,e.exports.constants=d},4555:(e,t,n)=>{"use strict";const i=n(405),r=n(6247),s=n(9373),a=n(8898),o=n(2292),c=Object.prototype.toString,{Z_NO_FLUSH:l,Z_SYNC_FLUSH:u,Z_FULL_FLUSH:d,Z_FINISH:h,Z_OK:f,Z_STREAM_END:p,Z_DEFAULT_COMPRESSION:m,Z_DEFAULT_STRATEGY:g,Z_DEFLATED:v}=n(1619);function y(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 o,this.strm.avail_out=0;let n=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==f)throw new Error(a[n]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,n=i.deflateSetDictionary(this.strm,e),n!==f)throw new Error(a[n]);this._dict_set=!0}}function b(e,t){const n=new y(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}y.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let a,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?h:l,"string"==typeof e?n.input=s.string2buf(e):"[object ArrayBuffer]"===c.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),(o===u||o===d)&&n.avail_out<=6)this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;else{if(a=i.deflate(n,o),a===p)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),a=i.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===f;if(0!==n.avail_out){if(o>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},y.prototype.onData=function(e){this.chunks.push(e)},y.prototype.onEnd=function(e){e===f&&(this.result=r.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},e.exports.Deflate=y,e.exports.deflate=b,e.exports.deflateRaw=function(e,t){return(t=t||{}).raw=!0,b(e,t)},e.exports.gzip=function(e,t){return(t=t||{}).gzip=!0,b(e,t)},e.exports.constants=n(1619)},8843:(e,t,n)=>{"use strict";const i=n(6351),r=n(6247),s=n(9373),a=n(8898),o=n(2292),c=n(2401),l=Object.prototype.toString,{Z_NO_FLUSH:u,Z_FINISH:d,Z_OK:h,Z_STREAM_END:f,Z_NEED_DICT:p,Z_STREAM_ERROR:m,Z_DATA_ERROR:g,Z_MEM_ERROR:v}=n(1619);function y(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 o,this.strm.avail_out=0;let n=i.inflateInit2(this.strm,t.windowBits);if(n!==h)throw new Error(a[n]);if(this.header=new c,i.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=s.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=i.inflateSetDictionary(this.strm,t.dictionary),n!==h)))throw new Error(a[n])}function b(e,t){const n=new y(t);if(n.push(e),n.err)throw n.msg||a[n.err];return n.result}y.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize,a=this.options.dictionary;let o,c,y;if(this.ended)return!1;for(c=t===~~t?t:!0===t?d:u,"[object ArrayBuffer]"===l.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),o=i.inflate(n,c),o===p&&a&&(o=i.inflateSetDictionary(n,a),o===h?o=i.inflate(n,c):o===g&&(o=p));n.avail_in>0&&o===f&&n.state.wrap>0&&0!==e[n.next_in];)i.inflateReset(n),o=i.inflate(n,c);switch(o){case m:case g:case p:case v:return this.onEnd(o),this.ended=!0,!1}if(y=n.avail_out,n.next_out&&(0===n.avail_out||o===f))if("string"===this.options.to){let e=s.utf8border(n.output,n.next_out),t=n.next_out-e,i=s.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(o!==h||0!==y){if(o===f)return o=i.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===n.avail_in)break}}return!0},y.prototype.onData=function(e){this.chunks.push(e)},y.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=y,e.exports.inflate=b,e.exports.inflateRaw=function(e,t){return(t=t||{}).raw=!0,b(e,t)},e.exports.ungzip=b,e.exports.constants=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{"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,s,a=e.length,o=0;for(r=0;r>>6,t[s++]=128|63&n):n<65536?(t[s++]=224|n>>>12,t[s++]=128|n>>>6&63,t[s++]=128|63&n):(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63,t[s++]=128|n>>>6&63,t[s++]=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 s,a;const o=new Array(2*r);for(a=0,s=0;s4)o[a++]=65533,s+=i-1;else{for(t&=2===i?31:3===i?15:7;i>1&&s1?o[a++]=65533:t<65536?o[a++]=t:(t-=65536,o[a++]=55296|t>>10&1023,o[a++]=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{(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,s=e>>>16&65535|0,a=0;for(;0!==n;){a=n>2e3?2e3:n,n-=a;do{r=r+t[i++]|0,s=s+r|0}while(--a);r%=65521,s%=65521}return r|s<<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 s=t,a=r+i;e^=-1;for(let t=r;t>>8^s[255&(e^n[t])];return-1^e}},405:(e,t,n)=>{"use strict";const{_tr_init:i,_tr_stored_block:r,_tr_flush_block:s,_tr_tally:a,_tr_align:o}=n(342),c=n(6069),l=n(2869),u=n(8898),{Z_NO_FLUSH:d,Z_PARTIAL_FLUSH:h,Z_FULL_FLUSH:f,Z_FINISH:p,Z_BLOCK:m,Z_OK:g,Z_STREAM_END:v,Z_STREAM_ERROR:y,Z_DATA_ERROR:b,Z_BUF_ERROR:x,Z_DEFAULT_COMPRESSION:w,Z_FILTERED:M,Z_HUFFMAN_ONLY:S,Z_RLE:_,Z_FIXED:C,Z_DEFAULT_STRATEGY:E,Z_UNKNOWN:T,Z_DEFLATED:L}=n(1619),A=258,z=262,R=42,P=113,H=666,k=(e,t)=>(e.msg=u[t],t),I=e=>2*e-(e>4?9:0),V=e=>{let t=e.length;for(;--t>=0;)e[t]=0},N=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 D=(e,t,n)=>(t<{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))},F=(e,t)=>{s(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,O(e.strm)},B=(e,t)=>{e.pending_buf[e.pending++]=t},U=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},W=(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=c(e.adler,t,r,n):2===e.state.wrap&&(e.adler=l(e.adler,t,r,n)),e.next_in+=r,e.total_in+=r,r)},G=(e,t)=>{let n,i,r=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match;const c=e.strstart>e.w_size-z?e.strstart-(e.w_size-z):0,l=e.window,u=e.w_mask,d=e.prev,h=e.strstart+A;let f=l[s+a-1],p=l[s+a];e.prev_length>=e.good_match&&(r>>=2),o>e.lookahead&&(o=e.lookahead);do{if(n=t,l[n+a]===p&&l[n+a-1]===f&&l[n]===l[s]&&l[++n]===l[s+1]){s+=2,n++;do{}while(l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&sa){if(e.match_start=t,a=i,i>=o)break;f=l[s+a-1],p=l[s+a]}}}while((t=d[t&u])>c&&0!=--r);return a<=e.lookahead?a:e.lookahead},j=e=>{const t=e.w_size;let n,i,r;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-z)&&(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),N(e),i+=t),0===e.strm.avail_in)break;if(n=W(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=D(e,e.ins_h,e.window[r+1]);e.insert&&(e.ins_h=D(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{let n,i,s,a=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,c=e.strm.avail_in;do{if(n=65535,s=e.bi_valid+42>>3,e.strm.avail_outi+e.strm.avail_in&&(n=i+e.strm.avail_in),n>s&&(n=s),n>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,O(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&&(W(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===o);return c-=e.strm.avail_in,c&&(c>=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<=c&&(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-c,e.strm.next_in),e.strstart),e.strstart+=c,e.insert+=c>e.w_size-e.insert?e.w_size-e.insert:c),e.block_start=e.strstart),e.high_waters&&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++,s+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),s>e.strm.avail_in&&(s=e.strm.avail_in),s&&(W(e.strm,e.window,e.strstart,s),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.high_water>3,s=e.pending_buf_size-s>65535?65535:e.pending_buf_size-s,a=s>e.w_size?e.w_size:s,i=e.strstart-e.block_start,(i>=a||(i||t===p)&&t!==d&&0===e.strm.avail_in&&i<=s)&&(n=i>s?s:i,o=t===p&&0===e.strm.avail_in&&n===i?1:0,r(e,e.block_start,n,o),e.block_start+=n,O(e.strm)),o?3:1)},$=(e,t)=>{let n,i;for(;;){if(e.lookahead=3&&(e.ins_h=D(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-z&&(e.match_length=G(e,n)),e.match_length>=3)if(i=a(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=D(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=D(e,e.ins_h,e.window[e.strstart+1]);else i=a(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(F(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===p?(F(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(F(e,!1),0===e.strm.avail_out)?1:2},X=(e,t)=>{let n,i,r;for(;;){if(e.lookahead=3&&(e.ins_h=D(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_length4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,i=a(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=D(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&&(F(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=a(e,0,e.window[e.strstart-1]),i&&F(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=a(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===p?(F(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(F(e,!1),0===e.strm.avail_out)?1:2};function K(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 Y=[new K(0,0,0,0,q),new K(4,4,8,4,$),new K(4,5,16,8,$),new K(4,6,32,32,$),new K(4,4,16,16,X),new K(8,16,32,32,X),new K(8,16,128,128,X),new K(8,32,128,256,X),new K(32,128,258,1024,X),new K(32,258,258,4096,X)];function J(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=L,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),V(this.dyn_ltree),V(this.dyn_dtree),V(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),V(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),V(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!==R&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==P&&t.status!==H?1:0},Q=e=>{if(Z(e))return k(e,y);e.total_in=e.total_out=0,e.data_type=T;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?R:P,e.adler=2===t.wrap?0:1,t.last_flush=-2,i(t),g},ee=e=>{const t=Q(e);var n;return t===g&&((n=e.state).window_size=2*n.w_size,V(n.head),n.max_lazy_match=Y[n.level].max_lazy,n.good_match=Y[n.level].good_length,n.nice_match=Y[n.level].nice_length,n.max_chain_length=Y[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,s)=>{if(!e)return y;let a=1;if(t===w&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),r<1||r>9||n!==L||i<8||i>15||t<0||t>9||s<0||s>C||8===i&&1!==a)return k(e,y);8===i&&(i=9);const o=new J;return e.state=o,o.strm=e,o.status=R,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<te(e,t,L,15,8,E),e.exports.deflateInit2=te,e.exports.deflateReset=ee,e.exports.deflateResetKeep=Q,e.exports.deflateSetHeader=(e,t)=>Z(e)||2!==e.state.wrap?y:(e.state.gzhead=t,g),e.exports.deflate=(e,t)=>{if(Z(e)||t>m||t<0)return e?k(e,y):y;const n=e.state;if(!e.output||0!==e.avail_in&&!e.input||n.status===H&&t!==p)return k(e,0===e.avail_out?x:y);const i=n.last_flush;if(n.last_flush=t,0!==n.pending){if(O(e),0===e.avail_out)return n.last_flush=-1,g}else if(0===e.avail_in&&I(t)<=I(i)&&t!==p)return k(e,x);if(n.status===H&&0!==e.avail_in)return k(e,x);if(n.status===R&&0===n.wrap&&(n.status=P),n.status===R){let t=L+(n.w_bits-8<<4)<<8,i=-1;if(i=n.strategy>=S||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,U(n,t),0!==n.strstart&&(U(n,e.adler>>>16),U(n,65535&e.adler)),e.adler=1,n.status=P,O(e),0!==n.pending)return n.last_flush=-1,g}if(57===n.status)if(e.adler=0,B(n,31),B(n,139),B(n,8),n.gzhead)B(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)),B(n,255&n.gzhead.time),B(n,n.gzhead.time>>8&255),B(n,n.gzhead.time>>16&255),B(n,n.gzhead.time>>24&255),B(n,9===n.level?2:n.strategy>=S||n.level<2?4:0),B(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(B(n,255&n.gzhead.extra.length),B(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=l(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(B(n,0),B(n,0),B(n,0),B(n,0),B(n,0),B(n,9===n.level?2:n.strategy>=S||n.level<2?4:0),B(n,3),n.status=P,O(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=l(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=r,O(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=l(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=l(e.adler,n.pending_buf,n.pending-i,i)),O(e),0!==n.pending)return n.last_flush=-1,g;i=0}t=n.gzindexi&&(e.adler=l(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=l(e.adler,n.pending_buf,n.pending-i,i)),O(e),0!==n.pending)return n.last_flush=-1,g;i=0}t=n.gzindexi&&(e.adler=l(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&&(O(e),0!==n.pending))return n.last_flush=-1,g;B(n,255&e.adler),B(n,e.adler>>8&255),e.adler=0}if(n.status=P,O(e),0!==n.pending)return n.last_flush=-1,g}if(0!==e.avail_in||0!==n.lookahead||t!==d&&n.status!==H){let i=0===n.level?q(n,t):n.strategy===S?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(j(e),0===e.lookahead)){if(t===d)return 1;break}if(e.match_length=0,n=a(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(F(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===p?(F(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(F(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===_?((e,t)=>{let n,i,r,s;const o=e.window;for(;;){if(e.lookahead<=A){if(j(e),e.lookahead<=A&&t===d)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=e.strstart-1,i=o[r],i===o[++r]&&i===o[++r]&&i===o[++r])){s=e.strstart+A;do{}while(i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&re.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=a(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(F(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===p?(F(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(F(e,!1),0===e.strm.avail_out)?1:2})(n,t):Y[n.level].func(n,t);if(3!==i&&4!==i||(n.status=H),1===i||3===i)return 0===e.avail_out&&(n.last_flush=-1),g;if(2===i&&(t===h?o(n):t!==m&&(r(n,0,0,!1),t===f&&(V(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),O(e),0===e.avail_out))return n.last_flush=-1,g}return t!==p?g:n.wrap<=0?v:(2===n.wrap?(B(n,255&e.adler),B(n,e.adler>>8&255),B(n,e.adler>>16&255),B(n,e.adler>>24&255),B(n,255&e.total_in),B(n,e.total_in>>8&255),B(n,e.total_in>>16&255),B(n,e.total_in>>24&255)):(U(n,e.adler>>>16),U(n,65535&e.adler)),O(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?g:v)},e.exports.deflateEnd=e=>{if(Z(e))return y;const t=e.state.status;return e.state=null,t===P?k(e,b):g},e.exports.deflateSetDictionary=(e,t)=>{let n=t.length;if(Z(e))return y;const i=e.state,r=i.wrap;if(2===r||1===r&&i.status!==R||i.lookahead)return y;if(1===r&&(e.adler=c(e.adler,t,n,0)),i.wrap=0,n>=i.w_size){0===r&&(V(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 s=e.avail_in,a=e.next_in,o=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,j(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=D(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,j(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=a,e.input=o,e.avail_in=s,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,s,a,o,c,l,u,d,h,f,p,m,g,v,y,b,x,w,M,S,_,C,E;const T=e.state;i=e.next_in,C=e.input,r=i+(e.avail_in-5),s=e.next_out,E=e.output,a=s-(n-e.avail_out),o=s+(e.avail_out-257),c=T.dmax,l=T.wsize,u=T.whave,d=T.wnext,h=T.window,f=T.hold,p=T.bits,m=T.lencode,g=T.distcode,v=(1<>>24,f>>>=x,p-=x,x=b>>>16&255,0===x)E[s++]=65535&b;else{if(!(16&x)){if(0==(64&x)){b=m[(65535&b)+(f&(1<>>=x,p-=x),p<15&&(f+=C[i++]<>>24,f>>>=x,p-=x,x=b>>>16&255,!(16&x)){if(0==(64&x)){b=g[(65535&b)+(f&(1<c){e.msg="invalid distance too far back",T.mode=t;break e}if(f>>>=x,p-=x,x=s-a,M>x){if(x=M-x,x>u&&T.sane){e.msg="invalid distance too far back",T.mode=t;break e}if(S=0,_=h,0===d){if(S+=l-x,x2;)E[s++]=_[S++],E[s++]=_[S++],E[s++]=_[S++],w-=3;w&&(E[s++]=_[S++],w>1&&(E[s++]=_[S++]))}else{S=s-M;do{E[s++]=E[S++],E[s++]=E[S++],E[s++]=E[S++],w-=3}while(w>2);w&&(E[s++]=E[S++],w>1&&(E[s++]=E[S++]))}break}}break}}while(i>3,i-=w,p-=w<<3,f&=(1<{"use strict";const i=n(6069),r=n(2869),s=n(4264),a=n(9241),{Z_FINISH:o,Z_BLOCK:c,Z_TREES:l,Z_OK:u,Z_STREAM_END:d,Z_NEED_DICT:h,Z_STREAM_ERROR:f,Z_DATA_ERROR:p,Z_MEM_ERROR:m,Z_BUF_ERROR:g,Z_DEFLATED:v}=n(1619),y=16180,b=16190,x=16191,w=16192,M=16194,S=16199,_=16200,C=16206,E=16209,T=16210,L=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function A(){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 z=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode16211?1:0},R=e=>{if(z(e))return f;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=y,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,u},P=e=>{if(z(e))return f;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,R(e)},H=(e,t)=>{let n;if(z(e))return f;const i=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?f:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,P(e))},k=(e,t)=>{if(!e)return f;const n=new A;e.state=n,n.strm=e,n.window=null,n.mode=y;const i=H(e,t);return i!==u&&(e.state=null),i};let I,V,N=!0;const D=e=>{if(N){I=new Int32Array(512),V=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(a(1,e.lens,0,288,I,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,V,0,e.work,{bits:5}),N=!1}e.lencode=I,e.lenbits=9,e.distcode=V,e.distbits=5},O=(e,t,n,i)=>{let r;const s=e.state;return null===s.window&&(s.wsize=1<=s.wsize?(s.window.set(t.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>i&&(r=i),s.window.set(t.subarray(n-i,n-i+r),s.wnext),(i-=r)?(s.window.set(t.subarray(n-i,n),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whavek(e,15),e.exports.inflateInit2=k,e.exports.inflate=(e,t)=>{let n,A,R,P,H,k,I,V,N,F,B,U,W,G,j,q,$,X,K,Y,J,Z,Q=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(z(e)||!e.output||!e.input&&0!==e.avail_in)return f;n=e.state,n.mode===x&&(n.mode=w),H=e.next_out,R=e.output,I=e.avail_out,P=e.next_in,A=e.input,k=e.avail_in,V=n.hold,N=n.bits,F=k,B=I,Z=u;e:for(;;)switch(n.mode){case y:if(0===n.wrap){n.mode=w;break}for(;N<16;){if(0===k)break e;k--,V+=A[P++]<>>8&255,n.check=r(n.check,ee,2,0),V=0,N=0,n.mode=16181;break}if(n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&V)<<8)+(V>>8))%31){e.msg="incorrect header check",n.mode=E;break}if((15&V)!==v){e.msg="unknown compression method",n.mode=E;break}if(V>>>=4,N-=4,J=8+(15&V),0===n.wbits&&(n.wbits=J),J>15||J>n.wbits){e.msg="invalid window size",n.mode=E;break}n.dmax=1<>8&1),512&n.flags&&4&n.wrap&&(ee[0]=255&V,ee[1]=V>>>8&255,n.check=r(n.check,ee,2,0)),V=0,N=0,n.mode=16182;case 16182:for(;N<32;){if(0===k)break e;k--,V+=A[P++]<>>8&255,ee[2]=V>>>16&255,ee[3]=V>>>24&255,n.check=r(n.check,ee,4,0)),V=0,N=0,n.mode=16183;case 16183:for(;N<16;){if(0===k)break e;k--,V+=A[P++]<>8),512&n.flags&&4&n.wrap&&(ee[0]=255&V,ee[1]=V>>>8&255,n.check=r(n.check,ee,2,0)),V=0,N=0,n.mode=16184;case 16184:if(1024&n.flags){for(;N<16;){if(0===k)break e;k--,V+=A[P++]<>>8&255,n.check=r(n.check,ee,2,0)),V=0,N=0}else n.head&&(n.head.extra=null);n.mode=16185;case 16185:if(1024&n.flags&&(U=n.length,U>k&&(U=k),U&&(n.head&&(J=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(A.subarray(P,P+U),J)),512&n.flags&&4&n.wrap&&(n.check=r(n.check,A,U,P)),k-=U,P+=U,n.length-=U),n.length))break e;n.length=0,n.mode=16186;case 16186:if(2048&n.flags){if(0===k)break e;U=0;do{J=A[P+U++],n.head&&J&&n.length<65536&&(n.head.name+=String.fromCharCode(J))}while(J&&U>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=x;break;case 16189:for(;N<32;){if(0===k)break e;k--,V+=A[P++]<>>=7&N,N-=7&N,n.mode=C;break}for(;N<3;){if(0===k)break e;k--,V+=A[P++]<>>=1,N-=1,3&V){case 0:n.mode=16193;break;case 1:if(D(n),n.mode=S,t===l){V>>>=2,N-=2;break e}break;case 2:n.mode=16196;break;case 3:e.msg="invalid block type",n.mode=E}V>>>=2,N-=2;break;case 16193:for(V>>>=7&N,N-=7&N;N<32;){if(0===k)break e;k--,V+=A[P++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=E;break}if(n.length=65535&V,V=0,N=0,n.mode=M,t===l)break e;case M:n.mode=16195;case 16195:if(U=n.length,U){if(U>k&&(U=k),U>I&&(U=I),0===U)break e;R.set(A.subarray(P,P+U),H),k-=U,P+=U,I-=U,H+=U,n.length-=U;break}n.mode=x;break;case 16196:for(;N<14;){if(0===k)break e;k--,V+=A[P++]<>>=5,N-=5,n.ndist=1+(31&V),V>>>=5,N-=5,n.ncode=4+(15&V),V>>>=4,N-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=E;break}n.have=0,n.mode=16197;case 16197:for(;n.have>>=3,N-=3}for(;n.have<19;)n.lens[ie[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,te={bits:n.lenbits},Z=a(0,n.lens,0,19,n.lencode,0,n.work,te),n.lenbits=te.bits,Z){e.msg="invalid code lengths set",n.mode=E;break}n.have=0,n.mode=16198;case 16198:for(;n.have>>24,q=Q>>>16&255,$=65535&Q,!(j<=N);){if(0===k)break e;k--,V+=A[P++]<>>=j,N-=j,n.lens[n.have++]=$;else{if(16===$){for(ne=j+2;N>>=j,N-=j,0===n.have){e.msg="invalid bit length repeat",n.mode=E;break}J=n.lens[n.have-1],U=3+(3&V),V>>>=2,N-=2}else if(17===$){for(ne=j+3;N>>=j,N-=j,J=0,U=3+(7&V),V>>>=3,N-=3}else{for(ne=j+7;N>>=j,N-=j,J=0,U=11+(127&V),V>>>=7,N-=7}if(n.have+U>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=E;break}for(;U--;)n.lens[n.have++]=J}}if(n.mode===E)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=E;break}if(n.lenbits=9,te={bits:n.lenbits},Z=a(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=E;break}if(n.distbits=6,n.distcode=n.distdyn,te={bits:n.distbits},Z=a(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=E;break}if(n.mode=S,t===l)break e;case S:n.mode=_;case _:if(k>=6&&I>=258){e.next_out=H,e.avail_out=I,e.next_in=P,e.avail_in=k,n.hold=V,n.bits=N,s(e,B),H=e.next_out,R=e.output,I=e.avail_out,P=e.next_in,A=e.input,k=e.avail_in,V=n.hold,N=n.bits,n.mode===x&&(n.back=-1);break}for(n.back=0;Q=n.lencode[V&(1<>>24,q=Q>>>16&255,$=65535&Q,!(j<=N);){if(0===k)break e;k--,V+=A[P++]<>X)],j=Q>>>24,q=Q>>>16&255,$=65535&Q,!(X+j<=N);){if(0===k)break e;k--,V+=A[P++]<>>=X,N-=X,n.back+=X}if(V>>>=j,N-=j,n.back+=j,n.length=$,0===q){n.mode=16205;break}if(32&q){n.back=-1,n.mode=x;break}if(64&q){e.msg="invalid literal/length code",n.mode=E;break}n.extra=15&q,n.mode=16201;case 16201:if(n.extra){for(ne=n.extra;N>>=n.extra,N-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=16202;case 16202:for(;Q=n.distcode[V&(1<>>24,q=Q>>>16&255,$=65535&Q,!(j<=N);){if(0===k)break e;k--,V+=A[P++]<>X)],j=Q>>>24,q=Q>>>16&255,$=65535&Q,!(X+j<=N);){if(0===k)break e;k--,V+=A[P++]<>>=X,N-=X,n.back+=X}if(V>>>=j,N-=j,n.back+=j,64&q){e.msg="invalid distance code",n.mode=E;break}n.offset=$,n.extra=15&q,n.mode=16203;case 16203:if(n.extra){for(ne=n.extra;N>>=n.extra,N-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=E;break}n.mode=16204;case 16204:if(0===I)break e;if(U=B-I,n.offset>U){if(U=n.offset-U,U>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=E;break}U>n.wnext?(U-=n.wnext,W=n.wsize-U):W=n.wnext-U,U>n.length&&(U=n.length),G=n.window}else G=R,W=H-n.offset,U=n.length;U>I&&(U=I),I-=U,n.length-=U;do{R[H++]=G[W++]}while(--U);0===n.length&&(n.mode=_);break;case 16205:if(0===I)break e;R[H++]=n.length,I--,n.mode=_;break;case C:if(n.wrap){for(;N<32;){if(0===k)break e;k--,V|=A[P++]<{if(z(e))return f;let t=e.state;return t.window&&(t.window=null),e.state=null,u},e.exports.inflateGetHeader=(e,t)=>{if(z(e))return f;const n=e.state;return 0==(2&n.wrap)?f:(n.head=t,t.done=!1,u)},e.exports.inflateSetDictionary=(e,t)=>{const n=t.length;let r,s,a;return z(e)?f:(r=e.state,0!==r.wrap&&r.mode!==b?f:r.mode===b&&(s=1,s=i(s,t,n,0),s!==r.check)?p:(a=O(e,t,n,n),a?(r.mode=T,m):(r.havedict=1,u)))},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,s,a,o,c,l,u,d)=>{const h=d.bits;let f,p,m,g,v,y,b=0,x=0,w=0,M=0,S=0,_=0,C=0,E=0,T=0,L=0,A=null;const z=new Uint16Array(16),R=new Uint16Array(16);let P,H,k,I=null;for(b=0;b<=15;b++)z[b]=0;for(x=0;x=1&&0===z[M];M--);if(S>M&&(S=M),0===M)return c[l++]=20971520,c[l++]=20971520,d.bits=1,0;for(w=1;w0&&(0===e||1!==M))return-1;for(R[1]=0,b=1;b<15;b++)R[b+1]=R[b]+z[b];for(x=0;x852||2===e&&T>592)return 1;for(;;){P=b-C,u[x]+1=y?(H=I[u[x]-y],k=A[u[x]-y]):(H=96,k=0),f=1<>C)+p]=P<<24|H<<16|k|0}while(0!==p);for(f=1<>=1;if(0!==f?(L&=f-1,L+=f):L=0,x++,0==--z[b]){if(b===M)break;b=s[a+u[x]]}if(b>S&&(L&g)!==m){for(0===C&&(C=S),v+=w,_=b-C,E=1<<_;_+C852||2===e&&T>592)return 1;m=L&g,c[m]=S<<24|_<<16|v-l|0}}return 0!==L&&(c[v+L]=b-C<<24|64<<16|0),d.bits=S,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]),s=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=new Array(576);t(a);const o=new Array(60);t(o);const c=new Array(512);t(c);const l=new Array(256);t(l);const u=new Array(29);t(u);const d=new Array(30);function 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 f,p,m;function g(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}t(d);const v=e=>e<256?c[e]:c[256+(e>>>7)],y=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},b=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<{b(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},M=(e,t,n)=>{const i=new Array(16);let r,s,a=0;for(r=1;r<=15;r++)a=a+n[r-1]<<1,i[r]=a;for(s=0;s<=t;s++){let t=e[2*s+1];0!==t&&(e[2*s]=w(i[t]++,t))}},S=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.bi_valid>8?y(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},C=(e,t,n,i)=>{const r=2*t,s=2*n;return e[r]{const i=e.heap[n];let r=n<<1;for(;r<=e.heap_len&&(r{let s,a,o,c,h=0;if(0!==e.sym_next)do{s=255&e.pending_buf[e.sym_buf+h++],s+=(255&e.pending_buf[e.sym_buf+h++])<<8,a=e.pending_buf[e.sym_buf+h++],0===s?x(e,a,t):(o=l[a],x(e,o+256+1,t),c=n[o],0!==c&&(a-=u[o],b(e,a,c)),s--,o=v(s),x(e,o,r),c=i[o],0!==c&&(s-=d[o],b(e,s,c)))}while(h{const n=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.elems;let a,o,c,l=-1;for(e.heap_len=0,e.heap_max=573,a=0;a>1;a>=1;a--)E(e,n,a);c=s;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],E(e,n,1),o=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=o,n[2*c]=n[2*a]+n[2*o],e.depth[c]=(e.depth[a]>=e.depth[o]?e.depth[a]:e.depth[o])+1,n[2*a+1]=n[2*o+1]=c,e.heap[1]=c++,E(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,s=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,c=t.stat_desc.max_length;let l,u,d,h,f,p,m=0;for(h=0;h<=15;h++)e.bl_count[h]=0;for(n[2*e.heap[e.heap_max]+1]=0,l=e.heap_max+1;l<573;l++)u=e.heap[l],h=n[2*n[2*u+1]+1]+1,h>c&&(h=c,m++),n[2*u+1]=h,u>i||(e.bl_count[h]++,f=0,u>=o&&(f=a[u-o]),p=n[2*u],e.opt_len+=p*(h+f),s&&(e.static_len+=p*(r[2*u+1]+f)));if(0!==m){do{for(h=c-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[c]--,m-=2}while(m>0);for(h=c;0!==h;h--)for(u=e.bl_count[h];0!==u;)d=e.heap[--l],d>i||(n[2*d+1]!==h&&(e.opt_len+=(h-n[2*d+1])*n[2*d],n[2*d+1]=h),u--)}})(e,t),M(n,l,e.bl_count)},A=(e,t,n)=>{let i,r,s=-1,a=t[1],o=0,c=7,l=4;for(0===a&&(c=138,l=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)r=a,a=t[2*(i+1)+1],++o{let i,r,s=-1,a=t[1],o=0,c=7,l=4;for(0===a&&(c=138,l=3),i=0;i<=n;i++)if(r=a,a=t[2*(i+1)+1],!(++o{b(e,0+(i?1:0),3),_(e),y(e,n),y(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};e.exports._tr_init=e=>{R||((()=>{let e,t,s,g,v;const y=new Array(16);for(s=0,g=0;g<28;g++)for(u[g]=s,e=0;e<1<>=7;g<30;g++)for(d[g]=v<<7,e=0;e<1<{let r,c,l=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,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)),L(e,e.l_desc),L(e,e.d_desc),l=(e=>{let t;for(A(e,e.dyn_ltree,e.l_desc.max_code),A(e,e.dyn_dtree,e.d_desc.max_code),L(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*s[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,c=e.static_len+3+7>>>3,c<=r&&(r=c)):r=c=n+5,n+4<=r&&-1!==t?P(e,t,n,i):4===e.strategy||c===r?(b(e,2+(i?1:0),3),T(e,a,o)):(b(e,4+(i?1:0),3),((e,t,n,i)=>{let r;for(b(e,t-257,5),b(e,n-1,5),b(e,i-4,4),r=0;r(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*(l[n]+256+1)]++,e.dyn_dtree[2*v(t)]++),e.sym_next===e.sym_end),e.exports._tr_align=e=>{b(e,2,3),x(e,256,a),(e=>{16===e.bi_valid?(y(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 s(){throw new Error("clearTimeout has not been defined")}function a(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:s}catch(e){n=s}}();var o,c=[],l=!1,u=-1;function d(){l&&o&&(l=!1,o.length?c=o.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(o=c,c=[];++u1)for(var n=1;n{"use strict";var i=n(414);function r(){}function s(){}s.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,s,a){if(a!==i){var o=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:r};return n.PropTypes=n,n}},5697:(e,t,n)=>{e.exports=n(2703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},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=c;var i,r=n(9693),s=r.LongBits,a=r.utf8;function o(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},d=function(){return r.Buffer?function(e){return(c.create=function(e){return r.Buffer.isBuffer(e)?new i(e):u(e)})(e)}:u};function h(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw o(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw o(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function f(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw o(this,8);return new s(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}c.create=d(),c.prototype._slice=r.Array.prototype.subarray||r.Array.prototype.slice,c.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return l}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return f(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return 0|f(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var e=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var e=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw o(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)},c.prototype.string=function(){var e=this.bytes();return a.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw o(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw o(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){i=e,c.create=d(),i._configure();var t=r.Long?"toLong":"toNumber";r.merge(c.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 p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},593:(e,t,n)=>{"use strict";e.exports=s;var i=n(1408);(s.prototype=Object.create(i.prototype)).constructor=s;var r=n(9693);function s(e){i.call(this,e)}s._configure=function(){r.Buffer&&(s.prototype._slice=r.Buffer.prototype.slice)},s.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))},s._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,s,a){if(!s)throw TypeError("request must be specified");var o=this;if(!a)return i.asPromise(e,o,t,n,r,s);if(o.rpcImpl)try{return o.rpcImpl(t,n[o.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,n){if(e)return o.emit("error",e,t),a(e);if(null!==n){if(!(n instanceof r))try{n=r[o.responseDelimited?"decodeDelimited":"decode"](n)}catch(e){return o.emit("error",e,t),a(e)}return o.emit("data",n,t),a(null,n)}o.end(!0)}))}catch(e){return o.emit("error",e,t),void setTimeout((function(){a(e)}),0)}else setTimeout((function(){a(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 s=r.zero=new r(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var a=r.zeroHash="\0\0\0\0\0\0\0\0";r.fromNumber=function(e){if(0===e)return s;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):s},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 o=String.prototype.charCodeAt;r.fromHash=function(e){return e===a?s:new r((o.call(e,0)|o.call(e,1)<<8|o.call(e,2)<<16|o.call(e,3)<<24)>>>0,(o.call(e,4)|o.call(e,5)<<8|o.call(e,6)<<16|o.call(e,7)<<24)>>>0)},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;r0)},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=s,i.ProtocolError=s("ProtocolError"),i.oneOfGetter=function(e){for(var t={},n=0;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{"use strict";e.exports=d;var i,r=n(9693),s=r.LongBits,a=r.base64,o=r.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function d(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var h=function(){return r.Buffer?function(){return(d.create=function(){return new i})()}:function(){return new d}};function f(e,t,n){t[n]=255&e}function p(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}d.create=h(),d.alloc=function(e){return new r.Array(e)},r.Array!==Array&&(d.alloc=r.pool(d.alloc,r.Array.prototype.subarray)),d.prototype._push=function(e,t,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},d.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},d.prototype.int32=function(e){return e<0?this._push(m,10,s.fromNumber(e)):this.uint32(e)},d.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},d.prototype.uint64=function(e){var t=s.from(e);return this._push(m,t.length(),t)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(m,t.length(),t)},d.prototype.bool=function(e){return this._push(f,1,e?1:0)},d.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(e){var t=s.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(e){return this._push(r.float.writeFloatLE,4,e)},d.prototype.double=function(e){return this._push(r.float.writeDoubleLE,8,e)};var v=r.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var i=0;i>>0;if(!t)return this._push(f,1,0);if(r.isString(e)){var n=d.alloc(t=a.length(e));a.decode(e,n,0),e=n}return this.uint32(t)._push(v,t,e)},d.prototype.string=function(e){var t=o.length(e);return t?this.uint32(t)._push(o.write,t,e):this._push(f,1,0)},d.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},d.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},d.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},d._configure=function(e){i=e,d.create=h(),i._configure()}},3155:(e,t,n)=>{"use strict";e.exports=s;var i=n(1173);(s.prototype=Object.create(i.prototype)).constructor=s;var r=n(9693);function s(){i.call(this)}function a(e,t,n){e.length<40?r.utf8.write(e,t,n):t.utf8Write?t.utf8Write(e,n):t.write(e,n)}s._configure=function(){s.alloc=r._Buffer_allocUnsafe,s.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>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=r.Buffer.byteLength(e);return this.uint32(t),t&&this._push(a,t,e),this},s._configure()},4448:(e,t,n)=>{"use strict";var i=n(7294),r=n(3840);function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n